Move calculation of summary data to a "finally" block so we display what we can, even if there was an exception during the simulation. In particular, if the exception happened in a branch other than the sustainer branch we still get all our summary data.
Added a commented-out bit of code forcing an exception for testing purposes. Since many former exceptions are now sim aborts, there isn't a reliable way to create a broken rocket design to test exception behavior -- which is a good thing!
This commit is contained in:
parent
64832fe8d6
commit
9a06464afe
@ -67,6 +67,7 @@ public class BasicEventSimulationEngine implements SimulationEngine {
|
|||||||
// Set up flight data
|
// Set up flight data
|
||||||
flightData = new FlightData();
|
flightData = new FlightData();
|
||||||
|
|
||||||
|
try {
|
||||||
// Set up rocket configuration
|
// Set up rocket configuration
|
||||||
this.fcid = simulationConditions.getFlightConfigurationID();
|
this.fcid = simulationConditions.getFlightConfigurationID();
|
||||||
FlightConfiguration origConfig = simulationConditions.getRocket().getFlightConfiguration(this.fcid);
|
FlightConfiguration origConfig = simulationConditions.getRocket().getFlightConfiguration(this.fcid);
|
||||||
@ -146,9 +147,12 @@ public class BasicEventSimulationEngine implements SimulationEngine {
|
|||||||
if (!flightData.getWarningSet().isEmpty()) {
|
if (!flightData.getWarningSet().isEmpty()) {
|
||||||
log.info("Warnings at the end of simulation: " + flightData.getWarningSet());
|
log.info("Warnings at the end of simulation: " + flightData.getWarningSet());
|
||||||
}
|
}
|
||||||
|
} catch (SimulationException e) {
|
||||||
|
throw e;
|
||||||
|
} finally {
|
||||||
flightData.calculateInterestingValues();
|
flightData.calculateInterestingValues();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void simulateLoop() throws SimulationException {
|
private void simulateLoop() throws SimulationException {
|
||||||
|
|
||||||
@ -291,9 +295,6 @@ public class BasicEventSimulationEngine implements SimulationEngine {
|
|||||||
|
|
||||||
flightData.getWarningSet().addAll(currentStatus.getWarnings());
|
flightData.getWarningSet().addAll(currentStatus.getWarnings());
|
||||||
|
|
||||||
//e.setFlightData(flightData);
|
|
||||||
//e.setFlightDataBranch(currentStatus.getFlightDataBranch());
|
|
||||||
|
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -698,6 +699,11 @@ public class BasicEventSimulationEngine implements SimulationEngine {
|
|||||||
currentStatus.abortSimulation(SimulationAbort.Cause.ACTIVE_LENGTH_ZERO);
|
currentStatus.abortSimulation(SimulationAbort.Cause.ACTIVE_LENGTH_ZERO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// test -- force an exception if we aren't the sustainer
|
||||||
|
if (currentStatus.getConfiguration().isStageActive(0)) {
|
||||||
|
throw new SimulationCalculationException("test", currentStatus.getFlightDataBranch());
|
||||||
|
}
|
||||||
|
|
||||||
// Can't calculate stability. If it's the sustainer we'll abort; if a booster
|
// Can't calculate stability. If it's the sustainer we'll abort; if a booster
|
||||||
// we'll just transition to tumbling (if it's a booster and under thrust code elsewhere
|
// we'll just transition to tumbling (if it's a booster and under thrust code elsewhere
|
||||||
// will abort).
|
// will abort).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user