When creating a new sim branch, copy one data point and the separation event to the new branch so we can plot it if it has an immediate exception
This commit is contained in:
parent
4c136441ff
commit
3571ebad68
@ -491,7 +491,8 @@ public class BasicEventSimulationEngine implements SimulationEngine {
|
||||
SimulationStatus boosterStatus = new SimulationStatus(currentStatus);
|
||||
|
||||
// Prepare the new simulation branch
|
||||
boosterStatus.setFlightData(new FlightDataBranch(boosterStage.getName(), FlightDataType.TYPE_TIME));
|
||||
boosterStatus.setFlightData(new FlightDataBranch(boosterStage.getName(), currentStatus.getFlightData()));
|
||||
boosterStatus.getFlightData().addEvent(event);
|
||||
|
||||
// Mark the current status as having dropped the current stage and all stages below it
|
||||
currentStatus.getConfiguration().clearStagesBelow( stageNumber);
|
||||
|
@ -75,6 +75,26 @@ public class FlightDataBranch implements Monitorable {
|
||||
maxValues.put(t, Double.NaN);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a flight data branch with one data point copied from its parent. Intended for use
|
||||
* when creating a new branch upon stage separation, so the data at separation is present
|
||||
* in both branches (and if the new branch has an immediate exception, it can be plotted)
|
||||
*/
|
||||
public FlightDataBranch(String branchName, FlightDataBranch parent) {
|
||||
this.branchName = branchName;
|
||||
|
||||
// need to have at least one type to set up values
|
||||
values.put(FlightDataType.TYPE_TIME, new ArrayList<Double>());
|
||||
minValues.put(FlightDataType.TYPE_TIME, Double.NaN);
|
||||
maxValues.put(FlightDataType.TYPE_TIME, Double.NaN);
|
||||
|
||||
// copy all values into new FlightDataBranch
|
||||
this.addPoint();
|
||||
for (FlightDataType t : parent.getTypes()) {
|
||||
this.setValue(t, parent.getLast(t));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes an 'empty' flight data branch which has no data but all built in data types are defined.
|
||||
|
Loading…
x
Reference in New Issue
Block a user