Create new SIM_ABORT FlightEvent

This commit is contained in:
JoePfeiffer 2023-12-24 06:20:21 -07:00
parent 64e999f2e2
commit 2123531f14
2 changed files with 14 additions and 1 deletions

View File

@ -1964,6 +1964,7 @@ FlightEvent.Type.STAGE_SEPARATION = Stage separation
FlightEvent.Type.APOGEE = Apogee
FlightEvent.Type.RECOVERY_DEVICE_DEPLOYMENT = Recovery device deployment
FlightEvent.Type.GROUND_HIT = Ground hit
FlightEvent.Type.SIM_ABORT = Simulation abort
FlightEvent.Type.SIMULATION_END = Simulation end
FlightEvent.Type.ALTITUDE = Altitude change
FlightEvent.Type.TUMBLE = Tumbling

View File

@ -1,6 +1,7 @@
package net.sf.openrocket.simulation;
import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.logging.SimulationAbort;
import net.sf.openrocket.rocketcomponent.AxialStage;
import net.sf.openrocket.rocketcomponent.MotorMount;
import net.sf.openrocket.rocketcomponent.RocketComponent;
@ -80,9 +81,15 @@ public class FlightEvent implements Comparable<FlightEvent> {
* The rocket begins to tumble.
*/
TUMBLE(trans.get("FlightEvent.Type.TUMBLE")),
/**
* It is impossible for the simulation proceed due to characteristics
* of the rocket or flight configuration
*/
SIM_ABORT(trans.get("FlightEvent.Type.SIM_ABORT")),
/**
* Simulation aborted
* Simulation exception thrown due to error in OpenRocket code
*/
EXCEPTION(trans.get("FlightEvent.Type.EXCEPTION"));
@ -239,6 +246,11 @@ public class FlightEvent implements Comparable<FlightEvent> {
}
}
break;
case SIM_ABORT:
if (( null == this.data ) || ( ! ( this.data instanceof SimulationAbort ))) {
throw new IllegalStateException(type.name()+" events require SimulationAbort objects");
}
break;
case LAUNCH:
case LIFTOFF:
case LAUNCHROD: