Explicitly store optimum delay in flight data, instead of recalculating from flight data branch of time it's wanted
This commit is contained in:
parent
587378026e
commit
2759711950
@ -51,7 +51,7 @@ public class FlightData {
|
||||
private double groundHitVelocity = Double.NaN;
|
||||
private double launchRodVelocity = Double.NaN;
|
||||
private double deploymentVelocity = Double.NaN;
|
||||
|
||||
private double optimumDelay = Double.NaN;
|
||||
|
||||
/**
|
||||
* Create a FlightData object with no content. The resulting object is mutable.
|
||||
@ -74,10 +74,11 @@ public class FlightData {
|
||||
* @param groundHitVelocity ground hit velocity.
|
||||
* @param launchRodVelocity velocity at launch rod clearance
|
||||
* @param deploymentVelocity velocity at deployment
|
||||
* @param optimumDelay optimum motor ejection delay time
|
||||
*/
|
||||
public FlightData(double maxAltitude, double maxVelocity, double maxAcceleration,
|
||||
double maxMachNumber, double timeToApogee, double flightTime,
|
||||
double groundHitVelocity, double launchRodVelocity, double deploymentVelocity) {
|
||||
double groundHitVelocity, double launchRodVelocity, double deploymentVelocity, double optimumDelay) {
|
||||
this.maxAltitude = maxAltitude;
|
||||
this.maxVelocity = maxVelocity;
|
||||
this.maxAcceleration = maxAcceleration;
|
||||
@ -87,6 +88,8 @@ public class FlightData {
|
||||
this.groundHitVelocity = groundHitVelocity;
|
||||
this.launchRodVelocity = launchRodVelocity;
|
||||
this.deploymentVelocity = deploymentVelocity;
|
||||
this.optimumDelay = optimumDelay;
|
||||
System.out.println("optimum delay " + optimumDelay);
|
||||
}
|
||||
|
||||
|
||||
@ -188,6 +191,10 @@ public class FlightData {
|
||||
return deploymentVelocity;
|
||||
}
|
||||
|
||||
public double getOptimumDelay() {
|
||||
return optimumDelay;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calculate the max. altitude/velocity/acceleration, time to apogee, flight time
|
||||
@ -201,7 +208,6 @@ public class FlightData {
|
||||
maxAltitude = branch.getMaximum(FlightDataType.TYPE_ALTITUDE);
|
||||
maxVelocity = branch.getMaximum(FlightDataType.TYPE_VELOCITY_TOTAL);
|
||||
maxMachNumber = branch.getMaximum(FlightDataType.TYPE_MACH_NUMBER);
|
||||
|
||||
flightTime = branch.getLast(FlightDataType.TYPE_TIME);
|
||||
|
||||
// Time to apogee
|
||||
@ -227,6 +233,7 @@ public class FlightData {
|
||||
else
|
||||
timeToApogee = Double.NaN;
|
||||
|
||||
optimumDelay = branch.getOptimumDelay();
|
||||
|
||||
// Launch rod velocity + deployment velocity + ground hit velocity
|
||||
for (FlightEvent event : branch.getEvents()) {
|
||||
@ -260,7 +267,8 @@ public class FlightData {
|
||||
" timeToApogee=" + timeToApogee +
|
||||
" flightTime=" + flightTime +
|
||||
" groundHitVelocity=" + groundHitVelocity +
|
||||
" launchRodVelocity=" + launchRodVelocity);
|
||||
" launchRodVelocity=" + launchRodVelocity +
|
||||
" optimumDelay=" + optimumDelay);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1306,14 +1306,10 @@ public class SimulationPanel extends JPanel {
|
||||
return null;
|
||||
|
||||
FlightData data = document.getSimulation(row).getSimulatedData();
|
||||
if (data == null || data.getBranchCount() == 0)
|
||||
if (data == null)
|
||||
return null;
|
||||
|
||||
double val = data.getBranch(0).getOptimumDelay();
|
||||
if (Double.isNaN(val)) {
|
||||
return null;
|
||||
}
|
||||
return val;
|
||||
return data.getOptimumDelay();
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user