Merge pull request #1436 from ptsongalis/unstable
Feature Request 1373 - Adds a warning when there is no recovery device for a simulation
This commit is contained in:
commit
1c129e64a1
@ -1787,6 +1787,7 @@ Warning.PARALLEL_FINS = Too many parallel fins
|
||||
Warning.SUPERSONIC = Body calculations may not be entirely accurate at supersonic speeds.
|
||||
Warning.RECOVERY_LAUNCH_ROD = Recovery device device deployed while on the launch guide.
|
||||
Warning.RECOVERY_HIGH_SPEED = Recovery device deployment at high speed
|
||||
Warning.NO_RECOVERY_DEVICE = No recovery device defined in the simulation.
|
||||
Warning.TUMBLE_UNDER_THRUST = Stage began to tumble under thrust.
|
||||
Warning.EVENT_AFTER_LANDING = Flight Event occurred after landing:
|
||||
Warning.ZERO_LENGTH_BODY = Zero length bodies may not result in accurate simulations.
|
||||
|
@ -375,6 +375,8 @@ public abstract class Warning {
|
||||
////Recovery device opened while motor still burning.
|
||||
public static final Warning RECOVERY_DEPLOYMENT_WHILE_BURNING = new Other(trans.get("Warning.RECOVERY_DEPLOYMENT_WHILE_BURNING"));
|
||||
|
||||
////No recovery device for simulation
|
||||
public static final Warning NO_RECOVERY_DEVICE = new Other(trans.get("Warning.NO_RECOVERY_DEVICE"));
|
||||
|
||||
//// Invalid parameter encountered, ignoring.
|
||||
public static final Warning FILE_INVALID_PARAMETER = new Other(trans.get("Warning.FILE_INVALID_PARAMETER"));
|
||||
|
@ -547,7 +547,18 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
||||
updateMotors();
|
||||
updateActiveInstances();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return true if rocket has a RecoveryDevice
|
||||
*/
|
||||
public boolean hasRecoveryDevice() {
|
||||
if (fcid.hasError()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.getRocket().hasRecoveryDevice();
|
||||
}
|
||||
|
||||
/////////////// Helper methods ///////////////
|
||||
|
||||
/**
|
||||
|
@ -427,6 +427,19 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if any of this component's children are a RecoveryDevice
|
||||
*/
|
||||
public boolean hasRecoveryDevice() {
|
||||
Iterator<RocketComponent> iterator = this.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
RocketComponent child = iterator.next();
|
||||
if (child instanceof RecoveryDevice) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////// Methods that may not be overridden ////////////
|
||||
|
||||
|
@ -344,6 +344,11 @@ public class BasicEventSimulationEngine implements SimulationEngine {
|
||||
}
|
||||
}
|
||||
|
||||
// Add a warning if there is no recovery device defined.
|
||||
if (!currentStatus.getConfiguration().hasRecoveryDevice()) {
|
||||
currentStatus.getWarnings().add(Warning.NO_RECOVERY_DEVICE);
|
||||
}
|
||||
|
||||
// Handle event
|
||||
log.trace("Handling event " + event);
|
||||
switch (event.getType()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user