Check for active upper stage before dropping booster
If there are multiple independent motor clusters in a stage, each of them can attempt a separation event. When the second event happens, there is no longer an active upper stage, so the separation results in a simulation branch with no active stages. This causes a NaN exception as the mass is 0.
This commit is contained in:
parent
f8f0e5d12c
commit
5ac829ea78
@ -425,24 +425,28 @@ public class BasicEventSimulationEngine implements SimulationEngine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case STAGE_SEPARATION: {
|
case STAGE_SEPARATION: {
|
||||||
// Record the event.
|
|
||||||
currentStatus.getFlightData().addEvent(event);
|
|
||||||
|
|
||||||
RocketComponent boosterStage = event.getSource();
|
RocketComponent boosterStage = event.getSource();
|
||||||
final int stageNumber = boosterStage.getStageNumber();
|
final int stageNumber = boosterStage.getStageNumber();
|
||||||
|
|
||||||
// Mark the status as having dropped the booster
|
if (currentStatus.getConfiguration().isStageActive(stageNumber-1)) {
|
||||||
currentStatus.getConfiguration().clearStage( stageNumber);
|
// Record the event.
|
||||||
|
currentStatus.getFlightData().addEvent(event);
|
||||||
// Prepare the simulation branch
|
|
||||||
SimulationStatus boosterStatus = new SimulationStatus(currentStatus);
|
// Mark the status as having dropped the booster
|
||||||
boosterStatus.setFlightData(new FlightDataBranch(boosterStage.getName(), FlightDataType.TYPE_TIME));
|
currentStatus.getConfiguration().clearStage( stageNumber);
|
||||||
// Mark the booster status as only having the booster.
|
|
||||||
boosterStatus.getConfiguration().setOnlyStage(stageNumber);
|
// Prepare the simulation branch
|
||||||
toSimulate.push(boosterStatus);
|
SimulationStatus boosterStatus = new SimulationStatus(currentStatus);
|
||||||
log.info(String.format("==>> @ %g; from Branch: %s ---- Branching: %s ---- \n",
|
boosterStatus.setFlightData(new FlightDataBranch(boosterStage.getName(), FlightDataType.TYPE_TIME));
|
||||||
currentStatus.getSimulationTime(),
|
// Mark the booster status as only having the booster.
|
||||||
currentStatus.getFlightData().getBranchName(), boosterStatus.getFlightData().getBranchName()));
|
boosterStatus.getConfiguration().setOnlyStage(stageNumber);
|
||||||
|
toSimulate.push(boosterStatus);
|
||||||
|
log.info(String.format("==>> @ %g; from Branch: %s ---- Branching: %s ---- \n",
|
||||||
|
currentStatus.getSimulationTime(),
|
||||||
|
currentStatus.getFlightData().getBranchName(), boosterStatus.getFlightData().getBranchName()));
|
||||||
|
} else {
|
||||||
|
log.debug("upper stage is not active; not performing separation");
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user