more fixes to stage ignition: now also pays attention to ignition

type and additional delay
This commit is contained in:
JoePfeiffer 2018-09-29 13:01:00 -06:00
parent 99a3065faf
commit cfa49b0655

View File

@ -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 ));
}
}