Make sure active motor list is updated after all stage state changes

Use getActiveMotors() instead of getMotors() to get motors in thrust calculation
This commit is contained in:
JoePfeiffer 2022-03-07 09:46:27 -07:00
parent 2aa6a84bf7
commit 24e1dcc7fe
2 changed files with 5 additions and 4 deletions

View File

@ -109,23 +109,23 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
public void clearAllStages() {
this._setAllStages(false);
this.updateMotors();
}
public void setAllStages() {
this._setAllStages(true);
this.updateMotors();
}
private void _setAllStages(final boolean _active) {
for (StageFlags cur : stages.values()) {
cur.active = _active;
}
updateMotors();
}
public void copyStages(FlightConfiguration other) {
for (StageFlags cur : other.stages.values())
stages.put(cur.stageNumber, new StageFlags(cur.stageNumber, cur.active));
updateMotors();
}
/**
@ -135,6 +135,7 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
*/
public void clearStage(final int stageNumber) {
_setStageActive( stageNumber, false );
updateMotors();
}
/**
@ -196,7 +197,7 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
flags.active = !flags.active;
return;
}
this.updateMotors();
updateMotors();
log.error("error: attempt to retrieve via a bad stage number: " + stageNumber);
}

View File

@ -181,7 +181,7 @@ public abstract class AbstractSimulationStepper implements SimulationStepper {
thrust = 0;
final double currentTime = status.getSimulationTime() + timestep;
Collection<MotorClusterState> activeMotorList = status.getMotors();
Collection<MotorClusterState> activeMotorList = status.getActiveMotors();
for (MotorClusterState currentMotorState : activeMotorList ) {
thrust += currentMotorState.getAverageThrust( status.getSimulationTime(), currentTime );
//thrust += currentMotorState.getThrust( currentTime );