Merge pull request #1954 from JoePfeiffer/fix-1923
Separate extension and scripting examples.
This commit is contained in:
commit
29e49f164a
@ -323,7 +323,7 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
// radius = 0;
|
// radius = 0;
|
||||||
//}
|
//}
|
||||||
//componentX = component.toAbsolute(new Coordinate(component.getLengthAerodynamic()))[0].x;
|
//componentX = component.toAbsolute(new Coordinate(component.getLengthAerodynamic()))[0].x;
|
||||||
|
|
||||||
}else if( comp instanceof ComponentAssembly ){
|
}else if( comp instanceof ComponentAssembly ){
|
||||||
checkGeometry(configuration, comp, warnings);
|
checkGeometry(configuration, comp, warnings);
|
||||||
}
|
}
|
||||||
|
@ -840,11 +840,9 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
|||||||
* - configurables
|
* - configurables
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Override
|
public FlightConfiguration clone(Rocket rocket) {
|
||||||
public FlightConfiguration clone() {
|
|
||||||
|
|
||||||
// Note the stages are updated in the constructor call.
|
// Note the stages are updated in the constructor call.
|
||||||
FlightConfiguration clone = new FlightConfiguration( this.rocket, this.fcid );
|
FlightConfiguration clone = new FlightConfiguration( rocket, this.fcid );
|
||||||
clone.setName(configurationName);
|
clone.setName(configurationName);
|
||||||
clone.copyStageActiveness(this);
|
clone.copyStageActiveness(this);
|
||||||
clone.preloadStageActiveness = this.preloadStageActiveness == null ? null : new HashMap<>(this.preloadStageActiveness);
|
clone.preloadStageActiveness = this.preloadStageActiveness == null ? null : new HashMap<>(this.preloadStageActiveness);
|
||||||
@ -856,6 +854,11 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
|||||||
clone.refLengthModID = -1;
|
clone.refLengthModID = -1;
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FlightConfiguration clone() {
|
||||||
|
return this.clone(this.rocket);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy all available information attached to this, and attached copies to the
|
* Copy all available information attached to this, and attached copies to the
|
||||||
|
@ -453,6 +453,24 @@ public class Rocket extends ComponentAssembly {
|
|||||||
|
|
||||||
/////// Implement the ComponentChangeListener lists
|
/////// Implement the ComponentChangeListener lists
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new EventListenerList for this component. This is necessary when cloning
|
||||||
|
* the structure.
|
||||||
|
*/
|
||||||
|
public void resetListeners() {
|
||||||
|
// System.out.println("RESETTING LISTENER LIST of Rocket "+this);
|
||||||
|
listenerList = new HashSet<EventListener>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void printListeners() {
|
||||||
|
int i = 0;
|
||||||
|
for (EventListener l : listenerList) {
|
||||||
|
System.out.println(" " + (i) + ": " + l);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addComponentChangeListener(ComponentChangeListener l) {
|
public void addComponentChangeListener(ComponentChangeListener l) {
|
||||||
checkState();
|
checkState();
|
||||||
|
@ -72,7 +72,7 @@ public class BasicEventSimulationEngine implements SimulationEngine {
|
|||||||
// Set up rocket configuration
|
// Set up rocket configuration
|
||||||
this.fcid = simulationConditions.getFlightConfigurationID();
|
this.fcid = simulationConditions.getFlightConfigurationID();
|
||||||
FlightConfiguration origConfig = simulationConditions.getRocket().getFlightConfiguration(this.fcid);
|
FlightConfiguration origConfig = simulationConditions.getRocket().getFlightConfiguration(this.fcid);
|
||||||
FlightConfiguration simulationConfig = origConfig.clone();
|
FlightConfiguration simulationConfig = origConfig.clone(simulationConditions.getRocket().copyWithOriginalID());
|
||||||
simulationConfig.copyStages(origConfig); // Clone the stage activation configuration
|
simulationConfig.copyStages(origConfig); // Clone the stage activation configuration
|
||||||
|
|
||||||
currentStatus = new SimulationStatus(simulationConfig, simulationConditions);
|
currentStatus = new SimulationStatus(simulationConfig, simulationConditions);
|
||||||
|
@ -35,7 +35,7 @@ public class AirStart extends AbstractSimulationExtension {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public double getLaunchAltitude() {
|
public double getLaunchAltitude() {
|
||||||
return config.getDouble("launchAltitude", 0.0);
|
return config.getDouble("launchAltitude", 100.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLaunchAltitude(double launchAltitude) {
|
public void setLaunchAltitude(double launchAltitude) {
|
||||||
@ -44,7 +44,7 @@ public class AirStart extends AbstractSimulationExtension {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public double getLaunchVelocity() {
|
public double getLaunchVelocity() {
|
||||||
return config.getDouble("launchVelocity", 0.0);
|
return config.getDouble("launchVelocity", 50.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLaunchVelocity(double launchVelocity) {
|
public void setLaunchVelocity(double launchVelocity) {
|
||||||
|
@ -187,10 +187,10 @@ public class RollControl extends AbstractSimulationExtension {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Clamp the fin angle between bounds
|
// Clamp the fin angle between bounds
|
||||||
if (Math.abs(value) > getMaxFinAngle()) {
|
if (Math.abs(finPosition) > getMaxFinAngle()) {
|
||||||
System.err.printf("Attempting to set angle %.1f at t=%.3f, clamping.\n",
|
System.err.printf("Attempting to set angle %.1f at t=%.3f, clamping.\n",
|
||||||
value * 180 / Math.PI, status.getSimulationTime());
|
finPosition * 180 / Math.PI, status.getSimulationTime());
|
||||||
value = MathUtil.clamp(value, -getMaxFinAngle(), getMaxFinAngle());
|
finPosition = MathUtil.clamp(finPosition, -getMaxFinAngle(), getMaxFinAngle());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the control fin cant and store the data
|
// Set the control fin cant and store the data
|
||||||
|
@ -74,7 +74,7 @@ public class FlightEventsTest extends BaseTestCase {
|
|||||||
|
|
||||||
// Test that the event sources are correct
|
// Test that the event sources are correct
|
||||||
for (int i = 0; i < expectedSources.length; i++) {
|
for (int i = 0; i < expectedSources.length; i++) {
|
||||||
assertSame(" Flight type " + expectedEventTypes[i] + " has wrong source",
|
assertEquals(" Flight type " + expectedEventTypes[i] + " has wrong source",
|
||||||
expectedSources[i], eventList.get(i).getSource());
|
expectedSources[i], eventList.get(i).getSource());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -149,7 +149,7 @@ public class FlightEventsTest extends BaseTestCase {
|
|||||||
|
|
||||||
// Test that the event sources are correct
|
// Test that the event sources are correct
|
||||||
for (int i = 0; i < expectedSources.length; i++) {
|
for (int i = 0; i < expectedSources.length; i++) {
|
||||||
assertSame(" Flight type " + expectedEventTypes[i] + " has wrong source",
|
assertEquals(" Flight type " + expectedEventTypes[i] + " has wrong source",
|
||||||
expectedSources[i], eventList.get(i).getSource());
|
expectedSources[i], eventList.get(i).getSource());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Binary file not shown.
BIN
swing/resources/datafiles/examples/Simulation scripting.ork
Normal file
BIN
swing/resources/datafiles/examples/Simulation scripting.ork
Normal file
Binary file not shown.
@ -46,7 +46,7 @@ public final class ExampleDesignFileAction extends JMenu {
|
|||||||
// Examples demonstrating customized functionality
|
// Examples demonstrating customized functionality
|
||||||
"Presets",
|
"Presets",
|
||||||
"Simulation extensions",
|
"Simulation extensions",
|
||||||
"Simulation extensions and scripting"
|
"Simulation scripting"
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -122,4 +122,4 @@ public final class ExampleDesignFileAction extends JMenu {
|
|||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user