Skip to content

Commit

Permalink
fix(mcdu): improve PERF pages (#8205)
Browse files Browse the repository at this point in the history
* Implement CHECK SPEED MODE message

* Improve layout on PERF pages

* Allow modification of PRED TO altitudes

* Fix displayed managed speed

* Take speed constraint into account for clb speed

* Update changelog

* Fix slash formatting

* Use Mach 0.80 for DES CAS selection only

* Fix input parsing

* Fix layout before FROM/TO entry

* Inhibit CHECK SPEED MODE in excessive attitude

* Fix slash formatting again

* Allow Mach only entries

* Make * on CRZ page small

* fix: changelog 0.12

---------

Co-authored-by: Michael Corcoran <[email protected]>
  • Loading branch information
BlueberryKing and tracernz authored Oct 25, 2023
1 parent 412892b commit 0afca04
Show file tree
Hide file tree
Showing 11 changed files with 635 additions and 233 deletions.
3 changes: 2 additions & 1 deletion .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

1. [EFB/ATSU] Added NOAA (aviationweather.gov) as a METAR source - @tracernz (Mike)
1. [EFB] Fixed the main page and landing calculator to use the selected METAR source - @tracernz (Mike)
1. [FMS] Improve layout of PERF CLB, PERF CRZ and PERF DES pages according to H3 - @BlueberryKing (BlueberryKing)
1. [FMS] Implement CHECK SPEED MODE message - @BlueberryKing (BlueberryKing)

## 0.11.0

Expand Down Expand Up @@ -189,7 +191,6 @@
1. [LIGHTS] Fixed trim decal emissive and floods - @FinalLightNL (FinalLight#2113)
1. [FLIGHTMODEL/FUEL] Fix outer tank transfer behaviour - @donstim (donbikes#4084)


## 0.9.0

1. [MODEL] Add Wheel Chocks and GSE Safety Cones - @bouveng (Johan Bouveng)
Expand Down
4 changes: 4 additions & 0 deletions fbw-a32nx/docs/a320-simvars.md
Original file line number Diff line number Diff line change
Expand Up @@ -1383,6 +1383,10 @@ These variables are the interface between the 3D model and the systems/code.
- Bool
- Indicates if the T/D REACHED message is shown on the PFD

- A32NX_PFD_MSG_CHECK_SPEED_MODE
- Bool
- Indicates if the CHECK SPEED MODE message is shown on the PFD

- A32NX_PFD_LINEAR_DEVIATION_ACTIVE
- Bool
- Indicates if the linear deviation is shown on the PFD
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const NXSystemMessages = {
awyWptMismatch: new TypeIMessage("AWY/WPT MISMATCH"),
cancelAtisUpdate: new TypeIMessage("CANCEL UPDATE BEFORE"),
checkMinDestFob: new TypeIIMessage("CHECK MIN DEST FOB"),
checkSpeedMode: new TypeIIMessage("CHECK SPEED MODE"),
checkToData: new TypeIIMessage("CHECK TAKE OFF DATA", true),
checkWeight: new TypeIIMessage("CHECK WEIGHT", true),
comUnavailable: new TypeIMessage("COM UNAVAILABLE"),
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export interface Fmgc {
getDescentSpeedLimit(): SpeedLimit,
getPreSelectedClbSpeed(): Knots,
getPreSelectedCruiseSpeed(): Knots,
getPreSelectedDescentSpeed(): Knots,
getTakeoffFlapsSetting(): FlapConf | undefined
getManagedDescentSpeed(): Knots,
getManagedDescentSpeedMach(): Mach,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export interface VerticalProfileComputationParameters {
flightPhase: FmgcFlightPhase,
preselectedClbSpeed: Knots,
preselectedCruiseSpeed: Knots,
preselectedDescentSpeed: Knots,
takeoffFlapsSetting?: FlapConf
estimatedDestinationFuel: Pounds,

Expand Down Expand Up @@ -106,7 +105,6 @@ export class VerticalProfileComputationParametersObserver {
flightPhase: this.fmgc.getFlightPhase(),
preselectedClbSpeed: this.fmgc.getPreSelectedClbSpeed(),
preselectedCruiseSpeed: this.fmgc.getPreSelectedCruiseSpeed(),
preselectedDescentSpeed: this.fmgc.getPreSelectedDescentSpeed(),
takeoffFlapsSetting: this.fmgc.getTakeoffFlapsSetting(),
estimatedDestinationFuel: UnitType.TONNE.convertTo(this.fmgc.getDestEFOB(false), UnitType.POUND),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,15 @@ export class McduSpeedProfile implements SpeedProfile {
}

getTarget(distanceFromStart: NauticalMiles, altitude: Feet, managedSpeedType: ManagedSpeedType): Knots {
const { fcuSpeed, flightPhase, preselectedClbSpeed, preselectedCruiseSpeed, preselectedDescentSpeed } = this.parameters.get();
const { fcuSpeed, flightPhase, preselectedClbSpeed, preselectedCruiseSpeed } = this.parameters.get();

let preselectedSpeed = -1;
if (flightPhase < FmgcFlightPhase.Climb && preselectedClbSpeed > 100) {
preselectedSpeed = preselectedClbSpeed;
} else if (flightPhase < FmgcFlightPhase.Cruise && preselectedCruiseSpeed > 100) {
preselectedSpeed = preselectedCruiseSpeed;
} else if (flightPhase < FmgcFlightPhase.Descent && preselectedDescentSpeed > 100) {
preselectedSpeed = preselectedDescentSpeed;
}

const hasPreselectedSpeed = preselectedSpeed > 0;

const isPredictingForCurrentPhase = managedSpeedType === ManagedSpeedType.Climb && flightPhase === FmgcFlightPhase.Climb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
import { MathUtils } from '@flybywiresim/fbw-sdk';
import { VnavConfig } from '@fmgc/guidance/vnav/VnavConfig';

export interface PerfClbToAltPrediction {
export interface PerfToAltPrediction {
altitude: Feet,
distanceFromStart: NauticalMiles,
secondsFromPresent: Seconds,
Expand Down Expand Up @@ -377,23 +377,50 @@ export abstract class BaseGeometryProfile {
this.isReadyToDisplay = true;
}

computePredictionToFcuAltitude(fcuAltitude: Feet): PerfClbToAltPrediction | undefined {
const maxAltitude = this.checkpoints.reduce((currentMax, checkpoint) => Math.max(currentMax, checkpoint.altitude), 0);
computeClimbPredictionToAltitude(altitude: Feet): PerfToAltPrediction | undefined {
const [minAlt, maxAlt] = this.checkpoints.reduce(
([currentMin, currentMax], checkpoint) => [Math.min(currentMin, checkpoint.altitude), Math.max(currentMax, checkpoint.altitude)], [Infinity, -Infinity],
);

if (fcuAltitude < this.checkpoints[0].altitude || fcuAltitude > maxAltitude) {
if (altitude < minAlt || altitude > maxAlt) {
return undefined;
}

const distanceToFcuAltitude = this.interpolateFromCheckpoints(fcuAltitude, (checkpoint) => checkpoint.altitude, (checkpoint) => checkpoint.distanceFromStart);
const distanceToFcuAltitude = this.interpolateFromCheckpoints(altitude, (checkpoint) => checkpoint.altitude, (checkpoint) => checkpoint.distanceFromStart);
const timeToFcuAltitude = this.interpolateTimeAtDistance(distanceToFcuAltitude);

return {
altitude: fcuAltitude,
altitude,
distanceFromStart: distanceToFcuAltitude,
secondsFromPresent: timeToFcuAltitude,
};
}

computeDescentPredictionToAltitude(altitude: Feet): PerfToAltPrediction | undefined {
const [minAlt, maxAlt] = this.checkpoints.reduce(
([currentMin, currentMax], checkpoint) => [Math.min(currentMin, checkpoint.altitude), Math.max(currentMax, checkpoint.altitude)], [Infinity, -Infinity],
);

if (altitude < minAlt || altitude > maxAlt) {
return undefined;
}

const ppos = this.findVerticalCheckpoint(VerticalCheckpointReason.PresentPosition);
if (!ppos) {
return undefined;
}

// TODO: Do this in one call
const distanceToFcuAltitude = this.interpolateFromCheckpointsBackwards(altitude, (checkpoint) => checkpoint.altitude, (checkpoint) => checkpoint.distanceFromStart, true);
const timeToFcuAltitude = this.interpolateFromCheckpointsBackwards(altitude, (checkpoint) => checkpoint.altitude, (checkpoint) => checkpoint.secondsFromPresent, true);

return {
altitude,
distanceFromStart: distanceToFcuAltitude - ppos.distanceFromStart,
secondsFromPresent: timeToFcuAltitude,
};
}

addPresentPositionCheckpoint(presentPosition: LatLongAlt, remainingFuelOnBoard: number, mach: Mach, vman: Knots) {
this.checkpoints.push({
reason: VerticalCheckpointReason.PresentPosition,
Expand Down
29 changes: 26 additions & 3 deletions fbw-a32nx/src/systems/instruments/src/PFD/FMA.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ export class FMA extends DisplayComponent<{ bus: ArincEventBus, isAttExcessive:

private tdReached = false;

private checkSpeedMode = false;

private tcasRaInhibited = Subject.create(false);

private trkFpaDeselected = Subject.create(false);
Expand All @@ -74,7 +76,7 @@ export class FMA extends DisplayComponent<{ bus: ArincEventBus, isAttExcessive:
const sharedModeActive = this.activeLateralMode === 32 || this.activeLateralMode === 33
|| this.activeLateralMode === 34 || (this.activeLateralMode === 20 && this.activeVerticalMode === 24);
const BC3Message = getBC3Message(this.props.isAttExcessive.get(), this.armedVerticalModeSub.get(),
this.setHoldSpeed, this.trkFpaDeselected.get(), this.tcasRaInhibited.get(), this.fcdcDiscreteWord1, this.fwcFlightPhase, this.tdReached)[0] !== null;
this.setHoldSpeed, this.trkFpaDeselected.get(), this.tcasRaInhibited.get(), this.fcdcDiscreteWord1, this.fwcFlightPhase, this.tdReached, this.checkSpeedMode)[0] !== null;

const engineMessage = this.athrModeMessage;
const AB3Message = (this.machPreselVal !== -1
Expand Down Expand Up @@ -162,6 +164,11 @@ export class FMA extends DisplayComponent<{ bus: ArincEventBus, isAttExcessive:
this.tdReached = tdr;
this.handleFMABorders();
});

sub.on('checkSpeedMode').whenChanged().handle((csm) => {
this.checkSpeedMode = csm;
this.handleFMABorders();
});
}

render(): VNode {
Expand Down Expand Up @@ -1192,6 +1199,7 @@ const getBC3Message = (
fcdcWord1: Arinc429Word,
fwcFlightPhase: number,
tdReached: boolean,
checkSpeedMode: boolean,
) => {
const armedVerticalBitmask = armedVerticalMode;
const TCASArmed = (armedVerticalBitmask >> 6) & 1;
Expand Down Expand Up @@ -1237,7 +1245,7 @@ const getBC3Message = (
} else if (false) {
text = 'MORE DRAG';
className = 'FontMedium White';
} else if (false) {
} else if (checkSpeedMode && !isAttExcessive) {
text = 'CHECK SPEED MODE';
className = 'FontMedium White';
} else if (false) {
Expand Down Expand Up @@ -1283,9 +1291,19 @@ class BC3Cell extends DisplayComponent<{ isAttExcessive: Subscribable<boolean>,

private tdReached = false;

private checkSpeedMode = false;

private fillBC3Cell() {
const [text, className] = getBC3Message(
this.isAttExcessive, this.armedVerticalMode, this.setHoldSpeed, this.trkFpaDeselected, this.tcasRaInhibited, this.fcdcDiscreteWord1, this.fwcFlightPhase, this.tdReached,
this.isAttExcessive,
this.armedVerticalMode,
this.setHoldSpeed,
this.trkFpaDeselected,
this.tcasRaInhibited,
this.fcdcDiscreteWord1,
this.fwcFlightPhase,
this.tdReached,
this.checkSpeedMode,
);
this.classNameSub.set(`MiddleAlign ${className}`);
if (text !== null) {
Expand Down Expand Up @@ -1338,6 +1356,11 @@ class BC3Cell extends DisplayComponent<{ isAttExcessive: Subscribable<boolean>,
this.tdReached = tdr;
this.fillBC3Cell();
});

sub.on('checkSpeedMode').whenChanged().handle((csm) => {
this.checkSpeedMode = csm;
this.fillBC3Cell();
});
}

render(): VNode {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export type PFDSimvars = AdirsSimVars & SwitchingPanelVSimVars & {
tdReached: boolean;
trkFpaDeselectedTCAS: boolean;
tcasRaInhibited: boolean;
checkSpeedMode: boolean;
radioAltitude1: number;
radioAltitude2: number;
crzAltMode: boolean;
Expand Down Expand Up @@ -241,6 +242,7 @@ export enum PFDVars {
trkFpaDeselectedTCAS = 'L:A32NX_AUTOPILOT_TCAS_MESSAGE_TRK_FPA_DESELECTION',
tdReached = 'L:A32NX_PFD_MSG_TD_REACHED',
tcasRaInhibited = 'L:A32NX_AUTOPILOT_TCAS_MESSAGE_RA_INHIBITED',
checkSpeedMode = 'L:A32NX_PFD_MSG_CHECK_SPEED_MODE',
radioAltitude1 = 'L:A32NX_RA_1_RADIO_ALTITUDE',
radioAltitude2 = 'L:A32NX_RA_2_RADIO_ALTITUDE',
crzAltMode = 'L:A32NX_FMA_CRUISE_ALT_MODE',
Expand Down Expand Up @@ -400,6 +402,7 @@ export class PFDSimvarPublisher extends UpdatableSimVarPublisher<PFDSimvars> {
['tdReached', { name: PFDVars.tdReached, type: SimVarValueType.Bool }],
['trkFpaDeselectedTCAS', { name: PFDVars.trkFpaDeselectedTCAS, type: SimVarValueType.Bool }],
['tcasRaInhibited', { name: PFDVars.tcasRaInhibited, type: SimVarValueType.Bool }],
['checkSpeedMode', { name: PFDVars.checkSpeedMode, type: SimVarValueType.Bool }],
['radioAltitude1', { name: PFDVars.radioAltitude1, type: SimVarValueType.Number }],
['radioAltitude2', { name: PFDVars.radioAltitude2, type: SimVarValueType.Number }],
['crzAltMode', { name: PFDVars.crzAltMode, type: SimVarValueType.Bool }],
Expand Down

0 comments on commit 0afca04

Please sign in to comment.