Create new class SimulationAbort to represent reasons for sim aborts

This commit is contained in:
JoePfeiffer 2023-12-23 17:42:09 -07:00
parent 85bac6484e
commit 64e999f2e2
2 changed files with 65 additions and 1 deletions

View File

@ -654,9 +654,16 @@ BasicEventSimulationEngine.error.noConfiguredIgnition = No motors configured to
BasicEventSimulationEngine.error.noIgnition = No motors ignited.
BasicEventSimulationEngine.error.NaNResult = Simulation resulted in not-a-number (NaN) value, please report a bug.
RK4SimulationStepper.error.valuesTooLarge = Simulation values exceeded limits. Try selecting a shorter time step.
SimulationAbort.noMotorsDefined = No motors defined in the simulation
SimulationAbort.noConfiguredIgnition = No motors configured to ignite at liftoff
SimulationAbort.noIgnition = No motors ignited
SimulationAbort.noLiftOff = <html>Motor burnout without liftoff.<br>Use more (powerful) motors, or decrease the rocket mass.</html>
SimulationAbort.activeLengthZero = Active airframe has length 0
SimulationAbort.noCP = Can't calculate Center of Pressure
SimulationAbort.totalMassZero = Total mass of active stages is 0
SimulationModifierTree.OptimizationParameters = Optimization Parameters
SimulationStepper.error.totalMassZero = Total mass of active states is 0

View File

@ -0,0 +1,57 @@
package net.sf.openrocket.logging;
import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.startup.Application;
/**
* Class for logging errors causing a simulation to fail
*/
public class SimulationAbort extends Message {
private static final Translator trans = Application.getTranslator();
private final String description;
SimulationAbort(String _description) {
description = _description;
}
@Override
public String getMessageDescription() {
return description;
}
@Override
public boolean replaceBy(Message other) {
return false;
}
/**
* Possible causes of sim aborts
*/
// No motors are defined in the sim configuration
public static final SimulationAbort NOMOTORSDEFINED = new SimulationAbort(trans.get("SimulationAbort.noMotorsDefined"));
// Motors are defined, but none are configured to fire at liftoff
public static final SimulationAbort NOCONFIGUREDIGNITION = new SimulationAbort(trans.get("SimulationAbort.noConfiguredIgnition"));
// No motors fired (can this really happen without getting a NoMotorsDefined?)
public static final SimulationAbort NOMOTORSFIRED = new SimulationAbort(trans.get("SimulationAbort.noMotorsIgnited"));
// Motors ignited, but rocket did not lift off
public static final SimulationAbort NOLIFTOFF = new SimulationAbort(trans.get("SimulationAbort.noLiftOff"));
// It is impossible to calculate the stage's center of pressure
public static final SimulationAbort NOCP = new SimulationAbort(trans.get("SimulationAbort.noCP"));
// The currently active components have a total length of 0
public static final SimulationAbort ACTIVELENGTHZERO = new SimulationAbort(trans.get("SimulationAbort.activeLengthZero"));
// The currently active components have a total mass of 0
public static final SimulationAbort ACTIVEMASSZERO = new SimulationAbort(trans.get("SimulationAbort.activeMassZero"));
}