Merge pull request #2451 from JoePfeiffer/fix-2450

Don't add motor delay time to upper stage motor ignition time
This commit is contained in:
Sibo Van Gool 2024-01-30 11:30:46 +01:00 committed by GitHub
commit 55e8c64d8c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 10 deletions

View File

@ -321,22 +321,15 @@ public class BasicEventSimulationEngine implements SimulationEngine {
(event.getType() != FlightEvent.Type.ALTITUDE) && (event.getType() != FlightEvent.Type.ALTITUDE) &&
(event.getType() != FlightEvent.Type.SIMULATION_END)) (event.getType() != FlightEvent.Type.SIMULATION_END))
currentStatus.getWarnings().add(new Warning.EventAfterLanding(event)); currentStatus.getWarnings().add(new Warning.EventAfterLanding(event));
// Check for motor ignition events, add ignition events to queue // Check for motor ignition events, add ignition events to queue
for (MotorClusterState state : currentStatus.getActiveMotors() ){ for (MotorClusterState state : currentStatus.getActiveMotors() ){
if (state.testForIgnition(currentStatus.getConfiguration(), event)) { if (state.testForIgnition(currentStatus.getConfiguration(), event)) {
MotorClusterState sourceState = (MotorClusterState) event.getData();
double ignitionDelay = 0;
if (event.getType() == FlightEvent.Type.BURNOUT)
ignitionDelay = 0;
else if (event.getType() == FlightEvent.Type.EJECTION_CHARGE)
ignitionDelay = sourceState.getEjectionDelay();
MotorMount mount = state.getMount(); MotorMount mount = state.getMount();
MotorConfiguration motorInstance = mount.getMotorConfig(this.fcid); MotorConfiguration motorInstance = mount.getMotorConfig(this.fcid);
ignitionDelay += motorInstance.getIgnitionDelay();
final double ignitionTime = currentStatus.getSimulationTime() + ignitionDelay; final double ignitionTime = currentStatus.getSimulationTime() + motorInstance.getIgnitionDelay();
// TODO: this event seems to get enqueue'd multiple times ... // TODO: this event seems to get enqueue'd multiple times ...
log.info("Queueing Ignition Event for: "+state.toDescription()+" @: "+ignitionTime); log.info("Queueing Ignition Event for: "+state.toDescription()+" @: "+ignitionTime);

View File

@ -7,6 +7,9 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import net.sf.openrocket.aerodynamics.FlightConditions; import net.sf.openrocket.aerodynamics.FlightConditions;
import net.sf.openrocket.simulation.exception.SimulationException; import net.sf.openrocket.simulation.exception.SimulationException;
import net.sf.openrocket.simulation.listeners.SimulationListenerHelper; import net.sf.openrocket.simulation.listeners.SimulationListenerHelper;
@ -32,6 +35,8 @@ import net.sf.openrocket.util.WorldCoordinate;
*/ */
public class SimulationStatus implements Monitorable { public class SimulationStatus implements Monitorable {
private static final Logger log = LoggerFactory.getLogger(BasicEventSimulationEngine.class);
private SimulationConditions simulationConditions; private SimulationConditions simulationConditions;
private FlightConfiguration configuration; private FlightConfiguration configuration;
@ -560,6 +565,9 @@ public class SimulationStatus implements Monitorable {
*/ */
public void addEvent(FlightEvent event) throws SimulationException { public void addEvent(FlightEvent event) throws SimulationException {
if (SimulationListenerHelper.fireAddFlightEvent(this, event)) { if (SimulationListenerHelper.fireAddFlightEvent(this, event)) {
if (event.getType() != FlightEvent.Type.ALTITUDE) {
log.trace("Adding event to queue: " + event);
}
getEventQueue().add(event); getEventQueue().add(event);
} }
} }