Show data from the primary flight data branch in each of the stages

prior to stage separation.
This commit is contained in:
kruland2607 2013-02-05 15:20:56 -06:00
parent 15f39a1d24
commit a4efe4f3b9

View File

@ -133,7 +133,12 @@ public class SimulationPlot {
String name = getLabel(type, unit); String name = getLabel(type, unit);
List<String> seriesNames = Util.generateSeriesLabels(simulation); List<String> seriesNames = Util.generateSeriesLabels(simulation);
for (int branchIndex = 0; branchIndex < branchCount; branchIndex++) {
// Populate data for each branch.
// The primary branch (branchIndex = 0) is easy since all the data is copied
{
int branchIndex = 0;
FlightDataBranch thisBranch = simulation.getSimulatedData().getBranch(branchIndex); FlightDataBranch thisBranch = simulation.getSimulatedData().getBranch(branchIndex);
// Store data in provided units // Store data in provided units
List<Double> plotx = thisBranch.get(domainType); List<Double> plotx = thisBranch.get(domainType);
@ -146,6 +151,39 @@ public class SimulationPlot {
} }
data[axis].addSeries(series); data[axis].addSeries(series);
} }
// For each of the secondary branches, we use data from branch 0 for the earlier times
for (int branchIndex = 1; branchIndex < branchCount; branchIndex++) {
FlightDataBranch primaryBranch = simulation.getSimulatedData().getBranch(0);
FlightDataBranch thisBranch = simulation.getSimulatedData().getBranch(branchIndex);
// Get first time index used in secondary branch;
double firstSampleTime = thisBranch.get(FlightDataType.TYPE_TIME).get(0);
XYSeries series = new XYSeries(seriesNames.get(branchIndex) + ": " + name, false, true);
series.setDescription(thisBranch.getBranchName() + ": " + name);
// Copy the first points from the primaryBranch.
List<Double> primaryT = primaryBranch.get(FlightDataType.TYPE_TIME);
List<Double> primaryx = primaryBranch.get(domainType);
List<Double> primaryy = primaryBranch.get(type);
for (int j = 0; j < primaryT.size(); j++) {
if (primaryT.get(j) >= firstSampleTime) {
break;
}
series.add(domainUnit.toUnit(primaryx.get(j)), unit.toUnit(primaryy.get(j)));
}
// Now copy all the data from the secondary branch
List<Double> plotx = thisBranch.get(domainType);
List<Double> ploty = thisBranch.get(type);
int pointCount = plotx.size();
for (int j = 0; j < pointCount; j++) {
series.add(domainUnit.toUnit(plotx.get(j)), unit.toUnit(ploty.get(j)));
}
data[axis].addSeries(series);
}
// Update axis label // Update axis label
if (axisLabel[axis] == null) if (axisLabel[axis] == null)