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