Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(fms): fix prediction crash due to invalid thrust limit prediction #9719

Merged
merged 2 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 17 additions & 30 deletions fbw-a32nx/src/systems/fmgc/src/flightplanning/A320AircraftConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,36 +57,23 @@ const engineModelParams: EngineModelParameters = {
numberOfEngines: 2,
fuelBurnFactor: 1.0,
cn1ClimbLimit: [
[0, 2000, 5000, 8000, 12000, 15000, 17000, 20000, 24000, 27000, 31000, 35000, 39000, 41500],
[-54.0, 71.8, 73.6, 75.5, 76.8, 78.1, 78.9, 80.1, 81.5, 81.6, 83.0, 83.6, 83.7, 83.3],
[-50.0, 72.5, 74.3, 76.2, 77.5, 78.8, 79.6, 80.9, 82.2, 82.4, 83.8, 84.4, 84.5, 84.0],
[-46.0, 73.1, 75.0, 76.9, 78.2, 79.5, 80.3, 81.6, 83.0, 83.1, 84.5, 85.1, 85.3, 84.8],
[-42.0, 73.8, 75.6, 77.6, 78.9, 80.2, 81.0, 82.3, 83.7, 83.8, 85.3, 85.9, 86.0, 85.5],
[-38.0, 74.4, 76.3, 78.2, 79.6, 80.9, 81.7, 83.0, 84.4, 84.6, 86.0, 86.6, 86.7, 86.3],
[-34.0, 75.0, 76.9, 78.9, 80.3, 81.6, 82.4, 83.7, 85.1, 85.3, 86.7, 87.3, 87.5, 87.0],
[-30.0, 75.7, 77.6, 79.6, 80.9, 82.2, 83.1, 84.4, 85.8, 86.0, 87.5, 88.1, 88.2, 87.7],
[-26.0, 76.3, 78.2, 80.2, 81.6, 82.9, 83.8, 85.1, 86.5, 86.7, 88.2, 88.8, 88.9, 88.4],
[-22.0, 76.9, 78.8, 80.9, 82.2, 83.6, 84.4, 85.8, 87.2, 87.4, 88.9, 89.5, 89.6, 89.1],
[-18.0, 77.5, 79.5, 81.5, 82.9, 84.2, 85.1, 86.5, 87.9, 88.1, 89.6, 90.2, 90.0, 89.5],
[-14.0, 78.1, 80.1, 82.1, 83.5, 84.9, 85.8, 87.1, 88.6, 88.8, 90.3, 90.0, 89.2, 88.7],
[-10.0, 78.7, 80.7, 82.8, 84.2, 85.6, 86.4, 87.8, 89.3, 89.5, 91.0, 89.2, 88.4, 87.9],
[-6.0, 79.3, 81.3, 83.4, 84.8, 86.2, 87.1, 88.5, 90.0, 90.1, 91.1, 88.5, 87.7, 87.1],
[-2.0, 79.9, 81.9, 84.0, 85.5, 86.8, 87.7, 89.1, 90.6, 90.8, 90.2, 87.7, 86.9, 86.4],
[2.0, 80.5, 82.5, 84.6, 86.1, 87.5, 88.4, 89.8, 91.3, 90.3, 89.5, 87.0, 86.2, 85.6],
[6.0, 81.1, 83.1, 85.3, 86.7, 88.1, 89.0, 90.4, 90.5, 89.5, 88.8, 86.3, 85.5, 84.9],
[10.0, 81.6, 83.7, 85.9, 87.3, 88.7, 89.7, 90.0, 89.6, 88.7, 88.1, 85.6, 84.8, 84.2],
[14.0, 82.2, 84.3, 86.5, 87.9, 89.4, 89.3, 89.1, 88.7, 87.9, 87.5, 84.8, 83.9, 83.3],
[18.0, 82.8, 84.9, 87.1, 88.5, 88.6, 88.4, 88.3, 87.9, 87.2, 86.8, 86.8, 86.8, 86.8],
[22.0, 83.4, 85.5, 86.9, 88.0, 87.8, 87.7, 87.5, 87.2, 86.5, 86.1, 86.1, 86.1, 86.1],
[26.0, 83.9, 85.7, 86.2, 87.2, 87.1, 87.0, 86.8, 86.5, 85.8, 85.4, 85.4, 85.4, 85.4],
[30.0, 84.5, 84.9, 85.4, 86.5, 86.4, 86.3, 86.1, 85.8, 85.1, 85.1, 85.1, 85.1, 85.1],
[34.0, 83.8, 84.2, 84.7, 85.8, 85.7, 85.6, 85.5, 85.1, 85.1, 85.1, 85.1, 85.1, 85.1],
[38.0, 83.0, 83.4, 83.9, 85.1, 85.0, 84.9, 84.8, 84.8, 84.8, 84.8, 84.8, 84.8, 84.8],
[42.0, 82.2, 82.6, 83.1, 84.4, 84.4, 84.3, 84.3, 84.3, 84.3, 84.3, 84.3, 84.3, 84.3],
[46.0, 81.4, 81.8, 82.4, 83.7, 83.7, 83.7, 83.7, 83.7, 83.7, 83.7, 83.7, 83.7, 83.7],
[50.0, 80.6, 81.1, 81.6, 83.0, 83.0, 83.0, 83.0, 83.0, 83.0, 83.0, 83.0, 83.0, 83.0],
[54.0, 79.9, 80.4, 80.4, 80.4, 80.4, 80.4, 80.4, 80.4, 80.4, 80.4, 80.4, 80.4, 80.4],
[58.0, 79.2, 79.2, 79.2, 79.2, 79.2, 79.2, 79.2, 79.2, 79.2, 79.2, 79.2, 79.2, 79.2],
[-2000, 30.8, 56.87, 80.28, 72.0],
[2000, 20.99, 48.157, 82.58, 74.159],
[5000, 16.139, 43.216, 84.642, 75.737],
[8000, 7.342, 38.17, 86.835, 77.338],
[10000, 4.051, 34.518, 88.183, 77.999],
[10000.1, 4.051, 34.518, 87.453, 77.353],
[12000, 0.76, 30.865, 88.303, 78.66],
[15000, -4.859, 25.039, 89.748, 79.816],
[17000, -9.934, 19.813, 90.668, 80.895],
[20000, -15.822, 13.676, 92.106, 81.894],
[24000, -22.75, 6.371, 93.651, 82.716],
[27000, -29.105, -0.304, 93.838, 83.26],
[29314, -32.049, -3.377, 93.502, 82.962],
[31000, -34.98, -6.452, 95.392, 84.11],
[35000, -45.679, -17.15, 96.104, 85.248],
[39000, -45.679, -17.15, 96.205, 84.346],
[41500, -45.679, -17.15, 95.676, 83.745],
],
table1502: [
[0, 0, 0.2, 0.9],
Expand Down
53 changes: 17 additions & 36 deletions fbw-a32nx/src/systems/fmgc/src/flightplanning/A380AircraftConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,43 +55,24 @@ const engineModelParams: EngineModelParameters = {
maxThrust: 80_213,
numberOfEngines: 4,
fuelBurnFactor: 1.33,
/**
* Maximum N1 in CLB thrust
* @param i row index (tat) in steps of 4°C
* @param j col index (pressure altitude, ft)
* @returns Corrected N1 (CN1)
*/
cn1ClimbLimit: [
[0, 2000, 5000, 8000, 12000, 15000, 17000, 20000, 24000, 27000, 31000, 35000, 39000, 41500],
[-54, 82.6, 84.6, 86.8, 88.3, 89.7, 90.7, 92.1, 94.6, 96.2, 99.5, 102.0, 104.1, 105.5],
[-50, 82.6, 84.6, 86.8, 88.3, 89.7, 90.7, 92.1, 94.6, 96.2, 99.5, 102.0, 104.1, 105.5],
[-46, 82.6, 84.6, 86.8, 88.3, 89.7, 90.7, 92.1, 94.6, 96.2, 99.5, 102.0, 104.1, 105.5],
[-42, 82.6, 84.6, 86.8, 88.3, 89.7, 90.7, 92.1, 94.6, 96.2, 99.5, 102.0, 104.1, 105.5],
[-38, 82.6, 84.6, 86.8, 88.3, 89.7, 90.7, 92.1, 94.6, 96.2, 99.5, 102.0, 104.1, 105.5],
[-34, 82.6, 84.6, 86.8, 88.3, 89.7, 90.7, 92.1, 94.6, 96.2, 99.5, 102.0, 104.1, 105.5],
[-30, 82.6, 84.6, 86.8, 88.3, 89.7, 90.7, 92.1, 94.6, 96.2, 99.5, 102.0, 104.1, 105.5],
[-26, 82.6, 84.6, 86.8, 88.3, 89.7, 90.7, 92.1, 94.6, 96.2, 99.5, 102.0, 104.1, 105.5],
[-22, 82.6, 84.6, 86.8, 88.3, 89.7, 90.7, 92.1, 94.6, 96.2, 99.5, 102.0, 104.1, 105.5],
[-18, 82.6, 84.6, 86.8, 88.3, 89.7, 90.7, 92.1, 94.6, 96.2, 99.5, 102.0, 104.1, 105.5],
[-14, 82.6, 84.6, 86.8, 88.3, 89.7, 90.7, 92.1, 94.6, 96.2, 99.5, 100.5, 102.5, 103.9],
[-10, 82.6, 84.6, 86.8, 88.3, 89.7, 90.7, 92.1, 94.6, 96.2, 99.5, 99.1, 100.9, 102.3],
[-6, 82.6, 84.6, 86.8, 88.3, 89.7, 90.7, 92.1, 94.6, 96.2, 99.5, 97.7, 99.3, 100.6],
[-2, 82.6, 84.6, 86.8, 88.3, 89.7, 90.7, 92.1, 94.6, 96.2, 98.1, 96.2, 97.7, 99.0],
[2, 82.6, 84.6, 86.8, 88.3, 89.7, 90.7, 92.1, 94.6, 94.8, 96.6, 94.8, 96.1, 97.3],
[6, 82.6, 84.6, 86.8, 88.3, 89.7, 90.7, 92.1, 93.2, 93.5, 95.1, 93.3, 94.5, 95.7],
[10, 82.6, 84.6, 86.8, 88.3, 89.7, 90.7, 90.8, 91.8, 92.1, 93.7, 91.9, 92.9, 94.0],
[14, 82.6, 84.6, 86.8, 88.3, 89.7, 89.4, 89.6, 90.4, 90.8, 92.2, 90.5, 91.3, 92.4],
[18, 82.6, 84.6, 86.8, 88.3, 88.5, 88.2, 88.3, 89.1, 89.4, 90.7, 89.0, 89.7, 90.7],
[22, 82.6, 84.6, 85.6, 87.1, 87.3, 87.0, 87.0, 87.7, 88.1, 89.2, 87.6, 88.1, 89.1],
[26, 82.6, 84.6, 84.5, 85.9, 86.0, 85.8, 85.7, 86.3, 86.7, 87.8, 86.1, 86.5, 87.4],
[30, 82.6, 83.4, 83.3, 84.7, 84.8, 84.6, 84.4, 84.9, 85.4, 86.3, 84.7, 84.9, 85.8],
[34, 81.4, 82.1, 82.1, 83.5, 83.5, 83.3, 83.2, 83.5, 84.0, 84.8, 83.3, 83.3, 84.2],
[38, 80.2, 80.8, 80.9, 82.3, 82.3, 82.1, 81.9, 82.2, 82.6, 83.4, 81.8, 81.6, 82.5],
[42, 79.0, 79.6, 79.7, 81.1, 81.1, 80.9, 80.6, 80.8, 81.3, 81.9, 80.4, 80.0, 80.9],
[46, 77.8, 78.3, 78.5, 79.9, 79.8, 79.7, 79.3, 79.4, 79.9, 80.4, 78.9, 78.4, 79.2],
[50, 76.6, 77.0, 77.3, 78.7, 78.6, 78.5, 78.1, 78.0, 78.6, 78.9, 77.5, 76.8, 77.6],
[54, 75.4, 75.7, 76.2, 77.5, 77.3, 77.2, 76.8, 76.6, 77.2, 77.5, 76.1, 75.2, 75.9],
[58, 74.2, 74.5, 75.0, 76.3, 76.1, 76.0, 75.5, 75.3, 75.9, 76.0, 74.6, 73.6, 74.3],
[-2000, 30.8, 56.87, 80.28, 72.0],
[2000, 20.99, 48.157, 82.58, 74.159],
[5000, 16.139, 43.216, 84.642, 75.737],
[8000, 7.342, 38.17, 86.835, 77.338],
[10000, 4.051, 34.518, 88.183, 77.999],
[10000.1, 4.051, 34.518, 87.453, 77.353],
[12000, 0.76, 30.865, 88.303, 78.66],
[15000, -4.859, 25.039, 89.748, 79.816],
[17000, -9.934, 19.813, 90.668, 80.895],
[20000, -15.822, 13.676, 92.106, 81.894],
[24000, -22.75, 6.371, 94.588, 83.543],
[27000, -29.105, -0.304, 96.203, 85.358],
[29314, -32.049, -3.377, 96.82, 85.906],
[31000, -34.98, -6.452, 98.568, 86.909],
[35000, -45.679, -17.15, 100.977, 89.57],
[39000, -45.679, -17.15, 103.085, 90.377],
[41500, -45.679, -17.15, 104.509, 91.476],
],
/**
* Table 1502 - CN2 vs CN1 @ Mach 0, 0.2, 0.9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,13 @@ export interface EngineModelParameters {

/**
* Maximum corrected N1 in CLB thrust
* @param i row index (tat) in steps of 4°C
* @param j col index (pressure altitude, ft)
* Each row represents a different altitude and the corresponding engine thrust
* limits. The columns in each row represent the following parameters:
* 1. Altitude (in feet)
* 2. Corner Point (CP) - the temperature below which the engine can operate at full thrust without any restrictions.
* 3. Limit Point (LP) - the temperature above which the engine thrust starts to be limited.
* 4. CN1 Flat - the engine's N1 fan speed limit at the CP temperature.
* 5. CN1 Last - the engine's N1 fan speed limit at the LP temperature.
* @returns Corrected N1 (CN1)
*/
cn1ClimbLimit: readonly (readonly number[])[];
Expand Down
58 changes: 56 additions & 2 deletions fbw-a32nx/src/systems/fmgc/src/guidance/vnav/EngineModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,61 @@ export class EngineModel {
return cn1;
}

static getClimbThrustCorrectedN1(parameters: EngineModelParameters, altitude: Feet, totalAirTemperature: number) {
return EngineModel.tableInterpolation(parameters.cn1ClimbLimit, totalAirTemperature, altitude);
static getClimbThrustCorrectedN1(
parameters: EngineModelParameters,
pressureAltitude: Feet,
outsideTemperature: Celsius,
): number {
let loAltRow = 0;
let hiAltRow = 0;

// Check for over/under flows. Else, find top row value
if (pressureAltitude >= parameters.cn1ClimbLimit[parameters.cn1ClimbLimit.length - 1][0]) {
hiAltRow = parameters.cn1ClimbLimit.length - 1;
loAltRow = parameters.cn1ClimbLimit.length - 1;
} else {
hiAltRow = parameters.cn1ClimbLimit.reduce((acc, val, idx) => {
return val[0] <= pressureAltitude ? idx + 1 : acc;
}, 0);
loAltRow = hiAltRow - 1;
}

// Define key table variables and interpolation
const cp = Common.interpolate(
pressureAltitude,
parameters.cn1ClimbLimit[loAltRow][0],
parameters.cn1ClimbLimit[hiAltRow][0],
parameters.cn1ClimbLimit[loAltRow][1],
parameters.cn1ClimbLimit[hiAltRow][1],
);
const lp = Common.interpolate(
pressureAltitude,
parameters.cn1ClimbLimit[loAltRow][0],
parameters.cn1ClimbLimit[hiAltRow][0],
parameters.cn1ClimbLimit[loAltRow][2],
parameters.cn1ClimbLimit[hiAltRow][2],
);
const cn1Flat = Common.interpolate(
pressureAltitude,
parameters.cn1ClimbLimit[loAltRow][0],
parameters.cn1ClimbLimit[hiAltRow][0],
parameters.cn1ClimbLimit[loAltRow][3],
parameters.cn1ClimbLimit[hiAltRow][3],
);
const cn1Last = Common.interpolate(
pressureAltitude,
parameters.cn1ClimbLimit[loAltRow][0],
parameters.cn1ClimbLimit[hiAltRow][0],
parameters.cn1ClimbLimit[loAltRow][4],
parameters.cn1ClimbLimit[hiAltRow][4],
);

if (outsideTemperature <= cp) {
return cn1Flat;
}

const m = (cn1Last - cn1Flat) / (lp - cp);
const b = cn1Last - m * lp;
return m * outsideTemperature + b;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -457,12 +457,7 @@ export class ClimbPathBuilder {
): StepResults {
const { zeroFuelWeight, managedClimbSpeedMach, tropoPause } = this.computationParametersObserver.get();

const averageCas = (initialSpeed + speedTarget) / 2;
const averageClimbSpeedMach = Math.min(
managedClimbSpeedMach,
this.atmosphericConditions.computeMachFromCas(altitude, averageCas),
);
const totalAirTemperature = this.atmosphericConditions.totalAirTemperatureFromMach(altitude, averageClimbSpeedMach);
const staticAirTemperature = this.atmosphericConditions.predictStaticAirTemperatureAtAltitude(altitude);

return Predictions.speedChangeStep(
config,
Expand All @@ -472,7 +467,7 @@ export class ClimbPathBuilder {
speedTarget,
managedClimbSpeedMach,
managedClimbSpeedMach,
EngineModel.getClimbThrustCorrectedN1(config.engineModelParameters, altitude, totalAirTemperature),
EngineModel.getClimbThrustCorrectedN1(config.engineModelParameters, altitude, staticAirTemperature),
zeroFuelWeight,
fuelWeight,
0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export class VerticalSpeedStrategy implements ClimbStrategy, DescentStrategy {
headwindComponent: WindComponent,
config: AircraftCtlSurfcConfiguration = DEFAULT_AIRCRAFT_CONTROL_SURFACE_CONFIG,
): StepResults {
const { zeroFuelWeight, perfFactor, tropoPause, managedClimbSpeedMach } = this.observer.get();
const { zeroFuelWeight, perfFactor, tropoPause } = this.observer.get();

const computedMach = Math.min(this.atmosphericConditions.computeMachFromCas(initialAltitude, initialSpeed), mach);

Expand All @@ -142,8 +142,6 @@ export class VerticalSpeedStrategy implements ClimbStrategy, DescentStrategy {
this.acConfig.engineModelParameters,
this.atmosphericConditions,
initialAltitude,
initialSpeed,
managedClimbSpeedMach,
)
: EngineModel.getIdleCorrectedN1(
this.acConfig.engineModelParameters,
Expand Down Expand Up @@ -261,7 +259,7 @@ export class FlightPathAngleStrategy implements ClimbStrategy, DescentStrategy {
headwindComponent: WindComponent,
config: AircraftCtlSurfcConfiguration = DEFAULT_AIRCRAFT_CONTROL_SURFACE_CONFIG,
): StepResults {
const { zeroFuelWeight, perfFactor, tropoPause, managedClimbSpeedMach } = this.observer.get();
const { zeroFuelWeight, perfFactor, tropoPause } = this.observer.get();

const computedMach = Math.min(this.atmosphericConditions.computeMachFromCas(initialAltitude, initialSpeed), mach);
const predictedN1 =
Expand All @@ -270,8 +268,6 @@ export class FlightPathAngleStrategy implements ClimbStrategy, DescentStrategy {
this.acConfig.engineModelParameters,
this.atmosphericConditions,
initialAltitude,
initialSpeed,
managedClimbSpeedMach,
)
: EngineModel.getIdleCorrectedN1(
this.acConfig.engineModelParameters,
Expand Down Expand Up @@ -319,7 +315,7 @@ export class ClimbThrustClimbStrategy implements ClimbStrategy {
headwindComponent: WindComponent,
config: AircraftCtlSurfcConfiguration = DEFAULT_AIRCRAFT_CONTROL_SURFACE_CONFIG,
): StepResults {
const { zeroFuelWeight, tropoPause, perfFactor, managedClimbSpeedMach } = this.observer.get();
const { zeroFuelWeight, tropoPause, perfFactor } = this.observer.get();

return Predictions.altitudeStep(
this.acConfig,
Expand All @@ -331,8 +327,6 @@ export class ClimbThrustClimbStrategy implements ClimbStrategy {
this.acConfig.engineModelParameters,
this.atmosphericConditions,
(initialAltitude + finalAltitude) / 2,
speed,
managedClimbSpeedMach,
),
zeroFuelWeight,
fuelOnBoard,
Expand All @@ -355,21 +349,15 @@ export class ClimbThrustClimbStrategy implements ClimbStrategy {
headwindComponent: WindComponent,
config: AircraftCtlSurfcConfiguration = DEFAULT_AIRCRAFT_CONTROL_SURFACE_CONFIG,
): StepResults {
const { zeroFuelWeight, tropoPause, perfFactor, managedClimbSpeedMach } = this.observer.get();
const { zeroFuelWeight, tropoPause, perfFactor } = this.observer.get();

return Predictions.distanceStep(
this.acConfig,
initialAltitude,
distance,
speed,
mach,
getClimbThrustCorrectedN1Limit(
this.acConfig.engineModelParameters,
this.atmosphericConditions,
initialAltitude,
speed,
managedClimbSpeedMach,
),
getClimbThrustCorrectedN1Limit(this.acConfig.engineModelParameters, this.atmosphericConditions, initialAltitude),
zeroFuelWeight,
fuelOnBoard,
headwindComponent.value,
Expand All @@ -391,21 +379,15 @@ export class ClimbThrustClimbStrategy implements ClimbStrategy {
headwindComponent: WindComponent,
config: AircraftCtlSurfcConfiguration = DEFAULT_AIRCRAFT_CONTROL_SURFACE_CONFIG,
): StepResults {
const { zeroFuelWeight, perfFactor, tropoPause, managedClimbSpeedMach } = this.observer.get();
const { zeroFuelWeight, perfFactor, tropoPause } = this.observer.get();

return Predictions.altitudeStepWithSpeedChange(
this.acConfig,
initialAltitude,
initialSpeed,
finalSpeed,
mach,
getClimbThrustCorrectedN1Limit(
this.acConfig.engineModelParameters,
this.atmosphericConditions,
initialAltitude,
initialSpeed,
managedClimbSpeedMach,
),
getClimbThrustCorrectedN1Limit(this.acConfig.engineModelParameters, this.atmosphericConditions, initialAltitude),
zeroFuelWeight,
fuelOnBoard,
headwindComponent.value,
Expand All @@ -423,11 +405,8 @@ function getClimbThrustCorrectedN1Limit(
engineModelParameters: EngineModelParameters,
atmosphericConditions: AtmosphericConditions,
altitude: Feet,
speed: Knots,
maxMach: Mach,
) {
const climbSpeedMach = Math.min(maxMach, atmosphericConditions.computeMachFromCas(altitude, speed));
const estimatedTat = atmosphericConditions.totalAirTemperatureFromMach(altitude, climbSpeedMach);
const staticAirTemperature = atmosphericConditions.predictStaticAirTemperatureAtAltitude(altitude);

return EngineModel.getClimbThrustCorrectedN1(engineModelParameters, altitude, estimatedTat);
return EngineModel.getClimbThrustCorrectedN1(engineModelParameters, altitude, staticAirTemperature);
}
Original file line number Diff line number Diff line change
Expand Up @@ -262,15 +262,7 @@ export class CruisePathBuilder {
const { zeroFuelWeight, cruiseAltitude, managedCruiseSpeedMach, tropoPause } =
this.computationParametersObserver.get();

const averageCas = (speed + finalSpeed) / 2;
const averageClimbSpeedMach = Math.min(
managedCruiseSpeedMach,
this.atmosphericConditions.computeMachFromCas(cruiseAltitude, averageCas),
);
const totalAirTemperature = this.atmosphericConditions.totalAirTemperatureFromMach(
cruiseAltitude,
averageClimbSpeedMach,
);
const staticAirTemperature = this.atmosphericConditions.predictStaticAirTemperatureAtAltitude(cruiseAltitude);

return Predictions.speedChangeStep(
config,
Expand All @@ -280,7 +272,7 @@ export class CruisePathBuilder {
finalSpeed,
managedCruiseSpeedMach,
managedCruiseSpeedMach,
EngineModel.getClimbThrustCorrectedN1(config.engineModelParameters, cruiseAltitude, totalAirTemperature),
EngineModel.getClimbThrustCorrectedN1(config.engineModelParameters, cruiseAltitude, staticAirTemperature),
zeroFuelWeight,
remainingFuelOnBoard,
headwind.value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,12 @@ export class TakeoffPathBuilder {
const startingAltitude = lastCheckpoint.altitude;
const midwayAltitude = (startingAltitude + accelerationAltitude) / 2;

const v2PlusTenMach = this.atmosphericConditions.computeMachFromCas(midwayAltitude, speed);
const estimatedTat = this.atmosphericConditions.totalAirTemperatureFromMach(midwayAltitude, v2PlusTenMach);
const staticAirTemperature = this.atmosphericConditions.predictStaticAirTemperatureAtAltitude(midwayAltitude);

const predictedN1 = EngineModel.getClimbThrustCorrectedN1(
config.engineModelParameters,
midwayAltitude,
estimatedTat,
staticAirTemperature,
);

const { fuelBurned, distanceTraveled, timeElapsed } = Predictions.altitudeStep(
Expand Down
Loading