commit
62d0305e86
@ -1827,6 +1827,7 @@ Warning.ZERO_LENGTH_BODY = Zero length bodies may not result in accurate simulat
|
||||
Warning.ZERO_RADIUS_BODY = Zero length bodies may not result in accurate simulations.
|
||||
Warning.TUBE_SEPARATION = Space between tube fins may not result in accurate simulations.
|
||||
Warning.TUBE_OVERLAP = Overlapping tube fins may not result in accurate simulations.
|
||||
Warning.SEPARATION_ORDER = Stages separated in an unreasonable order
|
||||
|
||||
! Scale dialog
|
||||
ScaleDialog.lbl.scaleRocket = Entire rocket
|
||||
|
@ -396,4 +396,6 @@ public abstract class Warning {
|
||||
|
||||
public static final Warning TUBE_SEPARATION = new Other(trans.get("Warning.TUBE_SEPARATION"));
|
||||
public static final Warning TUBE_OVERLAP = new Other(trans.get("Warning.TUBE_OVERLAP"));
|
||||
|
||||
public static final Warning SEPARATION_ORDER = new Other(trans.get("Warning.SEPARATION_ORDER"));
|
||||
}
|
||||
|
@ -146,6 +146,34 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
||||
updateMotors();
|
||||
updateActiveInstances();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method clears a stage and all stages below (higher stage number)
|
||||
*
|
||||
* @param stageNumber first stage number to turn off
|
||||
*/
|
||||
public void clearStagesBelow(int stageNumber) {
|
||||
// I can't just use _setStageActive(stageNumber, false, true)
|
||||
// because that won't clear side boosters' active flags (should it?)
|
||||
for (int i = stageNumber; i < rocket.getStageCount(); i++) {
|
||||
_setStageActive(i, false, false);
|
||||
}
|
||||
updateMotors();
|
||||
updateActiveInstances();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method clears all stages above (but not including) a stage
|
||||
*
|
||||
* @param stageNumber first stage number to stay active
|
||||
*/
|
||||
public void clearStagesAbove(int stageNumber) {
|
||||
for (int i = 0; i < stageNumber; i++) {
|
||||
_setStageActive(i, false, false);
|
||||
}
|
||||
updateMotors();
|
||||
updateActiveInstances();
|
||||
}
|
||||
|
||||
/**
|
||||
* Activates all stages as active starting from the specified component
|
||||
@ -187,7 +215,7 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
||||
}
|
||||
|
||||
/**
|
||||
* This method flags the specified stage as requested. Other stages are unaffected.
|
||||
* This method flags the specified stage as requested. Substages may be affected, depending on third parameter
|
||||
*
|
||||
* @param stageNumber stage number to flag
|
||||
* @param _active inactive (<code>false</code>) or active (<code>true</code>)
|
||||
|
@ -305,6 +305,9 @@ public class BasicEventSimulationEngine implements SimulationEngine {
|
||||
if (event.getSource() != null && event.getSource().getParent() != null &&
|
||||
!currentStatus.getConfiguration().isComponentActive(event.getSource())) {
|
||||
log.trace("Ignoring event from unattached component");
|
||||
log.debug(" source " + event.getSource());
|
||||
log.debug(" parent " + event.getSource().getParent());
|
||||
log.debug(" active " + currentStatus.getConfiguration().isComponentActive(event.getSource()));
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -381,7 +384,6 @@ public class BasicEventSimulationEngine implements SimulationEngine {
|
||||
}
|
||||
|
||||
// and queue up the burnout for this motor, as well.
|
||||
// double duration = motorState.getMotor().getBurnTimeEstimate();
|
||||
double duration = motorState.getBurnTime();
|
||||
double burnout = currentStatus.getSimulationTime() + duration;
|
||||
addEvent(new FlightEvent(FlightEvent.Type.BURNOUT, burnout,
|
||||
@ -436,19 +438,36 @@ public class BasicEventSimulationEngine implements SimulationEngine {
|
||||
case STAGE_SEPARATION: {
|
||||
RocketComponent boosterStage = event.getSource();
|
||||
final int stageNumber = boosterStage.getStageNumber();
|
||||
log.debug("separating at stage " + stageNumber);
|
||||
|
||||
if (currentStatus.getConfiguration().isStageActive(stageNumber-1)) {
|
||||
// Record the event.
|
||||
currentStatus.getFlightData().addEvent(event);
|
||||
|
||||
// Mark the status as having dropped the booster
|
||||
currentStatus.getConfiguration().clearStage( stageNumber);
|
||||
|
||||
// Prepare the simulation branch
|
||||
// If I've got something other than one active stage below the separation point,
|
||||
// flag a warning
|
||||
int numActiveBelow = 0;
|
||||
for (int i = stageNumber; i < currentStatus.getConfiguration().getStageCount(); i++) {
|
||||
if (currentStatus.getConfiguration().isStageActive(i)) {
|
||||
numActiveBelow++;
|
||||
}
|
||||
}
|
||||
if (numActiveBelow != 1) {
|
||||
currentStatus.getWarnings().add(Warning.SEPARATION_ORDER);
|
||||
}
|
||||
|
||||
// Create a new simulation branch for the booster
|
||||
SimulationStatus boosterStatus = new SimulationStatus(currentStatus);
|
||||
|
||||
// Prepare the new simulation branch
|
||||
boosterStatus.setFlightData(new FlightDataBranch(boosterStage.getName(), FlightDataType.TYPE_TIME));
|
||||
// Mark the booster status as only having the booster.
|
||||
boosterStatus.getConfiguration().setOnlyStage(stageNumber);
|
||||
|
||||
// Mark the current status as having dropped the current stage and all stages below it
|
||||
currentStatus.getConfiguration().clearStagesBelow( stageNumber);
|
||||
|
||||
// Mark the booster status as having no active stages above
|
||||
boosterStatus.getConfiguration().clearStagesAbove(stageNumber);
|
||||
|
||||
toSimulate.push(boosterStatus);
|
||||
log.info(String.format("==>> @ %g; from Branch: %s ---- Branching: %s ---- \n",
|
||||
currentStatus.getSimulationTime(),
|
||||
|
@ -13,8 +13,11 @@ public class BasicTumbleStepper extends AbstractSimulationStepper {
|
||||
private static final double RECOVERY_TIME_STEP = 0.5;
|
||||
|
||||
@Override
|
||||
public SimulationStatus initialize(SimulationStatus status) {
|
||||
return new BasicTumbleStatus(status);
|
||||
public SimulationStatus initialize(SimulationStatus original) {
|
||||
BasicTumbleStatus status = new BasicTumbleStatus(original);
|
||||
status.setWarnings(original.getWarnings());
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user