From 96f09851009ee3e56b809ca81a89858eacc2c4c0 Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Fri, 12 Jul 2024 05:53:43 -0600 Subject: [PATCH] Remove longitudinalAcceleration field from DataStore. This was initialized to NaN, but never set to anything else. It (along with the atmospheric conditions) was passed to calculateThrust for possible more accurate thrust calculation in the future, but not used there at present The entire DataStore is now passed to calculateAcceleration() to use whatever fields are useful to it -- none at present. --- .../core/simulation/AbstractSimulationStepper.java | 10 +++------- .../core/simulation/RK4SimulationStepper.java | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/core/src/main/java/info/openrocket/core/simulation/AbstractSimulationStepper.java b/core/src/main/java/info/openrocket/core/simulation/AbstractSimulationStepper.java index dcd152768..94810fb8e 100644 --- a/core/src/main/java/info/openrocket/core/simulation/AbstractSimulationStepper.java +++ b/core/src/main/java/info/openrocket/core/simulation/AbstractSimulationStepper.java @@ -163,14 +163,12 @@ public abstract class AbstractSimulationStepper implements SimulationStepper { * * @param status the current simulation status. * @param timestep the time step of the current iteration. - * @param acceleration the current (approximate) acceleration - * @param atmosphericConditions the current atmospheric conditions + * @param store the simulation calculation DataStore (contains acceleration, atmosphere) * @param stepMotors whether to step the motors forward or work on a clone object * @return the average thrust during the time step. */ - protected double calculateThrust(SimulationStatus status, - double acceleration, AtmosphericConditions atmosphericConditions, - boolean stepMotors) throws SimulationException { + protected double calculateThrust(SimulationStatus status, DataStore store, + boolean stepMotors) throws SimulationException { double thrust; // Pre-listeners @@ -240,8 +238,6 @@ public abstract class AbstractSimulationStepper implements SimulationStepper { public FlightConditions flightConditions; - public double longitudinalAcceleration = Double.NaN; - public RigidBody rocketMass; public RigidBody motorMass; diff --git a/core/src/main/java/info/openrocket/core/simulation/RK4SimulationStepper.java b/core/src/main/java/info/openrocket/core/simulation/RK4SimulationStepper.java index 91b76d28d..f235da572 100644 --- a/core/src/main/java/info/openrocket/core/simulation/RK4SimulationStepper.java +++ b/core/src/main/java/info/openrocket/core/simulation/RK4SimulationStepper.java @@ -325,7 +325,7 @@ public class RK4SimulationStepper extends AbstractSimulationStepper { double fN = store.forces.getCN() * dynP * refArea; double fSide = store.forces.getCside() * dynP * refArea; - store.thrustForce = calculateThrust(status, store.longitudinalAcceleration, store.flightConditions.getAtmosphericConditions(), false); + store.thrustForce = calculateThrust(status, store, false); double forceZ = store.thrustForce - store.dragForce; store.linearAcceleration = new Coordinate(-fN / store.rocketMass.getMass(),