From 64e999f2e21c1835756f8068c43c084a1a9fd213 Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Sat, 23 Dec 2023 17:42:09 -0700 Subject: [PATCH] Create new class SimulationAbort to represent reasons for sim aborts --- core/resources/l10n/messages.properties | 9 ++- .../openrocket/logging/SimulationAbort.java | 57 +++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 core/src/net/sf/openrocket/logging/SimulationAbort.java diff --git a/core/resources/l10n/messages.properties b/core/resources/l10n/messages.properties index 7da3ad017..91d36773e 100644 --- a/core/resources/l10n/messages.properties +++ b/core/resources/l10n/messages.properties @@ -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 = Motor burnout without liftoff.
Use more (powerful) motors, or decrease the rocket mass. +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 diff --git a/core/src/net/sf/openrocket/logging/SimulationAbort.java b/core/src/net/sf/openrocket/logging/SimulationAbort.java new file mode 100644 index 000000000..643b852b5 --- /dev/null +++ b/core/src/net/sf/openrocket/logging/SimulationAbort.java @@ -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")); +} + + + +