Skip to content

Commit

Permalink
Merge branch 'master' into fix-a380-pseudo-waypoint-crossing-spd-limit
Browse files Browse the repository at this point in the history
  • Loading branch information
bulenteroglu authored Jan 18, 2025
2 parents a5b2693 + 43f8291 commit 3b26a26
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 41 deletions.
3 changes: 2 additions & 1 deletion .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@
1. [A380X/FCU] Add TRUE indication on FCU when TRUE North reference is selected on AFS CP - @heclak (Heclak)
1. [A380X/MFD] Add airport data page into the MFD (DATA > AIRPORT) - @bulenteroglu (senolitam)
1. [A380X/EFB] Adds PRIM/SEC/FCDC failures to EFB - @flogross89 (floridude)

1. [A380X/PFD] Fix precision of pitch trim indicator - @flogross89 (floridude)
1. [A380X/MFD] Add leading zero to altitude prediction and track from last waypoint on FPLN page - @bulenteroglu (senolitam)

## 0.12.0

Expand Down
16 changes: 8 additions & 8 deletions fbw-a32nx/src/systems/shared/src/performance/a32nx_takeoff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class A320251NTakeoffPerformanceCalculator implements TakeoffPerformanceC

/** CONF 1+F runway limited weights at sea level/ISA/0 slope/no bleed/fwd cg/no wind/dry, MTOW [kg], runway length [metres] => lookup key = (runway length) */
private static readonly runwayPerfLimitConf1 = new LerpLookupTable([
[54_000, 1000],
[53_950, 1000],
[59_300, 1219],
[68_700, 1604],
[75_700, 1959],
Expand Down Expand Up @@ -914,31 +914,31 @@ export class A320251NTakeoffPerformanceCalculator implements TakeoffPerformanceC
};

private static readonly v2SecondSegBrakeThresholds: Record<number, [number, number]> = {
1: [-0.009368, 186.79],
1: [-0.011031, 189.0],
2: [0.02346, 68.33],
3: [0.022112, 83.141],
3: [0.014175, 106.14],
};

private static readonly v2SecondSegBrakeBaseTable1: Record<number, [number, number]> = {
1: [0.72637, 101.077],
2: [0.74005, 97.073],
2: [0.74005, 97.048],
3: [0.3746, 130.078],
};

private static readonly v2SecondSegBrakeBaseTable2: Record<number, [number, number]> = {
1: [0.63964, 102.127],
2: [0.692636, 92.9863],
1: [0.868263, 85.8],
2: [0.46666, 111.0],
3: [0.859926, 82.4377],
};

private static readonly v2SecondSegBrakeRunwayTable1: Record<number, [number, number]> = {
1: [3180, -0.015997],
2: [3180, -0.014862],
2: [3180, -0.012],
3: [3180, -0.019296],
};

private static readonly v2SecondSegBrakeRunwayTable2: Record<number, [number, number]> = {
1: [3180, -0.003612],
1: [3180, -0.007],
2: [3180, -0.007],
3: [3180, -0.013],
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1304,7 +1304,7 @@ class FplnLegLine extends DisplayComponent<FplnLegLineProps> {
this.fpaRef.instance.innerText = '';
} else {
this.trackRef.instance.innerText = data.trackFromLastWpt
? `${data.trackFromLastWpt.toFixed(0)}°${this.props.trueTrack.get() ? 'T' : ''}`
? `${data.trackFromLastWpt.toFixed(0).padStart(3, '0')}°${this.props.trueTrack.get() ? 'T' : ''}`
: '';
this.distRef.instance.innerText = data.distFromLastWpt?.toFixed(0) ?? '';
this.fpaRef.instance.innerText = data.fpa ? data.fpa.toFixed(1) : '';
Expand Down Expand Up @@ -1445,7 +1445,11 @@ class FplnLegLine extends DisplayComponent<FplnLegLineProps> {
) {
altStr = <span style="font-family: HoneywellMCDU, monospace;">"</span>;
} else if (!isBelowTransAlt) {
altStr = <span>{`FL${Math.round(data.altitudePrediction / 100).toString()}`}</span>;
altStr = (
<span>{`FL${Math.round(data.altitudePrediction / 100)
.toString()
.padStart(3, '0')}`}</span>
);
} else {
const roundedAltitude = MathUtils.round(data.altitudePrediction, 10).toFixed(0);
altStr = <span>{roundedAltitude}</span>;
Expand Down
8 changes: 0 additions & 8 deletions fbw-a380x/src/systems/instruments/src/PFD/PFD.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { A380Failure } from '@flybywiresim/failures';
import {
ClockEvents,
ComponentProps,
Expand Down Expand Up @@ -103,8 +102,6 @@ export class PFDComponent extends DisplayComponent<PFDProps> {
public onAfterRender(node: VNode): void {
super.onAfterRender(node);

this.failuresConsumer.register(getDisplayIndex() === 1 ? A380Failure.LeftPfdDisplay : A380Failure.RightPfdDisplay);

this.sub.on('headingAr').handle((h) => {
if (this.headingFailed.get() !== h.isNormalOperation()) {
this.headingFailed.set(!h.isNormalOperation());
Expand All @@ -124,11 +121,6 @@ export class PFDComponent extends DisplayComponent<PFDProps> {
.atFrequency(1)
.handle((_t) => {
this.failuresConsumer.update();
this.displayFailed.set(
this.failuresConsumer.isActive(
getDisplayIndex() === 1 ? A380Failure.LeftPfdDisplay : A380Failure.RightPfdDisplay,
),
);
if (
!this.isAttExcessive.get() &&
((this.pitch.isNormalOperation() && (this.pitch.value > 25 || this.pitch.value < -13)) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class PitchTrimDisplay extends DisplayComponent<{ bus: EventBus; visible:

private readonly fwcFlightPhase = ConsumerSubject.create(this.sub.on('fwcFlightPhase'), 0);

private readonly cgPercent = ConsumerSubject.create(this.sub.on('cgPercent').withPrecision(2), 0).map(
private readonly cgPercent = ConsumerSubject.create(this.sub.on('cgPercent').withPrecision(4), 0).map(
(it) => it * 100,
);

Expand Down
19 changes: 2 additions & 17 deletions fbw-a380x/src/systems/shared/src/OperatingSpeeds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -402,29 +402,14 @@ function getVfeNIdx(fi: number): number {
}
}

/**
* Convert degrees Celsius into Kelvin
* @param T degrees Celsius
* @returns degrees Kelvin
*/
function convertCtoK(T: number): number {
return T + 273.15;
}

/**
* Get correct Vmax for Vmo and Mmo in knots
* @returns Min(Vmo, Mmo)
* @private
*/
function getVmo() {
return Math.min(
Vmo,
MathUtils.convertMachToKCas(
Mmo,
convertCtoK(Simplane.getAmbientTemperature()),
SimVar.GetSimVarValue('AMBIENT PRESSURE', 'millibar'),
),
);
// FIXME use ADR corrected average static pressure
return Math.min(Vmo, MathUtils.convertMachToKCas(Mmo, SimVar.GetSimVarValue('AMBIENT PRESSURE', 'millibar')));
}

export class A380OperatingSpeeds {
Expand Down
10 changes: 10 additions & 0 deletions fbw-common/src/systems/shared/src/MathUtils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,14 @@ describe('MathUtils.correctMsfsLocaliserError', () => {
expect(MathUtils.correctMsfsLocaliserError(177.5)).toBeCloseTo(2.5);
expect(MathUtils.correctMsfsLocaliserError(90.1)).toBeCloseTo(89.9);
});

describe('MathUtils.convertMachToKCas', () => {
it('correctly converts mach to CAS', () => {
expect(MathUtils.convertMachToKCas(0, 1013.25)).toBeCloseTo(0);
expect(MathUtils.convertMachToKCas(0.84, 1013.25)).toBeCloseTo(555.634);
// FL350 = 238.423 hPa
expect(MathUtils.convertMachToKCas(0, 238.423)).toBeCloseTo(0);
expect(MathUtils.convertMachToKCas(0.84, 238.423)).toBeCloseTo(287.097);
});
});
});
11 changes: 7 additions & 4 deletions fbw-common/src/systems/shared/src/MathUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ export class MathUtils {
return (
1479.1 *
Math.sqrt(
((pressure / 1013) * ((1 + (1 / (oat / 288.15)) * (tas / 1479.1) ** 2) ** 3.5 - 1) + 1) ** (1 / 3.5) - 1,
((pressure / 1013.25) * ((1 + (1 / (oat / 288.15)) * (tas / 1479.1) ** 2) ** 3.5 - 1) + 1) ** (1 / 3.5) - 1,
)
);
}
Expand All @@ -306,7 +306,7 @@ export class MathUtils {
1479.1 *
Math.sqrt(
(oat / 288.15) *
(((1 / (pressure / 1013)) * ((1 + 0.2 * (kcas / 661.4786) ** 2) ** 3.5 - 1) + 1) ** (1 / 3.5) - 1),
(((1 / (pressure / 1013.25)) * ((1 + 0.2 * (kcas / 661.4786) ** 2) ** 3.5 - 1) + 1) ** (1 / 3.5) - 1),
)
);
}
Expand All @@ -318,8 +318,11 @@ export class MathUtils {
* @param pressure current pressure hpa
* @returns Calibrated Air Speed
*/
public static convertMachToKCas(mach: number, oat: number, pressure: number): number {
return MathUtils.convertTasToKCas(MathUtils.convertMachToKTas(mach, oat), oat, pressure);
public static convertMachToKCas(mach: number, pressure: number): number {
// Formula from Jet Transport Performance Methods 2009.
return (
1479.1 * Math.sqrt(Math.pow((pressure / 1013.25) * (Math.pow(0.2 * mach * mach + 1, 3.5) - 1) + 1, 1 / 3.5) - 1)
);
}

/**
Expand Down

0 comments on commit 3b26a26

Please sign in to comment.