Merge pull request #1236 from JoePfeiffer/fix-1226

Check for active upper stage before dropping booster
This commit is contained in:
SiboVG 2022-03-14 03:59:17 +01:00 committed by GitHub
commit 21b099d08f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 // Mark the status as having dropped the booster
SimulationStatus boosterStatus = new SimulationStatus(currentStatus); currentStatus.getConfiguration().clearStage( stageNumber);
boosterStatus.setFlightData(new FlightDataBranch(boosterStage.getName(), FlightDataType.TYPE_TIME));
// Mark the booster status as only having the booster. // Prepare the simulation branch
boosterStatus.getConfiguration().setOnlyStage(stageNumber); SimulationStatus boosterStatus = new SimulationStatus(currentStatus);
toSimulate.push(boosterStatus); boosterStatus.setFlightData(new FlightDataBranch(boosterStage.getName(), FlightDataType.TYPE_TIME));
log.info(String.format("==>> @ %g; from Branch: %s ---- Branching: %s ---- \n", // Mark the booster status as only having the booster.
currentStatus.getSimulationTime(), boosterStatus.getConfiguration().setOnlyStage(stageNumber);
currentStatus.getFlightData().getBranchName(), boosterStatus.getFlightData().getBranchName())); 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;
} }