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

feat(fmgc): minimums exposed by fmgc #7887

Merged
merged 33 commits into from
Apr 16, 2023
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
e155905
Added conditional logic to set BnrArincSimVar for minimums
MikioDK Feb 28, 2023
b797af9
Fixed a typo in the condition
MikioDK Feb 28, 2023
75c9af1
use same logic as approach msg on ND
MikioDK Mar 6, 2023
a3ef033
Fixed comment typo
MikioDK Mar 6, 2023
642d41f
Merged with new arincword implementation
MikioDK Mar 8, 2023
08e5aac
Merge branch 'master' into a32nx-minimums-exposed-by-fmgc
2hwk Mar 11, 2023
fd3d391
Merge branch 'master' into a32nx-minimums-exposed-by-fmgc
2hwk Mar 11, 2023
1a1de4b
Merge branch 'master' into a32nx-minimums-exposed-by-fmgc
2hwk Mar 11, 2023
e8e0d41
Merge branch 'master' into a32nx-minimums-exposed-by-fmgc
MikioDK Mar 18, 2023
8455ed8
Added logic to only have one NO active for decision height
MikioDK Mar 19, 2023
8bc094c
fixed missing line after merge conflict
MikioDK Mar 19, 2023
aa5c118
Merge branch 'master' into a32nx-minimums-exposed-by-fmgc
2hwk Mar 19, 2023
c6eed0a
Fixed broken setting of value
MikioDK Mar 19, 2023
9fdcfc9
Merge branch 'a32nx-minimums-exposed-by-fmgc' of github.com:MarkusOle…
MikioDK Mar 19, 2023
f121b35
removed comment
MikioDK Mar 22, 2023
534f42d
Correct expose of Minimums and consuming of the Arinc429word to only …
MikioDK Mar 25, 2023
c67bb2b
removed not needed file
MikioDK Mar 25, 2023
d6cacb5
Merge branch 'master' into a32nx-minimums-exposed-by-fmgc
MikioDK Mar 25, 2023
9210b2f
added changelog
MikioDK Mar 25, 2023
5d53f06
Added simvars to docs
MikioDK Mar 29, 2023
a53f59f
fixed simvar docs
MikioDK Mar 29, 2023
5ab36ef
Renamed simvar
MikioDK Mar 29, 2023
88d9368
corrected simvar docs
MikioDK Mar 29, 2023
59c6229
changed valid condition
MikioDK Mar 29, 2023
bc4e64c
include all checks
MikioDK Mar 29, 2023
d46d193
Fix missing FailureWarning check
beheh Mar 29, 2023
e1f0f8c
Fix whitespace
beheh Mar 29, 2023
ce85d32
Merge branch 'master' into a32nx-minimums-exposed-by-fmgc
MikioDK Apr 12, 2023
07dda71
Merge branch 'master' into a32nx-minimums-exposed-by-fmgc
2hwk Apr 15, 2023
6cde058
Merge branch 'master' into a32nx-minimums-exposed-by-fmgc
2hwk Apr 15, 2023
ef00c01
Merge branch 'master' into a32nx-minimums-exposed-by-fmgc
2hwk Apr 15, 2023
27ee832
PFD working again
MikioDK Apr 15, 2023
3bdb3d6
Merge branch 'a32nx-minimums-exposed-by-fmgc' of github.com:MarkusOle…
MikioDK Apr 15, 2023
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
1 change: 1 addition & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
1. [MCDU] Implemented NAVAID page - @tracernz (Mike)
1. [MCDU/ND] Implemented SPECIF VOR/D UNAVAIL message - @tracernz (Mike)
1. [MCDU] Implemented TUNE BBB FFF.FF, SPECIF NDB UNAVAIL messages - @tracernz (Mike)
1. [FMGC/PFD] Implemented FMGC exposure of the Minimums to the PFD - @MikioDK (Yekouri#1836)

## 0.9.0

Expand Down
21 changes: 20 additions & 1 deletion fbw-a32nx/docs/a320-simvars.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
- [Landing Gear (ATA 32)](#landing-gear-ata-32)
- [ATC (ATA 34)](#atc-ata-34)
- [Radio Altimeter (ATA 34)](#radio-altimeter-ata-34)
- [Electronic Flight Bag ATA 46](#electronic-flight-bag--ata-46-)
- [Electronic Flight Bag (ATA 46)](#electronic-flight-bag-ata-46)

## Uncategorized

Expand Down Expand Up @@ -1833,6 +1833,25 @@ In the variables below, {number} should be replaced with one item in the set: {
- 1 - captain's side FMGC
- 2 - f/o's side FMGC

- A32NX_FM{number}_DECISION_HEIGHT
- ARINC429<number>
- The decision height for an approach in feet, as entered on the PERF page.
- Value | Meaning
--- | ---
0 or greater | The decision height in feet
-1 | The pilot has not entered a decision height
-2 | The special value "NO" has been explicitly entered as the decision deight
- {number}
- 1 - captain's side FMGC
- 2 - f/o's side FMGC

- A32NX_FM{number}_MINIMUM_DESCENT_ALTITUDE
- ARINC429<number>
- The minimum descent altitude for a non-precision approach in feet, as entered on the PERF page.
- {number}
- 1 - captain's side FMGC
- 2 - f/o's side FMGC

## Autopilot System

- A32NX_FMA_LATERAL_MODE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ class FMCMainDisplay extends BaseAirliners {
this.arincLandingElevation = FmArinc429OutputWord.empty("LANDING_ELEVATION");
this.arincDestinationLatitude = FmArinc429OutputWord.empty("DEST_LAT");
this.arincDestinationLongitude = FmArinc429OutputWord.empty("DEST_LONG");
this.arincMDA = FmArinc429OutputWord.empty("MINIMUM_DESCENT_ALTITUDE");
this.arincDH = FmArinc429OutputWord.empty("DECISION_HEIGHT");
this.arincThrustReductionAltitude = FmArinc429OutputWord.empty("THR_RED_ALT");
this.arincAccelerationAltitude = FmArinc429OutputWord.empty("ACC_ALT");
this.arincEoAccelerationAltitude = FmArinc429OutputWord.empty("EO_ACC_ALT");
Expand All @@ -192,6 +194,8 @@ class FMCMainDisplay extends BaseAirliners {
this.arincLandingElevation,
this.arincDestinationLatitude,
this.arincDestinationLongitude,
this.arincMDA,
this.arincDH,
this.arincThrustReductionAltitude,
this.arincAccelerationAltitude,
this.arincEoAccelerationAltitude,
Expand All @@ -200,7 +204,6 @@ class FMCMainDisplay extends BaseAirliners {
this.arincMissedEoAccelerationAltitude,
];
}

Init() {
super.Init();
this.initVariables();
Expand Down Expand Up @@ -589,7 +592,7 @@ class FMCMainDisplay extends BaseAirliners {
this.toSpeedsChecks();
this.thrustReductionAccelerationChecks();
this.updateThrustReductionAcceleration();

this.updateMinimums();
this.updateIlsCourse();
}

Expand Down Expand Up @@ -1597,6 +1600,20 @@ class FMCMainDisplay extends BaseAirliners {
}
}

updateMinimums() {
const inRange = this.shouldTransmitMinimums();
const MDAssm = inRange && this.perfApprMDA ? Arinc429Word.SignStatusMatrix.NormalOperation : Arinc429Word.SignStatusMatrix.NoComputedData;
const DHssm = inRange && this.perfApprDH ? Arinc429Word.SignStatusMatrix.NormalOperation : Arinc429Word.SignStatusMatrix.NoComputedData

this.arincMDA.setBnrValue(this.perfApprMDA ? this.perfApprMDA : 0, MDAssm, 17, 131072, 0);
this.arincDH.setBnrValue(this.perfApprDH ? this.perfApprDH : 0, DHssm, 16, 8192, 0);
}

shouldTransmitMinimums() {
const phase = this.flightPhaseManager.phase;
return (phase > FmgcFlightPhases.CRUISE || (phase === FmgcFlightPhases.CRUISE && this.flightPlanManager.getDistanceToDestination(FlightPlans.Active) < 250));
}

getClbManagedSpeedFromCostIndex() {
const dCI = (this.costIndex / 999) ** 2;
return 290 * (1 - dCI) + 330 * dCI;
Expand Down
17 changes: 8 additions & 9 deletions fbw-a32nx/src/systems/instruments/src/PFD/AltitudeIndicator.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ClockEvents, DisplayComponent, EventBus, FSComponent, Subject, Subscribable, VNode } from 'msfssdk';
import { Arinc429SignStatusMatrix, Arinc429Word } from '@shared/arinc429';
import { Arinc429Word } from '@shared/arinc429';
import { VerticalMode } from '@shared/autopilot';
import { PFDSimvars } from './shared/PFDSimvarPublisher';
import { DigitalAltitudeReadout } from './DigitalAltitudeReadout';
Expand Down Expand Up @@ -180,10 +180,9 @@ class MinimumDescentAltitudeIndicator extends DisplayComponent<{ bus: EventBus }
this.updateIndication();
});

sub.on('mda').whenChanged().handle((mda) => {
// TODO get a real word
this.mda.value = mda;
this.mda.ssm = mda > 0 ? Arinc429SignStatusMatrix.NormalOperation : Arinc429SignStatusMatrix.NoComputedData;
sub.on('mdaAr').withArinc429Precision(0).handle((mda) => {
this.mda.value = mda.value;
this.mda.ssm = mda.ssm;
this.updateIndication();
});

Expand Down Expand Up @@ -664,7 +663,7 @@ class AltimeterIndicator extends DisplayComponent<AltimeterIndicatorProps> {

interface MetricAltIndicatorState {
altitude: Arinc429Word;
MDA: number;
MDA: Arinc429Word;
targetAlt: number;
altitudeColor: TargetAltitudeColor;
metricAltToggle: boolean;
Expand All @@ -687,7 +686,7 @@ class MetricAltIndicator extends DisplayComponent<MetricAltIndicatorProps> {

private state: MetricAltIndicatorState = {
altitude: new Arinc429Word(0),
MDA: 0,
MDA: new Arinc429Word(0),
altitudeColor: TargetAltitudeColor.Cyan,
targetAlt: 0,
metricAltToggle: false,
Expand All @@ -698,7 +697,7 @@ class MetricAltIndicator extends DisplayComponent<MetricAltIndicatorProps> {

const sub = this.props.bus.getSubscriber<PFDSimvars & Arinc429Values & ClockEvents & SimplaneValues>();

sub.on('mda').whenChanged().handle((mda) => {
sub.on('mdaAr').withArinc429Precision(0).handle((mda) => {
this.state.MDA = mda;
this.needsUpdate = true;
});
Expand Down Expand Up @@ -748,7 +747,7 @@ class MetricAltIndicator extends DisplayComponent<MetricAltIndicatorProps> {

this.updateAltitudeColor();

if (this.state.altitude.value < this.state.MDA) {
if (!this.state.MDA.isNoComputedData() && this.state.altitude.value < this.state.MDA.value) {
beheh marked this conversation as resolved.
Show resolved Hide resolved
this.metricAltText.instance.classList.replace('Green', 'Amber');
} else {
this.metricAltText.instance.classList.replace('Amber', 'Green');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ class RadioAltAndDH extends DisplayComponent<{ bus: EventBus, filteredRadioAltit

private roll = new Arinc429Word(0);

private dh = 0;
private dh = new Arinc429Word(0);

private filteredRadioAltitude = 0;

Expand Down Expand Up @@ -352,7 +352,7 @@ class RadioAltAndDH extends DisplayComponent<{ bus: EventBus, filteredRadioAltit
this.roll = roll;
});

sub.on('dh').whenChanged().handle((dh) => {
sub.on('dhAr').withArinc429Precision(0).handle((dh) => {
this.dh = dh;
});

Expand Down Expand Up @@ -382,15 +382,15 @@ class RadioAltAndDH extends DisplayComponent<{ bus: EventBus, filteredRadioAltit
const chosenTransalt = this.fmgcFlightPhase <= 3 ? this.transAlt : this.transAltAppr;
const belowTransitionAltitude = chosenTransalt !== 0 && (!this.altitude.isNoComputedData() && !this.altitude.isNoComputedData()) && this.altitude.value < chosenTransalt;
let size = 'FontLarge';
const DHValid = this.dh >= 0;
const DHValid = this.dh.value >= 0 && (!this.dh.isNoComputedData() && !this.dh.isFailureWarning());

let text = '';
let color = 'Amber';

if (raHasData) {
if (raFailed) {
if (raValue < 2500) {
if (raValue > 400 || (raValue > this.dh + 100 && DHValid)) {
if (raValue > 400 || (raValue > this.dh.value + 100 && DHValid)) {
color = 'Green';
}
if (raValue < 400) {
Expand All @@ -400,7 +400,7 @@ class RadioAltAndDH extends DisplayComponent<{ bus: EventBus, filteredRadioAltit
text = Math.round(raValue).toString();
} else if (raValue <= 50) {
text = (Math.round(raValue / 5) * 5).toString();
} else if (raValue > 50 || (raValue > this.dh + 100 && DHValid)) {
} else if (raValue > 50 || (raValue > this.dh.value + 100 && DHValid)) {
text = (Math.round(raValue / 10) * 10).toString();
}
}
Expand All @@ -411,7 +411,7 @@ class RadioAltAndDH extends DisplayComponent<{ bus: EventBus, filteredRadioAltit
}

this.daRaGroup.instance.style.transform = `translate3d(0px, ${-verticalOffset}px, 0px)`;
if (raFailed && DHValid && raValue <= this.dh) {
if (raFailed && DHValid && raValue <= this.dh.value) {
this.attDhText.instance.style.visibility = 'visible';
} else {
this.attDhText.instance.style.visibility = 'hidden';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Arinc429Word } from '@shared/arinc429';
import { DisplayComponent, EventBus, FSComponent, NodeReference, Subject, Subscribable, VNode } from 'msfssdk';
import { Arinc429Values } from './shared/ArincValueProvider';
import { PFDSimvars } from './shared/PFDSimvarPublisher';
Expand Down Expand Up @@ -52,7 +53,7 @@ interface DigitalAltitudeReadoutProps {
}

export class DigitalAltitudeReadout extends DisplayComponent<DigitalAltitudeReadoutProps> {
private mda = 0;
private mda = new Arinc429Word(0);

private altitude = 0;

Expand Down Expand Up @@ -81,7 +82,7 @@ export class DigitalAltitudeReadout extends DisplayComponent<DigitalAltitudeRead

const sub = this.props.bus.getSubscriber<PFDSimvars & Arinc429Values>();

sub.on('mda').whenChanged().handle((mda) => {
sub.on('mdaAr').withArinc429Precision(0).handle((mda) => {
this.mda = mda;
this.updateColor();
});
Expand Down Expand Up @@ -132,7 +133,7 @@ export class DigitalAltitudeReadout extends DisplayComponent<DigitalAltitudeRead
}

private updateColor() {
const color = (this.mda !== 0 && this.altitude < this.mda) ? 'Amber' : 'Green';
const color = ((!this.mda.isNoComputedData() && !this.mda.isFailureWarning()) && this.mda.value !== 0 && this.altitude < this.mda.value) ? 'Amber' : 'Green';
this.colorSub.set(color);
}

Expand Down
18 changes: 9 additions & 9 deletions fbw-a32nx/src/systems/instruments/src/PFD/FMA.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1415,28 +1415,28 @@ class D3Cell extends DisplayComponent<{bus: EventBus}> {
onAfterRender(node: VNode): void {
super.onAfterRender(node);

const sub = this.props.bus.getSubscriber<PFDSimvars>();
const sub = this.props.bus.getSubscriber<PFDSimvars & Arinc429Values>();

sub.on('mda').whenChanged().handle((mda) => {
if (mda !== 0) {
const MDAText = Math.round(mda).toString().padStart(6, ' ');
sub.on('mdaAr').withArinc429Precision(0).handle((mda) => {
if ((!mda.isNoComputedData() && !mda.isFailureWarning()) && mda.value !== 0) {
const MDAText = Math.round(mda.value).toString().padStart(6, ' ');

this.textRef.instance.innerHTML = `<tspan>BARO</tspan><tspan class="Cyan" xml:space="preserve">${MDAText}</tspan>`;
} else {
this.textRef.instance.innerHTML = '';
}
});

sub.on('dh').whenChanged().handle((dh) => {
sub.on('dhAr').withArinc429Precision(0).handle((dh) => {
let fontSize = 'FontSmallest';

if (dh !== -1 && dh !== -2) {
const DHText = Math.round(dh).toString().padStart(4, ' ');
const dhValue = dh.value;
if ((!dh.isNoComputedData() && !dh.isFailureWarning()) && dhValue !== -1 && dhValue !== -2) {
const DHText = Math.round(dhValue).toString().padStart(4, ' ');

this.textRef.instance.innerHTML = `
<tspan>RADIO</tspan><tspan class="Cyan" xml:space="preserve">${DHText}</tspan>
`;
} else if (dh === -2) {
} else if ((!dh.isNoComputedData() && !dh.isFailureWarning()) && dhValue === -2) {
this.textRef.instance.innerHTML = '<tspan>NO DH</tspan>';
fontSize = 'FontMedium';
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export interface Arinc429Values {
irMaintWord: Arinc429Word;
trueHeading: Arinc429Word;
trueTrack: Arinc429Word;
mdaAr: Arinc429Word;
dhAr: Arinc429Word;
}
export class ArincValueProvider {
private roll = new Arinc429Word(0);
Expand Down Expand Up @@ -479,6 +481,14 @@ export class ArincValueProvider {
subscriber.on('trueTrackRaw').handle((word) => {
publisher.pub('trueTrack', new Arinc429Word(word));
});

subscriber.on('mda').handle((word) => {
publisher.pub('mdaAr', new Arinc429Word(word));
});

subscriber.on('dh').handle((word) => {
publisher.pub('dhAr', new Arinc429Word(word));
});
}

private determineAndPublishChosenRadioAltitude(publisher: Publisher<Arinc429Values>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ export enum PFDVars {
athrModeMessage = 'L:A32NX_AUTOTHRUST_MODE_MESSAGE',
machPreselVal = 'L:A32NX_MachPreselVal',
speedPreselVal = 'L:A32NX_SpeedPreselVal',
mda = 'L:AIRLINER_MINIMUM_DESCENT_ALTITUDE',
dh = 'L:AIRLINER_DECISION_HEIGHT',
mda = 'L:A32NX_FM1_MINIMUM_DESCENT_ALTITUDE',
dh = 'L:A32NX_FM1_DECISION_HEIGHT',
attHdgKnob = 'L:A32NX_ATT_HDG_SWITCHING_KNOB',
airKnob = 'L:A32NX_AIR_DATA_SWITCHING_KNOB',
vsBaro = 'L:A32NX_ADIRS_ADR_1_BAROMETRIC_VERTICAL_SPEED',
Expand Down