Put underscores in SimulationAbort enum constants for readability

This commit is contained in:
JoePfeiffer 2024-01-11 09:42:46 -07:00
parent c803104a16
commit 00babafc7a
4 changed files with 15 additions and 15 deletions

View File

@ -28,25 +28,25 @@ public class SimulationAbort extends Message {
NO_ACTIVE_STAGES(trans.get("SimulationAbort.noActiveStages")),
// No motors are defined in the sim configuration
NOMOTORSDEFINED(trans.get("SimulationAbort.noMotorsDefined")),
NO_MOTORS_DEFINED(trans.get("SimulationAbort.noMotorsDefined")),
// Motors are defined, but none are configured to fire at liftoff
NOCONFIGUREDIGNITION(trans.get("SimulationAbort.noConfiguredIgnition")),
NO_CONFIGURED_IGNITION(trans.get("SimulationAbort.noConfiguredIgnition")),
// No motors fired (can this really happen without getting a NoMotorsDefined?)
NOMOTORSFIRED(trans.get("SimulationAbort.noIgnition")),
NO_MOTORS_FIRED(trans.get("SimulationAbort.noIgnition")),
// Motors ignited, but rocket did not lift off
NOLIFTOFF(trans.get("SimulationAbort.noLiftOff")),
NO_LIFTOFF(trans.get("SimulationAbort.noLiftOff")),
// It is impossible to calculate the active components' center of pressure
NOCP(trans.get("SimulationAbort.noCP")),
NO_CP(trans.get("SimulationAbort.noCP")),
// The currently active components have a total length of 0
ACTIVELENGTHZERO(trans.get("SimulationAbort.activeLengthZero")),
ACTIVE_LENGTH_ZERO(trans.get("SimulationAbort.activeLengthZero")),
// The currently active components have a total mass of 0
ACTIVEMASSZERO(trans.get("SimulationAbort.activeMassZero")),
ACTIVE_MASS_ZERO(trans.get("SimulationAbort.activeMassZero")),
// Stage is tumbling under thrust
TUMBLE_UNDER_THRUST(trans.get("SimulationAbort.tumbleUnderThrust"));

View File

@ -103,7 +103,7 @@ public class BasicEventSimulationEngine implements SimulationEngine {
// No motors in configuration
if (!simulationConfig.hasMotors() ) {
currentStatus.abortSimulation(SimulationAbort.Cause.NOMOTORSDEFINED);
currentStatus.abortSimulation(SimulationAbort.Cause.NO_MOTORS_DEFINED);
}
// Problems that let us simulate, but result is likely bad
@ -462,7 +462,7 @@ public class BasicEventSimulationEngine implements SimulationEngine {
case BURNOUT: {
// If motor burnout occurs without lift-off, abort
if (!currentStatus.isLiftoff()) {
currentStatus.abortSimulation(SimulationAbort.Cause.NOLIFTOFF);
currentStatus.abortSimulation(SimulationAbort.Cause.NO_LIFTOFF);
}
// Add ejection charge event
@ -656,7 +656,7 @@ public class BasicEventSimulationEngine implements SimulationEngine {
// If no motor has ignited, abort
if (!currentStatus.isMotorIgnited()) {
// TODO MEDIUM: display this as a warning to the user (e.g. highlight the cell in the simulation panel in red and a hover: 'make sure the motor ignition is correct' or something)
currentStatus.abortSimulation(SimulationAbort.Cause.NOMOTORSFIRED);
currentStatus.abortSimulation(SimulationAbort.Cause.NO_MOTORS_FIRED);
}
return ret;
@ -696,7 +696,7 @@ public class BasicEventSimulationEngine implements SimulationEngine {
// Active stages have total length of 0.
if (currentStatus.getConfiguration().getLengthAerodynamic() < MathUtil.EPSILON) {
currentStatus.abortSimulation(SimulationAbort.Cause.ACTIVELENGTHZERO);
currentStatus.abortSimulation(SimulationAbort.Cause.ACTIVE_LENGTH_ZERO);
}
// Can't calculate stability. If it's the sustainer we'll abort; if a booster
@ -707,7 +707,7 @@ public class BasicEventSimulationEngine implements SimulationEngine {
new FlightConditions(currentStatus.getConfiguration()),
new WarningSet()).weight < MathUtil.EPSILON) {
if (currentStatus.getConfiguration().isStageActive(0)) {
currentStatus.abortSimulation(SimulationAbort.Cause.NOCP);
currentStatus.abortSimulation(SimulationAbort.Cause.NO_CP);
} else {
currentStatus.addEvent(new FlightEvent(FlightEvent.Type.TUMBLE, currentStatus.getSimulationTime()));
}

View File

@ -307,7 +307,7 @@ public class RK4SimulationStepper extends AbstractSimulationStepper {
store.rocketMass = structureMassData.add( store.motorMass );
if (store.rocketMass.getMass() < MathUtil.EPSILON) {
status.abortSimulation(SimulationAbort.Cause.ACTIVEMASSZERO);
status.abortSimulation(SimulationAbort.Cause.ACTIVE_MASS_ZERO);
}
// Calculate the forces from the aerodynamic coefficients

View File

@ -217,7 +217,7 @@ public class DisableStageTest extends BaseTestCase {
// There should be no motors left at this point, so we should abort on no motors
FlightEvent abort = simRemoved.getSimulatedData().getBranch(0).getLastEvent(FlightEvent.Type.SIM_ABORT);
Assert.assertNotNull("Empty simulation failed to abort", abort);
Assert.assertEquals("Abort cause did not match", SimulationAbort.Cause.NOMOTORSDEFINED, ((SimulationAbort)(abort.getData())).getCause());
Assert.assertEquals("Abort cause did not match", SimulationAbort.Cause.NO_MOTORS_DEFINED, ((SimulationAbort)(abort.getData())).getCause());
Simulation simDisabled = new Simulation(rocketDisabled);
simDisabled.setFlightConfigurationId(fid);
@ -233,7 +233,7 @@ public class DisableStageTest extends BaseTestCase {
// There should be no motors left at this point, so we should abort on no motors
abort = simDisabled.getSimulatedData().getBranch(0).getLastEvent(FlightEvent.Type.SIM_ABORT);
Assert.assertNotNull("Empty simulation failed to abort", abort);
Assert.assertEquals("Abort cause did not match", SimulationAbort.Cause.NOMOTORSDEFINED, ((SimulationAbort)(abort.getData())).getCause());
Assert.assertEquals("Abort cause did not match", SimulationAbort.Cause.NO_MOTORS_DEFINED, ((SimulationAbort)(abort.getData())).getCause());
//// Test re-enabling the stage.
Rocket rocketOriginal = TestRockets.makeFalcon9Heavy();