diff --git a/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java b/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java index 264c1298b..ce2d5ce61 100644 --- a/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java +++ b/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java @@ -323,7 +323,7 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator { // radius = 0; //} //componentX = component.toAbsolute(new Coordinate(component.getLengthAerodynamic()))[0].x; - + }else if( comp instanceof ComponentAssembly ){ checkGeometry(configuration, comp, warnings); } diff --git a/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java b/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java index ec1546236..307b1e2d4 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java +++ b/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java @@ -840,11 +840,9 @@ public class FlightConfiguration implements FlightConfigurableParameter(this.preloadStageActiveness); @@ -856,6 +854,11 @@ public class FlightConfiguration implements FlightConfigurableParameter(); + } + + + public void printListeners() { + int i = 0; + for (EventListener l : listenerList) { + System.out.println(" " + (i) + ": " + l); + i++; + } + } + @Override public void addComponentChangeListener(ComponentChangeListener l) { checkState(); diff --git a/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java b/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java index 33b39174a..c903addbf 100644 --- a/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java +++ b/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java @@ -72,7 +72,7 @@ public class BasicEventSimulationEngine implements SimulationEngine { // Set up rocket configuration this.fcid = simulationConditions.getFlightConfigurationID(); FlightConfiguration origConfig = simulationConditions.getRocket().getFlightConfiguration(this.fcid); - FlightConfiguration simulationConfig = origConfig.clone(); + FlightConfiguration simulationConfig = origConfig.clone(simulationConditions.getRocket().copyWithOriginalID()); simulationConfig.copyStages(origConfig); // Clone the stage activation configuration currentStatus = new SimulationStatus(simulationConfig, simulationConditions); diff --git a/core/src/net/sf/openrocket/simulation/extension/example/AirStart.java b/core/src/net/sf/openrocket/simulation/extension/example/AirStart.java index 835b757a4..956f65d48 100644 --- a/core/src/net/sf/openrocket/simulation/extension/example/AirStart.java +++ b/core/src/net/sf/openrocket/simulation/extension/example/AirStart.java @@ -35,7 +35,7 @@ public class AirStart extends AbstractSimulationExtension { } public double getLaunchAltitude() { - return config.getDouble("launchAltitude", 0.0); + return config.getDouble("launchAltitude", 100.0); } public void setLaunchAltitude(double launchAltitude) { @@ -44,7 +44,7 @@ public class AirStart extends AbstractSimulationExtension { } public double getLaunchVelocity() { - return config.getDouble("launchVelocity", 0.0); + return config.getDouble("launchVelocity", 50.0); } public void setLaunchVelocity(double launchVelocity) { diff --git a/core/src/net/sf/openrocket/simulation/extension/example/RollControl.java b/core/src/net/sf/openrocket/simulation/extension/example/RollControl.java index 8b3a0a42a..a5fa6ce1b 100644 --- a/core/src/net/sf/openrocket/simulation/extension/example/RollControl.java +++ b/core/src/net/sf/openrocket/simulation/extension/example/RollControl.java @@ -187,10 +187,10 @@ public class RollControl extends AbstractSimulationExtension { } // Clamp the fin angle between bounds - if (Math.abs(value) > getMaxFinAngle()) { + if (Math.abs(finPosition) > getMaxFinAngle()) { System.err.printf("Attempting to set angle %.1f at t=%.3f, clamping.\n", - value * 180 / Math.PI, status.getSimulationTime()); - value = MathUtil.clamp(value, -getMaxFinAngle(), getMaxFinAngle()); + finPosition * 180 / Math.PI, status.getSimulationTime()); + finPosition = MathUtil.clamp(finPosition, -getMaxFinAngle(), getMaxFinAngle()); } // Set the control fin cant and store the data diff --git a/core/test/net/sf/openrocket/simulation/FlightEventsTest.java b/core/test/net/sf/openrocket/simulation/FlightEventsTest.java index 1069d67f5..74f573b98 100644 --- a/core/test/net/sf/openrocket/simulation/FlightEventsTest.java +++ b/core/test/net/sf/openrocket/simulation/FlightEventsTest.java @@ -74,7 +74,7 @@ public class FlightEventsTest extends BaseTestCase { // Test that the event sources are correct for (int i = 0; i < expectedSources.length; i++) { - assertSame(" Flight type " + expectedEventTypes[i] + " has wrong source", + assertEquals(" Flight type " + expectedEventTypes[i] + " has wrong source", expectedSources[i], eventList.get(i).getSource()); } } @@ -149,7 +149,7 @@ public class FlightEventsTest extends BaseTestCase { // Test that the event sources are correct for (int i = 0; i < expectedSources.length; i++) { - assertSame(" Flight type " + expectedEventTypes[i] + " has wrong source", + assertEquals(" Flight type " + expectedEventTypes[i] + " has wrong source", expectedSources[i], eventList.get(i).getSource()); } } diff --git a/swing/resources/datafiles/examples/Simulation extensions and scripting.ork b/swing/resources/datafiles/examples/Simulation extensions and scripting.ork deleted file mode 100644 index dc0d416b1..000000000 Binary files a/swing/resources/datafiles/examples/Simulation extensions and scripting.ork and /dev/null differ diff --git a/swing/resources/datafiles/examples/Simulation extensions.ork b/swing/resources/datafiles/examples/Simulation extensions.ork index 1ba1d3c06..056395085 100644 Binary files a/swing/resources/datafiles/examples/Simulation extensions.ork and b/swing/resources/datafiles/examples/Simulation extensions.ork differ diff --git a/swing/resources/datafiles/examples/Simulation scripting.ork b/swing/resources/datafiles/examples/Simulation scripting.ork new file mode 100644 index 000000000..fdfa6872b Binary files /dev/null and b/swing/resources/datafiles/examples/Simulation scripting.ork differ diff --git a/swing/src/net/sf/openrocket/gui/main/ExampleDesignFileAction.java b/swing/src/net/sf/openrocket/gui/main/ExampleDesignFileAction.java index 64abf6dc0..46fd05e97 100644 --- a/swing/src/net/sf/openrocket/gui/main/ExampleDesignFileAction.java +++ b/swing/src/net/sf/openrocket/gui/main/ExampleDesignFileAction.java @@ -46,7 +46,7 @@ public final class ExampleDesignFileAction extends JMenu { // Examples demonstrating customized functionality "Presets", "Simulation extensions", - "Simulation extensions and scripting" + "Simulation scripting" }; /** @@ -122,4 +122,4 @@ public final class ExampleDesignFileAction extends JMenu { return action; } -} \ No newline at end of file +}