[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:
Daniel_M_Williams 2015-12-13 11:08:32 -05:00
parent ec05e46a0e
commit 6af57134aa
6 changed files with 48 additions and 30 deletions

View File

@ -158,8 +158,6 @@ class DocumentConfig {
"auto", "auto",
Reflection.findMethod(ParallelStage.class, "setAutoRadialOffset", boolean.class))); Reflection.findMethod(ParallelStage.class, "setAutoRadialOffset", boolean.class)));
// file in degrees, internal in radians // 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( setters.put("ParallelStage:angularoffset", new DoubleSetter(
Reflection.findMethod(ParallelStage.class, "setAngularOffset", double.class), Math.PI / 180.0)); Reflection.findMethod(ParallelStage.class, "setAngularOffset", double.class), Math.PI / 180.0));
@ -425,7 +423,7 @@ class DocumentConfig {
Reflection.findMethod(PodSet.class, "setInstanceCount",int.class))); Reflection.findMethod(PodSet.class, "setInstanceCount",int.class)));
setters.put("PodSet:radialoffset", new DoubleSetter( setters.put("PodSet:radialoffset", new DoubleSetter(
Reflection.findMethod(PodSet.class, "setRadialOffset", double.class))); 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)); Reflection.findMethod(PodSet.class, "setAngularOffset", double.class),Math.PI / 180.0));
// Streamer // Streamer

View File

@ -37,6 +37,10 @@ class IgnitionConfigurationHandler extends AbstractElementHandler {
content = content.trim(); content = content.trim();
if (element.equals("ignitionevent")) { 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()) { for (IgnitionEvent ie : IgnitionEvent.values()) {
if (ie.equals(content)) { if (ie.equals(content)) {

View File

@ -8,20 +8,24 @@ import net.sf.openrocket.startup.Application;
public enum IgnitionEvent { public enum IgnitionEvent {
//// Automatic (launch or ejection charge) // //// Automatic (launch or ejection charge)
AUTOMATIC( "AUTOMATIC", "MotorMount.IgnitionEvent.AUTOMATIC"){ // AUTOMATIC( "AUTOMATIC", "MotorMount.IgnitionEvent.AUTOMATIC"){
@Override // @Override
public boolean isActivationEvent(FlightEvent e, RocketComponent source) { // public boolean isActivationEvent(FlightEvent e, RocketComponent source) {
int count = source.getRocket().getStageCount(); // int count = source.getRocket().getStageCount();
int stage = source.getStageNumber(); // AxialStage stage = (AxialStage)source;
//
if (stage == count - 1) { // if ( stage instanceof ParallelStage ){
return LAUNCH.isActivationEvent(e, source); // return LAUNCH.isActivationEvent(e, source);
} else { // }else if (????){
return EJECTION_CHARGE.isActivationEvent(e, source); // // 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"){ LAUNCH ( "LAUNCH", "MotorMount.IgnitionEvent.LAUNCH"){
@Override @Override
public boolean isActivationEvent( FlightEvent fe, RocketComponent source){ public boolean isActivationEvent( FlightEvent fe, RocketComponent source){

View File

@ -189,10 +189,24 @@ public class Rocket extends RocketComponent {
return this.stageMap.values(); return this.stageMap.values();
} }
/*
* Returns the stage at the top of the central stack
*
* @Return a reference to the topmost stage
*/
public AxialStage getTopmostStage(){ public AxialStage getTopmostStage(){
return (AxialStage) getChild(0); 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() { private int getNewStageNumber() {
int guess = 0; int guess = 0;
while (stageMap.containsKey(guess)) { while (stageMap.containsKey(guess)) {

View File

@ -289,17 +289,18 @@ public class BasicEventSimulationEngine implements SimulationEngine {
} }
// Check for motor ignition events, add ignition events to queue // Check for motor ignition events, add ignition events to queue
for (MotorInstance motor : currentStatus.getFlightConfiguration().getActiveMotors() ){ for (MotorInstance inst : currentStatus.getFlightConfiguration().getActiveMotors() ){
MotorInstanceId mid = motor.getID(); IgnitionEvent ignitionEvent = inst.getIgnitionEvent();
IgnitionEvent ignitionEvent = motor.getIgnitionEvent(); MotorMount mount = inst.getMount();
MotorMount mount = motor.getMount();
RocketComponent component = (RocketComponent) mount; RocketComponent component = (RocketComponent) mount;
if (ignitionEvent.isActivationEvent(event, component)) { 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, addEvent(new FlightEvent(FlightEvent.Type.IGNITION,
currentStatus.getSimulationTime() + ignitionDelay, currentStatus.getSimulationTime() + ignitionDelay,
component, mid)); component, inst.getID() ));
} }
} }
@ -343,6 +344,7 @@ public class BasicEventSimulationEngine implements SimulationEngine {
MotorInstanceId motorId = (MotorInstanceId) event.getData(); MotorInstanceId motorId = (MotorInstanceId) event.getData();
MotorInstance inst = currentStatus.getMotor( motorId); MotorInstance inst = currentStatus.getMotor( motorId);
inst.setIgnitionTime(event.getTime()); inst.setIgnitionTime(event.getTime());
//System.err.println("Igniting motor: "+inst.getMotor().getDesignation()+" @"+currentStatus.getSimulationTime());
currentStatus.setMotorIgnited(true); currentStatus.setMotorIgnited(true);
currentStatus.getFlightData().addEvent(event); currentStatus.getFlightData().addEvent(event);

View File

@ -19,9 +19,6 @@ import javax.swing.SwingUtilities;
import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener; import javax.swing.event.TableModelListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import net.sf.openrocket.gui.components.StyledLabel; import net.sf.openrocket.gui.components.StyledLabel;
import net.sf.openrocket.gui.components.StyledLabel.Style; 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.IgnitionEvent;
import net.sf.openrocket.rocketcomponent.MotorMount; import net.sf.openrocket.rocketcomponent.MotorMount;
import net.sf.openrocket.rocketcomponent.Rocket; import net.sf.openrocket.rocketcomponent.Rocket;
import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.unit.UnitGroup; import net.sf.openrocket.unit.UnitGroup;
import net.sf.openrocket.util.Chars; import net.sf.openrocket.util.Chars;
@ -221,7 +217,7 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel<MotorMount>
if (mtr != null) { if (mtr != null) {
MotorInstance curInstance = mtr.getNewInstance(); MotorInstance curInstance = mtr.getNewInstance();
curInstance.setEjectionDelay(d); curInstance.setEjectionDelay(d);
curInstance.setIgnitionEvent( IgnitionEvent.AUTOMATIC); curInstance.setIgnitionEvent( IgnitionEvent.NEVER);
curMount.setMotorInstance( fcid, curInstance); curMount.setMotorInstance( fcid, curInstance);
} }