[Bugfix] Removed "Automatic" ignition Option
Removed Automatic ignition Option - "bottom" core stage is ill-defined in current configuration - 'automatic' values in files get loaded as 'launch' Fixed file values for loading Pods
This commit is contained in:
parent
ec05e46a0e
commit
6af57134aa
@ -158,8 +158,6 @@ class DocumentConfig {
|
||||
"auto",
|
||||
Reflection.findMethod(ParallelStage.class, "setAutoRadialOffset", boolean.class)));
|
||||
// file in degrees, internal in radians
|
||||
setters.put("ParallelStage:angleoffset", new DoubleSetter(
|
||||
Reflection.findMethod(ParallelStage.class, "setAngularOffset", double.class), Math.PI / 180.0));
|
||||
setters.put("ParallelStage:angularoffset", new DoubleSetter(
|
||||
Reflection.findMethod(ParallelStage.class, "setAngularOffset", double.class), Math.PI / 180.0));
|
||||
|
||||
@ -425,7 +423,7 @@ class DocumentConfig {
|
||||
Reflection.findMethod(PodSet.class, "setInstanceCount",int.class)));
|
||||
setters.put("PodSet:radialoffset", new DoubleSetter(
|
||||
Reflection.findMethod(PodSet.class, "setRadialOffset", double.class)));
|
||||
setters.put("PodSet:angleoffset", new DoubleSetter(
|
||||
setters.put("PodSet:angularoffset", new DoubleSetter(
|
||||
Reflection.findMethod(PodSet.class, "setAngularOffset", double.class),Math.PI / 180.0));
|
||||
|
||||
// Streamer
|
||||
|
@ -37,6 +37,10 @@ class IgnitionConfigurationHandler extends AbstractElementHandler {
|
||||
content = content.trim();
|
||||
|
||||
if (element.equals("ignitionevent")) {
|
||||
if ( content.equals( "automatic")){
|
||||
content = "launch";
|
||||
warnings.add( Warning.fromString("'automatic' separation is deprecated and has been converted to the 'launch' setting."));
|
||||
}
|
||||
|
||||
for (IgnitionEvent ie : IgnitionEvent.values()) {
|
||||
if (ie.equals(content)) {
|
||||
|
@ -8,20 +8,24 @@ import net.sf.openrocket.startup.Application;
|
||||
|
||||
public enum IgnitionEvent {
|
||||
|
||||
//// Automatic (launch or ejection charge)
|
||||
AUTOMATIC( "AUTOMATIC", "MotorMount.IgnitionEvent.AUTOMATIC"){
|
||||
@Override
|
||||
public boolean isActivationEvent(FlightEvent e, RocketComponent source) {
|
||||
int count = source.getRocket().getStageCount();
|
||||
int stage = source.getStageNumber();
|
||||
|
||||
if (stage == count - 1) {
|
||||
return LAUNCH.isActivationEvent(e, source);
|
||||
} else {
|
||||
return EJECTION_CHARGE.isActivationEvent(e, source);
|
||||
}
|
||||
}
|
||||
},
|
||||
// //// Automatic (launch or ejection charge)
|
||||
// AUTOMATIC( "AUTOMATIC", "MotorMount.IgnitionEvent.AUTOMATIC"){
|
||||
// @Override
|
||||
// public boolean isActivationEvent(FlightEvent e, RocketComponent source) {
|
||||
// int count = source.getRocket().getStageCount();
|
||||
// AxialStage stage = (AxialStage)source;
|
||||
//
|
||||
// if ( stage instanceof ParallelStage ){
|
||||
// return LAUNCH.isActivationEvent(e, source);
|
||||
// }else if (????){
|
||||
// // no good option here. The non-sequential nature of
|
||||
// // parallel stages prevents us from using the simple test as previousyl
|
||||
// return LAUNCH.isActivationEvent(e, source);
|
||||
// } else {
|
||||
// return EJECTION_CHARGE.isActivationEvent(e, source);
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
LAUNCH ( "LAUNCH", "MotorMount.IgnitionEvent.LAUNCH"){
|
||||
@Override
|
||||
public boolean isActivationEvent( FlightEvent fe, RocketComponent source){
|
||||
|
@ -189,10 +189,24 @@ public class Rocket extends RocketComponent {
|
||||
return this.stageMap.values();
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the stage at the top of the central stack
|
||||
*
|
||||
* @Return a reference to the topmost stage
|
||||
*/
|
||||
public AxialStage getTopmostStage(){
|
||||
return (AxialStage) getChild(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the stage at the top of the central stack
|
||||
*
|
||||
* @Return a reference to the topmost stage
|
||||
*/
|
||||
public AxialStage getBottomCoreStage(){
|
||||
return (AxialStage) getChild(0);
|
||||
}
|
||||
|
||||
private int getNewStageNumber() {
|
||||
int guess = 0;
|
||||
while (stageMap.containsKey(guess)) {
|
||||
|
@ -289,17 +289,18 @@ public class BasicEventSimulationEngine implements SimulationEngine {
|
||||
}
|
||||
|
||||
// Check for motor ignition events, add ignition events to queue
|
||||
for (MotorInstance motor : currentStatus.getFlightConfiguration().getActiveMotors() ){
|
||||
MotorInstanceId mid = motor.getID();
|
||||
IgnitionEvent ignitionEvent = motor.getIgnitionEvent();
|
||||
MotorMount mount = motor.getMount();
|
||||
for (MotorInstance inst : currentStatus.getFlightConfiguration().getActiveMotors() ){
|
||||
IgnitionEvent ignitionEvent = inst.getIgnitionEvent();
|
||||
MotorMount mount = inst.getMount();
|
||||
RocketComponent component = (RocketComponent) mount;
|
||||
|
||||
if (ignitionEvent.isActivationEvent(event, component)) {
|
||||
double ignitionDelay = motor.getIgnitionDelay();
|
||||
double ignitionDelay = inst.getIgnitionDelay();
|
||||
// TODO: this event seems to get enque'd multiple times -- more than necessary...
|
||||
//System.err.println("Queing ignition of mtr:"+inst.getMotor().getDesignation()+" @"+currentStatus.getSimulationTime());
|
||||
addEvent(new FlightEvent(FlightEvent.Type.IGNITION,
|
||||
currentStatus.getSimulationTime() + ignitionDelay,
|
||||
component, mid));
|
||||
component, inst.getID() ));
|
||||
}
|
||||
}
|
||||
|
||||
@ -343,6 +344,7 @@ public class BasicEventSimulationEngine implements SimulationEngine {
|
||||
MotorInstanceId motorId = (MotorInstanceId) event.getData();
|
||||
MotorInstance inst = currentStatus.getMotor( motorId);
|
||||
inst.setIgnitionTime(event.getTime());
|
||||
//System.err.println("Igniting motor: "+inst.getMotor().getDesignation()+" @"+currentStatus.getSimulationTime());
|
||||
|
||||
currentStatus.setMotorIgnited(true);
|
||||
currentStatus.getFlightData().addEvent(event);
|
||||
|
@ -19,9 +19,6 @@ import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.TableModelEvent;
|
||||
import javax.swing.event.TableModelListener;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import net.sf.openrocket.gui.components.StyledLabel;
|
||||
import net.sf.openrocket.gui.components.StyledLabel.Style;
|
||||
@ -34,7 +31,6 @@ import net.sf.openrocket.rocketcomponent.FlightConfigurationID;
|
||||
import net.sf.openrocket.rocketcomponent.IgnitionEvent;
|
||||
import net.sf.openrocket.rocketcomponent.MotorMount;
|
||||
import net.sf.openrocket.rocketcomponent.Rocket;
|
||||
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
||||
import net.sf.openrocket.unit.UnitGroup;
|
||||
import net.sf.openrocket.util.Chars;
|
||||
|
||||
@ -221,7 +217,7 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel<MotorMount>
|
||||
if (mtr != null) {
|
||||
MotorInstance curInstance = mtr.getNewInstance();
|
||||
curInstance.setEjectionDelay(d);
|
||||
curInstance.setIgnitionEvent( IgnitionEvent.AUTOMATIC);
|
||||
curInstance.setIgnitionEvent( IgnitionEvent.NEVER);
|
||||
curMount.setMotorInstance( fcid, curInstance);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user