Make copy of rocket when starting simulation

This commit is contained in:
JoePfeiffer 2023-01-16 18:10:35 -07:00
parent 5cfdb3959e
commit 58ac3e4a1d
5 changed files with 9 additions and 10 deletions

View File

@ -323,7 +323,7 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
// radius = 0;
//}
//componentX = component.toAbsolute(new Coordinate(component.getLengthAerodynamic()))[0].x;
}else if( comp instanceof ComponentAssembly ){
checkGeometry(configuration, comp, warnings);
}

View File

@ -840,11 +840,9 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
* - configurables
*
*/
@Override
public FlightConfiguration clone() {
public FlightConfiguration clone(Rocket rocket) {
// 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.copyStageActiveness(this);
clone.preloadStageActiveness = this.preloadStageActiveness == null ? null : new HashMap<>(this.preloadStageActiveness);
@ -856,6 +854,11 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
clone.refLengthModID = -1;
return clone;
}
@Override
public FlightConfiguration clone() {
return this.clone(this.rocket);
}
/**
* Copy all available information attached to this, and attached copies to the

View File

@ -464,7 +464,6 @@ public class Rocket extends ComponentAssembly {
public void printListeners() {
System.out.println("" + this + " has " + listenerList.size() + " listeners:");
int i = 0;
for (EventListener l : listenerList) {
System.out.println(" " + (i) + ": " + l);

View File

@ -72,7 +72,7 @@ public class BasicEventSimulationEngine implements SimulationEngine {
// Set up rocket configuration
this.fcid = simulationConditions.getFlightConfigurationID();
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
currentStatus = new SimulationStatus(simulationConfig, simulationConditions);

View File

@ -146,7 +146,6 @@ public class RollControl extends AbstractSimulationExtension {
if (finset == null) {
throw new SimulationException("A fin set with name '" + getControlFinName() + "' was not found");
}
System.out.println("fin set found at " + finset.hashCode());
// remember the initial fin position so we can set it back after running the simulation
initialFinPosition = finset.getCantAngle();
@ -166,8 +165,6 @@ public class RollControl extends AbstractSimulationExtension {
prevTime = status.getSimulationTime();
return;
}
System.out.println("using fin set at " + finset.hashCode());
// Determine time step
double deltaT = status.getSimulationTime() - prevTime;