diff --git a/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java b/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java index bffa62ca5..c434df11b 100644 --- a/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java +++ b/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java @@ -8,6 +8,7 @@ import org.slf4j.LoggerFactory; import net.sf.openrocket.aerodynamics.Warning; import net.sf.openrocket.l10n.Translator; +import net.sf.openrocket.motor.MotorConfiguration; import net.sf.openrocket.motor.MotorConfigurationId; import net.sf.openrocket.rocketcomponent.AxialStage; import net.sf.openrocket.rocketcomponent.DeploymentConfiguration; @@ -258,19 +259,25 @@ public class BasicEventSimulationEngine implements SimulationEngine { for (MotorClusterState state : currentStatus.getActiveMotors() ){ if( state.testForIgnition(event )){ final double simulationTime = currentStatus.getSimulationTime() ; + MotorClusterState sourceState = (MotorClusterState) event.getData(); double ignitionDelay = 0; - if(( event.getType() == FlightEvent.Type.BURNOUT)|| ( event.getType() == FlightEvent.Type.EJECTION_CHARGE)){ + if (event.getType() == FlightEvent.Type.BURNOUT) + ignitionDelay = 0; + else if (event.getType() == FlightEvent.Type.EJECTION_CHARGE) ignitionDelay = sourceState.getEjectionDelay(); - } + + MotorMount mount = state.getMount(); + MotorConfiguration motorInstance = mount.getMotorConfig(this.fcid); + ignitionDelay += motorInstance.getIgnitionDelay(); + final double ignitionTime = currentStatus.getSimulationTime() + ignitionDelay; - final RocketComponent mount = (RocketComponent)state.getMount(); // TODO: this event seems to get enqueue'd multiple times ... log.info("Queueing Ignition Event for: "+state.toDescription()+" @: "+ignitionTime); //log.info(" Because of "+event.getType().name()+" @"+event.getTime()+" from: "+event.getSource().getName()); - addEvent(new FlightEvent(FlightEvent.Type.IGNITION, ignitionTime, mount, state )); + addEvent(new FlightEvent(FlightEvent.Type.IGNITION, ignitionTime, (RocketComponent) mount, state )); } }