diff --git a/core/src/net/sf/openrocket/optimization/rocketoptimization/parameters/SimulationBasedParameter.java b/core/src/net/sf/openrocket/optimization/rocketoptimization/parameters/SimulationBasedParameter.java index 5d0b455bb..e36ac7d04 100644 --- a/core/src/net/sf/openrocket/optimization/rocketoptimization/parameters/SimulationBasedParameter.java +++ b/core/src/net/sf/openrocket/optimization/rocketoptimization/parameters/SimulationBasedParameter.java @@ -9,11 +9,9 @@ import net.sf.openrocket.document.Simulation; import net.sf.openrocket.optimization.general.OptimizationException; import net.sf.openrocket.optimization.rocketoptimization.OptimizableParameter; import net.sf.openrocket.simulation.FlightData; -import net.sf.openrocket.simulation.exception.MotorIgnitionException; import net.sf.openrocket.simulation.exception.SimulationCalculationException; import net.sf.openrocket.simulation.exception.SimulationCancelledException; import net.sf.openrocket.simulation.exception.SimulationException; -import net.sf.openrocket.simulation.exception.SimulationLaunchException; import net.sf.openrocket.simulation.listeners.SimulationListener; import net.sf.openrocket.simulation.listeners.system.InterruptListener; @@ -40,12 +38,6 @@ public abstract class SimulationBasedParameter implements OptimizableParameter { double value = getResultValue(simulation.getSimulatedData()); log.debug("Parameter '" + getName() + " was " + value); return value; - } catch (MotorIgnitionException e) { - // A problem with motor ignition will cause optimization to fail - throw new OptimizationException(e); - } catch (SimulationLaunchException e) { - // Other launch exceptions result in illegal value - return Double.NaN; } catch (SimulationCalculationException e) { // Calculation errors result in illegal value return Double.NaN; diff --git a/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java b/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java index 18aff00bb..098c6735b 100644 --- a/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java +++ b/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java @@ -21,9 +21,8 @@ import net.sf.openrocket.rocketcomponent.MotorMount; import net.sf.openrocket.rocketcomponent.RecoveryDevice; import net.sf.openrocket.rocketcomponent.RocketComponent; import net.sf.openrocket.rocketcomponent.StageSeparationConfiguration; -import net.sf.openrocket.simulation.exception.MotorIgnitionException; +import net.sf.openrocket.simulation.exception.SimulationCalculationException; import net.sf.openrocket.simulation.exception.SimulationException; -import net.sf.openrocket.simulation.exception.SimulationLaunchException; import net.sf.openrocket.simulation.listeners.SimulationListenerHelper; import net.sf.openrocket.simulation.listeners.system.OptimumCoastListener; import net.sf.openrocket.startup.Application; @@ -709,7 +708,7 @@ public class BasicEventSimulationEngine implements SimulationEngine { " rocketOrientationQuaternion=" + currentStatus.getRocketOrientationQuaternion() + " rocketRotationVelocity=" + currentStatus.getRocketRotationVelocity() + " effectiveLaunchRodLength=" + currentStatus.getEffectiveLaunchRodLength()); - throw new SimulationException(trans.get("BasicEventSimulationEngine.error.NaNResult")); + throw new SimulationCalculationException(trans.get("BasicEventSimulationEngine.error.NaNResult")); } } diff --git a/core/src/net/sf/openrocket/simulation/exception/MotorIgnitionException.java b/core/src/net/sf/openrocket/simulation/exception/MotorIgnitionException.java deleted file mode 100644 index fd9e60ac9..000000000 --- a/core/src/net/sf/openrocket/simulation/exception/MotorIgnitionException.java +++ /dev/null @@ -1,19 +0,0 @@ -package net.sf.openrocket.simulation.exception; - -/** - * An exception signifying that the simulation failed because no motors were - * defined or ignited in the rocket. - * - * @author Sampo Niskanen - */ -public class MotorIgnitionException extends SimulationLaunchException { - - public MotorIgnitionException(String message) { - super(message); - } - - public MotorIgnitionException(String message, Throwable cause) { - super(message, cause); - } - -} diff --git a/core/src/net/sf/openrocket/simulation/exception/SimulationLaunchException.java b/core/src/net/sf/openrocket/simulation/exception/SimulationLaunchException.java deleted file mode 100644 index df9f3862d..000000000 --- a/core/src/net/sf/openrocket/simulation/exception/SimulationLaunchException.java +++ /dev/null @@ -1,19 +0,0 @@ -package net.sf.openrocket.simulation.exception; - -/** - * An exception signifying that a problem occurred at launch, for example - * that no motors were defined or no motors ignited. - * - * @author Sampo Niskanen - */ -public class SimulationLaunchException extends SimulationException { - - public SimulationLaunchException(String message) { - super(message); - } - - public SimulationLaunchException(String message, Throwable cause) { - super(message, cause); - } - -} diff --git a/core/test/net/sf/openrocket/simulation/DisableStageTest.java b/core/test/net/sf/openrocket/simulation/DisableStageTest.java index d0eb1e8d4..b10aab5bc 100644 --- a/core/test/net/sf/openrocket/simulation/DisableStageTest.java +++ b/core/test/net/sf/openrocket/simulation/DisableStageTest.java @@ -4,7 +4,6 @@ import net.sf.openrocket.document.Simulation; import net.sf.openrocket.rocketcomponent.FlightConfiguration; import net.sf.openrocket.rocketcomponent.FlightConfigurationId; import net.sf.openrocket.rocketcomponent.Rocket; -import net.sf.openrocket.simulation.exception.MotorIgnitionException; import net.sf.openrocket.simulation.exception.SimulationException; import net.sf.openrocket.util.BaseTestCase.BaseTestCase; import net.sf.openrocket.util.TestRockets; @@ -34,6 +33,7 @@ public class DisableStageTest extends BaseTestCase { simDisabled.getOptions().setTimeStep(0.05); // Since there are no stages, the simulation should throw an exception. + // Needs fixing for SimulationAbort try { simDisabled.simulate(); } catch (SimulationException e) { diff --git a/swing/src/net/sf/openrocket/gui/simulation/SimulationRunDialog.java b/swing/src/net/sf/openrocket/gui/simulation/SimulationRunDialog.java index 2ff3c7101..1d455f3f0 100644 --- a/swing/src/net/sf/openrocket/gui/simulation/SimulationRunDialog.java +++ b/swing/src/net/sf/openrocket/gui/simulation/SimulationRunDialog.java @@ -45,7 +45,6 @@ import net.sf.openrocket.simulation.customexpression.CustomExpression; import net.sf.openrocket.simulation.customexpression.CustomExpressionSimulationListener; import net.sf.openrocket.simulation.exception.SimulationCancelledException; import net.sf.openrocket.simulation.exception.SimulationException; -import net.sf.openrocket.simulation.exception.SimulationLaunchException; import net.sf.openrocket.simulation.listeners.AbstractSimulationListener; import net.sf.openrocket.simulation.listeners.SimulationListener; import net.sf.openrocket.startup.Application; @@ -425,15 +424,7 @@ public class SimulationRunDialog extends JDialog { } // Analyze the exception type - if (t instanceof SimulationLaunchException) { - - DetailDialog.showDetailedMessageDialog(SimulationRunDialog.this, - new Object[] { - //// Unable to simulate: - trans.get("SimuRunDlg.msg.Unabletosim"), t.getMessage() }, - null, simulation.getName(), JOptionPane.ERROR_MESSAGE); - - } else if (t instanceof SimulationException) { + if (t instanceof SimulationException) { String title = simulation.getName(); FlightDataBranch dataBranch = ((SimulationException) t).getFlightDataBranch();