From 8700450f20aa109b91c7dbb3e6ef744901c0b388 Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Thu, 18 Oct 2018 18:40:41 -0600 Subject: [PATCH] Comments in BasicEventSimulationEngine.java indicate that if we're the sustainer stage, we don't check for tumbling until after apogee, which is consistent with the email discussion eg https://sourceforge.net/p/openrocket/mailman/message/32016278/ Not switching to tumbling until after apogee results in unstable booster stages going into wild oscillations, and firing an exception terminating the branch of the simulation. This brings the code into conformity with the comment. --- .../sf/openrocket/simulation/BasicEventSimulationEngine.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java b/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java index 485d1dd50..8cc00e1e8 100644 --- a/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java +++ b/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java @@ -217,11 +217,11 @@ public class BasicEventSimulationEngine implements SimulationEngine { if (wantToTumble) { final boolean tooMuchThrust = t > THRUST_TUMBLE_CONDITION; - //final boolean isSustainer = status.getConfiguration().isStageActive(0); + final boolean isSustainer = currentStatus.getConfiguration().isStageActive(0); final boolean isApogee = currentStatus.isApogeeReached(); if (tooMuchThrust) { currentStatus.getWarnings().add(Warning.TUMBLE_UNDER_THRUST); - } else if (isApogee) { + } else if (isApogee || !isSustainer) { addEvent(new FlightEvent(FlightEvent.Type.TUMBLE, currentStatus.getSimulationTime())); currentStatus.setTumbling(true); }