diff --git a/fbw-a32nx/docs/a320-simvars.md b/fbw-a32nx/docs/a320-simvars.md index 47aef8c229ff..13c331c831e7 100644 --- a/fbw-a32nx/docs/a320-simvars.md +++ b/fbw-a32nx/docs/a320-simvars.md @@ -1300,9 +1300,9 @@ These variables are the interface between the 3D model and the systems/code. ## EIS Display System -- A32NX_EFIS_{side}_NAVAID_{1|2}_MODE +- A32NX_FCU_EFIS_{side}_NAVAID_{1|2}_MODE - Enum - - Provides the selected NAVAIDs for display on the EFIS + - Provides the selected NAVAID knob posiiton. For use systems, use the FCU discrete words instead. Value | Meaning --- | --- 0 | Off @@ -1312,9 +1312,9 @@ These variables are the interface between the 3D model and the systems/code. - L - R -- A32NX_EFIS_{side}_ND_MODE +- A32NX_FCU_EFIS_{side}_EFIS_MODE - Enum - - Provides the selected navigation display mode for the EFIS + - Provides the navigation display mode knob position. For use systems, use the FCU discrete words instead. Value | Meaning --- | --- 0 | ROSE ILS @@ -1326,9 +1326,9 @@ These variables are the interface between the 3D model and the systems/code. - L - R -- A32NX_EFIS_{side}_ND_RANGE +- A32NX_FCU_EFIS_{side}_EFIS_RANGE - Enum - - Provides the selected navigation display range for the EFIS + - Provides the selected navigation display range knob position. For use systems, use the FCU discrete words instead. Value | Meaning --- | --- 0 | 10 @@ -1341,17 +1341,16 @@ These variables are the interface between the 3D model and the systems/code. - L - R -- A32NX_EFIS_{side}_OPTION - - Enum - - Provides the selected EFIS option/overlay - Value | Meaning - --- | --- - 0 | None - 1 | Constraints - 2 | VOR/DMEs - 3 | Waypoints - 4 | NDBs - 5 | Airports +- A32NX_FCU_EFIS_{side}_{FILTER}_LIGHT_ON + - Bool + - If the related EFIS filter is selected, this Lvar is true. For use systems, use the FCU discrete words instead. + - {FILTER} + - None + - Constraints + - VOR/DMEs + - Waypoints + - NDBs + - Airports - {side} - L - R @@ -3186,7 +3185,169 @@ In the variables below, {number} should be replaced with one item in the set: { - Bool ## Autoflight (ATA 22) -- - A32NX_FAC_{number}_PUSHBUTTON_PRESSED +- A32NX_FMGC_{number}_HEALTHY + - Indicates if this FMGC is healthy + - Boolean + +- A32NX_FMGC_{number}_ATHR_ENGAGED + - Indicates if the A/THR of this FMGC is engaged + - Boolean + +- A32NX_FMGC_{number}_FD_ENGAGED + - Indicates if the FD of this FMGC is engaged + - Boolean + +- A32NX_FMGC_{number}_AP_ENGAGED + - Indicates if the AP of this FMGC is engaged + - Boolean + +- A32NX_FMGC_{number}_ROLL_FD_COMMAND + - The Roll FD command + - Arinc429 + +- A32NX_FMGC_{number}_PITCH_FD_COMMAND + - The Pitch FD command + - Arinc429 + +- A32NX_FMGC_{number}_YAW_FD_COMMAND + - The Yaw FD command + - Arinc429 + +- A32NX_FMGC_{number}_DISCRETE_WORD_5 + - Arinc429 + - | Bit | Description | + |:---:|:---------------------------------:| + | 11 | Mach Selected | + | 12 | VPATH/SPEED submode active | + | 13 | VPATH/THRUST submode active | + | 14 | V/S selected submode active | + | 15 | FPA selected submode active | + | 16 | Alt selected submode active | + | 19 | AUTO SPD control active | + | 20 | MANUAL SPD control active | + | 24 | Pitch FD bars flashing | + | 27 | SPD Window Display | + | 28 | Top of SPD Synchro | + | 29 | FMS Mach Selection | + +- A32NX_FMGC_{number}_DISCRETE_WORD_4 + - Arinc429 + - | Bit | Description | + |:---:|:---------------------------------:| + | 11 | AP Instinctive Disc | + | 12 | AP Engaged | + | 13 | FD Engaged | + | 14 | LAND TRK mode active | + | 16 | LAND 2 Capability | + | 17 | LAND 3 FAIL PASSIVE Capability | + | 18 | LAND 3 FAIL OP Capability | + | 19 | AP Inop | + | 20 | LAND 2 Inop | + | 21 | LAND 3 FAIL PASSIVE Inop | + | 22 | LAND 3 FAIL OP Inop | + | 23 | LAND 2 Capacity | + | 24 | LAND 3 FAIL PASSIVE Capacity | + | 25 | LAND 3 FAIL OP Capacity | + | 26 | RWY Heading memorized | + +- A32NX_FMGC_{number}_ATS_DISCRETE_WORD + - Arinc429 + - | Bit | Description | + |:---:|:---------------------------------:| + | 13 | A/THR Engaged | + | 14 | A/THR Active | + | 17 | A/THR Instinctive Disconnect | + | 18 | A/THR SPD MACH mode | + | 19 | FCU Mach Selection | + | 20 | RETARD Mode Active | + | 21 | THRUST N1 Mode Active | + | 22 | THRUST EPR Mode Active | + | 23 | A/THR ALPHA FLOOR | + | 24 | A/THR Inop | + +- A32NX_FMGC_{number}_ATS_FMA_DISCRETE_WORD + - Arinc429 + - | Bit | Description | + |:---:|:---------------------------------:| + | 11 | TO/GA Display | + | 12 | MCT Display | + | 13 | FLX Display | + | 14 | CLB Display | + | 15 | THR Display | + | 16 | IDLE Display | + | 17 | A.FLOOR Display | + | 18 | SPEED Display | + | 19 | MACH Display | + | 20 | ASYM Display | + | 21 | CLB Demand Display | + | 22 | MCT Demand Display | + +- A32NX_FMGC_{number}_DISCRETE_WORD_3 + - Arinc429 + - | Bit | Description | + |:---:|:---------------------------------:| + | 11 | HDG Preset | + | 12 | ALT ACQ Arm | + | 13 | ALT ACQ Arm Possible | + | 14 | NAV Arm | + | 16 | LOC Arm | + | 17 | FG Approach Phase | + | 18 | FMA LONGI Mode | + | 19 | LOC Backbeam Selection | + | 20 | LAND Arm | + | 21 | GS Capt Before LOC Capt | + | 22 | GLIDE Arm | + | 23 | FINAL DES Arm | + | 24 | CLB Arm | + | 25 | DES Arm | + | 26 | LONG MODE Reset | + | 27 | LAT MODE Reset | + | 28 | QFU Equal COM | + | 29 | FMA Longi Box | + +- A32NX_FMGC_{number}_DISCRETE_WORD_1 + - Arinc429 + - | Bit | Description | + |:---:|:---------------------------------:| + | 11 | Climb Mode | + | 12 | Descent Mode | + | 13 | Immediate Mode | + | 14 | Open Mode | + | 15 | Pitch T/O Mode | + | 16 | Pitch G/A Mode | + | 17 | V/S Mode | + | 18 | FPA Mode | + | 19 | ALT Mode | + | 20 | Track Mode | + | 21 | Capture Mode | + | 22 | G/S Mode | + | 23 | FINAL DES Mode | + | 24 | EXPED Mode | + | 25 | FLARE Mode | + | 26 | FMA Dash Display | + | 27 | FMA SPEED/MACH Preset Display | + +- A32NX_FMGC_{number}_DISCRETE_WORD_2 + - Arinc429 + - | Bit | Description | + |:---:|:---------------------------------:| + | 11 | Runway Mode | + | 12 | NAV Mode | + | 13 | LOC Capture Mode | + | 14 | LOC Track Mode | + | 15 | Roll G/A Mode | + | 16 | HDG Mode | + | 17 | TRK Mode | + | 20 | Runway LOC Submode | + | 21 | H/PATH Submode | + | 22 | HDG Submode | + | 23 | Runway TRK Submode | + | 24 | VOR Submode | + | 25 | ALIGN Submode | + | 26 | ROLLOUT Submode | + | 28 | Roll FD Bars Flashing | + +- A32NX_FAC_{number}_PUSHBUTTON_PRESSED - Boolean - A32NX_FAC_{number}_HEALTHY diff --git a/fbw-a32nx/mach.config.js b/fbw-a32nx/mach.config.js index 9f564c5a5bb4..452544061d5e 100644 --- a/fbw-a32nx/mach.config.js +++ b/fbw-a32nx/mach.config.js @@ -34,6 +34,7 @@ module.exports = { msfsAvionicsInstrument('ND'), msfsAvionicsInstrument('EWD'), msfsAvionicsInstrument('Clock'), + msfsAvionicsInstrument('FCU'), reactInstrument('SD'), reactInstrument('DCDU'), diff --git a/fbw-a32nx/src/base/flybywire-aircraft-a320-neo/ModelBehaviorDefs/A32NX/Airbus.xml b/fbw-a32nx/src/base/flybywire-aircraft-a320-neo/ModelBehaviorDefs/A32NX/Airbus.xml index 8aa996fb54ef..637d3da150d3 100644 --- a/fbw-a32nx/src/base/flybywire-aircraft-a320-neo/ModelBehaviorDefs/A32NX/Airbus.xml +++ b/fbw-a32nx/src/base/flybywire-aircraft-a320-neo/ModelBehaviorDefs/A32NX/Airbus.xml @@ -25,25 +25,6 @@ - - - - - - - - - - - - - - - - - - @@ -54,8 +36,8 @@ %((L:A32NX_AUTOTHRUST_STATUS, enum) 0 >)%{if}TT:COCKPIT.TOOLTIPS.AUTOPILOT_PANEL_AUTOTHROTTLE_ARMED%{else}TT:COCKPIT.TOOLTIPS.AUTOPILOT_PANEL_AUTOTHROTTLE_OFF%{end} - 1 (>K:AUTO_THROTTLE_ARM) - (L:A32NX_AUTOTHRUST_STATUS, enum) 0 > + 'A32NX.FCU_ATHR_PUSH' (>F:KeyEvent) + (L:A32NX_FCU_ATHR_LIGHT_ON, Bool) @@ -74,8 +56,8 @@ - (>H:A320_Neo_FCU_LOC_PUSH) - (L:A32NX_FCU_LOC_MODE_ACTIVE, bool) + 'A32NX.FCU_LOC_PUSH' (>F:KeyEvent) + (L:A32NX_FCU_LOC_LIGHT_ON, bool) @@ -94,8 +76,8 @@ - (>H:A320_Neo_FCU_APPR_PUSH) - (L:A32NX_FCU_APPR_MODE_ACTIVE, bool) + 'A32NX.FCU_APPR_PUSH' (>F:KeyEvent) + (L:A32NX_FCU_APPR_LIGHT_ON, bool) @@ -108,8 +90,8 @@ 1 - (>H:A320_Neo_FCU_EXPED_PUSH) - (L:A32NX_FMA_EXPEDITE_MODE, bool) + 'A32NX.FCU_EXPED_PUSH' (>F:KeyEvent) + (L:A32NX_FCU_EXPED_LIGHT_ON, bool) @@ -134,53 +116,31 @@ - - - - #ANIM_NAME# - - (>H:A320_Neo_FCU_SPEED_DEC) - - - (>H:A320_Neo_FCU_SPEED_INC) - - - (>H:A320_Neo_FCU_SPEED_PULL) - - - (>H:A320_Neo_FCU_SPEED_PUSH) - - QNHknob - QNHknob - - UpArrow - DownArrow - TT:COCKPIT.TOOLTIPS.AUTOPILOT_PANEL_SPEED_DECREASE - TT:COCKPIT.TOOLTIPS.AUTOPILOT_PANEL_SPEED_INCREASE - TT:COCKPIT.TOOLTIPS.AUTOPILOT_PANEL_SPEED_ENGAGE_MANAGE_MODE - TT:COCKPIT.TOOLTIPS.AUTOPILOT_PANEL_SPEED_ENGAGE_SELECTED_AIRSPEED_MODE - - - - - #ANIM_NAME# - (A:AUTOPILOT MANAGED SPEED IN MACH, Bool) if{ 1 (>K:AP_MACH_VAR_DEC) } els{ 1 (>K:AP_SPD_VAR_DEC) } - (A:AUTOPILOT MANAGED SPEED IN MACH, Bool) if{ 1 (>K:AP_MACH_VAR_INC) } els{ 1 (>K:AP_SPD_VAR_INC) } - (>K:AP_MANAGED_SPEED_IN_MACH_TOGGLE) - autopilot_knob_push_button_on - autopilot_knob_push_button_off - - - - - (L:XMLVAR_AirSpeedIsInMach) if{ (>K:AP_MACH_VAR_DEC) } els{ (>K:AP_SPD_VAR_DEC) } - (L:XMLVAR_AirSpeedIsInMach) if{ (>K:AP_MACH_VAR_INC) } els{ (>K:AP_SPD_VAR_INC) } - autopilot_knob_push_button_on - autopilot_knob_push_button_off - - - + + #ANIM_NAME# + + 'A32NX.FCU_SPD_DEC' (>F:KeyEvent) + + + 'A32NX.FCU_SPD_INC' (>F:KeyEvent) + + + 'A32NX.FCU_SPD_PULL' (>F:KeyEvent) + + + 'A32NX.FCU_SPD_PUSH' (>F:KeyEvent) + + QNHknob + QNHknob + + UpArrow + DownArrow + TT:COCKPIT.TOOLTIPS.AUTOPILOT_PANEL_SPEED_DECREASE + TT:COCKPIT.TOOLTIPS.AUTOPILOT_PANEL_SPEED_INCREASE + TT:COCKPIT.TOOLTIPS.AUTOPILOT_PANEL_SPEED_ENGAGE_MANAGE_MODE + TT:COCKPIT.TOOLTIPS.AUTOPILOT_PANEL_SPEED_ENGAGE_SELECTED_AIRSPEED_MODE + @@ -189,23 +149,11 @@ SpeedToggle - - - - (>H:A320_Neo_FCU_SPEED_TOGGLE_SPEED_MACH) - - (A:AUTOPILOT MANAGED SPEED IN MACH, Bool) - %((A:AUTOPILOT MANAGED SPEED IN MACH, Bool))%{if}TT:COCKPIT.TOOLTIPS.AUTOPILOT_PANEL_SPD_MACH%{else}TT:COCKPIT.TOOLTIPS.AUTOPILOT_PANEL_SPD_KNOT%{end} - - - - (>K:AP_MANAGED_SPEED_IN_MACH_TOGGLE) - (L:XMLVAR_AirSpeedIsInMach) ! (>L:XMLVAR_AirSpeedIsInMach) - - (L:XMLVAR_AirSpeedIsInMach) - %((L:XMLVAR_AirSpeedIsInMach, bool))%{if}TT:COCKPIT.TOOLTIPS.AUTOPILOT_PANEL_SPD_MACH%{else}TT:COCKPIT.TOOLTIPS.AUTOPILOT_PANEL_SPD_KNOT%{end} - - + + 'A32NX.FCU_SPD_MACH_TOGGLE_PUSH' (>F:KeyEvent) + + (A:AUTOPILOT MANAGED SPEED IN MACH, Bool) + %((A:AUTOPILOT MANAGED SPEED IN MACH, Bool))%{if}TT:COCKPIT.TOOLTIPS.AUTOPILOT_PANEL_SPD_MACH%{else}TT:COCKPIT.TOOLTIPS.AUTOPILOT_PANEL_SPD_KNOT%{end} @@ -223,7 +171,7 @@ AUTOPILOT_Switch_Altitude_Increment AUTOPILOT_Switch_Altitude_Increment Animtip - 1000 + 1 AUTOPILOT @@ -231,7 +179,7 @@ True - #INIT_ALTITUDE# (>L:XMLVAR_Autopilot_Altitude_Increment) + #INIT# (>L:A32NX_FCU_ALT_INCREMENT_1000) @@ -240,16 +188,16 @@ True @TT_Package.AUTOPILOT_KNOB_ALTITUDE_INCREMENT_ACTION @TT_Package.AUTOPILOT_KNOB_ALTITUDE_INCREMENT_TITLE - (L:XMLVAR_Autopilot_Altitude_Increment) sp0 - l0 1000 == - 100 (>L:XMLVAR_Autopilot_Altitude_Increment) - 1000 (>L:XMLVAR_Autopilot_Altitude_Increment) + (L:A32NX_FCU_ALT_INCREMENT_1000) sp0 + l0 1 == + 0 (>L:A32NX_FCU_ALT_INCREMENT_1000) + 1 (>L:A32NX_FCU_ALT_INCREMENT_1000) Hundred Thousand '100' '1000' False - XMLVAR_Autopilot_Altitude_Increment + A32NX_FCU_ALT_INCREMENT_1000 lswitch lswitch diff --git a/fbw-a32nx/src/behavior/src/A32NX_Interior_EFIS.xml b/fbw-a32nx/src/behavior/src/A32NX_Interior_EFIS.xml index ae8e5bfcbdc9..8831bc0a9f5d 100644 --- a/fbw-a32nx/src/behavior/src/A32NX_Interior_EFIS.xml +++ b/fbw-a32nx/src/behavior/src/A32NX_Interior_EFIS.xml @@ -8,19 +8,12 @@ LS - - LS_Button - LS_#ID# - LS - A320_Neo - - - (L:BTN_LS_#ID#_FILTER_ACTIVE, boolean) + (L:A32NX_FCU_EFIS_#SIDE#_LS_LIGHT_ON, boolean) - - (H:A320_Neo_PFD_BTN_LS_#ID#, boolean) = true; + + 'A32NX.FCU_EFIS_#SIDE#_LS_PUSH' (>F:KeyEvent) @@ -36,10 +29,10 @@ - (A:AUTOPILOT FLIGHT DIRECTOR ACTIVE:#ID#, boolean) + (L:A32NX_FCU_EFIS_#SIDE#_FD_LIGHT_ON, boolean) - - (K:TOGGLE_FLIGHT_DIRECTOR, number) = #ID, number#; + + 'A32NX.FCU_EFIS_#SIDE#_FD_PUSH' (>F:KeyEvent) @@ -52,17 +45,10 @@ - let optionId = #OPTION_ID, number#; - alias selectedOption = (L:A32NX_EFIS_#SIDE#_OPTION, enum); - optionId == selectedOption + (L:A32NX_FCU_EFIS_#SIDE#_#BASE_NAME#_LIGHT_ON, boolean) - - alias selectedOption = (L:A32NX_EFIS_#SIDE#_OPTION, enum); - if selectedOption == #OPTION_ID, number# { - selectedOption = 0; - } else { - selectedOption = #OPTION_ID, number#; - } + + 'A32NX.FCU_EFIS_#SIDE#_#BASE_NAME#_PUSH' (>F:KeyEvent) @@ -123,4 +109,241 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/fbw-a32nx/src/behavior/src/A32NX_Interior_FCU.xml b/fbw-a32nx/src/behavior/src/A32NX_Interior_FCU.xml index fcc4438153b5..ccfe3b8e7187 100644 --- a/fbw-a32nx/src/behavior/src/A32NX_Interior_FCU.xml +++ b/fbw-a32nx/src/behavior/src/A32NX_Interior_FCU.xml @@ -2,95 +2,6 @@ - - - - @@ -207,24 +108,16 @@ - (L:A32NX_TRK_FPA_MODE_ACTIVE, bool) 1 == if{ - (>H:A320_Neo_FCU_HDG_INC_TRACK) - } els{ - (>H:A320_Neo_FCU_HDG_INC_HEADING) - } + 'A32NX.FCU_HDG_INC' (>F:KeyEvent) - (L:A32NX_TRK_FPA_MODE_ACTIVE, bool) 1 == if{ - (>H:A320_Neo_FCU_HDG_DEC_TRACK) - } els{ - (>H:A320_Neo_FCU_HDG_DEC_HEADING) - } + 'A32NX.FCU_HDG_DEC' (>F:KeyEvent) - (>H:A320_Neo_FCU_HDG_PULL) + 'A32NX.FCU_HDG_PULL' (>F:KeyEvent) - (>H:A320_Neo_FCU_HDG_PUSH) + 'A32NX.FCU_HDG_PUSH' (>F:KeyEvent) 0 QNHknob @@ -272,28 +165,16 @@ - (L:A32NX_TRK_FPA_MODE_ACTIVE, bool) 1 == if{ - (>H:A320_Neo_FCU_VS_INC_FPA) - } els{ - (>H:A320_Neo_FCU_VS_INC_VS) - } - (>H:A320_Neo_CDU_VS) + 'A32NX.FCU_VS_INC' (>F:KeyEvent) - (L:A32NX_TRK_FPA_MODE_ACTIVE, bool) 1 == if{ - (>H:A320_Neo_FCU_VS_DEC_FPA) - } els{ - (>H:A320_Neo_FCU_VS_DEC_VS) - } - (>H:A320_Neo_CDU_VS) + 'A32NX.FCU_VS_DEC' (>F:KeyEvent) - (>H:A320_Neo_FCU_VS_PULL) - (>H:A320_Neo_CDU_VS) + 'A32NX.FCU_VS_PULL' (>F:KeyEvent) - (>H:A320_Neo_FCU_VS_PUSH) - (>H:A320_Neo_CDU_VS) + 'A32NX.FCU_VS_PUSH' (>F:KeyEvent) 0 QNHknob @@ -336,4 +217,23 @@ + + diff --git a/fbw-a32nx/src/systems/failures/src/a320.ts b/fbw-a32nx/src/systems/failures/src/a320.ts index 8bccecccf263..864be795e549 100644 --- a/fbw-a32nx/src/systems/failures/src/a320.ts +++ b/fbw-a32nx/src/systems/failures/src/a320.ts @@ -28,6 +28,10 @@ export const A320Failure = Object.freeze({ Fac1Failure: 22000, Fac2Failure: 22001, + Fmgc1Failure: 22002, + Fmgc2Failure: 22003, + Fcu1Failure: 22004, + Fcu2Failure: 22005, TransformerRectifier1: 24000, TransformerRectifier2: 24001, @@ -134,6 +138,10 @@ export const A320FailureDefinitions: FailureDefinition[] = [ [22, A320Failure.Fac1Failure, 'FAC 1'], [22, A320Failure.Fac2Failure, 'FAC 2'], + [22, A320Failure.Fmgc1Failure, 'FMGC 1'], + [22, A320Failure.Fmgc2Failure, 'FMGC 2'], + [22, A320Failure.Fcu1Failure, 'FCU 1'], + [22, A320Failure.Fcu2Failure, 'FCU 2'], [24, A320Failure.TransformerRectifier1, 'TR 1'], [24, A320Failure.TransformerRectifier2, 'TR 2'], diff --git a/fbw-a32nx/src/systems/instruments/src/FCU/Components/AfsDisplay.tsx b/fbw-a32nx/src/systems/instruments/src/FCU/Components/AfsDisplay.tsx new file mode 100644 index 000000000000..2b67034f4ebf --- /dev/null +++ b/fbw-a32nx/src/systems/instruments/src/FCU/Components/AfsDisplay.tsx @@ -0,0 +1,77 @@ +import { ComponentProps, DisplayComponent, EventBus, FSComponent, Subject, VNode } from '@microsoft/msfs-sdk'; +import { FcuSimvars } from '../shared/FcuSimvarPublisher'; +import { HdgDisplay } from './HdgDisplay'; +import { SpdDisplay } from './SpdDisplay'; +import { VerticalDisplay } from './VerticalDisplay'; + +interface AfsDisplayProps extends ComponentProps { + bus: EventBus; +} + +export class AfsDisplay extends DisplayComponent { + private lightsTest = false; + + private trkFpaMode = false; + + private trkFpaLabelSub = Subject.create(''); + + private hdgVsLabelSub = Subject.create(''); + + public onAfterRender(node: VNode): void { + super.onAfterRender(node); + + const sub = this.props.bus.getSubscriber(); + + sub + .on('lightsTest') + .whenChanged() + .handle((value) => { + this.lightsTest = value === 0; + + this.handleLabels(); + }); + + sub + .on('afsDisplayTrkFpaMode') + .whenChanged() + .handle((value) => { + this.trkFpaMode = value; + this.handleLabels(); + }); + } + + private handleLabels() { + this.trkFpaLabelSub.set(this.trkFpaMode || this.lightsTest ? 'Active' : 'Inactive'); + this.hdgVsLabelSub.set(!this.trkFpaMode || this.lightsTest ? 'Active' : 'Inactive'); + } + + public render(): VNode { + return ( + <> + + + + + + + HDG + + + TRK + + + + + + V/S + + + FPA + + + + + + ); + } +} diff --git a/fbw-a32nx/src/systems/instruments/src/FCU/Components/EisDisplay.tsx b/fbw-a32nx/src/systems/instruments/src/FCU/Components/EisDisplay.tsx new file mode 100644 index 000000000000..9ce004ae53e1 --- /dev/null +++ b/fbw-a32nx/src/systems/instruments/src/FCU/Components/EisDisplay.tsx @@ -0,0 +1,111 @@ +import { ComponentProps, DisplayComponent, EventBus, FSComponent, Subject, VNode } from '@microsoft/msfs-sdk'; +import { FcuSimvars } from '../shared/FcuSimvarPublisher'; + +interface EisDisplayProps extends ComponentProps { + isCaptSide: boolean; + x: number; + y: number; + bus: EventBus; +} + +export class EisDisplay extends DisplayComponent { + private baroValueMode = 0; + + private baroValue = 0; + + private baroMode = 0; + + private lightsTest = false; + + private baroValueSub = Subject.create(''); + + private qnhLabelSub = Subject.create(''); + + private qfeLabelSub = Subject.create(''); + + public onAfterRender(node: VNode): void { + super.onAfterRender(node); + + const sub = this.props.bus.getSubscriber(); + + sub + .on('lightsTest') + .whenChanged() + .handle((value) => { + this.lightsTest = value === 0; + + this.handleLabels(); + this.handleValue(); + }); + + sub + .on(`eisDisplay${this.props.isCaptSide ? 'Left' : 'Right'}BaroValueMode`) + .whenChanged() + .handle((newVal) => { + this.baroValueMode = newVal; + this.handleLabels(); + this.handleValue(); + }); + + sub + .on(`eisDisplay${this.props.isCaptSide ? 'Left' : 'Right'}BaroValue`) + .whenChanged() + .handle((newVal) => { + this.baroValue = newVal; + this.handleValue(); + }); + + sub + .on(`eisDisplay${this.props.isCaptSide ? 'Left' : 'Right'}BaroMode`) + .whenChanged() + .handle((newVal) => { + this.baroMode = newVal; + this.handleLabels(); + this.handleValue(); + }); + } + + private handleValue() { + if (this.lightsTest) { + this.baroValueSub.set('88.88'); + } else if (this.baroValueMode === 0) { + this.baroValueSub.set('Std'); + } else if (this.baroValueMode === 1) { + this.baroValueSub.set(Math.round(this.baroValue).toString()); + } else { + this.baroValueSub.set(this.baroValue.toFixed(2)); + } + } + + private handleLabels() { + if (this.lightsTest) { + this.qfeLabelSub.set('Active'); + this.qnhLabelSub.set('Active'); + } else if (this.baroMode === 0) { + this.qfeLabelSub.set('Inactive'); + this.qnhLabelSub.set('Inactive'); + } else if (this.baroMode === 1) { + this.qfeLabelSub.set('Inactive'); + this.qnhLabelSub.set('Active'); + } else { + this.qfeLabelSub.set('Active'); + this.qnhLabelSub.set('Inactive'); + } + } + + public render(): VNode { + return ( + + + QFE + + + QNH + + + {this.baroValueSub} + + + ); + } +} diff --git a/fbw-a32nx/src/systems/instruments/src/FCU/Components/HdgDisplay.tsx b/fbw-a32nx/src/systems/instruments/src/FCU/Components/HdgDisplay.tsx new file mode 100644 index 000000000000..827393541684 --- /dev/null +++ b/fbw-a32nx/src/systems/instruments/src/FCU/Components/HdgDisplay.tsx @@ -0,0 +1,111 @@ +import { DisplayComponent, EventBus, FSComponent, Subject, VNode } from '@microsoft/msfs-sdk'; +import { FcuSimvars } from '../shared/FcuSimvarPublisher'; + +export class HdgDisplay extends DisplayComponent<{ x: number; y: number; bus: EventBus }> { + private value = 0; + + private dashes = false; + + private managed = false; + + private trkFpaMode = false; + + private lightsTest = false; + + private dotVisibilitySub = Subject.create(''); + + private hdgLabelSub = Subject.create(''); + + private trkLabelSub = Subject.create(''); + + private valueSub = Subject.create(''); + + public onAfterRender(node: VNode): void { + super.onAfterRender(node); + + const sub = this.props.bus.getSubscriber(); + + sub + .on('lightsTest') + .whenChanged() + .handle((value) => { + this.lightsTest = value === 0; + + this.handleLabels(); + this.handleHdgDisplay(); + this.handleDot(); + }); + + sub + .on('afsDisplayTrkFpaMode') + .whenChanged() + .handle((value) => { + this.trkFpaMode = value; + + this.handleLabels(); + }); + + sub + .on('afsDisplayHdgTrkDashes') + .whenChanged() + .handle((value) => { + this.dashes = value; + this.handleHdgDisplay(); + }); + + sub + .on('afsDisplayHdgTrkValue') + .whenChanged() + .handle((value) => { + this.value = value; + this.handleHdgDisplay(); + }); + + sub + .on('afsDisplayHdgTrkManaged') + .whenChanged() + .handle((value) => { + this.managed = value; + this.handleDot(); + }); + } + + private handleHdgDisplay() { + if (this.lightsTest) { + this.valueSub.set('888'); + } else if (this.dashes) { + this.valueSub.set('---'); + } else { + this.valueSub.set(Math.round(this.value).toString().padStart(3, '0')); + } + } + + private handleLabels() { + this.trkLabelSub.set(this.trkFpaMode || this.lightsTest ? 'Active' : 'Inactive'); + this.hdgLabelSub.set(!this.trkFpaMode || this.lightsTest ? 'Active' : 'Inactive'); + } + + private handleDot() { + this.dotVisibilitySub.set(this.managed || this.lightsTest ? 'visible' : 'hidden'); + } + + public render(): VNode { + return ( + + + HDG + + + TRK + + + LAT + + + {this.valueSub} + + + + ); + } +} diff --git a/fbw-a32nx/src/systems/instruments/src/FCU/Components/SpdDisplay.tsx b/fbw-a32nx/src/systems/instruments/src/FCU/Components/SpdDisplay.tsx new file mode 100644 index 000000000000..c9e9b2100d0d --- /dev/null +++ b/fbw-a32nx/src/systems/instruments/src/FCU/Components/SpdDisplay.tsx @@ -0,0 +1,112 @@ +import { DisplayComponent, EventBus, FSComponent, Subject, VNode } from '@microsoft/msfs-sdk'; +import { FcuSimvars } from '../shared/FcuSimvarPublisher'; + +export class SpdDisplay extends DisplayComponent<{ x: number; y: number; bus: EventBus }> { + private value = 0; + + private dashes = false; + + private managed = false; + + private machActive = false; + + private lightsTest = false; + + private dotVisibilitySub = Subject.create(''); + + private spdLabelSub = Subject.create(''); + + private machLabelSub = Subject.create(''); + + private valueSub = Subject.create(''); + + public onAfterRender(node: VNode): void { + super.onAfterRender(node); + + const sub = this.props.bus.getSubscriber(); + + sub + .on('lightsTest') + .whenChanged() + .handle((value) => { + this.lightsTest = value === 0; + + this.handleLabels(); + this.handleSpeedDisplay(); + this.handleDot(); + }); + + sub + .on('afsDisplayMachMode') + .whenChanged() + .handle((value) => { + this.machActive = value; + + this.handleSpeedDisplay(); + }); + + sub + .on('afsDisplaySpdMachDashes') + .whenChanged() + .handle((value) => { + this.dashes = value; + this.handleSpeedDisplay(); + }); + + sub + .on('afsDisplaySpdMachValue') + .whenChanged() + .handle((value) => { + this.value = value; + this.handleSpeedDisplay(); + }); + + sub + .on('afsDisplaySpdMachManaged') + .whenChanged() + .handle((value) => { + this.managed = value; + this.handleDot(); + }); + } + + private handleSpeedDisplay() { + if (this.lightsTest) { + this.valueSub.set('8.88'); + } else if (this.machActive && this.dashes) { + this.valueSub.set('-.--'); + } else if (this.machActive && !this.dashes) { + this.valueSub.set(this.value.toFixed(2)); + } else if (this.dashes) { + this.valueSub.set('---'); + } else { + this.valueSub.set(Math.round(this.value).toString().padStart(3, '0')); + } + } + + private handleLabels() { + this.machLabelSub.set(this.machActive || this.lightsTest ? 'Active' : 'Inactive'); + this.spdLabelSub.set(!this.machActive || this.lightsTest ? 'Active' : 'Inactive'); + } + + private handleDot() { + this.dotVisibilitySub.set(this.managed || this.lightsTest ? 'visible' : 'hidden'); + } + + public render(): VNode { + return ( + + + SPD + + + MACH + + + {this.valueSub} + + + + ); + } +} diff --git a/fbw-a32nx/src/systems/instruments/src/FCU/Components/VerticalDisplay.tsx b/fbw-a32nx/src/systems/instruments/src/FCU/Components/VerticalDisplay.tsx new file mode 100644 index 000000000000..955bd5a0c724 --- /dev/null +++ b/fbw-a32nx/src/systems/instruments/src/FCU/Components/VerticalDisplay.tsx @@ -0,0 +1,163 @@ +import { DisplayComponent, EventBus, FSComponent, Subject, VNode } from '@microsoft/msfs-sdk'; +import { FcuSimvars } from '../shared/FcuSimvarPublisher'; + +export class VerticalDisplay extends DisplayComponent<{ x: number; y: number; bus: EventBus }> { + private altValue = 0; + + private vsValue = 0; + + private vsDashes = false; + + private trkFpaMode = false; + + private managed = false; + + private lightsTest = false; + + private dotVisibilitySub = Subject.create(''); + + private vsLabelSub = Subject.create(''); + + private fpaLabelSub = Subject.create(''); + + private altValueSub = Subject.create(''); + + private vsValueSub = Subject.create(''); + + public onAfterRender(node: VNode): void { + super.onAfterRender(node); + + const sub = this.props.bus.getSubscriber(); + + sub + .on('lightsTest') + .whenChanged() + .handle((value) => { + this.lightsTest = value === 0; + + this.handleLabels(); + this.handleVsFpaDisplay(); + this.handleAltDisplay(); + this.handleDot(); + }); + + sub + .on('afsDisplayTrkFpaMode') + .whenChanged() + .handle((value) => { + this.trkFpaMode = value; + + this.handleVsFpaDisplay(); + this.handleLabels(); + }); + + sub + .on('afsDisplayVsFpaDashes') + .whenChanged() + .handle((value) => { + this.vsDashes = value; + this.handleVsFpaDisplay(); + }); + + sub + .on('afsDisplayVsFpaValue') + .whenChanged() + .handle((value) => { + this.vsValue = value; + this.handleVsFpaDisplay(); + }); + + sub + .on('afsDisplayAltValue') + .whenChanged() + .handle((value) => { + this.altValue = value; + this.handleAltDisplay(); + }); + + sub + .on('afsDisplayLvlChManaged') + .whenChanged() + .handle((value) => { + this.managed = value; + + this.handleDot(); + }); + } + + private handleAltDisplay() { + if (this.lightsTest) { + this.altValueSub.set('88888'); + } else { + this.altValueSub.set(Math.round(this.altValue).toString().padStart(5, '0')); + } + } + + private handleVsFpaDisplay() { + const sign = Math.sign(this.vsValue) >= 0 ? '+' : '~'; + const absValue = Math.abs(this.vsValue); + + if (this.lightsTest) { + this.vsValueSub.set('+8.888'); + } else if (this.trkFpaMode && this.vsDashes) { + this.vsValueSub.set('~-.-'); + } else if (this.trkFpaMode && !this.vsDashes) { + this.vsValueSub.set(`${sign}${absValue.toFixed(1)}`); + } else if (this.vsDashes) { + this.vsValueSub.set('~----'); + } else { + this.vsValueSub.set( + `${sign}${Math.floor(absValue * 0.01) + .toString() + .padStart(2, '0')}oo`, + ); + } + } + + private handleLabels() { + this.fpaLabelSub.set(this.trkFpaMode || this.lightsTest ? 'Active' : 'Inactive'); + this.vsLabelSub.set(!this.trkFpaMode || this.lightsTest ? 'Active' : 'Inactive'); + } + + private handleDot() { + this.dotVisibilitySub.set(this.managed || this.lightsTest ? 'visible' : 'hidden'); + } + + public render(): VNode { + return ( + + + + ALT + + + {this.altValueSub} + + + + + + V/S + + + FPA + + + {this.vsValueSub} + + + + + + + + LVL/CH + + + + + + + ); + } +} diff --git a/fbw-a32nx/src/systems/instruments/src/FCU/FCU.tsx b/fbw-a32nx/src/systems/instruments/src/FCU/FCU.tsx new file mode 100644 index 000000000000..0098aea5f539 --- /dev/null +++ b/fbw-a32nx/src/systems/instruments/src/FCU/FCU.tsx @@ -0,0 +1,42 @@ +import { ComponentProps, DisplayComponent, EventBus, FSComponent, Subject, VNode } from '@microsoft/msfs-sdk'; +import { EisDisplay } from 'instruments/src/FCU/Components/EisDisplay'; +import { AfsDisplay } from 'instruments/src/FCU/Components/AfsDisplay'; + +import './style.scss'; +import { FcuSimvars } from 'instruments/src/FCU/shared/FcuSimvarPublisher'; + +interface FCUProps extends ComponentProps { + bus: EventBus; +} + +export class FCUComponent extends DisplayComponent { + private visSub = Subject.create<'' | 'Hide'>('Hide'); + + onAfterRender(node: VNode): void { + super.onAfterRender(node); + + const sub = this.props.bus.getSubscriber(); + + sub + .on('fcuHealthy') + .whenChanged() + .handle((value) => { + this.visSub.set(value ? '' : 'Hide'); + }); + } + + render(): VNode { + return ( + <> + + + + + + + + + + ); + } +} diff --git a/fbw-a32nx/src/systems/instruments/src/FCU/SunAngle.ts b/fbw-a32nx/src/systems/instruments/src/FCU/SunAngle.ts new file mode 100644 index 000000000000..e5a9e69aaf4f --- /dev/null +++ b/fbw-a32nx/src/systems/instruments/src/FCU/SunAngle.ts @@ -0,0 +1,367 @@ +// Based on ftp://climate1.gsfc.nasa.gov/wiscombe/Solar_Rad/SunAngles/sunae.f +// +// Calculates the local solar azimuth and elevation angles, and +// the distance to and angle subtended by the Sun, at a specific +// location and time using approximate formulas in The Astronomical +// Almanac. Accuracy of angles is 0.01 deg or better (the angular +// width of the Sun is about 0.5 deg, so 0.01 deg is more than +// sufficient for most applications). + +// Unlike many GCM (and other) sun angle routines, this +// one gives slightly different sun angles depending on +// the year. The difference is usually down in the 4th +// significant digit but can slowly creep up to the 3rd +// significant digit after several decades to a century. + +// A refraction correction appropriate for the "US Standard +// Atmosphere" is added, so that the returned sun position is +// the APPARENT one. The correction is below 0.1 deg for solar +// elevations above 9 deg. To remove it, comment out the code +// block where variable REFRAC is set, and replace it with +// REFRAC = 0.0. + +// References: + +// Michalsky, J., 1988: The Astronomical Almanac's algorithm for +// approximate solar position (1950-2050), Solar Energy 40, +// 227-235 (but the version of this program in the Appendix +// contains errors and should not be used) + +// The Astronomical Almanac, U.S. Gov't Printing Office, Washington, +// D.C. (published every year): the formulas used from the 1995 +// version are as follows: +// p. A12: approximation to sunrise/set times +// p. B61: solar elevation ("altitude") and azimuth +// p. B62: refraction correction +// p. C24: mean longitude, mean anomaly, ecliptic longitude, +// obliquity of ecliptic, right ascension, declination, +// Earth-Sun distance, angular diameter of Sun +// p. L2: Greenwich mean sidereal time (ignoring T^2, T^3 terms) + +// Authors: Dr. Joe Michalsky (joe@asrc.albany.edu) +// Dr. Lee Harrison (lee@asrc.albany.edu) +// Atmospheric Sciences Research Center +// State University of New York +// Albany, New York + +// Modified by: Dr. Warren Wiscombe (wiscombe@climate.gsfc.nasa.gov) +// NASA Goddard Space Flight Center +// Code 913 +// Greenbelt, MD 20771 + +// WARNING: Do not use this routine outside the year range +// 1950-2050. The approximations become increasingly +// worse, and the calculation of Julian date becomes +// more involved. + +// Input: + +// YEAR year (INTEGER; range 1950 to 2050) + +// DAY day of year at LAT-LONG location (INTEGER; range 1-366) + +// HOUR hour of DAY [GMT or UT] (REAL; range -13.0 to 36.0) +// = (local hour) + (time zone number) +// + (Daylight Savings Time correction; -1 or 0) +// where (local hour) range is 0 to 24, +// (time zone number) range is -12 to +12, and +// (Daylight Time correction) is -1 if on Daylight Time +// (summer half of year), 0 otherwise; +// Example: 8:30 am Eastern Daylight Time would be +// +// HOUR = 8.5 + 5 - 1 = 12.5 + +// LAT latitude [degrees] +// (REAL; range -90.0 to 90.0; north is positive) + +// LONG longitude [degrees] +// (REAL; range -180.0 to 180.0; east is positive) + +// Output: + +// AZ solar azimuth angle (measured east from north, +// 0 to 360 degs) + +// EL solar elevation angle [-90 to 90 degs]; +// solar zenith angle = 90 - EL + +// SOLDIA solar diameter [degs] + +// SOLDST distance to sun [Astronomical Units, AU] +// (1 AU = mean Earth-sun distance = 1.49597871E+11 m +// in IAU 1976 System of Astronomical Constants) + +// Local Variables: + +// DEC Declination (radians) + +// ecLong Ecliptic longitude (radians) + +// GMST Greenwich mean sidereal time (hours) + +// HA Hour angle (radians, -pi to pi) + +// JD Modified Julian date (number of days, including +// fractions thereof, from Julian year J2000.0); +// actual Julian date is JD + 2451545.0 + +// LMST Local mean sidereal time (radians) + +// meanAnomaly Mean anomaly (radians, normalized to 0 to 2*pi) + +// meanLon Mean longitude of Sun, corrected for aberration +// (deg; normalized to 0-360) + +// obiquityEc Obliquity of the ecliptic (radians) + +// RA Right ascension (radians) + +// REFRAC Refraction correction for US Standard Atmosphere (degs) + +// -------------------------------------------------------------------- +// Uses double precision for safety and because Julian dates can +// have a large number of digits in their full form (but in practice +// this version seems to work fine in single precision if you only +// need about 3 significant digits and aren't doing precise climate +// change or solar tracking work). +// -------------------------------------------------------------------- + +// Why does this routine require time input as Greenwich Mean Time +// (GMT; also called Universal Time, UT) rather than "local time"? +// Because "local time" (e.g. Eastern Standard Time) can be off by +// up to half an hour from the actual local time (called "local mean +// solar time"). For society's convenience, "local time" is held +// constant across each of 24 time zones (each technically 15 longitude +// degrees wide although some are distorted, again for societal +// convenience). Local mean solar time varies continuously around a +// longitude belt; it is not a step function with 24 steps. +// Thus it is far simpler to calculate local mean solar time from GMT, +// by adding 4 min for each degree of longitude the location is +// east of the Greenwich meridian or subtracting 4 min for each degree +// west of it. + +// -------------------------------------------------------------------- + +// time +// +// The measurement of time has become a complicated topic. A few +// basic facts are: +// +// (1) The Gregorian calendar was introduced in 1582 to replace +// Julian calendar; in it, every year divisible by four is a leap +// year just as in the Julian calendar except for centurial years +// which must be exactly divisible by 400 to be leap years. Thus +// 2000 is a leap year, but not 1900 or 2100. + +// (2) The Julian day begins at Greenwich noon whereas the calendar +// day begins at the preceding midnight; and Julian years begin on +// "Jan 0" which is really Greenwich noon on Dec 31. True Julian +// dates are a continous count of day numbers beginning with JD 0 on +// 1 Jan 4713 B.C. The term "Julian date" is widely misused and few +// people understand it; it is best avoided unless you want to study +// the Astronomical Almanac and learn to use it correctly. + +// (3) Universal Time (UT), the basis of civil timekeeping, is +// defined by a formula relating UT to GMST (Greenwich mean sidereal +// time). UTC (Coordinated Universal Time) is the time scale +// distributed by most broadcast time services. UT, UTC, and other +// related time measures are within a few sec of each other and are +// frequently used interchangeably. + +// (4) Beginning in 1984, the "standard epoch" of the astronomical +// coordinate system is Jan 1, 2000, 12 hr TDB (Julian date +// 2,451,545.0, denoted J2000.0). The fact that this routine uses +// 1949 as a point of reference is merely for numerical convenience. + +/** + * @prop solarElevation Solar elevation angle [-90 to 90 degs]; solar zenith angle = 90 - EL. + * @prop solarAzimuth Solar azimuth angle (measured east from north, [0 to 360 degs]). + * @prop solarDistance Distance to sun [Astronomical Units, AU]; + * (1 AU = mean Earth-sun distance = 1.49597871E+11 m in IAU 1976 System of Astronomical Constants). + * @prop solarDiameter Solar diameter [degs]. + */ +type SolarParameters = { + solarElevation: number; + solarAzimuth: number; + solarDistance: number; + solarDiameter: number; +}; +/** + * Calculates the solar azimuth and elevation. + * @param utcTime JS Date object with a UTC datetime. + * @param lat latitude in range [-90, 90]. + * @param lon longitude in range [-180, 180]. + * @param out Optional object to write the results. A new object will be returned if undefined. + * @returns the solar parameters on the given time and location. + */ +export function calculateSunAzimuthElevation( + utcTime: Date, + lat: number, + lon: number, + out: SolarParameters | undefined = undefined, +) { + const year = clamp(utcTime.getUTCFullYear(), 1950, 2050); + const day = dayOfYear(utcTime); + const hour = utcTime.getUTCHours() + utcTime.getUTCMinutes() / 60; + lat = clamp(lat, -90, 90); + lon = clamp(lon, -180, 180); + + const rpd = Math.PI / 180; + + // current Julian date (actually add 2,400,000 for true JD); LEAP = leap days since 1949; + // 32916.5 is midnite 0 jan 1949 minus 2.4e6 + const delta = year - 1949; + const leap = delta / 4; + let jd = 32916.5 + (delta * 365 + leap + day) + hour / 24; + + // last yr of century not leap yr unless divisible + // by 400 (not executed for the allowed YEAR range, + // but left in so our successors can adapt this for + // the following 100 years) + if (year % 100 === 0 && year % 400 !== 0) { + jd -= 1; + } + + // ecliptic coordinates + // 51545.0 + 2.4e6 = noon 1 jan 2000 + const time = jd - 51545.0; + + // force mean longitude between 0 and 360 degs + let meanLon = (280.46 + 0.9856474 * time) % 360; + if (meanLon < 0) { + meanLon += 360; + } + + // mean anomaly in radians between 0 and 2*pi + let meanAnomaly = (357.528 + 0.9856003 * time) % 360; + if (meanAnomaly < 0) { + meanAnomaly += 360; + } + + meanAnomaly *= rpd; + + // ecliptic longitude and obliquity + // of ecliptic in radians + let ecLong = (meanLon + 1.915 * Math.sin(meanAnomaly) + 0.02 * Math.sin(2 * meanAnomaly)) % 360; + if (ecLong < 0) { + ecLong += 360; + } + ecLong *= rpd; + + const obiquityEc = (23.439 - 0.0000004 * time) * rpd; + + // right ascension + const NUM = Math.cos(obiquityEc) * Math.sin(ecLong); + const DEN = Math.cos(ecLong); + let RA = Math.atan(NUM / DEN); + + // Force right ascension between 0 and 2*pi + if (DEN < 0.0) { + RA += Math.PI; + } else if (NUM < 0) { + RA += Math.PI * 2; + } + + // declination + const DEC = Math.asin(Math.sin(obiquityEc) * Math.sin(ecLong)); + + // Greenwich mean sidereal time in hours + let GMST = (6.697375 + 0.0657098242 * time + hour) % 24; + + // Hour not changed to sidereal time since + // 'time' includes the fractional day + if (GMST < 0) { + GMST += 24; + } + + // local mean sidereal time in radians + let LMST = (GMST + lon / 15) % 24; + if (LMST < 0) { + LMST += 24; + } + LMST = LMST * 15 * rpd; + + // hour angle in radians between -pi and pi + let HA = LMST - RA; + + if (HA < -Math.PI) { + HA += Math.PI * 2; + } + if (HA > Math.PI) { + HA -= Math.PI * 2; + } + + // solar azimuth and elevation + let solarElevation = Math.asin( + Math.sin(DEC) * Math.sin(lat * rpd) + Math.cos(DEC) * Math.cos(lat * rpd) * Math.cos(HA), + ); + + let solarAzimuth = Math.asin((-Math.cos(DEC) * Math.sin(HA)) / Math.cos(solarElevation)); + + // Put azimuth between 0 and 2*pi radians + if (Math.sin(DEC) - Math.sin(solarElevation) * Math.sin(lat * rpd) >= 0) { + if (Math.sin(solarAzimuth) < 0) { + solarAzimuth += Math.PI * 2; + } + } else { + solarAzimuth = Math.PI - solarAzimuth; + } + + // Convert elevation and azimuth to degrees + solarElevation /= rpd; + solarAzimuth /= rpd; + + // ======== Refraction correction for U.S. Standard Atmos. ========== + // (assumes elevation in degs) (3.51823=1013.25 mb/288 K) + let REFRAC = 0; + if (solarElevation >= 19.225) { + REFRAC = (0.00452 * 3.51823) / Math.tan(solarElevation * rpd); + } else if (solarElevation > -0.766 && solarElevation < 19.225) { + REFRAC = + (3.51823 * (0.1594 + solarElevation * (0.0196 + 0.00002 * solarElevation))) / + (1.0 + solarElevation * (0.505 + 0.0845 * solarElevation)); + } + + solarElevation += REFRAC; + // =================================================================== + // distance to sun in A.U. & diameter in degs + const solarDistance = 1.00014 - 0.01671 * Math.cos(meanAnomaly) - 0.00014 * Math.cos(2 * meanAnomaly); + const solarDiameter = 0.5332 / solarDistance; + + solarElevation = clamp(solarElevation, -90, 90); + solarAzimuth = clamp(solarAzimuth, 0, 360); + + if (out === undefined) { + out = {} as SolarParameters; + } + + out.solarElevation = solarElevation; + out.solarAzimuth = solarAzimuth; + out.solarDistance = solarDistance; + out.solarDiameter = solarDiameter; + + return out; +} + +/** + * + * @param solarParams Solar parameters from {@link calculateSunAzimuthElevation}. + */ +export function calculateAmbientBrightness(solarParams: SolarParameters) { + return lerp(solarParams.solarElevation, -6, 12, 0, 1); +} + +export function clamp(value: number, min: number, max: number) { + return Math.min(max, Math.max(min, value)); +} + +export function lerp(value: number, minX: number, maxX: number, minY: number, maxY: number) { + return clamp((value - minX) / (maxX - minX), 0, 1) * (maxY - minY) + minY; +} + +function dayOfYear(utcDate: Date) { + const datum = new Date(utcDate.getFullYear(), 0, 0); + const secondsIntoYear = utcDate.valueOf() - datum.valueOf(); + const secondsPerDay = 1000 * 60 * 60 * 24; + return clamp(1 + Math.trunc(secondsIntoYear / secondsPerDay), 1, 366); +} diff --git a/fbw-a32nx/src/systems/instruments/src/FCU/config.json b/fbw-a32nx/src/systems/instruments/src/FCU/config.json new file mode 100644 index 000000000000..ade492578f8b --- /dev/null +++ b/fbw-a32nx/src/systems/instruments/src/FCU/config.json @@ -0,0 +1,4 @@ +{ + "index": "./instrument.tsx", + "isInteractive": false +} diff --git a/fbw-a32nx/src/systems/instruments/src/FCU/instrument.tsx b/fbw-a32nx/src/systems/instruments/src/FCU/instrument.tsx new file mode 100644 index 000000000000..7c03f5ca8c61 --- /dev/null +++ b/fbw-a32nx/src/systems/instruments/src/FCU/instrument.tsx @@ -0,0 +1,101 @@ +import { EventBus, FSComponent, Subject } from '@microsoft/msfs-sdk'; +import { FCUSimvarPublisher } from './shared/FcuSimvarPublisher'; +import { FCUComponent } from './FCU'; +import { calculateSunAzimuthElevation, lerp, calculateAmbientBrightness } from './SunAngle'; + +// eslint-disable-next-line camelcase +class A32NX_FCU extends BaseInstrument { + private bus: EventBus; + + private simVarPublisher: FCUSimvarPublisher; + + /** + * "mainmenu" = 0 + * "loading" = 1 + * "briefing" = 2 + * "ingame" = 3 + */ + private gameState = 0; + + private simTime = new Date(); + + private solarParams = calculateSunAzimuthElevation(this.simTime, 0, 0); + + private ambientBrightness = Subject.create(0, (a, b) => Math.abs(a - b) < 0.01); + + private screenBrightess = Subject.create(0, (a, b) => Math.abs(a - b) < 0.01); + + constructor() { + super(); + this.bus = new EventBus(); + this.simVarPublisher = new FCUSimvarPublisher(this.bus); + + this.ambientBrightness.sub((ambientBrightness) => { + SimVar.SetSimVarValue('L:A32NX_AMBIENT_BRIGHTNESS', 'number', ambientBrightness); + this.updateDisplayBrightness(); + }); + + this.screenBrightess.sub(this.updateDisplayBrightness.bind(this), true); + + // need to run this at high speed to avoid jumps when the knob is rotated + setInterval(() => { + const screenBrightess = SimVar.GetSimVarValue('A:LIGHT POTENTIOMETER:87', 'percent over 100'); + this.screenBrightess.set(screenBrightess); + }); + } + + get templateID(): string { + return 'A32NX_FCU'; + } + + private updateDisplayBrightness() { + const ambientBrightness = this.ambientBrightness.get(); + const screenBrightess = this.screenBrightess.get(); + + const saturation = lerp(ambientBrightness * (1.05 - screenBrightess), 1, 0.6, 10, 100); + const luminosity = lerp(ambientBrightness * (1.05 - screenBrightess), 1, 0.6, 80, 55); + const colour = `hsl(31, ${saturation.toFixed(1)}%, ${luminosity.toFixed(1)}%)`; + document.documentElement.style.setProperty('--main-display-colour', colour); + + const textShadowOpacity = lerp(screenBrightess, 0, 1, 0, 0.3) * lerp(ambientBrightness, 0, 0.9, 1, 0); + const textShadow = `rgba(207, 110, 0, ${textShadowOpacity.toFixed(2)})`; + document.documentElement.style.setProperty('--main-text-shadow-colour', textShadow); + + const backgroundOpacity = lerp(screenBrightess, 0, 1, 0, 0.3) * lerp(ambientBrightness, 0, 0.8, 1, 0.1); + document.documentElement.style.setProperty('--main-background-opacity', backgroundOpacity.toString()); + } + + public connectedCallback(): void { + super.connectedCallback(); + + FSComponent.render(, document.getElementById('FCU_CONTENT')); + + // Remove "instrument didn't load" text + document.getElementById('FCU_CONTENT').querySelector(':scope > h1').remove(); + } + + public Update(): void { + super.Update(); + + if (this.gameState !== 3) { + const gamestate = this.getGameState(); + if (gamestate === 3) { + this.simVarPublisher.startPublish(); + } + this.gameState = gamestate; + } else { + this.simVarPublisher.onUpdate(); + } + + const lat = SimVar.GetSimVarValue('PLANE LATITUDE', 'degrees'); + const lon = SimVar.GetSimVarValue('PLANE LONGITUDE', 'degrees'); + const simTimestamp = SimVar.GetSimVarValue('E:ABSOLUTE TIME', 'seconds') - 62135596800; + this.simTime.setTime(simTimestamp * 1000); + + const sunParams = calculateSunAzimuthElevation(this.simTime, lat, lon, this.solarParams); + const ambientBrightness = calculateAmbientBrightness(sunParams); + this.ambientBrightness.set(ambientBrightness); + } +} + +registerInstrument('a32nx-fcu', A32NX_FCU); diff --git a/fbw-a32nx/src/systems/instruments/src/FCU/rollup.config.js b/fbw-a32nx/src/systems/instruments/src/FCU/rollup.config.js new file mode 100644 index 000000000000..80245f0ecaed --- /dev/null +++ b/fbw-a32nx/src/systems/instruments/src/FCU/rollup.config.js @@ -0,0 +1,30 @@ +'use strict'; + +import ts from 'rollup-plugin-typescript2'; +import resolve from '@rollup/plugin-node-resolve'; +import scss from 'rollup-plugin-scss'; + +const { join } = require('path'); + +const root = join(__dirname, '..', '..', '..', '..', '..', '..'); + +export default { + input: join(__dirname, 'instrument.tsx'), + output: { + file: join( + root, + 'fbw-a32nx/out/flybywire-aircraft-a320-neo/html_ui/Pages/VCockpit/Instruments/A32NX/FCU/instrument.js', + ), + format: 'es', + }, + plugins: [ + scss({ + output: join( + root, + 'fbw-a32nx/out/flybywire-aircraft-a320-neo/html_ui/Pages/VCockpit/Instruments/A32NX/FCU/fcu.css', + ), + }), + resolve(), + ts(), + ], +}; diff --git a/fbw-a32nx/src/systems/instruments/src/FCU/shared/FcuSimvarPublisher.tsx b/fbw-a32nx/src/systems/instruments/src/FCU/shared/FcuSimvarPublisher.tsx new file mode 100644 index 000000000000..e7484575d19d --- /dev/null +++ b/fbw-a32nx/src/systems/instruments/src/FCU/shared/FcuSimvarPublisher.tsx @@ -0,0 +1,82 @@ +import { EventBus, SimVarDefinition, SimVarValueType, SimVarPublisher } from '@microsoft/msfs-sdk'; + +export interface FcuSimvars { + lightsTest: number; + fcuHealthy: boolean; + + eisDisplayLeftBaroValueMode: number; + eisDisplayLeftBaroValue: number; + eisDisplayLeftBaroMode: number; + eisDisplayRightBaroValueMode: number; + eisDisplayRightBaroValue: number; + eisDisplayRightBaroMode: number; + + afsDisplayTrkFpaMode: boolean; + afsDisplayMachMode: boolean; + afsDisplaySpdMachValue: number; + afsDisplaySpdMachDashes: boolean; + afsDisplaySpdMachManaged: boolean; + afsDisplayHdgTrkValue: number; + afsDisplayHdgTrkDashes: boolean; + afsDisplayHdgTrkManaged: boolean; + afsDisplayAltValue: number; + afsDisplayLvlChManaged: boolean; + afsDisplayVsFpaValue: number; + afsDisplayVsFpaDashes: boolean; +} + +export enum FcuVars { + lightsTest = 'L:A32NX_OVHD_INTLT_ANN', + fcuHealthy = 'L:A32NX_FCU_HEALTHY', + + eisDisplayLeftBaroValueMode = 'L:A32NX_FCU_EFIS_L_DISPLAY_BARO_VALUE_MODE', + eisDisplayLeftBaroValue = 'L:A32NX_FCU_EFIS_L_DISPLAY_BARO_VALUE', + eisDisplayLeftBaroMode = 'L:A32NX_FCU_EFIS_L_DISPLAY_BARO_MODE', + eisDisplayRightBaroValueMode = 'L:A32NX_FCU_EFIS_R_DISPLAY_BARO_VALUE_MODE', + eisDisplayRightBaroValue = 'L:A32NX_FCU_EFIS_R_DISPLAY_BARO_VALUE', + eisDisplayRightBaroMode = 'L:A32NX_FCU_EFIS_R_DISPLAY_BARO_MODE', + + afsDisplayTrkFpaMode = 'L:A32NX_FCU_AFS_DISPLAY_TRK_FPA_MODE', + afsDisplayMachMode = 'L:A32NX_FCU_AFS_DISPLAY_MACH_MODE', + afsDisplaySpdMachValue = 'L:A32NX_FCU_AFS_DISPLAY_SPD_MACH_VALUE', + afsDisplaySpdMachDashes = 'L:A32NX_FCU_AFS_DISPLAY_SPD_MACH_DASHES', + afsDisplaySpdMachManaged = 'L:A32NX_FCU_AFS_DISPLAY_SPD_MACH_MANAGED', + afsDisplayHdgTrkValue = 'L:A32NX_FCU_AFS_DISPLAY_HDG_TRK_VALUE', + afsDisplayHdgTrkDashes = 'L:A32NX_FCU_AFS_DISPLAY_HDG_TRK_DASHES', + afsDisplayHdgTrkManaged = 'L:A32NX_FCU_AFS_DISPLAY_HDG_TRK_MANAGED', + afsDisplayAltValue = 'L:A32NX_FCU_AFS_DISPLAY_ALT_VALUE', + afsDisplayLvlChManaged = 'L:A32NX_FCU_AFS_DISPLAY_LVL_CH_MANAGED', + afsDisplayVsFpaValue = 'L:A32NX_FCU_AFS_DISPLAY_VS_FPA_VALUE', + afsDisplayVsFpaDashes = 'L:A32NX_FCU_AFS_DISPLAY_VS_FPA_DASHES', +} + +export class FCUSimvarPublisher extends SimVarPublisher { + private static simvars = new Map([ + ['lightsTest', { name: FcuVars.lightsTest, type: SimVarValueType.Number }], + ['fcuHealthy', { name: FcuVars.fcuHealthy, type: SimVarValueType.Number }], + + ['eisDisplayLeftBaroValueMode', { name: FcuVars.eisDisplayLeftBaroValueMode, type: SimVarValueType.Number }], + ['eisDisplayLeftBaroValue', { name: FcuVars.eisDisplayLeftBaroValue, type: SimVarValueType.Number }], + ['eisDisplayLeftBaroMode', { name: FcuVars.eisDisplayLeftBaroMode, type: SimVarValueType.Number }], + ['eisDisplayRightBaroValueMode', { name: FcuVars.eisDisplayRightBaroValueMode, type: SimVarValueType.Number }], + ['eisDisplayRightBaroValue', { name: FcuVars.eisDisplayRightBaroValue, type: SimVarValueType.Number }], + ['eisDisplayRightBaroMode', { name: FcuVars.eisDisplayRightBaroMode, type: SimVarValueType.Number }], + + ['afsDisplayTrkFpaMode', { name: FcuVars.afsDisplayTrkFpaMode, type: SimVarValueType.Bool }], + ['afsDisplayMachMode', { name: FcuVars.afsDisplayMachMode, type: SimVarValueType.Bool }], + ['afsDisplaySpdMachValue', { name: FcuVars.afsDisplaySpdMachValue, type: SimVarValueType.Number }], + ['afsDisplaySpdMachDashes', { name: FcuVars.afsDisplaySpdMachDashes, type: SimVarValueType.Bool }], + ['afsDisplaySpdMachManaged', { name: FcuVars.afsDisplaySpdMachManaged, type: SimVarValueType.Bool }], + ['afsDisplayHdgTrkValue', { name: FcuVars.afsDisplayHdgTrkValue, type: SimVarValueType.Number }], + ['afsDisplayHdgTrkDashes', { name: FcuVars.afsDisplayHdgTrkDashes, type: SimVarValueType.Bool }], + ['afsDisplayHdgTrkManaged', { name: FcuVars.afsDisplayHdgTrkManaged, type: SimVarValueType.Bool }], + ['afsDisplayAltValue', { name: FcuVars.afsDisplayAltValue, type: SimVarValueType.Number }], + ['afsDisplayLvlChManaged', { name: FcuVars.afsDisplayLvlChManaged, type: SimVarValueType.Bool }], + ['afsDisplayVsFpaValue', { name: FcuVars.afsDisplayVsFpaValue, type: SimVarValueType.Number }], + ['afsDisplayVsFpaDashes', { name: FcuVars.afsDisplayVsFpaDashes, type: SimVarValueType.Bool }], + ]); + + public constructor(bus: EventBus) { + super(FCUSimvarPublisher.simvars, bus); + } +} diff --git a/fbw-a32nx/src/systems/instruments/src/FCU/style.scss b/fbw-a32nx/src/systems/instruments/src/FCU/style.scss new file mode 100644 index 000000000000..e538c8a9ccf7 --- /dev/null +++ b/fbw-a32nx/src/systems/instruments/src/FCU/style.scss @@ -0,0 +1,71 @@ +@font-face { + font-family: "Poppins-SemiBold"; + src: url("/Fonts/fbw-a32nx/Poppins-SemiBold.ttf") format("truetype"); + font-weight: normal; + font-style: normal; +} + +@font-face { + font-family: "Digital"; + src: url("/Fonts/fbw-a32nx/AirbusFCU.ttf") format("truetype"); + font-weight: 900; + font-style: normal; +} + +:root { + --main-display-colour: hsl(36, 100%, 45%); + --main-display-colour-inactive: hsl(53, 82%, 0%); + --main-background-opacity: 0; + --main-text-shadow-colour: rgba(207, 110, 0, 0); + + // text-shadow places the shadow in the wrong position, seems to be a coherent bug, + // so this remains commented out for now. + //text-shadow: var(--main-text-shadow-colour) 0 0 12px; +} + +#fcu-background { + position: absolute; + width: 100%; + height: 100%; + opacity: var(--main-background-opacity); +} + +.fcu-svg { + position: absolute; + width: 1280px; + height: 640px; +} + +text.Active { + font-family: "Poppins-SemiBold"; + font-size: 56px; + fill: var(--main-display-colour); +} + +text.Inactive { + font-family: "Poppins-SemiBold"; + font-size: 56px; + fill: var(--main-display-colour-inactive); + opacity: 0.1; +} + +text.Value { + font-family: Digital; + font-size: 110px; + text-anchor: start; + fill: var(--main-display-colour); + letter-spacing: 0px; +} + +line { + stroke: var(--main-display-colour); + stroke-width: 7; +} + +circle { + fill: var(--main-display-colour); +} + +.Hide { + visibility: hidden !important; +} diff --git a/fbw-a32nx/src/systems/instruments/src/FCU/tsconfig.json b/fbw-a32nx/src/systems/instruments/src/FCU/tsconfig.json new file mode 100644 index 000000000000..6fb2151a8090 --- /dev/null +++ b/fbw-a32nx/src/systems/instruments/src/FCU/tsconfig.json @@ -0,0 +1,17 @@ +{ + "extends": "../../../tsconfig.json", + + "compilerOptions": { + "incremental": false /* Enables incremental builds */, + "target": "es2017" /* Specifies the ES2017 target, compatible with Coherent GT */, + "module": "es2015" /* Ensures that modules are at least es2015 */, + "strict": false /* Enables strict type checking, highly recommended but optional */, + "esModuleInterop": true /* Emits additional JS to work with CommonJS modules */, + "skipLibCheck": true /* Skip type checking on library .d.ts files */, + "forceConsistentCasingInFileNames": true /* Ensures correct import casing */, + "moduleResolution": "node" /* Enables compatibility with MSFS SDK bare global imports */, + "jsxFactory": "FSComponent.buildComponent" /* Required for FSComponent framework JSX */, + "jsxFragmentFactory": "FSComponent.Fragment" /* Required for FSComponent framework JSX */, + "jsx": "react" /* Required for FSComponent framework JSX */ + } + } diff --git a/fbw-a32nx/src/systems/instruments/src/PFD/AltitudeIndicator.tsx b/fbw-a32nx/src/systems/instruments/src/PFD/AltitudeIndicator.tsx index a912d55cc5f3..c6e311cf6669 100644 --- a/fbw-a32nx/src/systems/instruments/src/PFD/AltitudeIndicator.tsx +++ b/fbw-a32nx/src/systems/instruments/src/PFD/AltitudeIndicator.tsx @@ -10,11 +10,11 @@ import { Arinc429WordData, Arinc429RegisterSubject, } from '@flybywiresim/fbw-sdk'; +import { FcuBus } from 'instruments/src/PFD/shared/FcuBusProvider'; +import { FgBus } from 'instruments/src/PFD/shared/FgBusProvider'; -import { VerticalMode } from '@shared/autopilot'; import { PFDSimvars } from './shared/PFDSimvarPublisher'; import { DigitalAltitudeReadout } from './DigitalAltitudeReadout'; -import { SimplaneValues } from './shared/SimplaneValueProvider'; import { VerticalTape } from './VerticalTape'; import { Arinc429Values } from './shared/ArincValueProvider'; @@ -140,7 +140,7 @@ class MinimumDescentAltitudeIndicator extends DisplayComponent<{ bus: ArincEvent private inLandingPhases = false; - private altMode: 'STD' | 'QNH' | 'QFE' = 'STD'; + private fcuEisDiscreteWord2 = new Arinc429Word(0); private readonly mda = Arinc429RegisterSubject.createEmpty(); @@ -151,9 +151,9 @@ class MinimumDescentAltitudeIndicator extends DisplayComponent<{ bus: ArincEvent !this.landingElevation.isFailureWarning() && !this.landingElevation.isNoComputedData() && this.inLandingPhases && - this.altMode === 'QNH'; + this.fcuEisDiscreteWord2.getBitValueOr(29, false); - this.qfeLandingAltValid = this.inLandingPhases && this.altMode === 'QFE'; + this.qfeLandingAltValid = this.inLandingPhases && !this.fcuEisDiscreteWord2.getBitValueOr(29, true); const altDelta = this.mda.get().value - this.altitude; @@ -176,7 +176,7 @@ class MinimumDescentAltitudeIndicator extends DisplayComponent<{ bus: ArincEvent onAfterRender(node: VNode): void { super.onAfterRender(node); - const sub = this.props.bus.getArincSubscriber(); + const sub = this.props.bus.getArincSubscriber(); sub .on('chosenRa') @@ -195,10 +195,10 @@ class MinimumDescentAltitudeIndicator extends DisplayComponent<{ bus: ArincEvent }); sub - .on('baroMode') + .on('fcuEisDiscreteWord2') .whenChanged() .handle((m) => { - this.altMode = m; + this.fcuEisDiscreteWord2 = m; this.updateIndication(); }); @@ -300,20 +300,22 @@ export class AltitudeIndicatorOfftape extends DisplayComponent(0); + private altConstraint = new Arinc429Word(0); - private constraint = 0; + private fmgcDiscreteWord1 = new Arinc429Word(0); - private activeVerticalMode = 0; + private fmgcDiscreteWord4 = new Arinc429Word(0); + + private shownTargetAltitude = Subject.create(new Arinc429Word(0)); private targetAltitudeColor = Subject.create(TargetAltitudeColor.Cyan); onAfterRender(node: VNode): void { super.onAfterRender(node); - const sub = this.props.bus.getSubscriber(); + const sub = this.props.bus.getSubscriber(); sub.on('altitudeAr').handle((altitude) => { if (!altitude.isNormalOperation()) { @@ -338,26 +340,34 @@ export class AltitudeIndicatorOfftape extends DisplayComponent { - this.activeVerticalMode = v; + this.fmgcDiscreteWord1 = v; this.handleAltManagedChange(); }); sub - .on('selectedAltitude') + .on('fmgcDiscreteWord4') + .whenChanged() + .handle((v) => { + this.fmgcDiscreteWord4 = v; + this.handleAltManagedChange(); + }); + + sub + .on('fcuSelectedAltitude') .whenChanged() .handle((alt) => { - this.targetAltitudeSelected = alt; + this.fcuSelectedAlt = alt; this.handleAltManagedChange(); }); sub - .on('altConstraint') + .on('fmgcFmAltitudeConstraint') .whenChanged() .handle((cstr) => { - this.constraint = cstr; + this.altConstraint = cstr; this.handleAltManagedChange(); }); } @@ -417,51 +427,50 @@ export class AltitudeIndicatorOfftape extends DisplayComponent 0 && isManagedModeActive; + const landTrackActive = this.fmgcDiscreteWord4.getBitValueOr(14, false); + const gsActive = this.fmgcDiscreteWord1.getBitValueOr(22, false); + const finalDesActive = this.fmgcDiscreteWord1.getBitValueOr(23, false); - const selectedAltIgnored = - (this.activeVerticalMode >= VerticalMode.GS_CPT && this.activeVerticalMode < VerticalMode.ROLL_OUT) || - this.activeVerticalMode === VerticalMode.FINAL; + const selectedAltIgnored = landTrackActive || gsActive || finalDesActive; - this.shownTargetAltitude.set(hasConstraint && !selectedAltIgnored ? this.constraint : this.targetAltitudeSelected); + const targetAltIsSelected = + selectedAltIgnored || this.altConstraint.isFailureWarning() || this.altConstraint.isNoComputedData(); + + this.shownTargetAltitude.set(targetAltIsSelected ? this.fcuSelectedAlt : this.altConstraint); if (selectedAltIgnored) { this.targetAltitudeColor.set(TargetAltitudeColor.White); - } else if (hasConstraint) { - this.targetAltitudeColor.set(TargetAltitudeColor.Magenta); - } else { + } else if (targetAltIsSelected) { this.targetAltitudeColor.set(TargetAltitudeColor.Cyan); + } else { + this.targetAltitudeColor.set(TargetAltitudeColor.Magenta); } } } interface SelectedAltIndicatorProps { bus: ArincEventBus; - selectedAltitude: Subscribable; + selectedAltitude: Subscribable; altitudeColor: Subscribable; } class SelectedAltIndicator extends DisplayComponent { - private mode: 'QNH' | 'QFE' | 'STD' = 'QNH'; - - private selectedAltLowerGroupRef = FSComponent.createRef(); + private baroInStd = false; private selectedAltLowerText = FSComponent.createRef(); private selectedAltLowerFLText = FSComponent.createRef(); - private selectedAltUpperGroupRef = FSComponent.createRef(); - private selectedAltUpperText = FSComponent.createRef(); private selectedAltUpperFLText = FSComponent.createRef(); + private selectedAltLowerGroupRef = FSComponent.createRef(); + + private selectedAltUpperGroupRef = FSComponent.createRef(); + + private selectedAltFailText = FSComponent.createRef(); + private targetGroupRef = FSComponent.createRef(); private blackFill = FSComponent.createRef(); @@ -472,7 +481,7 @@ class SelectedAltIndicator extends DisplayComponent { private altitude = new Arinc429Word(0); - private shownTargetAltitude = 0; + private shownTargetAltitude = new Arinc429Word(0); private textSub = Subject.create(''); @@ -505,7 +514,7 @@ class SelectedAltIndicator extends DisplayComponent { onAfterRender(node: VNode): void { super.onAfterRender(node); - const sub = this.props.bus.getArincSubscriber(); + const sub = this.props.bus.getArincSubscriber(); sub .on('altitudeAr') @@ -517,12 +526,12 @@ class SelectedAltIndicator extends DisplayComponent { }); sub - .on('baroMode') + .on('fcuEisDiscreteWord2') .whenChanged() .handle((m) => { - this.mode = m; + this.baroInStd = m.getBitValueOr(28, false) || m.isFailureWarning(); - if (this.mode === 'STD') { + if (this.baroInStd) { this.selectedAltLowerFLText.instance.style.visibility = 'visible'; this.selectedAltUpperFLText.instance.style.visibility = 'visible'; } else { @@ -546,38 +555,46 @@ class SelectedAltIndicator extends DisplayComponent { } private handleAltitudeDisplay() { - if (this.altitude.value - this.shownTargetAltitude > DisplayRange) { + if (this.shownTargetAltitude.isNoComputedData() || this.shownTargetAltitude.isFailureWarning()) { + this.selectedAltUpperGroupRef.instance.style.display = 'none'; + this.selectedAltLowerGroupRef.instance.style.display = 'none'; + this.targetGroupRef.instance.style.display = 'none'; + this.selectedAltFailText.instance.style.display = 'block'; + } else if (this.altitude.value - this.shownTargetAltitude.value > DisplayRange) { this.selectedAltLowerGroupRef.instance.style.display = 'block'; this.selectedAltUpperGroupRef.instance.style.display = 'none'; this.targetGroupRef.instance.style.display = 'none'; - } else if (this.altitude.value - this.shownTargetAltitude < -DisplayRange) { + this.selectedAltFailText.instance.style.display = 'none'; + } else if (this.altitude.value - this.shownTargetAltitude.value < -DisplayRange) { this.targetGroupRef.instance.style.display = 'none'; this.selectedAltUpperGroupRef.instance.style.display = 'block'; this.selectedAltLowerGroupRef.instance.style.display = 'none'; + this.selectedAltFailText.instance.style.display = 'none'; } else { this.selectedAltUpperGroupRef.instance.style.display = 'none'; this.selectedAltLowerGroupRef.instance.style.display = 'none'; this.targetGroupRef.instance.style.display = 'inline'; + this.selectedAltFailText.instance.style.display = 'none'; } } private setText() { let boxLength = 19.14; let text = '0'; - if (this.mode === 'STD') { - text = Math.round(this.shownTargetAltitude / 100) + if (this.baroInStd) { + text = Math.round(this.shownTargetAltitude.value / 100) .toString() .padStart(3, '0'); boxLength = 12.5; } else { - text = Math.round(this.shownTargetAltitude).toString().padStart(5, ' '); + text = Math.round(this.shownTargetAltitude.value).toString().padStart(5, ' '); } this.textSub.set(text); this.blackFill.instance.setAttribute('d', `m117.75 77.784h${boxLength}v6.0476h-${boxLength}z`); } private getOffset() { - const offset = ((this.altitude.value - this.shownTargetAltitude) * DistanceSpacing) / ValueSpacing; + const offset = ((this.altitude.value - this.shownTargetAltitude.value) * DistanceSpacing) / ValueSpacing; this.targetGroupRef.instance.style.transform = `translate3d(0px, ${offset}px, 0px)`; } @@ -644,6 +661,15 @@ class SelectedAltIndicator extends DisplayComponent { {this.textSub} + + ALT SEL + ); } @@ -659,9 +685,15 @@ class AltimeterIndicator extends DisplayComponent { private text = Subject.create(''); - private pressure = 0; + private baroInhg = new Arinc429Word(0); + + private baroHpa = new Arinc429Word(0); + + private baroInInhg = false; - private unit = ''; + private baroInStd = false; + + private baroInQnh = false; private transAltAr = Arinc429Register.empty(); @@ -678,33 +710,24 @@ class AltimeterIndicator extends DisplayComponent { onAfterRender(node: VNode): void { super.onAfterRender(node); - const sub = this.props.bus.getArincSubscriber(); + const sub = this.props.bus.getSubscriber(); sub - .on('baroMode') + .on('fcuEisDiscreteWord1') .whenChanged() - .handle((m) => { - if (m === 'QFE') { - this.mode.set(m); - this.stdGroup.instance.classList.add('HiddenElement'); - this.qfeGroup.instance.classList.remove('HiddenElement'); - this.qfeBorder.instance.classList.remove('HiddenElement'); - } else if (m === 'QNH') { - this.mode.set(m); - this.stdGroup.instance.classList.add('HiddenElement'); - this.qfeGroup.instance.classList.remove('HiddenElement'); - this.qfeBorder.instance.classList.add('HiddenElement'); - } else if (m === 'STD') { - this.mode.set(m); - this.stdGroup.instance.classList.remove('HiddenElement'); - this.qfeGroup.instance.classList.add('HiddenElement'); - this.qfeBorder.instance.classList.add('HiddenElement'); - } else { - this.mode.set(m); - this.stdGroup.instance.classList.add('HiddenElement'); - this.qfeGroup.instance.classList.add('HiddenElement'); - this.qfeBorder.instance.classList.add('HiddenElement'); - } + .handle((word) => { + this.baroInInhg = word.getBitValueOr(11, false); + + this.getText(); + }); + + sub + .on('fcuEisDiscreteWord2') + .whenChanged() + .handle((word) => { + this.baroInStd = word.getBitValueOr(28, false) || word.isFailureWarning(); + this.baroInQnh = word.getBitValueOr(29, false); + this.getText(); }); @@ -723,8 +746,8 @@ class AltimeterIndicator extends DisplayComponent { .handle((ta) => { this.transAltAr.set(ta); - this.handleBlink(); this.getText(); + this.handleBlink(); }); sub @@ -733,23 +756,23 @@ class AltimeterIndicator extends DisplayComponent { .handle((tl) => { this.transLvlAr.set(tl); - this.handleBlink(); this.getText(); + this.handleBlink(); }); sub - .on('units') + .on('fcuEisBaro') .whenChanged() - .handle((u) => { - this.unit = u; + .handle((p) => { + this.baroInhg = p; this.getText(); }); sub - .on('pressure') + .on('fcuEisBaroHpa') .whenChanged() .handle((p) => { - this.pressure = p; + this.baroHpa = p; this.getText(); }); @@ -781,14 +804,27 @@ class AltimeterIndicator extends DisplayComponent { } private getText() { - if (this.pressure !== null) { - if (this.unit === 'millibar') { - this.text.set(Math.round(this.pressure).toString()); - } else { - this.text.set(this.pressure.toFixed(2)); - } + if (this.baroInStd) { + this.mode.set('STD'); + this.stdGroup.instance.classList.remove('HiddenElement'); + this.qfeGroup.instance.classList.add('HiddenElement'); + this.qfeBorder.instance.classList.add('HiddenElement'); + } else if (this.baroInQnh) { + this.mode.set('QNH'); + this.stdGroup.instance.classList.add('HiddenElement'); + this.qfeGroup.instance.classList.remove('HiddenElement'); + this.qfeBorder.instance.classList.add('HiddenElement'); + } else { + this.mode.set('QFE'); + this.stdGroup.instance.classList.add('HiddenElement'); + this.qfeGroup.instance.classList.remove('HiddenElement'); + this.qfeBorder.instance.classList.remove('HiddenElement'); + } + + if (!this.baroInInhg) { + this.text.set(Math.round(this.baroHpa.value).toString()); } else { - this.text.set(''); + this.text.set(this.baroInhg.value.toFixed(2)); } } @@ -823,14 +859,14 @@ class AltimeterIndicator extends DisplayComponent { interface MetricAltIndicatorState { altitude: Arinc429WordData; - targetAlt: number; + targetAlt: Arinc429WordData; altitudeColor: TargetAltitudeColor; - metricAltToggle: boolean; + fcuDiscreteWord1: Arinc429Word; } interface MetricAltIndicatorProps { bus: ArincEventBus; - targetAlt: Subscribable; + targetAlt: Subscribable; altitudeColor: Subscribable; } @@ -839,6 +875,8 @@ class MetricAltIndicator extends DisplayComponent { private metricAlt = FSComponent.createRef(); + private metricTargetAlt = FSComponent.createRef(); + private metricAltText = FSComponent.createRef(); private metricAltTargetText = FSComponent.createRef(); @@ -849,14 +887,18 @@ class MetricAltIndicator extends DisplayComponent { private state: MetricAltIndicatorState = { altitude: new Arinc429Word(0), altitudeColor: TargetAltitudeColor.Cyan, - targetAlt: 0, - metricAltToggle: false, + targetAlt: new Arinc429Word(0), + fcuDiscreteWord1: new Arinc429Word(0), }; + private fmgcDiscreteWord1 = new Arinc429Word(0); + + private fmgcDiscreteWord4 = new Arinc429Word(0); + onAfterRender(node: VNode): void { super.onAfterRender(node); - const sub = this.props.bus.getArincSubscriber(); + const sub = this.props.bus.getArincSubscriber(); this.mda.sub(() => (this.needsUpdate = true)); @@ -876,15 +918,31 @@ class MetricAltIndicator extends DisplayComponent { }); sub - .on('metricAltToggle') + .on('fcuDiscreteWord1') .whenChanged() .handle((m) => { - this.state.metricAltToggle = m; + this.state.fcuDiscreteWord1 = m; this.needsUpdate = true; }); sub.on('fmMdaRaw').handle(this.mda.setWord.bind(this.mda)); + sub + .on('fmgcDiscreteWord1') + .whenChanged() + .handle((v) => { + this.fmgcDiscreteWord1 = v; + this.needsUpdate = true; + }); + + sub + .on('fmgcDiscreteWord4') + .whenChanged() + .handle((v) => { + this.fmgcDiscreteWord4 = v; + this.needsUpdate = true; + }); + sub.on('realTime').handle(this.updateState.bind(this)); } @@ -900,7 +958,11 @@ class MetricAltIndicator extends DisplayComponent { private updateState(_time: number) { if (this.needsUpdate) { this.needsUpdate = false; - const showMetricAlt = this.state.metricAltToggle; + + const showMetricAlt = + this.state.fcuDiscreteWord1.getBitValueOr(20, false) && + !this.state.targetAlt.isFailureWarning() && + !this.state.targetAlt.isNoComputedData(); if (!showMetricAlt) { this.metricAlt.instance.style.display = 'none'; } else { @@ -908,7 +970,7 @@ class MetricAltIndicator extends DisplayComponent { const currentMetricAlt = Math.round((this.state.altitude.value * 0.3048) / 10) * 10; this.metricAltText.instance.textContent = currentMetricAlt.toString(); - const targetMetric = Math.round((this.state.targetAlt * 0.3048) / 10) * 10; + const targetMetric = Math.round((this.state.targetAlt.value * 0.3048) / 10) * 10; this.metricAltTargetText.instance.textContent = targetMetric.toString(); this.updateAltitudeColor(); diff --git a/fbw-a32nx/src/systems/instruments/src/PFD/AttitudeIndicatorFixed.tsx b/fbw-a32nx/src/systems/instruments/src/PFD/AttitudeIndicatorFixed.tsx index 2ea157ae946c..2d26ca56810a 100644 --- a/fbw-a32nx/src/systems/instruments/src/PFD/AttitudeIndicatorFixed.tsx +++ b/fbw-a32nx/src/systems/instruments/src/PFD/AttitudeIndicatorFixed.tsx @@ -4,8 +4,9 @@ import { DisplayComponent, FSComponent, Subject, Subscribable, VNode } from '@microsoft/msfs-sdk'; import { ArincEventBus, Arinc429Register, Arinc429Word, Arinc429WordData } from '@flybywiresim/fbw-sdk'; +import { FgBus } from 'instruments/src/PFD/shared/FgBusProvider'; +import { FcuBus } from 'instruments/src/PFD/shared/FcuBusProvider'; -import { getDisplayIndex } from 'instruments/src/PFD/PFD'; import { FlightPathDirector } from './FlightPathDirector'; import { FlightPathVector } from './FlightPathVector'; import { Arinc429Values } from './shared/ArincValueProvider'; @@ -187,86 +188,57 @@ export class AttitudeIndicatorFixedCenter extends DisplayComponent { - private lateralMode = 0; + private fdEngaged = false; - private fdYawCommand = 0; + private fcuEisDiscreteWord2 = new Arinc429Word(0); - private fdActive = false; + private fdYawCommand = new Arinc429Word(0); private yawRef = FSComponent.createRef(); - private isActive(): boolean { - if (!this.fdActive || !(this.lateralMode === 40 || this.lateralMode === 33 || this.lateralMode === 34)) { - return false; - } - return true; - } + private handleFdState() { + const fdOff = this.fcuEisDiscreteWord2.getBitValueOr(23, false); + const showFd = this.fdEngaged && !fdOff; + + const showYaw = showFd && !(this.fdYawCommand.isFailureWarning() || this.fdYawCommand.isNoComputedData()); + + if (showYaw) { + const offset = -Math.max(Math.min(this.fdYawCommand.value, 45), -45) * 0.44; - private setOffset() { - const offset = -Math.max(Math.min(this.fdYawCommand, 45), -45) * 0.44; - if (this.isActive()) { this.yawRef.instance.style.visibility = 'visible'; this.yawRef.instance.style.transform = `translate3d(${offset}px, 0px, 0px)`; + } else { + this.yawRef.instance.style.visibility = 'hidden'; } } onAfterRender(node: VNode): void { super.onAfterRender(node); - const sub = this.props.bus.getSubscriber(); + const sub = this.props.bus.getSubscriber(); - sub.on('fdYawCommand').handle((fy) => { + sub.on('yawFdCommand').handle((fy) => { this.fdYawCommand = fy; - if (this.isActive()) { - this.setOffset(); - } else { - this.yawRef.instance.style.visibility = 'hidden'; - } + this.handleFdState(); }); sub - .on('activeLateralMode') + .on('fdEngaged') .whenChanged() - .handle((lm) => { - this.lateralMode = lm; + .handle((fd) => { + this.fdEngaged = fd; - if (this.isActive()) { - this.setOffset(); - } else { - this.yawRef.instance.style.visibility = 'hidden'; - } + this.handleFdState(); }); - // FIXME, differentiate properly (without duplication) sub - .on('fd1Active') + .on('fcuEisDiscreteWord2') .whenChanged() - .handle((fd) => { - if (getDisplayIndex() === 1) { - this.fdActive = fd; - - if (this.isActive()) { - this.setOffset(); - } else { - this.yawRef.instance.style.visibility = 'hidden'; - } - } - }); + .handle((tr) => { + this.fcuEisDiscreteWord2 = tr; - sub - .on('fd2Active') - .whenChanged() - .handle((fd) => { - if (getDisplayIndex() === 2) { - this.fdActive = fd; - - if (this.isActive()) { - this.setOffset(); - } else { - this.yawRef.instance.style.visibility = 'hidden'; - } - } + this.handleFdState(); }); } @@ -283,169 +255,192 @@ class FDYawBar extends DisplayComponent<{ bus: ArincEventBus }> { } class FlightDirector extends DisplayComponent<{ bus: ArincEventBus }> { - private lateralMode = 0; + private fdEngaged = false; - private verticalMode = 0; + private fcuEisDiscreteWord2 = new Arinc429Word(0); - private fdActive = false; + private fcuDiscreteWord1 = new Arinc429Word(0); - private trkFpaActive = false; + private fdRollCommand = new Arinc429Word(0); - private fdBank = 0; + private fdPitchCommand = new Arinc429Word(0); - private fdPitch = 0; + private fdYawCommand = new Arinc429Word(0); - private fdRef = FSComponent.createRef(); + private leftMainGearCompressed = false; - private lateralRef1 = FSComponent.createRef(); + private rightMainGearCompressed = false; - private lateralRef2 = FSComponent.createRef(); + private rollBarVisibleSub = Subject.create('hidden'); - private verticalRef1 = FSComponent.createRef(); + private rollBarOffsetSub = Subject.create(0); - private verticalRef2 = FSComponent.createRef(); + private pitchBarVisibleSub = Subject.create('hidden'); + + private pitchBarOffsetSub = Subject.create(0); + + private fdFlagVisibleSub = Subject.create('hidden'); private handleFdState() { - const [toggled, showLateral, showVertical] = this.isActive(); + const fdOff = this.fcuEisDiscreteWord2.getBitValueOr(23, false); + const showFd = this.fdEngaged && !fdOff; - let FDRollOffset = 0; - let FDPitchOffset = 0; + const trkFpaActive = this.fcuDiscreteWord1.getBitValueOr(25, false); - if (toggled && showLateral) { - const FDRollOrder = this.fdBank; - FDRollOffset = Math.min(Math.max(FDRollOrder, -45), 45) * 0.44; + const showRoll = + showFd && !trkFpaActive && !(this.fdRollCommand.isFailureWarning() || this.fdRollCommand.isNoComputedData()); - this.lateralRef1.instance.setAttribute('visibility', 'visible'); - this.lateralRef1.instance.style.transform = `translate3d(${FDRollOffset}px, 0px, 0px)`; + if (showRoll) { + const FDRollOffset = Math.min(Math.max(this.fdRollCommand.value, -45), 45) * 0.44; - this.lateralRef2.instance.setAttribute('visibility', 'visible'); - this.lateralRef2.instance.style.transform = `translate3d(${FDRollOffset}px, 0px, 0px)`; + this.rollBarVisibleSub.set('visible'); + this.rollBarOffsetSub.set(FDRollOffset); } else { - this.lateralRef1.instance.setAttribute('visibility', 'hidden'); - this.lateralRef2.instance.setAttribute('visibility', 'hidden'); + this.rollBarVisibleSub.set('hidden'); } - if (toggled && showVertical) { - const FDPitchOrder = this.fdPitch; - FDPitchOffset = Math.min(Math.max(FDPitchOrder, -22.5), 22.5) * 0.89; + const showPitch = + showFd && !trkFpaActive && !(this.fdPitchCommand.isFailureWarning() || this.fdPitchCommand.isNoComputedData()); - this.verticalRef1.instance.setAttribute('visibility', 'visible'); - this.verticalRef1.instance.style.transform = `translate3d(0px, ${FDPitchOffset}px, 0px)`; + if (showPitch) { + const FDPitchOffset = Math.min(Math.max(this.fdPitchCommand.value, -22.5), 22.5) * 0.89; - this.verticalRef2.instance.setAttribute('visibility', 'visible'); - this.verticalRef2.instance.style.transform = `translate3d(0px, ${FDPitchOffset}px, 0px)`; + this.pitchBarVisibleSub.set('visible'); + this.pitchBarOffsetSub.set(FDPitchOffset); } else { - this.verticalRef1.instance.setAttribute('visibility', 'hidden'); - this.verticalRef2.instance.setAttribute('visibility', 'hidden'); + this.pitchBarVisibleSub.set('hidden'); } - } - private isActive(): [boolean, boolean, boolean] { - const toggled = this.fdActive && !this.trkFpaActive; - - const showLateralFD = this.lateralMode !== 0 && this.lateralMode !== 34 && this.lateralMode !== 40; - const showVerticalFD = this.verticalMode !== 0 && this.verticalMode !== 34; - - return [toggled, showLateralFD, showVerticalFD]; + const onGround = this.leftMainGearCompressed || this.rightMainGearCompressed; + if ( + !fdOff && + (!this.fdEngaged || + this.fdRollCommand.isFailureWarning() || + this.fdPitchCommand.isFailureWarning() || + (this.fdYawCommand.isFailureWarning() && onGround)) + ) { + this.fdFlagVisibleSub.set('block'); + } else { + this.fdFlagVisibleSub.set('none'); + } } onAfterRender(node: VNode): void { super.onAfterRender(node); - const sub = this.props.bus.getSubscriber(); + const sub = this.props.bus.getArincSubscriber(); sub - .on('fd1Active') + .on('fdEngaged') .whenChanged() .handle((fd) => { - if (getDisplayIndex() === 1) { - this.fdActive = fd; - - if (this.isActive()[0]) { - this.fdRef.instance.style.display = 'inline'; - } else { - this.fdRef.instance.style.display = 'none'; - } - } + this.fdEngaged = fd; + + this.handleFdState(); }); sub - .on('fd2Active') + .on('fcuEisDiscreteWord2') .whenChanged() - .handle((fd) => { - if (getDisplayIndex() === 2) { - this.fdActive = fd; - - if (this.isActive()[0]) { - this.fdRef.instance.style.display = 'inline'; - } else { - this.fdRef.instance.style.display = 'none'; - } - } + .handle((tr) => { + this.fcuEisDiscreteWord2 = tr; + + this.handleFdState(); }); sub - .on('trkFpaActive') + .on('fcuDiscreteWord1') .whenChanged() .handle((tr) => { - this.trkFpaActive = tr; + this.fcuDiscreteWord1 = tr; - if (this.isActive()[0]) { - this.fdRef.instance.style.display = 'inline'; - } else { - this.fdRef.instance.style.display = 'none'; - } + this.handleFdState(); }); sub - .on('fdBank') - .withPrecision(2) + .on('rollFdCommand') + .withArinc429Precision(2) .handle((fd) => { - this.fdBank = fd; + this.fdRollCommand = fd; this.handleFdState(); }); + sub - .on('fdPitch') - .withPrecision(2) + .on('pitchFdCommand') + .withArinc429Precision(2) .handle((fd) => { - this.fdPitch = fd; + this.fdPitchCommand = fd; this.handleFdState(); }); sub - .on('activeLateralMode') - .whenChanged() - .handle((vm) => { - this.lateralMode = vm; + .on('yawFdCommand') + .withArinc429Precision(2) + .handle((fd) => { + this.fdYawCommand = fd; this.handleFdState(); }); sub - .on('activeVerticalMode') + .on('leftMainGearCompressed') .whenChanged() - .handle((lm) => { - this.verticalMode = lm; + .handle((g) => { + this.leftMainGearCompressed = g; + this.handleFdState(); + }); + sub + .on('rightMainGearCompressed') + .whenChanged() + .handle((g) => { + this.rightMainGearCompressed = g; this.handleFdState(); }); } render(): VNode | null { return ( - + - - - + + + - - - + + + + + FD + ); } diff --git a/fbw-a32nx/src/systems/instruments/src/PFD/AttitudeIndicatorHorizon.tsx b/fbw-a32nx/src/systems/instruments/src/PFD/AttitudeIndicatorHorizon.tsx index 83f08ce0591f..782e66fd95c9 100644 --- a/fbw-a32nx/src/systems/instruments/src/PFD/AttitudeIndicatorHorizon.tsx +++ b/fbw-a32nx/src/systems/instruments/src/PFD/AttitudeIndicatorHorizon.tsx @@ -2,24 +2,15 @@ // // SPDX-License-Identifier: GPL-3.0 -import { - ClockEvents, - ConsumerSubject, - DisplayComponent, - FSComponent, - MappedSubject, - Subject, - Subscribable, - VNode, -} from '@microsoft/msfs-sdk'; +import { ClockEvents, DisplayComponent, FSComponent, Subject, Subscribable, VNode } from '@microsoft/msfs-sdk'; import { ArincEventBus, Arinc429Register, Arinc429Word, Arinc429WordData, Arinc429RegisterSubject, - Arinc429ConsumerSubject, } from '@flybywiresim/fbw-sdk'; +import { FcuBus } from 'instruments/src/PFD/shared/FcuBusProvider'; import { DmcLogicEvents } from '../MsfsAvionicsCommon/providers/DmcPublisher'; import { @@ -42,73 +33,98 @@ class HeadingBug extends DisplayComponent<{ isCaptainSide: boolean; yOffset: Subscribable; }> { - private isActive = false; + private fcuSelectedHeading = new Arinc429Word(0); + + private fcuSelectedTrack = new Arinc429Word(0); + + private fcuEisDiscreteWord2 = new Arinc429Word(0); + + private fcuDiscreteWord1 = new Arinc429Word(0); + + private heading = new Arinc429Word(0); + + private bugVisible = Subject.create(false); + + private bugTranslate = Subject.create(''); - private selectedHeading = Subject.create(0); + private yOffset = 0; - private heading = Arinc429ConsumerSubject.create(null); + private calculateAndSetOffset() { + const fdActive = !this.fcuEisDiscreteWord2.getBitValueOr(23, false); + const trkFpaActive = this.fcuDiscreteWord1.getBitValueOr(25, false); - private attitude = Arinc429ConsumerSubject.create(null); + const targetValue = trkFpaActive ? this.fcuSelectedTrack : this.fcuSelectedHeading; - private fdActive = ConsumerSubject.create(null, true); + const showSelectedHeadingBug = !(fdActive || targetValue.isNoComputedData() || targetValue.isFailureWarning()); - private horizonHeadingBug = FSComponent.createRef(); + if (showSelectedHeadingBug) { + const headingDelta = getSmallestAngle(targetValue.value, this.heading.value); - private readonly visibilitySub = MappedSubject.create( - ([heading, attitude, fdActive, selectedHeading]) => { - const headingDelta = getSmallestAngle(selectedHeading, heading.value); const offset = (headingDelta * DistanceSpacing) / ValueSpacing; - const inRange = Math.abs(offset) <= DisplayRange + 10; - return !fdActive && attitude.isNormalOperation() && heading.isNormalOperation() && inRange; - }, - this.heading, - this.attitude, - this.fdActive, - this.selectedHeading, - ); - - private readonly headingBugSubject = MappedSubject.create( - ([heading, selectedHeading, yOffset, visible]) => { - if (visible) { - const headingDelta = getSmallestAngle(selectedHeading, heading.value); - - const offset = (headingDelta * DistanceSpacing) / ValueSpacing; - - return `transform: translate3d(${offset}px, ${yOffset}px, 0px)`; + + if (Math.abs(offset) <= DisplayRange + 10) { + this.bugVisible.set(true); + this.bugTranslate.set(`transform: translate3d(${offset}px, ${this.yOffset}px, 0px)`); + } else { + this.bugVisible.set(false); } - return ''; - }, - this.heading, - this.selectedHeading, - this.props.yOffset, - this.visibilitySub, - ); + } else { + this.bugVisible.set(false); + } + } onAfterRender(node: VNode): void { super.onAfterRender(node); - const sub = this.props.bus.getArincSubscriber(); + const sub = this.props.bus.getSubscriber(); - this.heading.setConsumer(sub.on('heading').withArinc429Precision(2)); + sub + .on('fcuSelectedHeading') + .whenChanged() + .handle((s) => { + this.fcuSelectedHeading = s; + this.calculateAndSetOffset(); + }); sub - .on('selectedHeading') + .on('fcuSelectedTrack') .whenChanged() .handle((s) => { - this.selectedHeading.set(s); + this.fcuSelectedTrack = s; + this.calculateAndSetOffset(); }); - this.attitude.setConsumer(sub.on('pitchAr')); - this.fdActive.setConsumer(sub.on(this.props.isCaptainSide ? 'fd1Active' : 'fd2Active').whenChanged()); + sub.on('heading').handle((h) => { + this.heading = h; + this.calculateAndSetOffset(); + }); + + sub + .on('fcuEisDiscreteWord2') + .whenChanged() + .handle((fd) => { + this.fcuEisDiscreteWord2 = fd; + }); + + sub + .on('fcuDiscreteWord1') + .whenChanged() + .handle((fd) => { + this.fcuDiscreteWord1 = fd; + }); + + this.props.yOffset.sub((yOffset) => { + this.yOffset = yOffset; + this.calculateAndSetOffset(); + }); } render(): VNode { return ( (v ? 'inherit' : 'hidden'))} + style={this.bugTranslate} + visibility={this.bugVisible.map((v) => (v ? 'inherit' : 'hidden'))} > diff --git a/fbw-a32nx/src/systems/instruments/src/PFD/DigitalAltitudeReadout.tsx b/fbw-a32nx/src/systems/instruments/src/PFD/DigitalAltitudeReadout.tsx index 4f00e25020e1..a39b497b7c84 100644 --- a/fbw-a32nx/src/systems/instruments/src/PFD/DigitalAltitudeReadout.tsx +++ b/fbw-a32nx/src/systems/instruments/src/PFD/DigitalAltitudeReadout.tsx @@ -3,7 +3,6 @@ // SPDX-License-Identifier: GPL-3.0 import { - ConsumerSubject, DisplayComponent, FSComponent, MappedSubject, @@ -14,7 +13,6 @@ import { } from '@microsoft/msfs-sdk'; import { ArincEventBus, Arinc429RegisterSubject } from '@flybywiresim/fbw-sdk'; -import { SimplaneBaroMode, SimplaneValues } from 'instruments/src/PFD/shared/SimplaneValueProvider'; import { Arinc429Values } from './shared/ArincValueProvider'; import { PFDSimvars } from './shared/PFDSimvarPublisher'; @@ -72,8 +70,6 @@ export class DigitalAltitudeReadout extends DisplayComponent(null, 'QNH'); - private isNegativeSub = Subject.create('hidden'); private showThousandsZeroSub = Subject.create(false); @@ -102,7 +98,7 @@ export class DigitalAltitudeReadout extends DisplayComponent(); + const sub = this.props.bus.getArincSubscriber(); this.altitude.sub((altitude) => { const isNegative = altitude.value < 0; @@ -148,8 +144,6 @@ export class DigitalAltitudeReadout extends DisplayComponent extends DisplayComponent { private timeout: number = 0; - private displayTimeInSeconds; + private displayTimeInSeconds: number; protected modeChangedPathRef = FSComponent.createRef(); @@ -50,11 +50,13 @@ abstract class ShowForSecondsComponent extends Display } export class FMA extends DisplayComponent<{ bus: ArincEventBus; isAttExcessive: Subscribable }> { - private activeLateralMode: number = 0; + private fmgcDiscreteWord1 = new Arinc429Word(0); - private activeVerticalMode: number = 0; + private fmgcDiscreteWord2 = new Arinc429Word(0); - private armedVerticalModeSub = Subject.create(0); + private fmgcDiscreteWord4 = new Arinc429Word(0); + + private tcasArmed = false; private athrModeMessage = 0; @@ -83,15 +85,19 @@ export class FMA extends DisplayComponent<{ bus: ArincEventBus; isAttExcessive: private AB3Message = Subject.create(false); private handleFMABorders() { - const sharedModeActive = - this.activeLateralMode === 32 || - this.activeLateralMode === 33 || - this.activeLateralMode === 34 || - (this.activeLateralMode === 20 && this.activeVerticalMode === 24); + const rollOutActive = this.fmgcDiscreteWord2.getBitValueOr(26, false); + const flareActive = this.fmgcDiscreteWord2.getBitValueOr(25, false); + const landActive = this.fmgcDiscreteWord4.getBitValueOr(14, false) && !flareActive && !rollOutActive; + + const navActive = this.fmgcDiscreteWord2.getBitValueOr(12, false); + const finalActive = this.fmgcDiscreteWord1.getBitValueOr(23, false); + + const sharedModeActive = rollOutActive || flareActive || landActive || (navActive && finalActive); + const BC3Message = getBC3Message( this.props.isAttExcessive.get(), - this.armedVerticalModeSub.get(), + this.tcasArmed, this.setHoldSpeed, this.trkFpaDeselected.get(), this.tcasRaInhibited.get(), @@ -128,32 +134,41 @@ export class FMA extends DisplayComponent<{ bus: ArincEventBus; isAttExcessive: onAfterRender(node: VNode): void { super.onAfterRender(node); - const sub = this.props.bus.getSubscriber(); + const sub = this.props.bus.getSubscriber(); this.props.isAttExcessive.sub((_a) => { this.handleFMABorders(); }); sub - .on('fmaVerticalArmed') + .on('fmgcDiscreteWord1') .whenChanged() - .handle((a) => { - this.armedVerticalModeSub.set(a); + .handle((word) => { + this.fmgcDiscreteWord1 = word; + this.handleFMABorders(); + }); + + sub + .on('fmgcDiscreteWord2') + .whenChanged() + .handle((word) => { + this.fmgcDiscreteWord2 = word; this.handleFMABorders(); }); sub - .on('activeLateralMode') + .on('fmgcDiscreteWord4') .whenChanged() - .handle((activeLateralMode) => { - this.activeLateralMode = activeLateralMode; + .handle((word) => { + this.fmgcDiscreteWord4 = word; this.handleFMABorders(); }); + sub - .on('activeVerticalMode') + .on('fmgcDiscreteWord7') .whenChanged() - .handle((activeVerticalMode) => { - this.activeVerticalMode = activeVerticalMode; + .handle((word) => { + this.tcasArmed = word.getBitValueOr(12, false); this.handleFMABorders(); }); @@ -181,22 +196,6 @@ export class FMA extends DisplayComponent<{ bus: ArincEventBus; isAttExcessive: this.handleFMABorders(); }); - sub - .on('tcasRaInhibited') - .whenChanged() - .handle((tra) => { - this.tcasRaInhibited.set(tra); - this.handleFMABorders(); - }); - - sub - .on('trkFpaDeselectedTCAS') - .whenChanged() - .handle((trk) => { - this.trkFpaDeselected.set(trk); - this.handleFMABorders(); - }); - sub .on('fcdcDiscreteWord1') .atFrequency(1) @@ -368,17 +367,14 @@ class A2Cell extends DisplayComponent<{ bus: ArincEventBus }> { } }); - sub - .on('AThrMode') - .whenChanged() - .handle((athrMode) => { - // ATHR mode overrides BRK LO and MED memo - if (athrMode > 0 && athrMode <= 6) { - this.autoBrkRef.instance.style.visibility = 'hidden'; - } else { - this.autoBrkRef.instance.style.visibility = 'visible'; - } - }); + // sub.on('AThrMode').whenChanged().handle((athrMode) => { + // // ATHR mode overrides BRK LO and MED memo + // if (athrMode > 0 && athrMode <= 6) { + // this.autoBrkRef.instance.style.visibility = 'hidden'; + // } else { + // this.autoBrkRef.instance.style.visibility = 'visible'; + // } + // }); } render(): VNode { @@ -429,7 +425,9 @@ interface CellProps extends ComponentProps { } class A1A2Cell extends ShowForSecondsComponent { - private athrMode = 0; + private fcuAtsFmaDiscreteWord = new Arinc429Word(0); + + private fcuAtsDiscreteWord = new Arinc429Word(0); private cellRef = FSComponent.createRef(); @@ -447,28 +445,28 @@ class A1A2Cell extends ShowForSecondsComponent { let text: string = ''; this.isShown = true; - switch (this.athrMode) { - case 1: - this.displayModeChangedPath(true); - text = ` + const atEngaged = this.fcuAtsDiscreteWord.getBitValueOr(13, false); + const atActive = this.fcuAtsDiscreteWord.getBitValueOr(14, false); + + if (this.fcuAtsFmaDiscreteWord.getBitValueOr(11, false)) { + this.displayModeChangedPath(true); + text = ` MAN TOGA `; - break; - case 2: - this.displayModeChangedPath(true); - text = ` + } else if (false) { + this.displayModeChangedPath(true); + text = ` MAN GA SOFT `; - break; - case 3: { - this.displayModeChangedPath(true); - const FlexTemp = Math.round(this.flexTemp); - const FlexText = FlexTemp >= 0 ? `+${FlexTemp}` : FlexTemp.toString(); - text = ` + } else if (this.fcuAtsFmaDiscreteWord.getBitValueOr(13, false)) { + this.displayModeChangedPath(true); + const FlexTemp = Math.round(this.flexTemp); + const FlexText = FlexTemp >= 0 ? `+${FlexTemp}` : FlexTemp.toString(); + text = ` MAN FLX @@ -476,96 +474,80 @@ class A1A2Cell extends ShowForSecondsComponent { ${FlexText} `; - - break; - } - case 4: - this.displayModeChangedPath(true); - text = ` + } else if (this.fcuAtsFmaDiscreteWord.getBitValueOr(29, false)) { + this.displayModeChangedPath(true); + text = ` MAN DTO `; - break; - case 5: - this.displayModeChangedPath(true); - text = ` + } else if (this.fcuAtsFmaDiscreteWord.getBitValueOr(12, false) && atEngaged && !atActive) { + this.displayModeChangedPath(true); + text = ` MAN MCT `; - break; - case 6: - this.displayModeChangedPath(true); - text = ` + } else if (this.fcuAtsFmaDiscreteWord.getBitValueOr(15, false) && atEngaged && !atActive) { + this.displayModeChangedPath(true); + text = ` MAN THR `; - break; - case 7: - text = 'SPEED'; - this.displayModeChangedPath(); - break; - case 8: - text = 'MACH'; - this.displayModeChangedPath(); - break; - case 9: - text = 'THR MCT'; - this.displayModeChangedPath(); - break; - case 10: - text = 'THR CLB'; - this.displayModeChangedPath(); - break; - case 11: - text = 'THR LVR'; - this.displayModeChangedPath(); - break; - case 12: - text = 'THR IDLE'; - this.displayModeChangedPath(); - break; - case 13: - this.displayModeChangedPath(true); - text = ` + } else if (this.fcuAtsFmaDiscreteWord.getBitValueOr(17, false)) { + this.displayModeChangedPath(true); + text = ` A.FLOOR `; - break; - case 14: - this.displayModeChangedPath(true); - text = ` + } else if (this.fcuAtsFmaDiscreteWord.getBitValueOr(18, false)) { + this.displayModeChangedPath(true); + text = ` TOGA LK `; - break; - default: - if (this.autoBrakeActive) { - switch (this.autoBrakeMode) { - case 1: - text = 'BRK LO'; - this.displayModeChangedPath(); - break; - case 2: - text = 'BRK MED'; - this.displayModeChangedPath(); - break; - case 3: - text = 'BRK MAX'; - this.displayModeChangedPath(); - break; - default: - text = ''; - this.isShown = false; - this.displayModeChangedPath(true); - } - } else { + } else if (this.fcuAtsFmaDiscreteWord.getBitValueOr(19, false)) { + text = 'SPEED'; + this.displayModeChangedPath(); + } else if (this.fcuAtsFmaDiscreteWord.getBitValueOr(20, false)) { + text = 'MACH'; + this.displayModeChangedPath(); + } else if (this.fcuAtsFmaDiscreteWord.getBitValueOr(12, false) && atEngaged && atActive) { + text = 'THR MCT'; + this.displayModeChangedPath(); + } else if (this.fcuAtsFmaDiscreteWord.getBitValueOr(14, false)) { + text = 'THR CLB'; + this.displayModeChangedPath(); + } else if (this.fcuAtsFmaDiscreteWord.getBitValueOr(15, false) && atEngaged && atActive) { + text = 'THR LVR'; + this.displayModeChangedPath(); + } else if (this.fcuAtsFmaDiscreteWord.getBitValueOr(16, false)) { + text = 'THR IDLE'; + this.displayModeChangedPath(); + } else if (this.autoBrakeActive) { + switch (this.autoBrakeMode) { + case 1: + text = 'BRK LO'; + this.displayModeChangedPath(); + break; + case 2: + text = 'BRK MED'; + this.displayModeChangedPath(); + break; + case 3: + text = 'BRK MAX'; + this.displayModeChangedPath(); + break; + default: text = ''; this.isShown = false; this.displayModeChangedPath(true); - } + } + } else { + text = ''; + this.isShown = false; + this.displayModeChangedPath(true); } this.cellRef.instance.innerHTML = text; @@ -574,7 +556,7 @@ class A1A2Cell extends ShowForSecondsComponent { onAfterRender(node: VNode): void { super.onAfterRender(node); - const sub = this.props.bus.getSubscriber(); + const sub = this.props.bus.getSubscriber(); sub .on('flexTemp') @@ -585,10 +567,10 @@ class A1A2Cell extends ShowForSecondsComponent { }); sub - .on('AThrMode') + .on('fcuAtsFmaDiscreteWord') .whenChanged() - .handle((athrMode) => { - this.athrMode = athrMode; + .handle((word) => { + this.fcuAtsFmaDiscreteWord = word; this.setText(); }); @@ -632,61 +614,57 @@ class A3Cell extends DisplayComponent { private textSub = Subject.create(''); + private fcuAtsFmaDiscreteWord = new Arinc429Word(0); + private autobrakeMode = 0; private AB3Message = false; - private onUpdateAthrModeMessage(message: number) { + private updateMessage() { + const clbDemand = this.fcuAtsFmaDiscreteWord.getBitValueOr(22, false); + const mctDemand = this.fcuAtsFmaDiscreteWord.getBitValueOr(23, false); + const assymThrust = this.fcuAtsFmaDiscreteWord.getBitValueOr(21, false); + let text: string = ''; let className: string = ''; - switch (message) { - case 1: - text = 'THR LK'; - className = 'Amber BlinkInfinite'; - break; - case 2: - text = 'LVR TOGA'; - className = 'White BlinkInfinite'; - break; - case 3: - text = 'LVR CLB'; - className = 'White BlinkInfinite'; - break; - case 4: - text = 'LVR MCT'; - className = 'White BlinkInfinite'; - break; - case 5: - text = 'LVR ASYM'; - className = 'Amber'; - break; - default: - text = ''; + // TODO Implement ECU Bus for THR LK + if (false) { + text = 'THR LK'; + className = 'Amber BlinkInfinite'; + } else if (false) { + text = 'LVR TOGA'; + className = 'White BlinkInfinite'; + } else if (clbDemand) { + text = 'LVR CLB'; + className = 'White BlinkInfinite'; + } else if (mctDemand) { + text = 'LVR MCT'; + className = 'White BlinkInfinite'; + } else if (assymThrust) { + text = 'LVR ASYM'; + className = 'Amber'; + } else if (this.autobrakeMode === 3 && !this.AB3Message) { + text = 'BRK MAX'; + className = 'FontMediumSmaller MiddleAlign Cyan'; + } else { + text = ''; } this.textSub.set(text); this.classSub.set(`FontMedium MiddleAlign ${className}`); } - private handleAutobrakeMode() { - if (this.autobrakeMode === 3 && !this.AB3Message) { - this.textSub.set('BRK MAX'); - this.classSub.set('FontMediumSmaller MiddleAlign Cyan'); - } else { - this.textSub.set(''); - } - } - onAfterRender(node: VNode): void { super.onAfterRender(node); - const sub = this.props.bus.getSubscriber(); + const sub = this.props.bus.getSubscriber(); sub - .on('athrModeMessage') + .on('fcuAtsFmaDiscreteWord') .whenChanged() - .handle((m) => { - this.onUpdateAthrModeMessage(m); + .handle((word) => { + this.fcuAtsFmaDiscreteWord = word; + this.updateMessage(); }); sub @@ -694,12 +672,12 @@ class A3Cell extends DisplayComponent { .whenChanged() .handle((am) => { this.autobrakeMode = am; - this.handleAutobrakeMode(); + this.updateMessage(); }); this.props.AB3Message.sub((ab3) => { this.AB3Message = ab3; - this.handleAutobrakeMode(); + this.updateMessage(); }); sub @@ -779,13 +757,10 @@ class AB3Cell extends DisplayComponent { this.getText(); }); - sub - .on('athrModeMessage') - .whenChanged() - .handle((m) => { - this.athrModeMessage = m; - this.getText(); - }); + // sub.on('athrModeMessage').whenChanged().handle((m) => { + // this.athrModeMessage = m; + // this.getText(); + // }); } render(): VNode { @@ -807,163 +782,174 @@ class B1Cell extends ShowForSecondsComponent { private boxPathStringSub = Subject.create(''); - private activeVerticalModeSub = Subject.create(0); - private activeVerticalModeClassSub = Subject.create(''); + private readonly verticalText = Subject.create(''); + + private readonly additionalText = Subject.create(''); + + private readonly inSpeedProtection = Subject.create(false); + private speedProtectionPathRef = FSComponent.createRef(); private inModeReversionPathRef = FSComponent.createRef(); private fmaTextRef = FSComponent.createRef(); - private readonly verticalText = Subject.create(''); + private selectedVS = new Arinc429Word(0); - private readonly additionalText = Subject.create(''); + private selectedFPA = new Arinc429Word(0); - private selectedVS = 0; + private fmgcDiscreteWord1 = new Arinc429Word(0); - private readonly apSpeedProtection = ConsumerSubject.create(null, false); + private fmgcDiscreteWord2 = new Arinc429Word(0); - private readonly inSpeedProtection = MappedSubject.create( - ([apSpeedProtection, activeVerticalMode]) => - apSpeedProtection && (activeVerticalMode === 14 || activeVerticalMode === 15), - this.apSpeedProtection, - this.activeVerticalModeSub, - ); + private fmgcDiscreteWord3 = new Arinc429Word(0); - private fmaModeReversion = false; + private fmgcDiscreteWord4 = new Arinc429Word(0); - private expediteMode = false; + private fmgcDiscreteWord7 = new Arinc429Word(0); - private crzAltMode = false; + private fmAltitudeConstraint = new Arinc429Word(0); - private tcasModeDisarmed = false; - - private FPA = 0; + private previousText = ''; constructor(props: CellProps) { super(props, 10); } private getText(): boolean { + const gsMode = this.fmgcDiscreteWord1.getBitValueOr(22, false); + const gsTrackMode = this.fmgcDiscreteWord1.getBitValueOr(20, false); + const gsCaptureMode = this.fmgcDiscreteWord1.getBitValueOr(21, false); + const expedMode = this.fmgcDiscreteWord1.getBitValueOr(24, false); + const descentMode = this.fmgcDiscreteWord1.getBitValueOr(12, false); + const climbMode = this.fmgcDiscreteWord1.getBitValueOr(11, false); + const pitchTakeoffMode = this.fmgcDiscreteWord1.getBitValueOr(15, false); + const pitchGoaroundMode = this.fmgcDiscreteWord1.getBitValueOr(16, false); + const openMode = this.fmgcDiscreteWord1.getBitValueOr(14, false); + const trackMode = this.fmgcDiscreteWord1.getBitValueOr(20, false); + const captureMode = this.fmgcDiscreteWord1.getBitValueOr(21, false); + const altMode = this.fmgcDiscreteWord1.getBitValueOr(19, false); + const dashMode = this.fmgcDiscreteWord1.getBitValueOr(26, false); + const altConstraintValid = this.fmAltitudeConstraint.isNormalOperation(); + const fpaMode = this.fmgcDiscreteWord1.getBitValueOr(18, false); + const vsMode = this.fmgcDiscreteWord1.getBitValueOr(17, false); + const finalDesMode = this.fmgcDiscreteWord1.getBitValueOr(23, false); + const tcasMode = this.fmgcDiscreteWord7.getBitValueOr(13, false); + + const navMode = this.fmgcDiscreteWord2.getBitValueOr(12, false); + let text: string; let additionalText: string = ''; this.isShown = true; - switch (this.activeVerticalModeSub.get()) { - case VerticalMode.GS_TRACK: - text = 'G/S'; - break; - /* case 2: - text = 'F-G/S'; - break; */ - case VerticalMode.GS_CPT: - text = 'G/S*'; - break; - /* case 4: - text = 'F-G/S*'; - break; */ - case VerticalMode.SRS: - case VerticalMode.SRS_GA: - text = 'SRS'; - break; - case VerticalMode.TCAS: - text = 'TCAS'; - break; - /* case 9: - text = 'FINAL'; - break; */ - case VerticalMode.DES: - text = 'DES'; - break; - case VerticalMode.OP_DES: - if (this.expediteMode) { - text = 'EXP DES'; - } else { - text = 'OP DES'; - } - break; - case VerticalMode.CLB: - text = 'CLB'; - break; - case VerticalMode.OP_CLB: - if (this.expediteMode) { - text = 'EXP CLB'; - } else { - text = 'OP CLB'; - } - break; - case VerticalMode.ALT: - if (this.crzAltMode) { - text = 'ALT CRZ'; - } else { - text = 'ALT'; - } - break; - case VerticalMode.ALT_CPT: - text = 'ALT*'; - break; - case VerticalMode.ALT_CST_CPT: - text = 'ALT CST*'; - break; - case VerticalMode.ALT_CST: - text = 'ALT CST'; - break; - /* case 18: - text = 'ALT CRZ'; - break; */ - case VerticalMode.FPA: { - const FPAText = `${this.FPA > 0 ? '+' : ''}${(Math.round(this.FPA * 10) / 10).toFixed(1)}°`; - - text = 'FPA'; + if (gsMode && gsTrackMode) { + text = 'G/S'; + } else if (false) { + text = 'F-G/S'; + } else if (gsMode && gsCaptureMode) { + text = 'G/S*'; + } else if (false) { + text = 'F-G/S*'; + } else if (expedMode && descentMode) { + text = 'EXP DES'; + } else if (expedMode && climbMode) { + text = 'EXP CLB'; + } else if (pitchTakeoffMode || pitchGoaroundMode) { + text = 'SRS'; + } else if (tcasMode) { + text = 'TCAS'; + } else if (finalDesMode && !navMode) { + text = 'FINAL'; + } else if (descentMode && !openMode) { + text = 'DES'; + } else if (descentMode && openMode) { + text = 'OP DES'; + } else if (climbMode && !openMode) { + text = 'CLB'; + } else if (climbMode && openMode) { + text = 'OP CLB'; + } else if (trackMode && altMode && !dashMode && !altConstraintValid) { + text = 'ALT'; + } else if (captureMode && altMode && !dashMode && !altConstraintValid) { + text = 'ALT*'; + } else if (captureMode && altMode && !dashMode && altConstraintValid) { + text = 'ALT CST*'; + } else if (trackMode && altMode && !dashMode && altConstraintValid) { + text = 'ALT CST'; + } else if (dashMode && (!altMode || !altConstraintValid)) { + text = 'ALT CRZ'; + } else if (fpaMode) { + text = 'FPA'; + + if (!(this.selectedFPA.isNoComputedData() || this.selectedFPA.isFailureWarning())) { + const fpaValue = this.selectedFPA.value; + additionalText = `${fpaValue > 0 ? '+' : ''}${(Math.round(fpaValue * 10) / 10).toFixed(1)}°`; // if FPA is 0 give it an empty space for where the '+' and '-' will be. - if (this.FPA === 0) { + if (fpaValue === 0) { text += ' '; } - additionalText = FPAText; - break; + } else { + additionalText = '-----'; } - case VerticalMode.VS: { - const VSText = `${this.selectedVS > 0 ? '+' : ''}${Math.round(this.selectedVS).toString()}`.padStart(5, '\xa0'); + } else if (vsMode) { + if (!(this.selectedVS.isNoComputedData() || this.selectedVS.isFailureWarning())) { + const vsValue = this.selectedVS.value; + additionalText = `${vsValue > 0 ? '+' : ''}${Math.round(vsValue).toString()}`.padStart(5, '\xa0'); + } else { + additionalText = '-----'; + } + + text = 'V/S'; + } else { + text = ''; + this.isShown = false; + } - text = 'V/S'; + const hasChanged = text.length > 0 && text !== this.previousText; + this.previousText = text; - additionalText = VSText; - break; - } - default: - text = ''; - this.isShown = false; - this.displayModeChangedPath(true); + if (hasChanged) { + this.displayModeChangedPath(); + } else if (!this.isShown) { + this.displayModeChangedPath(true); } - const inSpeedProtection = this.inSpeedProtection.get(); + const targetNotHeld = this.fmgcDiscreteWord4.getBitValueOr(29, false); + + const inSpeedProtection = targetNotHeld && text !== ''; + + this.inSpeedProtection.set(inSpeedProtection); + + const longitudinalModeReversion = this.fmgcDiscreteWord3.getBitValueOr(18, false); - if (inSpeedProtection || this.fmaModeReversion) { + if (inSpeedProtection || longitudinalModeReversion) { this.boxClassSub.set('NormalStroke None'); } else { this.boxClassSub.set('NormalStroke White'); } + if (longitudinalModeReversion) { + this.inModeReversionPathRef.instance.setAttribute('visibility', 'visible'); + } else { + this.inModeReversionPathRef.instance.setAttribute('visibility', 'hidden'); + } + if (inSpeedProtection) { this.speedProtectionPathRef.instance.setAttribute('visibility', 'visible'); } else { this.speedProtectionPathRef.instance.setAttribute('visibility', 'hidden'); } + const bigBoxDisplayed = this.fmgcDiscreteWord7.getBitValueOr(18, false); const boxPathString = - this.activeVerticalModeSub.get() === 50 && this.tcasModeDisarmed - ? 'm35.756 1.8143h27.918v13.506h-27.918z' - : 'm35.756 1.8143h27.918v6.0476h-27.918z'; + tcasMode && bigBoxDisplayed ? 'm35.756 1.8143h27.918v13.506h-27.918z' : 'm35.756 1.8143h27.918v6.0476h-27.918z'; this.boxPathStringSub.set(boxPathString); // VS FPA & ALT CST* have a smaller font than the other active modes - const smallFont = - this.activeVerticalModeSub.get() === 14 || - this.activeVerticalModeSub.get() === 15 || - this.activeVerticalModeSub.get() === 21; + const smallFont = fpaMode || vsMode || (captureMode && altMode && !dashMode && altConstraintValid); this.activeVerticalModeClassSub.set( smallFont ? 'FontMediumSmaller MiddleAlign Green' : 'FontMedium MiddleAlign Green', @@ -978,70 +964,69 @@ class B1Cell extends ShowForSecondsComponent { onAfterRender(node: VNode): void { super.onAfterRender(node); - const sub = this.props.bus.getSubscriber(); + const sub = this.props.bus.getSubscriber(); sub - .on('activeVerticalMode') + .on('fmgcDiscreteWord1') .whenChanged() - .handle((activeVerticalMode) => { - this.activeVerticalModeSub.set(activeVerticalMode); + .handle((word) => { + this.fmgcDiscreteWord1 = word; this.getText(); - this.displayModeChangedPath(); }); sub - .on('selectedFpa') + .on('fmgcDiscreteWord2') .whenChanged() - .handle((fpa) => { - this.FPA = fpa; + .handle((word) => { + this.fmgcDiscreteWord2 = word; this.getText(); }); sub - .on('apVsSelected') + .on('fmgcDiscreteWord3') .whenChanged() - .handle((svs) => { - this.selectedVS = svs; + .handle((word) => { + this.fmgcDiscreteWord4 = word; this.getText(); }); sub - .on('fmaModeReversion') + .on('fmgcDiscreteWord4') .whenChanged() - .handle((reversion) => { - this.fmaModeReversion = reversion; - if (reversion) { - this.inModeReversionPathRef.instance.setAttribute('visibility', 'visible'); - } else { - this.inModeReversionPathRef.instance.setAttribute('visibility', 'hidden'); - } + .handle((word) => { + this.fmgcDiscreteWord4 = word; this.getText(); }); - this.apSpeedProtection.setConsumer(sub.on('fmaSpeedProtection')); - this.apSpeedProtection.sub(this.getText.bind(this)); + sub + .on('fmgcDiscreteWord7') + .whenChanged() + .handle((word) => { + this.fmgcDiscreteWord7 = word; + this.getText(); + }); sub - .on('expediteMode') + .on('fmgcFmAltitudeConstraint') .whenChanged() - .handle((e) => { - this.expediteMode = e; + .handle((word) => { + this.fmAltitudeConstraint = word; this.getText(); }); sub - .on('crzAltMode') + .on('fcuSelectedFpa') .whenChanged() - .handle((c) => { - this.crzAltMode = c; + .handle((fpa) => { + this.selectedFPA = fpa; this.getText(); }); sub - .on('tcasModeDisarmed') + .on('fcuSelectedVerticalSpeed') .whenChanged() - .handle((t) => { - this.tcasModeDisarmed = t; + .handle((svs) => { + this.selectedVS = svs; this.getText(); }); } @@ -1092,49 +1077,64 @@ class B2Cell extends DisplayComponent { private classSub = Subject.create(''); + private altConstraint = new Arinc429Word(0); + + private fmgcDiscreteWord3 = new Arinc429Word(0); + + private handleMessage(): void { + const altAcqArmed = this.fmgcDiscreteWord3.getBitValueOr(12, false); + const clbArmed = this.fmgcDiscreteWord3.getBitValueOr(24, false); + + let text1: string; + let color1 = 'Cyan'; + if (altAcqArmed && this.altConstraint.isNormalOperation()) { + text1 = 'ALT'; + color1 = 'Magenta'; + } else if (altAcqArmed && !clbArmed && !this.altConstraint.isNormalOperation()) { + text1 = 'ALT'; + } else if (clbArmed) { + text1 = ' CLB'; // spaces added to center armed FMA as per newer DMC stnadards + } else if (this.fmgcDiscreteWord3.getBitValueOr(25, false)) { + text1 = 'DES'; + } else { + text1 = ''; + } + + let text2; + if (false) { + text2 = 'F-G/S'; + } else if (this.fmgcDiscreteWord3.getBitValueOr(22, false)) { + text2 = 'G/S'; + } else if (this.fmgcDiscreteWord3.getBitValueOr(23, false)) { + text2 = 'FINAL'; + } else { + text2 = ''; + } + + this.text1Sub.set(text1); + this.text2Sub.set(text2); + this.classSub.set(`FontMediumSmaller MiddleAlign ${color1}`); + } + onAfterRender(node: VNode): void { super.onAfterRender(node); - const sub = this.props.bus.getSubscriber(); + const sub = this.props.bus.getSubscriber(); sub - .on('fmaVerticalArmed') + .on('fmgcDiscreteWord3') .whenChanged() - .handle((fmv) => { - const altArmed = (fmv >> 0) & 1; - const altCstArmed = (fmv >> 1) & 1; - const clbArmed = (fmv >> 2) & 1; - const desArmed = (fmv >> 3) & 1; - const gsArmed = (fmv >> 4) & 1; - const finalArmed = (fmv >> 5) & 1; - - let text1: string; - let color1 = 'Cyan'; - if (clbArmed) { - text1 = ' CLB'; // spaces added to center armed FMA as per newer DMC stnadards - } else if (desArmed) { - text1 = 'DES'; - } else if (altCstArmed) { - text1 = 'ALT'; - color1 = 'Magenta'; - } else if (altArmed) { - text1 = 'ALT'; - } else { - text1 = ''; - } - - let text2; - if (gsArmed) { - text2 = 'G/S'; - } else if (finalArmed) { - text2 = 'FINAL'; - } else { - text2 = ''; - } + .handle((word) => { + this.fmgcDiscreteWord3 = word; + this.handleMessage(); + }); - this.text1Sub.set(text1); - this.text2Sub.set(text2); - this.classSub.set(`FontMediumSmaller MiddleAlign ${color1}`); + sub + .on('fmgcFmAltitudeConstraint') + .whenChanged() + .handle((word) => { + this.altConstraint = word; + this.handleMessage(); }); } @@ -1157,23 +1157,11 @@ class C1Cell extends ShowForSecondsComponent { private readonly activeLateralMode = ConsumerSubject.create(this.sub.on('activeLateralMode'), LateralMode.NONE); - private readonly activeVerticalMode = ConsumerSubject.create(this.sub.on('activeVerticalMode'), VerticalMode.NONE); - - private readonly armedVerticalMode = ConsumerSubject.create(this.sub.on('fmaVerticalArmed'), VerticalMode.NONE); + private fmgcDiscreteWord1 = new Arinc429Word(0); - /** - * Whether LOC backbeam mode mode is selected. - * @todo Get this state from the FG. - */ - private readonly backbeam = ConsumerSubject.create(this.sub.on('fm1Backbeam'), false); + private fmgcDiscreteWord2 = new Arinc429Word(0); - private readonly text = MappedSubject.create( - this.mapText.bind(this), - this.activeLateralMode, - this.activeVerticalMode, - this.armedVerticalMode, - this.backbeam, - ); + private fmgcDiscreteWord3 = new Arinc429Word(0); constructor(props: CellProps) { super(props, 10); @@ -1182,73 +1170,96 @@ class C1Cell extends ShowForSecondsComponent { onAfterRender(node: VNode): void { super.onAfterRender(node); - this.text.sub((v) => { - this.isShown = v.length > 0; - this.displayModeChangedPath(!this.isShown); - }); + const sub = this.props.bus.getSubscriber(); + + sub + .on('fmgcDiscreteWord1') + .whenChanged() + .handle((word) => { + this.fmgcDiscreteWord1 = word; + + this.updateText(); + }); + + sub + .on('fmgcDiscreteWord2') + .whenChanged() + .handle((word) => { + this.fmgcDiscreteWord2 = word; + + this.updateText(); + }); + + sub + .on('fmgcDiscreteWord3') + .whenChanged() + .handle((word) => { + this.fmgcDiscreteWord3 = word; + + this.updateText(); + }); } - private mapText([activeLateralMode, activeVerticalMode, armedVerticalMode, backbeam]: [ - LateralMode, - VerticalMode, - VerticalMode, - boolean, - ]): string { - const finalArmed = (armedVerticalMode >> 5) & 1; + private updateText(): void { + const rollGaActive = this.fmgcDiscreteWord2.getBitValueOr(15, false); + const backbeamMode = this.fmgcDiscreteWord3.getBitValueOr(19, false); + const locCaptActive = this.fmgcDiscreteWord2.getBitValueOr(13, false); + const locTrackActive = this.fmgcDiscreteWord2.getBitValueOr(14, false); + const headingActive = this.fmgcDiscreteWord2.getBitValueOr(16, false); + const runwayActive = this.fmgcDiscreteWord2.getBitValueOr(11, false); + const runwayLocSubmodeActive = this.fmgcDiscreteWord2.getBitValueOr(20, false); + const runwayTrackSubmodeActive = this.fmgcDiscreteWord2.getBitValueOr(23, false); + const trackActive = this.fmgcDiscreteWord2.getBitValueOr(17, false); + const navActive = this.fmgcDiscreteWord2.getBitValueOr(12, false); + const finalDesArmed = this.fmgcDiscreteWord3.getBitValueOr(23, false); + const finalDesActive = this.fmgcDiscreteWord1.getBitValueOr(23, false); - if (activeLateralMode === LateralMode.GA_TRACK) { - return 'GA TRK'; - } - if (activeLateralMode === LateralMode.LOC_CPT) { - return backbeam ? 'LOC B/C*' : 'LOC *'; - } - if (activeLateralMode === LateralMode.HDG) { - return 'HDG'; - } - if (activeLateralMode === LateralMode.RWY) { - return 'RWY'; - } - if (activeLateralMode === LateralMode.RWY_TRACK) { - return 'RWY TRK'; - } - if (activeLateralMode === LateralMode.TRACK) { - return 'TRACK'; - } - if (activeLateralMode === LateralMode.LOC_TRACK) { - return backbeam ? 'LOC B/C' : 'LOC'; + let text: string; + this.isShown = true; + if (rollGaActive) { + text = 'GA TRK'; + } else if (locCaptActive && backbeamMode) { + text = 'LOC B/C*'; + } else if (locCaptActive && !backbeamMode) { + text = 'LOC *'; + } else if (false) { + text = 'F-LOC *'; + } else if (headingActive) { + text = 'HDG'; + } else if (runwayActive && runwayLocSubmodeActive) { + text = 'RWY'; + } else if (runwayActive && runwayTrackSubmodeActive) { + text = 'RWY TRK'; + } else if (trackActive) { + text = 'TRACK'; + } else if (locTrackActive && backbeamMode) { + text = 'LOC B/C'; + } else if (locTrackActive && !backbeamMode) { + text = 'LOC'; + } else if (false) { + text = 'F-LOC'; + } else if (navActive && !finalDesActive && finalDesArmed) { + text = 'APP NAV'; + } else if (navActive && !finalDesActive && !finalDesArmed) { + text = 'NAV'; + } else { + text = ''; + this.isShown = false; } - if (activeLateralMode === LateralMode.NAV && !finalArmed && activeVerticalMode !== VerticalMode.FINAL) { - return 'NAV'; + + const hasChanged = text.length > 0 && text !== this.textSub.get(); + + if (hasChanged || text.length === 0) { + this.textSub.set(text); } - if (activeLateralMode === LateralMode.NAV && finalArmed && activeVerticalMode !== VerticalMode.FINAL) { - return 'APP NAV'; + if (hasChanged) { + this.displayModeChangedPath(); + } else if (!this.isShown) { + this.displayModeChangedPath(true); } - - return ''; } render(): VNode { - // case 2: - // text = 'LOC B/C*'; - // id = 2; - // break; - // case 4: - // text = 'F-LOC*'; - // id = 4; - // break; - // case 9: - // text = 'LOC B/C'; - // id = 9; - // break; - // case 11: - // text = 'F-LOC'; - // id = 11; - // break; - // case 12: - // text = 'APP NAV'; - // id = 12; - // break; - return ( { } class C2Cell extends DisplayComponent { - private readonly sub = this.props.bus.getSubscriber(); - - private readonly fmaLateralArmed = ConsumerSubject.create(this.sub.on('fmaLateralArmed'), LateralMode.NONE); + private fmgcDiscreteWord1 = new Arinc429Word(0); - private readonly fmaVerticalArmed = ConsumerSubject.create(this.sub.on('fmaVerticalArmed'), LateralMode.NONE); + private fmgcDiscreteWord3 = new Arinc429Word(0); - private readonly activeVerticalMode = ConsumerSubject.create(this.sub.on('activeVerticalMode'), LateralMode.NONE); + private textSub = Subject.create(''); - /** - * Whether LOC backbeam mode mode is selected. - * @todo Get this state from the FG. - */ - private readonly backbeam = ConsumerSubject.create(this.sub.on('fm1Backbeam'), false); + private getText() { + const navArmed = this.fmgcDiscreteWord3.getBitValueOr(14, false); + const locArmed = this.fmgcDiscreteWord3.getBitValueOr(16, false); + const backbeamMode = this.fmgcDiscreteWord3.getBitValueOr(19, false); - private text = MappedSubject.create( - this.mapText.bind(this), - this.fmaLateralArmed, - this.fmaVerticalArmed, - this.activeVerticalMode, - this.backbeam, - ); + const finalArmed = this.fmgcDiscreteWord3.getBitValueOr(23, false); + const finalActive = this.fmgcDiscreteWord1.getBitValueOr(23, false); - private mapText([lateralArmed, verticalArmed, verticalActive, backbeam]: [ - LateralMode, - VerticalMode, - VerticalMode, - boolean, - ]): string { - const navArmed = isArmed(lateralArmed, ArmedLateralMode.NAV); - const locArmed = isArmed(lateralArmed, ArmedLateralMode.LOC); - - const finalArmed = isArmed(verticalArmed, ArmedVerticalMode.FINAL); - - if (locArmed) { - return backbeam ? 'LOC B/C' : 'LOC'; - // case 3: - // text = 'F-LOC'; - // break; - } else if (navArmed && (finalArmed || verticalActive === VerticalMode.FINAL)) { - return 'APP NAV'; + let text: string = ''; + if (locArmed && backbeamMode) { + text = 'LOC B/C'; + } else if (locArmed && !backbeamMode) { + text = 'LOC'; + } else if (false) { + text = 'F-LOC'; + } else if (navArmed && (finalArmed || finalActive)) { + text = 'APP NAV'; } else if (navArmed) { return 'NAV'; } - return ''; + this.textSub.set(text); + } + + onAfterRender(node: VNode): void { + super.onAfterRender(node); + + const sub = this.props.bus.getSubscriber(); + + sub + .on('fmgcDiscreteWord1') + .whenChanged() + .handle((word) => { + this.fmgcDiscreteWord1 = word; + this.getText(); + }); + + sub + .on('fmgcDiscreteWord3') + .whenChanged() + .handle((word) => { + this.fmgcDiscreteWord3 = word; + this.getText(); + }); } render(): VNode { @@ -1322,9 +1338,11 @@ class C2Cell extends DisplayComponent { } class BC1Cell extends ShowForSecondsComponent { - private lastLateralMode = 0; + private fmgcDiscreteWord1 = new Arinc429Word(0); - private lastVerticalMode = 0; + private fmgcDiscreteWord2 = new Arinc429Word(0); + + private fmgcDiscreteWord4 = new Arinc429Word(0); private textSub = Subject.create(''); @@ -1333,46 +1351,66 @@ class BC1Cell extends ShowForSecondsComponent { } private setText() { + const rollOutActive = this.fmgcDiscreteWord2.getBitValueOr(26, false); + const flareActive = this.fmgcDiscreteWord2.getBitValueOr(25, false); + const landActive = this.fmgcDiscreteWord4.getBitValueOr(14, false) && !flareActive && !rollOutActive; + + const navActive = this.fmgcDiscreteWord2.getBitValueOr(12, false); + const finalActive = this.fmgcDiscreteWord1.getBitValueOr(23, false); + let text: string; this.isShown = true; - if (this.lastVerticalMode === VerticalMode.ROLL_OUT) { + if (rollOutActive) { text = 'ROLL OUT'; - } else if (this.lastVerticalMode === VerticalMode.FLARE) { + } else if (flareActive) { text = 'FLARE'; - } else if (this.lastVerticalMode === VerticalMode.LAND) { + } else if (landActive) { text = 'LAND'; - } else if (this.lastVerticalMode === VerticalMode.FINAL && this.lastLateralMode === LateralMode.NAV) { + } else if (navActive && finalActive) { text = 'FINAL APP'; } else { text = ''; + this.isShown = false; + } + + const hasChanged = text.length > 0 && text !== this.textSub.get(); + + if (hasChanged || text.length === 0) { + this.textSub.set(text); } - if (text !== '') { + if (hasChanged) { this.displayModeChangedPath(); - } else { - this.isShown = false; + } else if (!this.isShown) { this.displayModeChangedPath(true); } - this.textSub.set(text); } onAfterRender(node: VNode): void { super.onAfterRender(node); - const sub = this.props.bus.getSubscriber(); + const sub = this.props.bus.getSubscriber(); sub - .on('activeVerticalMode') + .on('fmgcDiscreteWord1') .whenChanged() - .handle((v) => { - this.lastVerticalMode = v; + .handle((word) => { + this.fmgcDiscreteWord1 = word; this.setText(); }); sub - .on('activeLateralMode') + .on('fmgcDiscreteWord2') .whenChanged() - .handle((l) => { - this.lastLateralMode = l; + .handle((word) => { + this.fmgcDiscreteWord2 = word; + this.setText(); + }); + + sub + .on('fmgcDiscreteWord4') + .whenChanged() + .handle((word) => { + this.fmgcDiscreteWord4 = word; this.setText(); }); } @@ -1396,7 +1434,7 @@ class BC1Cell extends ShowForSecondsComponent { const getBC3Message = ( isAttExcessive: boolean, - armedVerticalMode: number, + TCASArmed: boolean, setHoldSpeed: boolean, trkFpaDeselectedTCAS: boolean, tcasRaInhibited: boolean, @@ -1405,9 +1443,6 @@ const getBC3Message = ( tdReached: boolean, checkSpeedMode: boolean, ) => { - const armedVerticalBitmask = armedVerticalMode; - const TCASArmed = (armedVerticalBitmask >> 6) & 1; - const flightPhaseForWarning = fwcFlightPhase >= 2 && fwcFlightPhase <= 9 && fwcFlightPhase !== 4 && fwcFlightPhase !== 5; @@ -1483,7 +1518,7 @@ class BC3Cell extends DisplayComponent<{ isAttExcessive: Subscribable; private isAttExcessive = false; - private armedVerticalMode = 0; + private tcasArmed = false; private setHoldSpeed = false; @@ -1502,7 +1537,7 @@ class BC3Cell extends DisplayComponent<{ isAttExcessive: Subscribable; private fillBC3Cell() { const [text, className] = getBC3Message( this.isAttExcessive, - this.armedVerticalMode, + this.tcasArmed, this.setHoldSpeed, this.trkFpaDeselected, this.tcasRaInhibited, @@ -1522,7 +1557,7 @@ class BC3Cell extends DisplayComponent<{ isAttExcessive: Subscribable; onAfterRender(node: VNode): void { super.onAfterRender(node); - const sub = this.props.bus.getSubscriber(); + const sub = this.props.bus.getSubscriber(); this.props.isAttExcessive.sub((e) => { this.isAttExcessive = e; @@ -1530,10 +1565,10 @@ class BC3Cell extends DisplayComponent<{ isAttExcessive: Subscribable; }); sub - .on('fmaVerticalArmed') + .on('fmgcDiscreteWord7') .whenChanged() - .handle((v) => { - this.armedVerticalMode = v; + .handle((word) => { + this.tcasArmed = word.getBitValueOr(12, false); this.fillBC3Cell(); }); @@ -1545,22 +1580,6 @@ class BC3Cell extends DisplayComponent<{ isAttExcessive: Subscribable; this.fillBC3Cell(); }); - sub - .on('tcasRaInhibited') - .whenChanged() - .handle((tra) => { - this.tcasRaInhibited = tra; - this.fillBC3Cell(); - }); - - sub - .on('trkFpaDeselectedTCAS') - .whenChanged() - .handle((trk) => { - this.trkFpaDeselected = trk; - this.fillBC3Cell(); - }); - sub .on('fcdcDiscreteWord1') .atFrequency(1) @@ -1599,6 +1618,10 @@ class BC3Cell extends DisplayComponent<{ isAttExcessive: Subscribable; } class D1D2Cell extends ShowForSecondsComponent { + private fmgcDiscreteWord4 = new Arinc429Word(0); + + private fmgcDiscreteWord3 = new Arinc429Word(0); + private text1Sub = Subject.create(''); private text2Sub = Subject.create(''); @@ -1607,66 +1630,83 @@ class D1D2Cell extends ShowForSecondsComponent { super(props, 9); } + private setText() { + const landModeArmed = this.fmgcDiscreteWord3.getBitValueOr(20, false); + const landModeActive = this.fmgcDiscreteWord4.getBitValueOr(14, false); + const land2Capacity = this.fmgcDiscreteWord4.getBitValueOr(23, false); + const land3FailPassiveCapacity = this.fmgcDiscreteWord4.getBitValueOr(24, false); + const land3FailOperationalCapacity = this.fmgcDiscreteWord4.getBitValueOr(25, false); + + let text1: string; + let text2: string | undefined; + this.isShown = true; + if (land2Capacity) { + text1 = 'CAT 2'; + text2 = ''; + } else if (land3FailPassiveCapacity) { + text1 = 'CAT 3'; + text2 = 'SINGLE'; + } else if (land3FailOperationalCapacity) { + text1 = 'CAT 3'; + text2 = 'DUAL'; + } else if (landModeArmed || landModeActive) { + text1 = 'CAT 1'; + text2 = ''; + } else if (false) { + text1 = 'AUTO'; + text2 = 'LAND'; + } else if (false) { + text1 = 'F-APP'; + } else if (false) { + text1 = 'F-APP'; + text2 = '+ RAW'; + } else if (false) { + text1 = 'RAW'; + text2 = 'ONLY'; + } else { + text1 = ''; + text2 = ''; + this.isShown = false; + } + + const hasChanged = text1 !== this.text1Sub.get() || text2 !== this.text2Sub.get(); + + if (hasChanged) { + this.displayModeChangedPath(); + + this.text1Sub.set(text1); + this.text2Sub.set(text2); + + if (text2 !== '') { + this.modeChangedPathRef.instance.setAttribute('d', 'm104.1 1.8143h27.994v13.506h-27.994z'); + } else { + this.modeChangedPathRef.instance.setAttribute('d', 'm104.1 1.8143h27.994v6.0476h-27.994z'); + } + } + if (!this.isShown) { + this.displayModeChangedPath(true); + } + } + onAfterRender(node: VNode): void { super.onAfterRender(node); - const sub = this.props.bus.getSubscriber(); + const sub = this.props.bus.getSubscriber(); sub - .on('approachCapability') + .on('fmgcDiscreteWord4') .whenChanged() .handle((c) => { - let text1: string; - let text2: string | undefined; - - this.isShown = true; - switch (c) { - case 1: - text1 = 'CAT1'; - break; - case 2: - text1 = 'CAT2'; - break; - case 3: - text1 = 'CAT3'; - text2 = 'SINGLE'; - break; - case 4: - text1 = 'CAT3'; - text2 = 'DUAL'; - break; - case 5: - text1 = 'AUTO'; - text2 = 'LAND'; - break; - case 6: - text1 = 'F-APP'; - break; - case 7: - text1 = 'F-APP'; - text2 = '+ RAW'; - break; - case 8: - text1 = 'RAW'; - text2 = 'ONLY'; - break; - default: - text1 = ''; - } - - this.text1Sub.set(text1); + this.fmgcDiscreteWord4 = c; + this.setText(); + }); - if (text2) { - this.text2Sub.set(text2); - this.modeChangedPathRef.instance.setAttribute('d', 'm104.1 1.8143h27.994v13.506h-27.994z'); - } else { - this.text2Sub.set(''); - this.modeChangedPathRef.instance.setAttribute('d', 'm104.1 1.8143h27.994v6.0476h-27.994z'); - } - if (text1.length === 0 && !text2) { - this.isShown = false; - } - this.displayModeChangedPath(); + sub + .on('fmgcDiscreteWord3') + .whenChanged() + .handle((c) => { + this.fmgcDiscreteWord3 = c; + this.setText(); }); } @@ -1777,9 +1817,9 @@ class D3Cell extends DisplayComponent<{ bus: ArincEventBus }> { } class E1Cell extends ShowForSecondsComponent { - private ap1Active = false; + private fmgc1DiscreteWord4 = new Arinc429Word(0); - private ap2Active = false; + private fmgc2DiscreteWord4 = new Arinc429Word(0); private textSub = Subject.create(''); @@ -1788,42 +1828,52 @@ class E1Cell extends ShowForSecondsComponent { } private setText() { + const ap1Engaged = this.fmgc1DiscreteWord4.getBitValueOr(12, false); + const ap2Engaged = this.fmgc2DiscreteWord4.getBitValueOr(12, false); + let text: string; this.isShown = true; - if (this.ap1Active && !this.ap2Active) { + if (ap1Engaged && ap2Engaged) { + text = 'AP1+2'; + } else if (ap1Engaged) { text = 'AP1'; - } else if (this.ap2Active && !this.ap1Active) { + } else if (ap2Engaged) { text = 'AP2'; - } else if (!this.ap2Active && !this.ap1Active) { + } else { text = ''; this.isShown = false; - } else { - text = 'AP1+2'; } - this.displayModeChangedPath(); - this.textSub.set(text); + + const hasChanged = text.length > 0 && text !== this.textSub.get(); + + if (hasChanged || text.length === 0) { + this.textSub.set(text); + } + if (hasChanged) { + this.displayModeChangedPath(); + } else if (!this.isShown) { + this.displayModeChangedPath(true); + } } onAfterRender(node: VNode): void { super.onAfterRender(node); - const sub = this.props.bus.getSubscriber(); + const sub = this.props.bus.getSubscriber(); sub - .on('ap1Active') + .on('fmgc1DiscreteWord4') .whenChanged() .handle((ap) => { - this.ap1Active = ap; - this.displayModeChangedPath(); + this.fmgc1DiscreteWord4 = ap; this.setText(); }); sub - .on('ap2Active') + .on('fmgc2DiscreteWord4') .whenChanged() .handle((ap) => { - this.ap2Active = ap; - this.displayModeChangedPath(); + this.fmgc2DiscreteWord4 = ap; this.setText(); }); } @@ -1846,13 +1896,11 @@ class E1Cell extends ShowForSecondsComponent { } class E2Cell extends ShowForSecondsComponent { - private fd1Active = false; + private fmgc1DiscreteWord4 = new Arinc429Word(0); - private fd2Active = false; + private fmgc2DiscreteWord4 = new Arinc429Word(0); - private ap1Active = false; - - private ap2Active = false; + private fcuDiscreteWord2 = new Arinc429Word(0); private textSub = Subject.create(''); @@ -1861,60 +1909,83 @@ class E2Cell extends ShowForSecondsComponent { } private getText() { + const ap1Engaged = this.fmgc1DiscreteWord4.getBitValueOr(12, false); + const ap2Engaged = this.fmgc2DiscreteWord4.getBitValueOr(12, false); + + const fd1Engaged = this.fmgc1DiscreteWord4.getBitValueOr(13, false); + const fd2Engaged = this.fmgc2DiscreteWord4.getBitValueOr(13, false); + + const fdLeftOff = this.fcuDiscreteWord2.getBitValueOr(26, false); + const fdRightOff = this.fcuDiscreteWord2.getBitValueOr(27, false); + + const fd1EngagedOnLeft = !fdLeftOff && fd1Engaged; + const fd2EngagedOnRight = !fdRightOff && fd2Engaged; + const fd1EngagedOnRight = !fdRightOff && fd1Engaged; + const fd2EngagedOnLeft = !fdLeftOff && fd2Engaged; + + const anyFdOrApEngaged = ap1Engaged || ap2Engaged || fd1Engaged || fd2Engaged; + + let text: string; this.isShown = true; - if (!this.ap1Active && !this.ap2Active && !this.fd1Active && !this.fd2Active) { + if (!anyFdOrApEngaged) { this.isShown = false; - this.textSub.set(''); + text = ''; + } else if (fd1EngagedOnLeft && fd2EngagedOnRight) { + text = '1 FD 2'; + } else if (fd1EngagedOnLeft && fd1EngagedOnRight) { + text = '1 FD 1'; + } else if (fd2EngagedOnLeft && fd2EngagedOnRight) { + text = '2 FD 2'; + } else if (fd1EngagedOnLeft) { + text = '1 FD -'; + } else if (fd1EngagedOnRight) { + text = '- FD 1'; + } else if (fd2EngagedOnRight) { + text = '- FD 2'; + } else if (fd2EngagedOnLeft) { + text = '2 FD -'; } else { - const text = `${this.fd1Active ? '1' : '-'} FD ${this.fd2Active ? '2' : '-'}`; + text = '- FD -'; + } + + const hasChanged = text.length > 0 && text !== this.textSub.get(); + + if (hasChanged || text.length === 0) { this.textSub.set(text); } + if (hasChanged) { + this.displayModeChangedPath(); + } else if (!this.isShown) { + this.displayModeChangedPath(true); + } } onAfterRender(node: VNode): void { super.onAfterRender(node); - const sub = this.props.bus.getSubscriber(); + const sub = this.props.bus.getSubscriber(); sub - .on('fd1Active') + .on('fmgc1DiscreteWord4') .whenChanged() .handle((fd) => { - this.fd1Active = fd; - if (fd || this.fd2Active) { - this.displayModeChangedPath(); - } else { - this.displayModeChangedPath(true); - } + this.fmgc1DiscreteWord4 = fd; this.getText(); }); sub - .on('ap1Active') + .on('fmgc2DiscreteWord4') .whenChanged() .handle((fd) => { - this.ap1Active = fd; + this.fmgc2DiscreteWord4 = fd; this.getText(); }); sub - .on('ap2Active') + .on('fcuDiscreteWord2') .whenChanged() .handle((fd) => { - this.ap2Active = fd; - this.getText(); - }); - - sub - .on('fd2Active') - .whenChanged() - .handle((fd) => { - this.fd2Active = fd; - if (fd || this.fd1Active) { - this.displayModeChangedPath(); - } else { - this.displayModeChangedPath(true); - } + this.fcuDiscreteWord2 = fd; this.getText(); }); } @@ -1945,19 +2016,16 @@ class E3Cell extends ShowForSecondsComponent { super(props, 9); } - private getClass(athrStatus: number): string { + private getClass(atEngaged: boolean, atActive: boolean): string { let className: string = ''; this.isShown = true; - switch (athrStatus) { - case 1: - className = 'Cyan FontSmall'; - break; - case 2: - className = 'White FontMedium'; - break; - default: - this.isShown = false; - className = 'HiddenElement'; + if (atEngaged && atActive) { + className = 'White FontMedium'; + } else if (atEngaged) { + className = 'Cyan FontSmall'; + } else { + this.isShown = false; + className = 'HiddenElement'; } return className; } @@ -1965,14 +2033,17 @@ class E3Cell extends ShowForSecondsComponent { onAfterRender(node: VNode): void { super.onAfterRender(node); - const sub = this.props.bus.getSubscriber(); + const sub = this.props.bus.getSubscriber(); sub - .on('athrStatus') + .on('fcuAtsDiscreteWord') .whenChanged() .handle((a) => { - const className = this.getClass(a); - this.posSub.set(a === 1 ? 21.253048 : 21.753487); + const atEngaged = a.getBitValueOr(13, false); + const atActive = a.getBitValueOr(14, false); + + const className = this.getClass(atEngaged, atActive); + this.posSub.set(!atActive ? 21.253048 : 21.753487); this.classSub.set(`MiddleAlign ${className}`); if (className !== 'HiddenElement') { this.displayModeChangedPath(); diff --git a/fbw-a32nx/src/systems/instruments/src/PFD/FlightPathDirector.tsx b/fbw-a32nx/src/systems/instruments/src/PFD/FlightPathDirector.tsx index 4ff11e8100ad..77be3191558d 100644 --- a/fbw-a32nx/src/systems/instruments/src/PFD/FlightPathDirector.tsx +++ b/fbw-a32nx/src/systems/instruments/src/PFD/FlightPathDirector.tsx @@ -4,8 +4,9 @@ import { ClockEvents, DisplayComponent, FSComponent, Subscribable, VNode } from '@microsoft/msfs-sdk'; import { ArincEventBus, Arinc429Word, Arinc429WordData } from '@flybywiresim/fbw-sdk'; +import { FcuBus } from 'instruments/src/PFD/shared/FcuBusProvider'; +import { FgBus } from 'instruments/src/PFD/shared/FgBusProvider'; -import { getDisplayIndex } from './PFD'; import { calculateHorizonOffsetFromPitch } from './PFDUtils'; import { Arinc429Values } from './shared/ArincValueProvider'; import { PFDSimvars } from './shared/PFDSimvarPublisher'; @@ -18,11 +19,10 @@ interface FlightPathVectorData { pitch: Arinc429WordData; fpa: Arinc429WordData; da: Arinc429WordData; - activeVerticalMode: number; - activeLateralMode: number; - fdRoll: number; - fdPitch: number; - fdActive: boolean; + rollFdCommand: Arinc429WordData; + pitchFdCommand: Arinc429WordData; + fdEngaged: boolean; + fdOff: boolean; } export class FlightPathDirector extends DisplayComponent<{ @@ -34,14 +34,13 @@ export class FlightPathDirector extends DisplayComponent<{ pitch: new Arinc429Word(0), fpa: new Arinc429Word(0), da: new Arinc429Word(0), - fdPitch: 0, - fdRoll: 0, - fdActive: true, - activeLateralMode: 0, - activeVerticalMode: 0, + rollFdCommand: new Arinc429Word(0), + pitchFdCommand: new Arinc429Word(0), + fdEngaged: false, + fdOff: false, }; - private isTrkFpaActive = false; + private fcuDiscreteWord1 = new Arinc429Word(0); private needsUpdate = false; @@ -54,32 +53,29 @@ export class FlightPathDirector extends DisplayComponent<{ onAfterRender(node: VNode): void { super.onAfterRender(node); - const sub = this.props.bus.getSubscriber(); + const sub = this.props.bus.getSubscriber(); sub - .on('fd1Active') + .on('fdEngaged') .whenChanged() .handle((fd) => { - if (getDisplayIndex() === 1) { - this.data.fdActive = fd; - this.needsUpdate = true; - } + this.data.fdEngaged = fd; + this.needsUpdate = true; }); sub - .on('fd2Active') + .on('fcuDiscreteWord1') .whenChanged() - .handle((fd) => { - if (getDisplayIndex() === 2) { - this.data.fdActive = fd; - this.needsUpdate = true; - } + .handle((a) => { + this.fcuDiscreteWord1 = a; + this.needsUpdate = true; }); + sub - .on('trkFpaActive') + .on('fcuEisDiscreteWord2') .whenChanged() - .handle((a) => { - this.isTrkFpaActive = a; + .handle((tr) => { + this.data.fdOff = tr.getBitValueOr(23, false); this.needsUpdate = true; }); @@ -93,29 +89,13 @@ export class FlightPathDirector extends DisplayComponent<{ this.needsUpdate = true; }); - sub - .on('activeVerticalMode') - .whenChanged() - .handle((vm) => { - this.data.activeLateralMode = vm; - this.needsUpdate = true; - }); - - sub - .on('activeLateralMode') - .whenChanged() - .handle((lm) => { - this.data.activeLateralMode = lm; - this.needsUpdate = true; - }); - - sub.on('fdPitch').handle((fdp) => { - this.data.fdPitch = fdp; + sub.on('rollFdCommand').handle((fdp) => { + this.data.rollFdCommand = fdp; this.needsUpdate = true; }); - sub.on('fdBank').handle((fdr) => { - this.data.fdRoll = fdr; + sub.on('rollFdCommand').handle((fdr) => { + this.data.pitchFdCommand = fdr; this.needsUpdate = true; }); @@ -142,16 +122,18 @@ export class FlightPathDirector extends DisplayComponent<{ } private handlePath() { - const showLateralFD = - this.data.activeLateralMode !== 0 && this.data.activeLateralMode !== 34 && this.data.activeLateralMode !== 40; - const showVerticalFD = this.data.activeVerticalMode !== 0 && this.data.activeVerticalMode !== 34; + const rollFdInvalid = this.data.rollFdCommand.isFailureWarning() || this.data.rollFdCommand.isNoComputedData(); + const pitchFdInvalid = this.data.pitchFdCommand.isFailureWarning() || this.data.pitchFdCommand.isNoComputedData(); const daAndFpaValid = this.data.fpa.isNormalOperation() && this.data.da.isNormalOperation(); + const trkFpaActive = this.fcuDiscreteWord1.getBitValueOr(25, false); if ( - (!showVerticalFD && !showLateralFD) || - !this.isTrkFpaActive || - !this.data.fdActive || + rollFdInvalid || + pitchFdInvalid || !daAndFpaValid || + !this.data.fdEngaged || + !trkFpaActive || + this.data.fdOff || this.props.isAttExcessive.get() ) { this.birdPath.instance.style.visibility = 'hidden'; @@ -163,10 +145,10 @@ export class FlightPathDirector extends DisplayComponent<{ } private moveBird() { - if (this.data.fdActive && this.isTrkFpaActive) { - const FDRollOrder = this.data.fdRoll; + if (this.isVisible) { + const FDRollOrder = this.data.rollFdCommand.value; const FDRollOrderLim = Math.max(Math.min(FDRollOrder, 45), -45); - const FDPitchOrder = this.data.fdPitch; + const FDPitchOrder = this.data.pitchFdCommand.value; const FDPitchOrderLim = Math.max(Math.min(FDPitchOrder, 22.5), -22.5) * 1.9; const daLimConv = (Math.max(Math.min(this.data.da.value, 21), -21) * DistanceSpacing) / ValueSpacing; diff --git a/fbw-a32nx/src/systems/instruments/src/PFD/FlightPathVector.tsx b/fbw-a32nx/src/systems/instruments/src/PFD/FlightPathVector.tsx index ae4cbe3f63f5..cc5b777508fa 100644 --- a/fbw-a32nx/src/systems/instruments/src/PFD/FlightPathVector.tsx +++ b/fbw-a32nx/src/systems/instruments/src/PFD/FlightPathVector.tsx @@ -4,6 +4,7 @@ import { ClockEvents, DisplayComponent, FSComponent, VNode } from '@microsoft/msfs-sdk'; import { ArincEventBus, Arinc429Word, Arinc429WordData } from '@flybywiresim/fbw-sdk'; +import { FcuBus } from 'instruments/src/PFD/shared/FcuBusProvider'; import { calculateHorizonOffsetFromPitch } from './PFDUtils'; import { Arinc429Values } from './shared/ArincValueProvider'; @@ -24,7 +25,7 @@ export class FlightPathVector extends DisplayComponent<{ bus: ArincEventBus }> { private fpvFlag = FSComponent.createRef(); - private isTrkFpaActive = false; + private fcuDiscreteWord1 = new Arinc429Word(0); private data: FlightPathVectorData = { roll: new Arinc429Word(0), @@ -38,19 +39,14 @@ export class FlightPathVector extends DisplayComponent<{ bus: ArincEventBus }> { onAfterRender(node: VNode): void { super.onAfterRender(node); - const sub = this.props.bus.getSubscriber(); + const sub = this.props.bus.getSubscriber(); sub - .on('trkFpaActive') + .on('fcuDiscreteWord1') .whenChanged() .handle((a) => { - this.isTrkFpaActive = a; - if (this.isTrkFpaActive) { - this.moveBird(); - this.bird.instance.classList.remove('HiddenElement'); - } else { - this.bird.instance.classList.add('HiddenElement'); - } + this.fcuDiscreteWord1 = a; + this.needsUpdate = true; }); sub.on('fpa').handle((fpa) => { @@ -77,12 +73,16 @@ export class FlightPathVector extends DisplayComponent<{ bus: ArincEventBus }> { if (this.needsUpdate) { this.needsUpdate = false; + const trkFpaActive = this.fcuDiscreteWord1.getBitValueOr(25, false); const daAndFpaValid = this.data.fpa.isNormalOperation() && this.data.da.isNormalOperation(); - if (this.isTrkFpaActive && daAndFpaValid) { + if (trkFpaActive && daAndFpaValid) { this.fpvFlag.instance.style.visibility = 'hidden'; this.bird.instance.classList.remove('HiddenElement'); this.moveBird(); - } else if (this.isTrkFpaActive && this.data.pitch.isNormalOperation() && this.data.roll.isNormalOperation()) { + } else if (!trkFpaActive) { + this.fpvFlag.instance.style.visibility = 'hidden'; + this.bird.instance.classList.add('HiddenElement'); + } else if (trkFpaActive && this.data.pitch.isNormalOperation() && this.data.roll.isNormalOperation()) { this.fpvFlag.instance.style.visibility = 'visible'; this.bird.instance.classList.add('HiddenElement'); } diff --git a/fbw-a32nx/src/systems/instruments/src/PFD/HeadingIndicator.tsx b/fbw-a32nx/src/systems/instruments/src/PFD/HeadingIndicator.tsx index dfa2f33a8d7a..feab4f77d5da 100644 --- a/fbw-a32nx/src/systems/instruments/src/PFD/HeadingIndicator.tsx +++ b/fbw-a32nx/src/systems/instruments/src/PFD/HeadingIndicator.tsx @@ -2,24 +2,15 @@ // // SPDX-License-Identifier: GPL-3.0 -import { - ConsumerSubject, - DisplayComponent, - FSComponent, - HEvent, - MappedSubject, - Subject, - Subscribable, - VNode, -} from '@microsoft/msfs-sdk'; -import { Arinc429ConsumerSubject, ArincEventBus } from '@flybywiresim/fbw-sdk'; +import { DisplayComponent, FSComponent, MappedSubject, Subject, Subscribable, VNode } from '@microsoft/msfs-sdk'; +import { Arinc429ConsumerSubject, Arinc429Word, ArincEventBus } from '@flybywiresim/fbw-sdk'; +import { FcuBus } from 'instruments/src/PFD/shared/FcuBusProvider'; import { DmcLogicEvents } from '../MsfsAvionicsCommon/providers/DmcPublisher'; import { HorizontalTape } from './HorizontalTape'; import { getSmallestAngle } from './PFDUtils'; import { PFDSimvars } from './shared/PFDSimvarPublisher'; import { Arinc429Values } from './shared/ArincValueProvider'; -import { getDisplayIndex } from './PFD'; const DisplayRange = 24; const DistanceSpacing = 7.555; @@ -75,7 +66,7 @@ export class HeadingOfftape extends DisplayComponent<{ bus: ArincEventBus; faile onAfterRender(node: VNode): void { super.onAfterRender(node); - const sub = this.props.bus.getArincSubscriber(); + const sub = this.props.bus.getArincSubscriber(); sub .on('heading') @@ -99,7 +90,12 @@ export class HeadingOfftape extends DisplayComponent<{ bus: ArincEventBus; faile this.ILSCourse.set(n); }); - this.lsPressed.setConsumer(sub.on(getDisplayIndex() === 1 ? 'ls1Button' : 'ls2Button')); + sub + .on('fcuEisDiscreteWord2') + .whenChanged() + .handle((word) => { + this.lsPressed.set(word.getBitValueOr(22, false) || word.isFailureWarning()); + }); } render(): VNode { @@ -131,9 +127,13 @@ interface SelectedHeadingProps { } class SelectedHeading extends DisplayComponent { - private selectedHeading = NaN; + private selectedHeading = new Arinc429Word(0); + + private selectedTrack = new Arinc429Word(0); - private showSelectedHeading = 0; + private fcuDiscreteWord1 = new Arinc429Word(0); + + private heading = 0; private targetIndicator = FSComponent.createRef(); @@ -146,48 +146,53 @@ class SelectedHeading extends DisplayComponent { onAfterRender(node: VNode): void { super.onAfterRender(node); - const sub = this.props.bus.getSubscriber(); + const sub = this.props.bus.getSubscriber(); sub - .on('selectedHeading') + .on('fcuSelectedHeading') .whenChanged() .handle((h) => { - if (this.showSelectedHeading === 1) { - this.selectedHeading = h; - this.handleDelta(this.props.heading.get(), this.selectedHeading); - } else { - this.selectedHeading = NaN; - } + this.selectedHeading = h; + this.handleDelta(); }); sub - .on('showSelectedHeading') + .on('fcuSelectedTrack') .whenChanged() - .handle((sh) => { - this.showSelectedHeading = sh; - if (this.showSelectedHeading === 0) { - this.selectedHeading = NaN; - } - this.handleDelta(this.props.heading.get(), this.selectedHeading); + .handle((t) => { + this.selectedTrack = t; + this.handleDelta(); + }); + + sub + .on('fcuDiscreteWord1') + .whenChanged() + .handle((a) => { + this.fcuDiscreteWord1 = a; + this.handleDelta(); }); this.props.heading.sub((h) => { - this.handleDelta(h, this.selectedHeading); + this.heading = h; + this.handleDelta(); }, true); } - private handleDelta(heading: number, selectedHeading: number) { - const headingDelta = getSmallestAngle(selectedHeading, heading); - - this.text.set(Math.round(selectedHeading).toString().padStart(3, '0')); + private handleDelta() { + const trkFpaActive = this.fcuDiscreteWord1.getBitValueOr(25, false); + const targetValue = trkFpaActive ? this.selectedTrack : this.selectedHeading; - if (Number.isNaN(selectedHeading)) { + if (targetValue.isNoComputedData() || targetValue.isFailureWarning()) { this.headingTextLeft.instance.classList.add('HiddenElement'); this.targetIndicator.instance.classList.add('HiddenElement'); this.headingTextRight.instance.classList.add('HiddenElement'); return; } + const headingDelta = getSmallestAngle(targetValue.value, this.heading); + + this.text.set(Math.round(targetValue.value).toString().padStart(3, '0')); + if (Math.abs(headingDelta) < DisplayRange) { const offset = (headingDelta * DistanceSpacing) / ValueSpacing; diff --git a/fbw-a32nx/src/systems/instruments/src/PFD/LandingSystemIndicator.tsx b/fbw-a32nx/src/systems/instruments/src/PFD/LandingSystemIndicator.tsx index f44bd4b8ddef..76a5fa6433d3 100644 --- a/fbw-a32nx/src/systems/instruments/src/PFD/LandingSystemIndicator.tsx +++ b/fbw-a32nx/src/systems/instruments/src/PFD/LandingSystemIndicator.tsx @@ -8,7 +8,6 @@ import { ConsumerValue, DisplayComponent, FSComponent, - HEvent, MappedSubject, Subject, Subscribable, @@ -19,13 +18,14 @@ import { import { ArincEventBus, Arinc429RegisterSubject, MathUtils } from '@flybywiresim/fbw-sdk'; import { getDisplayIndex } from 'instruments/src/PFD/PFD'; +import { FcuBus } from 'instruments/src/PFD/shared/FcuBusProvider'; import { Arinc429Values } from './shared/ArincValueProvider'; import { PFDSimvars } from './shared/PFDSimvarPublisher'; import { LagFilter } from './PFDUtils'; // FIXME true ref export class LandingSystem extends DisplayComponent<{ bus: ArincEventBus; instrument: BaseInstrument }> { - private readonly lsVisible = ConsumerSubject.create(null, false); + private readonly lsVisible = Subject.create(false); private readonly lsHidden = this.lsVisible.map(SubscribableMapFunctions.not()); @@ -55,17 +55,12 @@ export class LandingSystem extends DisplayComponent<{ bus: ArincEventBus; instru onAfterRender(node: VNode): void { super.onAfterRender(node); - const sub = this.props.bus.getSubscriber(); + const sub = this.props.bus.getSubscriber(); - // FIXME clean this up.. should be handled by an IE in the XML - sub.on('hEvent').handle((eventName) => { - if (eventName === `A320_Neo_PFD_BTN_LS_${getDisplayIndex()}`) { - SimVar.SetSimVarValue(`L:BTN_LS_${getDisplayIndex()}_FILTER_ACTIVE`, 'Bool', !this.lsVisible.get()); - } + sub.on('fcuEisDiscreteWord2').handle((word) => { + this.lsVisible.set(word.getBitValueOr(22, false) || word.isFailureWarning()); }); - this.lsVisible.setConsumer(sub.on(getDisplayIndex() === 1 ? 'ls1Button' : 'ls2Button')); - sub.on('baroCorrectedAltitude').handle((altitude) => { this.altitude2.setWord(altitude); }); diff --git a/fbw-a32nx/src/systems/instruments/src/PFD/SpeedIndicator.tsx b/fbw-a32nx/src/systems/instruments/src/PFD/SpeedIndicator.tsx index 819966718ac9..21e42fc5b8b1 100644 --- a/fbw-a32nx/src/systems/instruments/src/PFD/SpeedIndicator.tsx +++ b/fbw-a32nx/src/systems/instruments/src/PFD/SpeedIndicator.tsx @@ -14,9 +14,10 @@ import { import { ArincEventBus, Arinc429Word, Arinc429WordData } from '@flybywiresim/fbw-sdk'; import { FmsVars } from 'instruments/src/MsfsAvionicsCommon/providers/FmsDataPublisher'; +import { FgBus } from 'instruments/src/PFD/shared/FgBusProvider'; +import { FcuBus } from 'instruments/src/PFD/shared/FcuBusProvider'; import { PFDSimvars } from './shared/PFDSimvarPublisher'; import { VerticalTape } from './VerticalTape'; -import { SimplaneValues } from './shared/SimplaneValueProvider'; import { Arinc429Values } from './shared/ArincValueProvider'; const ValueSpacing = 10; @@ -984,15 +985,15 @@ class V1Offtape extends DisplayComponent<{ bus: ArincEventBus }> { } interface SpeedStateInfo { - targetSpeed: number; - managedTargetSpeed: number; - holdValue: number; - isSpeedManaged: boolean; - isMach: boolean; + pfdTargetSpeed: Arinc429WordData; + fcuSelectedSpeed: Arinc429WordData; speed: Arinc429WordData; + fmgcDiscreteWord5: Arinc429WordData; } class SpeedTarget extends DisplayComponent<{ bus: ArincEventBus }> { + private spdSelFlagRef = FSComponent.createRef(); + private upperBoundRef = FSComponent.createRef(); private lowerBoundRef = FSComponent.createRef(); @@ -1009,69 +1010,47 @@ class SpeedTarget extends DisplayComponent<{ bus: ArincEventBus }> { private speedState: SpeedStateInfo = { speed: new Arinc429Word(0), - targetSpeed: 100, - managedTargetSpeed: 100, - holdValue: 100, - isSpeedManaged: false, - isMach: false, + pfdTargetSpeed: new Arinc429Word(0), + fcuSelectedSpeed: new Arinc429Word(0), + fmgcDiscreteWord5: new Arinc429Word(0), }; - private handleManagedSpeed() { - if (this.speedState.isSpeedManaged) { - this.currentVisible.instance.classList.replace('Cyan', 'Magenta'); - const text = Math.round(this.speedState.managedTargetSpeed).toString().padStart(3, '0'); - this.textSub.set(text); - } else { - this.currentVisible.instance.classList.replace('Magenta', 'Cyan'); - const text = Math.round(this.speedState.managedTargetSpeed).toString().padStart(3, '0'); - this.textSub.set(text); - } - } - onAfterRender(node: VNode): void { super.onAfterRender(node); this.needsUpdate = true; - const sub = this.props.bus.getArincSubscriber(); - - sub - .on('isSelectedSpeed') - .whenChanged() - .handle((s) => { - this.speedState.isSpeedManaged = !s; - this.needsUpdate = true; - }); + const sub = this.props.bus.getArincSubscriber(); sub - .on('speedAr') + .on('pfdSelectedSpeed') .withArinc429Precision(2) .handle((s) => { - this.speedState.speed = s; - + this.speedState.pfdTargetSpeed = s; this.needsUpdate = true; }); sub - .on('holdValue') + .on('fmgcDiscreteWord5') .whenChanged() .handle((s) => { - this.speedState.holdValue = s; + this.speedState.fmgcDiscreteWord5 = s; this.needsUpdate = true; }); sub - .on('machActive') - .whenChanged() + .on('fcuSelectedAirspeed') + .withArinc429Precision(2) .handle((s) => { - this.speedState.isMach = s; + this.speedState.fcuSelectedSpeed = s; this.needsUpdate = true; }); sub - .on('targetSpeedManaged') - .whenChanged() + .on('speedAr') + .withArinc429Precision(2) .handle((s) => { - this.speedState.managedTargetSpeed = s; + this.speedState.speed = s; + this.needsUpdate = true; }); @@ -1090,72 +1069,71 @@ class SpeedTarget extends DisplayComponent<{ bus: ArincEventBus }> { if (this.needsUpdate === true) { this.needsUpdate = false; - this.determineTargetSpeed(); - const inRange = this.handleLowerUpperBound(); - this.handleManagedSpeed(); + const fmgcPfdSelectedSpeedValid = !( + this.speedState.pfdTargetSpeed.isNoComputedData() || this.speedState.pfdTargetSpeed.isFailureWarning() + ); + const isSpeedManaged = + this.speedState.fmgcDiscreteWord5.getBitValueOr(19, false) && + !(this.speedState.fmgcDiscreteWord5.getBitValueOr(20, false) || !fmgcPfdSelectedSpeedValid); + + const chosenTargetSpeed = fmgcPfdSelectedSpeedValid + ? this.speedState.pfdTargetSpeed + : this.speedState.fcuSelectedSpeed; + + const chosenTargetSpeedFailed = chosenTargetSpeed.isFailureWarning(); + + const inRange = this.handleVisibility(chosenTargetSpeed.value, chosenTargetSpeedFailed); + + if (isSpeedManaged) { + this.currentVisible.instance.classList.replace('Cyan', 'Magenta'); + } else { + this.currentVisible.instance.classList.replace('Magenta', 'Cyan'); + } if (inRange) { const multiplier = 100; const currentValueAtPrecision = Math.round(this.speedState.speed.value * multiplier) / multiplier; - const offset = - ((currentValueAtPrecision - - (this.speedState.isSpeedManaged ? this.speedState.managedTargetSpeed : this.speedState.targetSpeed)) * - DistanceSpacing) / - ValueSpacing; + const offset = ((currentValueAtPrecision - chosenTargetSpeed.value) * DistanceSpacing) / ValueSpacing; this.speedTargetRef.instance.style.transform = `translate3d(0px, ${offset}px, 0px)`; } else { - const text = Math.round( - this.speedState.isSpeedManaged ? this.speedState.managedTargetSpeed : this.speedState.targetSpeed, - ) - .toString() - .padStart(3, '0'); + const text = Math.round(chosenTargetSpeed.value).toString().padStart(3, '0'); this.textSub.set(text); } } } - private determineTargetSpeed() { - const isSelected = !this.speedState.isSpeedManaged; - if (isSelected) { - if (this.speedState.isMach) { - const holdValue = this.speedState.holdValue; - this.speedState.targetSpeed = SimVar.GetGameVarValue( - 'FROM MACH TO KIAS', - 'number', - holdValue === null ? undefined : holdValue, - ); - } else { - this.speedState.targetSpeed = this.speedState.holdValue; - } - } - } - - private handleLowerUpperBound(): boolean { + private handleVisibility(currentTargetSpeed: number, spdSelFail: boolean): boolean { let inRange = false; - const currentTargetSpeed = this.speedState.isSpeedManaged - ? this.speedState.managedTargetSpeed - : this.speedState.targetSpeed; - if (this.speedState.speed.value - currentTargetSpeed > DisplayRange) { + if (spdSelFail) { + this.lowerBoundRef.instance.style.visibility = 'hidden'; + this.upperBoundRef.instance.style.visibility = 'hidden'; + this.speedTargetRef.instance.style.visibility = 'hidden'; + this.spdSelFlagRef.instance.style.display = 'block'; + } else if (this.speedState.speed.value - currentTargetSpeed > DisplayRange) { this.upperBoundRef.instance.style.visibility = 'visible'; this.lowerBoundRef.instance.style.visibility = 'hidden'; this.speedTargetRef.instance.style.visibility = 'hidden'; + this.spdSelFlagRef.instance.style.display = 'none'; this.currentVisible = this.upperBoundRef; } else if (this.speedState.speed.value - currentTargetSpeed < -DisplayRange && !this.decelActive) { this.lowerBoundRef.instance.style.visibility = 'visible'; this.upperBoundRef.instance.style.visibility = 'hidden'; this.speedTargetRef.instance.style.visibility = 'hidden'; + this.spdSelFlagRef.instance.style.display = 'none'; this.currentVisible = this.lowerBoundRef; } else if (Math.abs(this.speedState.speed.value - currentTargetSpeed) < DisplayRange) { this.lowerBoundRef.instance.style.visibility = 'hidden'; this.upperBoundRef.instance.style.visibility = 'hidden'; this.speedTargetRef.instance.style.visibility = 'visible'; + this.spdSelFlagRef.instance.style.display = 'none'; this.currentVisible = this.speedTargetRef; inRange = true; } else { this.lowerBoundRef.instance.style.visibility = 'hidden'; this.upperBoundRef.instance.style.visibility = 'hidden'; this.speedTargetRef.instance.style.visibility = 'hidden'; + this.spdSelFlagRef.instance.style.display = 'none'; } return inRange; } @@ -1181,6 +1159,15 @@ class SpeedTarget extends DisplayComponent<{ bus: ArincEventBus }> { > {this.textSub} + + SPD SEL + { private failedRef = FSComponent.createRef(); - private showMach = false; + private machHysteresis = false; private onGround = false; + private mach = new Arinc429Word(0); + + private fcuEisDiscreteWord2 = new Arinc429Word(0); + private leftMainGearCompressed = true; private rightMainGearCompressed = true; + private handleMachDisplay() { + if (this.mach.value > 0.5) { + this.machHysteresis = true; + } else if (this.mach.value < 0.45) { + this.machHysteresis = false; + } + + const stdBaro = this.fcuEisDiscreteWord2.getBitValueOr(28, false) || this.fcuEisDiscreteWord2.isFailureWarning(); + const lsDisplay = this.fcuEisDiscreteWord2.getBitValueOr(22, false) || this.fcuEisDiscreteWord2.isFailureWarning(); + + const hideMachDisplay = + (!this.machHysteresis && this.mach.isNormalOperation()) || + (!this.mach.isNormalOperation() && (this.onGround || stdBaro)) || + lsDisplay; + + if (hideMachDisplay) { + this.failedRef.instance.style.visibility = 'hidden'; + this.machTextSub.set(''); + } else if (!this.mach.isNormalOperation()) { + this.failedRef.instance.style.visibility = 'visible'; + this.machTextSub.set(''); + } else { + this.failedRef.instance.style.visibility = 'hidden'; + const machPermille = Math.round(this.mach.value * 1000); + this.machTextSub.set(`.${machPermille}`); + } + } + onAfterRender(node: VNode): void { super.onAfterRender(node); - const sub = this.props.bus.getSubscriber(); + const sub = this.props.bus.getArincSubscriber(); - sub.on('machAr').handle((mach) => { - if (!mach.isNormalOperation() && !this.onGround) { - this.machTextSub.set(''); - this.failedRef.instance.style.display = 'inline'; - return; - } - this.failedRef.instance.style.display = 'none'; - const machPermille = Math.round(mach.valueOr(0) * 1000); - if (this.showMach && machPermille < 450) { - this.showMach = false; - this.machTextSub.set(''); - } else if (!this.showMach && machPermille > 500) { - this.showMach = true; - } - if (this.showMach) { - this.machTextSub.set(`.${machPermille}`); - } - }); + sub + .on('machAr') + .withArinc429Precision(2) + .handle((mach) => { + this.mach = mach; + this.handleMachDisplay(); + }); sub .on('leftMainGearCompressed') @@ -1316,6 +1324,7 @@ export class MachNumber extends DisplayComponent<{ bus: ArincEventBus }> { .handle((g) => { this.leftMainGearCompressed = g; this.onGround = this.rightMainGearCompressed || g; + this.handleMachDisplay(); }); sub @@ -1324,6 +1333,15 @@ export class MachNumber extends DisplayComponent<{ bus: ArincEventBus }> { .handle((g) => { this.rightMainGearCompressed = g; this.onGround = this.leftMainGearCompressed || g; + this.handleMachDisplay(); + }); + + sub + .on('fcuEisDiscreteWord2') + .whenChanged() + .handle((word) => { + this.fcuEisDiscreteWord2 = word; + this.handleMachDisplay(); }); } diff --git a/fbw-a32nx/src/systems/instruments/src/PFD/instrument.tsx b/fbw-a32nx/src/systems/instruments/src/PFD/instrument.tsx index 98a6f2310ab5..953933884697 100644 --- a/fbw-a32nx/src/systems/instruments/src/PFD/instrument.tsx +++ b/fbw-a32nx/src/systems/instruments/src/PFD/instrument.tsx @@ -8,11 +8,12 @@ import { FwcPublisher, RopRowOansPublisher } from '@flybywiresim/msfs-avionics-c import { FmsDataPublisher } from '../MsfsAvionicsCommon/providers/FmsDataPublisher'; import { DmcPublisher } from '../MsfsAvionicsCommon/providers/DmcPublisher'; +import { FcuBusProvider } from 'instruments/src/PFD/shared/FcuBusProvider'; +import { FgBusProvider } from 'instruments/src/PFD/shared/FgBusProvider'; import { getDisplayIndex, PFDComponent } from './PFD'; import { AdirsValueProvider } from '../MsfsAvionicsCommon/AdirsValueProvider'; import { ArincValueProvider } from './shared/ArincValueProvider'; import { PFDSimvarPublisher, PFDSimvars } from './shared/PFDSimvarPublisher'; -import { SimplaneValueProvider } from './shared/SimplaneValueProvider'; import './style.scss'; @@ -29,7 +30,9 @@ class A32NX_PFD extends BaseInstrument { private readonly arincProvider = new ArincValueProvider(this.bus); - private readonly simplaneValueProvider = new SimplaneValueProvider(this.bus); + private readonly fgBusProvider: FgBusProvider; + + private readonly fcuBusProvider: FcuBusProvider; private readonly clock = new Clock(this.bus); @@ -59,7 +62,8 @@ class A32NX_PFD extends BaseInstrument { this.backplane.addPublisher('PfdSimvars', this.simVarPublisher); this.backplane.addPublisher('hEvent', this.hEventPublisher); this.backplane.addInstrument('arincProvider', this.arincProvider); - this.backplane.addInstrument('simPlane', this.simplaneValueProvider); + this.backplane.addInstrument('fgBusProvider', this.fgBusProvider); + this.backplane.addInstrument('fcuBusProvider', this.fcuBusProvider); this.backplane.addInstrument('Clock', this.clock); this.backplane.addPublisher('Dmc', this.dmcPublisher); this.backplane.addPublisher('RopRowOans', this.ropRowOansPublisher); diff --git a/fbw-a32nx/src/systems/instruments/src/PFD/shared/FcuBusProvider.ts b/fbw-a32nx/src/systems/instruments/src/PFD/shared/FcuBusProvider.ts new file mode 100644 index 000000000000..7749a1975a6c --- /dev/null +++ b/fbw-a32nx/src/systems/instruments/src/PFD/shared/FcuBusProvider.ts @@ -0,0 +1,130 @@ +// Copyright (c) 2021-2023 FlyByWire Simulations +// +// SPDX-License-Identifier: GPL-3.0 + +import { getDisplayIndex } from 'instruments/src/PFD/PFD'; +import { Arinc429Word } from '@flybywiresim/fbw-sdk'; +import { Instrument } from '@microsoft/msfs-sdk'; +import { PFDSimvars } from './PFDSimvarPublisher'; +import { ArincEventBus } from '../../MsfsAvionicsCommon/ArincEventBus'; + +export interface FcuBus { + fcuSelectedHeading: Arinc429Word; + fcuSelectedAltitude: Arinc429Word; + fcuSelectedAirspeed: Arinc429Word; + fcuSelectedVerticalSpeed: Arinc429Word; + fcuSelectedTrack: Arinc429Word; + fcuSelectedFpa: Arinc429Word; + fcuAtsDiscreteWord: Arinc429Word; + fcuAtsFmaDiscreteWord: Arinc429Word; + fcuEisDiscreteWord1: Arinc429Word; + fcuEisDiscreteWord2: Arinc429Word; + fcuEisBaro: Arinc429Word; + fcuEisBaroHpa: Arinc429Word; + fcuDiscreteWord1: Arinc429Word; + fcuDiscreteWord2: Arinc429Word; +} +export class FcuBusProvider implements Instrument { + private fcuEisDiscreteWord2 = new Arinc429Word(0); + + constructor(private readonly bus: ArincEventBus) {} + + /** @inheritdoc */ + public init() { + const publisher = this.bus.getPublisher(); + const subscriber = this.bus.getSubscriber(); + + subscriber.on('fcuSelectedHeadingRaw').handle((word) => { + publisher.pub('fcuSelectedHeading', new Arinc429Word(word)); + }); + + subscriber.on('fcuSelectedAltitudeRaw').handle((word) => { + publisher.pub('fcuSelectedAltitude', new Arinc429Word(word)); + }); + + subscriber.on('fcuSelectedAirspeedRaw').handle((word) => { + publisher.pub('fcuSelectedAirspeed', new Arinc429Word(word)); + }); + + subscriber.on('fcuSelectedVerticalSpeedRaw').handle((word) => { + publisher.pub('fcuSelectedVerticalSpeed', new Arinc429Word(word)); + }); + + subscriber.on('fcuSelectedTrackRaw').handle((word) => { + publisher.pub('fcuSelectedTrack', new Arinc429Word(word)); + }); + + subscriber.on('fcuSelectedFpaRaw').handle((word) => { + publisher.pub('fcuSelectedFpa', new Arinc429Word(word)); + }); + + subscriber.on('fcuAtsDiscreteWordRaw').handle((word) => { + publisher.pub('fcuAtsDiscreteWord', new Arinc429Word(word)); + }); + + subscriber.on('fcuAtsFmaDiscreteWordRaw').handle((word) => { + publisher.pub('fcuAtsFmaDiscreteWord', new Arinc429Word(word)); + }); + + subscriber.on('fcuEisLeftDiscreteWord1Raw').handle((word) => { + if (getDisplayIndex() === 1) { + publisher.pub('fcuEisDiscreteWord1', new Arinc429Word(word)); + } + }); + + subscriber.on('fcuEisLeftDiscreteWord2Raw').handle((word) => { + if (getDisplayIndex() === 1) { + this.fcuEisDiscreteWord2 = new Arinc429Word(word); + publisher.pub('fcuEisDiscreteWord2', this.fcuEisDiscreteWord2); + } + }); + + subscriber.on('fcuEisLeftBaroRaw').handle((word) => { + if (getDisplayIndex() === 1) { + publisher.pub('fcuEisBaro', new Arinc429Word(word)); + } + }); + + subscriber.on('fcuEisLeftBaroHpaRaw').handle((word) => { + if (getDisplayIndex() === 1) { + publisher.pub('fcuEisBaroHpa', new Arinc429Word(word)); + } + }); + + subscriber.on('fcuEisRightDiscreteWord1Raw').handle((word) => { + if (getDisplayIndex() === 2) { + publisher.pub('fcuEisDiscreteWord1', new Arinc429Word(word)); + } + }); + + subscriber.on('fcuEisRightDiscreteWord2Raw').handle((word) => { + if (getDisplayIndex() === 2) { + this.fcuEisDiscreteWord2 = new Arinc429Word(word); + publisher.pub('fcuEisDiscreteWord2', this.fcuEisDiscreteWord2); + } + }); + + subscriber.on('fcuEisRightBaroRaw').handle((word) => { + if (getDisplayIndex() === 2) { + publisher.pub('fcuEisBaro', new Arinc429Word(word)); + } + }); + + subscriber.on('fcuEisRightBaroHpaRaw').handle((word) => { + if (getDisplayIndex() === 2) { + publisher.pub('fcuEisBaroHpa', new Arinc429Word(word)); + } + }); + + subscriber.on('fcuDiscreteWord1Raw').handle((word) => { + publisher.pub('fcuDiscreteWord1', new Arinc429Word(word)); + }); + + subscriber.on('fcuDiscreteWord2Raw').handle((word) => { + publisher.pub('fcuDiscreteWord2', new Arinc429Word(word)); + }); + } + + /** @inheritdoc */ + onUpdate(): void {} +} diff --git a/fbw-a32nx/src/systems/instruments/src/PFD/shared/FgBusProvider.ts b/fbw-a32nx/src/systems/instruments/src/PFD/shared/FgBusProvider.ts new file mode 100644 index 000000000000..0ed9f5c20af4 --- /dev/null +++ b/fbw-a32nx/src/systems/instruments/src/PFD/shared/FgBusProvider.ts @@ -0,0 +1,261 @@ +// Copyright (c) 2021-2023 FlyByWire Simulations +// +// SPDX-License-Identifier: GPL-3.0 + +import { Instrument, Publisher } from '@microsoft/msfs-sdk'; +import { getDisplayIndex } from 'instruments/src/PFD/PFD'; +import { Arinc429Word } from '@flybywiresim/fbw-sdk'; +import { PFDSimvars } from './PFDSimvarPublisher'; +import { ArincEventBus } from '../../MsfsAvionicsCommon/ArincEventBus'; + +export interface FgBus { + fdEngaged: boolean; + pfdSelectedSpeed: Arinc429Word; + rollFdCommand: Arinc429Word; + pitchFdCommand: Arinc429Word; + yawFdCommand: Arinc429Word; + fmgcDiscreteWord5: Arinc429Word; + fmgc1DiscreteWord4: Arinc429Word; + fmgc2DiscreteWord4: Arinc429Word; + fmgcDiscreteWord4: Arinc429Word; + fmgcFmAltitudeConstraint: Arinc429Word; + fmgcDiscreteWord3: Arinc429Word; + fmgcDiscreteWord1: Arinc429Word; + fmgcDiscreteWord2: Arinc429Word; + fmgcDiscreteWord7: Arinc429Word; +} +export class FgBusProvider implements Instrument { + private fcuEisDiscreteWord2 = new Arinc429Word(0); + + private fmgc1DiscreteWord4 = new Arinc429Word(0); + + private fmgc2DiscreteWord4 = new Arinc429Word(0); + + private fmgc1AtsDiscreteWord = new Arinc429Word(0); + + private fmgc2AtsDiscreteWord = new Arinc429Word(0); + + private fg1ForFlightDirectorSelected = false; + + private fg1Selected = false; + + constructor(private readonly bus: ArincEventBus) {} + + /** @inheritdoc */ + public init() { + const publisher = this.bus.getPublisher(); + const subscriber = this.bus.getSubscriber(); + + subscriber.on('fcuEisLeftDiscreteWord2Raw').handle((word) => { + if (getDisplayIndex() === 1) { + this.fcuEisDiscreteWord2 = new Arinc429Word(word); + this.determineFmgcToUseForFlightDirector(publisher); + } + }); + + subscriber.on('fcuEisRightDiscreteWord2Raw').handle((word) => { + if (getDisplayIndex() === 2) { + this.fcuEisDiscreteWord2 = new Arinc429Word(word); + this.determineFmgcToUseForFlightDirector(publisher); + } + }); + + subscriber.on('fmgc1PfdSelectedSpeedRaw').handle((word) => { + if (this.fg1Selected) { + publisher.pub('pfdSelectedSpeed', new Arinc429Word(word)); + } + }); + + subscriber.on('fmgc2PfdSelectedSpeedRaw').handle((word) => { + if (!this.fg1Selected) { + publisher.pub('pfdSelectedSpeed', new Arinc429Word(word)); + } + }); + + subscriber.on('fmgc1RollFdCommandRaw').handle((word) => { + if (this.fg1ForFlightDirectorSelected) { + publisher.pub('rollFdCommand', new Arinc429Word(word)); + } + }); + + subscriber.on('fmgc2RollFdCommandRaw').handle((word) => { + if (!this.fg1ForFlightDirectorSelected) { + publisher.pub('rollFdCommand', new Arinc429Word(word)); + } + }); + + subscriber.on('fmgc1PitchFdCommandRaw').handle((word) => { + if (this.fg1ForFlightDirectorSelected) { + publisher.pub('pitchFdCommand', new Arinc429Word(word)); + } + }); + + subscriber.on('fmgc2PitchFdCommandRaw').handle((word) => { + if (!this.fg1ForFlightDirectorSelected) { + publisher.pub('pitchFdCommand', new Arinc429Word(word)); + } + }); + + subscriber.on('fmgc1YawFdCommandRaw').handle((word) => { + if (this.fg1ForFlightDirectorSelected) { + publisher.pub('yawFdCommand', new Arinc429Word(word)); + } + }); + + subscriber.on('fmgc2YawFdCommandRaw').handle((word) => { + if (!this.fg1ForFlightDirectorSelected) { + publisher.pub('yawFdCommand', new Arinc429Word(word)); + } + }); + + subscriber.on('fmgc1DiscreteWord5Raw').handle((word) => { + if (this.fg1Selected) { + publisher.pub('fmgcDiscreteWord5', new Arinc429Word(word)); + } + }); + + subscriber.on('fmgc2DiscreteWord5Raw').handle((word) => { + if (!this.fg1Selected) { + publisher.pub('fmgcDiscreteWord5', new Arinc429Word(word)); + } + }); + + subscriber.on('fmgc1DiscreteWord4Raw').handle((word) => { + this.fmgc1DiscreteWord4 = new Arinc429Word(word); + this.determineFmgcToUseForFlightDirector(publisher); + this.determineFmgcToUse(); + publisher.pub('fmgc1DiscreteWord4', new Arinc429Word(word)); + if (this.fg1Selected) { + publisher.pub('fmgcDiscreteWord4', this.fmgc1DiscreteWord4); + } + }); + + subscriber.on('fmgc2DiscreteWord4Raw').handle((word) => { + this.fmgc2DiscreteWord4 = new Arinc429Word(word); + this.determineFmgcToUseForFlightDirector(publisher); + this.determineFmgcToUse(); + publisher.pub('fmgc2DiscreteWord4', new Arinc429Word(word)); + if (!this.fg1Selected) { + publisher.pub('fmgcDiscreteWord4', this.fmgc2DiscreteWord4); + } + }); + + subscriber.on('fmgc1FmAltitudeConstraintRaw').handle((word) => { + if (this.fg1Selected) { + publisher.pub('fmgcFmAltitudeConstraint', new Arinc429Word(word)); + } + }); + + subscriber.on('fmgc2FmAltitudeConstraintRaw').handle((word) => { + if (!this.fg1Selected) { + publisher.pub('fmgcFmAltitudeConstraint', new Arinc429Word(word)); + } + }); + + subscriber.on('fmgc1AtsDiscreteWordRaw').handle((word) => { + this.fmgc1AtsDiscreteWord = new Arinc429Word(word); + this.determineFmgcToUse(); + }); + + subscriber.on('fmgc2AtsDiscreteWordRaw').handle((word) => { + this.fmgc2AtsDiscreteWord = new Arinc429Word(word); + this.determineFmgcToUse(); + }); + + subscriber.on('fmgc1DiscreteWord3Raw').handle((word) => { + if (this.fg1Selected) { + publisher.pub('fmgcDiscreteWord3', new Arinc429Word(word)); + } + }); + + subscriber.on('fmgc2DiscreteWord3Raw').handle((word) => { + if (!this.fg1Selected) { + publisher.pub('fmgcDiscreteWord3', new Arinc429Word(word)); + } + }); + + subscriber.on('fmgc1DiscreteWord1Raw').handle((word) => { + if (this.fg1Selected) { + publisher.pub('fmgcDiscreteWord1', new Arinc429Word(word)); + } + }); + + subscriber.on('fmgc2DiscreteWord1Raw').handle((word) => { + if (!this.fg1Selected) { + publisher.pub('fmgcDiscreteWord1', new Arinc429Word(word)); + } + }); + + subscriber.on('fmgc1DiscreteWord2Raw').handle((word) => { + if (this.fg1Selected) { + publisher.pub('fmgcDiscreteWord2', new Arinc429Word(word)); + } + }); + + subscriber.on('fmgc2DiscreteWord2Raw').handle((word) => { + if (!this.fg1Selected) { + publisher.pub('fmgcDiscreteWord2', new Arinc429Word(word)); + } + }); + + subscriber.on('fmgc1DiscreteWord7Raw').handle((word) => { + if (this.fg1Selected) { + publisher.pub('fmgcDiscreteWord7', new Arinc429Word(word)); + } + }); + + subscriber.on('fmgc2DiscreteWord7Raw').handle((word) => { + if (!this.fg1Selected) { + publisher.pub('fmgcDiscreteWord7', new Arinc429Word(word)); + } + }); + } + + /** @inheritdoc */ + onUpdate(): void {} + + private determineFmgcToUseForFlightDirector(publisher: Publisher) { + const side2 = getDisplayIndex() === 2; + + const fd1Engaged = this.fmgc1DiscreteWord4.getBitValueOr(13, false); + const fd2Engaged = this.fmgc2DiscreteWord4.getBitValueOr(13, false); + const fdOwnSelectedOn = !this.fcuEisDiscreteWord2.getBitValueOr(23, false); + + const ownFdEngaged = side2 ? fd2Engaged : fd1Engaged; + const oppFdEngaged = side2 ? fd1Engaged : fd2Engaged; + + const ownFdEngagedAndOn = ownFdEngaged && fdOwnSelectedOn; + const oppFdEngagedAndOn = !ownFdEngaged && oppFdEngaged && fdOwnSelectedOn; + + this.fg1ForFlightDirectorSelected = + (!side2 && !ownFdEngagedAndOn && !oppFdEngagedAndOn) || + (!side2 && ownFdEngagedAndOn) || + (side2 && oppFdEngagedAndOn); + + publisher.pub('fdEngaged', this.fg1ForFlightDirectorSelected ? fd1Engaged : fd2Engaged); + } + + private determineFmgcToUse() { + const side2 = getDisplayIndex() === 2; + + const ap1Engaged = this.fmgc1DiscreteWord4.getBitValueOr(12, false); + const fd1Engaged = this.fmgc1DiscreteWord4.getBitValueOr(13, false); + const ap2Engaged = this.fmgc2DiscreteWord4.getBitValueOr(12, false); + const fd2Engaged = this.fmgc2DiscreteWord4.getBitValueOr(13, false); + + const fg1Inop = + this.fmgc1AtsDiscreteWord.getBitValueOr(24, false) || + this.fmgc1AtsDiscreteWord.isFailureWarning() || + this.fmgc1DiscreteWord4.isFailureWarning(); + const fg2Inop = + this.fmgc2AtsDiscreteWord.getBitValueOr(24, false) || + this.fmgc2AtsDiscreteWord.isFailureWarning() || + this.fmgc2DiscreteWord4.isFailureWarning(); + + const apCondition = !side2 ? ap1Engaged : ap1Engaged && !ap2Engaged; + const fdCondition = !(ap1Engaged || ap2Engaged) && (!side2 ? fd1Engaged : fd1Engaged && !fd2Engaged); + const inopCondition = !(ap1Engaged || ap2Engaged) && !(fd1Engaged || fd2Engaged) && (!fg1Inop || fg2Inop); + + this.fg1Selected = apCondition || fdCondition || inopCondition; + } +} diff --git a/fbw-a32nx/src/systems/instruments/src/PFD/shared/PFDSimvarPublisher.tsx b/fbw-a32nx/src/systems/instruments/src/PFD/shared/PFDSimvarPublisher.tsx index e7dae43595de..2c9a2f2add4e 100644 --- a/fbw-a32nx/src/systems/instruments/src/PFD/shared/PFDSimvarPublisher.tsx +++ b/fbw-a32nx/src/systems/instruments/src/PFD/shared/PFDSimvarPublisher.tsx @@ -29,30 +29,12 @@ export type PFDSimvars = AdirsSimVars & noseGearCompressed: boolean; leftMainGearCompressed: boolean; rightMainGearCompressed: boolean; - activeLateralMode: number; - activeVerticalMode: number; - fmaModeReversion: boolean; - fmaSpeedProtection: boolean; - AThrMode: number; - apVsSelected: number; - approachCapability: number; - ap1Active: boolean; - ap2Active: boolean; - fmaVerticalArmed: number; - fmaLateralArmed: number; - fd1Active: boolean; - fd2Active: boolean; - athrStatus: number; - athrModeMessage: number; machPreselVal: number; speedPreselVal: number; attHdgKnob: number; airKnob: number; vsBaro: number; vsInert: number; - fdYawCommand: number; - fdBank: number; - fdPitch: number; v1: number; vr: number; fwcFlightPhase: number; @@ -66,17 +48,9 @@ export type PFDSimvars = AdirsSimVars & hasGlideslope: boolean; glideSlopeError: number; markerBeacon: number; - isAltManaged: boolean; - targetSpeedManaged: number; flapHandleIndex: number; - selectedHeading: number; - showSelectedHeading: number; - altConstraint: number; - trkFpaActive: boolean; aoa: number; - selectedFpa: number; ilsCourse: number; - metricAltToggle: boolean; tla1: number; tla2: number; landingElevation: number; @@ -89,16 +63,11 @@ export type PFDSimvars = AdirsSimVars & tcasFail: boolean; engOneRunning: boolean; engTwoRunning: boolean; - expediteMode: boolean; setHoldSpeed: boolean; tdReached: boolean; - trkFpaDeselectedTCAS: boolean; - tcasRaInhibited: boolean; checkSpeedMode: boolean; radioAltitude1: number; radioAltitude2: number; - crzAltMode: boolean; - tcasModeDisarmed: boolean; flexTemp: number; autoBrakeMode: number; autoBrakeActive: boolean; @@ -106,8 +75,6 @@ export type PFDSimvars = AdirsSimVars & fpaRaw: number; daRaw: number; latAccRaw: number; - ls1Button: boolean; - ls2Button: boolean; fcdc1DiscreteWord1Raw: number; fcdc2DiscreteWord1Raw: number; fcdc1DiscreteWord2Raw: number; @@ -169,6 +136,48 @@ export type PFDSimvars = AdirsSimVars & fm2TransLvlRaw: number; fm1Backbeam: boolean; fm2Backbeam: boolean; + fmgc1PfdSelectedSpeedRaw: number; + fmgc2PfdSelectedSpeedRaw: number; + fmgc1RollFdCommandRaw: number; + fmgc2RollFdCommandRaw: number; + fmgc1PitchFdCommandRaw: number; + fmgc2PitchFdCommandRaw: number; + fmgc1YawFdCommandRaw: number; + fmgc2YawFdCommandRaw: number; + fmgc1DiscreteWord5Raw: number; + fmgc2DiscreteWord5Raw: number; + fmgc1DiscreteWord4Raw: number; + fmgc2DiscreteWord4Raw: number; + fmgc1FmAltitudeConstraintRaw: number; + fmgc2FmAltitudeConstraintRaw: number; + fmgc1AtsDiscreteWordRaw: number; + fmgc2AtsDiscreteWordRaw: number; + fmgc1DiscreteWord3Raw: number; + fmgc2DiscreteWord3Raw: number; + fmgc1DiscreteWord1Raw: number; + fmgc2DiscreteWord1Raw: number; + fmgc1DiscreteWord2Raw: number; + fmgc2DiscreteWord2Raw: number; + fmgc1DiscreteWord7Raw: number; + fmgc2DiscreteWord7Raw: number; + fcuSelectedHeadingRaw: number; + fcuSelectedAltitudeRaw: number; + fcuSelectedAirspeedRaw: number; + fcuSelectedVerticalSpeedRaw: number; + fcuSelectedTrackRaw: number; + fcuSelectedFpaRaw: number; + fcuAtsDiscreteWordRaw: number; + fcuAtsFmaDiscreteWordRaw: number; + fcuEisLeftDiscreteWord1Raw: number; + fcuEisLeftDiscreteWord2Raw: number; + fcuEisLeftBaroRaw: number; + fcuEisLeftBaroHpaRaw: number; + fcuEisRightDiscreteWord1Raw: number; + fcuEisRightDiscreteWord2Raw: number; + fcuEisRightBaroRaw: number; + fcuEisRightBaroHpaRaw: number; + fcuDiscreteWord1Raw: number; + fcuDiscreteWord2Raw: number; }; export enum PFDVars { @@ -186,30 +195,12 @@ export enum PFDVars { noseGearCompressed = 'L:A32NX_LGCIU_1_NOSE_GEAR_COMPRESSED', leftMainGearCompressed = 'L:A32NX_LGCIU_1_LEFT_GEAR_COMPRESSED', rightMainGearCompressed = 'L:A32NX_LGCIU_1_RIGHT_GEAR_COMPRESSED', - activeLateralMode = 'L:A32NX_FMA_LATERAL_MODE', - activeVerticalMode = 'L:A32NX_FMA_VERTICAL_MODE', - fmaModeReversion = 'L:A32NX_FMA_MODE_REVERSION', - fmaSpeedProtection = 'L:A32NX_FMA_SPEED_PROTECTION_MODE', - AThrMode = 'L:A32NX_AUTOTHRUST_MODE', - apVsSelected = 'L:A32NX_AUTOPILOT_VS_SELECTED', - approachCapability = 'L:A32NX_ApproachCapability', - ap1Active = 'L:A32NX_AUTOPILOT_1_ACTIVE', - ap2Active = 'L:A32NX_AUTOPILOT_2_ACTIVE', - fmaVerticalArmed = 'L:A32NX_FMA_VERTICAL_ARMED', - fmaLateralArmed = 'L:A32NX_FMA_LATERAL_ARMED', - fd1Active = 'AUTOPILOT FLIGHT DIRECTOR ACTIVE:1', - fd2Active = 'AUTOPILOT FLIGHT DIRECTOR ACTIVE:2', - athrStatus = 'L:A32NX_AUTOTHRUST_STATUS', - athrModeMessage = 'L:A32NX_AUTOTHRUST_MODE_MESSAGE', machPreselVal = 'L:A32NX_MachPreselVal', speedPreselVal = 'L:A32NX_SpeedPreselVal', attHdgKnob = 'L:A32NX_ATT_HDG_SWITCHING_KNOB', airKnob = 'L:A32NX_AIR_DATA_SWITCHING_KNOB', vsBaro = 'L:A32NX_ADIRS_ADR_1_BAROMETRIC_VERTICAL_SPEED', vsInert = 'L:A32NX_ADIRS_IR_1_VERTICAL_SPEED', - fdYawCommand = 'L:A32NX_FLIGHT_DIRECTOR_YAW', - fdBank = 'L:A32NX_FLIGHT_DIRECTOR_BANK', - fdPitch = 'L:A32NX_FLIGHT_DIRECTOR_PITCH', v1 = 'L:AIRLINER_V1_SPEED', vr = 'L:AIRLINER_VR_SPEED', fwcFlightPhase = 'L:A32NX_FWC_FLIGHT_PHASE', @@ -223,19 +214,11 @@ export enum PFDVars { hasGlideslope = 'L:A32NX_RADIO_RECEIVER_GS_IS_VALID', glideSlopeError = 'L:A32NX_RADIO_RECEIVER_GS_DEVIATION', markerBeacon = 'MARKER BEACON STATE', - isAltManaged = 'L:A32NX_FCU_ALT_MANAGED', - targetSpeedManaged = 'L:A32NX_SPEEDS_MANAGED_PFD', mach = 'L:A32NX_ADIRS_ADR_1_MACH', flapHandleIndex = 'L:A32NX_FLAPS_HANDLE_INDEX', magTrackRaw = 'L:A32NX_ADIRS_IR_1_TRACK', - selectedHeading = 'L:A32NX_FCU_HEADING_SELECTED', - showSelectedHeading = 'L:A320_FCU_SHOW_SELECTED_HEADING', - altConstraint = 'L:A32NX_FG_ALTITUDE_CONSTRAINT', - trkFpaActive = 'L:A32NX_TRK_FPA_MODE_ACTIVE', aoa = 'INCIDENCE ALPHA', - selectedFpa = 'L:A32NX_AUTOPILOT_FPA_SELECTED', ilsCourse = 'L:A32NX_FM_LS_COURSE', - metricAltToggle = 'L:A32NX_METRIC_ALT_TOGGLE', tla1 = 'L:A32NX_AUTOTHRUST_TLA:1', tla2 = 'L:A32NX_AUTOTHRUST_TLA:2', tcasState = 'L:A32NX_TCAS_STATE', @@ -247,16 +230,11 @@ export enum PFDVars { tcasFail = 'L:A32NX_TCAS_FAULT', engOneRunning = 'GENERAL ENG COMBUSTION:1', engTwoRunning = 'GENERAL ENG COMBUSTION:2', - expediteMode = 'L:A32NX_FMA_EXPEDITE_MODE', setHoldSpeed = 'L:A32NX_PFD_MSG_SET_HOLD_SPEED', - 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', - tcasModeDisarmed = 'L:A32NX_AUTOPILOT_TCAS_MESSAGE_DISARM', flexTemp = 'L:AIRLINER_TO_FLEX_TEMP', autoBrakeMode = 'L:A32NX_AUTOBRAKES_ARMED_MODE', autoBrakeActive = 'L:A32NX_AUTOBRAKES_ACTIVE', @@ -264,8 +242,6 @@ export enum PFDVars { fpaRaw = 'L:A32NX_ADIRS_IR_1_FLIGHT_PATH_ANGLE', daRaw = 'L:A32NX_ADIRS_IR_1_DRIFT_ANGLE', latAccRaw = 'L:A32NX_ADIRS_IR_1_BODY_LATERAL_ACC', - ls1Button = 'L:BTN_LS_1_FILTER_ACTIVE', - ls2Button = 'L:BTN_LS_2_FILTER_ACTIVE', fcdc1DiscreteWord1Raw = 'L:A32NX_FCDC_1_DISCRETE_WORD_1', fcdc2DiscreteWord1Raw = 'L:A32NX_FCDC_2_DISCRETE_WORD_1', fcdc1DiscreteWord2Raw = 'L:A32NX_FCDC_1_DISCRETE_WORD_2', @@ -329,6 +305,48 @@ export enum PFDVars { fm2TransLvlRaw = 'L:A32NX_FM2_TRANS_LVL', fm1Backbeam = 'L:A32NX_FM1_BACKBEAM_SELECTED', fm2Backbeam = 'L:A32NX_FM2_BACKBEAM_SELECTED', + fmgc1PfdSelectedSpeedRaw = 'L:A32NX_FMGC_1_PFD_SELECTED_SPEED', + fmgc2PfdSelectedSpeedRaw = 'L:A32NX_FMGC_2_PFD_SELECTED_SPEED', + fmgc1RollFdCommandRaw = 'L:A32NX_FMGC_1_ROLL_FD_COMMAND', + fmgc2RollFdCommandRaw = 'L:A32NX_FMGC_2_ROLL_FD_COMMAND', + fmgc1PitchFdCommandRaw = 'L:A32NX_FMGC_1_PITCH_FD_COMMAND', + fmgc2PitchFdCommandRaw = 'L:A32NX_FMGC_2_PITCH_FD_COMMAND', + fmgc1YawFdCommandRaw = 'L:A32NX_FMGC_1_YAW_FD_COMMAND', + fmgc2YawFdCommandRaw = 'L:A32NX_FMGC_2_YAW_FD_COMMAND', + fmgc1DiscreteWord5Raw = 'L:A32NX_FMGC_1_DISCRETE_WORD_5', + fmgc2DiscreteWord5Raw = 'L:A32NX_FMGC_2_DISCRETE_WORD_5', + fmgc1DiscreteWord4Raw = 'L:A32NX_FMGC_1_DISCRETE_WORD_4', + fmgc2DiscreteWord4Raw = 'L:A32NX_FMGC_2_DISCRETE_WORD_4', + fmgc1FmAltitudeConstraintRaw = 'L:A32NX_FMGC_1_FM_ALTITUDE_CONSTRAINT', + fmgc2FmAltitudeConstraintRaw = 'L:A32NX_FMGC_2_FM_ALTITUDE_CONSTRAINT', + fmgc1AtsDiscreteWordRaw = 'L:A32NX_FMGC_1_ATS_DISCRETE_WORD', + fmgc2AtsDiscreteWordRaw = 'L:A32NX_FMGC_2_ATS_DISCRETE_WORD', + fmgc1DiscreteWord3Raw = 'L:A32NX_FMGC_1_DISCRETE_WORD_3', + fmgc2DiscreteWord3Raw = 'L:A32NX_FMGC_2_DISCRETE_WORD_3', + fmgc1DiscreteWord1Raw = 'L:A32NX_FMGC_1_DISCRETE_WORD_1', + fmgc2DiscreteWord1Raw = 'L:A32NX_FMGC_2_DISCRETE_WORD_1', + fmgc1DiscreteWord2Raw = 'L:A32NX_FMGC_1_DISCRETE_WORD_2', + fmgc2DiscreteWord2Raw = 'L:A32NX_FMGC_2_DISCRETE_WORD_2', + fmgc1DiscreteWord7Raw = 'L:A32NX_FMGC_1_DISCRETE_WORD_7', + fmgc2DiscreteWord7Raw = 'L:A32NX_FMGC_2_DISCRETE_WORD_7', + fcuSelectedHeadingRaw = 'L:A32NX_FCU_SELECTED_HEADING', + fcuSelectedAltitudeRaw = 'L:A32NX_FCU_SELECTED_ALTITUDE', + fcuSelectedAirspeedRaw = 'L:A32NX_FCU_SELECTED_AIRSPEED', + fcuSelectedVerticalSpeedRaw = 'L:A32NX_FCU_SELECTED_VERTICAL_SPEED', + fcuSelectedTrackRaw = 'L:A32NX_FCU_SELECTED_TRACK', + fcuSelectedFpaRaw = 'L:A32NX_FCU_SELECTED_FPA', + fcuAtsDiscreteWordRaw = 'L:A32NX_FCU_ATS_DISCRETE_WORD', + fcuAtsFmaDiscreteWordRaw = 'L:A32NX_FCU_ATS_FMA_DISCRETE_WORD', + fcuEisLeftDiscreteWord1Raw = 'L:A32NX_FCU_LEFT_EIS_DISCRETE_WORD_1', + fcuEisLeftDiscreteWord2Raw = 'L:A32NX_FCU_LEFT_EIS_DISCRETE_WORD_2', + fcuEisLeftBaroRaw = 'L:A32NX_FCU_LEFT_EIS_BARO', + fcuEisLeftBaroHpaRaw = 'L:A32NX_FCU_LEFT_EIS_BARO_HPA', + fcuEisRightDiscreteWord1Raw = 'L:A32NX_FCU_RIGHT_EIS_DISCRETE_WORD_1', + fcuEisRightDiscreteWord2Raw = 'L:A32NX_FCU_RIGHT_EIS_DISCRETE_WORD_2', + fcuEisRightBaroRaw = 'L:A32NX_FCU_RIGHT_EIS_BARO', + fcuEisRightBaroHpaRaw = 'L:A32NX_FCU_RIGHT_EIS_BARO_HPA', + fcuDiscreteWord1Raw = 'L:A32NX_FCU_DISCRETE_WORD_1', + fcuDiscreteWord2Raw = 'L:A32NX_FCU_DISCRETE_WORD_2', } /** A publisher to poll and publish nav/com simvars. */ @@ -349,30 +367,12 @@ export class PFDSimvarPublisher extends UpdatableSimVarPublisher { ['noseGearCompressed', { name: PFDVars.noseGearCompressed, type: SimVarValueType.Bool }], ['leftMainGearCompressed', { name: PFDVars.leftMainGearCompressed, type: SimVarValueType.Bool }], ['rightMainGearCompressed', { name: PFDVars.rightMainGearCompressed, type: SimVarValueType.Bool }], - ['activeLateralMode', { name: PFDVars.activeLateralMode, type: SimVarValueType.Number }], - ['activeVerticalMode', { name: PFDVars.activeVerticalMode, type: SimVarValueType.Number }], - ['fmaModeReversion', { name: PFDVars.fmaModeReversion, type: SimVarValueType.Bool }], - ['fmaSpeedProtection', { name: PFDVars.fmaSpeedProtection, type: SimVarValueType.Bool }], - ['AThrMode', { name: PFDVars.AThrMode, type: SimVarValueType.Number }], - ['apVsSelected', { name: PFDVars.apVsSelected, type: SimVarValueType.FPM }], - ['approachCapability', { name: PFDVars.approachCapability, type: SimVarValueType.Number }], - ['ap1Active', { name: PFDVars.ap1Active, type: SimVarValueType.Bool }], - ['ap2Active', { name: PFDVars.ap2Active, type: SimVarValueType.Bool }], - ['fmaVerticalArmed', { name: PFDVars.fmaVerticalArmed, type: SimVarValueType.Number }], - ['fmaLateralArmed', { name: PFDVars.fmaLateralArmed, type: SimVarValueType.Number }], - ['fd1Active', { name: PFDVars.fd1Active, type: SimVarValueType.Bool }], - ['fd2Active', { name: PFDVars.fd2Active, type: SimVarValueType.Bool }], - ['athrStatus', { name: PFDVars.athrStatus, type: SimVarValueType.Number }], - ['athrModeMessage', { name: PFDVars.athrModeMessage, type: SimVarValueType.Number }], ['machPreselVal', { name: PFDVars.machPreselVal, type: SimVarValueType.Number }], ['speedPreselVal', { name: PFDVars.speedPreselVal, type: SimVarValueType.Knots }], ['attHdgKnob', { name: PFDVars.attHdgKnob, type: SimVarValueType.Enum }], ['airKnob', { name: PFDVars.airKnob, type: SimVarValueType.Enum }], ['vsBaro', { name: PFDVars.vsBaro, type: SimVarValueType.Number }], ['vsInert', { name: PFDVars.vsInert, type: SimVarValueType.Number }], - ['fdYawCommand', { name: PFDVars.fdYawCommand, type: SimVarValueType.Number }], - ['fdBank', { name: PFDVars.fdBank, type: SimVarValueType.Number }], - ['fdPitch', { name: PFDVars.fdPitch, type: SimVarValueType.Number }], ['v1', { name: PFDVars.v1, type: SimVarValueType.Knots }], ['vr', { name: PFDVars.vr, type: SimVarValueType.Knots }], ['fwcFlightPhase', { name: PFDVars.fwcFlightPhase, type: SimVarValueType.Number }], @@ -386,19 +386,11 @@ export class PFDSimvarPublisher extends UpdatableSimVarPublisher { ['hasGlideslope', { name: PFDVars.hasGlideslope, type: SimVarValueType.Bool }], ['glideSlopeError', { name: PFDVars.glideSlopeError, type: SimVarValueType.Degree }], ['markerBeacon', { name: PFDVars.markerBeacon, type: SimVarValueType.Enum }], - ['isAltManaged', { name: PFDVars.isAltManaged, type: SimVarValueType.Bool }], - ['targetSpeedManaged', { name: PFDVars.targetSpeedManaged, type: SimVarValueType.Knots }], ['mach', { name: PFDVars.mach, type: SimVarValueType.Number }], ['flapHandleIndex', { name: PFDVars.flapHandleIndex, type: SimVarValueType.Number }], ['magTrackRaw', { name: PFDVars.magTrackRaw, type: SimVarValueType.Number }], - ['selectedHeading', { name: PFDVars.selectedHeading, type: SimVarValueType.Degree }], - ['showSelectedHeading', { name: PFDVars.showSelectedHeading, type: SimVarValueType.Number }], - ['altConstraint', { name: PFDVars.altConstraint, type: SimVarValueType.Feet }], - ['trkFpaActive', { name: PFDVars.trkFpaActive, type: SimVarValueType.Bool }], ['aoa', { name: PFDVars.aoa, type: SimVarValueType.Degree }], - ['selectedFpa', { name: PFDVars.selectedFpa, type: SimVarValueType.Degree }], ['ilsCourse', { name: PFDVars.ilsCourse, type: SimVarValueType.Number }], - ['metricAltToggle', { name: PFDVars.metricAltToggle, type: SimVarValueType.Bool }], ['tla1', { name: PFDVars.tla1, type: SimVarValueType.Number }], ['tla2', { name: PFDVars.tla2, type: SimVarValueType.Number }], ['tcasState', { name: PFDVars.tcasState, type: SimVarValueType.Enum }], @@ -410,16 +402,11 @@ export class PFDSimvarPublisher extends UpdatableSimVarPublisher { ['tcasFail', { name: PFDVars.tcasFail, type: SimVarValueType.Bool }], ['engOneRunning', { name: PFDVars.engOneRunning, type: SimVarValueType.Bool }], ['engTwoRunning', { name: PFDVars.engTwoRunning, type: SimVarValueType.Bool }], - ['expediteMode', { name: PFDVars.expediteMode, type: SimVarValueType.Bool }], ['setHoldSpeed', { name: PFDVars.setHoldSpeed, type: SimVarValueType.Bool }], ['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 }], - ['tcasModeDisarmed', { name: PFDVars.tcasModeDisarmed, type: SimVarValueType.Bool }], ['flexTemp', { name: PFDVars.flexTemp, type: SimVarValueType.Number }], ['autoBrakeMode', { name: PFDVars.autoBrakeMode, type: SimVarValueType.Number }], ['autoBrakeActive', { name: PFDVars.autoBrakeActive, type: SimVarValueType.Bool }], @@ -427,8 +414,6 @@ export class PFDSimvarPublisher extends UpdatableSimVarPublisher { ['fpaRaw', { name: PFDVars.fpaRaw, type: SimVarValueType.Number }], ['daRaw', { name: PFDVars.daRaw, type: SimVarValueType.Number }], ['latAccRaw', { name: PFDVars.latAccRaw, type: SimVarValueType.Number }], - ['ls1Button', { name: PFDVars.ls1Button, type: SimVarValueType.Bool }], - ['ls2Button', { name: PFDVars.ls2Button, type: SimVarValueType.Bool }], ['fcdc1DiscreteWord1Raw', { name: PFDVars.fcdc1DiscreteWord1Raw, type: SimVarValueType.Number }], ['fcdc2DiscreteWord1Raw', { name: PFDVars.fcdc2DiscreteWord1Raw, type: SimVarValueType.Number }], ['fcdc1DiscreteWord2Raw', { name: PFDVars.fcdc1DiscreteWord2Raw, type: SimVarValueType.Number }], @@ -490,6 +475,48 @@ export class PFDSimvarPublisher extends UpdatableSimVarPublisher { ['fm2TransLvlRaw', { name: PFDVars.fm2TransLvlRaw, type: SimVarValueType.Number }], ['fm1Backbeam', { name: PFDVars.fm1Backbeam, type: SimVarValueType.Bool }], ['fm2Backbeam', { name: PFDVars.fm2Backbeam, type: SimVarValueType.Bool }], + ['fmgc1PfdSelectedSpeedRaw', { name: PFDVars.fmgc1PfdSelectedSpeedRaw, type: SimVarValueType.Number }], + ['fmgc2PfdSelectedSpeedRaw', { name: PFDVars.fmgc2PfdSelectedSpeedRaw, type: SimVarValueType.Number }], + ['fmgc1RollFdCommandRaw', { name: PFDVars.fmgc1RollFdCommandRaw, type: SimVarValueType.Number }], + ['fmgc2RollFdCommandRaw', { name: PFDVars.fmgc2RollFdCommandRaw, type: SimVarValueType.Number }], + ['fmgc1PitchFdCommandRaw', { name: PFDVars.fmgc1PitchFdCommandRaw, type: SimVarValueType.Number }], + ['fmgc2PitchFdCommandRaw', { name: PFDVars.fmgc2PitchFdCommandRaw, type: SimVarValueType.Number }], + ['fmgc1YawFdCommandRaw', { name: PFDVars.fmgc1YawFdCommandRaw, type: SimVarValueType.Number }], + ['fmgc2YawFdCommandRaw', { name: PFDVars.fmgc2YawFdCommandRaw, type: SimVarValueType.Number }], + ['fmgc1DiscreteWord5Raw', { name: PFDVars.fmgc1DiscreteWord5Raw, type: SimVarValueType.Number }], + ['fmgc2DiscreteWord5Raw', { name: PFDVars.fmgc2DiscreteWord5Raw, type: SimVarValueType.Number }], + ['fmgc1DiscreteWord4Raw', { name: PFDVars.fmgc1DiscreteWord4Raw, type: SimVarValueType.Number }], + ['fmgc2DiscreteWord4Raw', { name: PFDVars.fmgc2DiscreteWord4Raw, type: SimVarValueType.Number }], + ['fmgc1FmAltitudeConstraintRaw', { name: PFDVars.fmgc1FmAltitudeConstraintRaw, type: SimVarValueType.Number }], + ['fmgc2FmAltitudeConstraintRaw', { name: PFDVars.fmgc2FmAltitudeConstraintRaw, type: SimVarValueType.Number }], + ['fmgc1AtsDiscreteWordRaw', { name: PFDVars.fmgc1AtsDiscreteWordRaw, type: SimVarValueType.Number }], + ['fmgc2AtsDiscreteWordRaw', { name: PFDVars.fmgc2AtsDiscreteWordRaw, type: SimVarValueType.Number }], + ['fmgc1DiscreteWord3Raw', { name: PFDVars.fmgc1DiscreteWord3Raw, type: SimVarValueType.Number }], + ['fmgc2DiscreteWord3Raw', { name: PFDVars.fmgc2DiscreteWord3Raw, type: SimVarValueType.Number }], + ['fmgc1DiscreteWord1Raw', { name: PFDVars.fmgc1DiscreteWord1Raw, type: SimVarValueType.Number }], + ['fmgc2DiscreteWord1Raw', { name: PFDVars.fmgc2DiscreteWord1Raw, type: SimVarValueType.Number }], + ['fmgc1DiscreteWord2Raw', { name: PFDVars.fmgc1DiscreteWord2Raw, type: SimVarValueType.Number }], + ['fmgc2DiscreteWord2Raw', { name: PFDVars.fmgc2DiscreteWord2Raw, type: SimVarValueType.Number }], + ['fmgc1DiscreteWord7Raw', { name: PFDVars.fmgc1DiscreteWord7Raw, type: SimVarValueType.Number }], + ['fmgc2DiscreteWord7Raw', { name: PFDVars.fmgc2DiscreteWord7Raw, type: SimVarValueType.Number }], + ['fcuSelectedHeadingRaw', { name: PFDVars.fcuSelectedHeadingRaw, type: SimVarValueType.Number }], + ['fcuSelectedAltitudeRaw', { name: PFDVars.fcuSelectedAltitudeRaw, type: SimVarValueType.Number }], + ['fcuSelectedAirspeedRaw', { name: PFDVars.fcuSelectedAirspeedRaw, type: SimVarValueType.Number }], + ['fcuSelectedVerticalSpeedRaw', { name: PFDVars.fcuSelectedVerticalSpeedRaw, type: SimVarValueType.Number }], + ['fcuSelectedTrackRaw', { name: PFDVars.fcuSelectedTrackRaw, type: SimVarValueType.Number }], + ['fcuSelectedFpaRaw', { name: PFDVars.fcuSelectedFpaRaw, type: SimVarValueType.Number }], + ['fcuAtsDiscreteWordRaw', { name: PFDVars.fcuAtsDiscreteWordRaw, type: SimVarValueType.Number }], + ['fcuAtsFmaDiscreteWordRaw', { name: PFDVars.fcuAtsFmaDiscreteWordRaw, type: SimVarValueType.Number }], + ['fcuEisLeftDiscreteWord1Raw', { name: PFDVars.fcuEisLeftDiscreteWord1Raw, type: SimVarValueType.Number }], + ['fcuEisLeftDiscreteWord2Raw', { name: PFDVars.fcuEisLeftDiscreteWord2Raw, type: SimVarValueType.Number }], + ['fcuEisLeftBaroRaw', { name: PFDVars.fcuEisLeftBaroRaw, type: SimVarValueType.Number }], + ['fcuEisLeftBaroHpaRaw', { name: PFDVars.fcuEisLeftBaroHpaRaw, type: SimVarValueType.Number }], + ['fcuEisRightDiscreteWord1Raw', { name: PFDVars.fcuEisRightDiscreteWord1Raw, type: SimVarValueType.Number }], + ['fcuEisRightDiscreteWord2Raw', { name: PFDVars.fcuEisRightDiscreteWord2Raw, type: SimVarValueType.Number }], + ['fcuEisRightBaroRaw', { name: PFDVars.fcuEisRightBaroRaw, type: SimVarValueType.Number }], + ['fcuEisRightBaroHpaRaw', { name: PFDVars.fcuEisRightBaroHpaRaw, type: SimVarValueType.Number }], + ['fcuDiscreteWord1Raw', { name: PFDVars.fcuDiscreteWord1Raw, type: SimVarValueType.Number }], + ['fcuDiscreteWord2Raw', { name: PFDVars.fcuDiscreteWord2Raw, type: SimVarValueType.Number }], ]); public constructor(bus: ArincEventBus) { diff --git a/fbw-a32nx/src/systems/instruments/src/PFD/shared/SimplaneValueProvider.ts b/fbw-a32nx/src/systems/instruments/src/PFD/shared/SimplaneValueProvider.ts deleted file mode 100644 index 5bd89b4827fe..000000000000 --- a/fbw-a32nx/src/systems/instruments/src/PFD/shared/SimplaneValueProvider.ts +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2021-2023 FlyByWire Simulations -// -// SPDX-License-Identifier: GPL-3.0 - -import { Instrument, Publisher } from '@microsoft/msfs-sdk'; -import { ArincEventBus } from '@flybywiresim/fbw-sdk'; - -export type SimplaneBaroMode = 'QNH' | 'QFE' | 'STD'; - -export interface SimplaneValues { - units: string; - pressure: number; - machActive: boolean; - holdValue: number; - airSpeedHoldValue: number; - isSelectedSpeed: boolean; - selectedAltitude: number; - baroMode: SimplaneBaroMode; -} -export class SimplaneValueProvider implements Instrument { - private publisher: Publisher; - - constructor(private readonly bus: ArincEventBus) { - this.publisher = this.bus.getPublisher(); - } - - /** @inheritdoc */ - public init(): void { - // noop - } - - /** @inheritdoc */ - public onUpdate(): void { - const units = Simplane.getPressureSelectedUnits(); - const pressure = Simplane.getPressureValue(units); - const isSelected = Simplane.getAutoPilotAirspeedSelected(); - const isMach = Simplane.getAutoPilotMachModeActive(); - const selectedAltitude = Simplane.getAutoPilotDisplayedAltitudeLockValue(); - const holdValue = isMach ? Simplane.getAutoPilotMachHoldValue() : Simplane.getAutoPilotAirspeedHoldValue(); - const baroMode = Simplane.getPressureSelectedMode(Aircraft.A320_NEO) as 'QNH' | 'QFE' | 'STD'; - - this.publisher.pub('units', units); - this.publisher.pub('pressure', pressure); - this.publisher.pub('isSelectedSpeed', isSelected); - this.publisher.pub('machActive', isMach); - this.publisher.pub('holdValue', holdValue); - this.publisher.pub('selectedAltitude', selectedAltitude); - this.publisher.pub('baroMode', baroMode); - } -} diff --git a/fbw-a32nx/src/wasm/fbw_a320/build.sh b/fbw-a32nx/src/wasm/fbw_a320/build.sh index f6aeee7891ff..95b657c1e36f 100755 --- a/fbw-a32nx/src/wasm/fbw_a320/build.sh +++ b/fbw-a32nx/src/wasm/fbw_a320/build.sh @@ -106,6 +106,10 @@ clang++ \ "${DIR}/src/fcdc/Fcdc.cpp" \ -I "${DIR}/src/fac" \ "${DIR}/src/fac/Fac.cpp" \ + -I "${DIR}/src/fmgc" \ + "${DIR}/src/fmgc/Fmgc.cpp" \ + -I "${DIR}/src/fcu" \ + "${DIR}/src/fcu/Fcu.cpp" \ -I "${DIR}/src/failures" \ "${DIR}/src/failures/FailuresConsumer.cpp" \ -I "${DIR}/src/utils" \ @@ -114,10 +118,6 @@ clang++ \ "${DIR}/src/utils/PulseNode.cpp" \ "${DIR}/src/utils/HysteresisNode.cpp" \ -I "${DIR}/src/model" \ - "${DIR}/src/model/AutopilotLaws_data.cpp" \ - "${DIR}/src/model/AutopilotLaws.cpp" \ - "${DIR}/src/model/AutopilotStateMachine_data.cpp" \ - "${DIR}/src/model/AutopilotStateMachine.cpp" \ "${DIR}/src/model/Autothrust_data.cpp" \ "${DIR}/src/model/Autothrust.cpp" \ "${DIR}/src/model/Double2MultiWord.cpp" \ @@ -132,6 +132,10 @@ clang++ \ "${DIR}/src/model/LateralDirectLaw.cpp" \ "${DIR}/src/model/FacComputer_data.cpp" \ "${DIR}/src/model/FacComputer.cpp" \ + "${DIR}/src/model/FmgcComputer_data.cpp" \ + "${DIR}/src/model/FmgcComputer.cpp" \ + "${DIR}/src/model/FcuComputer_data.cpp" \ + "${DIR}/src/model/FcuComputer.cpp" \ "${DIR}/src/model/look1_binlxpw.cpp" \ "${DIR}/src/model/look2_binlcpw.cpp" \ "${DIR}/src/model/look2_binlxpw.cpp" \ diff --git a/fbw-a32nx/src/wasm/fbw_a320/src/FlightDataRecorder.cpp b/fbw-a32nx/src/wasm/fbw_a320/src/FlightDataRecorder.cpp index 9dca8e10fb10..c4c5d816c78f 100644 --- a/fbw-a32nx/src/wasm/fbw_a320/src/FlightDataRecorder.cpp +++ b/fbw-a32nx/src/wasm/fbw_a320/src/FlightDataRecorder.cpp @@ -37,11 +37,7 @@ void FlightDataRecorder::initialize() { std::cout << "WASM: Flight Data Recorder Configuration : Interface Version = " << INTERFACE_VERSION << std::endl; } -void FlightDataRecorder::update(AutopilotStateMachine* autopilotStateMachine, - AutopilotLawsModelClass* autopilotLaws, - Autothrust* autoThrust, - const EngineData& engineData, - const AdditionalData& additionalData) { +void FlightDataRecorder::update(const EngineData& engineData, const AdditionalData& additionalData) { // check if enabled if (!isEnabled) { return; @@ -51,9 +47,6 @@ void FlightDataRecorder::update(AutopilotStateMachine* autopilotStateMachine, manageFlightDataRecorderFiles(); // write data to file - fileStream->write((char*)(&autopilotStateMachine->getExternalOutputs().out), sizeof(autopilotStateMachine->getExternalOutputs().out)); - fileStream->write((char*)(&autopilotLaws->getExternalOutputs().out.output), sizeof(autopilotLaws->getExternalOutputs().out.output)); - fileStream->write((char*)(&autoThrust->getExternalOutputs().out), sizeof(autoThrust->getExternalOutputs().out)); fileStream->write((char*)(&engineData), sizeof(engineData)); fileStream->write((char*)(&additionalData), sizeof(additionalData)); } diff --git a/fbw-a32nx/src/wasm/fbw_a320/src/FlightDataRecorder.h b/fbw-a32nx/src/wasm/fbw_a320/src/FlightDataRecorder.h index 836e2570a4ec..343e2fafe7e7 100644 --- a/fbw-a32nx/src/wasm/fbw_a320/src/FlightDataRecorder.h +++ b/fbw-a32nx/src/wasm/fbw_a320/src/FlightDataRecorder.h @@ -16,11 +16,7 @@ class FlightDataRecorder { void initialize(); - void update(AutopilotStateMachine* autopilotStateMachine, - AutopilotLawsModelClass* autopilotLaws, - Autothrust* autoThrust, - const EngineData& engineData, - const AdditionalData& additionalData); + void update(const EngineData& engineData, const AdditionalData& additionalData); void terminate(); diff --git a/fbw-a32nx/src/wasm/fbw_a320/src/FlyByWireInterface.cpp b/fbw-a32nx/src/wasm/fbw_a320/src/FlyByWireInterface.cpp index bfa3f7288aee..5e0a9ee28571 100644 --- a/fbw-a32nx/src/wasm/fbw_a320/src/FlyByWireInterface.cpp +++ b/fbw-a32nx/src/wasm/fbw_a320/src/FlyByWireInterface.cpp @@ -25,20 +25,15 @@ bool FlyByWireInterface::connect() { // initialize failures handler failuresConsumer.initialize(); - // initialize model - autopilotStateMachine.initialize(); - autopilotLaws.initialize(); - autoThrust.initialize(); - // initialize flight data recorder flightDataRecorder.initialize(); // connect to sim connect - bool success = simConnectInterface.connect( - clientDataEnabled, autopilotStateMachineEnabled, autopilotLawsEnabled, flyByWireEnabled, elacDisabled, secDisabled, facDisabled, - throttleAxis, spoilersHandler, flightControlsKeyChangeAileron, flightControlsKeyChangeElevator, flightControlsKeyChangeRudder, - disableXboxCompatibilityRudderAxisPlusMinus, enableRudder2AxisMode, idMinimumSimulationRate->get(), idMaximumSimulationRate->get(), - limitSimulationRateByPerformance); + bool success = + simConnectInterface.connect(clientDataEnabled, elacDisabled, secDisabled, facDisabled, fmgcDisabled, fcuDisabled, throttleAxis, + spoilersHandler, flightControlsKeyChangeAileron, flightControlsKeyChangeElevator, + flightControlsKeyChangeRudder, disableXboxCompatibilityRudderAxisPlusMinus, enableRudder2AxisMode, + idMinimumSimulationRate->get(), idMaximumSimulationRate->get(), limitSimulationRateByPerformance); // request data if (!simConnectInterface.requestData()) { @@ -53,10 +48,6 @@ void FlyByWireInterface::disconnect() { // disconnect from sim connect simConnectInterface.disconnect(); - // terminate model - autopilotStateMachine.terminate(); - autopilotLaws.terminate(); - // terminate flight data recorder flightDataRecorder.terminate(); @@ -88,9 +79,6 @@ bool FlyByWireInterface::update(double sampleTime) { // update radio receivers result &= updateRadioReceiver(sampleTime); - // handle initialization - result &= handleFcuInitialization(calculatedSampleTime); - // do not process laws in pause or slew if (simData.slew_on) { wasInSlew = true; @@ -102,12 +90,6 @@ bool FlyByWireInterface::update(double sampleTime) { // update altimeter setting result &= updateAltimeterSetting(calculatedSampleTime); - // update autopilot state machine - result &= updateAutopilotStateMachine(calculatedSampleTime); - - // update autopilot laws - result &= updateAutopilotLaws(calculatedSampleTime); - // update fly-by-wire result &= updateFlyByWire(calculatedSampleTime); @@ -126,10 +108,24 @@ bool FlyByWireInterface::update(double sampleTime) { result &= updateSfcc(i); } + for (int i = 0; i < 2; i++) { + result &= updateFadec(i); + } + + for (int i = 0; i < 2; i++) { + result &= updateIls(i); + } + for (int i = 0; i < 3; i++) { result &= updateAdirs(i); } + result &= updateFcu(calculatedSampleTime); + + for (int i = 0; i < 2; i++) { + result &= updateFmgc(calculatedSampleTime, i); + } + for (int i = 0; i < 2; i++) { result &= updateElac(calculatedSampleTime, i); } @@ -157,13 +153,10 @@ bool FlyByWireInterface::update(double sampleTime) { // update spoilers result &= updateSpoilers(calculatedSampleTime); - // update FO side with FO Sync ON - result &= updateFoSide(calculatedSampleTime); - // do not further process when active pause is on if (!simConnectInterface.isSimInActivePause()) { // update flight data recorder - flightDataRecorder.update(&autopilotStateMachine, &autopilotLaws, &autoThrust, engineData, additionalData); + flightDataRecorder.update(engineData, additionalData); } // if default AP is on -> disconnect it @@ -186,28 +179,23 @@ void FlyByWireInterface::loadConfiguration() { // -------------------------------------------------------------------------- // load values - model - autopilotStateMachineEnabled = INITypeConversion::getBoolean(iniStructure, "MODEL", "AUTOPILOT_STATE_MACHINE_ENABLED", true); - autopilotLawsEnabled = INITypeConversion::getBoolean(iniStructure, "MODEL", "AUTOPILOT_LAWS_ENABLED", true); - autoThrustEnabled = INITypeConversion::getBoolean(iniStructure, "MODEL", "AUTOTHRUST_ENABLED", true); - flyByWireEnabled = INITypeConversion::getBoolean(iniStructure, "MODEL", "FLY_BY_WIRE_ENABLED", true); elacDisabled = INITypeConversion::getInteger(iniStructure, "MODEL", "ELAC_DISABLED", -1); secDisabled = INITypeConversion::getInteger(iniStructure, "MODEL", "SEC_DISABLED", -1); facDisabled = INITypeConversion::getInteger(iniStructure, "MODEL", "FAC_DISABLED", -1); + fcuDisabled = INITypeConversion::getBoolean(iniStructure, "MODEL", "FCU_DISABLED", false); + fmgcDisabled = INITypeConversion::getInteger(iniStructure, "MODEL", "FMGC_DISABLED", -1); tailstrikeProtectionEnabled = INITypeConversion::getBoolean(iniStructure, "MODEL", "TAILSTRIKE_PROTECTION_ENABLED", false); // if any model is deactivated we need to enable client data - clientDataEnabled = (elacDisabled != -1 || secDisabled != -1 || facDisabled != -1 || !autopilotStateMachineEnabled || - !autopilotLawsEnabled || !autoThrustEnabled || !flyByWireEnabled); + clientDataEnabled = (elacDisabled != -1 || secDisabled != -1 || facDisabled != -1 || fmgcDisabled != -1 || fcuDisabled); // print configuration into console std::cout << "WASM: MODEL : CLIENT_DATA_ENABLED (auto) = " << clientDataEnabled << std::endl; - std::cout << "WASM: MODEL : AUTOPILOT_STATE_MACHINE_ENABLED = " << autopilotStateMachineEnabled << std::endl; - std::cout << "WASM: MODEL : AUTOPILOT_LAWS_ENABLED = " << autopilotLawsEnabled << std::endl; - std::cout << "WASM: MODEL : AUTOTHRUST_ENABLED = " << autoThrustEnabled << std::endl; - std::cout << "WASM: MODEL : FLY_BY_WIRE_ENABLED = " << flyByWireEnabled << std::endl; std::cout << "WASM: MODEL : ELAC_DISABLED = " << elacDisabled << std::endl; std::cout << "WASM: MODEL : SEC_DISABLED = " << secDisabled << std::endl; std::cout << "WASM: MODEL : FAC_DISABLED = " << facDisabled << std::endl; + std::cout << "WASM: MODEL : FCU_DISABLED = " << fcuDisabled << std::endl; + std::cout << "WASM: MODEL : FMGC_DISABLED = " << fmgcDisabled << std::endl; std::cout << "WASM: MODEL : TAILSTRIKE_PROTECTION_ENABLED = " << tailstrikeProtectionEnabled << std::endl; // -------------------------------------------------------------------------- @@ -316,43 +304,10 @@ void FlyByWireInterface::setupLocalVariables() { idSideStickPositionX = std::make_unique("A32NX_SIDESTICK_POSITION_X"); idSideStickPositionY = std::make_unique("A32NX_SIDESTICK_POSITION_Y"); idRudderPedalPosition = std::make_unique("A32NX_RUDDER_PEDAL_POSITION"); - idAutopilotNosewheelDemand = std::make_unique("A32NX_AUTOPILOT_NOSEWHEEL_DEMAND"); - - // register L variable for custom fly-by-wire interface - idFmaLateralMode = std::make_unique("A32NX_FMA_LATERAL_MODE"); - idFmaLateralArmed = std::make_unique("A32NX_FMA_LATERAL_ARMED"); - idFmaVerticalMode = std::make_unique("A32NX_FMA_VERTICAL_MODE"); - idFmaVerticalArmed = std::make_unique("A32NX_FMA_VERTICAL_ARMED"); - idFmaExpediteModeActive = std::make_unique("A32NX_FMA_EXPEDITE_MODE"); - idFmaSpeedProtectionActive = std::make_unique("A32NX_FMA_SPEED_PROTECTION_MODE"); - idFmaSoftAltModeActive = std::make_unique("A32NX_FMA_SOFT_ALT_MODE"); - idFmaCruiseAltModeActive = std::make_unique("A32NX_FMA_CRUISE_ALT_MODE"); - idFmaApproachCapability = std::make_unique("A32NX_ApproachCapability"); - idFmaTripleClick = std::make_unique("A32NX_FMA_TRIPLE_CLICK"); - idFmaModeReversion = std::make_unique("A32NX_FMA_MODE_REVERSION"); - - idAutopilotTcasMessageDisarm = std::make_unique("A32NX_AUTOPILOT_TCAS_MESSAGE_DISARM"); - idAutopilotTcasMessageRaInhibited = std::make_unique("A32NX_AUTOPILOT_TCAS_MESSAGE_RA_INHIBITED"); - idAutopilotTcasMessageTrkFpaDeselection = std::make_unique("A32NX_AUTOPILOT_TCAS_MESSAGE_TRK_FPA_DESELECTION"); - - // register L variable for flight director - idFlightDirectorBank = std::make_unique("A32NX_FLIGHT_DIRECTOR_BANK"); - idFlightDirectorPitch = std::make_unique("A32NX_FLIGHT_DIRECTOR_PITCH"); - idFlightDirectorYaw = std::make_unique("A32NX_FLIGHT_DIRECTOR_YAW"); - - // register L variables for autoland warning - idAutopilotAutolandWarning = std::make_unique("A32NX_AUTOPILOT_AUTOLAND_WARNING"); // register L variables for relative speed to ground idAutopilot_H_dot_radio = std::make_unique("A32NX_AUTOPILOT_H_DOT_RADIO"); - // register L variables for autopilot - idAutopilotActiveAny = std::make_unique("A32NX_AUTOPILOT_ACTIVE"); - idAutopilotActive_1 = std::make_unique("A32NX_AUTOPILOT_1_ACTIVE"); - idAutopilotActive_2 = std::make_unique("A32NX_AUTOPILOT_2_ACTIVE"); - - idAutopilotAutothrustMode = std::make_unique("A32NX_AUTOPILOT_AUTOTHRUST_MODE"); - // register L variables for flight guidance idFwcFlightPhase = std::make_unique("A32NX_FWC_FLIGHT_PHASE"); idFmgcFlightPhase = std::make_unique("A32NX_FMGC_FLIGHT_PHASE"); @@ -393,18 +348,6 @@ void FlyByWireInterface::setupLocalVariables() { idTcasTargetRedMin = std::make_unique("A32NX_TCAS_VSPEED_RED:1"); idTcasTargetRedMax = std::make_unique("A32NX_TCAS_VSPEED_RED:2"); - idFcuTrkFpaModeActive = std::make_unique("A32NX_TRK_FPA_MODE_ACTIVE"); - idFcuSelectedFpa = std::make_unique("A32NX_AUTOPILOT_FPA_SELECTED"); - idFcuSelectedVs = std::make_unique("A32NX_AUTOPILOT_VS_SELECTED"); - idFcuSelectedHeading = std::make_unique("A32NX_AUTOPILOT_HEADING_SELECTED"); - - idFcuLocModeActive = std::make_unique("A32NX_FCU_LOC_MODE_ACTIVE"); - idFcuApprModeActive = std::make_unique("A32NX_FCU_APPR_MODE_ACTIVE"); - idFcuHeadingSync = std::make_unique("A32NX_FCU_HEADING_SYNC"); - idFcuModeReversionActive = std::make_unique("A32NX_FCU_MODE_REVERSION_ACTIVE"); - idFcuModeReversionTrkFpaActive = std::make_unique("A32NX_FCU_MODE_REVERSION_TRK_FPA_ACTIVE"); - idFcuModeReversionTargetFpm = std::make_unique("A32NX_FCU_MODE_REVERSION_TARGET_FPM"); - idThrottlePosition3d_1 = std::make_unique("A32NX_3D_THROTTLE_LEVER_POSITION_1"); idThrottlePosition3d_2 = std::make_unique("A32NX_3D_THROTTLE_LEVER_POSITION_2"); @@ -732,6 +675,10 @@ void FlyByWireInterface::setupLocalVariables() { idElecBat1HotBusPowered = std::make_unique("A32NX_ELEC_DC_HOT_1_BUS_IS_POWERED"); idElecBat2HotBusPowered = std::make_unique("A32NX_ELEC_DC_HOT_2_BUS_IS_POWERED"); + idElecBtc1Closed = std::make_unique("A32NX_ELEC_CONTACTOR_11XU1_IS_CLOSED"); + idElecBtc2Closed = std::make_unique("A32NX_ELEC_CONTACTOR_11XU2_IS_CLOSED"); + idElecDcBatToDc2ContactorClosed = std::make_unique("A32NX_ELEC_CONTACTOR_1PC2_IS_CLOSED"); + idHydYellowSystemPressure = std::make_unique("A32NX_HYD_YELLOW_SYSTEM_1_SECTION_PRESSURE"); idHydGreenSystemPressure = std::make_unique("A32NX_HYD_GREEN_SYSTEM_1_SECTION_PRESSURE"); idHydBlueSystemPressure = std::make_unique("A32NX_HYD_BLUE_SYSTEM_1_SECTION_PRESSURE"); @@ -741,63 +688,93 @@ void FlyByWireInterface::setupLocalVariables() { idCaptPriorityButtonPressed = std::make_unique("A32NX_PRIORITY_TAKEOVER:1"); idFoPriorityButtonPressed = std::make_unique("A32NX_PRIORITY_TAKEOVER:2"); -} -bool FlyByWireInterface::handleFcuInitialization(double sampleTime) { - // init should be run only once and only when is ready is signaled - if (wasFcuInitialized || !idIsReady->get()) { - return true; - } - - // get sim data - auto simData = simConnectInterface.getSimData(); + for (int i = 0; i < 2; i++) { + std::string idString = std::to_string(i + 1); - // remember simulation of ready signal - if (simulationTimeReady == 0.0) { - simulationTimeReady = simData.simulationTime; - } - - // time since ready - auto timeSinceReady = simData.simulationTime - simulationTimeReady; - - // determine if we need to run init code - if (idStartState->get() >= 5 && timeSinceReady > 6.0) { - // init FCU for in flight configuration - double targetAltitude = std::round(simData.H_ind_ft / 1000.0) * 1000.0; - double targetHeading = std::fmod(std::round(simData.Psi_magnetic_deg / 10.0) * 10.0, 360.0); - simConnectInterface.sendEvent(SimConnectInterface::A32NX_FCU_SPD_PUSH); - simConnectInterface.sendEvent(SimConnectInterface::A32NX_FCU_HDG_SET, targetHeading); - simConnectInterface.sendEvent(SimConnectInterface::A32NX_FCU_HDG_PULL); - simConnectInterface.sendEvent(SimConnectInterface::A32NX_FCU_ALT_SET, targetAltitude); - simConnectInterface.sendEvent(SimConnectInterface::A32NX_FCU_VS_SET, simData.H_ind_ft < targetAltitude ? 1000 : -1000); - simConnectInterface.sendEvent(SimConnectInterface::A32NX_FCU_VS_PULL); - simConnectInterface.sendEvent(SimConnectInterface::A32NX_FCU_ATHR_PUSH); - simConnectInterface.sendEvent(SimConnectInterface::A32NX_FCU_AP_1_PUSH); - idFcuHeadingSync->set(0); - idFcuModeReversionActive->set(0); - idFcuModeReversionTargetFpm->set(simData.H_ind_ft < targetAltitude ? 1000 : -1000); - wasFcuInitialized = true; - } else if (idStartState->get() == 4 && timeSinceReady > 1.0) { - // init FCU for on runway -> ready for take-off - double targetHeading = std::fmod(std::round(simData.Psi_magnetic_deg), 360.0); - simConnectInterface.sendEvent(SimConnectInterface::A32NX_FCU_SPD_SET, 150); - simConnectInterface.sendEvent(SimConnectInterface::A32NX_FCU_SPD_PULL); - simConnectInterface.sendEvent(SimConnectInterface::A32NX_FCU_HDG_SET, targetHeading); - simConnectInterface.sendEvent(SimConnectInterface::A32NX_FCU_HDG_PULL); - simConnectInterface.sendEvent(SimConnectInterface::A32NX_FCU_ALT_SET, 15000); - wasFcuInitialized = true; - } else if (idStartState->get() < 4 && timeSinceReady > 1.0) { - // init FCU for on ground -> default FCU values after power-on - simConnectInterface.sendEvent(SimConnectInterface::A32NX_FCU_SPD_SET, 100); - simConnectInterface.sendEvent(SimConnectInterface::A32NX_FCU_SPD_PULL); - simConnectInterface.sendEvent(SimConnectInterface::A32NX_FCU_HDG_SET, 0); - simConnectInterface.sendEvent(SimConnectInterface::A32NX_FCU_HDG_PULL); - simConnectInterface.sendEvent(SimConnectInterface::A32NX_FCU_ALT_SET, 100); - wasFcuInitialized = true; - } + idFmgcHealthy[i] = std::make_unique("A32NX_FMGC_" + idString + "_HEALTHY"); + idFmgcAthrEngaged[i] = std::make_unique("A32NX_FMGC_" + idString + "_ATHR_ENGAGED"); + idFmgcFdEngaged[i] = std::make_unique("A32NX_FMGC_" + idString + "_FD_ENGAGED"); + idFmgcApEngaged[i] = std::make_unique("A32NX_FMGC_" + idString + "_AP_ENGAGED"); + + idFmgcABusPfdSelectedSpeed[i] = std::make_unique("A32NX_FMGC_" + idString + "_PFD_SELECTED_SPEED"); + idFmgcABusRollFdCommand[i] = std::make_unique("A32NX_FMGC_" + idString + "_ROLL_FD_COMMAND"); + idFmgcABusPitchFdCommand[i] = std::make_unique("A32NX_FMGC_" + idString + "_PITCH_FD_COMMAND"); + idFmgcABusYawFdCommand[i] = std::make_unique("A32NX_FMGC_" + idString + "_YAW_FD_COMMAND"); + idFmgcABusDiscreteWord5[i] = std::make_unique("A32NX_FMGC_" + idString + "_DISCRETE_WORD_5"); + idFmgcABusDiscreteWord4[i] = std::make_unique("A32NX_FMGC_" + idString + "_DISCRETE_WORD_4"); + idFmgcABusAtsDiscreteWord[i] = std::make_unique("A32NX_FMGC_" + idString + "_ATS_DISCRETE_WORD"); + idFmgcABusAtsFmaDiscreteWord[i] = std::make_unique("A32NX_FMGC_" + idString + "_ATS_FMA_DISCRETE_WORD"); + idFmgcABusDiscreteWord3[i] = std::make_unique("A32NX_FMGC_" + idString + "_DISCRETE_WORD_3"); + idFmgcABusDiscreteWord1[i] = std::make_unique("A32NX_FMGC_" + idString + "_DISCRETE_WORD_1"); + idFmgcABusDiscreteWord2[i] = std::make_unique("A32NX_FMGC_" + idString + "_DISCRETE_WORD_2"); + idFmgcABusDiscreteWord6[i] = std::make_unique("A32NX_FMGC_" + idString + "_DISCRETE_WORD_6"); + } + + // FCU Lvars + idLightsTest = std::make_unique("A32NX_OVHD_INTLT_ANN"); + + idFcuSelectedHeading = std::make_unique("A32NX_FCU_SELECTED_HEADING"); + idFcuSelectedAltitude = std::make_unique("A32NX_FCU_SELECTED_ALTITUDE"); + idFcuSelectedAirspeed = std::make_unique("A32NX_FCU_SELECTED_AIRSPEED"); + idFcuSelectedVerticalSpeed = std::make_unique("A32NX_FCU_SELECTED_VERTICAL_SPEED"); + idFcuSelectedTrack = std::make_unique("A32NX_FCU_SELECTED_TRACK"); + idFcuSelectedFpa = std::make_unique("A32NX_FCU_SELECTED_FPA"); + idFcuAtsDiscreteWord = std::make_unique("A32NX_FCU_ATS_DISCRETE_WORD"); + idFcuAtsFmaDiscreteWord = std::make_unique("A32NX_FCU_ATS_FMA_DISCRETE_WORD"); + idFcuEisLeftDiscreteWord1 = std::make_unique("A32NX_FCU_LEFT_EIS_DISCRETE_WORD_1"); + idFcuEisLeftDiscreteWord2 = std::make_unique("A32NX_FCU_LEFT_EIS_DISCRETE_WORD_2"); + idFcuEisLeftBaro = std::make_unique("A32NX_FCU_LEFT_EIS_BARO"); + idFcuEisLeftBaroHpa = std::make_unique("A32NX_FCU_LEFT_EIS_BARO_HPA"); + idFcuEisRightDiscreteWord1 = std::make_unique("A32NX_FCU_RIGHT_EIS_DISCRETE_WORD_1"); + idFcuEisRightDiscreteWord2 = std::make_unique("A32NX_FCU_RIGHT_EIS_DISCRETE_WORD_2"); + idFcuEisRightBaro = std::make_unique("A32NX_FCU_RIGHT_EIS_BARO"); + idFcuEisRightBaroHpa = std::make_unique("A32NX_FCU_RIGHT_EIS_BARO_HPA"); + idFcuDiscreteWord1 = std::make_unique("A32NX_FCU_DISCRETE_WORD_1"); + idFcuDiscreteWord2 = std::make_unique("A32NX_FCU_DISCRETE_WORD_2"); - // success - return true; + for (int i = 0; i < 2; i++) { + std::string idString = i == 0 ? "L" : "R"; + + idFcuEisPanelEfisMode[i] = std::make_unique("A32NX_FCU_EFIS_" + idString + "_EFIS_MODE"); + idFcuEisPanelEfisRange[i] = std::make_unique("A32NX_FCU_EFIS_" + idString + "_EFIS_RANGE"); + idFcuEisPanelNavaid1Mode[i] = std::make_unique("A32NX_FCU_EFIS_" + idString + "_NAVAID_1_MODE"); + idFcuEisPanelNavaid2Mode[i] = std::make_unique("A32NX_FCU_EFIS_" + idString + "_NAVAID_2_MODE"); + idFcuEisPanelBaroIsInhg[i] = std::make_unique("A32NX_FCU_EFIS_" + idString + "_BARO_IS_INHG"); + idFcuEisDisplayBaroValueMode[i] = std::make_unique("A32NX_FCU_EFIS_" + idString + "_DISPLAY_BARO_VALUE_MODE"); + idFcuEisDisplayBaroValue[i] = std::make_unique("A32NX_FCU_EFIS_" + idString + "_DISPLAY_BARO_VALUE"); + idFcuEisDisplayBaroMode[i] = std::make_unique("A32NX_FCU_EFIS_" + idString + "_DISPLAY_BARO_MODE"); + + idFcuEisPanelFdLightOn[i] = std::make_unique("A32NX_FCU_EFIS_" + idString + "_FD_LIGHT_ON"); + idFcuEisPanelLsLightOn[i] = std::make_unique("A32NX_FCU_EFIS_" + idString + "_LS_LIGHT_ON"); + idFcuEisPanelCstrLightOn[i] = std::make_unique("A32NX_FCU_EFIS_" + idString + "_CSTR_LIGHT_ON"); + idFcuEisPanelWptLightOn[i] = std::make_unique("A32NX_FCU_EFIS_" + idString + "_WPT_LIGHT_ON"); + idFcuEisPanelVordLightOn[i] = std::make_unique("A32NX_FCU_EFIS_" + idString + "_VORD_LIGHT_ON"); + idFcuEisPanelNdbLightOn[i] = std::make_unique("A32NX_FCU_EFIS_" + idString + "_NDB_LIGHT_ON"); + idFcuEisPanelArptLightOn[i] = std::make_unique("A32NX_FCU_EFIS_" + idString + "_ARPT_LIGHT_ON"); + } + idFcuAfsPanelAltIncrement1000 = std::make_unique("A32NX_FCU_ALT_INCREMENT_1000"); + + idFcuAfsPanelAp1LightOn = std::make_unique("A32NX_FCU_AP_1_LIGHT_ON"); + idFcuAfsPanelAp2LightOn = std::make_unique("A32NX_FCU_AP_2_LIGHT_ON"); + idFcuAfsPanelAthrLightOn = std::make_unique("A32NX_FCU_ATHR_LIGHT_ON"); + idFcuAfsPanelLocLightOn = std::make_unique("A32NX_FCU_LOC_LIGHT_ON"); + idFcuAfsPanelExpedLightOn = std::make_unique("A32NX_FCU_EXPED_LIGHT_ON"); + idFcuAfsPanelApprLightOn = std::make_unique("A32NX_FCU_APPR_LIGHT_ON"); + idFcuAfsDisplayTrkFpaMode = std::make_unique("A32NX_FCU_AFS_DISPLAY_TRK_FPA_MODE"); + idFcuAfsDisplayMachMode = std::make_unique("A32NX_FCU_AFS_DISPLAY_MACH_MODE"); + idFcuAfsDisplaySpdMachValue = std::make_unique("A32NX_FCU_AFS_DISPLAY_SPD_MACH_VALUE"); + idFcuAfsDisplaySpdMachDashes = std::make_unique("A32NX_FCU_AFS_DISPLAY_SPD_MACH_DASHES"); + idFcuAfsDisplaySpdMachManaged = std::make_unique("A32NX_FCU_AFS_DISPLAY_SPD_MACH_MANAGED"); + idFcuAfsDisplayHdgTrkValue = std::make_unique("A32NX_FCU_AFS_DISPLAY_HDG_TRK_VALUE"); + idFcuAfsDisplayHdgTrkDashes = std::make_unique("A32NX_FCU_AFS_DISPLAY_HDG_TRK_DASHES"); + idFcuAfsDisplayHdgTrkManaged = std::make_unique("A32NX_FCU_AFS_DISPLAY_HDG_TRK_MANAGED"); + idFcuAfsDisplayAltValue = std::make_unique("A32NX_FCU_AFS_DISPLAY_ALT_VALUE"); + idFcuAfsDisplayLvlChManaged = std::make_unique("A32NX_FCU_AFS_DISPLAY_LVL_CH_MANAGED"); + idFcuAfsDisplayVsFpaValue = std::make_unique("A32NX_FCU_AFS_DISPLAY_VS_FPA_VALUE"); + idFcuAfsDisplayVsFpaDashes = std::make_unique("A32NX_FCU_AFS_DISPLAY_VS_FPA_DASHES"); + + idFcuHealthy = std::make_unique("A32NX_FCU_HEALTHY"); } bool FlyByWireInterface::readDataAndLocalVariables(double sampleTime) { @@ -809,6 +786,10 @@ bool FlyByWireInterface::readDataAndLocalVariables(double sampleTime) { simConnectInterface.resetSimInputRudderTrim(); + simConnectInterface.resetFcuFrontPanelInputs(); + + simConnectInterface.resetSimInputThrottles(); + // set logging options simConnectInterface.setLoggingFlightControlsEnabled(idLoggingFlightControlsEnabled->get() == 1); simConnectInterface.setLoggingThrottlesEnabled(idLoggingThrottlesEnabled->get() == 1); @@ -836,49 +817,6 @@ bool FlyByWireInterface::readDataAndLocalVariables(double sampleTime) { // update simulation rate limits simConnectInterface.updateSimulationRateLimits(idMinimumSimulationRate->get(), idMaximumSimulationRate->get()); - // read local variables and update client data - // update client data for flight guidance - if (!autopilotStateMachineEnabled || !autopilotLawsEnabled) { - ClientDataLocalVariables clientDataLocalVariables = { - idFmgcFlightPhase->get(), - idFmgcV2->get(), - idFmgcV_APP->get(), - facsDiscreteOutputs[0].fac_healthy ? facsBusOutputs[0].v_ls_kn.Data : facsBusOutputs[1].v_ls_kn.Data, - facsDiscreteOutputs[0].fac_healthy ? facsBusOutputs[0].v_max_kn.Data : facsBusOutputs[1].v_max_kn.Data, - idFlightGuidanceAvailable->get(), - idFmgcAltitudeConstraint->get(), - fmThrustReductionAltitude->valueOr(0), - fmThrustReductionAltitudeGoAround->valueOr(0), - fmAccelerationAltitude->valueOr(0), - fmAccelerationAltitudeEngineOut->valueOr(0), - fmAccelerationAltitudeGoAround->valueOr(0), - fmAccelerationAltitudeGoAroundEngineOut->valueOr(0), - idFmgcCruiseAltitude->get(), - simConnectInterface.getSimInputAutopilot().DIR_TO_trigger, - idFcuTrkFpaModeActive->get(), - idFcuSelectedVs->get(), - idFcuSelectedFpa->get(), - idFcuSelectedHeading->get(), - idFlightGuidanceCrossTrackError->get(), - idFlightGuidanceTrackAngleError->get(), - idFlightGuidancePhiCommand->get(), - idFlightGuidancePhiLimit->get(), - static_cast(idFlightGuidanceRequestedVerticalMode->get()), - idFlightGuidanceTargetAltitude->get(), - idFlightGuidanceTargetVerticalSpeed->get(), - static_cast(idFmRnavAppSelected->get()), - static_cast(idFmFinalCanEngage->get()), - simData.speed_slot_index == 2, - autopilotLawsOutput.Phi_loc_c, - static_cast(idTcasFault->get()), - static_cast(getTcasModeAvailable()), - getTcasAdvisoryState(), - idTcasTargetGreenMin->get(), - idTcasTargetGreenMax->get(), - autopilotLawsOutput.flare_law.condition_Flare}; - simConnectInterface.setClientDataLocalVariables(clientDataLocalVariables); - } - // detect pause if ((simData.simulationTime == previousSimulationTime) || (simData.simulationTime < 0.2)) { pauseDetected = true; @@ -970,11 +908,13 @@ bool FlyByWireInterface::handleSimulationRate(double sampleTime) { bool elac1ProtActive = false; bool elac2ProtActive = false; + bool apSpeedProtActive = Arinc429Utils::bitFromValueOr(fmgcsBusOutputs[0].fmgc_a_bus.discrete_word_4, 29, false) || + Arinc429Utils::bitFromValueOr(fmgcsBusOutputs[1].fmgc_a_bus.discrete_word_4, 29, false); // check if simulation rate should be reduced if (idPerformanceWarningActive->get() == 1 || abs(simConnectInterface.getSimData().Phi_deg) > 33 || simConnectInterface.getSimData().Theta_deg < -20 || simConnectInterface.getSimData().Theta_deg > 10 || elac1ProtActive || - elac2ProtActive || autopilotStateMachineOutput.speed_protection_mode == 1) { + elac2ProtActive || apSpeedProtActive) { // set target simulation rate targetSimulationRateModified = true; targetSimulationRate = max(1, simData.simulation_rate / 2); @@ -1069,8 +1009,6 @@ bool FlyByWireInterface::updateAdditionalData(double sampleTime) { // Fix missing data for FDR Analysis auto simInputs = simConnectInterface.getSimInput(); - auto clientDataFlyByWire = simConnectInterface.getClientDataFlyByWire(); - auto clientDataAutothrust = simConnectInterface.getClientDataAutothrust(); // controller input data additionalData.inputElevator = simInputs.inputs[0]; @@ -1200,6 +1138,60 @@ bool FlyByWireInterface::updateSfcc(int sfccIndex) { return true; } +bool FlyByWireInterface::updateFadec(int fadecIndex) { + fadecBusOutputs[fadecIndex].selected_tla_deg.SSM = Arinc429SignStatus::NormalOperation; + fadecBusOutputs[fadecIndex].selected_tla_deg.Data = fadecIndex == 0 ? thrustLeverAngle_1->get() : thrustLeverAngle_2->get(); + + double flexTemp = idFmgcFlexTemperature->get(); + fadecBusOutputs[fadecIndex].selected_flex_temp_deg.SSM = + flexTemp > 0 ? Arinc429SignStatus::NormalOperation : Arinc429SignStatus::NoComputedData; + fadecBusOutputs[fadecIndex].selected_flex_temp_deg.Data = flexTemp; + + if (clientDataEnabled) { + simConnectInterface.setClientDataFadec(fadecBusOutputs[fadecIndex], fadecIndex); + } + + return true; +} + +bool FlyByWireInterface::updateIls(int ilsIndex) { + SimData simData = simConnectInterface.getSimData(); + + bool nav_loc_valid; + double nav_loc_error_deg; + bool nav_gs_valid; + double nav_gs_error_deg; + + if (idRadioReceiverUsageEnabled->get()) { + nav_loc_valid = idRadioReceiverLocalizerValid->get() != 0; + nav_loc_error_deg = idRadioReceiverLocalizerDeviation->get(); + nav_gs_valid = idRadioReceiverGlideSlopeValid->get() != 0; + nav_gs_error_deg = idRadioReceiverGlideSlopeDeviation->get(); + } else { + nav_loc_valid = (simData.nav_loc_valid != 0); + nav_loc_error_deg = simData.nav_loc_error_deg; + nav_gs_valid = (simData.nav_gs_valid != 0); + nav_gs_error_deg = simData.nav_gs_error_deg; + } + + ilsBusOutputs[ilsIndex].runway_heading_deg.SSM = nav_loc_valid ? Arinc429SignStatus::NormalOperation : Arinc429SignStatus::NoComputedData; + ilsBusOutputs[ilsIndex].runway_heading_deg.Data = simData.nav_loc_deg; + ilsBusOutputs[ilsIndex].ils_frequency_mhz.SSM = Arinc429SignStatus::NormalOperation; + ilsBusOutputs[ilsIndex].ils_frequency_mhz.Data = 0; + ilsBusOutputs[ilsIndex].localizer_deviation_deg.SSM = + nav_loc_valid ? Arinc429SignStatus::NormalOperation : Arinc429SignStatus::NoComputedData; + ilsBusOutputs[ilsIndex].localizer_deviation_deg.Data = nav_loc_error_deg; + ilsBusOutputs[ilsIndex].glideslope_deviation_deg.SSM = + nav_gs_valid ? Arinc429SignStatus::NormalOperation : Arinc429SignStatus::NoComputedData; + ilsBusOutputs[ilsIndex].glideslope_deviation_deg.Data = nav_gs_error_deg; + + if (clientDataEnabled) { + simConnectInterface.setClientDataIls(ilsBusOutputs[ilsIndex], ilsIndex); + } + + return true; +} + bool FlyByWireInterface::updateAdirs(int adirsIndex) { adrBusOutputs[adirsIndex].altitude_corrected_ft = Arinc429Utils::fromSimVar(idAdrAltitudeCorrected[adirsIndex]->get()); adrBusOutputs[adirsIndex].mach = Arinc429Utils::fromSimVar(idAdrMach[adirsIndex]->get()); @@ -1265,8 +1257,8 @@ bool FlyByWireInterface::updateElac(double sampleTime, int elacIndex) { elacs[elacIndex].modelInputs.in.discrete_inputs.is_unit_1 = elacIndex == 0; elacs[elacIndex].modelInputs.in.discrete_inputs.is_unit_2 = elacIndex == 1; elacs[elacIndex].modelInputs.in.discrete_inputs.opp_axis_pitch_failure = !elacsDiscreteOutputs[oppElacIndex].pitch_axis_ok; - elacs[elacIndex].modelInputs.in.discrete_inputs.ap_1_disengaged = !autopilotStateMachineOutput.enabled_AP1; - elacs[elacIndex].modelInputs.in.discrete_inputs.ap_2_disengaged = !autopilotStateMachineOutput.enabled_AP2; + elacs[elacIndex].modelInputs.in.discrete_inputs.ap_1_disengaged = !fmgcsDiscreteOutputs[0].ap_own_engaged; + elacs[elacIndex].modelInputs.in.discrete_inputs.ap_2_disengaged = !fmgcsDiscreteOutputs[1].ap_own_engaged; elacs[elacIndex].modelInputs.in.discrete_inputs.opp_left_aileron_lost = !elacsDiscreteOutputs[oppElacIndex].left_aileron_ok; elacs[elacIndex].modelInputs.in.discrete_inputs.opp_right_aileron_lost = !elacsDiscreteOutputs[oppElacIndex].right_aileron_ok; elacs[elacIndex].modelInputs.in.discrete_inputs.fac_1_yaw_control_lost = !facsDiscreteOutputs[0].yaw_damper_avail_for_norm_law; @@ -1317,8 +1309,8 @@ bool FlyByWireInterface::updateElac(double sampleTime, int elacIndex) { elacs[elacIndex].modelInputs.in.bus_inputs.ir_1_bus = irBusOutputs[0]; elacs[elacIndex].modelInputs.in.bus_inputs.ir_2_bus = irBusOutputs[1]; elacs[elacIndex].modelInputs.in.bus_inputs.ir_3_bus = irBusOutputs[2]; - elacs[elacIndex].modelInputs.in.bus_inputs.fmgc_1_bus = fmgcBBusOutputs; - elacs[elacIndex].modelInputs.in.bus_inputs.fmgc_2_bus = fmgcBBusOutputs; + elacs[elacIndex].modelInputs.in.bus_inputs.fmgc_1_bus = fmgcsBusOutputs[0].fmgc_b_bus; + elacs[elacIndex].modelInputs.in.bus_inputs.fmgc_2_bus = fmgcsBusOutputs[1].fmgc_b_bus; elacs[elacIndex].modelInputs.in.bus_inputs.ra_1_bus = raBusOutputs[0]; elacs[elacIndex].modelInputs.in.bus_inputs.ra_2_bus = raBusOutputs[1]; elacs[elacIndex].modelInputs.in.bus_inputs.sfcc_1_bus = sfccBusOutputs[0]; @@ -1609,6 +1601,273 @@ bool FlyByWireInterface::updateFcdc(double sampleTime, int fcdcIndex) { return true; } +bool FlyByWireInterface::updateFmgc(double sampleTime, int fmgcIndex) { + const int oppFmgcIndex = fmgcIndex == 0 ? 1 : 0; + SimData simData = simConnectInterface.getSimData(); + SimInputAutopilot simInputAutopilot = simConnectInterface.getSimInputAutopilot(); + + fmgcs[fmgcIndex].modelInputs.in.time.dt = sampleTime; + fmgcs[fmgcIndex].modelInputs.in.time.simulation_time = simData.simulationTime; + fmgcs[fmgcIndex].modelInputs.in.time.monotonic_time = monotonicTime; + + fmgcs[fmgcIndex].modelInputs.in.sim_data.slew_on = wasInSlew; + fmgcs[fmgcIndex].modelInputs.in.sim_data.pause_on = pauseDetected; + fmgcs[fmgcIndex].modelInputs.in.sim_data.tracking_mode_on_override = idExternalOverride->get() == 1; + fmgcs[fmgcIndex].modelInputs.in.sim_data.tailstrike_protection_on = tailstrikeProtectionEnabled; + + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.is_unit_1 = fmgcIndex == 0; + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.athr_opp_engaged = fmgcsDiscreteOutputs[oppFmgcIndex].athr_own_engaged; + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.fcu_athr_button = simConnectInterface.getSimInputThrottles().ATHR_push; + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.athr_instinctive_disc = + simConnectInterface.getSimInputThrottles().ATHR_disconnect || idAutothrustDisconnect->get() == 1; + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.fd_opp_engaged = fmgcsDiscreteOutputs[oppFmgcIndex].fd_own_engaged; + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.ap_opp_engaged = fmgcsDiscreteOutputs[oppFmgcIndex].ap_own_engaged; + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.fcu_ap_button = + fmgcIndex == 0 ? simInputAutopilot.AP_1_push : simInputAutopilot.AP_2_push; + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.ap_instinctive_disc = simInputAutopilot.AP_disconnect || wasInSlew; + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.powersupply_split = + !(idElecBtc1Closed->get() || idElecBtc2Closed->get() || idElecDcBatToDc2ContactorClosed->get()); + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.fcu_opp_healthy = fcuHealthy; + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.fcu_own_healthy = fcuHealthy; + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.fac_opp_healthy = facsDiscreteOutputs[oppFmgcIndex].fac_healthy; + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.fac_own_healthy = facsDiscreteOutputs[fmgcIndex].fac_healthy; + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.fmgc_opp_healthy = fmgcsDiscreteOutputs[oppFmgcIndex].fmgc_healthy; + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.mcdu_opp_fail = false; + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.mcdu_own_fail = false; + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.nav_control_opp = false; + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.nav_control_own = false; + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.fwc_opp_valid = true; + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.fwc_own_valid = true; + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.pfd_opp_valid = true; + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.pfd_own_valid = true; + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.adc_3_switch = false; + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.att_3_switch = false; + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.left_wheel_spd_abv_70_kts = false; + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.right_wheel_spd_abv_70_kts = false; + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.bscu_opp_valid = true; + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.bscu_own_valid = true; + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.nose_gear_pressed_opp = idLgciuNoseGearCompressed[oppFmgcIndex]->get(); + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.nose_gear_pressed_own = idLgciuNoseGearCompressed[fmgcIndex]->get(); + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.elac_opp_ap_disc = !elacsDiscreteOutputs[oppFmgcIndex].ap_1_authorised; + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.elac_own_ap_disc = !elacsDiscreteOutputs[fmgcIndex].ap_1_authorised; + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.eng_opp_stop = false; + fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.eng_own_stop = false; + + fmgcs[fmgcIndex].modelInputs.in.fms_inputs.fm_valid = true; + fmgcs[fmgcIndex].modelInputs.in.fms_inputs.fms_flight_phase = static_cast(idFmgcFlightPhase->get()); + fmgcs[fmgcIndex].modelInputs.in.fms_inputs.selected_approach_type = fmgc_approach_type::None; + fmgcs[fmgcIndex].modelInputs.in.fms_inputs.fms_loc_distance = 0; + fmgcs[fmgcIndex].modelInputs.in.fms_inputs.fms_weight_lbs = 0; + fmgcs[fmgcIndex].modelInputs.in.fms_inputs.fms_cg_percent = 0; + fmgcs[fmgcIndex].modelInputs.in.fms_inputs.lateral_flight_plan_valid = idFlightGuidanceAvailable->get(); + fmgcs[fmgcIndex].modelInputs.in.fms_inputs.nav_capture_condition = idFlightGuidanceCrossTrackError->get() < 1; + fmgcs[fmgcIndex].modelInputs.in.fms_inputs.phi_c_deg = idFlightGuidancePhiCommand->get(); + fmgcs[fmgcIndex].modelInputs.in.fms_inputs.xtk_nmi = idFlightGuidanceCrossTrackError->get(); + fmgcs[fmgcIndex].modelInputs.in.fms_inputs.tke_deg = idFlightGuidanceTrackAngleError->get(); + fmgcs[fmgcIndex].modelInputs.in.fms_inputs.phi_limit_deg = idFlightGuidancePhiLimit->get(); + fmgcs[fmgcIndex].modelInputs.in.fms_inputs.direct_to_nav_engage = false; + fmgcs[fmgcIndex].modelInputs.in.fms_inputs.vertical_flight_plan_valid = false; + fmgcs[fmgcIndex].modelInputs.in.fms_inputs.final_app_can_engage = idFmFinalCanEngage->get(); + fmgcs[fmgcIndex].modelInputs.in.fms_inputs.next_alt_cstr_ft = idFmgcAltitudeConstraint->get(); + fmgcs[fmgcIndex].modelInputs.in.fms_inputs.requested_des_submode = + static_cast(idFlightGuidanceRequestedVerticalMode->get()); + fmgcs[fmgcIndex].modelInputs.in.fms_inputs.alt_profile_tgt_ft = idFlightGuidanceTargetAltitude->get(); + fmgcs[fmgcIndex].modelInputs.in.fms_inputs.vs_target_ft_min = idFlightGuidanceTargetVerticalSpeed->get(); + fmgcs[fmgcIndex].modelInputs.in.fms_inputs.v_2_kts = idFmgcV2->get(); + fmgcs[fmgcIndex].modelInputs.in.fms_inputs.v_app_kts = idFmgcV2->get(); + fmgcs[fmgcIndex].modelInputs.in.fms_inputs.v_managed_kts = idFmgcV2->get(); + fmgcs[fmgcIndex].modelInputs.in.fms_inputs.flex_temp_deg_c = idFmgcFlexTemperature->get(); + fmgcs[fmgcIndex].modelInputs.in.fms_inputs.acceleration_alt_ft = fmAccelerationAltitude->valueOr(0); + fmgcs[fmgcIndex].modelInputs.in.fms_inputs.acceleration_alt_eo_ft = fmAccelerationAltitudeEngineOut->valueOr(0); + fmgcs[fmgcIndex].modelInputs.in.fms_inputs.thrust_reduction_alt_ft = fmThrustReductionAltitude->valueOr(0); + fmgcs[fmgcIndex].modelInputs.in.fms_inputs.cruise_alt_ft = idFmgcCruiseAltitude->get(); + + fmgcs[fmgcIndex].modelInputs.in.bus_inputs.fac_opp_bus = facsBusOutputs[oppFmgcIndex]; + fmgcs[fmgcIndex].modelInputs.in.bus_inputs.fac_own_bus = facsBusOutputs[fmgcIndex]; + fmgcs[fmgcIndex].modelInputs.in.bus_inputs.adr_3_bus = adrBusOutputs[2]; + fmgcs[fmgcIndex].modelInputs.in.bus_inputs.ir_3_bus = irBusOutputs[2]; + fmgcs[fmgcIndex].modelInputs.in.bus_inputs.adr_opp_bus = fmgcIndex == 0 ? adrBusOutputs[1] : adrBusOutputs[0]; + fmgcs[fmgcIndex].modelInputs.in.bus_inputs.ir_opp_bus = fmgcIndex == 0 ? irBusOutputs[1] : irBusOutputs[0]; + fmgcs[fmgcIndex].modelInputs.in.bus_inputs.adr_own_bus = fmgcIndex == 0 ? adrBusOutputs[0] : adrBusOutputs[1]; + fmgcs[fmgcIndex].modelInputs.in.bus_inputs.ir_own_bus = fmgcIndex == 0 ? irBusOutputs[0] : irBusOutputs[1]; + fmgcs[fmgcIndex].modelInputs.in.bus_inputs.fadec_opp_bus = fadecBusOutputs[oppFmgcIndex]; + fmgcs[fmgcIndex].modelInputs.in.bus_inputs.fadec_own_bus = fadecBusOutputs[fmgcIndex]; + fmgcs[fmgcIndex].modelInputs.in.bus_inputs.fcdc_opp_bus = fcdcsBusOutputs[oppFmgcIndex]; + fmgcs[fmgcIndex].modelInputs.in.bus_inputs.fcdc_own_bus = fcdcsBusOutputs[fmgcIndex]; + fmgcs[fmgcIndex].modelInputs.in.bus_inputs.ra_opp_bus = raBusOutputs[oppFmgcIndex]; + fmgcs[fmgcIndex].modelInputs.in.bus_inputs.ra_own_bus = raBusOutputs[fmgcIndex]; + fmgcs[fmgcIndex].modelInputs.in.bus_inputs.ils_opp_bus = ilsBusOutputs[oppFmgcIndex]; + fmgcs[fmgcIndex].modelInputs.in.bus_inputs.ils_own_bus = ilsBusOutputs[fmgcIndex]; + fmgcs[fmgcIndex].modelInputs.in.bus_inputs.fmgc_opp_bus = fmgcsBusOutputs[oppFmgcIndex].fmgc_a_bus; + fmgcs[fmgcIndex].modelInputs.in.bus_inputs.fcu_bus = fcuBusOutputs; + + if (fmgcIndex == fmgcDisabled) { + simConnectInterface.setClientDataFmgcDiscretes(fmgcs[fmgcIndex].modelInputs.in.discrete_inputs); + simConnectInterface.setClientDataFmgcFmsData(fmgcs[fmgcIndex].modelInputs.in.fms_inputs); + + fmgcsDiscreteOutputs[fmgcIndex] = simConnectInterface.getClientDataFmgcDiscretesOutput(); + fmgcsBusOutputs[fmgcIndex].fmgc_a_bus = simConnectInterface.getClientDataFmgcABusOutput(); + fmgcsBusOutputs[fmgcIndex].fmgc_b_bus = simConnectInterface.getClientDataFmgcBBusOutput(); + } else { + fmgcs[fmgcIndex].update(sampleTime, simData.simulationTime, + failuresConsumer.isActive(fmgcIndex == 0 ? Failures::Fmgc1 : Failures::Fmgc2), + fmgcIndex == 0 ? idElecDcEssShedBusPowered->get() : idElecDcBus2Powered->get()); + + fmgcsDiscreteOutputs[fmgcIndex] = fmgcs[fmgcIndex].getDiscreteOutputs(); + fmgcsBusOutputs[fmgcIndex] = fmgcs[fmgcIndex].getBusOutputs(); + } + + if (oppFmgcIndex == fmgcDisabled || fcuDisabled) { + simConnectInterface.setClientDataFmgcABus(fmgcsBusOutputs[fmgcIndex].fmgc_a_bus, fmgcIndex); + } + + if (facDisabled != -1 || elacDisabled != -1) { + simConnectInterface.setClientDataFmgcBBus(fmgcsBusOutputs[fmgcIndex].fmgc_b_bus, fmgcIndex); + } + + idFmgcHealthy[fmgcIndex]->set(fmgcsDiscreteOutputs[fmgcIndex].fmgc_healthy); + idFmgcAthrEngaged[fmgcIndex]->set(fmgcsDiscreteOutputs[fmgcIndex].athr_own_engaged); + idFmgcFdEngaged[fmgcIndex]->set(fmgcsDiscreteOutputs[fmgcIndex].fd_own_engaged); + idFmgcApEngaged[fmgcIndex]->set(fmgcsDiscreteOutputs[fmgcIndex].ap_own_engaged); + + idFmgcABusPfdSelectedSpeed[fmgcIndex]->set(Arinc429Utils::toSimVar(fmgcsBusOutputs[fmgcIndex].fmgc_a_bus.pfd_sel_spd_kts)); + idFmgcABusRollFdCommand[fmgcIndex]->set(Arinc429Utils::toSimVar(fmgcsBusOutputs[fmgcIndex].fmgc_a_bus.roll_fd_command)); + idFmgcABusPitchFdCommand[fmgcIndex]->set(Arinc429Utils::toSimVar(fmgcsBusOutputs[fmgcIndex].fmgc_a_bus.pitch_fd_command)); + idFmgcABusYawFdCommand[fmgcIndex]->set(Arinc429Utils::toSimVar(fmgcsBusOutputs[fmgcIndex].fmgc_a_bus.yaw_fd_command)); + idFmgcABusDiscreteWord5[fmgcIndex]->set(Arinc429Utils::toSimVar(fmgcsBusOutputs[fmgcIndex].fmgc_a_bus.discrete_word_5)); + idFmgcABusDiscreteWord4[fmgcIndex]->set(Arinc429Utils::toSimVar(fmgcsBusOutputs[fmgcIndex].fmgc_a_bus.discrete_word_4)); + idFmgcABusAtsDiscreteWord[fmgcIndex]->set(Arinc429Utils::toSimVar(fmgcsBusOutputs[fmgcIndex].fmgc_a_bus.ats_discrete_word)); + idFmgcABusAtsFmaDiscreteWord[fmgcIndex]->set(Arinc429Utils::toSimVar(fmgcsBusOutputs[fmgcIndex].fmgc_a_bus.ats_fma_discrete_word)); + idFmgcABusDiscreteWord3[fmgcIndex]->set(Arinc429Utils::toSimVar(fmgcsBusOutputs[fmgcIndex].fmgc_a_bus.discrete_word_3)); + idFmgcABusDiscreteWord1[fmgcIndex]->set(Arinc429Utils::toSimVar(fmgcsBusOutputs[fmgcIndex].fmgc_a_bus.discrete_word_1)); + idFmgcABusDiscreteWord2[fmgcIndex]->set(Arinc429Utils::toSimVar(fmgcsBusOutputs[fmgcIndex].fmgc_a_bus.discrete_word_2)); + idFmgcABusDiscreteWord6[fmgcIndex]->set(Arinc429Utils::toSimVar(fmgcsBusOutputs[fmgcIndex].fmgc_a_bus.discrete_word_6)); + + return true; +} + +bool FlyByWireInterface::updateFcu(double sampleTime) { + SimData simData = simConnectInterface.getSimData(); + + fcu.modelInputs.in.time.dt = sampleTime; + fcu.modelInputs.in.time.simulation_time = simData.simulationTime; + fcu.modelInputs.in.time.monotonic_time = monotonicTime; + + fcu.modelInputs.in.sim_data.slew_on = wasInSlew; + fcu.modelInputs.in.sim_data.pause_on = pauseDetected; + fcu.modelInputs.in.sim_data.tracking_mode_on_override = idExternalOverride->get() == 1; + fcu.modelInputs.in.sim_data.tailstrike_protection_on = tailstrikeProtectionEnabled; + + fcu.modelInputs.in.discrete_inputs.ap_1_engaged = fmgcsDiscreteOutputs[0].ap_own_engaged; + fcu.modelInputs.in.discrete_inputs.fd_1_engaged = fmgcsDiscreteOutputs[0].fd_own_engaged; + fcu.modelInputs.in.discrete_inputs.athr_1_engaged = fmgcsDiscreteOutputs[0].athr_own_engaged; + fcu.modelInputs.in.discrete_inputs.ap_2_engaged = fmgcsDiscreteOutputs[1].ap_own_engaged; + fcu.modelInputs.in.discrete_inputs.fd_2_engaged = fmgcsDiscreteOutputs[1].fd_own_engaged; + fcu.modelInputs.in.discrete_inputs.athr_2_engaged = fmgcsDiscreteOutputs[1].athr_own_engaged; + fcu.modelInputs.in.discrete_inputs.lights_test = idLightsTest->get(); + + fcu.modelInputs.in.discrete_inputs.capt_efis_inputs = simConnectInterface.getFcuEfisPanelInputs(0); + fcu.modelInputs.in.discrete_inputs.capt_efis_inputs.efis_mode = static_cast(idFcuEisPanelEfisMode[0]->get()); + fcu.modelInputs.in.discrete_inputs.capt_efis_inputs.efis_range = static_cast(idFcuEisPanelEfisRange[0]->get()); + fcu.modelInputs.in.discrete_inputs.capt_efis_inputs.efis_navaid_1 = + static_cast(idFcuEisPanelNavaid1Mode[0]->get()); + fcu.modelInputs.in.discrete_inputs.capt_efis_inputs.efis_navaid_2 = + static_cast(idFcuEisPanelNavaid2Mode[0]->get()); + fcu.modelInputs.in.discrete_inputs.capt_efis_inputs.baro_is_inhg = idFcuEisPanelBaroIsInhg[0]->get(); + + fcu.modelInputs.in.discrete_inputs.fo_efis_inputs = simConnectInterface.getFcuEfisPanelInputs(1); + fcu.modelInputs.in.discrete_inputs.fo_efis_inputs.efis_mode = static_cast(idFcuEisPanelEfisMode[1]->get()); + fcu.modelInputs.in.discrete_inputs.fo_efis_inputs.efis_range = static_cast(idFcuEisPanelEfisRange[1]->get()); + fcu.modelInputs.in.discrete_inputs.fo_efis_inputs.efis_navaid_1 = static_cast(idFcuEisPanelNavaid1Mode[1]->get()); + fcu.modelInputs.in.discrete_inputs.fo_efis_inputs.efis_navaid_2 = static_cast(idFcuEisPanelNavaid2Mode[1]->get()); + fcu.modelInputs.in.discrete_inputs.fo_efis_inputs.baro_is_inhg = idFcuEisPanelBaroIsInhg[1]->get(); + + fcu.modelInputs.in.discrete_inputs.afs_inputs = simConnectInterface.getFcuAfsPanelInputs(); + fcu.modelInputs.in.discrete_inputs.afs_inputs.alt_increment_1000 = idFcuAfsPanelAltIncrement1000->get(); + + fcu.modelInputs.in.bus_inputs.fmgc_1_bus = fmgcsBusOutputs[0].fmgc_a_bus; + fcu.modelInputs.in.bus_inputs.fmgc_2_bus = fmgcsBusOutputs[1].fmgc_a_bus; + + if (fcuDisabled) { + fcuBusOutputs = simConnectInterface.getClientDataFcuBusOutput(); + } else { + fcu.update(sampleTime, simData.simulationTime, failuresConsumer.isActive(Failures::Fcu1), failuresConsumer.isActive(Failures::Fcu2), + idElecDcEssBusPowered->get(), idElecDcBus2Powered->get()); + fcuBusOutputs = fcu.getBusOutputs(); + } + + base_fcu_discrete_outputs discreteOutputs = fcu.getDiscreteOutputs(); + fcuHealthy = discreteOutputs.fcu_healthy; + + if (fmgcDisabled != -1) { + simConnectInterface.setClientDataFcuBus(fcuBusOutputs); + } + + idFcuSelectedHeading->set(Arinc429Utils::toSimVar(fcuBusOutputs.selected_hdg_deg)); + idFcuSelectedAltitude->set(Arinc429Utils::toSimVar(fcuBusOutputs.selected_alt_ft)); + idFcuSelectedAirspeed->set(Arinc429Utils::toSimVar(fcuBusOutputs.selected_spd_kts)); + idFcuSelectedVerticalSpeed->set(Arinc429Utils::toSimVar(fcuBusOutputs.selected_vz_ft_min)); + idFcuSelectedTrack->set(Arinc429Utils::toSimVar(fcuBusOutputs.selected_trk_deg)); + idFcuSelectedFpa->set(Arinc429Utils::toSimVar(fcuBusOutputs.selected_fpa_deg)); + idFcuAtsDiscreteWord->set(Arinc429Utils::toSimVar(fcuBusOutputs.ats_discrete_word)); + idFcuAtsFmaDiscreteWord->set(Arinc429Utils::toSimVar(fcuBusOutputs.ats_fma_discrete_word)); + idFcuEisLeftDiscreteWord1->set(Arinc429Utils::toSimVar(fcuBusOutputs.eis_discrete_word_1_left)); + idFcuEisLeftDiscreteWord2->set(Arinc429Utils::toSimVar(fcuBusOutputs.eis_discrete_word_2_left)); + idFcuEisLeftBaro->set(Arinc429Utils::toSimVar(fcuBusOutputs.baro_setting_left_inhg)); + idFcuEisLeftBaroHpa->set(Arinc429Utils::toSimVar(fcuBusOutputs.baro_setting_left_hpa)); + idFcuEisRightDiscreteWord1->set(Arinc429Utils::toSimVar(fcuBusOutputs.eis_discrete_word_1_right)); + idFcuEisRightDiscreteWord2->set(Arinc429Utils::toSimVar(fcuBusOutputs.eis_discrete_word_2_right)); + idFcuEisRightBaro->set(Arinc429Utils::toSimVar(fcuBusOutputs.baro_setting_right_inhg)); + idFcuEisRightBaroHpa->set(Arinc429Utils::toSimVar(fcuBusOutputs.baro_setting_right_hpa)); + idFcuDiscreteWord1->set(Arinc429Utils::toSimVar(fcuBusOutputs.fcu_discrete_word_1)); + idFcuDiscreteWord2->set(Arinc429Utils::toSimVar(fcuBusOutputs.fcu_discrete_word_2)); + + idFcuHealthy->set(discreteOutputs.fcu_healthy); + + for (int i = 0; i < 2; i++) { + std::string idString = std::to_string(i + 1); + + base_fcu_efis_panel_outputs efisPanelOutputs = (i == 0) ? discreteOutputs.capt_efis_outputs : discreteOutputs.fo_efis_outputs; + + idFcuEisPanelFdLightOn[i]->set(efisPanelOutputs.fd_light_on); + idFcuEisPanelLsLightOn[i]->set(efisPanelOutputs.ls_light_on); + idFcuEisPanelCstrLightOn[i]->set(efisPanelOutputs.cstr_light_on); + idFcuEisPanelWptLightOn[i]->set(efisPanelOutputs.wpt_light_on); + idFcuEisPanelVordLightOn[i]->set(efisPanelOutputs.vord_light_on); + idFcuEisPanelNdbLightOn[i]->set(efisPanelOutputs.ndb_light_on); + idFcuEisPanelArptLightOn[i]->set(efisPanelOutputs.arpt_light_on); + + idFcuEisDisplayBaroValueMode[i]->set(efisPanelOutputs.baro_value_mode); + idFcuEisDisplayBaroValue[i]->set(efisPanelOutputs.baro_value); + idFcuEisDisplayBaroMode[i]->set(efisPanelOutputs.baro_mode); + } + + // If the FCU is running in Simulink, these Lvars will be directly set from Simulink via SimConnect + if (!fcuDisabled) { + idFcuAfsPanelAp1LightOn->set(discreteOutputs.afs_outputs.ap_1_light_on); + idFcuAfsPanelAp2LightOn->set(discreteOutputs.afs_outputs.ap_2_light_on); + idFcuAfsPanelAthrLightOn->set(discreteOutputs.afs_outputs.athr_light_on); + idFcuAfsPanelLocLightOn->set(discreteOutputs.afs_outputs.loc_light_on); + idFcuAfsPanelExpedLightOn->set(discreteOutputs.afs_outputs.exped_light_on); + idFcuAfsPanelApprLightOn->set(discreteOutputs.afs_outputs.appr_light_on); + + idFcuAfsDisplayTrkFpaMode->set(discreteOutputs.afs_outputs.trk_fpa_mode); + idFcuAfsDisplayMachMode->set(discreteOutputs.afs_outputs.mach_mode); + idFcuAfsDisplaySpdMachValue->set(discreteOutputs.afs_outputs.spd_mach_value); + idFcuAfsDisplaySpdMachDashes->set(discreteOutputs.afs_outputs.spd_mach_dashes); + idFcuAfsDisplaySpdMachManaged->set(discreteOutputs.afs_outputs.spd_mach_managed); + idFcuAfsDisplayHdgTrkValue->set(discreteOutputs.afs_outputs.hdg_trk_value); + idFcuAfsDisplayHdgTrkDashes->set(discreteOutputs.afs_outputs.hdg_trk_dashes); + idFcuAfsDisplayHdgTrkManaged->set(discreteOutputs.afs_outputs.hdg_trk_managed); + idFcuAfsDisplayAltValue->set(discreteOutputs.afs_outputs.alt_value); + idFcuAfsDisplayLvlChManaged->set(discreteOutputs.afs_outputs.lvl_ch_managed); + idFcuAfsDisplayVsFpaValue->set(discreteOutputs.afs_outputs.vs_fpa_value); + idFcuAfsDisplayVsFpaDashes->set(discreteOutputs.afs_outputs.vs_fpa_dashes); + } + + return true; +} + bool FlyByWireInterface::updateFac(double sampleTime, int facIndex) { // do not further process when active pause is on if (simConnectInterface.isSimInActivePause()) { @@ -1628,10 +1887,8 @@ bool FlyByWireInterface::updateFac(double sampleTime, int facIndex) { facs[facIndex].modelInputs.in.sim_data.tracking_mode_on_override = idExternalOverride->get() == 1; facs[facIndex].modelInputs.in.sim_data.tailstrike_protection_on = tailstrikeProtectionEnabled; - facs[facIndex].modelInputs.in.discrete_inputs.ap_own_engaged = - facIndex == 0 ? autopilotStateMachineOutput.enabled_AP1 : autopilotStateMachineOutput.enabled_AP2; - facs[facIndex].modelInputs.in.discrete_inputs.ap_opp_engaged = - facIndex == 0 ? autopilotStateMachineOutput.enabled_AP2 : autopilotStateMachineOutput.enabled_AP1; + facs[facIndex].modelInputs.in.discrete_inputs.ap_own_engaged = fmgcsDiscreteOutputs[facIndex].ap_own_engaged; + facs[facIndex].modelInputs.in.discrete_inputs.ap_opp_engaged = fmgcsDiscreteOutputs[oppFacIndex].ap_own_engaged; facs[facIndex].modelInputs.in.discrete_inputs.yaw_damper_opp_engaged = facsDiscreteOutputs[oppFacIndex].yaw_damper_engaged; facs[facIndex].modelInputs.in.discrete_inputs.rudder_trim_opp_engaged = facsDiscreteOutputs[oppFacIndex].rudder_trim_engaged; facs[facIndex].modelInputs.in.discrete_inputs.rudder_travel_lim_opp_engaged = facsDiscreteOutputs[oppFacIndex].rudder_travel_lim_engaged; @@ -1667,8 +1924,8 @@ bool FlyByWireInterface::updateFac(double sampleTime, int facIndex) { facs[facIndex].modelInputs.in.bus_inputs.ir_own_bus = facIndex == 0 ? irBusOutputs[0] : irBusOutputs[1]; facs[facIndex].modelInputs.in.bus_inputs.ir_opp_bus = facIndex == 0 ? irBusOutputs[1] : irBusOutputs[0]; facs[facIndex].modelInputs.in.bus_inputs.ir_3_bus = irBusOutputs[2]; - facs[facIndex].modelInputs.in.bus_inputs.fmgc_own_bus = fmgcBBusOutputs; - facs[facIndex].modelInputs.in.bus_inputs.fmgc_opp_bus = fmgcBBusOutputs; + facs[facIndex].modelInputs.in.bus_inputs.fmgc_own_bus = fmgcsBusOutputs[facIndex].fmgc_b_bus; + facs[facIndex].modelInputs.in.bus_inputs.fmgc_opp_bus = fmgcsBusOutputs[oppFacIndex].fmgc_b_bus; facs[facIndex].modelInputs.in.bus_inputs.sfcc_own_bus = sfccBusOutputs[facIndex]; facs[facIndex].modelInputs.in.bus_inputs.lgciu_own_bus = lgciuBusOutputs[facIndex]; facs[facIndex].modelInputs.in.bus_inputs.elac_1_bus = elacsBusOutputs[0]; @@ -1690,7 +1947,7 @@ bool FlyByWireInterface::updateFac(double sampleTime, int facIndex) { facsBusOutputs[facIndex] = facs[facIndex].getBusOutputs(); } - if (oppFacIndex == facDisabled) { + if (oppFacIndex == facDisabled || fmgcDisabled != -1) { simConnectInterface.setClientDataFacBus(facsBusOutputs[facIndex], facIndex); } @@ -1800,579 +2057,6 @@ bool FlyByWireInterface::updateServoSolenoidStatus() { return true; } -bool FlyByWireInterface::updateAutopilotStateMachine(double sampleTime) { - // get data from interface ------------------------------------------------------------------------------------------ - SimData simData = simConnectInterface.getSimData(); - SimInput simInput = simConnectInterface.getSimInput(); - SimInputAutopilot simInputAutopilot = simConnectInterface.getSimInputAutopilot(); - - // determine disconnection conditions ------------------------------------------------------------------------------- - - bool doDisconnect = false; - if (autopilotStateMachineOutput.enabled_AP1 || autopilotStateMachineOutput.enabled_AP2) { - doDisconnect = !(elacsDiscreteOutputs[0].ap_1_authorised || elacsDiscreteOutputs[1].ap_1_authorised); - } - - // update state machine --------------------------------------------------------------------------------------------- - if (autopilotStateMachineEnabled) { - // time ----------------------------------------------------------------------------------------------------------- - autopilotStateMachineInput.in.time.dt = sampleTime; - autopilotStateMachineInput.in.time.simulation_time = simData.simulationTime; - - // data ----------------------------------------------------------------------------------------------------------- - autopilotStateMachineInput.in.data.aircraft_position.lat = simData.latitude_deg; - autopilotStateMachineInput.in.data.aircraft_position.lon = simData.longitude_deg; - autopilotStateMachineInput.in.data.aircraft_position.alt = simData.altitude_m; - autopilotStateMachineInput.in.data.Theta_deg = simData.Theta_deg; - autopilotStateMachineInput.in.data.Phi_deg = simData.Phi_deg; - autopilotStateMachineInput.in.data.q_rad_s = simData.bodyRotationVelocity.x; - autopilotStateMachineInput.in.data.r_rad_s = simData.bodyRotationVelocity.y; - autopilotStateMachineInput.in.data.p_rad_s = simData.bodyRotationVelocity.z; - autopilotStateMachineInput.in.data.V_ias_kn = simData.V_ias_kn; - autopilotStateMachineInput.in.data.V_tas_kn = simData.V_tas_kn; - autopilotStateMachineInput.in.data.V_mach = simData.V_mach; - autopilotStateMachineInput.in.data.V_gnd_kn = simData.V_gnd_kn; - autopilotStateMachineInput.in.data.alpha_deg = simData.alpha_deg; - autopilotStateMachineInput.in.data.beta_deg = simData.beta_deg; - autopilotStateMachineInput.in.data.H_ft = simData.H_ft; - autopilotStateMachineInput.in.data.H_ind_ft = simData.H_ind_ft; - autopilotStateMachineInput.in.data.H_radio_ft = simData.H_radio_ft; - autopilotStateMachineInput.in.data.H_dot_ft_min = simData.H_dot_fpm; - autopilotStateMachineInput.in.data.Psi_magnetic_deg = simData.Psi_magnetic_deg; - autopilotStateMachineInput.in.data.Psi_magnetic_track_deg = simData.Psi_magnetic_track_deg; - autopilotStateMachineInput.in.data.Psi_true_deg = simData.Psi_true_deg; - autopilotStateMachineInput.in.data.bx_m_s2 = simData.bx_m_s2; - autopilotStateMachineInput.in.data.by_m_s2 = simData.by_m_s2; - autopilotStateMachineInput.in.data.bz_m_s2 = simData.bz_m_s2; - autopilotStateMachineInput.in.data.nav_valid = (simData.nav_valid != 0); - const auto backbeam = idFm1BackbeamSelected->get() != 0; - autopilotStateMachineInput.in.data.nav_loc_deg = MathUtils::normalise360(simData.nav_loc_deg + (backbeam ? 180 : 0)); - autopilotStateMachineInput.in.data.nav_gs_deg = simData.nav_gs_deg; - if (idRadioReceiverUsageEnabled->get()) { - autopilotStateMachineInput.in.data.nav_dme_valid = 0; // this forces the usage of the calculated dme - autopilotStateMachineInput.in.data.nav_dme_nmi = idRadioReceiverLocalizerDistance->get(); - autopilotStateMachineInput.in.data.nav_loc_valid = idRadioReceiverLocalizerValid->get() != 0; - const auto locDeviation = MathUtils::correctMsfsLocaliserError(idRadioReceiverLocalizerDeviation->get()); - autopilotStateMachineInput.in.data.nav_loc_error_deg = backbeam ? -locDeviation : locDeviation; - autopilotStateMachineInput.in.data.nav_gs_valid = idRadioReceiverGlideSlopeValid->get() != 0; - autopilotStateMachineInput.in.data.nav_gs_error_deg = idRadioReceiverGlideSlopeDeviation->get(); - } else { - autopilotStateMachineInput.in.data.nav_dme_valid = (simData.nav_dme_valid != 0); - autopilotStateMachineInput.in.data.nav_dme_nmi = simData.nav_dme_nmi; - autopilotStateMachineInput.in.data.nav_loc_valid = (simData.nav_loc_valid != 0); - const auto locDeviation = MathUtils::correctMsfsLocaliserError(simData.nav_loc_error_deg); - autopilotStateMachineInput.in.data.nav_loc_error_deg = backbeam ? -locDeviation : locDeviation; - autopilotStateMachineInput.in.data.nav_gs_valid = (simData.nav_gs_valid != 0); - autopilotStateMachineInput.in.data.nav_gs_error_deg = simData.nav_gs_error_deg; - } - autopilotStateMachineInput.in.data.nav_loc_magvar_deg = simData.nav_loc_magvar_deg; - autopilotStateMachineInput.in.data.nav_loc_position.lat = simData.nav_loc_pos.Latitude; - autopilotStateMachineInput.in.data.nav_loc_position.lon = simData.nav_loc_pos.Longitude; - autopilotStateMachineInput.in.data.nav_loc_position.alt = simData.nav_loc_pos.Altitude; - autopilotStateMachineInput.in.data.nav_gs_position.lat = simData.nav_gs_pos.Latitude; - autopilotStateMachineInput.in.data.nav_gs_position.lon = simData.nav_gs_pos.Longitude; - autopilotStateMachineInput.in.data.nav_gs_position.alt = simData.nav_gs_pos.Altitude; - autopilotStateMachineInput.in.data.flight_guidance_xtk_nmi = idFlightGuidanceCrossTrackError->get(); - autopilotStateMachineInput.in.data.flight_guidance_tae_deg = idFlightGuidanceTrackAngleError->get(); - autopilotStateMachineInput.in.data.flight_guidance_phi_deg = idFlightGuidancePhiCommand->get(); - autopilotStateMachineInput.in.data.flight_guidance_phi_limit_deg = idFlightGuidancePhiLimit->get(); - autopilotStateMachineInput.in.data.flight_phase = idFmgcFlightPhase->get(); - autopilotStateMachineInput.in.data.V2_kn = idFmgcV2->get(); - autopilotStateMachineInput.in.data.VAPP_kn = idFmgcV_APP->get(); - autopilotStateMachineInput.in.data.VLS_kn = - facsDiscreteOutputs[0].fac_healthy ? facsBusOutputs[0].v_ls_kn.Data : facsBusOutputs[1].v_ls_kn.Data; - autopilotStateMachineInput.in.data.VMAX_kn = - facsDiscreteOutputs[0].fac_healthy ? facsBusOutputs[0].v_max_kn.Data : facsBusOutputs[1].v_max_kn.Data; - autopilotStateMachineInput.in.data.is_flight_plan_available = idFlightGuidanceAvailable->get(); - autopilotStateMachineInput.in.data.altitude_constraint_ft = idFmgcAltitudeConstraint->get(); - autopilotStateMachineInput.in.data.thrust_reduction_altitude = fmThrustReductionAltitude->valueOr(0); - autopilotStateMachineInput.in.data.thrust_reduction_altitude_go_around = fmThrustReductionAltitudeGoAround->valueOr(0); - autopilotStateMachineInput.in.data.acceleration_altitude = fmAccelerationAltitude->valueOr(0); - autopilotStateMachineInput.in.data.acceleration_altitude_engine_out = fmAccelerationAltitudeEngineOut->valueOr(0); - autopilotStateMachineInput.in.data.acceleration_altitude_go_around = fmAccelerationAltitudeGoAround->valueOr(0); - autopilotStateMachineInput.in.data.acceleration_altitude_go_around_engine_out = fmAccelerationAltitudeGoAroundEngineOut->valueOr(0); - autopilotStateMachineInput.in.data.cruise_altitude = idFmgcCruiseAltitude->get(); - autopilotStateMachineInput.in.data.throttle_lever_1_pos = thrustLeverAngle_1->get(); - autopilotStateMachineInput.in.data.throttle_lever_2_pos = thrustLeverAngle_2->get(); - autopilotStateMachineInput.in.data.gear_strut_compression_1 = simData.gear_animation_pos_1; - autopilotStateMachineInput.in.data.gear_strut_compression_2 = simData.gear_animation_pos_2; - autopilotStateMachineInput.in.data.zeta_pos = simData.zeta_pos; - autopilotStateMachineInput.in.data.flaps_handle_index = flapsHandleIndexFlapConf->get(); - autopilotStateMachineInput.in.data.is_engine_operative_1 = simData.engine_combustion_1; - autopilotStateMachineInput.in.data.is_engine_operative_2 = simData.engine_combustion_2; - autopilotStateMachineInput.in.data.altimeter_setting_left_mbar = simData.kohlsmanSetting_0; - autopilotStateMachineInput.in.data.altimeter_setting_right_mbar = simData.kohlsmanSetting_1; - autopilotStateMachineInput.in.data.total_weight_kg = simData.total_weight_kg; - - // input ---------------------------------------------------------------------------------------------------------- - autopilotStateMachineInput.in.input.FD_active = simData.ap_fd_1_active || simData.ap_fd_2_active; - autopilotStateMachineInput.in.input.AP_ENGAGE_push = simInputAutopilot.AP_engage; - autopilotStateMachineInput.in.input.AP_1_push = simInputAutopilot.AP_1_push; - autopilotStateMachineInput.in.input.AP_2_push = simInputAutopilot.AP_2_push; - autopilotStateMachineInput.in.input.AP_DISCONNECT_push = simInputAutopilot.AP_disconnect || wasInSlew || doDisconnect; - autopilotStateMachineInput.in.input.HDG_push = simInputAutopilot.HDG_push; - autopilotStateMachineInput.in.input.HDG_pull = simInputAutopilot.HDG_pull; - autopilotStateMachineInput.in.input.ALT_push = simInputAutopilot.ALT_push; - autopilotStateMachineInput.in.input.ALT_pull = simInputAutopilot.ALT_pull; - autopilotStateMachineInput.in.input.VS_push = simInputAutopilot.VS_push; - autopilotStateMachineInput.in.input.VS_pull = simInputAutopilot.VS_pull; - autopilotStateMachineInput.in.input.LOC_push = simInputAutopilot.LOC_push; - autopilotStateMachineInput.in.input.APPR_push = simInputAutopilot.APPR_push; - autopilotStateMachineInput.in.input.EXPED_push = simInputAutopilot.EXPED_push; - autopilotStateMachineInput.in.input.V_fcu_kn = simData.ap_V_c_kn; - autopilotStateMachineInput.in.input.H_fcu_ft = simData.ap_H_c_ft; - autopilotStateMachineInput.in.input.H_constraint_ft = idFmgcAltitudeConstraint->get(); - autopilotStateMachineInput.in.input.H_dot_fcu_fpm = idFcuSelectedVs->get(); - autopilotStateMachineInput.in.input.FPA_fcu_deg = idFcuSelectedFpa->get(); - autopilotStateMachineInput.in.input.Psi_fcu_deg = idFcuSelectedHeading->get(); - autopilotStateMachineInput.in.input.TRK_FPA_mode = idFcuTrkFpaModeActive->get(); - autopilotStateMachineInput.in.input.DIR_TO_trigger = simInputAutopilot.DIR_TO_trigger; - autopilotStateMachineInput.in.input.is_FLX_active = autoThrust.getExternalOutputs().out.data_computed.is_FLX_active; - autopilotStateMachineInput.in.input.Slew_trigger = wasInSlew; - autopilotStateMachineInput.in.input.MACH_mode = simData.is_mach_mode_active; - autopilotStateMachineInput.in.input.ATHR_engaged = (autoThrustOutput.status == athr_status::ENGAGED_ACTIVE); - autopilotStateMachineInput.in.input.is_SPEED_managed = (simData.speed_slot_index == 2); - autopilotStateMachineInput.in.input.FDR_event = idFdrEvent->get(); - autopilotStateMachineInput.in.input.Phi_loc_c = autopilotLawsOutput.Phi_loc_c; - autopilotStateMachineInput.in.input.FM_requested_vertical_mode = - static_cast(idFlightGuidanceRequestedVerticalMode->get()); - autopilotStateMachineInput.in.input.FM_H_c_ft = idFlightGuidanceTargetAltitude->get(); - autopilotStateMachineInput.in.input.FM_H_dot_c_fpm = idFlightGuidanceTargetVerticalSpeed->get(); - autopilotStateMachineInput.in.input.FM_rnav_appr_selected = static_cast(idFmRnavAppSelected->get()); - autopilotStateMachineInput.in.input.FM_final_des_can_engage = static_cast(idFmFinalCanEngage->get()); - autopilotStateMachineInput.in.input.TCAS_mode_available = getTcasModeAvailable(); - autopilotStateMachineInput.in.input.TCAS_advisory_state = getTcasAdvisoryState(); - autopilotStateMachineInput.in.input.TCAS_advisory_target_min_fpm = idTcasTargetGreenMin->get(); - autopilotStateMachineInput.in.input.TCAS_advisory_target_max_fpm = idTcasTargetGreenMax->get(); - autopilotStateMachineInput.in.input.condition_Flare = autopilotLawsOutput.flare_law.condition_Flare; - - // step the model ------------------------------------------------------------------------------------------------- - autopilotStateMachine.setExternalInputs(&autopilotStateMachineInput); - autopilotStateMachine.step(); - - // result - autopilotStateMachineOutput = autopilotStateMachine.getExternalOutputs().out.output; - } else { - // read client data written by simulink - ClientDataAutopilotStateMachine clientData = simConnectInterface.getClientDataAutopilotStateMachine(); - autopilotStateMachineOutput.enabled_AP1 = clientData.enabled_AP1; - autopilotStateMachineOutput.enabled_AP2 = clientData.enabled_AP2; - autopilotStateMachineOutput.lateral_law = clientData.lateral_law; - autopilotStateMachineOutput.lateral_mode = clientData.lateral_mode; - autopilotStateMachineOutput.lateral_mode_armed = clientData.lateral_mode_armed; - autopilotStateMachineOutput.vertical_law = clientData.vertical_law; - autopilotStateMachineOutput.vertical_mode = clientData.vertical_mode; - autopilotStateMachineOutput.vertical_mode_armed = clientData.vertical_mode_armed; - autopilotStateMachineOutput.mode_reversion_lateral = clientData.mode_reversion_lateral; - autopilotStateMachineOutput.mode_reversion_vertical = clientData.mode_reversion_vertical; - autopilotStateMachineOutput.mode_reversion_vertical_target_fpm = clientData.mode_reversion_vertical_target_fpm; - autopilotStateMachineOutput.mode_reversion_TRK_FPA = clientData.mode_reversion_TRK_FPA; - autopilotStateMachineOutput.mode_reversion_triple_click = clientData.mode_reversion_triple_click; - autopilotStateMachineOutput.mode_reversion_fma = clientData.mode_reversion_fma; - autopilotStateMachineOutput.speed_protection_mode = clientData.speed_protection_mode; - autopilotStateMachineOutput.autothrust_mode = clientData.autothrust_mode; - autopilotStateMachineOutput.Psi_c_deg = clientData.Psi_c_deg; - autopilotStateMachineOutput.H_c_ft = clientData.H_c_ft; - autopilotStateMachineOutput.H_dot_c_fpm = clientData.H_dot_c_fpm; - autopilotStateMachineOutput.FPA_c_deg = clientData.FPA_c_deg; - autopilotStateMachineOutput.V_c_kn = clientData.V_c_kn; - autopilotStateMachineOutput.ALT_soft_mode_active = clientData.ALT_soft_mode_active; - autopilotStateMachineOutput.ALT_cruise_mode_active = clientData.ALT_cruise_mode_active; - autopilotStateMachineOutput.EXPED_mode_active = clientData.EXPED_mode_active; - autopilotStateMachineOutput.FD_disconnect = clientData.FD_disconnect; - autopilotStateMachineOutput.FD_connect = clientData.FD_connect; - autopilotStateMachineOutput.TCAS_message_disarm = clientData.TCAS_message_disarm; - autopilotStateMachineOutput.TCAS_message_RA_inhibit = clientData.TCAS_message_RA_inhibit; - autopilotStateMachineOutput.TCAS_message_TRK_FPA_deselection = clientData.TCAS_message_TRK_FPA_deselection; - } - - // update autopilot state ------------------------------------------------------------------------------------------- - idAutopilotActiveAny->set(autopilotStateMachineOutput.enabled_AP1 || autopilotStateMachineOutput.enabled_AP2); - idAutopilotActive_1->set(autopilotStateMachineOutput.enabled_AP1); - idAutopilotActive_2->set(autopilotStateMachineOutput.enabled_AP2); - - bool isLocArmed = static_cast(autopilotStateMachineOutput.lateral_mode_armed) >> 1 & 0x01; - bool isLocEngaged = autopilotStateMachineOutput.lateral_mode >= 30 && autopilotStateMachineOutput.lateral_mode <= 34; - bool isGsArmed = static_cast(autopilotStateMachineOutput.vertical_mode_armed) >> 4 & 0x01; - bool isGsEngaged = autopilotStateMachineOutput.vertical_mode >= 30 && autopilotStateMachineOutput.vertical_mode <= 34; - bool isFinalArmed = static_cast(autopilotStateMachineOutput.vertical_mode_armed) >> 5 & 0x01; - bool isFinalEngaged = autopilotStateMachineOutput.vertical_mode == 24; - idFcuLocModeActive->set((isLocArmed || isLocEngaged) && !(isGsArmed || isGsEngaged)); - idFcuApprModeActive->set(((isLocArmed || isLocEngaged) && (isGsArmed || isGsEngaged)) || isFinalArmed || isFinalEngaged); - idFcuHeadingSync->set(autopilotStateMachineOutput.mode_reversion_lateral); - idFcuModeReversionActive->set(autopilotStateMachineOutput.mode_reversion_vertical); - idFcuModeReversionTargetFpm->set(autopilotStateMachineOutput.mode_reversion_vertical_target_fpm); - idFcuModeReversionTrkFpaActive->set(autopilotStateMachineOutput.mode_reversion_TRK_FPA); - idAutopilotTcasMessageDisarm->set(autopilotStateMachineOutput.TCAS_message_disarm); - idAutopilotTcasMessageRaInhibited->set(autopilotStateMachineOutput.TCAS_message_RA_inhibit); - idAutopilotTcasMessageTrkFpaDeselection->set(autopilotStateMachineOutput.TCAS_message_TRK_FPA_deselection); - - bool isTcasEngaged = autopilotStateMachineOutput.vertical_mode == 50; - if (!wasTcasEngaged && isTcasEngaged) { - execute_calculator_code("(>H:A320_Neo_FCU_SPEED_TCAS)", nullptr, nullptr, nullptr); - } - wasTcasEngaged = isTcasEngaged; - - // update autothrust mode ------------------------------------------------------------------------------------------- - idAutopilotAutothrustMode->set(autopilotStateMachineOutput.autothrust_mode); - - // connect FD if requested ------------------------------------------------------------------------------------------ - if (simData.ap_fd_1_active) { - flightDirectorConnectLatch_1 = false; - } - if (simData.ap_fd_2_active) { - flightDirectorConnectLatch_2 = false; - } - if (autopilotStateMachineOutput.FD_connect) { - if (!simData.ap_fd_1_active && !flightDirectorConnectLatch_1) { - flightDirectorConnectLatch_1 = true; - simConnectInterface.sendEvent(SimConnectInterface::Events::TOGGLE_FLIGHT_DIRECTOR, 1); - } - if (!simData.ap_fd_2_active && !flightDirectorConnectLatch_2) { - flightDirectorConnectLatch_2 = true; - simConnectInterface.sendEvent(SimConnectInterface::Events::TOGGLE_FLIGHT_DIRECTOR, 2); - } - } - - // disconnect FD if requested --------------------------------------------------------------------------------------- - if (!simData.ap_fd_1_active) { - flightDirectorDisconnectLatch_1 = false; - } - if (!simData.ap_fd_2_active) { - flightDirectorDisconnectLatch_2 = false; - } - if (autopilotStateMachineOutput.FD_disconnect) { - if (simData.ap_fd_1_active && !flightDirectorDisconnectLatch_1) { - flightDirectorDisconnectLatch_1 = true; - simConnectInterface.sendEvent(SimConnectInterface::Events::TOGGLE_FLIGHT_DIRECTOR, 1); - } - if (simData.ap_fd_2_active && !flightDirectorDisconnectLatch_2) { - flightDirectorDisconnectLatch_2 = true; - simConnectInterface.sendEvent(SimConnectInterface::Events::TOGGLE_FLIGHT_DIRECTOR, 2); - } - } - - // update FMA variables --------------------------------------------------------------------------------------------- - idFmaLateralMode->set(autopilotStateMachineOutput.lateral_mode); - idFmaLateralArmed->set(autopilotStateMachineOutput.lateral_mode_armed); - idFmaVerticalMode->set(autopilotStateMachineOutput.vertical_mode); - idFmaVerticalArmed->set(autopilotStateMachineOutput.vertical_mode_armed); - idFmaExpediteModeActive->set(autopilotStateMachineOutput.EXPED_mode_active); - idFmaSpeedProtectionActive->set(autopilotStateMachineOutput.speed_protection_mode); - idFmaSoftAltModeActive->set(autopilotStateMachineOutput.ALT_soft_mode_active); - idFmaCruiseAltModeActive->set(autopilotStateMachineOutput.ALT_cruise_mode_active); - - // calculate and set approach capability - // when no RA is available at all -> CAT1, at least one RA is needed to get into CAT2 or higher - // CAT3 requires two valid RA which are not simulated yet - bool landModeArmedOrActive = (isLocArmed || isLocEngaged) && (isGsArmed || isGsEngaged); - int numberOfAutopilotsEngaged = autopilotStateMachineOutput.enabled_AP1 + autopilotStateMachineOutput.enabled_AP2; - bool autoThrustEngaged = (autoThrustOutput.status == athr_status::ENGAGED_ACTIVE); - bool radioAltimeterAvailable = (simData.H_radio_ft <= 5000); - bool isCat1 = landModeArmedOrActive; - bool isCat2 = landModeArmedOrActive && radioAltimeterAvailable && !autoThrustEngaged && numberOfAutopilotsEngaged >= 1; - bool isCat3S = landModeArmedOrActive && radioAltimeterAvailable && autoThrustEngaged && numberOfAutopilotsEngaged >= 1; - bool isCat3D = landModeArmedOrActive && radioAltimeterAvailable && autoThrustEngaged && numberOfAutopilotsEngaged == 2; - int newApproachCapability = currentApproachCapability; - - if (currentApproachCapability == 0) { - if (isCat1) { - newApproachCapability = 1; - } - } else if (currentApproachCapability == 1) { - if (!isCat1) { - newApproachCapability = 0; - } - if (isCat3S) { - newApproachCapability = 3; - } else if (isCat2) { - newApproachCapability = 2; - } - } else if (currentApproachCapability == 2) { - if (isCat3D) { - newApproachCapability = 4; - } else if (isCat3S) { - newApproachCapability = 3; - } else if (!isCat2) { - newApproachCapability = 1; - } - } else if (currentApproachCapability == 3) { - if ((simData.H_radio_ft > 100) || (simData.H_radio_ft < 100 && numberOfAutopilotsEngaged == 0)) { - if (isCat3D) { - newApproachCapability = 4; - } else if (!isCat3S && !isCat2) { - newApproachCapability = 1; - } else if (!isCat3S && isCat2) { - newApproachCapability = 2; - } - } - } else if (currentApproachCapability == 4) { - if ((simData.H_radio_ft > 100) || (simData.H_radio_ft < 100 && numberOfAutopilotsEngaged == 0)) { - if (!autoThrustEngaged) { - newApproachCapability = 2; - } else if (!isCat3D) { - newApproachCapability = 3; - } - } - } - - bool doUpdate = false; - bool canDowngrade = (simData.simulationTime - previousApproachCapabilityUpdateTime) > 3.0; - bool canUpgrade = (simData.simulationTime - previousApproachCapabilityUpdateTime) > 1.5; - if (newApproachCapability != currentApproachCapability) { - doUpdate = (newApproachCapability == 0 && currentApproachCapability == 1) || - (newApproachCapability == 1 && currentApproachCapability == 0) || - (newApproachCapability > currentApproachCapability && canUpgrade) || - (newApproachCapability < currentApproachCapability && canDowngrade); - } else { - previousApproachCapabilityUpdateTime = simData.simulationTime; - } - - if (doUpdate) { - currentApproachCapability = newApproachCapability; - idFmaApproachCapability->set(currentApproachCapability); - previousApproachCapabilityUpdateTime = simData.simulationTime; - } - - // autoland warning ------------------------------------------------------------------------------------------------- - // if at least one AP engaged and LAND or FLARE mode -> latch - if (simData.H_radio_ft < 200 && numberOfAutopilotsEngaged > 0 && - (autopilotStateMachineOutput.vertical_mode == 32 || autopilotStateMachineOutput.vertical_mode == 33)) { - autolandWarningLatch = true; - } else if (simData.H_radio_ft >= 200 || - (autopilotStateMachineOutput.vertical_mode != 32 && autopilotStateMachineOutput.vertical_mode != 33)) { - autolandWarningLatch = false; - autolandWarningTriggered = false; - idAutopilotAutolandWarning->set(0); - } - - if (autolandWarningLatch && !autolandWarningTriggered) { - if (numberOfAutopilotsEngaged == 0 || - (simData.H_radio_ft > 15 && (abs(simData.nav_loc_error_deg) > 0.2 || simData.nav_loc_valid == false)) || - (simData.H_radio_ft > 100 && (abs(simData.nav_gs_error_deg) > 0.4 || simData.nav_gs_valid == false))) { - autolandWarningTriggered = true; - idAutopilotAutolandWarning->set(1); - } - } - - // FMA triple click and mode reversion ------------------------------------------------------------------------------ - idFmaTripleClick->set(autopilotStateMachineOutput.mode_reversion_triple_click); - idFmaModeReversion->set(autopilotStateMachineOutput.mode_reversion_fma); - - // return result ---------------------------------------------------------------------------------------------------- - return true; -} - -bool FlyByWireInterface::updateAutopilotLaws(double sampleTime) { - // do not further process when active pause is on - if (simConnectInterface.isSimInActivePause()) { - return true; - } - - // get data from interface ------------------------------------------------------------------------------------------ - SimData simData = simConnectInterface.getSimData(); - - // update laws ------------------------------------------------------------------------------------------------------ - if (autopilotLawsEnabled) { - // time ----------------------------------------------------------------------------------------------------------- - autopilotLawsInput.in.time.dt = sampleTime; - autopilotLawsInput.in.time.simulation_time = simData.simulationTime; - - // data ----------------------------------------------------------------------------------------------------------- - autopilotLawsInput.in.data.aircraft_position.lat = simData.latitude_deg; - autopilotLawsInput.in.data.aircraft_position.lon = simData.longitude_deg; - autopilotLawsInput.in.data.aircraft_position.alt = simData.altitude_m; - autopilotLawsInput.in.data.Theta_deg = simData.Theta_deg; - autopilotLawsInput.in.data.Phi_deg = simData.Phi_deg; - autopilotLawsInput.in.data.q_rad_s = simData.bodyRotationVelocity.x; - autopilotLawsInput.in.data.r_rad_s = simData.bodyRotationVelocity.y; - autopilotLawsInput.in.data.p_rad_s = simData.bodyRotationVelocity.z; - autopilotLawsInput.in.data.V_ias_kn = simData.V_ias_kn; - autopilotLawsInput.in.data.V_tas_kn = simData.V_tas_kn; - autopilotLawsInput.in.data.V_mach = simData.V_mach; - autopilotLawsInput.in.data.V_gnd_kn = simData.V_gnd_kn; - autopilotLawsInput.in.data.alpha_deg = simData.alpha_deg; - autopilotLawsInput.in.data.beta_deg = simData.beta_deg; - autopilotLawsInput.in.data.H_ft = simData.H_ft; - autopilotLawsInput.in.data.H_ind_ft = simData.H_ind_ft; - autopilotLawsInput.in.data.H_radio_ft = simData.H_radio_ft; - autopilotLawsInput.in.data.H_dot_ft_min = simData.H_dot_fpm; - autopilotLawsInput.in.data.Psi_magnetic_deg = simData.Psi_magnetic_deg; - autopilotLawsInput.in.data.Psi_magnetic_track_deg = simData.Psi_magnetic_track_deg; - autopilotLawsInput.in.data.Psi_true_deg = simData.Psi_true_deg; - autopilotLawsInput.in.data.bx_m_s2 = simData.bx_m_s2; - autopilotLawsInput.in.data.by_m_s2 = simData.by_m_s2; - autopilotLawsInput.in.data.bz_m_s2 = simData.bz_m_s2; - autopilotLawsInput.in.data.nav_valid = (simData.nav_valid != 0); - const auto backbeam = idFm1BackbeamSelected->get() != 0; - autopilotLawsInput.in.data.nav_loc_deg = MathUtils::normalise360(simData.nav_loc_deg + (backbeam ? 180 : 0)); - autopilotLawsInput.in.data.nav_gs_deg = simData.nav_gs_deg; - if (idRadioReceiverUsageEnabled->get()) { - autopilotLawsInput.in.data.nav_dme_valid = 0; // this forces the usage of the calculated dme - autopilotLawsInput.in.data.nav_dme_nmi = idRadioReceiverLocalizerDistance->get(); - autopilotLawsInput.in.data.nav_loc_valid = idRadioReceiverLocalizerValid->get() != 0; - const auto locDeviation = MathUtils::correctMsfsLocaliserError(idRadioReceiverLocalizerDeviation->get()); - autopilotLawsInput.in.data.nav_loc_error_deg = backbeam ? -locDeviation : locDeviation; - autopilotLawsInput.in.data.nav_gs_valid = idRadioReceiverGlideSlopeValid->get() != 0; - autopilotLawsInput.in.data.nav_gs_error_deg = idRadioReceiverGlideSlopeDeviation->get(); - } else { - autopilotLawsInput.in.data.nav_dme_valid = (simData.nav_dme_valid != 0); - autopilotLawsInput.in.data.nav_dme_nmi = simData.nav_dme_nmi; - autopilotLawsInput.in.data.nav_loc_valid = (simData.nav_loc_valid != 0); - const auto locDeviation = MathUtils::correctMsfsLocaliserError(simData.nav_loc_error_deg); - autopilotLawsInput.in.data.nav_loc_error_deg = backbeam ? -locDeviation : locDeviation; - autopilotLawsInput.in.data.nav_gs_valid = (simData.nav_gs_valid != 0); - autopilotLawsInput.in.data.nav_gs_error_deg = simData.nav_gs_error_deg; - } - autopilotLawsInput.in.data.nav_loc_magvar_deg = simData.nav_loc_magvar_deg; - autopilotLawsInput.in.data.nav_loc_position.lat = simData.nav_loc_pos.Latitude; - autopilotLawsInput.in.data.nav_loc_position.lon = simData.nav_loc_pos.Longitude; - autopilotLawsInput.in.data.nav_loc_position.alt = simData.nav_loc_pos.Altitude; - autopilotLawsInput.in.data.nav_gs_position.lat = simData.nav_gs_pos.Latitude; - autopilotLawsInput.in.data.nav_gs_position.lon = simData.nav_gs_pos.Longitude; - autopilotLawsInput.in.data.nav_gs_position.alt = simData.nav_gs_pos.Altitude; - autopilotLawsInput.in.data.flight_guidance_xtk_nmi = idFlightGuidanceCrossTrackError->get(); - autopilotLawsInput.in.data.flight_guidance_tae_deg = idFlightGuidanceTrackAngleError->get(); - autopilotLawsInput.in.data.flight_guidance_phi_deg = idFlightGuidancePhiCommand->get(); - autopilotLawsInput.in.data.flight_guidance_phi_limit_deg = idFlightGuidancePhiLimit->get(); - autopilotLawsInput.in.data.flight_phase = idFmgcFlightPhase->get(); - autopilotLawsInput.in.data.V2_kn = idFmgcV2->get(); - autopilotLawsInput.in.data.VAPP_kn = idFmgcV_APP->get(); - autopilotLawsInput.in.data.VLS_kn = - facsDiscreteOutputs[0].fac_healthy ? facsBusOutputs[0].v_ls_kn.Data : facsBusOutputs[1].v_ls_kn.Data; - autopilotLawsInput.in.data.VMAX_kn = - facsDiscreteOutputs[0].fac_healthy ? facsBusOutputs[0].v_max_kn.Data : facsBusOutputs[1].v_max_kn.Data; - autopilotLawsInput.in.data.is_flight_plan_available = idFlightGuidanceAvailable->get(); - autopilotLawsInput.in.data.altitude_constraint_ft = idFmgcAltitudeConstraint->get(); - autopilotLawsInput.in.data.thrust_reduction_altitude = fmThrustReductionAltitude->valueOr(0); - autopilotLawsInput.in.data.thrust_reduction_altitude_go_around = fmThrustReductionAltitudeGoAround->valueOr(0); - autopilotLawsInput.in.data.acceleration_altitude = fmAccelerationAltitude->valueOr(0); - autopilotLawsInput.in.data.acceleration_altitude_engine_out = fmAccelerationAltitudeEngineOut->valueOr(0); - autopilotLawsInput.in.data.acceleration_altitude_go_around = fmAccelerationAltitudeGoAround->valueOr(0); - autopilotLawsInput.in.data.acceleration_altitude_go_around_engine_out = fmAccelerationAltitudeGoAroundEngineOut->valueOr(0); - autopilotLawsInput.in.data.throttle_lever_1_pos = thrustLeverAngle_1->get(); - autopilotLawsInput.in.data.throttle_lever_2_pos = thrustLeverAngle_2->get(); - autopilotLawsInput.in.data.gear_strut_compression_1 = simData.gear_animation_pos_1; - autopilotLawsInput.in.data.gear_strut_compression_2 = simData.gear_animation_pos_2; - autopilotLawsInput.in.data.zeta_pos = simData.zeta_pos; - autopilotLawsInput.in.data.flaps_handle_index = flapsHandleIndexFlapConf->get(); - autopilotLawsInput.in.data.is_engine_operative_1 = simData.engine_combustion_1; - autopilotLawsInput.in.data.is_engine_operative_2 = simData.engine_combustion_2; - autopilotLawsInput.in.data.altimeter_setting_left_mbar = simData.kohlsmanSetting_0; - autopilotLawsInput.in.data.altimeter_setting_right_mbar = simData.kohlsmanSetting_1; - autopilotLawsInput.in.data.total_weight_kg = simData.total_weight_kg; - - // input ---------------------------------------------------------------------------------------------------------- - autopilotLawsInput.in.input = autopilotStateMachineOutput; - - // step the model ------------------------------------------------------------------------------------------------- - autopilotLaws.setExternalInputs(&autopilotLawsInput); - autopilotLaws.step(); - - // result --------------------------------------------------------------------------------------------------------- - autopilotLawsOutput = autopilotLaws.getExternalOutputs().out.output; - } else { - if (autopilotStateMachineEnabled) { - // send data to client data to be read by simulink - ClientDataAutopilotStateMachine clientDataStateMachine = { - autopilotStateMachineOutput.enabled_AP1, - autopilotStateMachineOutput.enabled_AP2, - autopilotStateMachineOutput.lateral_law, - autopilotStateMachineOutput.lateral_mode, - autopilotStateMachineOutput.lateral_mode_armed, - autopilotStateMachineOutput.vertical_law, - autopilotStateMachineOutput.vertical_mode, - autopilotStateMachineOutput.vertical_mode_armed, - autopilotStateMachineOutput.mode_reversion_lateral, - autopilotStateMachineOutput.mode_reversion_vertical, - autopilotStateMachineOutput.mode_reversion_vertical_target_fpm, - autopilotStateMachineOutput.mode_reversion_TRK_FPA, - autopilotStateMachineOutput.mode_reversion_triple_click, - autopilotStateMachineOutput.mode_reversion_fma, - autopilotStateMachineOutput.speed_protection_mode, - autopilotStateMachineOutput.autothrust_mode, - autopilotStateMachineOutput.Psi_c_deg, - autopilotStateMachineOutput.H_c_ft, - autopilotStateMachineOutput.H_dot_c_fpm, - autopilotStateMachineOutput.FPA_c_deg, - autopilotStateMachineOutput.V_c_kn, - autopilotStateMachineOutput.ALT_soft_mode_active, - autopilotStateMachineOutput.ALT_cruise_mode_active, - autopilotStateMachineOutput.EXPED_mode_active, - autopilotStateMachineOutput.FD_disconnect, - autopilotStateMachineOutput.FD_connect, - idRadioReceiverLocalizerValid->get(), - idRadioReceiverLocalizerDeviation->get(), - idRadioReceiverGlideSlopeValid->get(), - idRadioReceiverGlideSlopeDeviation->get(), - autopilotStateMachineOutput.TCAS_message_disarm, - autopilotStateMachineOutput.TCAS_message_RA_inhibit, - autopilotStateMachineOutput.TCAS_message_TRK_FPA_deselection, - }; - simConnectInterface.setClientDataAutopilotStateMachine(clientDataStateMachine); - } - // read client data written by simulink - ClientDataAutopilotLaws clientDataLaws = simConnectInterface.getClientDataAutopilotLaws(); - autopilotLawsOutput.ap_on = clientDataLaws.enableAutopilot; - autopilotLawsOutput.flight_director.Theta_c_deg = clientDataLaws.flightDirectorTheta; - autopilotLawsOutput.autopilot.Theta_c_deg = clientDataLaws.autopilotTheta; - autopilotLawsOutput.flight_director.Phi_c_deg = clientDataLaws.flightDirectorPhi; - autopilotLawsOutput.autopilot.Phi_c_deg = clientDataLaws.autopilotPhi; - autopilotLawsOutput.flight_director.Beta_c_deg = clientDataLaws.autopilotBeta; - autopilotLawsOutput.autopilot.Beta_c_deg = clientDataLaws.autopilotBeta; - autopilotLawsOutput.Phi_loc_c = clientDataLaws.locPhiCommand; - autopilotLawsOutput.Nosewheel_c = clientDataLaws.nosewheelCommand; - autopilotLawsOutput.flare_law.condition_Flare = clientDataLaws.conditionFlare; - } - - base_arinc_429 raToUse; - if (raBusOutputs[0].radio_height_ft.SSM != Arinc429SignStatus::FailureWarning) { - raToUse = raBusOutputs[0].radio_height_ft; - } else { - raToUse = raBusOutputs[1].radio_height_ft; - } - - fmgcBBusOutputs.fg_radio_height_ft = raToUse; - fmgcBBusOutputs.delta_p_ail_cmd_deg.SSM = Arinc429SignStatus::NormalOperation; - fmgcBBusOutputs.delta_p_ail_cmd_deg.Data = autopilotLawsOutput.autopilot.Phi_c_deg; - fmgcBBusOutputs.delta_p_splr_cmd_deg.SSM = Arinc429SignStatus::NormalOperation; - fmgcBBusOutputs.delta_p_splr_cmd_deg.Data = 0; - fmgcBBusOutputs.delta_r_cmd_deg.SSM = Arinc429SignStatus::NormalOperation; - fmgcBBusOutputs.delta_r_cmd_deg.Data = autopilotLawsOutput.autopilot.Beta_c_deg; - fmgcBBusOutputs.delta_q_cmd_deg.SSM = Arinc429SignStatus::NormalOperation; - fmgcBBusOutputs.delta_q_cmd_deg.Data = autopilotLawsOutput.autopilot.Theta_c_deg; - fmgcBBusOutputs.fm_weight_lbs.SSM = - idFmGrossWeight->get() == 0 ? Arinc429SignStatus::NoComputedData : Arinc429SignStatus::NormalOperation; - fmgcBBusOutputs.fm_weight_lbs.Data = idFmGrossWeight->get() * 2205; - fmgcBBusOutputs.fm_cg_percent.SSM = Arinc429SignStatus::NormalOperation; - fmgcBBusOutputs.fm_cg_percent.Data = simData.CG_percent_MAC; - fmgcBBusOutputs.fac_weight_lbs.SSM = Arinc429SignStatus::NormalOperation; - fmgcBBusOutputs.fac_weight_lbs.Data = simData.total_weight_kg * 2.20462262; - fmgcBBusOutputs.fac_cg_percent.SSM = Arinc429SignStatus::NormalOperation; - fmgcBBusOutputs.fac_cg_percent.Data = simData.CG_percent_MAC; - - if (elacDisabled != -1 || facDisabled != -1) { - simConnectInterface.setClientDataFmgcB(fmgcBBusOutputs, 0); - } - - // update flight director ------------------------------------------------------------------------------------------- - idFlightDirectorPitch->set(-autopilotLawsOutput.flight_director.Theta_c_deg); - idFlightDirectorBank->set(-autopilotLawsOutput.flight_director.Phi_c_deg); - idFlightDirectorYaw->set(autopilotLawsOutput.flight_director.Beta_c_deg); - - // update development variables ------------------------------------------------------------------------------------- - idDevelopmentAutoland_condition_Flare->set(autopilotLawsOutput.flare_law.condition_Flare); - idAutopilot_H_dot_radio->set(autopilotLawsOutput.flare_law.H_dot_radio_fpm); - idDevelopmentAutoland_H_dot_c_fpm->set(autopilotLawsOutput.flare_law.H_dot_c_fpm); - idDevelopmentAutoland_delta_Theta_H_dot_deg->set(autopilotLawsOutput.flare_law.delta_Theta_H_dot_deg); - idDevelopmentAutoland_delta_Theta_bx_deg->set(autopilotLawsOutput.flare_law.delta_Theta_bx_deg); - idDevelopmentAutoland_delta_Theta_bz_deg->set(autopilotLawsOutput.flare_law.delta_Theta_bz_deg); - idDevelopmentAutoland_delta_Theta_beta_c_deg->set(autopilotLawsOutput.flare_law.delta_Theta_beta_c_deg); - - // return result ---------------------------------------------------------------------------------------------------- - return true; -} - bool FlyByWireInterface::updateFlyByWire(double sampleTime) { // get data from interface ------------------------------------------------------------------------------------------ SimData simData = simConnectInterface.getSimData(); @@ -2388,13 +2072,6 @@ bool FlyByWireInterface::updateFlyByWire(double sampleTime) { // provide tracking mode state idTrackingMode->set(wasInSlew || pauseDetected || idExternalOverride->get()); - // determine if nosewheel demand shall be set - if (!(wasInSlew || pauseDetected || idExternalOverride->get())) { - idAutopilotNosewheelDemand->set(autopilotLawsOutput.Nosewheel_c); - } else { - idAutopilotNosewheelDemand->set(0); - } - // success ---------------------------------------------------------------------------------------------------------- return true; } @@ -2420,148 +2097,94 @@ bool FlyByWireInterface::updateAutothrust(double sampleTime) { // update reverser thrust limit idAutothrustThrustLimitREV->set(idAutothrustThrustLimitTOGA->get() * autothrustThrustLimitReversePercentageToga); - // set client data if needed - if (!autoThrustEnabled || !autopilotStateMachineEnabled || !flyByWireEnabled) { - ClientDataLocalVariablesAutothrust ClientDataLocalVariablesAutothrust = { - simConnectInterface.getSimInputThrottles().ATHR_push, - simConnectInterface.getSimInputThrottles().ATHR_disconnect || idAutothrustDisconnect->get() == 1, - thrustLeverAngle_1->get(), - thrustLeverAngle_2->get(), - simData.ap_V_c_kn, - facsDiscreteOutputs[0].fac_healthy ? facsBusOutputs[0].v_ls_kn.Data : facsBusOutputs[1].v_ls_kn.Data, - facsDiscreteOutputs[0].fac_healthy ? facsBusOutputs[0].v_max_kn.Data : facsBusOutputs[1].v_max_kn.Data, - idAutothrustThrustLimitREV->get(), - idAutothrustThrustLimitIDLE->get(), - idAutothrustThrustLimitCLB->get(), - idAutothrustThrustLimitFLX->get(), - idAutothrustThrustLimitMCT->get(), - idAutothrustThrustLimitTOGA->get(), - idFmgcFlexTemperature->get(), - autopilotStateMachineOutput.autothrust_mode, - simData.is_mach_mode_active, - reinterpret_cast(&facsBusOutputs[0].discrete_word_5)->bitFromValueOr(29, false) || - reinterpret_cast(&facsBusOutputs[1].discrete_word_5)->bitFromValueOr(29, false), - autopilotStateMachineOutput.vertical_mode >= 30 && autopilotStateMachineOutput.vertical_mode <= 34, - autopilotStateMachineOutput.vertical_mode == 40, - autopilotStateMachineOutput.vertical_mode == 41, - autopilotStateMachineOutput.vertical_mode == 32, - fmThrustReductionAltitude->valueOr(0), - fmThrustReductionAltitudeGoAround->valueOr(0), - idFmgcFlightPhase->get(), - autopilotStateMachineOutput.ALT_soft_mode_active, - getTcasAdvisoryState() > 1, - autopilotStateMachineOutput.H_dot_c_fpm, - }; - simConnectInterface.setClientDataLocalVariablesAutothrust(ClientDataLocalVariablesAutothrust); - } - - if (autoThrustEnabled) { - autoThrustInput.in.time.dt = sampleTime; - autoThrustInput.in.time.simulation_time = simData.simulationTime; - - autoThrustInput.in.data.nz_g = simData.nz_g; - autoThrustInput.in.data.Theta_deg = simData.Theta_deg; - autoThrustInput.in.data.Phi_deg = simData.Phi_deg; - autoThrustInput.in.data.V_ias_kn = simData.V_ias_kn; - autoThrustInput.in.data.V_tas_kn = simData.V_tas_kn; - autoThrustInput.in.data.V_mach = simData.V_mach; - autoThrustInput.in.data.V_gnd_kn = simData.V_gnd_kn; - autoThrustInput.in.data.alpha_deg = simData.alpha_deg; - autoThrustInput.in.data.H_ft = simData.H_ft; - autoThrustInput.in.data.H_ind_ft = simData.H_ind_ft; - autoThrustInput.in.data.H_radio_ft = simData.H_radio_ft; - autoThrustInput.in.data.H_dot_fpm = simData.H_dot_fpm; - autoThrustInput.in.data.bx_m_s2 = simData.bx_m_s2; - autoThrustInput.in.data.by_m_s2 = simData.by_m_s2; - autoThrustInput.in.data.bz_m_s2 = simData.bz_m_s2; - autoThrustInput.in.data.gear_strut_compression_1 = simData.gear_animation_pos_1; - autoThrustInput.in.data.gear_strut_compression_2 = simData.gear_animation_pos_2; - autoThrustInput.in.data.flap_handle_index = flapsHandleIndexFlapConf->get(); - autoThrustInput.in.data.is_engine_operative_1 = simData.engine_combustion_1; - autoThrustInput.in.data.is_engine_operative_2 = simData.engine_combustion_2; - autoThrustInput.in.data.commanded_engine_N1_1_percent = simData.commanded_engine_N1_1_percent; - autoThrustInput.in.data.commanded_engine_N1_2_percent = simData.commanded_engine_N1_2_percent; - autoThrustInput.in.data.engine_N1_1_percent = simData.engine_N1_1_percent; - autoThrustInput.in.data.engine_N1_2_percent = simData.engine_N1_2_percent; - autoThrustInput.in.data.corrected_engine_N1_1_percent = simData.corrected_engine_N1_1_percent; - autoThrustInput.in.data.corrected_engine_N1_2_percent = simData.corrected_engine_N1_2_percent; - autoThrustInput.in.data.TAT_degC = simData.total_air_temperature_celsius; - autoThrustInput.in.data.OAT_degC = simData.ambient_temperature_celsius; - - autoThrustInput.in.input.ATHR_push = simConnectInterface.getSimInputThrottles().ATHR_push; - autoThrustInput.in.input.ATHR_disconnect = - simConnectInterface.getSimInputThrottles().ATHR_disconnect || idAutothrustDisconnect->get() == 1; - autoThrustInput.in.input.TLA_1_deg = thrustLeverAngle_1->get(); - autoThrustInput.in.input.TLA_2_deg = thrustLeverAngle_2->get(); - autoThrustInput.in.input.V_c_kn = simData.ap_V_c_kn; - autoThrustInput.in.input.V_LS_kn = facsDiscreteOutputs[0].fac_healthy ? facsBusOutputs[0].v_ls_kn.Data : facsBusOutputs[1].v_ls_kn.Data; - autoThrustInput.in.input.V_MAX_kn = - facsDiscreteOutputs[0].fac_healthy ? facsBusOutputs[0].v_max_kn.Data : facsBusOutputs[1].v_max_kn.Data; - autoThrustInput.in.input.thrust_limit_REV_percent = idAutothrustThrustLimitREV->get(); - autoThrustInput.in.input.thrust_limit_IDLE_percent = idAutothrustThrustLimitIDLE->get(); - autoThrustInput.in.input.thrust_limit_CLB_percent = idAutothrustThrustLimitCLB->get(); - autoThrustInput.in.input.thrust_limit_MCT_percent = idAutothrustThrustLimitMCT->get(); - autoThrustInput.in.input.thrust_limit_FLEX_percent = idAutothrustThrustLimitFLX->get(); - autoThrustInput.in.input.thrust_limit_TOGA_percent = idAutothrustThrustLimitTOGA->get(); - autoThrustInput.in.input.flex_temperature_degC = idFmgcFlexTemperature->get(); - autoThrustInput.in.input.mode_requested = autopilotStateMachineOutput.autothrust_mode; - autoThrustInput.in.input.is_mach_mode_active = simData.is_mach_mode_active; - autoThrustInput.in.input.alpha_floor_condition = - reinterpret_cast(&facsBusOutputs[0].discrete_word_5)->bitFromValueOr(29, false) || - reinterpret_cast(&facsBusOutputs[1].discrete_word_5)->bitFromValueOr(29, false); - autoThrustInput.in.input.is_approach_mode_active = - (autopilotStateMachineOutput.vertical_mode >= 30 && autopilotStateMachineOutput.vertical_mode <= 34) || - autopilotStateMachineOutput.vertical_mode == 24; - autoThrustInput.in.input.is_SRS_TO_mode_active = autopilotStateMachineOutput.vertical_mode == 40; - autoThrustInput.in.input.is_SRS_GA_mode_active = autopilotStateMachineOutput.vertical_mode == 41; - autoThrustInput.in.input.is_LAND_mode_active = autopilotStateMachineOutput.vertical_mode == 32; - autoThrustInput.in.input.thrust_reduction_altitude = fmThrustReductionAltitude->valueOr(0); - autoThrustInput.in.input.thrust_reduction_altitude_go_around = fmThrustReductionAltitudeGoAround->valueOr(0); - autoThrustInput.in.input.flight_phase = idFmgcFlightPhase->get(); - autoThrustInput.in.input.is_alt_soft_mode_active = autopilotStateMachineOutput.ALT_soft_mode_active; - autoThrustInput.in.input.is_anti_ice_wing_active = additionalData.wingAntiIce == 1; - autoThrustInput.in.input.is_anti_ice_engine_1_active = simData.engineAntiIce_1 == 1; - autoThrustInput.in.input.is_anti_ice_engine_2_active = simData.engineAntiIce_2 == 1; - autoThrustInput.in.input.is_air_conditioning_1_active = idAirConditioningPack_1->get(); - autoThrustInput.in.input.is_air_conditioning_2_active = idAirConditioningPack_2->get(); - autoThrustInput.in.input.FD_active = simData.ap_fd_1_active || simData.ap_fd_2_active; - autoThrustInput.in.input.ATHR_reset_disable = simConnectInterface.getSimInputThrottles().ATHR_reset_disable == 1; - autoThrustInput.in.input.is_TCAS_active = getTcasAdvisoryState() > 1; - autoThrustInput.in.input.target_TCAS_RA_rate_fpm = autopilotStateMachineOutput.H_dot_c_fpm; - autoThrustInput.in.input.tracking_mode_on_override = simConnectInterface.isSimInActivePause(); - - // step the model ------------------------------------------------------------------------------------------------- - autoThrust.setExternalInputs(&autoThrustInput); - autoThrust.step(); - - // get output from model ------------------------------------------------------------------------------------------ - autoThrustOutput = autoThrust.getExternalOutputs().out.output; - - // set autothrust disabled state (when ATHR disconnect is pressed longer than 15s) - idAutothrustDisabled->set(autoThrust.getExternalOutputs().out.data_computed.ATHR_disabled); - - // write output to sim -------------------------------------------------------------------------------------------- - SimOutputThrottles simOutputThrottles = {std::fmin(99.9999999999999, autoThrustOutput.sim_throttle_lever_1_pos), - std::fmin(99.9999999999999, autoThrustOutput.sim_throttle_lever_2_pos), - autoThrustOutput.sim_thrust_mode_1, autoThrustOutput.sim_thrust_mode_2}; - if (!simConnectInterface.sendData(simOutputThrottles)) { - std::cout << "WASM: Write data failed!" << std::endl; - return false; - } - } else { - // read data from client data - ClientDataAutothrust clientData = simConnectInterface.getClientDataAutothrust(); - autoThrustOutput.N1_TLA_1_percent = clientData.N1_TLA_1_percent; - autoThrustOutput.N1_TLA_2_percent = clientData.N1_TLA_2_percent; - autoThrustOutput.is_in_reverse_1 = clientData.is_in_reverse_1; - autoThrustOutput.is_in_reverse_2 = clientData.is_in_reverse_2; - autoThrustOutput.thrust_limit_type = static_cast(clientData.thrust_limit_type); - autoThrustOutput.thrust_limit_percent = clientData.thrust_limit_percent; - autoThrustOutput.N1_c_1_percent = clientData.N1_c_1_percent; - autoThrustOutput.N1_c_2_percent = clientData.N1_c_2_percent; - autoThrustOutput.status = static_cast(clientData.status); - autoThrustOutput.mode = static_cast(clientData.mode); - autoThrustOutput.mode_message = static_cast(clientData.mode_message); + autoThrustInput.in.time.dt = sampleTime; + autoThrustInput.in.time.simulation_time = simData.simulationTime; + + autoThrustInput.in.data.nz_g = simData.nz_g; + autoThrustInput.in.data.Theta_deg = simData.Theta_deg; + autoThrustInput.in.data.Phi_deg = simData.Phi_deg; + autoThrustInput.in.data.V_ias_kn = simData.V_ias_kn; + autoThrustInput.in.data.V_tas_kn = simData.V_tas_kn; + autoThrustInput.in.data.V_mach = simData.V_mach; + autoThrustInput.in.data.V_gnd_kn = simData.V_gnd_kn; + autoThrustInput.in.data.alpha_deg = simData.alpha_deg; + autoThrustInput.in.data.H_ft = simData.H_ft; + autoThrustInput.in.data.H_ind_ft = simData.H_ind_ft; + autoThrustInput.in.data.H_radio_ft = simData.H_radio_ft; + autoThrustInput.in.data.H_dot_fpm = simData.H_dot_fpm; + autoThrustInput.in.data.bx_m_s2 = simData.bx_m_s2; + autoThrustInput.in.data.by_m_s2 = simData.by_m_s2; + autoThrustInput.in.data.bz_m_s2 = simData.bz_m_s2; + autoThrustInput.in.data.gear_strut_compression_1 = simData.gear_animation_pos_1; + autoThrustInput.in.data.gear_strut_compression_2 = simData.gear_animation_pos_2; + autoThrustInput.in.data.flap_handle_index = flapsHandleIndexFlapConf->get(); + autoThrustInput.in.data.is_engine_operative_1 = simData.engine_combustion_1; + autoThrustInput.in.data.is_engine_operative_2 = simData.engine_combustion_2; + autoThrustInput.in.data.commanded_engine_N1_1_percent = simData.commanded_engine_N1_1_percent; + autoThrustInput.in.data.commanded_engine_N1_2_percent = simData.commanded_engine_N1_2_percent; + autoThrustInput.in.data.engine_N1_1_percent = simData.engine_N1_1_percent; + autoThrustInput.in.data.engine_N1_2_percent = simData.engine_N1_2_percent; + autoThrustInput.in.data.corrected_engine_N1_1_percent = simData.corrected_engine_N1_1_percent; + autoThrustInput.in.data.corrected_engine_N1_2_percent = simData.corrected_engine_N1_2_percent; + autoThrustInput.in.data.TAT_degC = simData.total_air_temperature_celsius; + autoThrustInput.in.data.OAT_degC = simData.ambient_temperature_celsius; + + autoThrustInput.in.input.ATHR_push = simConnectInterface.getSimInputThrottles().ATHR_push; + autoThrustInput.in.input.ATHR_disconnect = + simConnectInterface.getSimInputThrottles().ATHR_disconnect || idAutothrustDisconnect->get() == 1; + autoThrustInput.in.input.TLA_1_deg = thrustLeverAngle_1->get(); + autoThrustInput.in.input.TLA_2_deg = thrustLeverAngle_2->get(); + autoThrustInput.in.input.V_c_kn = simData.ap_V_c_kn; + autoThrustInput.in.input.V_LS_kn = facsDiscreteOutputs[0].fac_healthy ? facsBusOutputs[0].v_ls_kn.Data : facsBusOutputs[1].v_ls_kn.Data; + autoThrustInput.in.input.V_MAX_kn = + facsDiscreteOutputs[0].fac_healthy ? facsBusOutputs[0].v_max_kn.Data : facsBusOutputs[1].v_max_kn.Data; + autoThrustInput.in.input.thrust_limit_REV_percent = idAutothrustThrustLimitREV->get(); + autoThrustInput.in.input.thrust_limit_IDLE_percent = idAutothrustThrustLimitIDLE->get(); + autoThrustInput.in.input.thrust_limit_CLB_percent = idAutothrustThrustLimitCLB->get(); + autoThrustInput.in.input.thrust_limit_MCT_percent = idAutothrustThrustLimitMCT->get(); + autoThrustInput.in.input.thrust_limit_FLEX_percent = idAutothrustThrustLimitFLX->get(); + autoThrustInput.in.input.thrust_limit_TOGA_percent = idAutothrustThrustLimitTOGA->get(); + autoThrustInput.in.input.flex_temperature_degC = idFmgcFlexTemperature->get(); + autoThrustInput.in.input.mode_requested = 0; + autoThrustInput.in.input.is_mach_mode_active = simData.is_mach_mode_active; + autoThrustInput.in.input.alpha_floor_condition = + reinterpret_cast(&facsBusOutputs[0].discrete_word_5)->bitFromValueOr(29, false) || + reinterpret_cast(&facsBusOutputs[1].discrete_word_5)->bitFromValueOr(29, false); + autoThrustInput.in.input.is_approach_mode_active = false; + autoThrustInput.in.input.is_SRS_TO_mode_active = false; + autoThrustInput.in.input.is_SRS_GA_mode_active = false; + autoThrustInput.in.input.is_LAND_mode_active = false; + autoThrustInput.in.input.thrust_reduction_altitude = fmThrustReductionAltitude->valueOr(0); + autoThrustInput.in.input.thrust_reduction_altitude_go_around = fmThrustReductionAltitudeGoAround->valueOr(0); + autoThrustInput.in.input.flight_phase = idFmgcFlightPhase->get(); + autoThrustInput.in.input.is_alt_soft_mode_active = false; + autoThrustInput.in.input.is_anti_ice_wing_active = additionalData.wingAntiIce == 1; + autoThrustInput.in.input.is_anti_ice_engine_1_active = simData.engineAntiIce_1 == 1; + autoThrustInput.in.input.is_anti_ice_engine_2_active = simData.engineAntiIce_2 == 1; + autoThrustInput.in.input.is_air_conditioning_1_active = idAirConditioningPack_1->get(); + autoThrustInput.in.input.is_air_conditioning_2_active = idAirConditioningPack_2->get(); + autoThrustInput.in.input.FD_active = simData.ap_fd_1_active || simData.ap_fd_2_active; + autoThrustInput.in.input.ATHR_reset_disable = simConnectInterface.getSimInputThrottles().ATHR_reset_disable == 1; + autoThrustInput.in.input.is_TCAS_active = getTcasAdvisoryState() > 1; + autoThrustInput.in.input.target_TCAS_RA_rate_fpm = 0; + + // step the model ------------------------------------------------------------------------------------------------- + autoThrust.setExternalInputs(&autoThrustInput); + autoThrust.step(); + + // get output from model ------------------------------------------------------------------------------------------ + autoThrustOutput = autoThrust.getExternalOutputs().out.output; + + // set autothrust disabled state (when ATHR disconnect is pressed longer than 15s) + idAutothrustDisabled->set(autoThrust.getExternalOutputs().out.data_computed.ATHR_disabled); + + // write output to sim -------------------------------------------------------------------------------------------- + SimOutputThrottles simOutputThrottles = {std::fmin(99.9999999999999, autoThrustOutput.sim_throttle_lever_1_pos), + std::fmin(99.9999999999999, autoThrustOutput.sim_throttle_lever_2_pos), + autoThrustOutput.sim_thrust_mode_1, autoThrustOutput.sim_thrust_mode_2}; + if (!simConnectInterface.sendData(simOutputThrottles)) { + std::cout << "WASM: Write data failed!" << std::endl; + return false; } // update local variables @@ -2587,9 +2210,6 @@ bool FlyByWireInterface::updateAutothrust(double sampleTime) { idAutothrustThrustLeverWarningToga->set(0); } - // reset button state - simConnectInterface.resetSimInputThrottles(); - // success return true; } @@ -2625,46 +2245,6 @@ bool FlyByWireInterface::updateAltimeterSetting(double sampleTime) { return true; } -bool FlyByWireInterface::updateFoSide(double sampleTime) { - // get sim data - auto simData = simConnectInterface.getSimData(); - - // FD Button - if (additionalData.syncFoEfisEnabled && simData.ap_fd_1_active != simData.ap_fd_2_active) { - if (last_fd1_active != simData.ap_fd_1_active) { - simConnectInterface.sendEvent(SimConnectInterface::Events::TOGGLE_FLIGHT_DIRECTOR, 2); - } - - if (last_fd2_active != simData.ap_fd_2_active) { - simConnectInterface.sendEvent(SimConnectInterface::Events::TOGGLE_FLIGHT_DIRECTOR, 1); - } - } - last_fd1_active = simData.ap_fd_1_active; - last_fd2_active = simData.ap_fd_2_active; - - // LS Button - if (additionalData.syncFoEfisEnabled && additionalData.ls1Active != additionalData.ls2Active) { - if (last_ls1_active != additionalData.ls1Active) { - idLs2Active->set(additionalData.ls1Active); - } - - if (last_ls2_active != additionalData.ls2Active) { - idLs1Active->set(additionalData.ls2Active); - } - } - last_ls1_active = additionalData.ls1Active; - last_ls2_active = additionalData.ls2Active; - - // inHg/hPa switch - // Currently synced already - - // STD Button - // Currently synced already - - // result - return true; -} - double FlyByWireInterface::getTcasModeAvailable() { auto state = idTcasMode->get(); auto isTaOnly = idTcasTaOnly->get(); diff --git a/fbw-a32nx/src/wasm/fbw_a320/src/FlyByWireInterface.h b/fbw-a32nx/src/wasm/fbw_a320/src/FlyByWireInterface.h index 0af482e4164f..4c7b9ef5373d 100644 --- a/fbw-a32nx/src/wasm/fbw_a320/src/FlyByWireInterface.h +++ b/fbw-a32nx/src/wasm/fbw_a320/src/FlyByWireInterface.h @@ -5,8 +5,6 @@ #include "AdditionalData.h" #include "Arinc429.h" -#include "AutopilotLaws.h" -#include "AutopilotStateMachine.h" #include "Autothrust.h" #include "CalculatedRadioReceiver.h" #include "EngineData.h" @@ -21,6 +19,8 @@ #include "fac/Fac.h" #include "failures/FailuresConsumer.h" #include "fcdc/Fcdc.h" +#include "fcu/Fcu.h" +#include "fmgc/Fmgc.h" #include "sec/Sec.h" #include "utils/ConfirmNode.h" @@ -56,13 +56,11 @@ class FlyByWireInterface { double targetSimulationRate = 1; bool targetSimulationRateModified = false; - bool autopilotStateMachineEnabled = false; - bool autopilotLawsEnabled = false; - bool flyByWireEnabled = false; int elacDisabled = -1; int secDisabled = -1; int facDisabled = -1; - bool autoThrustEnabled = false; + bool fcuDisabled = false; + int fmgcDisabled = -1; bool tailstrikeProtectionEnabled = true; ConfirmNode elac2EmerPowersupplyRelayTimer = ConfirmNode(true, 30); @@ -116,14 +114,6 @@ class FlyByWireInterface { FailuresConsumer failuresConsumer; - AutopilotStateMachine autopilotStateMachine; - AutopilotStateMachine::ExternalInputs_AutopilotStateMachine_T autopilotStateMachineInput = {}; - ap_raw_laws_input autopilotStateMachineOutput; - - AutopilotLawsModelClass autopilotLaws; - AutopilotLawsModelClass::ExternalInputs_AutopilotLaws_T autopilotLawsInput = {}; - ap_raw_output autopilotLawsOutput; - Autothrust autoThrust; Autothrust::ExternalInputs_Autothrust_T autoThrustInput = {}; athr_output autoThrustOutput; @@ -134,7 +124,9 @@ class FlyByWireInterface { base_sfcc_bus sfccBusOutputs[2] = {}; - base_fmgc_b_bus fmgcBBusOutputs = {}; + base_ecu_bus fadecBusOutputs[2] = {}; + + base_ils_bus ilsBusOutputs[2] = {}; base_adr_bus adrBusOutputs[3] = {}; base_ir_bus irBusOutputs[3] = {}; @@ -153,6 +145,14 @@ class FlyByWireInterface { FcdcDiscreteOutputs fcdcsDiscreteOutputs[2] = {}; base_fcdc_bus fcdcsBusOutputs[2] = {}; + Fmgc fmgcs[2] = {Fmgc(true), Fmgc(false)}; + base_fmgc_discrete_outputs fmgcsDiscreteOutputs[2] = {}; + base_fmgc_bus_outputs fmgcsBusOutputs[2] = {}; + + Fcu fcu = Fcu(); + base_fcu_bus fcuBusOutputs = {}; + bool fcuHealthy = false; + Fac facs[2] = {Fac(true), Fac(false)}; base_fac_discrete_outputs facsDiscreteOutputs[2] = {}; base_fac_analog_outputs facsAnalogOutputs[2] = {}; @@ -162,8 +162,6 @@ class FlyByWireInterface { RadioReceiver radioReceiver; - bool wasFcuInitialized = false; - double simulationTimeReady = 0.0; std::unique_ptr idIsReady; std::unique_ptr idStartState; @@ -193,50 +191,8 @@ class FlyByWireInterface { std::unique_ptr idSideStickPositionY; std::unique_ptr idRudderPedalPosition; - std::unique_ptr idAutopilotNosewheelDemand; - - std::unique_ptr idFmaLateralMode; - std::unique_ptr idFmaLateralArmed; - std::unique_ptr idFmaVerticalMode; - std::unique_ptr idFmaVerticalArmed; - std::unique_ptr idFmaSoftAltModeActive; - std::unique_ptr idFmaCruiseAltModeActive; - std::unique_ptr idFmaExpediteModeActive; - std::unique_ptr idFmaSpeedProtectionActive; - std::unique_ptr idFmaApproachCapability; - std::unique_ptr idFmaTripleClick; - std::unique_ptr idFmaModeReversion; - - std::unique_ptr idAutopilotTcasMessageDisarm; - std::unique_ptr idAutopilotTcasMessageRaInhibited; - std::unique_ptr idAutopilotTcasMessageTrkFpaDeselection; - - std::unique_ptr idFlightDirectorBank; - std::unique_ptr idFlightDirectorPitch; - std::unique_ptr idFlightDirectorYaw; - - std::unique_ptr idAutopilotAutolandWarning; - - std::unique_ptr idAutopilotActiveAny; - std::unique_ptr idAutopilotActive_1; - std::unique_ptr idAutopilotActive_2; - - std::unique_ptr idAutopilotAutothrustMode; - std::unique_ptr idAutopilot_H_dot_radio; - std::unique_ptr idFcuTrkFpaModeActive; - std::unique_ptr idFcuSelectedFpa; - std::unique_ptr idFcuSelectedVs; - std::unique_ptr idFcuSelectedHeading; - - std::unique_ptr idFcuLocModeActive; - std::unique_ptr idFcuApprModeActive; - std::unique_ptr idFcuHeadingSync; - std::unique_ptr idFcuModeReversionActive; - std::unique_ptr idFcuModeReversionTrkFpaActive; - std::unique_ptr idFcuModeReversionTargetFpm; - std::unique_ptr idFlightGuidanceAvailable; std::unique_ptr idFlightGuidanceCrossTrackError; std::unique_ptr idFlightGuidanceTrackAngleError; @@ -568,6 +524,10 @@ class FlyByWireInterface { std::unique_ptr idElecBat1HotBusPowered; std::unique_ptr idElecBat2HotBusPowered; + std::unique_ptr idElecBtc1Closed; + std::unique_ptr idElecBtc2Closed; + std::unique_ptr idElecDcBatToDc2ContactorClosed; + std::unique_ptr idHydYellowSystemPressure; std::unique_ptr idHydGreenSystemPressure; std::unique_ptr idHydBlueSystemPressure; @@ -578,11 +538,90 @@ class FlyByWireInterface { std::unique_ptr idCaptPriorityButtonPressed; std::unique_ptr idFoPriorityButtonPressed; + // FMGC discrete output Lvars + std::unique_ptr idFmgcHealthy[2]; + std::unique_ptr idFmgcAthrEngaged[2]; + std::unique_ptr idFmgcFdEngaged[2]; + std::unique_ptr idFmgcApEngaged[2]; + + // FMGC A Bus output Lvars + std::unique_ptr idFmgcABusPfdSelectedSpeed[2]; + std::unique_ptr idFmgcABusRollFdCommand[2]; + std::unique_ptr idFmgcABusPitchFdCommand[2]; + std::unique_ptr idFmgcABusYawFdCommand[2]; + std::unique_ptr idFmgcABusDiscreteWord5[2]; + std::unique_ptr idFmgcABusDiscreteWord4[2]; + std::unique_ptr idFmgcABusAtsDiscreteWord[2]; + std::unique_ptr idFmgcABusAtsFmaDiscreteWord[2]; + std::unique_ptr idFmgcABusDiscreteWord3[2]; + std::unique_ptr idFmgcABusDiscreteWord1[2]; + std::unique_ptr idFmgcABusDiscreteWord2[2]; + std::unique_ptr idFmgcABusDiscreteWord6[2]; + + std::unique_ptr idLightsTest; + + std::unique_ptr idFcuSelectedHeading; + std::unique_ptr idFcuSelectedAltitude; + std::unique_ptr idFcuSelectedAirspeed; + std::unique_ptr idFcuSelectedVerticalSpeed; + std::unique_ptr idFcuSelectedTrack; + std::unique_ptr idFcuSelectedFpa; + std::unique_ptr idFcuAtsDiscreteWord; + std::unique_ptr idFcuAtsFmaDiscreteWord; + std::unique_ptr idFcuEisLeftDiscreteWord1; + std::unique_ptr idFcuEisLeftDiscreteWord2; + std::unique_ptr idFcuEisLeftBaro; + std::unique_ptr idFcuEisLeftBaroHpa; + std::unique_ptr idFcuEisRightDiscreteWord1; + std::unique_ptr idFcuEisRightDiscreteWord2; + std::unique_ptr idFcuEisRightBaro; + std::unique_ptr idFcuEisRightBaroHpa; + std::unique_ptr idFcuDiscreteWord1; + std::unique_ptr idFcuDiscreteWord2; + + std::unique_ptr idFcuEisPanelEfisMode[2]; + std::unique_ptr idFcuEisPanelEfisRange[2]; + std::unique_ptr idFcuEisPanelNavaid1Mode[2]; + std::unique_ptr idFcuEisPanelNavaid2Mode[2]; + std::unique_ptr idFcuEisPanelBaroIsInhg[2]; + + std::unique_ptr idFcuEisPanelFdLightOn[2]; + std::unique_ptr idFcuEisPanelLsLightOn[2]; + std::unique_ptr idFcuEisPanelCstrLightOn[2]; + std::unique_ptr idFcuEisPanelWptLightOn[2]; + std::unique_ptr idFcuEisPanelVordLightOn[2]; + std::unique_ptr idFcuEisPanelNdbLightOn[2]; + std::unique_ptr idFcuEisPanelArptLightOn[2]; + std::unique_ptr idFcuEisDisplayBaroValueMode[2]; + std::unique_ptr idFcuEisDisplayBaroValue[2]; + std::unique_ptr idFcuEisDisplayBaroMode[2]; + + std::unique_ptr idFcuAfsPanelAltIncrement1000; + + std::unique_ptr idFcuAfsPanelAp1LightOn; + std::unique_ptr idFcuAfsPanelAp2LightOn; + std::unique_ptr idFcuAfsPanelAthrLightOn; + std::unique_ptr idFcuAfsPanelLocLightOn; + std::unique_ptr idFcuAfsPanelExpedLightOn; + std::unique_ptr idFcuAfsPanelApprLightOn; + std::unique_ptr idFcuAfsDisplayTrkFpaMode; + std::unique_ptr idFcuAfsDisplayMachMode; + std::unique_ptr idFcuAfsDisplaySpdMachValue; + std::unique_ptr idFcuAfsDisplaySpdMachDashes; + std::unique_ptr idFcuAfsDisplaySpdMachManaged; + std::unique_ptr idFcuAfsDisplayHdgTrkValue; + std::unique_ptr idFcuAfsDisplayHdgTrkDashes; + std::unique_ptr idFcuAfsDisplayHdgTrkManaged; + std::unique_ptr idFcuAfsDisplayAltValue; + std::unique_ptr idFcuAfsDisplayLvlChManaged; + std::unique_ptr idFcuAfsDisplayVsFpaValue; + std::unique_ptr idFcuAfsDisplayVsFpaDashes; + + std::unique_ptr idFcuHealthy; + void loadConfiguration(); void setupLocalVariables(); - bool handleFcuInitialization(double sampleTime); - bool readDataAndLocalVariables(double sampleTime); bool updatePerformanceMonitoring(double sampleTime); @@ -593,8 +632,6 @@ class FlyByWireInterface { bool updateEngineData(double sampleTime); bool updateAdditionalData(double sampleTime); - bool updateAutopilotStateMachine(double sampleTime); - bool updateAutopilotLaws(double sampleTime); bool updateFlyByWire(double sampleTime); bool updateAutothrust(double sampleTime); @@ -604,6 +641,10 @@ class FlyByWireInterface { bool updateSfcc(int sfccIndex); + bool updateFadec(int fadecIndex); + + bool updateIls(int ilsIndex); + bool updateAdirs(int adirsIndex); bool updateElac(double sampleTime, int elacIndex); @@ -612,14 +653,16 @@ class FlyByWireInterface { bool updateFcdc(double sampleTime, int fcdcIndex); + bool updateFmgc(double sampleTime, int fmgcIndex); + + bool updateFcu(double sampleTime); + bool updateFac(double sampleTime, int facIndex); bool updateServoSolenoidStatus(); bool updateSpoilers(double sampleTime); - bool updateFoSide(double sampleTime); - bool updateAltimeterSetting(double sampleTime); double getTcasModeAvailable(); diff --git a/fbw-a32nx/src/wasm/fbw_a320/src/failures/FailureList.h b/fbw-a32nx/src/wasm/fbw_a320/src/failures/FailureList.h index 5bf13cd015b1..5e4a36d2788b 100644 --- a/fbw-a32nx/src/wasm/fbw_a320/src/failures/FailureList.h +++ b/fbw-a32nx/src/wasm/fbw_a320/src/failures/FailureList.h @@ -3,6 +3,10 @@ enum class Failures { Fac1 = 22000, Fac2 = 22001, + Fmgc1 = 22002, + Fmgc2 = 22003, + Fcu1 = 22004, + Fcu2 = 22005, Elac1 = 27000, Elac2 = 27001, Sec1 = 27002, diff --git a/fbw-a32nx/src/wasm/fbw_a320/src/failures/FailuresConsumer.cpp b/fbw-a32nx/src/wasm/fbw_a320/src/failures/FailuresConsumer.cpp index 97c76ed37b3d..d190032f7890 100644 --- a/fbw-a32nx/src/wasm/fbw_a320/src/failures/FailuresConsumer.cpp +++ b/fbw-a32nx/src/wasm/fbw_a320/src/failures/FailuresConsumer.cpp @@ -1,6 +1,6 @@ #include "FailuresConsumer.h" -#include #include +#include FailuresConsumer::FailuresConsumer() { activeFailures.emplace(std::make_pair(Failures::Elac1, false)); @@ -12,6 +12,10 @@ FailuresConsumer::FailuresConsumer() { activeFailures.emplace(std::make_pair(Failures::Fac2, false)); activeFailures.emplace(std::make_pair(Failures::Fcdc1, false)); activeFailures.emplace(std::make_pair(Failures::Fcdc2, false)); + activeFailures.emplace(std::make_pair(Failures::Fcu1, false)); + activeFailures.emplace(std::make_pair(Failures::Fcu2, false)); + activeFailures.emplace(std::make_pair(Failures::Fmgc1, false)); + activeFailures.emplace(std::make_pair(Failures::Fmgc2, false)); } void FailuresConsumer::initialize() { @@ -53,10 +57,8 @@ bool FailuresConsumer::setIfFound(double identifier, bool value) { } bool FailuresConsumer::isAnyActive() { - if (std::any_of(activeFailures.begin(), activeFailures.end(), [](auto pair) { - return pair.second; - })) { - return true; + if (std::any_of(activeFailures.begin(), activeFailures.end(), [](auto pair) { return pair.second; })) { + return true; } return false; } diff --git a/fbw-a32nx/src/wasm/fbw_a320/src/fcu/Fcu.cpp b/fbw-a32nx/src/wasm/fbw_a320/src/fcu/Fcu.cpp new file mode 100644 index 000000000000..a0712c2f84a0 --- /dev/null +++ b/fbw-a32nx/src/wasm/fbw_a320/src/fcu/Fcu.cpp @@ -0,0 +1,86 @@ +#include "Fcu.h" +#include "../Arinc429Utils.h" + +Fcu::Fcu() { + fcuComputer.initialize(); +} + +void Fcu::initSelfTests(int index) { + if (powerSupplyFault[index]) + return; + + selfTestTimer[index] = selfTestDuration; +} + +void Fcu::update(double deltaTime, + double simulationTime, + bool fcu1FaultActive, + bool fcu2FaultActive, + bool fcu1IsPowered, + bool fcu2IsPowered) { + for (int i = 0; i < 2; i++) { + monitorPowerSupply(deltaTime, i == 0 ? fcu1IsPowered : fcu2IsPowered, i); + + updateSelfTest(deltaTime, i); + monitorSelf(i == 0 ? fcu1FaultActive : fcu2FaultActive, i); + } + + fcuHealthy = monitoringHealthy[0] || monitoringHealthy[1]; + modelInputs.in.sim_data.computer_running = fcuHealthy; + + fcuComputer.setExternalInputs(&modelInputs); + fcuComputer.step(); + modelOutputs = fcuComputer.getExternalOutputs().out; +} + +void Fcu::monitorSelf(bool faultActive, int index) { + if (faultActive || powerSupplyFault[index] || !selfTestComplete[index]) { + monitoringHealthy[index] = false; + } else { + monitoringHealthy[index] = true; + } +} + +void Fcu::monitorPowerSupply(double deltaTime, bool isPowered, int index) { + if (!isPowered) { + powerSupplyOutageTime[index] += deltaTime; + } + if (powerSupplyOutageTime[index] > minimumPowerOutageTimeForFailure) { + powerSupplyFault[index] = true; + } + if (isPowered && powerSupplyFault[index]) { + powerSupplyFault[index] = false; + initSelfTests(index); + powerSupplyOutageTime[index] = 0; + } +} + +void Fcu::updateSelfTest(double deltaTime, int index) { + if (selfTestTimer[index] > 0) { + selfTestTimer[index] -= deltaTime; + } + if (selfTestTimer[index] <= 0) { + selfTestComplete[index] = true; + } else { + selfTestComplete[index] = false; + } +} + +base_fcu_bus Fcu::getBusOutputs() { + if (!fcuHealthy) { + return {}; + } + + return modelOutputs.bus_outputs; +} + +base_fcu_discrete_outputs Fcu::getDiscreteOutputs() { + base_fcu_discrete_outputs output = {}; + + output.fcu_healthy = fcuHealthy; + if (!fcuHealthy) { + return output; + } else { + return modelOutputs.discrete_outputs; + } +} diff --git a/fbw-a32nx/src/wasm/fbw_a320/src/fcu/Fcu.h b/fbw-a32nx/src/wasm/fbw_a320/src/fcu/Fcu.h new file mode 100644 index 000000000000..e6145e619917 --- /dev/null +++ b/fbw-a32nx/src/wasm/fbw_a320/src/fcu/Fcu.h @@ -0,0 +1,49 @@ +#pragma once +#include "../model/FcuComputer.h" + +class Fcu { + public: + Fcu(); + + void update(double deltaTime, double simulationTime, bool fcu1FaultActive, bool fcu2FaultActive, bool fcu1IsPowered, bool fcu2IsPowered); + + base_fcu_bus getBusOutputs(); + + base_fcu_discrete_outputs getDiscreteOutputs(); + + FcuComputer::ExternalInputs_FcuComputer_T modelInputs = {}; + + private: + void initSelfTests(int index); + + void monitorPowerSupply(double deltaTime, bool isPowered, int index); + + void monitorSelf(bool faultActive, int index); + + void updateSelfTest(double deltaTime, int index); + + // Model + FcuComputer fcuComputer; + fcu_outputs modelOutputs; + + // Computer Self-monitoring vars + bool fcuHealthy; + + bool monitoringHealthy[2]; + + bool cpuStopped[2]; + + // Power Supply monitoring + double powerSupplyOutageTime[2]; + + bool powerSupplyFault[2]; + + // Selftest vars + double selfTestTimer[2]; + + bool selfTestComplete[2]; + + // Constants + const double minimumPowerOutageTimeForFailure = 0.02; + const double selfTestDuration = 4; +}; diff --git a/fbw-a32nx/src/wasm/fbw_a320/src/fmgc/Fmgc.cpp b/fbw-a32nx/src/wasm/fbw_a320/src/fmgc/Fmgc.cpp new file mode 100644 index 000000000000..8d4b6e0a7f7c --- /dev/null +++ b/fbw-a32nx/src/wasm/fbw_a320/src/fmgc/Fmgc.cpp @@ -0,0 +1,108 @@ +#include "Fmgc.h" +#include "../Arinc429.h" + +Fmgc::Fmgc(bool isUnit1) : isUnit1(isUnit1) { + fmgcComputer.initialize(); +} + +Fmgc::Fmgc(const Fmgc& obj) : isUnit1(obj.isUnit1) { + fmgcComputer.initialize(); +} + +// If the power supply is valid, perform the self-test-sequence. +// If at least one hydraulic source is pressurised, perform a short test. +// If no hydraulic supply is pressurised, and the outage was more than 3 seconds (or the switch was turned off), +// perform a long selft-test. +// Else, perform a short self-test. +void Fmgc::initSelfTests() { + if (powerSupplyFault) + return; + + clearMemory(); + selfTestTimer = selfTestDuration; +} + +// After the self-test is complete, erase all data in RAM. +void Fmgc::clearMemory() {} + +// Main update cycle. Surface position through parameters here is temporary. +void Fmgc::update(double deltaTime, double simulationTime, bool faultActive, bool isPowered) { + monitorPowerSupply(deltaTime, isPowered); + + updateSelfTest(deltaTime); + monitorSelf(faultActive); + + modelInputs.in.sim_data.computer_running = monitoringHealthy; + fmgcComputer.setExternalInputs(&modelInputs); + fmgcComputer.step(); + modelOutputs = fmgcComputer.getExternalOutputs().out; +} + +// Perform self monitoring +void Fmgc::monitorSelf(bool faultActive) { + if (faultActive || powerSupplyFault || !selfTestComplete) { + monitoringHealthy = false; + } else { + monitoringHealthy = true; + } +} + +// Monitor the power supply and record the outage time (used for self test and healthy logic). +// If an outage lasts more than 10ms, stop the program execution. +// If the power has been restored after an outage that lasted longer than 10ms, reset the RAM and +// perform the startup sequence. +void Fmgc::monitorPowerSupply(double deltaTime, bool isPowered) { + if (!isPowered) { + powerSupplyOutageTime += deltaTime; + } + if (powerSupplyOutageTime > minimumPowerOutageTimeForFailure) { + powerSupplyFault = true; + } + if (isPowered && powerSupplyFault) { + powerSupplyFault = false; + initSelfTests(); + powerSupplyOutageTime = 0; + } +} + +// Update the Self-test-Sequence +void Fmgc::updateSelfTest(double deltaTime) { + if (selfTestTimer > 0) { + selfTestTimer -= deltaTime; + } + if (selfTestTimer <= 0) { + selfTestComplete = true; + } else { + selfTestComplete = false; + } +} + +// Write the discrete output data and return it. +base_fmgc_discrete_outputs Fmgc::getDiscreteOutputs() { + base_fmgc_discrete_outputs output = {}; + + output.fmgc_healthy = !monitoringHealthy; + if (!monitoringHealthy) { + output.athr_own_engaged = false; + output.fd_own_engaged = false; + output.ap_own_engaged = false; + output.fcu_own_fail = false; + output.ils_test_inhibit = false; + } else { + output = modelOutputs.discrete_outputs; + } + + return output; +} + +base_fmgc_bus_outputs Fmgc::getBusOutputs() { + base_fmgc_bus_outputs output = {}; + + if (!monitoringHealthy) { + return output; + } + + output = modelOutputs.bus_outputs; + + return output; +} diff --git a/fbw-a32nx/src/wasm/fbw_a320/src/fmgc/Fmgc.h b/fbw-a32nx/src/wasm/fbw_a320/src/fmgc/Fmgc.h new file mode 100644 index 000000000000..667f94c23756 --- /dev/null +++ b/fbw-a32nx/src/wasm/fbw_a320/src/fmgc/Fmgc.h @@ -0,0 +1,53 @@ +#pragma once +#include "../model/FmgcComputer.h" + +class Fmgc { + public: + Fmgc(bool isUnit1); + + Fmgc(const Fmgc&); + + void update(double deltaTime, double simulationTime, bool faultActive, bool isPowered); + + base_fmgc_bus_outputs getBusOutputs(); + + base_fmgc_discrete_outputs getDiscreteOutputs(); + + FmgcComputer::ExternalInputs_FmgcComputer_T modelInputs = {}; + + private: + void initSelfTests(); + + void clearMemory(); + + void monitorPowerSupply(double deltaTime, bool isPowered); + + void monitorSelf(bool faultActive); + + void updateSelfTest(double deltaTime); + + // Model + FmgcComputer fmgcComputer; + fmgc_outputs modelOutputs; + + // Computer Self-monitoring vars + bool monitoringHealthy; + + bool cpuStopped; + + // Power Supply monitoring + double powerSupplyOutageTime; + + bool powerSupplyFault; + + // Selftest vars + double selfTestTimer; + + bool selfTestComplete; + + // Constants + const bool isUnit1; + + const double minimumPowerOutageTimeForFailure = 0.02; + const double selfTestDuration = 4; +}; diff --git a/fbw-a32nx/src/wasm/fbw_a320/src/interface/SimConnectData.h b/fbw-a32nx/src/wasm/fbw_a320/src/interface/SimConnectData.h index 91db896831d2..981187a13302 100644 --- a/fbw-a32nx/src/wasm/fbw_a320/src/interface/SimConnectData.h +++ b/fbw-a32nx/src/wasm/fbw_a320/src/interface/SimConnectData.h @@ -200,155 +200,3 @@ struct SimOutputSpoilers { struct SimOutputAltimeter { unsigned long long kohlsmanSettingStd_3; }; - -struct ClientDataAutopilotStateMachine { - unsigned long long enabled_AP1; - unsigned long long enabled_AP2; - double lateral_law; - double lateral_mode; - double lateral_mode_armed; - double vertical_law; - double vertical_mode; - double vertical_mode_armed; - double mode_reversion_lateral; - double mode_reversion_vertical; - double mode_reversion_vertical_target_fpm; - double mode_reversion_TRK_FPA; - double mode_reversion_triple_click; - double mode_reversion_fma; - double speed_protection_mode; - double autothrust_mode; - double Psi_c_deg; - double H_c_ft; - double H_dot_c_fpm; - double FPA_c_deg; - double V_c_kn; - double ALT_soft_mode_active; - double ALT_cruise_mode_active; - double EXPED_mode_active; - double FD_disconnect; - double FD_connect; - double nav_e_loc_valid; - double nav_e_loc_error_deg; - double nav_e_gs_valid; - double nav_e_gs_error_deg; - unsigned long long TCAS_message_disarm; - unsigned long long TCAS_message_RA_inhibit; - unsigned long long TCAS_message_TRK_FPA_deselection; -}; - -struct ClientDataAutopilotLaws { - unsigned long long enableAutopilot; - double flightDirectorTheta; - double autopilotTheta; - double flightDirectorPhi; - double autopilotPhi; - double autopilotBeta; - double locPhiCommand; - double nosewheelCommand; - unsigned long long conditionFlare; -}; - -struct ClientDataAutothrust { - double N1_TLA_1_percent; - double N1_TLA_2_percent; - double is_in_reverse_1; - double is_in_reverse_2; - double thrust_limit_type; - double thrust_limit_percent; - double N1_c_1_percent; - double N1_c_2_percent; - double status; - double mode; - double mode_message; -}; - -struct ClientDataFlyByWireInput { - double delta_eta_pos; - double delta_xi_pos; - double delta_zeta_pos; -}; - -struct ClientDataFlyByWire { - double eta_pos; - double xi_pos; - double zeta_pos; - double eta_trim_deg_should_write; - double eta_trim_deg; - double zeta_trim_pos_should_write; - double zeta_trim_pos; - double alpha_floor_command; - double protection_ap_disc; - double v_alpha_prot_kn; - double v_alpha_max_kn; - double beta_target_deg; -}; - -struct ClientDataLocalVariables { - double flightPhase; - double V2; - double V_APP; - double V_LS; - double V_MAX; - double flightPlanAvailable; - double altitudeConstraint; - double thrustReductionAltitude; - double thrustReductionAltitudeGoAround; - double accelerationAltitude; - double accelerationAltitudeEngineOut; - double accelerationAltitudeGoAround; - double accelerationAltitudeGoAroundEngineOut; - double cruiseAltitude; - double directToTrigger; - double fcuTrkFpaModeActive; - double fcuSelectedVs; - double fcuSelectedFpa; - double fcuSelectedHeading; - double flightManagementCrossTrackError; - double flightManagementTrackAngleError; - double flightManagementPhiCommand; - double flightManagementPhiLimit; - unsigned long long flightManagementRequestedVerticalMode; - double flightManagement_H_c_ft; - double flightManagement_H_dot_c_fpm; - unsigned long long flightManagement_rnav_app_selected; - unsigned long long flightManagement_final_can_engage; - double is_SPEED_managed; - double locPhiCommand; - unsigned long long TCAS_mode_fail; - unsigned long long TCAS_mode_available; - double TCAS_advisory_state; - double TCAS_advisory_target_min_fpm; - double TCAS_advisory_target_max_fpm; - unsigned long long conditionFlare; -}; - -struct ClientDataLocalVariablesAutothrust { - double ATHR_push; - double ATHR_disconnect; - double TLA_1; - double TLA_2; - double V_c_kn; - double V_LS_kn; - double V_MAX_kn; - double thrust_limit_REV_percent; - double thrust_limit_IDLE_percent; - double thrust_limit_CLB_percent; - double thrust_limit_MCT_percent; - double thrust_limit_FLEX_percent; - double thrust_limit_TOGA_percent; - double flex_temperature_degC; - double mode_requested; - double is_mach_mode_active; - double alpha_floor_condition; - double is_approach_mode_active; - double is_SRS_TO_mode_active; - double is_SRS_GA_mode_active; - double is_LAND_mode_active; - double thrust_reduction_altitude; - double thrust_reduction_altitude_go_around; - double flight_phase; - double is_soft_alt_mode_active; - double is_TCAS_active; - double target_TCAS_RA_rate_fpm; -}; diff --git a/fbw-a32nx/src/wasm/fbw_a320/src/interface/SimConnectInterface.cpp b/fbw-a32nx/src/wasm/fbw_a320/src/interface/SimConnectInterface.cpp index a109a37e3687..19dcf462663e 100644 --- a/fbw-a32nx/src/wasm/fbw_a320/src/interface/SimConnectInterface.cpp +++ b/fbw-a32nx/src/wasm/fbw_a320/src/interface/SimConnectInterface.cpp @@ -12,12 +12,11 @@ SimInput SimConnectInterface::simInput = {}; double SimConnectInterface::flightControlsKeyChangeAileron = 0.0; bool SimConnectInterface::connect(bool clientDataEnabled, - bool autopilotStateMachineEnabled, - bool autopilotLawsEnabled, - bool flyByWireEnabled, int elacDisabled, int secDisabled, int facDisabled, + int fmgcDisabled, + bool fcuDisabled, const std::vector>& throttleAxis, std::shared_ptr spoilersHandler, double keyChangeAileron, @@ -51,6 +50,8 @@ bool SimConnectInterface::connect(bool clientDataEnabled, this->elacDisabled = elacDisabled; this->secDisabled = secDisabled; this->facDisabled = facDisabled; + this->fmgcDisabled = fmgcDisabled; + this->fcuDisabled = fcuDisabled; // store key change value for each axis flightControlsKeyChangeAileron = keyChangeAileron; flightControlsKeyChangeElevator = keyChangeElevator; @@ -307,7 +308,6 @@ bool SimConnectInterface::prepareSimInputSimConnectDataDefinitions() { result &= addInputDataDefinition(hSimConnect, 0, Events::AUTOPILOT_ON, "AUTOPILOT_ON", true); result &= addInputDataDefinition(hSimConnect, 0, Events::AUTOPILOT_DISENGAGE_SET, "AUTOPILOT_DISENGAGE_SET", true); result &= addInputDataDefinition(hSimConnect, 0, Events::AUTOPILOT_DISENGAGE_TOGGLE, "AUTOPILOT_DISENGAGE_TOGGLE", true); - result &= addInputDataDefinition(hSimConnect, 0, Events::TOGGLE_FLIGHT_DIRECTOR, "TOGGLE_FLIGHT_DIRECTOR", false); result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_AP_1_PUSH, "A32NX.FCU_AP_1_PUSH", false); result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_AP_2_PUSH, "A32NX.FCU_AP_2_PUSH", false); result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_AP_DISCONNECT_PUSH, "A32NX.FCU_AP_DISCONNECT_PUSH", false); @@ -315,36 +315,49 @@ bool SimConnectInterface::prepareSimInputSimConnectDataDefinitions() { result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_ATHR_DISCONNECT_PUSH, "A32NX.FCU_ATHR_DISCONNECT_PUSH", false); result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_SPD_INC, "A32NX.FCU_SPD_INC", false); result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_SPD_DEC, "A32NX.FCU_SPD_DEC", false); - result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_SPD_SET, "A32NX.FCU_SPD_SET", false); result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_SPD_PUSH, "A32NX.FCU_SPD_PUSH", false); result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_SPD_PULL, "A32NX.FCU_SPD_PULL", false); result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_SPD_MACH_TOGGLE_PUSH, "A32NX.FCU_SPD_MACH_TOGGLE_PUSH", false); result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_HDG_INC, "A32NX.FCU_HDG_INC", false); result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_HDG_DEC, "A32NX.FCU_HDG_DEC", false); - result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_HDG_SET, "A32NX.FCU_HDG_SET", false); result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_HDG_PUSH, "A32NX.FCU_HDG_PUSH", false); result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_HDG_PULL, "A32NX.FCU_HDG_PULL", false); result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_TRK_FPA_TOGGLE_PUSH, "A32NX.FCU_TRK_FPA_TOGGLE_PUSH", false); - result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_TO_AP_HDG_PUSH, "A32NX.FCU_TO_AP_HDG_PUSH", false); - result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_TO_AP_HDG_PULL, "A32NX.FCU_TO_AP_HDG_PULL", false); result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_ALT_INC, "A32NX.FCU_ALT_INC", false); result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_ALT_DEC, "A32NX.FCU_ALT_DEC", false); - result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_ALT_SET, "A32NX.FCU_ALT_SET", false); - result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_ALT_INCREMENT_TOGGLE, "A32NX.FCU_ALT_INCREMENT_TOGGLE", false); - result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_ALT_INCREMENT_SET, "A32NX.FCU_ALT_INCREMENT_SET", false); result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_ALT_PUSH, "A32NX.FCU_ALT_PUSH", false); result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_ALT_PULL, "A32NX.FCU_ALT_PULL", false); + result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_METRIC_ALT_TOGGLE_PUSH, "A32NX.FCU_METRIC_ALT_TOGGLE_PUSH", false); result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_VS_INC, "A32NX.FCU_VS_INC", false); result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_VS_DEC, "A32NX.FCU_VS_DEC", false); - result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_VS_SET, "A32NX.FCU_VS_SET", false); result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_VS_PUSH, "A32NX.FCU_VS_PUSH", false); result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_VS_PULL, "A32NX.FCU_VS_PULL", false); - result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_TO_AP_VS_PUSH, "A32NX.FCU_TO_AP_VS_PUSH", false); - result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_TO_AP_VS_PULL, "A32NX.FCU_TO_AP_VS_PULL", false); result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_LOC_PUSH, "A32NX.FCU_LOC_PUSH", false); result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_APPR_PUSH, "A32NX.FCU_APPR_PUSH", false); result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_EXPED_PUSH, "A32NX.FCU_EXPED_PUSH", false); - result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FMGC_DIR_TO_TRIGGER, "A32NX.FMGC_DIR_TO_TRIGGER", false); + + result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_EFIS_L_FD_PUSH, "A32NX.FCU_EFIS_L_FD_PUSH", false); + result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_EFIS_L_LS_PUSH, "A32NX.FCU_EFIS_L_LS_PUSH", false); + result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_EFIS_L_BARO_INC, "A32NX.FCU_EFIS_L_BARO_INC", false); + result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_EFIS_L_BARO_DEC, "A32NX.FCU_EFIS_L_BARO_DEC", false); + result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_EFIS_L_BARO_PUSH, "A32NX.FCU_EFIS_L_BARO_PUSH", false); + result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_EFIS_L_BARO_PULL, "A32NX.FCU_EFIS_L_BARO_PULL", false); + result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_EFIS_L_CSTR_PUSH, "A32NX.FCU_EFIS_L_CSTR_PUSH", false); + result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_EFIS_L_WPT_PUSH, "A32NX.FCU_EFIS_L_WPT_PUSH", false); + result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_EFIS_L_VORD_PUSH, "A32NX.FCU_EFIS_L_VORD_PUSH", false); + result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_EFIS_L_NDB_PUSH, "A32NX.FCU_EFIS_L_NDB_PUSH", false); + result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_EFIS_L_ARPT_PUSH, "A32NX.FCU_EFIS_L_ARPT_PUSH", false); + result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_EFIS_R_FD_PUSH, "A32NX.FCU_EFIS_R_FD_PUSH", false); + result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_EFIS_R_LS_PUSH, "A32NX.FCU_EFIS_R_LS_PUSH", false); + result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_EFIS_R_BARO_INC, "A32NX.FCU_EFIS_R_BARO_INC", false); + result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_EFIS_R_BARO_DEC, "A32NX.FCU_EFIS_R_BARO_DEC", false); + result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_EFIS_R_BARO_PUSH, "A32NX.FCU_EFIS_R_BARO_PUSH", false); + result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_EFIS_R_BARO_PULL, "A32NX.FCU_EFIS_R_BARO_PULL", false); + result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_EFIS_R_CSTR_PUSH, "A32NX.FCU_EFIS_R_CSTR_PUSH", false); + result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_EFIS_R_WPT_PUSH, "A32NX.FCU_EFIS_R_WPT_PUSH", false); + result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_EFIS_R_VORD_PUSH, "A32NX.FCU_EFIS_R_VORD_PUSH", false); + result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_EFIS_R_NDB_PUSH, "A32NX.FCU_EFIS_R_NDB_PUSH", false); + result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_FCU_EFIS_R_ARPT_PUSH, "A32NX.FCU_EFIS_R_ARPT_PUSH", false); result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_EFIS_L_CHRONO_PUSHED, "A32NX.EFIS_L_CHRONO_PUSHED", false); result &= addInputDataDefinition(hSimConnect, 0, Events::A32NX_EFIS_R_CHRONO_PUSHED, "A32NX.EFIS_R_CHRONO_PUSHED", false); @@ -476,151 +489,6 @@ bool SimConnectInterface::prepareClientDataDefinitions() { // ------------------------------------------------------------------------------------------------------------------ - // map client id - result = SimConnect_MapClientDataNameToID(hSimConnect, "A32NX_CLIENT_DATA_AUTOPILOT_STATE_MACHINE", ClientData::AUTOPILOT_STATE_MACHINE); - // create client data - result &= SimConnect_CreateClientData(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, sizeof(ClientDataAutopilotStateMachine), - SIMCONNECT_CREATE_CLIENT_DATA_FLAG_DEFAULT); - // add data definitions - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_INT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_INT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_INT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_INT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_INT64); - - // request data to be updated when set - result &= SimConnect_RequestClientData(hSimConnect, ClientData::AUTOPILOT_STATE_MACHINE, ClientData::AUTOPILOT_STATE_MACHINE, - ClientData::AUTOPILOT_STATE_MACHINE, SIMCONNECT_CLIENT_DATA_PERIOD_ON_SET); - - // ------------------------------------------------------------------------------------------------------------------ - - // map client id - result &= SimConnect_MapClientDataNameToID(hSimConnect, "A32NX_CLIENT_DATA_AUTOPILOT_LAWS", ClientData::AUTOPILOT_LAWS); - // create client data - result &= SimConnect_CreateClientData(hSimConnect, ClientData::AUTOPILOT_LAWS, sizeof(ClientDataAutopilotLaws), - SIMCONNECT_CREATE_CLIENT_DATA_FLAG_DEFAULT); - // add data definitions - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_LAWS, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_INT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_LAWS, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_LAWS, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_LAWS, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_LAWS, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_LAWS, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_LAWS, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_LAWS, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOPILOT_LAWS, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_INT64); - - // request data to be updated when set - result &= SimConnect_RequestClientData(hSimConnect, ClientData::AUTOPILOT_LAWS, ClientData::AUTOPILOT_LAWS, ClientData::AUTOPILOT_LAWS, - SIMCONNECT_CLIENT_DATA_PERIOD_ON_SET); - - // ------------------------------------------------------------------------------------------------------------------ - - // map client id - result &= SimConnect_MapClientDataNameToID(hSimConnect, "A32NX_CLIENT_DATA_AUTOTHRUST", ClientData::AUTOTHRUST); - // create client data - result &= SimConnect_CreateClientData(hSimConnect, ClientData::AUTOTHRUST, sizeof(ClientDataAutothrust), - SIMCONNECT_CREATE_CLIENT_DATA_FLAG_DEFAULT); - // add data definitions - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - - // request data to be updated when set - result &= SimConnect_RequestClientData(hSimConnect, ClientData::AUTOTHRUST, ClientData::AUTOTHRUST, ClientData::AUTOTHRUST, - SIMCONNECT_CLIENT_DATA_PERIOD_ON_SET); - - // ------------------------------------------------------------------------------------------------------------------ - // map client id result &= SimConnect_MapClientDataNameToID(hSimConnect, "A32NX_CLIENT_DATA_ELAC_DISCRETE_INPUT", ClientData::ELAC_DISCRETE_INPUTS); // create client data @@ -780,14 +648,29 @@ bool SimConnectInterface::prepareClientDataDefinitions() { // ------------------------------------------------------------------------------------------------------------------ for (int i = 0; i < 2; i++) { - auto defineId = ClientData::FMGC_1_B_BUS + i; + auto defineId = ClientData::ILS_1_BUS + i; + // map client id + result &= SimConnect_MapClientDataNameToID(hSimConnect, ("A32NX_CLIENT_DATA_ILS_" + std::to_string(i + 1) + "_BUS").c_str(), defineId); + // create client data + result &= SimConnect_CreateClientData(hSimConnect, defineId, sizeof(base_ils_bus), SIMCONNECT_CREATE_CLIENT_DATA_FLAG_DEFAULT); + // add data definitions + for (int i = 0; i < 4; i++) { + result &= + SimConnect_AddToClientDataDefinition(hSimConnect, defineId, SIMCONNECT_CLIENTDATAOFFSET_AUTO, SIMCONNECT_CLIENTDATATYPE_FLOAT64); + } + } + + // ------------------------------------------------------------------------------------------------------------------ + + for (int i = 0; i < 2; i++) { + auto defineId = ClientData::FADEC_1_BUS + i; // map client id result &= - SimConnect_MapClientDataNameToID(hSimConnect, ("A32NX_CLIENT_DATA_FMGC_" + std::to_string(i + 1) + "_B_BUS").c_str(), defineId); + SimConnect_MapClientDataNameToID(hSimConnect, ("A32NX_CLIENT_DATA_FADEC_" + std::to_string(i + 1) + "_BUS").c_str(), defineId); // create client data - result &= SimConnect_CreateClientData(hSimConnect, defineId, sizeof(base_fmgc_b_bus), SIMCONNECT_CREATE_CLIENT_DATA_FLAG_DEFAULT); + result &= SimConnect_CreateClientData(hSimConnect, defineId, sizeof(base_ecu_bus), SIMCONNECT_CREATE_CLIENT_DATA_FLAG_DEFAULT); // add data definitions - for (int i = 0; i < 18; i++) { + for (int i = 0; i < 2; i++) { result &= SimConnect_AddToClientDataDefinition(hSimConnect, defineId, SIMCONNECT_CLIENTDATAOFFSET_AUTO, SIMCONNECT_CLIENTDATATYPE_FLOAT64); } @@ -958,147 +841,109 @@ bool SimConnectInterface::prepareClientDataDefinitions() { // ------------------------------------------------------------------------------------------------------------------ // map client id - result &= SimConnect_MapClientDataNameToID(hSimConnect, "A32NX_CLIENT_DATA_LOCAL_VARIABLES", ClientData::LOCAL_VARIABLES); + result &= SimConnect_MapClientDataNameToID(hSimConnect, "A32NX_CLIENT_DATA_FCU_BUS", ClientData::FCU_BUS_OUTPUT); // create client data - result &= SimConnect_CreateClientData(hSimConnect, ClientData::LOCAL_VARIABLES, sizeof(ClientDataLocalVariables), + result &= SimConnect_CreateClientData(hSimConnect, ClientData::FCU_BUS_OUTPUT, sizeof(base_fcu_bus), SIMCONNECT_CREATE_CLIENT_DATA_FLAG_DEFAULT); // add data definitions - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_INT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_INT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_INT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_INT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_INT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_INT64); + for (int i = 0; i < 21; i++) { + result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::FCU_BUS_OUTPUT, SIMCONNECT_CLIENTDATAOFFSET_AUTO, + SIMCONNECT_CLIENTDATATYPE_FLOAT64); + } + + // request data to be updated when set + if (fcuDisabled) { + result &= SimConnect_RequestClientData(hSimConnect, ClientData::FCU_BUS_OUTPUT, ClientData::FCU_BUS_OUTPUT, ClientData::FCU_BUS_OUTPUT, + SIMCONNECT_CLIENT_DATA_PERIOD_ON_SET); + } // ------------------------------------------------------------------------------------------------------------------ // map client id - result &= - SimConnect_MapClientDataNameToID(hSimConnect, "A32NX_CLIENT_DATA_LOCAL_VARIABLES_AUTOTHRUST", ClientData::LOCAL_VARIABLES_AUTOTHRUST); - // create client - result &= SimConnect_CreateClientData(hSimConnect, ClientData::LOCAL_VARIABLES_AUTOTHRUST, sizeof(ClientDataLocalVariablesAutothrust), + result &= SimConnect_MapClientDataNameToID(hSimConnect, "A32NX_CLIENT_DATA_FMGC_DISCRETE_INPUT", ClientData::FMGC_DISCRETE_INPUTS); + // create client data + result &= SimConnect_CreateClientData(hSimConnect, ClientData::FMGC_DISCRETE_INPUTS, sizeof(base_fmgc_discrete_inputs), + SIMCONNECT_CREATE_CLIENT_DATA_FLAG_DEFAULT); + // add data definitions + for (int i = 0; i < 34; i++) { + result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::FMGC_DISCRETE_INPUTS, SIMCONNECT_CLIENTDATAOFFSET_AUTO, + SIMCONNECT_CLIENTDATATYPE_INT8); + } + + // ------------------------------------------------------------------------------------------------------------------ + + // map client id + result &= SimConnect_MapClientDataNameToID(hSimConnect, "A32NX_CLIENT_DATA_FMS_INPUT", ClientData::FMGC_FMS_INPUTS); + // create client data + result &= SimConnect_CreateClientData(hSimConnect, ClientData::FMGC_FMS_INPUTS, sizeof(base_fms_inputs), SIMCONNECT_CREATE_CLIENT_DATA_FLAG_DEFAULT); // add data definitions - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES_AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES_AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES_AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES_AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES_AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES_AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES_AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES_AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES_AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES_AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES_AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES_AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES_AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES_AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES_AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES_AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES_AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES_AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES_AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES_AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES_AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES_AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES_AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES_AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES_AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES_AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); - result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::LOCAL_VARIABLES_AUTOTHRUST, SIMCONNECT_CLIENTDATAOFFSET_AUTO, - SIMCONNECT_CLIENTDATATYPE_FLOAT64); + + // Struct size is 184 bytes due to struct padding. Thus, we cannot just give the correct datatypes, but instead just + // pass 23 8byte f64's. + for (int i = 0; i < 23; i++) { + result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::FMGC_FMS_INPUTS, SIMCONNECT_CLIENTDATAOFFSET_AUTO, + SIMCONNECT_CLIENTDATATYPE_FLOAT64); + } + + // ------------------------------------------------------------------------------------------------------------------ + + // map client id + result &= SimConnect_MapClientDataNameToID(hSimConnect, "A32NX_CLIENT_DATA_FMGC_DISCRETES_OUTPUT", ClientData::FMGC_DISCRETE_OUTPUTS); + // create client data + result &= SimConnect_CreateClientData(hSimConnect, ClientData::FMGC_DISCRETE_OUTPUTS, sizeof(base_fmgc_discrete_outputs), + SIMCONNECT_CREATE_CLIENT_DATA_FLAG_DEFAULT); + // add data definitions + for (int i = 0; i < 6; i++) { + result &= SimConnect_AddToClientDataDefinition(hSimConnect, ClientData::FMGC_DISCRETE_OUTPUTS, SIMCONNECT_CLIENTDATAOFFSET_AUTO, + SIMCONNECT_CLIENTDATATYPE_INT8); + } + + // request data to be updated when set + result &= SimConnect_RequestClientData(hSimConnect, ClientData::FMGC_DISCRETE_OUTPUTS, ClientData::FMGC_DISCRETE_OUTPUTS, + ClientData::FMGC_DISCRETE_OUTPUTS, SIMCONNECT_CLIENT_DATA_PERIOD_ON_SET); + + // ------------------------------------------------------------------------------------------------------------------ + + for (int i = 0; i < 2; i++) { + auto defineId = ClientData::FMGC_1_BUS_A_OUTPUT + i; + // map client id + result &= + SimConnect_MapClientDataNameToID(hSimConnect, ("A32NX_CLIENT_DATA_FMGC_" + std::to_string(i + 1) + "_A_BUS").c_str(), defineId); + // create client data + result &= SimConnect_CreateClientData(hSimConnect, defineId, sizeof(base_fmgc_a_bus), SIMCONNECT_CREATE_CLIENT_DATA_FLAG_DEFAULT); + // add data definitions + for (int i = 0; i < 33; i++) { + result &= + SimConnect_AddToClientDataDefinition(hSimConnect, defineId, SIMCONNECT_CLIENTDATAOFFSET_AUTO, SIMCONNECT_CLIENTDATATYPE_FLOAT64); + } + + // request data to be updated when set + if (i == fmgcDisabled) { + result &= SimConnect_RequestClientData(hSimConnect, defineId, defineId, defineId, SIMCONNECT_CLIENT_DATA_PERIOD_ON_SET); + } + } + + // ------------------------------------------------------------------------------------------------------------------ + + for (int i = 0; i < 2; i++) { + auto defineId = ClientData::FMGC_1_BUS_B_OUTPUT + i; + // map client id + result &= + SimConnect_MapClientDataNameToID(hSimConnect, ("A32NX_CLIENT_DATA_FMGC_" + std::to_string(i + 1) + "_B_BUS").c_str(), defineId); + // create client data + result &= SimConnect_CreateClientData(hSimConnect, defineId, sizeof(base_fmgc_b_bus), SIMCONNECT_CREATE_CLIENT_DATA_FLAG_DEFAULT); + // add data definitions + for (int i = 0; i < 18; i++) { + result &= + SimConnect_AddToClientDataDefinition(hSimConnect, defineId, SIMCONNECT_CLIENTDATAOFFSET_AUTO, SIMCONNECT_CLIENTDATATYPE_FLOAT64); + } + + // request data to be updated when set + if (i == fmgcDisabled) { + result &= SimConnect_RequestClientData(hSimConnect, defineId, defineId, defineId, SIMCONNECT_CLIENT_DATA_PERIOD_ON_SET); + } + } // ------------------------------------------------------------------------------------------------------------------ @@ -1189,16 +1034,6 @@ bool SimConnectInterface::sendEvent(Events eventId, DWORD data, DWORD priority) return true; } -bool SimConnectInterface::setClientDataLocalVariables(ClientDataLocalVariables output) { - // write data and return result - return sendClientData(ClientData::LOCAL_VARIABLES, sizeof(output), &output); -} - -bool SimConnectInterface::setClientDataLocalVariablesAutothrust(ClientDataLocalVariablesAutothrust output) { - // write data and return result - return sendClientData(ClientData::LOCAL_VARIABLES_AUTOTHRUST, sizeof(output), &output); -} - SimData SimConnectInterface::getSimData() { return simData; } @@ -1211,6 +1046,14 @@ SimInputAutopilot SimConnectInterface::getSimInputAutopilot() { return simInputAutopilot; } +base_fcu_afs_panel_inputs SimConnectInterface::getFcuAfsPanelInputs() { + return fcuAfsPanelInputs; +} + +base_fcu_efis_panel_inputs SimConnectInterface::getFcuEfisPanelInputs(int side) { + return fcuEfisPanelInputs[side]; +} + SimInputRudderTrim SimConnectInterface::getSimInputRudderTrim() { return simInputRudderTrim; } @@ -1236,6 +1079,48 @@ void SimConnectInterface::resetSimInputAutopilot() { simInputAutopilot.DIR_TO_trigger = 0; } +void SimConnectInterface::resetFcuFrontPanelInputs() { + fcuEfisPanelInputs[0].baro_knob.pushed = false; + fcuEfisPanelInputs[0].baro_knob.pulled = false; + fcuEfisPanelInputs[0].baro_knob.turns = 0; + fcuEfisPanelInputs[0].fd_button_pushed = false; + fcuEfisPanelInputs[0].ls_button_pushed = false; + fcuEfisPanelInputs[0].cstr_button_pushed = false; + fcuEfisPanelInputs[0].wpt_button_pushed = false; + fcuEfisPanelInputs[0].vord_button_pushed = false; + fcuEfisPanelInputs[0].ndb_button_pushed = false; + fcuEfisPanelInputs[0].arpt_button_pushed = false; + fcuEfisPanelInputs[1].baro_knob.pushed = false; + fcuEfisPanelInputs[1].baro_knob.pulled = false; + fcuEfisPanelInputs[1].baro_knob.turns = 0; + fcuEfisPanelInputs[1].fd_button_pushed = false; + fcuEfisPanelInputs[1].ls_button_pushed = false; + fcuEfisPanelInputs[1].cstr_button_pushed = false; + fcuEfisPanelInputs[1].wpt_button_pushed = false; + fcuEfisPanelInputs[1].vord_button_pushed = false; + fcuEfisPanelInputs[1].ndb_button_pushed = false; + fcuEfisPanelInputs[1].arpt_button_pushed = false; + fcuAfsPanelInputs.loc_button_pressed = false; + fcuAfsPanelInputs.exped_button_pressed = false; + fcuAfsPanelInputs.appr_button_pressed = false; + fcuAfsPanelInputs.spd_mach_button_pressed = false; + fcuAfsPanelInputs.trk_fpa_button_pressed = false; + fcuAfsPanelInputs.metric_alt_button_pressed = false; + fcuAfsPanelInputs.spd_knob.pushed = false; + fcuAfsPanelInputs.spd_knob.pulled = false; + fcuAfsPanelInputs.spd_knob.turns = 0; + fcuAfsPanelInputs.hdg_trk_knob.pushed = false; + fcuAfsPanelInputs.hdg_trk_knob.pulled = false; + fcuAfsPanelInputs.hdg_trk_knob.turns = 0; + fcuAfsPanelInputs.alt_knob.pushed = false; + fcuAfsPanelInputs.alt_knob.pulled = false; + fcuAfsPanelInputs.alt_knob.turns = 0; + fcuAfsPanelInputs.alt_increment_1000 = false; + fcuAfsPanelInputs.vs_fpa_knob.pushed = false; + fcuAfsPanelInputs.vs_fpa_knob.pulled = false; + fcuAfsPanelInputs.vs_fpa_knob.turns = 0; +} + void SimConnectInterface::resetSimInputRudderTrim() { simInputRudderTrim.rudderTrimSwitchLeft = false; simInputRudderTrim.rudderTrimSwitchRight = false; @@ -1248,32 +1133,6 @@ void SimConnectInterface::resetSimInputThrottles() { simInputThrottles.ATHR_reset_disable = 0; } -bool SimConnectInterface::setClientDataAutopilotLaws(ClientDataAutopilotLaws output) { - // write data and return result - return sendClientData(ClientData::AUTOPILOT_LAWS, sizeof(output), &output); -} - -ClientDataAutopilotLaws SimConnectInterface::getClientDataAutopilotLaws() { - return clientDataAutopilotLaws; -} - -bool SimConnectInterface::setClientDataAutopilotStateMachine(ClientDataAutopilotStateMachine output) { - // write data and return result - return sendClientData(ClientData::AUTOPILOT_STATE_MACHINE, sizeof(output), &output); -} - -ClientDataAutopilotStateMachine SimConnectInterface::getClientDataAutopilotStateMachine() { - return clientDataAutopilotStateMachine; -} - -ClientDataAutothrust SimConnectInterface::getClientDataAutothrust() { - return clientDataAutothrust; -} - -ClientDataFlyByWire SimConnectInterface::getClientDataFlyByWire() { - return clientDataFlyByWire; -} - bool SimConnectInterface::setClientDataElacDiscretes(base_elac_discrete_inputs output) { return sendClientData(ClientData::ELAC_DISCRETE_INPUTS, sizeof(output), &output); } @@ -1314,6 +1173,26 @@ bool SimConnectInterface::setClientDataFacBus(base_fac_bus output, int facIndex) return sendClientData(ClientData::FAC_1_BUS_OUTPUT + facIndex, sizeof(output), &output); } +bool SimConnectInterface::setClientDataFcuBus(base_fcu_bus output) { + return sendClientData(ClientData::FCU_BUS_OUTPUT, sizeof(output), &output); +} + +bool SimConnectInterface::setClientDataFmgcDiscretes(base_fmgc_discrete_inputs output) { + return sendClientData(ClientData::FMGC_DISCRETE_INPUTS, sizeof(output), &output); +} + +bool SimConnectInterface::setClientDataFmgcFmsData(base_fms_inputs output) { + return sendClientData(ClientData::FMGC_FMS_INPUTS, sizeof(output), &output); +} + +bool SimConnectInterface::setClientDataFmgcABus(base_fmgc_a_bus output, int fmgcIndex) { + return sendClientData(ClientData::FMGC_1_BUS_A_OUTPUT + fmgcIndex, sizeof(output), &output); +} + +bool SimConnectInterface::setClientDataFmgcBBus(base_fmgc_b_bus output, int fmgcIndex) { + return sendClientData(ClientData::FMGC_1_BUS_B_OUTPUT + fmgcIndex, sizeof(output), &output); +} + base_elac_discrete_outputs SimConnectInterface::getClientDataElacDiscretesOutput() { return clientDataElacDiscreteOutputs; } @@ -1350,6 +1229,22 @@ base_fac_bus SimConnectInterface::getClientDataFacBusOutput() { return clientDataFacBusOutputs; } +base_fcu_bus SimConnectInterface::getClientDataFcuBusOutput() { + return clientDataFcuBusOutputs; +} + +base_fmgc_discrete_outputs SimConnectInterface::getClientDataFmgcDiscretesOutput() { + return clientDataFmgcDiscreteOutputs; +} + +base_fmgc_a_bus SimConnectInterface::getClientDataFmgcABusOutput() { + return clientDataFmgcABusOutputs; +} + +base_fmgc_b_bus SimConnectInterface::getClientDataFmgcBBusOutput() { + return clientDataFmgcBBusOutputs; +} + bool SimConnectInterface::setClientDataAdr(base_adr_bus output, int adrIndex) { return sendClientData(ClientData::ADR_1_INPUTS + adrIndex, sizeof(output), &output); } @@ -1370,8 +1265,12 @@ bool SimConnectInterface::setClientDataSfcc(base_sfcc_bus output, int sfccIndex) return sendClientData(ClientData::SFCC_1_BUS + sfccIndex, sizeof(output), &output); } -bool SimConnectInterface::setClientDataFmgcB(base_fmgc_b_bus output, int fmgcIndex) { - return sendClientData(ClientData::FMGC_1_B_BUS + fmgcIndex, sizeof(output), &output); +bool SimConnectInterface::setClientDataIls(base_ils_bus output, int ilsIndex) { + return sendClientData(ClientData::ILS_1_BUS + ilsIndex, sizeof(output), &output); +} + +bool SimConnectInterface::setClientDataFadec(base_ecu_bus output, int fadecIndex) { + return sendClientData(ClientData::FADEC_1_BUS + fadecIndex, sizeof(output), &output); } void SimConnectInterface::setLoggingFlightControlsEnabled(bool enabled) { @@ -1787,11 +1686,6 @@ void SimConnectInterface::processEventWithOneParam(const DWORD eventId, const DW break; } - case Events::TOGGLE_FLIGHT_DIRECTOR: { - std::cout << "WASM: event triggered: TOGGLE_FLIGHT_DIRECTOR:" << static_cast(data0) << std::endl; - break; - } - case Events::AP_MASTER: { simInputAutopilot.AP_1_push = 1; std::cout << "WASM: event triggered: AP_MASTER" << std::endl; @@ -1843,273 +1737,279 @@ void SimConnectInterface::processEventWithOneParam(const DWORD eventId, const DW } case Events::A32NX_FCU_SPD_INC: { - execute_calculator_code("(>H:A320_Neo_FCU_SPEED_INC)", nullptr, nullptr, nullptr); + fcuAfsPanelInputs.spd_knob.turns = 1; std::cout << "WASM: event triggered: A32NX_FCU_SPD_INC" << std::endl; break; } case Events::A32NX_FCU_SPD_DEC: { - execute_calculator_code("(>H:A320_Neo_FCU_SPEED_DEC)", nullptr, nullptr, nullptr); + fcuAfsPanelInputs.spd_knob.turns = -1; std::cout << "WASM: event triggered: A32NX_FCU_SPD_DEC" << std::endl; break; } - case Events::A32NX_FCU_SPD_SET: { - idFcuEventSetSPEED->set(static_cast(data0)); - execute_calculator_code("(>H:A320_Neo_FCU_SPEED_SET)", nullptr, nullptr, nullptr); - std::cout << "WASM: event triggered: A32NX_FCU_SPD_SET: " << static_cast(data0) << std::endl; - break; - } - case Events::A32NX_FCU_SPD_PUSH: case Events::AP_AIRSPEED_ON: { - execute_calculator_code("(>H:A320_Neo_FCU_SPEED_PUSH)", nullptr, nullptr, nullptr); + fcuAfsPanelInputs.spd_knob.pushed = true; std::cout << "WASM: event triggered: A32NX_FCU_SPD_PUSH" << std::endl; break; } case Events::A32NX_FCU_SPD_PULL: case Events::AP_AIRSPEED_OFF: { - execute_calculator_code("(>H:A320_Neo_FCU_SPEED_PULL)", nullptr, nullptr, nullptr); + fcuAfsPanelInputs.spd_knob.pulled = true; std::cout << "WASM: event triggered: A32NX_FCU_SPD_PULL" << std::endl; break; } case Events::A32NX_FCU_SPD_MACH_TOGGLE_PUSH: case Events::AP_MACH_HOLD: { - execute_calculator_code("(>H:A320_Neo_FCU_SPEED_TOGGLE_SPEED_MACH)", nullptr, nullptr, nullptr); + fcuAfsPanelInputs.spd_mach_button_pressed = true; std::cout << "WASM: event triggered: A32NX_FCU_SPD_MACH_TOGGLE_PUSH" << std::endl; break; } case Events::A32NX_FCU_HDG_INC: { - execute_calculator_code( - "(L:A32NX_TRK_FPA_MODE_ACTIVE, bool) 1 == if{ (>H:A320_Neo_FCU_HDG_INC_TRACK) } els{ (>H:A320_Neo_FCU_HDG_INC_HEADING) }", - nullptr, nullptr, nullptr); + fcuAfsPanelInputs.hdg_trk_knob.turns = 1; std::cout << "WASM: event triggered: A32NX_FCU_HDG_INC" << std::endl; break; } case Events::A32NX_FCU_HDG_DEC: { - execute_calculator_code( - "(L:A32NX_TRK_FPA_MODE_ACTIVE, bool) 1 == if{ (>H:A320_Neo_FCU_HDG_DEC_TRACK) } els{ (>H:A320_Neo_FCU_HDG_DEC_HEADING) }", - nullptr, nullptr, nullptr); + fcuAfsPanelInputs.hdg_trk_knob.turns = -1; std::cout << "WASM: event triggered: A32NX_FCU_HDG_DEC" << std::endl; break; } - case Events::A32NX_FCU_HDG_SET: { - idFcuEventSetHDG->set(static_cast(data0)); - execute_calculator_code("(>H:A320_Neo_FCU_HDG_SET)", nullptr, nullptr, nullptr); - std::cout << "WASM: event triggered: A32NX_FCU_HDG_SET: " << static_cast(data0) << std::endl; - break; - } - case Events::A32NX_FCU_HDG_PUSH: case Events::AP_HDG_HOLD_ON: { - execute_calculator_code("(>H:A320_Neo_FCU_HDG_PUSH)", nullptr, nullptr, nullptr); + fcuAfsPanelInputs.hdg_trk_knob.pushed = true; std::cout << "WASM: event triggered: A32NX_FCU_HDG_PUSH" << std::endl; break; } case Events::A32NX_FCU_HDG_PULL: case Events::AP_HDG_HOLD_OFF: { - execute_calculator_code("(>H:A320_Neo_FCU_HDG_PULL)", nullptr, nullptr, nullptr); + fcuAfsPanelInputs.hdg_trk_knob.pulled = true; std::cout << "WASM: event triggered: A32NX_FCU_HDG_PULL" << std::endl; break; } case Events::A32NX_FCU_TRK_FPA_TOGGLE_PUSH: case Events::AP_VS_HOLD: { - execute_calculator_code("(L:A32NX_TRK_FPA_MODE_ACTIVE) ! (>L:A32NX_TRK_FPA_MODE_ACTIVE)", nullptr, nullptr, nullptr); + fcuAfsPanelInputs.trk_fpa_button_pressed = true; std::cout << "WASM: event triggered: A32NX_FCU_TRK_FPA_TOGGLE_PUSH" << std::endl; break; } - case Events::A32NX_FCU_TO_AP_HDG_PUSH: { - simInputAutopilot.HDG_push = 1; - std::cout << "WASM: event triggered: A32NX_FCU_TO_AP_HDG_PUSH" << std::endl; - break; - } - - case Events::A32NX_FCU_TO_AP_HDG_PULL: { - simInputAutopilot.HDG_pull = 1; - std::cout << "WASM: event triggered: A32NX_FCU_TO_AP_HDG_PULL" << std::endl; - break; - } - case Events::A32NX_FCU_ALT_INC: { - long increment = static_cast(data0); - if (increment == 100) { - execute_calculator_code( - "3 (A:AUTOPILOT ALTITUDE LOCK VAR:3, feet) 100 + (A:AUTOPILOT ALTITUDE LOCK VAR:3, feet) " - "100 % - 49000 min (>K:2:AP_ALT_VAR_SET_ENGLISH) (>H:AP_KNOB_Up) " - "(>H:A320_Neo_CDU_AP_INC_ALT)", - nullptr, nullptr, nullptr); - } else if (increment == 1000) { - execute_calculator_code( - "3 (A:AUTOPILOT ALTITUDE LOCK VAR:3, feet) 1000 + (A:AUTOPILOT ALTITUDE LOCK VAR:3, feet) " - "1000 % - 49000 min (>K:2:AP_ALT_VAR_SET_ENGLISH) (>H:AP_KNOB_Up) " - "(>H:A320_Neo_CDU_AP_INC_ALT)", - nullptr, nullptr, nullptr); - } else { - execute_calculator_code( - "3 (A:AUTOPILOT ALTITUDE LOCK VAR:3, feet) (L:XMLVAR_Autopilot_Altitude_Increment) + (A:AUTOPILOT ALTITUDE LOCK VAR:3, feet) " - "(L:XMLVAR_Autopilot_Altitude_Increment) % - 49000 min (>K:2:AP_ALT_VAR_SET_ENGLISH) (>H:AP_KNOB_Up) " - "(>H:A320_Neo_CDU_AP_INC_ALT)", - nullptr, nullptr, nullptr); - } + fcuAfsPanelInputs.alt_knob.turns = 1; + std::cout << "WASM: event triggered: A32NX_FCU_ALT_INC" << std::endl; break; } case Events::A32NX_FCU_ALT_DEC: { - long increment = static_cast(data0); - if (increment == 100) { - execute_calculator_code( - "3 (A:AUTOPILOT ALTITUDE LOCK VAR:3, feet) 100 - 100 " - "(A:AUTOPILOT ALTITUDE LOCK VAR:3, feet) 100 % - 100 % " - "+ 100 max (>K:2:AP_ALT_VAR_SET_ENGLISH) (>H:AP_KNOB_Down) (>H:A320_Neo_CDU_AP_DEC_ALT)", - nullptr, nullptr, nullptr); - } else if (increment == 1000) { - execute_calculator_code( - "3 (A:AUTOPILOT ALTITUDE LOCK VAR:3, feet) 1000 - 1000 " - "(A:AUTOPILOT ALTITUDE LOCK VAR:3, feet) 1000 % - 1000 % " - "+ 100 max (>K:2:AP_ALT_VAR_SET_ENGLISH) (>H:AP_KNOB_Down) (>H:A320_Neo_CDU_AP_DEC_ALT)", - nullptr, nullptr, nullptr); - } else { - execute_calculator_code( - "3 (A:AUTOPILOT ALTITUDE LOCK VAR:3, feet) (L:XMLVAR_Autopilot_Altitude_Increment) - (L:XMLVAR_Autopilot_Altitude_Increment) " - "(A:AUTOPILOT ALTITUDE LOCK VAR:3, feet) (L:XMLVAR_Autopilot_Altitude_Increment) % - (L:XMLVAR_Autopilot_Altitude_Increment) " - "% " - "+ 100 max (>K:2:AP_ALT_VAR_SET_ENGLISH) (>H:AP_KNOB_Down) (>H:A320_Neo_CDU_AP_DEC_ALT)", - nullptr, nullptr, nullptr); - } - std::cout << "WASM: event triggered: A32NX_FCU_ALT_DEC" << std::endl; - break; - } - - case Events::A32NX_FCU_ALT_SET: { - long value = 100 * (static_cast(data0) / 100); - std::ostringstream stringStream; - stringStream << value; - stringStream << " (>K:3:AP_ALT_VAR_SET_ENGLISH)"; - execute_calculator_code(stringStream.str().c_str(), nullptr, nullptr, nullptr); - std::cout << "WASM: event triggered: A32NX_FCU_ALT_SET: " << value << std::endl; - break; - } - - case Events::A32NX_FCU_ALT_INCREMENT_TOGGLE: - case Events::AP_ALT_HOLD: { - execute_calculator_code( - "(L:XMLVAR_Autopilot_Altitude_Increment, number) 100 == " - "if{ 1000 (>L:XMLVAR_Autopilot_Altitude_Increment) } " - "els{ 100 (>L:XMLVAR_Autopilot_Altitude_Increment) }", - nullptr, nullptr, nullptr); - std::cout << "WASM: event triggered: A32NX_FCU_ALT_INCREMENT_TOGGLE" << std::endl; - break; - } + fcuAfsPanelInputs.alt_knob.turns = -1; - case Events::A32NX_FCU_ALT_INCREMENT_SET: { - long value = static_cast(data0); - if (value == 100 || value == 1000) { - std::ostringstream stringStream; - stringStream << value; - stringStream << " (>L:XMLVAR_Autopilot_Altitude_Increment)"; - execute_calculator_code(stringStream.str().c_str(), nullptr, nullptr, nullptr); - std::cout << "WASM: event triggered: A32NX_FCU_ALT_INCREMENT_SET: " << value << std::endl; - } + std::cout << "WASM: event triggered: A32NX_FCU_ALT_DEC" << std::endl; break; } case Events::A32NX_FCU_ALT_PUSH: case Events::AP_ALT_HOLD_ON: { - simInputAutopilot.ALT_push = 1; - execute_calculator_code("(>H:A320_Neo_CDU_MODE_MANAGED_ALTITUDE)", nullptr, nullptr, nullptr); + fcuAfsPanelInputs.alt_knob.pushed = true; std::cout << "WASM: event triggered: A32NX_FCU_ALT_PUSH" << std::endl; break; } case Events::A32NX_FCU_ALT_PULL: case Events::AP_ALT_HOLD_OFF: { - simInputAutopilot.ALT_pull = 1; - execute_calculator_code("(>H:A320_Neo_CDU_MODE_SELECTED_ALTITUDE)", nullptr, nullptr, nullptr); + fcuAfsPanelInputs.alt_knob.pulled = true; std::cout << "WASM: event triggered: A32NX_FCU_ALT_PULL" << std::endl; break; } + case Events::A32NX_FCU_METRIC_ALT_TOGGLE_PUSH: { + fcuAfsPanelInputs.metric_alt_button_pressed = true; + std::cout << "WASM: event triggered: A32NX_FCU_METRIC_ALT_TOGGLE_PUSH" << std::endl; + break; + } + case Events::A32NX_FCU_VS_INC: { - execute_calculator_code( - "(L:A32NX_TRK_FPA_MODE_ACTIVE, bool) 1 == if{ (>H:A320_Neo_FCU_VS_INC_FPA) } els{ (>H:A320_Neo_FCU_VS_INC_VS) } " - "(>H:A320_Neo_CDU_VS)", - nullptr, nullptr, nullptr); + fcuAfsPanelInputs.vs_fpa_knob.turns = 1; std::cout << "WASM: event triggered: A32NX_FCU_VS_INC" << std::endl; break; } case Events::A32NX_FCU_VS_DEC: { - execute_calculator_code( - "(L:A32NX_TRK_FPA_MODE_ACTIVE, bool) 1 == if{ (>H:A320_Neo_FCU_VS_DEC_FPA) } els{ (>H:A320_Neo_FCU_VS_DEC_VS) } " - "(>H:A320_Neo_CDU_VS)", - nullptr, nullptr, nullptr); + fcuAfsPanelInputs.vs_fpa_knob.turns = -1; std::cout << "WASM: event triggered: A32NX_FCU_VS_DEC" << std::endl; break; } - case Events::A32NX_FCU_VS_SET: { - idFcuEventSetVS->set(static_cast(data0)); - execute_calculator_code("(>H:A320_Neo_FCU_VS_SET) (>H:A320_Neo_CDU_VS)", nullptr, nullptr, nullptr); - std::cout << "WASM: event triggered: A32NX_FCU_VS_SET: " << static_cast(data0) << std::endl; - break; - } - case Events::A32NX_FCU_VS_PUSH: case Events::AP_VS_ON: { - execute_calculator_code("(>H:A320_Neo_FCU_VS_PUSH) (>H:A320_Neo_CDU_VS)", nullptr, nullptr, nullptr); + fcuAfsPanelInputs.vs_fpa_knob.pushed = true; std::cout << "WASM: event triggered: A32NX_FCU_VS_PUSH" << std::endl; break; } case Events::A32NX_FCU_VS_PULL: case Events::AP_VS_OFF: { - execute_calculator_code("(>H:A320_Neo_FCU_VS_PULL) (>H:A320_Neo_CDU_VS)", nullptr, nullptr, nullptr); + fcuAfsPanelInputs.vs_fpa_knob.pulled = true; std::cout << "WASM: event triggered: A32NX_FCU_VS_PULL" << std::endl; break; } - case Events::A32NX_FCU_TO_AP_VS_PUSH: { - simInputAutopilot.VS_push = 1; - std::cout << "WASM: event triggered: A32NX_FCU_TO_AP_VS_PUSH" << std::endl; - break; - } - case Events::A32NX_FCU_TO_AP_VS_PULL: { - simInputAutopilot.VS_pull = 1; - std::cout << "WASM: event triggered: A32NX_FCU_TO_AP_VS_PULL" << std::endl; - break; - } - case Events::A32NX_FCU_LOC_PUSH: { - simInputAutopilot.LOC_push = 1; + fcuAfsPanelInputs.loc_button_pressed = true; std::cout << "WASM: event triggered: A32NX_FCU_LOC_PUSH" << std::endl; break; } case Events::A32NX_FCU_APPR_PUSH: { - simInputAutopilot.APPR_push = 1; + fcuAfsPanelInputs.appr_button_pressed = true; std::cout << "WASM: event triggered: A32NX_FCU_APPR_PUSH" << std::endl; break; } case Events::A32NX_FCU_EXPED_PUSH: case Events::AP_ATT_HOLD: { - simInputAutopilot.EXPED_push = 1; + fcuAfsPanelInputs.exped_button_pressed = true; std::cout << "WASM: event triggered: A32NX_FCU_EXPED_PUSH" << std::endl; break; } - case Events::A32NX_FMGC_DIR_TO_TRIGGER: { - simInputAutopilot.DIR_TO_trigger = 1; - std::cout << "WASM: event triggered: A32NX_FMGC_DIR_TO_TRIGGER" << std::endl; + case Events::A32NX_FCU_EFIS_L_FD_PUSH: { + fcuEfisPanelInputs[0].fd_button_pushed = true; + std::cout << "WASM: event triggered: A32NX_FCU_EFIS_L_FD_PUSH" << std::endl; + break; + } + + case Events::A32NX_FCU_EFIS_L_LS_PUSH: { + fcuEfisPanelInputs[0].ls_button_pushed = true; + std::cout << "WASM: event triggered: A32NX_FCU_EFIS_L_LS_PUSH" << std::endl; + break; + } + + case Events::A32NX_FCU_EFIS_L_BARO_INC: { + fcuEfisPanelInputs[0].baro_knob.turns = 1; + std::cout << "WASM: event triggered: A32NX_FCU_EFIS_L_BARO_INC" << std::endl; + break; + } + + case Events::A32NX_FCU_EFIS_L_BARO_DEC: { + fcuEfisPanelInputs[0].baro_knob.turns = -1; + std::cout << "WASM: event triggered: A32NX_FCU_EFIS_L_BARO_DEC" << std::endl; + break; + } + + case Events::A32NX_FCU_EFIS_L_BARO_PUSH: { + fcuEfisPanelInputs[0].baro_knob.pushed = true; + std::cout << "WASM: event triggered: A32NX_FCU_EFIS_L_BARO_PUSH" << std::endl; + break; + } + + case Events::A32NX_FCU_EFIS_L_BARO_PULL: { + fcuEfisPanelInputs[0].baro_knob.pulled = true; + std::cout << "WASM: event triggered: A32NX_FCU_EFIS_L_BARO_PULL" << std::endl; + break; + } + + case Events::A32NX_FCU_EFIS_L_CSTR_PUSH: { + fcuEfisPanelInputs[0].cstr_button_pushed = true; + std::cout << "WASM: event triggered: A32NX_FCU_EFIS_L_CSTR_PUSH" << std::endl; + break; + } + + case Events::A32NX_FCU_EFIS_L_WPT_PUSH: { + fcuEfisPanelInputs[0].wpt_button_pushed = true; + std::cout << "WASM: event triggered: A32NX_FCU_EFIS_L_WPT_PUSH" << std::endl; + break; + } + + case Events::A32NX_FCU_EFIS_L_VORD_PUSH: { + fcuEfisPanelInputs[0].vord_button_pushed = true; + std::cout << "WASM: event triggered: A32NX_FCU_EFIS_L_VORD_PUSH" << std::endl; + break; + } + + case Events::A32NX_FCU_EFIS_L_NDB_PUSH: { + fcuEfisPanelInputs[0].ndb_button_pushed = true; + std::cout << "WASM: event triggered: A32NX_FCU_EFIS_L_NDB_PUSH" << std::endl; + break; + } + + case Events::A32NX_FCU_EFIS_L_ARPT_PUSH: { + fcuEfisPanelInputs[0].arpt_button_pushed = true; + std::cout << "WASM: event triggered: A32NX_FCU_EFIS_L_ARPT_PUSH" << std::endl; + break; + } + + case Events::A32NX_FCU_EFIS_R_FD_PUSH: { + fcuEfisPanelInputs[1].fd_button_pushed = true; + std::cout << "WASM: event triggered: A32NX_FCU_EFIS_R_FD_PUSH" << std::endl; + break; + } + + case Events::A32NX_FCU_EFIS_R_LS_PUSH: { + fcuEfisPanelInputs[1].ls_button_pushed = true; + std::cout << "WASM: event triggered: A32NX_FCU_EFIS_R_LS_PUSH" << std::endl; + break; + } + + case Events::A32NX_FCU_EFIS_R_BARO_INC: { + fcuEfisPanelInputs[1].baro_knob.turns = 1; + std::cout << "WASM: event triggered: A32NX_FCU_EFIS_R_BARO_INC" << std::endl; + break; + } + + case Events::A32NX_FCU_EFIS_R_BARO_DEC: { + fcuEfisPanelInputs[1].baro_knob.turns = -1; + std::cout << "WASM: event triggered: A32NX_FCU_EFIS_R_BARO_DEC" << std::endl; + break; + } + + case Events::A32NX_FCU_EFIS_R_BARO_PUSH: { + fcuEfisPanelInputs[1].baro_knob.pushed = true; + std::cout << "WASM: event triggered: A32NX_FCU_EFIS_R_BARO_PUSH" << std::endl; + break; + } + + case Events::A32NX_FCU_EFIS_R_BARO_PULL: { + fcuEfisPanelInputs[1].baro_knob.pulled = true; + std::cout << "WASM: event triggered: A32NX_FCU_EFIS_R_BARO_PULL" << std::endl; + break; + } + + case Events::A32NX_FCU_EFIS_R_CSTR_PUSH: { + fcuEfisPanelInputs[1].cstr_button_pushed = true; + std::cout << "WASM: event triggered: A32NX_FCU_EFIS_R_CSTR_PUSH" << std::endl; + break; + } + + case Events::A32NX_FCU_EFIS_R_WPT_PUSH: { + fcuEfisPanelInputs[1].wpt_button_pushed = true; + std::cout << "WASM: event triggered: A32NX_FCU_EFIS_R_WPT_PUSH" << std::endl; + break; + } + + case Events::A32NX_FCU_EFIS_R_VORD_PUSH: { + fcuEfisPanelInputs[1].vord_button_pushed = true; + std::cout << "WASM: event triggered: A32NX_FCU_EFIS_R_VORD_PUSH" << std::endl; + break; + } + + case Events::A32NX_FCU_EFIS_R_NDB_PUSH: { + fcuEfisPanelInputs[1].ndb_button_pushed = true; + std::cout << "WASM: event triggered: A32NX_FCU_EFIS_R_NDB_PUSH" << std::endl; + break; + } + + case Events::A32NX_FCU_EFIS_R_ARPT_PUSH: { + fcuEfisPanelInputs[1].arpt_button_pushed = true; + std::cout << "WASM: event triggered: A32NX_FCU_EFIS_R_ARPT_PUSH" << std::endl; break; } @@ -2797,21 +2697,6 @@ void SimConnectInterface::simConnectProcessSimObjectData(const SIMCONNECT_RECV_S void SimConnectInterface::simConnectProcessClientData(const SIMCONNECT_RECV_CLIENT_DATA* data) { // process depending on request id switch (data->dwRequestID) { - case ClientData::AUTOPILOT_STATE_MACHINE: - // store aircraft data - clientDataAutopilotStateMachine = *((ClientDataAutopilotStateMachine*)&data->dwData); - return; - - case ClientData::AUTOPILOT_LAWS: - // store aircraft data - clientDataAutopilotLaws = *((ClientDataAutopilotLaws*)&data->dwData); - return; - - case ClientData::AUTOTHRUST: - // store aircraft data - clientDataAutothrust = *((ClientDataAutothrust*)&data->dwData); - return; - case ClientData::ELAC_DISCRETE_OUTPUTS: // store aircraft data clientDataElacDiscreteOutputs = *((base_elac_discrete_outputs*)&data->dwData); @@ -2872,6 +2757,36 @@ void SimConnectInterface::simConnectProcessClientData(const SIMCONNECT_RECV_CLIE clientDataFacBusOutputs = *((base_fac_bus*)&data->dwData); return; + case ClientData::FCU_BUS_OUTPUT: + // store aircraft data + clientDataFcuBusOutputs = *((base_fcu_bus*)&data->dwData); + return; + + case ClientData::FMGC_DISCRETE_OUTPUTS: + // store aircraft data + clientDataFmgcDiscreteOutputs = *((base_fmgc_discrete_outputs*)&data->dwData); + return; + + case ClientData::FMGC_1_BUS_A_OUTPUT: + // store aircraft data + clientDataFmgcABusOutputs = *((base_fmgc_a_bus*)&data->dwData); + return; + + case ClientData::FMGC_2_BUS_A_OUTPUT: + // store aircraft data + clientDataFmgcABusOutputs = *((base_fmgc_a_bus*)&data->dwData); + return; + + case ClientData::FMGC_1_BUS_B_OUTPUT: + // store aircraft data + clientDataFmgcBBusOutputs = *((base_fmgc_b_bus*)&data->dwData); + return; + + case ClientData::FMGC_2_BUS_B_OUTPUT: + // store aircraft data + clientDataFmgcBBusOutputs = *((base_fmgc_b_bus*)&data->dwData); + return; + default: // print unknown request id std::cout << "WASM: Unknown request id in SimConnect connection: "; diff --git a/fbw-a32nx/src/wasm/fbw_a320/src/interface/SimConnectInterface.h b/fbw-a32nx/src/wasm/fbw_a320/src/interface/SimConnectInterface.h index 914dcc271805..5a1c350b1974 100644 --- a/fbw-a32nx/src/wasm/fbw_a320/src/interface/SimConnectInterface.h +++ b/fbw-a32nx/src/wasm/fbw_a320/src/interface/SimConnectInterface.h @@ -12,6 +12,8 @@ #include "../model/ElacComputer_types.h" #include "../model/FacComputer_types.h" +#include "../model/FcuComputer_types.h" +#include "../model/FmgcComputer_types.h" #include "../model/SecComputer_types.h" class SimConnectInterface { @@ -43,7 +45,6 @@ class SimConnectInterface { AUTOPILOT_ON, AUTOPILOT_DISENGAGE_SET, AUTOPILOT_DISENGAGE_TOGGLE, - TOGGLE_FLIGHT_DIRECTOR, A32NX_FCU_AP_1_PUSH, A32NX_FCU_AP_2_PUSH, A32NX_FCU_AP_DISCONNECT_PUSH, @@ -51,36 +52,48 @@ class SimConnectInterface { A32NX_FCU_ATHR_DISCONNECT_PUSH, A32NX_FCU_SPD_INC, A32NX_FCU_SPD_DEC, - A32NX_FCU_SPD_SET, A32NX_FCU_SPD_PUSH, A32NX_FCU_SPD_PULL, A32NX_FCU_SPD_MACH_TOGGLE_PUSH, A32NX_FCU_HDG_INC, A32NX_FCU_HDG_DEC, - A32NX_FCU_HDG_SET, A32NX_FCU_HDG_PUSH, A32NX_FCU_HDG_PULL, A32NX_FCU_TRK_FPA_TOGGLE_PUSH, - A32NX_FCU_TO_AP_HDG_PUSH, - A32NX_FCU_TO_AP_HDG_PULL, A32NX_FCU_ALT_INC, A32NX_FCU_ALT_DEC, - A32NX_FCU_ALT_SET, A32NX_FCU_ALT_PUSH, A32NX_FCU_ALT_PULL, - A32NX_FCU_ALT_INCREMENT_TOGGLE, - A32NX_FCU_ALT_INCREMENT_SET, + A32NX_FCU_METRIC_ALT_TOGGLE_PUSH, A32NX_FCU_VS_INC, A32NX_FCU_VS_DEC, - A32NX_FCU_VS_SET, A32NX_FCU_VS_PUSH, A32NX_FCU_VS_PULL, - A32NX_FCU_TO_AP_VS_PUSH, - A32NX_FCU_TO_AP_VS_PULL, A32NX_FCU_LOC_PUSH, A32NX_FCU_APPR_PUSH, A32NX_FCU_EXPED_PUSH, - A32NX_FMGC_DIR_TO_TRIGGER, + A32NX_FCU_EFIS_L_FD_PUSH, + A32NX_FCU_EFIS_L_LS_PUSH, + A32NX_FCU_EFIS_L_BARO_INC, + A32NX_FCU_EFIS_L_BARO_DEC, + A32NX_FCU_EFIS_L_BARO_PUSH, + A32NX_FCU_EFIS_L_BARO_PULL, + A32NX_FCU_EFIS_L_CSTR_PUSH, + A32NX_FCU_EFIS_L_WPT_PUSH, + A32NX_FCU_EFIS_L_VORD_PUSH, + A32NX_FCU_EFIS_L_NDB_PUSH, + A32NX_FCU_EFIS_L_ARPT_PUSH, + A32NX_FCU_EFIS_R_FD_PUSH, + A32NX_FCU_EFIS_R_LS_PUSH, + A32NX_FCU_EFIS_R_BARO_INC, + A32NX_FCU_EFIS_R_BARO_DEC, + A32NX_FCU_EFIS_R_BARO_PUSH, + A32NX_FCU_EFIS_R_BARO_PULL, + A32NX_FCU_EFIS_R_CSTR_PUSH, + A32NX_FCU_EFIS_R_WPT_PUSH, + A32NX_FCU_EFIS_R_VORD_PUSH, + A32NX_FCU_EFIS_R_NDB_PUSH, + A32NX_FCU_EFIS_R_ARPT_PUSH, A32NX_EFIS_L_CHRONO_PUSHED, A32NX_EFIS_R_CHRONO_PUSHED, AP_AIRSPEED_ON, @@ -183,12 +196,11 @@ class SimConnectInterface { ~SimConnectInterface() = default; bool connect(bool clientDataEnabled, - bool autopilotStateMachineEnabled, - bool autopilotLawsEnabled, - bool flyByWireEnabled, int elacDisabled, int secDisabled, int facDisabled, + int fmgcDisabled, + bool fcuDisabled, const std::vector>& throttleAxis, std::shared_ptr spoilersHandler, double keyChangeAileron, @@ -224,12 +236,10 @@ class SimConnectInterface { bool sendEvent(Events eventId, DWORD data, DWORD priority); - bool setClientDataLocalVariables(ClientDataLocalVariables output); - - bool setClientDataLocalVariablesAutothrust(ClientDataLocalVariablesAutothrust output); - void resetSimInputRudderTrim(); + void resetFcuFrontPanelInputs(); + void resetSimInputAutopilot(); void resetSimInputThrottles(); @@ -240,22 +250,13 @@ class SimConnectInterface { SimInputAutopilot getSimInputAutopilot(); - SimInputRudderTrim getSimInputRudderTrim(); + base_fcu_afs_panel_inputs getFcuAfsPanelInputs(); - SimInputThrottles getSimInputThrottles(); + base_fcu_efis_panel_inputs getFcuEfisPanelInputs(int side); - bool setClientDataAutopilotStateMachine(ClientDataAutopilotStateMachine output); - ClientDataAutopilotStateMachine getClientDataAutopilotStateMachine(); - - bool setClientDataAutopilotLaws(ClientDataAutopilotLaws output); - ClientDataAutopilotLaws getClientDataAutopilotLaws(); - - ClientDataAutothrust getClientDataAutothrust(); - - bool setClientDataFlyByWireInput(ClientDataFlyByWireInput output); + SimInputRudderTrim getSimInputRudderTrim(); - bool setClientDataFlyByWire(ClientDataFlyByWire output); - ClientDataFlyByWire getClientDataFlyByWire(); + SimInputThrottles getSimInputThrottles(); bool setClientDataElacDiscretes(base_elac_discrete_inputs output); bool setClientDataElacAnalog(base_elac_analog_inputs output); @@ -281,12 +282,26 @@ class SimConnectInterface { base_fac_analog_outputs getClientDataFacAnalogsOutput(); base_fac_bus getClientDataFacBusOutput(); + bool setClientDataFcuBus(base_fcu_bus output); + + base_fcu_bus getClientDataFcuBusOutput(); + + bool setClientDataFmgcDiscretes(base_fmgc_discrete_inputs output); + bool setClientDataFmgcFmsData(base_fms_inputs output); + bool setClientDataFmgcABus(base_fmgc_a_bus output, int fmgcIndex); + bool setClientDataFmgcBBus(base_fmgc_b_bus output, int fmgcIndex); + + base_fmgc_discrete_outputs getClientDataFmgcDiscretesOutput(); + base_fmgc_a_bus getClientDataFmgcABusOutput(); + base_fmgc_b_bus getClientDataFmgcBBusOutput(); + bool setClientDataAdr(base_adr_bus output, int adrIndex); bool setClientDataIr(base_ir_bus output, int irIndex); bool setClientDataRa(base_ra_bus output, int raIndex); bool setClientDataLgciu(base_lgciu_bus output, int lgciuIndex); bool setClientDataSfcc(base_sfcc_bus output, int sfccIndex); - bool setClientDataFmgcB(base_fmgc_b_bus output, int fmgcIndex); + bool setClientDataIls(base_ils_bus output, int ilsIndex); + bool setClientDataFadec(base_ecu_bus output, int fadecIndex); void setLoggingFlightControlsEnabled(bool enabled); bool getLoggingFlightControlsEnabled(); @@ -305,9 +320,6 @@ class SimConnectInterface { private: enum ClientData { - AUTOPILOT_STATE_MACHINE, - AUTOPILOT_LAWS, - AUTOTHRUST, ELAC_DISCRETE_INPUTS, ELAC_ANALOG_INPUTS, ELAC_DISCRETE_OUTPUTS, @@ -326,6 +338,14 @@ class SimConnectInterface { FAC_ANALOG_OUTPUTS, FAC_1_BUS_OUTPUT, FAC_2_BUS_OUTPUT, + FCU_BUS_OUTPUT, + FMGC_DISCRETE_INPUTS, + FMGC_FMS_INPUTS, + FMGC_DISCRETE_OUTPUTS, + FMGC_1_BUS_A_OUTPUT, + FMGC_2_BUS_A_OUTPUT, + FMGC_1_BUS_B_OUTPUT, + FMGC_2_BUS_B_OUTPUT, ADR_1_INPUTS, ADR_2_INPUTS, ADR_3_INPUTS, @@ -338,10 +358,10 @@ class SimConnectInterface { LGCIU_2_BUS, SFCC_1_BUS, SFCC_2_BUS, - FMGC_1_B_BUS, - FMGC_2_B_BUS, - LOCAL_VARIABLES, - LOCAL_VARIABLES_AUTOTHRUST, + ILS_1_BUS, + ILS_2_BUS, + FADEC_1_BUS, + FADEC_2_BUS, }; bool isConnected = false; @@ -357,6 +377,8 @@ class SimConnectInterface { int elacDisabled = -1; int secDisabled = -1; int facDisabled = -1; + int fmgcDisabled = -1; + bool fcuDisabled = false; long pauseState = 0; @@ -369,17 +391,14 @@ class SimConnectInterface { static SimInput simInput; SimInputRudderTrim simInputRudderTrim = {}; SimInputAutopilot simInputAutopilot = {}; + base_fcu_afs_panel_inputs fcuAfsPanelInputs = {}; + base_fcu_efis_panel_inputs fcuEfisPanelInputs[2] = {}; SimInputThrottles simInputThrottles = {}; std::vector> throttleAxis; std::shared_ptr spoilersHandler; - ClientDataAutopilotStateMachine clientDataAutopilotStateMachine = {}; - ClientDataAutopilotLaws clientDataAutopilotLaws = {}; - ClientDataAutothrust clientDataAutothrust = {}; - ClientDataFlyByWire clientDataFlyByWire = {}; - base_elac_discrete_outputs clientDataElacDiscreteOutputs = {}; base_elac_analog_outputs clientDataElacAnalogOutputs = {}; base_elac_out_bus clientDataElacBusOutputs = {}; @@ -392,6 +411,12 @@ class SimConnectInterface { base_fac_analog_outputs clientDataFacAnalogOutputs = {}; base_fac_bus clientDataFacBusOutputs = {}; + base_fcu_bus clientDataFcuBusOutputs = {}; + + base_fmgc_discrete_outputs clientDataFmgcDiscreteOutputs = {}; + base_fmgc_a_bus clientDataFmgcABusOutputs = {}; + base_fmgc_b_bus clientDataFmgcBBusOutputs = {}; + // change to non-static when aileron events can be processed via SimConnect static double flightControlsKeyChangeAileron; double flightControlsKeyChangeElevator = 0.0; diff --git a/fbw-a32nx/src/wasm/fbw_a320/src/model/FcuComputer.cpp b/fbw-a32nx/src/wasm/fbw_a320/src/model/FcuComputer.cpp new file mode 100644 index 000000000000..c370726f2a33 --- /dev/null +++ b/fbw-a32nx/src/wasm/fbw_a320/src/model/FcuComputer.cpp @@ -0,0 +1,1339 @@ +#include "FcuComputer.h" +#include "rtwtypes.h" +#include "FcuComputer_types.h" +#include + +void FcuComputer::FcuComputer_MATLABFunction_Reset(rtDW_MATLABFunction_FcuComputer_T *localDW) +{ + localDW->previousInput = false; + localDW->remainingTriggerTime = 0.0; +} + +void FcuComputer::FcuComputer_MATLABFunction(boolean_T rtu_u, real_T rtu_Ts, boolean_T *rty_y, real_T rtp_isRisingEdge, + real_T rtp_retriggerable, real_T rtp_triggerDuration, rtDW_MATLABFunction_FcuComputer_T *localDW) +{ + if (localDW->remainingTriggerTime > 0.0) { + localDW->remainingTriggerTime -= rtu_Ts; + } else if (localDW->remainingTriggerTime < 0.0) { + localDW->remainingTriggerTime = 0.0; + } + + if (((rtp_retriggerable != 0.0) || (localDW->remainingTriggerTime == 0.0)) && (((rtp_isRisingEdge != 0.0) && rtu_u && + (!localDW->previousInput)) || ((rtp_isRisingEdge == 0.0) && (!rtu_u) && localDW->previousInput))) { + localDW->remainingTriggerTime = rtp_triggerDuration; + } + + localDW->previousInput = rtu_u; + *rty_y = (localDW->remainingTriggerTime > 0.0); +} + +void FcuComputer::FcuComputer_MATLABFunction_i(const base_arinc_429 *rtu_u, real32_T rtu_default, real32_T *rty_y) +{ + if (rtu_u->SSM == static_cast(SignStatusMatrix::NormalOperation)) { + *rty_y = rtu_u->Data; + } else { + *rty_y = rtu_default; + } +} + +void FcuComputer::FcuComputer_MATLABFunction1_Reset(rtDW_MATLABFunction1_FcuComputer_T *localDW) +{ + localDW->eventTime_not_empty = false; +} + +void FcuComputer::FcuComputer_MATLABFunction1(const fcu_outputs *rtu_in, boolean_T rtu_set_dashes, boolean_T + rtu_set_selection, boolean_T *rty_dashes, rtDW_MATLABFunction1_FcuComputer_T *localDW) +{ + if (!localDW->eventTime_not_empty) { + localDW->eventTime = rtu_in->data.time.simulation_time; + localDW->eventTime_not_empty = true; + } + + if (rtu_set_dashes) { + localDW->eventTime = (rtu_in->data.time.simulation_time - 10.0) - 1.0; + } else if (rtu_set_selection) { + localDW->eventTime = rtu_in->data.time.simulation_time; + } + + *rty_dashes = (rtu_in->data.time.simulation_time - localDW->eventTime > 10.0); +} + +void FcuComputer::FcuComputer_MATLABFunction_o_Reset(rtDW_MATLABFunction_FcuComputer_e_T *localDW) +{ + localDW->previousInput_not_empty = false; +} + +void FcuComputer::FcuComputer_MATLABFunction_d(boolean_T rtu_u, boolean_T rtu_isRisingEdge, boolean_T *rty_y, + rtDW_MATLABFunction_FcuComputer_e_T *localDW) +{ + if (!localDW->previousInput_not_empty) { + localDW->previousInput = rtu_isRisingEdge; + localDW->previousInput_not_empty = true; + } + + if (rtu_isRisingEdge) { + *rty_y = (rtu_u && (!localDW->previousInput)); + } else { + *rty_y = ((!rtu_u) && localDW->previousInput); + } + + localDW->previousInput = rtu_u; +} + +void FcuComputer::FcuComputer_MATLABFunction_m(const base_arinc_429 *rtu_u, boolean_T *rty_y) +{ + *rty_y = (rtu_u->SSM == static_cast(SignStatusMatrix::NormalOperation)); +} + +void FcuComputer::FcuComputer_MATLABFunction_a(const base_arinc_429 *rtu_u, real_T rtu_bit, uint32_T *rty_y) +{ + real32_T tmp; + uint32_T a; + tmp = std::round(rtu_u->Data); + if (tmp < 4.2949673E+9F) { + if (tmp >= 0.0F) { + a = static_cast(tmp); + } else { + a = 0U; + } + } else { + a = MAX_uint32_T; + } + + if (-(rtu_bit - 1.0) >= 0.0) { + if (-(rtu_bit - 1.0) <= 31.0) { + a <<= static_cast(-(rtu_bit - 1.0)); + } else { + a = 0U; + } + } else if (-(rtu_bit - 1.0) >= -31.0) { + a >>= static_cast(rtu_bit - 1.0); + } else { + a = 0U; + } + + *rty_y = a & 1U; +} + +void FcuComputer::FcuComputer_EFISFilterLogic_Reset(rtDW_EFISFilterLogic_FcuComputer_T *localDW) +{ + localDW->pEfisFilter = efis_filter_selection::NONE; +} + +void FcuComputer::FcuComputer_EFISFilterLogic(boolean_T rtu_cstr, boolean_T rtu_wpt, boolean_T rtu_vord, boolean_T + rtu_ndb, boolean_T rtu_arpt, efis_filter_selection *rty_efisFilter, rtDW_EFISFilterLogic_FcuComputer_T *localDW) +{ + if (((localDW->pEfisFilter == efis_filter_selection::CSTR) && rtu_cstr) || ((localDW->pEfisFilter == + efis_filter_selection::WPT) && rtu_wpt) || ((localDW->pEfisFilter == efis_filter_selection::VORD) && rtu_vord) || + ((localDW->pEfisFilter == efis_filter_selection::NDB) && rtu_ndb) || ((localDW->pEfisFilter == + efis_filter_selection::ARPT) && rtu_arpt)) { + localDW->pEfisFilter = efis_filter_selection::NONE; + } else if (rtu_cstr) { + localDW->pEfisFilter = efis_filter_selection::CSTR; + } else if (rtu_wpt) { + localDW->pEfisFilter = efis_filter_selection::WPT; + } else if (rtu_vord) { + localDW->pEfisFilter = efis_filter_selection::VORD; + } else if (rtu_ndb) { + localDW->pEfisFilter = efis_filter_selection::NDB; + } else if (rtu_arpt) { + localDW->pEfisFilter = efis_filter_selection::ARPT; + } + + *rty_efisFilter = localDW->pEfisFilter; +} + +void FcuComputer::FcuComputer_MATLABFunction_j_Init(rtDW_MATLABFunction_FcuComputer_b_T *localDW) +{ + localDW->qnh_active = true; +} + +void FcuComputer::FcuComputer_MATLABFunction_a_Reset(rtDW_MATLABFunction_FcuComputer_b_T *localDW) +{ + localDW->std_active = false; + localDW->qnh_active = true; + localDW->qfe_active = false; +} + +void FcuComputer::FcuComputer_MATLABFunction_p(boolean_T rtu_knob_push, boolean_T rtu_knob_pull, boolean_T *rty_std, + boolean_T *rty_qnh, boolean_T *rty_qfe, rtDW_MATLABFunction_FcuComputer_b_T *localDW) +{ + if (rtu_knob_push && localDW->std_active) { + localDW->std_active = false; + } else if (rtu_knob_push && (!localDW->std_active)) { + localDW->qnh_active = !localDW->qnh_active; + localDW->qfe_active = !localDW->qfe_active; + } else { + localDW->std_active = ((rtu_knob_pull && (!localDW->std_active)) || localDW->std_active); + } + + *rty_std = localDW->std_active; + *rty_qnh = localDW->qnh_active; + *rty_qfe = localDW->qfe_active; +} + +void FcuComputer::FcuComputer_MATLABFunction1_i_Init(rtDW_MATLABFunction1_FcuComputer_b_T *localDW) +{ + localDW->pValueHpa = 1013.0; + localDW->pValueInhg = 29.92; +} + +void FcuComputer::FcuComputer_MATLABFunction1_c_Reset(rtDW_MATLABFunction1_FcuComputer_b_T *localDW) +{ + localDW->pValueHpa = 1013.0; + localDW->pValueInhg = 29.92; +} + +void FcuComputer::FcuComputer_MATLABFunction1_h(boolean_T rtu_std_active, boolean_T rtu_inhg_active, real_T + rtu_click_count, real_T *rty_value_hpa, real_T *rty_value_inhg, rtDW_MATLABFunction1_FcuComputer_b_T *localDW) +{ + boolean_T tmp; + tmp = !rtu_std_active; + if (tmp && (!rtu_inhg_active)) { + localDW->pValueHpa = std::fmax(std::fmin(localDW->pValueHpa + rtu_click_count, 1100.0), 745.0); + localDW->pValueInhg = std::round(localDW->pValueHpa * 0.02953 * 100.0) / 100.0; + } else if (tmp && rtu_inhg_active) { + localDW->pValueInhg = std::fmax(std::fmin(rtu_click_count * 0.01 + localDW->pValueInhg, 32.48), 22.0); + localDW->pValueHpa = localDW->pValueInhg * 33.863867253640365; + localDW->pValueHpa = std::round(localDW->pValueHpa); + } + + *rty_value_hpa = localDW->pValueHpa; + *rty_value_inhg = localDW->pValueInhg; +} + +void FcuComputer::FcuComputer_MATLABFunction_i_Reset(rtDW_MATLABFunction_FcuComputer_l_T *localDW) +{ + localDW->pY_not_empty = false; +} + +void FcuComputer::FcuComputer_MATLABFunction_mb(boolean_T rtu_u, boolean_T *rty_y, boolean_T rtp_init, + rtDW_MATLABFunction_FcuComputer_l_T *localDW) +{ + if (!localDW->pY_not_empty) { + localDW->pY = rtp_init; + localDW->pY_not_empty = true; + } + + if (rtu_u) { + localDW->pY = !localDW->pY; + } + + *rty_y = localDW->pY; +} + +void FcuComputer::FcuComputer_MATLABFunction_e(const boolean_T rtu_u[19], real32_T *rty_y) +{ + uint32_T out; + out = 0U; + for (int32_T i{0}; i < 19; i++) { + out |= static_cast(rtu_u[i]) << (i + 10); + } + + *rty_y = static_cast(out); +} + +void FcuComputer::FcuComputer_MATLABFunction_n(const base_fcu_efis_logic_outputs *rtu_logic, const + base_fcu_efis_panel_inputs *rtu_data, int8_T *rty_baroValueMode, real32_T *rty_baroValue, int8_T *rty_baroMode) +{ + int8_T baroValueMode; + if (rtu_logic->baro_std) { + baroValueMode = 0; + } else if (!rtu_data->baro_is_inhg) { + baroValueMode = 1; + } else { + baroValueMode = 2; + } + + switch (baroValueMode) { + case 1: + *rty_baroValue = rtu_logic->baro_value_hpa; + break; + + case 2: + *rty_baroValue = rtu_logic->baro_value_inhg; + break; + + default: + *rty_baroValue = 0.0F; + break; + } + + if (rtu_logic->baro_std) { + *rty_baroMode = 0; + } else if (rtu_logic->baro_qnh) { + *rty_baroMode = 1; + } else { + *rty_baroMode = 2; + } + + *rty_baroValueMode = baroValueMode; +} + +void FcuComputer::step() +{ + const base_arinc_429 *rtb_Switch1_2; + const base_arinc_429 *rtb_Switch2_0; + const base_arinc_429 *rtb_Switch_fpa_deg; + const base_arinc_429 *rtb_Switch_heading_deg; + const base_arinc_429 *rtb_Switch_k_0; + const base_arinc_429 *rtb_Switch_track_deg; + const base_arinc_429 *rtb_Switch_vertical_speed_ft_min; + fcu_outputs rtb_BusAssignment_m; + real_T rtb_DataTypeConversion2; + real_T rtb_DataTypeConversion3; + real32_T rtb_y; + real32_T rtb_y_b; + real32_T rtb_y_cy; + real32_T rtb_y_f; + real32_T rtb_y_gu; + real32_T rtb_y_h; + real32_T rtb_y_m; + uint32_T rtb_Switch1_oa; + int8_T rtb_baroMode; + int8_T rtb_baroValueMode; + boolean_T rtb_VectorConcatenate[19]; + boolean_T rtb_DataTypeConversion_d; + boolean_T rtb_Equal6; + boolean_T rtb_Equal7; + boolean_T rtb_Equal8; + boolean_T rtb_Equal9; + boolean_T rtb_OR3_j; + boolean_T rtb_y_cp; + boolean_T rtb_y_e; + boolean_T rtb_y_l0; + efis_filter_selection rtb_efisFilter; + if (FcuComputer_U.in.sim_data.computer_running) { + real32_T rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_fo_efis_outputs_baro_value; + real32_T rtb_Switch4_b_Data; + real32_T rtb_Switch6_Data; + real32_T rtb_Switch7_Data; + real32_T rtb_capt_efis_outputs_baro_value; + uint32_T rtb_Switch4_b_SSM; + uint32_T rtb_Switch6_SSM; + uint32_T rtb_Switch7_SSM; + int8_T rtb_capt_efis_outputs_baro_mode; + int8_T rtb_capt_efis_outputs_baro_value_mode; + boolean_T rtb_AND1_l; + boolean_T rtb_AND2_m; + boolean_T rtb_AND_g; + boolean_T rtb_OR_o; + boolean_T rtb_fmgc1Priority; + if (!FcuComputer_DWork.Runtime_MODE) { + FcuComputer_DWork.DelayInput1_DSTATE[0] = FcuComputer_P.DetectChange_vinit; + FcuComputer_DWork.DelayInput1_DSTATE[1] = FcuComputer_P.DetectChange_vinit; + FcuComputer_DWork.DelayInput1_DSTATE[2] = FcuComputer_P.DetectChange_vinit; + FcuComputer_DWork.DelayInput1_DSTATE[3] = FcuComputer_P.DetectChange_vinit; + FcuComputer_DWork.Delay_DSTATE = FcuComputer_P.Delay_InitialCondition; + FcuComputer_MATLABFunction_o_Reset(&FcuComputer_DWork.sf_MATLABFunction_he); + FcuComputer_MATLABFunction_o_Reset(&FcuComputer_DWork.sf_MATLABFunction_nz); + FcuComputer_MATLABFunction_o_Reset(&FcuComputer_DWork.sf_MATLABFunction_id); + FcuComputer_MATLABFunction_o_Reset(&FcuComputer_DWork.sf_MATLABFunction_gb); + FcuComputer_MATLABFunction_o_Reset(&FcuComputer_DWork.sf_MATLABFunction_bpf); + FcuComputer_EFISFilterLogic_Reset(&FcuComputer_DWork.sf_EFISFilterLogic); + FcuComputer_MATLABFunction_o_Reset(&FcuComputer_DWork.sf_MATLABFunction_ik); + FcuComputer_MATLABFunction_i_Reset(&FcuComputer_DWork.sf_MATLABFunction_mb); + FcuComputer_MATLABFunction_o_Reset(&FcuComputer_DWork.sf_MATLABFunction_jr); + FcuComputer_MATLABFunction_i_Reset(&FcuComputer_DWork.sf_MATLABFunction_kc); + FcuComputer_MATLABFunction_o_Reset(&FcuComputer_DWork.sf_MATLABFunction_hc); + FcuComputer_MATLABFunction_o_Reset(&FcuComputer_DWork.sf_MATLABFunction_b3); + FcuComputer_MATLABFunction_a_Reset(&FcuComputer_DWork.sf_MATLABFunction_pr); + FcuComputer_MATLABFunction1_c_Reset(&FcuComputer_DWork.sf_MATLABFunction1_h); + FcuComputer_MATLABFunction_o_Reset(&FcuComputer_DWork.sf_MATLABFunction_fiq); + FcuComputer_MATLABFunction_o_Reset(&FcuComputer_DWork.sf_MATLABFunction_ec); + FcuComputer_MATLABFunction_o_Reset(&FcuComputer_DWork.sf_MATLABFunction_hlu); + FcuComputer_MATLABFunction_o_Reset(&FcuComputer_DWork.sf_MATLABFunction_df); + FcuComputer_MATLABFunction_o_Reset(&FcuComputer_DWork.sf_MATLABFunction_cb); + FcuComputer_EFISFilterLogic_Reset(&FcuComputer_DWork.sf_EFISFilterLogic_h); + FcuComputer_MATLABFunction_o_Reset(&FcuComputer_DWork.sf_MATLABFunction_ja0); + FcuComputer_MATLABFunction_i_Reset(&FcuComputer_DWork.sf_MATLABFunction_ja); + FcuComputer_MATLABFunction_o_Reset(&FcuComputer_DWork.sf_MATLABFunction_je); + FcuComputer_MATLABFunction_i_Reset(&FcuComputer_DWork.sf_MATLABFunction_hk); + FcuComputer_MATLABFunction_o_Reset(&FcuComputer_DWork.sf_MATLABFunction_ng); + FcuComputer_MATLABFunction_o_Reset(&FcuComputer_DWork.sf_MATLABFunction_gx); + FcuComputer_MATLABFunction_a_Reset(&FcuComputer_DWork.sf_MATLABFunction_jp); + FcuComputer_MATLABFunction1_c_Reset(&FcuComputer_DWork.sf_MATLABFunction1_e3); + FcuComputer_MATLABFunction_Reset(&FcuComputer_DWork.sf_MATLABFunction_e); + FcuComputer_MATLABFunction_Reset(&FcuComputer_DWork.sf_MATLABFunction_k); + FcuComputer_MATLABFunction_Reset(&FcuComputer_DWork.sf_MATLABFunction_n); + FcuComputer_MATLABFunction_Reset(&FcuComputer_DWork.sf_MATLABFunction_b); + FcuComputer_MATLABFunction_Reset(&FcuComputer_DWork.sf_MATLABFunction_l); + FcuComputer_MATLABFunction_Reset(&FcuComputer_DWork.sf_MATLABFunction_m); + FcuComputer_MATLABFunction_Reset(&FcuComputer_DWork.sf_MATLABFunction_kr); + FcuComputer_MATLABFunction_Reset(&FcuComputer_DWork.sf_MATLABFunction_f); + FcuComputer_MATLABFunction_Reset(&FcuComputer_DWork.sf_MATLABFunction_c); + FcuComputer_MATLABFunction_Reset(&FcuComputer_DWork.sf_MATLABFunction_a); + FcuComputer_MATLABFunction_Reset(&FcuComputer_DWork.sf_MATLABFunction_o); + FcuComputer_MATLABFunction_Reset(&FcuComputer_DWork.sf_MATLABFunction_kh); + FcuComputer_MATLABFunction_Reset(&FcuComputer_DWork.sf_MATLABFunction_d); + FcuComputer_MATLABFunction_Reset(&FcuComputer_DWork.sf_MATLABFunction_i); + FcuComputer_MATLABFunction_Reset(&FcuComputer_DWork.sf_MATLABFunction_k0); + FcuComputer_MATLABFunction_Reset(&FcuComputer_DWork.sf_MATLABFunction_g); + FcuComputer_MATLABFunction_o_Reset(&FcuComputer_DWork.sf_MATLABFunction_a4); + FcuComputer_DWork.p_trk_fpa_active = false; + FcuComputer_MATLABFunction_o_Reset(&FcuComputer_DWork.sf_MATLABFunction_ma); + FcuComputer_DWork.p_metric_alt_active = false; + FcuComputer_MATLABFunction_o_Reset(&FcuComputer_DWork.sf_MATLABFunction_kl); + FcuComputer_MATLABFunction1_Reset(&FcuComputer_DWork.sf_MATLABFunction1_p); + FcuComputer_DWork.pValue_not_empty_i = false; + FcuComputer_DWork.prevMachActive = false; + FcuComputer_MATLABFunction_o_Reset(&FcuComputer_DWork.sf_MATLABFunction_dc); + FcuComputer_MATLABFunction1_Reset(&FcuComputer_DWork.sf_MATLABFunction1); + FcuComputer_DWork.pValue_not_empty_o = false; + FcuComputer_DWork.prevTrkFpaActive_not_empty_l = false; + FcuComputer_DWork.pValue_not_empty_g = false; + FcuComputer_MATLABFunction_o_Reset(&FcuComputer_DWork.sf_MATLABFunction_kw); + FcuComputer_MATLABFunction1_Reset(&FcuComputer_DWork.sf_MATLABFunction1_o); + FcuComputer_MATLABFunction_o_Reset(&FcuComputer_DWork.sf_MATLABFunction_ch); + FcuComputer_DWork.pValue_not_empty = false; + FcuComputer_DWork.prevTrkFpaActive_not_empty = false; + FcuComputer_MATLABFunction_Reset(&FcuComputer_DWork.sf_MATLABFunction_av); + FcuComputer_MATLABFunction_Reset(&FcuComputer_DWork.sf_MATLABFunction_p5r); + FcuComputer_MATLABFunction_Reset(&FcuComputer_DWork.sf_MATLABFunction_lh); + FcuComputer_MATLABFunction_Reset(&FcuComputer_DWork.sf_MATLABFunction_oi); + FcuComputer_DWork.Runtime_MODE = true; + } + + FcuComputer_MATLABFunction_d(FcuComputer_U.in.discrete_inputs.capt_efis_inputs.cstr_button_pushed, + FcuComputer_P.PulseNode_isRisingEdge, &rtb_Equal9, &FcuComputer_DWork.sf_MATLABFunction_he); + FcuComputer_MATLABFunction_d(FcuComputer_U.in.discrete_inputs.capt_efis_inputs.wpt_button_pushed, + FcuComputer_P.PulseNode1_isRisingEdge, &rtb_Equal8, &FcuComputer_DWork.sf_MATLABFunction_nz); + FcuComputer_MATLABFunction_d(FcuComputer_U.in.discrete_inputs.capt_efis_inputs.vord_button_pushed, + FcuComputer_P.PulseNode2_isRisingEdge, &rtb_Equal7, &FcuComputer_DWork.sf_MATLABFunction_id); + FcuComputer_MATLABFunction_d(FcuComputer_U.in.discrete_inputs.capt_efis_inputs.ndb_button_pushed, + FcuComputer_P.PulseNode3_isRisingEdge, &rtb_Equal6, &FcuComputer_DWork.sf_MATLABFunction_gb); + FcuComputer_MATLABFunction_d(FcuComputer_U.in.discrete_inputs.capt_efis_inputs.arpt_button_pushed, + FcuComputer_P.PulseNode4_isRisingEdge, &rtb_OR3_j, &FcuComputer_DWork.sf_MATLABFunction_bpf); + FcuComputer_EFISFilterLogic(rtb_Equal9, rtb_Equal8, rtb_Equal7, rtb_Equal6, rtb_OR3_j, &rtb_efisFilter, + &FcuComputer_DWork.sf_EFISFilterLogic); + FcuComputer_MATLABFunction_d(FcuComputer_U.in.discrete_inputs.capt_efis_inputs.fd_button_pushed, + FcuComputer_P.PulseNode_isRisingEdge_n, &rtb_OR3_j, &FcuComputer_DWork.sf_MATLABFunction_ik); + FcuComputer_MATLABFunction_mb(rtb_OR3_j, &rtb_Equal7, FcuComputer_P.TFlipFlop_init, + &FcuComputer_DWork.sf_MATLABFunction_mb); + FcuComputer_MATLABFunction_d(FcuComputer_U.in.discrete_inputs.capt_efis_inputs.ls_button_pushed, + FcuComputer_P.PulseNode_isRisingEdge_nj, &rtb_OR3_j, &FcuComputer_DWork.sf_MATLABFunction_jr); + FcuComputer_MATLABFunction_mb(rtb_OR3_j, &rtb_Equal6, FcuComputer_P.TFlipFlop1_init, + &FcuComputer_DWork.sf_MATLABFunction_kc); + FcuComputer_MATLABFunction_d(FcuComputer_U.in.discrete_inputs.capt_efis_inputs.baro_knob.pushed, + FcuComputer_P.PulseNode_isRisingEdge_a, &rtb_Equal8, &FcuComputer_DWork.sf_MATLABFunction_hc); + FcuComputer_MATLABFunction_d(FcuComputer_U.in.discrete_inputs.capt_efis_inputs.baro_knob.pulled, + FcuComputer_P.PulseNode1_isRisingEdge_h, &rtb_OR3_j, &FcuComputer_DWork.sf_MATLABFunction_b3); + FcuComputer_MATLABFunction_p(rtb_Equal8, rtb_OR3_j, &rtb_Equal9, &rtb_DataTypeConversion_d, &rtb_y_e, + &FcuComputer_DWork.sf_MATLABFunction_pr); + FcuComputer_MATLABFunction1_h(rtb_Equal9, FcuComputer_U.in.discrete_inputs.capt_efis_inputs.baro_is_inhg, + static_cast(FcuComputer_U.in.discrete_inputs.capt_efis_inputs.baro_knob.turns), &rtb_DataTypeConversion3, + &rtb_DataTypeConversion2, &FcuComputer_DWork.sf_MATLABFunction1_h); + rtb_BusAssignment_m.logic.capt_efis.efis_filter = rtb_efisFilter; + rtb_BusAssignment_m.logic.capt_efis.fd_on = rtb_Equal7; + rtb_BusAssignment_m.logic.capt_efis.ls_on = rtb_Equal6; + rtb_BusAssignment_m.logic.capt_efis.baro_std = rtb_Equal9; + rtb_BusAssignment_m.logic.capt_efis.baro_qnh = rtb_DataTypeConversion_d; + rtb_BusAssignment_m.logic.capt_efis.baro_qfe = rtb_y_e; + rtb_BusAssignment_m.logic.capt_efis.baro_value_hpa = static_cast(rtb_DataTypeConversion3); + rtb_BusAssignment_m.logic.capt_efis.baro_value_inhg = static_cast(rtb_DataTypeConversion2); + FcuComputer_MATLABFunction_d(FcuComputer_U.in.discrete_inputs.fo_efis_inputs.cstr_button_pushed, + FcuComputer_P.PulseNode_isRisingEdge_m, &rtb_Equal9, &FcuComputer_DWork.sf_MATLABFunction_fiq); + FcuComputer_MATLABFunction_d(FcuComputer_U.in.discrete_inputs.fo_efis_inputs.wpt_button_pushed, + FcuComputer_P.PulseNode1_isRisingEdge_k, &rtb_Equal8, &FcuComputer_DWork.sf_MATLABFunction_ec); + FcuComputer_MATLABFunction_d(FcuComputer_U.in.discrete_inputs.fo_efis_inputs.vord_button_pushed, + FcuComputer_P.PulseNode2_isRisingEdge_a, &rtb_Equal7, &FcuComputer_DWork.sf_MATLABFunction_hlu); + FcuComputer_MATLABFunction_d(FcuComputer_U.in.discrete_inputs.fo_efis_inputs.ndb_button_pushed, + FcuComputer_P.PulseNode3_isRisingEdge_g, &rtb_Equal6, &FcuComputer_DWork.sf_MATLABFunction_df); + FcuComputer_MATLABFunction_d(FcuComputer_U.in.discrete_inputs.fo_efis_inputs.arpt_button_pushed, + FcuComputer_P.PulseNode4_isRisingEdge_a, &rtb_OR3_j, &FcuComputer_DWork.sf_MATLABFunction_cb); + FcuComputer_EFISFilterLogic(rtb_Equal9, rtb_Equal8, rtb_Equal7, rtb_Equal6, rtb_OR3_j, &rtb_efisFilter, + &FcuComputer_DWork.sf_EFISFilterLogic_h); + FcuComputer_MATLABFunction_d(FcuComputer_U.in.discrete_inputs.fo_efis_inputs.fd_button_pushed, + FcuComputer_P.PulseNode_isRisingEdge_i, &rtb_OR3_j, &FcuComputer_DWork.sf_MATLABFunction_ja0); + FcuComputer_MATLABFunction_mb(rtb_OR3_j, &rtb_Equal7, FcuComputer_P.TFlipFlop_init_f, + &FcuComputer_DWork.sf_MATLABFunction_ja); + FcuComputer_MATLABFunction_d(FcuComputer_U.in.discrete_inputs.fo_efis_inputs.ls_button_pushed, + FcuComputer_P.PulseNode_isRisingEdge_h, &rtb_OR3_j, &FcuComputer_DWork.sf_MATLABFunction_je); + FcuComputer_MATLABFunction_mb(rtb_OR3_j, &rtb_Equal6, FcuComputer_P.TFlipFlop1_init_a, + &FcuComputer_DWork.sf_MATLABFunction_hk); + FcuComputer_MATLABFunction_d(FcuComputer_U.in.discrete_inputs.fo_efis_inputs.baro_knob.pushed, + FcuComputer_P.PulseNode_isRisingEdge_o, &rtb_Equal8, &FcuComputer_DWork.sf_MATLABFunction_ng); + FcuComputer_MATLABFunction_d(FcuComputer_U.in.discrete_inputs.fo_efis_inputs.baro_knob.pulled, + FcuComputer_P.PulseNode1_isRisingEdge_f, &rtb_OR3_j, &FcuComputer_DWork.sf_MATLABFunction_gx); + FcuComputer_MATLABFunction_p(rtb_Equal8, rtb_OR3_j, &rtb_Equal9, &rtb_DataTypeConversion_d, &rtb_y_e, + &FcuComputer_DWork.sf_MATLABFunction_jp); + FcuComputer_MATLABFunction1_h(rtb_Equal9, FcuComputer_U.in.discrete_inputs.fo_efis_inputs.baro_is_inhg, static_cast< + real_T>(FcuComputer_U.in.discrete_inputs.fo_efis_inputs.baro_knob.turns), &rtb_DataTypeConversion3, + &rtb_DataTypeConversion2, &FcuComputer_DWork.sf_MATLABFunction1_e3); + rtb_y_b = static_cast(rtb_DataTypeConversion3); + rtb_y_cy = static_cast(rtb_DataTypeConversion2); + rtb_fmgc1Priority = !FcuComputer_U.in.discrete_inputs.ap_2_engaged; + rtb_fmgc1Priority = (FcuComputer_U.in.discrete_inputs.ap_1_engaged || (rtb_fmgc1Priority && + FcuComputer_U.in.discrete_inputs.fd_1_engaged) || (rtb_fmgc1Priority && + (!FcuComputer_U.in.discrete_inputs.fd_2_engaged) && FcuComputer_U.in.discrete_inputs.athr_1_engaged)); + if (rtb_fmgc1Priority) { + rtb_Switch_k_0 = &FcuComputer_U.in.bus_inputs.fmgc_1_bus.altitude_ft; + rtb_Switch1_2 = &FcuComputer_U.in.bus_inputs.fmgc_1_bus.mach; + rtb_Switch2_0 = &FcuComputer_U.in.bus_inputs.fmgc_1_bus.cas_kts; + rtb_Switch_track_deg = &FcuComputer_U.in.bus_inputs.fmgc_1_bus.track_deg; + rtb_Switch_heading_deg = &FcuComputer_U.in.bus_inputs.fmgc_1_bus.heading_deg; + rtb_Switch_fpa_deg = &FcuComputer_U.in.bus_inputs.fmgc_1_bus.fpa_deg; + rtb_Switch_vertical_speed_ft_min = &FcuComputer_U.in.bus_inputs.fmgc_1_bus.vertical_speed_ft_min; + } else { + rtb_Switch_k_0 = &FcuComputer_U.in.bus_inputs.fmgc_2_bus.altitude_ft; + rtb_Switch1_2 = &FcuComputer_U.in.bus_inputs.fmgc_2_bus.mach; + rtb_Switch2_0 = &FcuComputer_U.in.bus_inputs.fmgc_2_bus.cas_kts; + rtb_Switch_track_deg = &FcuComputer_U.in.bus_inputs.fmgc_2_bus.track_deg; + rtb_Switch_heading_deg = &FcuComputer_U.in.bus_inputs.fmgc_2_bus.heading_deg; + rtb_Switch_fpa_deg = &FcuComputer_U.in.bus_inputs.fmgc_2_bus.fpa_deg; + rtb_Switch_vertical_speed_ft_min = &FcuComputer_U.in.bus_inputs.fmgc_2_bus.vertical_speed_ft_min; + } + + FcuComputer_MATLABFunction_i(rtb_Switch2_0, FcuComputer_P.A429ValueOrDefault_defaultValue, &rtb_y); + FcuComputer_MATLABFunction_i(rtb_Switch1_2, FcuComputer_P.A429ValueOrDefault1_defaultValue, &rtb_y_cy); + FcuComputer_MATLABFunction_i(rtb_Switch_heading_deg, FcuComputer_P.A429ValueOrDefault2_defaultValue, &rtb_y_b); + FcuComputer_MATLABFunction_i(rtb_Switch_track_deg, FcuComputer_P.A429ValueOrDefault3_defaultValue, &rtb_y_h); + FcuComputer_MATLABFunction_i(rtb_Switch_k_0, FcuComputer_P.A429ValueOrDefault4_defaultValue, &rtb_y_m); + FcuComputer_MATLABFunction_i(rtb_Switch_vertical_speed_ft_min, FcuComputer_P.A429ValueOrDefault5_defaultValue, + &rtb_y_gu); + FcuComputer_MATLABFunction_i(rtb_Switch_fpa_deg, FcuComputer_P.A429ValueOrDefault6_defaultValue, &rtb_y_f); + rtb_BusAssignment_m.logic.fo_efis.ls_on = rtb_Equal6; + FcuComputer_MATLABFunction(FcuComputer_U.in.discrete_inputs.afs_inputs.hdg_trk_knob.pushed, FcuComputer_U.in.time.dt, + &rtb_OR3_j, FcuComputer_P.MTrigNode_isRisingEdge, FcuComputer_P.MTrigNode_retriggerable, + FcuComputer_P.KnobMtrigProcessing_triggerDuration, &FcuComputer_DWork.sf_MATLABFunction_e); + FcuComputer_MATLABFunction(FcuComputer_U.in.discrete_inputs.afs_inputs.hdg_trk_knob.pulled, FcuComputer_U.in.time.dt, + &rtb_y_l0, FcuComputer_P.MTrigNode1_isRisingEdge, FcuComputer_P.MTrigNode1_retriggerable, + FcuComputer_P.KnobMtrigProcessing_triggerDuration, &FcuComputer_DWork.sf_MATLABFunction_k); + FcuComputer_MATLABFunction(FcuComputer_U.in.discrete_inputs.afs_inputs.hdg_trk_knob.turns != + FcuComputer_P.CompareToConstant_const, FcuComputer_U.in.time.dt, &rtb_y_cp, FcuComputer_P.MTrigNode2_isRisingEdge, + FcuComputer_P.MTrigNode2_retriggerable, FcuComputer_P.KnobMtrigProcessing_triggerDuration, + &FcuComputer_DWork.sf_MATLABFunction_n); + rtb_BusAssignment_m.logic.afs.hdg_trk_buttons.pushed = rtb_OR3_j; + rtb_BusAssignment_m.logic.afs.hdg_trk_buttons.pulled = rtb_y_l0; + rtb_BusAssignment_m.logic.afs.hdg_trk_buttons.turns = static_cast(rtb_y_cp); + FcuComputer_MATLABFunction(FcuComputer_U.in.discrete_inputs.afs_inputs.spd_knob.pushed, FcuComputer_U.in.time.dt, + &rtb_OR3_j, FcuComputer_P.MTrigNode_isRisingEdge_a, FcuComputer_P.MTrigNode_retriggerable_f, + FcuComputer_P.KnobMtrigProcessing1_triggerDuration, &FcuComputer_DWork.sf_MATLABFunction_b); + FcuComputer_MATLABFunction(FcuComputer_U.in.discrete_inputs.afs_inputs.spd_knob.pulled, FcuComputer_U.in.time.dt, + &rtb_y_l0, FcuComputer_P.MTrigNode1_isRisingEdge_j, FcuComputer_P.MTrigNode1_retriggerable_d, + FcuComputer_P.KnobMtrigProcessing1_triggerDuration, &FcuComputer_DWork.sf_MATLABFunction_l); + FcuComputer_MATLABFunction(FcuComputer_U.in.discrete_inputs.afs_inputs.spd_knob.turns != + FcuComputer_P.CompareToConstant_const_p, FcuComputer_U.in.time.dt, &rtb_y_cp, + FcuComputer_P.MTrigNode2_isRisingEdge_j, FcuComputer_P.MTrigNode2_retriggerable_i, + FcuComputer_P.KnobMtrigProcessing1_triggerDuration, &FcuComputer_DWork.sf_MATLABFunction_m); + rtb_BusAssignment_m.logic.afs.spd_mach_buttons.pushed = rtb_OR3_j; + rtb_BusAssignment_m.logic.afs.spd_mach_buttons.pulled = rtb_y_l0; + rtb_BusAssignment_m.logic.afs.spd_mach_buttons.turns = static_cast(rtb_y_cp); + FcuComputer_MATLABFunction(FcuComputer_U.in.discrete_inputs.afs_inputs.alt_knob.pushed, FcuComputer_U.in.time.dt, + &rtb_OR3_j, FcuComputer_P.MTrigNode_isRisingEdge_k, FcuComputer_P.MTrigNode_retriggerable_h, + FcuComputer_P.KnobMtrigProcessing2_triggerDuration, &FcuComputer_DWork.sf_MATLABFunction_kr); + FcuComputer_MATLABFunction(FcuComputer_U.in.discrete_inputs.afs_inputs.alt_knob.pulled, FcuComputer_U.in.time.dt, + &rtb_y_l0, FcuComputer_P.MTrigNode1_isRisingEdge_o, FcuComputer_P.MTrigNode1_retriggerable_j, + FcuComputer_P.KnobMtrigProcessing2_triggerDuration, &FcuComputer_DWork.sf_MATLABFunction_f); + FcuComputer_MATLABFunction(FcuComputer_U.in.discrete_inputs.afs_inputs.alt_knob.turns != + FcuComputer_P.CompareToConstant_const_pg, FcuComputer_U.in.time.dt, &rtb_y_cp, + FcuComputer_P.MTrigNode2_isRisingEdge_h, FcuComputer_P.MTrigNode2_retriggerable_h, + FcuComputer_P.KnobMtrigProcessing2_triggerDuration, &FcuComputer_DWork.sf_MATLABFunction_c); + rtb_BusAssignment_m.logic.afs.alt_buttons.pushed = rtb_OR3_j; + rtb_BusAssignment_m.logic.afs.alt_buttons.pulled = rtb_y_l0; + rtb_BusAssignment_m.logic.afs.alt_buttons.turns = static_cast(rtb_y_cp); + FcuComputer_MATLABFunction(FcuComputer_U.in.discrete_inputs.afs_inputs.vs_fpa_knob.pushed, FcuComputer_U.in.time.dt, + &rtb_OR3_j, FcuComputer_P.MTrigNode_isRisingEdge_d, FcuComputer_P.MTrigNode_retriggerable_g, + FcuComputer_P.KnobMtrigProcessing3_triggerDuration, &FcuComputer_DWork.sf_MATLABFunction_a); + FcuComputer_MATLABFunction(FcuComputer_U.in.discrete_inputs.afs_inputs.vs_fpa_knob.pulled, FcuComputer_U.in.time.dt, + &rtb_y_l0, FcuComputer_P.MTrigNode1_isRisingEdge_c, FcuComputer_P.MTrigNode1_retriggerable_l, + FcuComputer_P.KnobMtrigProcessing3_triggerDuration, &FcuComputer_DWork.sf_MATLABFunction_o); + FcuComputer_MATLABFunction(FcuComputer_U.in.discrete_inputs.afs_inputs.vs_fpa_knob.turns != + FcuComputer_P.CompareToConstant_const_e, FcuComputer_U.in.time.dt, &rtb_y_cp, + FcuComputer_P.MTrigNode2_isRisingEdge_hx, FcuComputer_P.MTrigNode2_retriggerable_g, + FcuComputer_P.KnobMtrigProcessing3_triggerDuration, &FcuComputer_DWork.sf_MATLABFunction_kh); + rtb_baroValueMode = static_cast(rtb_y_cp); + rtb_BusAssignment_m.logic.afs.vs_fpa_buttons.pushed = rtb_OR3_j; + rtb_BusAssignment_m.logic.afs.vs_fpa_buttons.pulled = rtb_y_l0; + FcuComputer_MATLABFunction(FcuComputer_U.in.discrete_inputs.afs_inputs.loc_button_pressed, FcuComputer_U.in.time.dt, + &rtb_Equal6, FcuComputer_P.MTrigNode_isRisingEdge_c, FcuComputer_P.MTrigNode_retriggerable_i, + FcuComputer_P.MTrigNode_triggerDuration, &FcuComputer_DWork.sf_MATLABFunction_d); + FcuComputer_MATLABFunction(FcuComputer_U.in.discrete_inputs.afs_inputs.exped_button_pressed, + FcuComputer_U.in.time.dt, &rtb_OR3_j, FcuComputer_P.MTrigNode1_isRisingEdge_a, + FcuComputer_P.MTrigNode1_retriggerable_ls, FcuComputer_P.MTrigNode1_triggerDuration, + &FcuComputer_DWork.sf_MATLABFunction_i); + FcuComputer_MATLABFunction(FcuComputer_U.in.discrete_inputs.afs_inputs.appr_button_pressed, FcuComputer_U.in.time.dt, + &rtb_y_l0, FcuComputer_P.MTrigNode2_isRisingEdge_p, FcuComputer_P.MTrigNode2_retriggerable_c, + FcuComputer_P.MTrigNode2_triggerDuration, &FcuComputer_DWork.sf_MATLABFunction_k0); + FcuComputer_MATLABFunction(FcuComputer_U.in.discrete_inputs.afs_inputs.spd_mach_button_pressed, + FcuComputer_U.in.time.dt, &rtb_y_cp, FcuComputer_P.MTrigNode3_isRisingEdge, FcuComputer_P.MTrigNode3_retriggerable, + FcuComputer_P.MTrigNode3_triggerDuration, &FcuComputer_DWork.sf_MATLABFunction_g); + rtb_BusAssignment_m.logic.afs.exped_pushed = rtb_OR3_j; + FcuComputer_MATLABFunction_d(FcuComputer_U.in.discrete_inputs.afs_inputs.trk_fpa_button_pressed, + FcuComputer_P.PulseNode_isRisingEdge_oa, &rtb_OR3_j, &FcuComputer_DWork.sf_MATLABFunction_a4); + if (rtb_OR3_j) { + FcuComputer_DWork.p_trk_fpa_active = !FcuComputer_DWork.p_trk_fpa_active; + } + + FcuComputer_MATLABFunction_d(FcuComputer_U.in.discrete_inputs.afs_inputs.metric_alt_button_pressed, + FcuComputer_P.PulseNode1_isRisingEdge_ke, &rtb_OR3_j, &FcuComputer_DWork.sf_MATLABFunction_ma); + if (rtb_OR3_j) { + FcuComputer_DWork.p_metric_alt_active = !FcuComputer_DWork.p_metric_alt_active; + } + + rtb_BusAssignment_m.logic.afs.loc_pushed = rtb_Equal6; + rtb_BusAssignment_m.logic.afs.appr_pushed = rtb_y_l0; + rtb_BusAssignment_m.logic.afs.spd_mach_switching_pushed = rtb_y_cp; + rtb_BusAssignment_m.logic.fo_efis.fd_on = rtb_Equal7; + rtb_BusAssignment_m.logic.fo_efis.baro_std = rtb_Equal9; + rtb_BusAssignment_m.logic.fo_efis.baro_qnh = rtb_DataTypeConversion_d; + rtb_BusAssignment_m.logic.fo_efis.baro_qfe = rtb_y_e; + if (rtb_fmgc1Priority) { + rtb_Switch_k_0 = &FcuComputer_U.in.bus_inputs.fmgc_1_bus.discrete_word_5; + } else { + rtb_Switch_k_0 = &FcuComputer_U.in.bus_inputs.fmgc_2_bus.discrete_word_5; + } + + FcuComputer_MATLABFunction_a(rtb_Switch_k_0, FcuComputer_P.BitfromLabel_bit, &rtb_Switch1_oa); + FcuComputer_MATLABFunction_m(rtb_Switch_k_0, &rtb_y_cp); + rtb_AND_g = ((rtb_Switch1_oa != 0U) && rtb_y_cp); + FcuComputer_MATLABFunction_a(rtb_Switch_k_0, FcuComputer_P.BitfromLabel1_bit, &rtb_Switch1_oa); + rtb_AND1_l = (rtb_y_cp && (rtb_Switch1_oa != 0U)); + if (rtb_fmgc1Priority) { + rtb_Switch1_2 = &FcuComputer_U.in.bus_inputs.fmgc_1_bus.discrete_word_3; + } else { + rtb_Switch1_2 = &FcuComputer_U.in.bus_inputs.fmgc_2_bus.discrete_word_3; + } + + FcuComputer_MATLABFunction_a(rtb_Switch1_2, FcuComputer_P.BitfromLabel4_bit, &rtb_Switch1_oa); + rtb_Equal7 = (rtb_Switch1_oa != 0U); + FcuComputer_MATLABFunction_a(rtb_Switch1_2, FcuComputer_P.BitfromLabel3_bit, &rtb_Switch1_oa); + FcuComputer_MATLABFunction_m(rtb_Switch1_2, &rtb_y_cp); + rtb_OR3_j = ((rtb_Equal7 || (rtb_Switch1_oa != 0U)) && rtb_y_cp); + if (rtb_fmgc1Priority) { + rtb_Switch2_0 = &FcuComputer_U.in.bus_inputs.fmgc_1_bus.discrete_word_2; + } else { + rtb_Switch2_0 = &FcuComputer_U.in.bus_inputs.fmgc_2_bus.discrete_word_2; + } + + FcuComputer_MATLABFunction_a(rtb_Switch2_0, FcuComputer_P.BitfromLabel6_bit, &rtb_Switch1_oa); + rtb_y_e = (rtb_Switch1_oa != 0U); + FcuComputer_MATLABFunction_a(rtb_Switch2_0, FcuComputer_P.BitfromLabel5_bit, &rtb_Switch1_oa); + rtb_Equal7 = (rtb_Switch1_oa != 0U); + FcuComputer_MATLABFunction_a(rtb_Switch2_0, FcuComputer_P.BitfromLabel8_bit, &rtb_Switch1_oa); + rtb_DataTypeConversion_d = (rtb_Switch1_oa != 0U); + FcuComputer_MATLABFunction_a(rtb_Switch2_0, FcuComputer_P.BitfromLabel7_bit, &rtb_Switch1_oa); + rtb_Equal9 = (rtb_Switch1_oa != 0U); + FcuComputer_MATLABFunction_a(rtb_Switch2_0, FcuComputer_P.BitfromLabel9_bit, &rtb_Switch1_oa); + rtb_Equal8 = (rtb_Switch1_oa != 0U); + if (rtb_fmgc1Priority) { + rtb_Switch_k_0 = &FcuComputer_U.in.bus_inputs.fmgc_1_bus.discrete_word_4; + } else { + rtb_Switch_k_0 = &FcuComputer_U.in.bus_inputs.fmgc_2_bus.discrete_word_4; + } + + FcuComputer_MATLABFunction_a(rtb_Switch_k_0, FcuComputer_P.BitfromLabel10_bit, &rtb_Switch1_oa); + FcuComputer_MATLABFunction_m(rtb_Switch2_0, &rtb_y_l0); + rtb_Equal9 = ((rtb_y_e || rtb_Equal7 || rtb_DataTypeConversion_d || rtb_Equal9 || rtb_Equal8 || (rtb_Switch1_oa != + 0U)) && rtb_y_l0); + FcuComputer_MATLABFunction_a(rtb_Switch2_0, FcuComputer_P.BitfromLabel2_bit, &rtb_Switch1_oa); + rtb_Equal8 = (rtb_Switch1_oa != 0U); + FcuComputer_MATLABFunction_a(rtb_Switch2_0, FcuComputer_P.BitfromLabel1_bit_l, &rtb_Switch1_oa); + rtb_BusAssignment_m.logic.afs.hdg_trk_selected = (rtb_y_l0 && (rtb_Equal8 || (rtb_Switch1_oa != 0U))); + FcuComputer_MATLABFunction_m(rtb_Switch1_2, &rtb_y_cp); + FcuComputer_MATLABFunction_a(rtb_Switch1_2, FcuComputer_P.BitfromLabel2_bit_l, &rtb_Switch1_oa); + rtb_BusAssignment_m.logic.afs.hdg_trk_preset_available = (rtb_y_cp && (rtb_Switch1_oa != 0U)); + FcuComputer_MATLABFunction_a(rtb_Switch1_2, FcuComputer_P.BitfromLabel12_bit, &rtb_Switch1_oa); + rtb_DataTypeConversion_d = (rtb_Switch1_oa != 0U); + FcuComputer_MATLABFunction_a(rtb_Switch1_2, FcuComputer_P.BitfromLabel11_bit, &rtb_Switch1_oa); + rtb_y_e = (rtb_Switch1_oa != 0U); + FcuComputer_MATLABFunction_a(rtb_Switch1_2, FcuComputer_P.BitfromLabel4_bit_n, &rtb_Switch1_oa); + rtb_Equal7 = (rtb_Switch1_oa != 0U); + FcuComputer_MATLABFunction_a(rtb_Switch1_2, FcuComputer_P.BitfromLabel3_bit_p, &rtb_Switch1_oa); + FcuComputer_MATLABFunction_m(rtb_Switch1_2, &rtb_y_l0); + rtb_AND2_m = ((rtb_DataTypeConversion_d || rtb_y_e || rtb_Equal7 || (rtb_Switch1_oa != 0U)) && rtb_y_l0); + if (rtb_fmgc1Priority) { + rtb_Switch1_2 = &FcuComputer_U.in.bus_inputs.fmgc_1_bus.fm_alt_constraint_ft; + } else { + rtb_Switch1_2 = &FcuComputer_U.in.bus_inputs.fmgc_2_bus.fm_alt_constraint_ft; + } + + FcuComputer_MATLABFunction_m(rtb_Switch1_2, &rtb_y_cp); + if (rtb_fmgc1Priority) { + rtb_Switch1_2 = &FcuComputer_U.in.bus_inputs.fmgc_1_bus.discrete_word_1; + } else { + rtb_Switch1_2 = &FcuComputer_U.in.bus_inputs.fmgc_2_bus.discrete_word_1; + } + + FcuComputer_MATLABFunction_a(rtb_Switch1_2, FcuComputer_P.BitfromLabel17_bit, &rtb_Switch1_oa); + rtb_Equal8 = (rtb_y_cp && (rtb_Switch1_oa != 0U)); + FcuComputer_MATLABFunction_a(rtb_Switch1_2, FcuComputer_P.BitfromLabel16_bit, &rtb_Switch1_oa); + rtb_Equal6 = (rtb_Switch1_oa != 0U); + FcuComputer_MATLABFunction_a(rtb_Switch1_2, FcuComputer_P.BitfromLabel15_bit, &rtb_Switch1_oa); + rtb_y_l0 = (rtb_Equal6 || (rtb_Switch1_oa != 0U)); + FcuComputer_MATLABFunction_a(rtb_Switch1_2, FcuComputer_P.BitfromLabel14_bit, &rtb_Switch1_oa); + rtb_Equal6 = (rtb_Switch1_oa != 0U); + FcuComputer_MATLABFunction_a(rtb_Switch1_2, FcuComputer_P.BitfromLabel13_bit, &rtb_Switch1_oa); + rtb_DataTypeConversion_d = (rtb_Switch1_oa != 0U); + FcuComputer_MATLABFunction_a(rtb_Switch1_2, FcuComputer_P.BitfromLabel9_bit_i, &rtb_Switch1_oa); + rtb_y_cp = ((!rtb_Equal6) && (!rtb_DataTypeConversion_d) && (rtb_Switch1_oa == 0U)); + FcuComputer_MATLABFunction_a(rtb_Switch1_2, FcuComputer_P.BitfromLabel6_bit_n, &rtb_Switch1_oa); + rtb_Equal6 = (rtb_Switch1_oa != 0U); + FcuComputer_MATLABFunction_a(rtb_Switch1_2, FcuComputer_P.BitfromLabel5_bit_f, &rtb_Switch1_oa); + rtb_DataTypeConversion_d = (rtb_Switch1_oa != 0U); + FcuComputer_MATLABFunction_a(rtb_Switch1_2, FcuComputer_P.BitfromLabel8_bit_h, &rtb_Switch1_oa); + rtb_y_e = (rtb_Switch1_oa != 0U); + FcuComputer_MATLABFunction_a(rtb_Switch1_2, FcuComputer_P.BitfromLabel7_bit_j, &rtb_Switch1_oa); + rtb_Equal7 = (rtb_Switch1_oa != 0U); + FcuComputer_MATLABFunction_a(rtb_Switch_k_0, FcuComputer_P.BitfromLabel10_bit_c, &rtb_Switch1_oa); + rtb_DataTypeConversion_d = (rtb_Equal8 || (rtb_y_l0 && rtb_y_cp) || rtb_Equal6 || rtb_DataTypeConversion_d || + rtb_y_e || rtb_Equal7 || (rtb_Switch1_oa != 0U)); + FcuComputer_MATLABFunction_m(rtb_Switch1_2, &rtb_y_e); + FcuComputer_MATLABFunction_a(rtb_Switch1_2, FcuComputer_P.BitfromLabel2_bit_a, &rtb_Switch1_oa); + rtb_Equal6 = (rtb_Switch1_oa != 0U); + FcuComputer_MATLABFunction_a(rtb_Switch1_2, FcuComputer_P.BitfromLabel1_bit_m, &rtb_Switch1_oa); + rtb_OR_o = (rtb_Equal6 || (rtb_Switch1_oa != 0U)); + if (rtb_fmgc1Priority) { + rtb_Switch_k_0 = &FcuComputer_U.in.bus_inputs.fmgc_1_bus.discrete_word_1; + } else { + rtb_Switch_k_0 = &FcuComputer_U.in.bus_inputs.fmgc_2_bus.discrete_word_1; + } + + FcuComputer_MATLABFunction_a(rtb_Switch_k_0, FcuComputer_P.BitfromLabel6_bit_b, &rtb_Switch1_oa); + FcuComputer_MATLABFunction_m(rtb_Switch_k_0, &rtb_y_cp); + rtb_BusAssignment_m.logic.afs.exped_active = ((rtb_Switch1_oa != 0U) && rtb_y_cp); + if (rtb_fmgc1Priority) { + rtb_Switch_k_0 = &FcuComputer_U.in.bus_inputs.fmgc_1_bus.discrete_word_3; + } else { + rtb_Switch_k_0 = &FcuComputer_U.in.bus_inputs.fmgc_2_bus.discrete_word_3; + } + + FcuComputer_MATLABFunction_m(rtb_Switch_k_0, &rtb_y_l0); + if (rtb_fmgc1Priority) { + rtb_Switch1_2 = &FcuComputer_U.in.bus_inputs.fmgc_1_bus.discrete_word_4; + } else { + rtb_Switch1_2 = &FcuComputer_U.in.bus_inputs.fmgc_2_bus.discrete_word_4; + } + + FcuComputer_MATLABFunction_a(rtb_Switch1_2, FcuComputer_P.BitfromLabel1_bit_i, &rtb_Switch1_oa); + rtb_Equal6 = (rtb_Switch1_oa != 0U); + FcuComputer_MATLABFunction_a(rtb_Switch_k_0, FcuComputer_P.BitfromLabel2_bit_g, &rtb_Switch1_oa); + FcuComputer_MATLABFunction_m(rtb_Switch1_2, &rtb_y_cp); + rtb_Equal6 = ((rtb_Equal6 || (rtb_Switch1_oa != 0U)) && rtb_y_cp && rtb_y_l0); + if (rtb_fmgc1Priority) { + rtb_Switch1_2 = &FcuComputer_U.in.bus_inputs.fmgc_1_bus.discrete_word_2; + } else { + rtb_Switch1_2 = &FcuComputer_U.in.bus_inputs.fmgc_2_bus.discrete_word_2; + } + + FcuComputer_MATLABFunction_m(rtb_Switch1_2, &rtb_y_cp); + FcuComputer_MATLABFunction_a(rtb_Switch1_2, FcuComputer_P.BitfromLabel5_bit_p, &rtb_Switch1_oa); + rtb_Equal7 = (rtb_Switch1_oa != 0U); + FcuComputer_MATLABFunction_a(rtb_Switch1_2, FcuComputer_P.BitfromLabel4_bit_o, &rtb_Switch1_oa); + rtb_Equal8 = (rtb_Switch1_oa != 0U); + FcuComputer_MATLABFunction_a(rtb_Switch_k_0, FcuComputer_P.BitfromLabel3_bit_f, &rtb_Switch1_oa); + rtb_Equal7 = (rtb_y_cp && (rtb_Equal7 || rtb_Equal8 || (rtb_Switch1_oa != 0U)) && rtb_y_l0 && (!rtb_Equal6)); + rtb_BusAssignment_m.data = FcuComputer_U.in; + rtb_BusAssignment_m.logic.afs.fmgc_1_has_priority = rtb_fmgc1Priority; + rtb_BusAssignment_m.logic.afs.chosen_fmgc_data.v_cas_kts = rtb_y; + rtb_BusAssignment_m.logic.afs.chosen_fmgc_data.v_mach = rtb_y_cy; + rtb_BusAssignment_m.logic.afs.chosen_fmgc_data.hdg_deg = rtb_y_b; + rtb_BusAssignment_m.logic.afs.chosen_fmgc_data.trk_deg = rtb_y_h; + rtb_BusAssignment_m.logic.afs.chosen_fmgc_data.alt_ft = rtb_y_m; + rtb_BusAssignment_m.logic.afs.chosen_fmgc_data.vs_ft_min = rtb_y_gu; + rtb_BusAssignment_m.logic.afs.chosen_fmgc_data.fpa_deg = rtb_y_f; + rtb_BusAssignment_m.logic.afs.any_ap_fd_engaged = (FcuComputer_U.in.discrete_inputs.ap_1_engaged || + FcuComputer_U.in.discrete_inputs.ap_2_engaged || FcuComputer_U.in.discrete_inputs.fd_1_engaged || + FcuComputer_U.in.discrete_inputs.fd_2_engaged); + rtb_BusAssignment_m.logic.afs.trk_fpa_active = FcuComputer_DWork.p_trk_fpa_active; + rtb_BusAssignment_m.logic.afs.metric_alt_active = FcuComputer_DWork.p_metric_alt_active; + rtb_BusAssignment_m.logic.afs.auto_speed_control = rtb_AND_g; + rtb_BusAssignment_m.logic.afs.selected_speed_control = rtb_AND1_l; + rtb_BusAssignment_m.logic.afs.spd_mach_display_value = FcuComputer_P.Constant1_Value.afs.spd_mach_display_value; + rtb_BusAssignment_m.logic.afs.spd_mach_dashes = FcuComputer_P.Constant1_Value.afs.spd_mach_dashes; + rtb_BusAssignment_m.logic.afs.hdg_trk_managed = (rtb_OR3_j || rtb_Equal9); + rtb_BusAssignment_m.logic.afs.hdg_trk_display_value = FcuComputer_P.Constant1_Value.afs.hdg_trk_display_value; + rtb_BusAssignment_m.logic.afs.hdg_trk_dashes = FcuComputer_P.Constant1_Value.afs.hdg_trk_dashes; + rtb_BusAssignment_m.logic.afs.alt_display_value = FcuComputer_P.Constant1_Value.afs.alt_display_value; + rtb_BusAssignment_m.logic.afs.lvl_ch_managed = (rtb_AND2_m || (rtb_DataTypeConversion_d && rtb_y_e)); + rtb_BusAssignment_m.logic.afs.lvl_ch_vs_fpa = (rtb_y_e && rtb_OR_o); + rtb_BusAssignment_m.logic.afs.vs_fpa_display_value = FcuComputer_P.Constant1_Value.afs.vs_fpa_display_value; + rtb_BusAssignment_m.logic.afs.vs_fpa_dashes = FcuComputer_P.Constant1_Value.afs.vs_fpa_dashes; + rtb_BusAssignment_m.logic.afs.vs_fpa_buttons.turns = rtb_baroValueMode; + rtb_BusAssignment_m.logic.afs.lat_value_changed = FcuComputer_P.Constant1_Value.afs.lat_value_changed; + rtb_BusAssignment_m.logic.afs.alt_value_changed = FcuComputer_P.Constant1_Value.afs.alt_value_changed; + rtb_BusAssignment_m.logic.afs.vpath_value_changed = FcuComputer_P.Constant1_Value.afs.vpath_value_changed; + rtb_BusAssignment_m.logic.afs.spd_mach_value_changed = FcuComputer_P.Constant1_Value.afs.spd_mach_value_changed; + rtb_BusAssignment_m.logic.fo_efis.efis_filter = rtb_efisFilter; + rtb_BusAssignment_m.logic.fo_efis.baro_value_hpa = static_cast(rtb_DataTypeConversion3); + rtb_BusAssignment_m.logic.fo_efis.baro_value_inhg = static_cast(rtb_DataTypeConversion2); + rtb_BusAssignment_m.discrete_outputs = FcuComputer_P.Constant3_Value; + rtb_BusAssignment_m.bus_outputs = FcuComputer_P.Constant2_Value; + rtb_BusAssignment_m.logic.afs.loc_only_active = rtb_Equal7; + rtb_BusAssignment_m.logic.afs.appr_active = rtb_Equal6; + FcuComputer_MATLABFunction_d(rtb_AND_g, FcuComputer_P.PulseNode_isRisingEdge_l, &rtb_Equal7, + &FcuComputer_DWork.sf_MATLABFunction_kl); + rtb_OR3_j = ((!rtb_AND1_l) && (!rtb_AND_g)); + FcuComputer_MATLABFunction1(&rtb_BusAssignment_m, rtb_Equal7, rtb_AND1_l || rtb_OR3_j || + (FcuComputer_U.in.discrete_inputs.afs_inputs.spd_knob.turns != FcuComputer_P.CompareToConstant_const_p0), + &rtb_OR3_j, &FcuComputer_DWork.sf_MATLABFunction1_p); + if (!FcuComputer_DWork.pValue_not_empty_i) { + FcuComputer_DWork.pValue_g = rtb_y; + FcuComputer_DWork.pValue_not_empty_i = true; + } + + if (FcuComputer_DWork.prevMachActive) { + FcuComputer_DWork.pValue_g = rtb_y; + } + + if (rtb_OR3_j) { + FcuComputer_DWork.pValue_g = rtb_y; + } + + FcuComputer_DWork.pValue_g += static_cast(FcuComputer_U.in.discrete_inputs.afs_inputs.spd_knob.turns); + FcuComputer_DWork.pValue_g = std::fmax(std::fmin(FcuComputer_DWork.pValue_g, 399.0F), 100.0F); + FcuComputer_DWork.pValue_g = std::round(FcuComputer_DWork.pValue_g); + FcuComputer_DWork.prevMachActive = false; + rtb_BusAssignment_m.logic.afs.spd_mach_display_value = FcuComputer_DWork.pValue_g; + rtb_BusAssignment_m.logic.afs.spd_mach_dashes = rtb_OR3_j; + FcuComputer_MATLABFunction_d((!rtb_BusAssignment_m.logic.afs.hdg_trk_selected) && + rtb_BusAssignment_m.logic.afs.any_ap_fd_engaged, FcuComputer_P.PulseNode_isRisingEdge_hz, &rtb_y_cp, + &FcuComputer_DWork.sf_MATLABFunction_dc); + rtb_Equal7 = (rtb_BusAssignment_m.logic.afs.hdg_trk_preset_available && (!FcuComputer_DWork.Delay_DSTATE)); + FcuComputer_MATLABFunction1(&rtb_BusAssignment_m, rtb_y_cp, rtb_BusAssignment_m.logic.afs.hdg_trk_selected || + (!rtb_BusAssignment_m.logic.afs.any_ap_fd_engaged) || + (FcuComputer_U.in.discrete_inputs.afs_inputs.hdg_trk_knob.turns != FcuComputer_P.CompareToConstant_const_es) || + rtb_Equal7, &FcuComputer_DWork.Delay_DSTATE, &FcuComputer_DWork.sf_MATLABFunction1); + if (!FcuComputer_DWork.pValue_not_empty_o) { + if (FcuComputer_DWork.p_trk_fpa_active) { + FcuComputer_DWork.pValue_e = rtb_y_h; + FcuComputer_DWork.pValue_not_empty_o = true; + } else { + FcuComputer_DWork.pValue_e = rtb_y_b; + FcuComputer_DWork.pValue_not_empty_o = true; + } + } + + if (!FcuComputer_DWork.prevTrkFpaActive_not_empty_l) { + FcuComputer_DWork.prevTrkFpaActive_g = FcuComputer_DWork.p_trk_fpa_active; + FcuComputer_DWork.prevTrkFpaActive_not_empty_l = true; + } + + if (FcuComputer_DWork.prevTrkFpaActive_g != FcuComputer_DWork.p_trk_fpa_active) { + if (FcuComputer_DWork.p_trk_fpa_active) { + rtb_y_cy = FcuComputer_DWork.pValue_e - rtb_y_b; + } else { + rtb_y_cy = FcuComputer_DWork.pValue_e - rtb_y_h; + } + + if (rtb_y_cy > 180.0F) { + rtb_y_cy -= 360.0F; + } else if (rtb_y_cy < -180.0F) { + rtb_y_cy += 360.0F; + } + + rtb_y_cy = std::abs(rtb_y_cy); + if ((rtb_y_cy < 5.0F) && FcuComputer_DWork.p_trk_fpa_active) { + FcuComputer_DWork.pValue_e = rtb_y_h; + } else if ((rtb_y_cy < 5.0F) && (!FcuComputer_DWork.p_trk_fpa_active)) { + FcuComputer_DWork.pValue_e = rtb_y_b; + } + } + + if (FcuComputer_DWork.Delay_DSTATE) { + if (FcuComputer_DWork.p_trk_fpa_active) { + FcuComputer_DWork.pValue_e = rtb_y_h; + FcuComputer_DWork.pValue_e = std::round(FcuComputer_DWork.pValue_e); + } else { + FcuComputer_DWork.pValue_e = rtb_y_b; + FcuComputer_DWork.pValue_e = std::round(FcuComputer_DWork.pValue_e); + } + } + + FcuComputer_DWork.pValue_e += static_cast(FcuComputer_U.in.discrete_inputs.afs_inputs.hdg_trk_knob.turns); + FcuComputer_DWork.pValue_e = std::round(FcuComputer_DWork.pValue_e); + if (FcuComputer_DWork.pValue_e > 359.0F) { + FcuComputer_DWork.pValue_e -= 360.0F; + } else if (FcuComputer_DWork.pValue_e < 0.0F) { + FcuComputer_DWork.pValue_e += 360.0F; + } + + FcuComputer_DWork.prevTrkFpaActive_g = FcuComputer_DWork.p_trk_fpa_active; + rtb_BusAssignment_m.logic.afs.hdg_trk_display_value = FcuComputer_DWork.pValue_e; + rtb_BusAssignment_m.logic.afs.hdg_trk_dashes = FcuComputer_DWork.Delay_DSTATE; + if (!FcuComputer_DWork.pValue_not_empty_g) { + FcuComputer_DWork.pValue_a = rtb_y_m; + FcuComputer_DWork.pValue_not_empty_g = true; + } + + if (FcuComputer_U.in.discrete_inputs.afs_inputs.alt_increment_1000) { + FcuComputer_DWork.pValue_a = std::round((static_cast + (FcuComputer_U.in.discrete_inputs.afs_inputs.alt_knob.turns) * 1000.0F + FcuComputer_DWork.pValue_a) / 1000.0F) * + 1000.0F; + } else { + FcuComputer_DWork.pValue_a = std::round((static_cast + (FcuComputer_U.in.discrete_inputs.afs_inputs.alt_knob.turns) * 100.0F + FcuComputer_DWork.pValue_a) / 100.0F) * + 100.0F; + } + + FcuComputer_DWork.pValue_a = std::fmax(std::fmin(FcuComputer_DWork.pValue_a, 49000.0F), 100.0F); + rtb_BusAssignment_m.logic.afs.alt_display_value = FcuComputer_DWork.pValue_a; + FcuComputer_MATLABFunction_d((!rtb_BusAssignment_m.logic.afs.lvl_ch_vs_fpa) && + rtb_BusAssignment_m.logic.afs.any_ap_fd_engaged, FcuComputer_P.PulseNode1_isRisingEdge_e, &rtb_Equal7, + &FcuComputer_DWork.sf_MATLABFunction_kw); + rtb_OR3_j = !rtb_BusAssignment_m.logic.afs.any_ap_fd_engaged; + rtb_Equal6 = (FcuComputer_U.in.discrete_inputs.afs_inputs.vs_fpa_knob.turns != + FcuComputer_P.CompareToConstant_const_o); + FcuComputer_MATLABFunction1(&rtb_BusAssignment_m, rtb_Equal7, rtb_BusAssignment_m.logic.afs.lvl_ch_vs_fpa || + rtb_OR3_j || rtb_Equal6, &rtb_Equal6, &FcuComputer_DWork.sf_MATLABFunction1_o); + FcuComputer_MATLABFunction_d(FcuComputer_U.in.discrete_inputs.ap_1_engaged || + FcuComputer_U.in.discrete_inputs.ap_2_engaged, FcuComputer_P.PulseNode_isRisingEdge_d, &rtb_OR3_j, + &FcuComputer_DWork.sf_MATLABFunction_ch); + if (!FcuComputer_DWork.pValue_not_empty) { + if (FcuComputer_DWork.p_trk_fpa_active) { + FcuComputer_DWork.pValue = rtb_y_f; + FcuComputer_DWork.pValue_not_empty = true; + } else { + FcuComputer_DWork.pValue = rtb_y_gu; + FcuComputer_DWork.pValue_not_empty = true; + } + } + + if (!FcuComputer_DWork.prevTrkFpaActive_not_empty) { + FcuComputer_DWork.prevTrkFpaActive = FcuComputer_DWork.p_trk_fpa_active; + FcuComputer_DWork.prevTrkFpaActive_not_empty = true; + } + + if (FcuComputer_DWork.prevTrkFpaActive != FcuComputer_DWork.p_trk_fpa_active) { + if (FcuComputer_DWork.p_trk_fpa_active) { + FcuComputer_DWork.pValue = rtb_y_f; + } else { + FcuComputer_DWork.pValue = rtb_y_gu; + } + } + + if (rtb_OR3_j || rtb_Equal6) { + if (FcuComputer_DWork.p_trk_fpa_active) { + FcuComputer_DWork.pValue = rtb_y_f; + } else { + FcuComputer_DWork.pValue = rtb_y_gu; + } + } + + if (FcuComputer_DWork.p_trk_fpa_active) { + FcuComputer_DWork.pValue += static_cast(FcuComputer_U.in.discrete_inputs.afs_inputs.vs_fpa_knob.turns) * + 0.1F; + FcuComputer_DWork.pValue = std::fmax(std::fmin(FcuComputer_DWork.pValue, 9.9F), -9.9F); + FcuComputer_DWork.pValue = std::round(FcuComputer_DWork.pValue / 0.1F) * 0.1F; + } else { + FcuComputer_DWork.pValue += static_cast(FcuComputer_U.in.discrete_inputs.afs_inputs.vs_fpa_knob.turns) * + 100.0F; + FcuComputer_DWork.pValue = std::fmax(std::fmin(FcuComputer_DWork.pValue, 6000.0F), -6000.0F); + FcuComputer_DWork.pValue = std::round(FcuComputer_DWork.pValue / 100.0F) * 100.0F; + } + + FcuComputer_DWork.prevTrkFpaActive = FcuComputer_DWork.p_trk_fpa_active; + rtb_y_e = rtb_Equal6; + FcuComputer_MATLABFunction(FcuComputer_DWork.pValue_e != FcuComputer_DWork.DelayInput1_DSTATE[0], + FcuComputer_U.in.time.dt, &rtb_Equal8, FcuComputer_P.MTrigNode_isRisingEdge_i, + FcuComputer_P.MTrigNode_retriggerable_k, FcuComputer_P.MTrigNode_triggerDuration_m, + &FcuComputer_DWork.sf_MATLABFunction_av); + FcuComputer_MATLABFunction(FcuComputer_DWork.pValue_a != FcuComputer_DWork.DelayInput1_DSTATE[1], + FcuComputer_U.in.time.dt, &rtb_Equal7, FcuComputer_P.MTrigNode1_isRisingEdge_m, + FcuComputer_P.MTrigNode1_retriggerable_p, FcuComputer_P.MTrigNode1_triggerDuration_h, + &FcuComputer_DWork.sf_MATLABFunction_p5r); + FcuComputer_MATLABFunction(FcuComputer_DWork.pValue != FcuComputer_DWork.DelayInput1_DSTATE[2], + FcuComputer_U.in.time.dt, &rtb_Equal6, FcuComputer_P.MTrigNode2_isRisingEdge_hp, + FcuComputer_P.MTrigNode2_retriggerable_k, FcuComputer_P.MTrigNode2_triggerDuration_a, + &FcuComputer_DWork.sf_MATLABFunction_lh); + FcuComputer_MATLABFunction(FcuComputer_DWork.pValue_g != FcuComputer_DWork.DelayInput1_DSTATE[3], + FcuComputer_U.in.time.dt, &rtb_OR3_j, FcuComputer_P.MTrigNode3_isRisingEdge_j, + FcuComputer_P.MTrigNode3_retriggerable_a, FcuComputer_P.MTrigNode3_triggerDuration_h, + &FcuComputer_DWork.sf_MATLABFunction_oi); + FcuComputer_MATLABFunction_n(&rtb_BusAssignment_m.logic.capt_efis, + &FcuComputer_U.in.discrete_inputs.capt_efis_inputs, &rtb_baroMode, &rtb_y_b, &rtb_baroValueMode); + rtb_capt_efis_outputs_baro_value_mode = rtb_baroMode; + rtb_capt_efis_outputs_baro_value = rtb_y_b; + rtb_capt_efis_outputs_baro_mode = rtb_baroValueMode; + FcuComputer_MATLABFunction_n(&rtb_BusAssignment_m.logic.fo_efis, &FcuComputer_U.in.discrete_inputs.fo_efis_inputs, + &rtb_baroValueMode, &rtb_y_b, &rtb_baroMode); + rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_fo_efis_outputs_baro_value = rtb_y_b; + if (rtb_fmgc1Priority) { + rtb_Switch1_oa = FcuComputer_U.in.bus_inputs.fmgc_1_bus.ats_fma_discrete_word.SSM; + rtb_y = FcuComputer_U.in.bus_inputs.fmgc_1_bus.ats_fma_discrete_word.Data; + rtb_Switch6_SSM = FcuComputer_U.in.bus_inputs.fmgc_1_bus.flx_to_temp_deg_c.SSM; + rtb_Switch6_Data = FcuComputer_U.in.bus_inputs.fmgc_1_bus.flx_to_temp_deg_c.Data; + rtb_Switch7_SSM = FcuComputer_U.in.bus_inputs.fmgc_1_bus.ats_discrete_word.SSM; + rtb_Switch7_Data = FcuComputer_U.in.bus_inputs.fmgc_1_bus.ats_discrete_word.Data; + } else { + rtb_Switch1_oa = FcuComputer_U.in.bus_inputs.fmgc_2_bus.ats_fma_discrete_word.SSM; + rtb_y = FcuComputer_U.in.bus_inputs.fmgc_2_bus.ats_fma_discrete_word.Data; + rtb_Switch6_SSM = FcuComputer_U.in.bus_inputs.fmgc_2_bus.flx_to_temp_deg_c.SSM; + rtb_Switch6_Data = FcuComputer_U.in.bus_inputs.fmgc_2_bus.flx_to_temp_deg_c.Data; + rtb_Switch7_SSM = FcuComputer_U.in.bus_inputs.fmgc_2_bus.ats_discrete_word.SSM; + rtb_Switch7_Data = FcuComputer_U.in.bus_inputs.fmgc_2_bus.ats_discrete_word.Data; + } + + rtb_VectorConcatenate[0] = FcuComputer_U.in.discrete_inputs.capt_efis_inputs.baro_is_inhg; + rtb_VectorConcatenate[1] = FcuComputer_P.Constant10_Value; + rtb_VectorConcatenate[2] = FcuComputer_P.Constant10_Value; + rtb_VectorConcatenate[3] = FcuComputer_P.Constant10_Value; + rtb_VectorConcatenate[4] = FcuComputer_P.Constant10_Value; + rtb_VectorConcatenate[5] = FcuComputer_P.Constant10_Value; + rtb_VectorConcatenate[6] = FcuComputer_P.Constant10_Value; + rtb_VectorConcatenate[7] = FcuComputer_P.Constant10_Value; + rtb_VectorConcatenate[8] = FcuComputer_P.Constant10_Value; + rtb_VectorConcatenate[9] = FcuComputer_P.Constant10_Value; + rtb_VectorConcatenate[10] = FcuComputer_P.Constant10_Value; + rtb_VectorConcatenate[11] = FcuComputer_P.Constant10_Value; + rtb_VectorConcatenate[12] = FcuComputer_P.Constant10_Value; + rtb_VectorConcatenate[13] = FcuComputer_P.Constant10_Value; + rtb_VectorConcatenate[14] = (FcuComputer_U.in.discrete_inputs.capt_efis_inputs.efis_range == + FcuComputer_P.EnumeratedConstant2_Value_g); + rtb_VectorConcatenate[15] = (FcuComputer_U.in.discrete_inputs.capt_efis_inputs.efis_range == + FcuComputer_P.EnumeratedConstant1_Value_h); + rtb_VectorConcatenate[16] = (FcuComputer_U.in.discrete_inputs.capt_efis_inputs.efis_range == + FcuComputer_P.EnumeratedConstant3_Value_i); + rtb_VectorConcatenate[17] = (FcuComputer_U.in.discrete_inputs.capt_efis_inputs.efis_range == + FcuComputer_P.EnumeratedConstant4_Value_n); + rtb_VectorConcatenate[18] = (FcuComputer_U.in.discrete_inputs.capt_efis_inputs.efis_range == + FcuComputer_P.EnumeratedConstant5_Value_a); + FcuComputer_MATLABFunction_e(rtb_VectorConcatenate, &rtb_y_m); + rtb_VectorConcatenate[0] = FcuComputer_U.in.discrete_inputs.fo_efis_inputs.baro_is_inhg; + rtb_VectorConcatenate[1] = FcuComputer_P.Constant10_Value_a; + rtb_VectorConcatenate[2] = FcuComputer_P.Constant10_Value_a; + rtb_VectorConcatenate[3] = FcuComputer_P.Constant10_Value_a; + rtb_VectorConcatenate[4] = FcuComputer_P.Constant10_Value_a; + rtb_VectorConcatenate[5] = FcuComputer_P.Constant10_Value_a; + rtb_VectorConcatenate[6] = FcuComputer_P.Constant10_Value_a; + rtb_VectorConcatenate[7] = FcuComputer_P.Constant10_Value_a; + rtb_VectorConcatenate[8] = FcuComputer_P.Constant10_Value_a; + rtb_VectorConcatenate[9] = FcuComputer_P.Constant10_Value_a; + rtb_VectorConcatenate[10] = FcuComputer_P.Constant10_Value_a; + rtb_VectorConcatenate[11] = FcuComputer_P.Constant10_Value_a; + rtb_VectorConcatenate[12] = FcuComputer_P.Constant10_Value_a; + rtb_VectorConcatenate[13] = FcuComputer_P.Constant10_Value_a; + rtb_VectorConcatenate[14] = (FcuComputer_U.in.discrete_inputs.fo_efis_inputs.efis_range == + FcuComputer_P.EnumeratedConstant2_Value_l); + rtb_VectorConcatenate[15] = (FcuComputer_U.in.discrete_inputs.fo_efis_inputs.efis_range == + FcuComputer_P.EnumeratedConstant1_Value_n); + rtb_VectorConcatenate[16] = (FcuComputer_U.in.discrete_inputs.fo_efis_inputs.efis_range == + FcuComputer_P.EnumeratedConstant3_Value_e); + rtb_VectorConcatenate[17] = (FcuComputer_U.in.discrete_inputs.fo_efis_inputs.efis_range == + FcuComputer_P.EnumeratedConstant4_Value_i); + rtb_VectorConcatenate[18] = (FcuComputer_U.in.discrete_inputs.fo_efis_inputs.efis_range == + FcuComputer_P.EnumeratedConstant5_Value_k); + FcuComputer_MATLABFunction_e(rtb_VectorConcatenate, &rtb_y_h); + rtb_VectorConcatenate[0] = (FcuComputer_U.in.discrete_inputs.capt_efis_inputs.efis_mode == + FcuComputer_P.EnumeratedConstant2_Value); + rtb_VectorConcatenate[1] = (FcuComputer_U.in.discrete_inputs.capt_efis_inputs.efis_mode == + FcuComputer_P.EnumeratedConstant1_Value_b); + rtb_VectorConcatenate[2] = (FcuComputer_U.in.discrete_inputs.capt_efis_inputs.efis_mode == + FcuComputer_P.EnumeratedConstant3_Value); + rtb_VectorConcatenate[3] = (FcuComputer_U.in.discrete_inputs.capt_efis_inputs.efis_mode == + FcuComputer_P.EnumeratedConstant4_Value); + rtb_VectorConcatenate[4] = (FcuComputer_U.in.discrete_inputs.capt_efis_inputs.efis_mode == + FcuComputer_P.EnumeratedConstant5_Value); + rtb_VectorConcatenate[5] = FcuComputer_P.Constant10_Value_p; + rtb_VectorConcatenate[6] = (rtb_BusAssignment_m.logic.capt_efis.efis_filter == + FcuComputer_P.EnumeratedConstant7_Value_k); + rtb_VectorConcatenate[7] = (rtb_BusAssignment_m.logic.capt_efis.efis_filter == + FcuComputer_P.EnumeratedConstant6_Value_l); + rtb_VectorConcatenate[8] = (rtb_BusAssignment_m.logic.capt_efis.efis_filter == + FcuComputer_P.EnumeratedConstant8_Value_a); + rtb_VectorConcatenate[9] = (rtb_BusAssignment_m.logic.capt_efis.efis_filter == + FcuComputer_P.EnumeratedConstant9_Value_g); + rtb_VectorConcatenate[10] = (rtb_BusAssignment_m.logic.capt_efis.efis_filter == + FcuComputer_P.EnumeratedConstant10_Value_b); + rtb_VectorConcatenate[11] = rtb_BusAssignment_m.logic.capt_efis.ls_on; + rtb_DataTypeConversion_d = !rtb_BusAssignment_m.logic.capt_efis.fd_on; + rtb_VectorConcatenate[12] = rtb_DataTypeConversion_d; + rtb_VectorConcatenate[13] = (FcuComputer_U.in.discrete_inputs.capt_efis_inputs.efis_navaid_1 == + FcuComputer_P.EnumeratedConstant12_Value); + rtb_VectorConcatenate[14] = (FcuComputer_P.EnumeratedConstant12_Value == + FcuComputer_U.in.discrete_inputs.capt_efis_inputs.efis_navaid_2); + rtb_VectorConcatenate[15] = (FcuComputer_U.in.discrete_inputs.capt_efis_inputs.efis_navaid_1 == + FcuComputer_P.EnumeratedConstant11_Value); + rtb_VectorConcatenate[16] = (FcuComputer_P.EnumeratedConstant11_Value == + FcuComputer_U.in.discrete_inputs.capt_efis_inputs.efis_navaid_2); + rtb_VectorConcatenate[17] = rtb_BusAssignment_m.logic.capt_efis.baro_std; + rtb_VectorConcatenate[18] = rtb_BusAssignment_m.logic.capt_efis.baro_qnh; + FcuComputer_MATLABFunction_e(rtb_VectorConcatenate, &rtb_y_cy); + rtb_VectorConcatenate[0] = (FcuComputer_U.in.discrete_inputs.fo_efis_inputs.efis_mode == + FcuComputer_P.EnumeratedConstant2_Value_a); + rtb_VectorConcatenate[1] = (FcuComputer_U.in.discrete_inputs.fo_efis_inputs.efis_mode == + FcuComputer_P.EnumeratedConstant1_Value_m); + rtb_VectorConcatenate[2] = (FcuComputer_U.in.discrete_inputs.fo_efis_inputs.efis_mode == + FcuComputer_P.EnumeratedConstant3_Value_l); + rtb_VectorConcatenate[3] = (FcuComputer_U.in.discrete_inputs.fo_efis_inputs.efis_mode == + FcuComputer_P.EnumeratedConstant4_Value_b); + rtb_VectorConcatenate[4] = (FcuComputer_U.in.discrete_inputs.fo_efis_inputs.efis_mode == + FcuComputer_P.EnumeratedConstant5_Value_e); + rtb_VectorConcatenate[5] = FcuComputer_P.Constant10_Value_e; + rtb_VectorConcatenate[6] = (rtb_efisFilter == FcuComputer_P.EnumeratedConstant7_Value_a); + rtb_VectorConcatenate[7] = (rtb_efisFilter == FcuComputer_P.EnumeratedConstant6_Value_l4); + rtb_VectorConcatenate[8] = (rtb_efisFilter == FcuComputer_P.EnumeratedConstant8_Value_p); + rtb_VectorConcatenate[9] = (rtb_efisFilter == FcuComputer_P.EnumeratedConstant9_Value_o); + rtb_VectorConcatenate[10] = (rtb_efisFilter == FcuComputer_P.EnumeratedConstant10_Value_e); + rtb_VectorConcatenate[11] = rtb_BusAssignment_m.logic.fo_efis.ls_on; + rtb_Equal9 = !rtb_BusAssignment_m.logic.fo_efis.fd_on; + rtb_VectorConcatenate[12] = rtb_Equal9; + rtb_VectorConcatenate[13] = (FcuComputer_U.in.discrete_inputs.fo_efis_inputs.efis_navaid_1 == + FcuComputer_P.EnumeratedConstant12_Value_a); + rtb_VectorConcatenate[14] = (FcuComputer_P.EnumeratedConstant12_Value_a == + FcuComputer_U.in.discrete_inputs.fo_efis_inputs.efis_navaid_2); + rtb_VectorConcatenate[15] = (FcuComputer_U.in.discrete_inputs.fo_efis_inputs.efis_navaid_1 == + FcuComputer_P.EnumeratedConstant11_Value_o); + rtb_VectorConcatenate[16] = (FcuComputer_P.EnumeratedConstant11_Value_o == + FcuComputer_U.in.discrete_inputs.fo_efis_inputs.efis_navaid_2); + rtb_VectorConcatenate[17] = rtb_BusAssignment_m.logic.fo_efis.baro_std; + rtb_VectorConcatenate[18] = rtb_BusAssignment_m.logic.fo_efis.baro_qnh; + FcuComputer_MATLABFunction_e(rtb_VectorConcatenate, &rtb_y_b); + rtb_VectorConcatenate[0] = rtb_BusAssignment_m.logic.afs.hdg_trk_buttons.pushed; + rtb_VectorConcatenate[1] = rtb_BusAssignment_m.logic.afs.hdg_trk_buttons.pulled; + rtb_VectorConcatenate[2] = rtb_BusAssignment_m.logic.afs.loc_pushed; + rtb_VectorConcatenate[3] = rtb_Equal8; + rtb_VectorConcatenate[4] = FcuComputer_P.Constant19_Value; + rtb_VectorConcatenate[5] = FcuComputer_P.Constant19_Value; + rtb_VectorConcatenate[6] = FcuComputer_P.Constant19_Value; + rtb_VectorConcatenate[7] = FcuComputer_P.Constant19_Value; + rtb_VectorConcatenate[8] = FcuComputer_P.Constant19_Value; + rtb_VectorConcatenate[9] = rtb_fmgc1Priority; + rtb_VectorConcatenate[10] = !rtb_fmgc1Priority; + rtb_VectorConcatenate[11] = FcuComputer_P.Constant19_Value; + rtb_VectorConcatenate[12] = FcuComputer_P.Constant19_Value; + rtb_VectorConcatenate[13] = FcuComputer_P.Constant19_Value; + rtb_VectorConcatenate[14] = FcuComputer_P.Constant19_Value; + rtb_VectorConcatenate[15] = rtb_DataTypeConversion_d; + rtb_VectorConcatenate[16] = rtb_Equal9; + rtb_VectorConcatenate[17] = FcuComputer_P.Constant19_Value; + rtb_VectorConcatenate[18] = FcuComputer_P.Constant19_Value; + FcuComputer_MATLABFunction_e(rtb_VectorConcatenate, &rtb_y_f); + rtb_VectorConcatenate[0] = rtb_BusAssignment_m.logic.afs.spd_mach_buttons.pushed; + rtb_VectorConcatenate[1] = rtb_BusAssignment_m.logic.afs.spd_mach_buttons.pulled; + rtb_VectorConcatenate[2] = rtb_Equal7; + rtb_VectorConcatenate[3] = rtb_Equal6; + rtb_VectorConcatenate[4] = rtb_OR3_j; + rtb_VectorConcatenate[5] = rtb_BusAssignment_m.logic.afs.vs_fpa_buttons.pushed; + rtb_VectorConcatenate[6] = rtb_BusAssignment_m.logic.afs.alt_buttons.pushed; + rtb_VectorConcatenate[7] = rtb_BusAssignment_m.logic.afs.alt_buttons.pulled; + rtb_VectorConcatenate[8] = rtb_BusAssignment_m.logic.afs.vs_fpa_buttons.pulled; + rtb_VectorConcatenate[9] = FcuComputer_DWork.p_metric_alt_active; + rtb_VectorConcatenate[10] = rtb_BusAssignment_m.logic.afs.spd_mach_switching_pushed; + rtb_VectorConcatenate[11] = rtb_BusAssignment_m.logic.afs.exped_pushed; + rtb_VectorConcatenate[12] = rtb_BusAssignment_m.logic.afs.appr_pushed; + rtb_DataTypeConversion_d = !FcuComputer_DWork.p_trk_fpa_active; + rtb_VectorConcatenate[13] = rtb_DataTypeConversion_d; + rtb_VectorConcatenate[14] = FcuComputer_DWork.p_trk_fpa_active; + rtb_VectorConcatenate[15] = FcuComputer_P.Constant20_Value; + rtb_VectorConcatenate[16] = FcuComputer_P.Constant20_Value; + rtb_VectorConcatenate[17] = FcuComputer_P.Constant20_Value; + rtb_VectorConcatenate[18] = FcuComputer_P.Constant20_Value; + FcuComputer_MATLABFunction_e(rtb_VectorConcatenate, &rtb_y_gu); + if (rtb_fmgc1Priority) { + rtb_Switch4_b_SSM = FcuComputer_U.in.bus_inputs.fmgc_1_bus.n1_command_percent.SSM; + rtb_Switch4_b_Data = FcuComputer_U.in.bus_inputs.fmgc_1_bus.n1_command_percent.Data; + } else { + rtb_Switch4_b_SSM = FcuComputer_U.in.bus_inputs.fmgc_2_bus.n1_command_percent.SSM; + rtb_Switch4_b_Data = FcuComputer_U.in.bus_inputs.fmgc_2_bus.n1_command_percent.Data; + } + + FcuComputer_Y.out.data = FcuComputer_U.in; + FcuComputer_Y.out.logic.afs.fmgc_1_has_priority = rtb_fmgc1Priority; + FcuComputer_Y.out.logic.afs.chosen_fmgc_data = rtb_BusAssignment_m.logic.afs.chosen_fmgc_data; + FcuComputer_Y.out.logic.afs.any_ap_fd_engaged = rtb_BusAssignment_m.logic.afs.any_ap_fd_engaged; + FcuComputer_Y.out.logic.afs.trk_fpa_active = FcuComputer_DWork.p_trk_fpa_active; + FcuComputer_Y.out.logic.afs.metric_alt_active = FcuComputer_DWork.p_metric_alt_active; + FcuComputer_Y.out.logic.afs.auto_speed_control = rtb_AND_g; + FcuComputer_Y.out.logic.afs.selected_speed_control = rtb_AND1_l; + FcuComputer_Y.out.logic.afs.spd_mach_display_value = FcuComputer_DWork.pValue_g; + FcuComputer_Y.out.logic.afs.spd_mach_dashes = rtb_BusAssignment_m.logic.afs.spd_mach_dashes; + FcuComputer_Y.out.logic.afs.hdg_trk_managed = rtb_BusAssignment_m.logic.afs.hdg_trk_managed; + FcuComputer_Y.out.logic.afs.hdg_trk_selected = rtb_BusAssignment_m.logic.afs.hdg_trk_selected; + FcuComputer_Y.out.logic.afs.hdg_trk_display_value = FcuComputer_DWork.pValue_e; + FcuComputer_Y.out.logic.afs.hdg_trk_dashes = FcuComputer_DWork.Delay_DSTATE; + FcuComputer_Y.out.logic.afs.hdg_trk_preset_available = rtb_BusAssignment_m.logic.afs.hdg_trk_preset_available; + FcuComputer_Y.out.logic.afs.alt_display_value = FcuComputer_DWork.pValue_a; + FcuComputer_Y.out.logic.afs.lvl_ch_managed = rtb_BusAssignment_m.logic.afs.lvl_ch_managed; + FcuComputer_Y.out.logic.afs.lvl_ch_vs_fpa = rtb_BusAssignment_m.logic.afs.lvl_ch_vs_fpa; + FcuComputer_Y.out.logic.afs.vs_fpa_display_value = FcuComputer_DWork.pValue; + FcuComputer_Y.out.logic.afs.vs_fpa_dashes = rtb_y_e; + FcuComputer_Y.out.logic.afs.exped_active = rtb_BusAssignment_m.logic.afs.exped_active; + FcuComputer_Y.out.logic.afs.loc_only_active = rtb_BusAssignment_m.logic.afs.loc_only_active; + FcuComputer_Y.out.logic.afs.appr_active = rtb_BusAssignment_m.logic.afs.appr_active; + FcuComputer_Y.out.logic.afs.hdg_trk_buttons = rtb_BusAssignment_m.logic.afs.hdg_trk_buttons; + FcuComputer_Y.out.logic.afs.spd_mach_buttons = rtb_BusAssignment_m.logic.afs.spd_mach_buttons; + FcuComputer_Y.out.logic.afs.alt_buttons = rtb_BusAssignment_m.logic.afs.alt_buttons; + FcuComputer_Y.out.logic.afs.vs_fpa_buttons = rtb_BusAssignment_m.logic.afs.vs_fpa_buttons; + FcuComputer_Y.out.logic.afs.loc_pushed = rtb_BusAssignment_m.logic.afs.loc_pushed; + FcuComputer_Y.out.logic.afs.exped_pushed = rtb_BusAssignment_m.logic.afs.exped_pushed; + FcuComputer_Y.out.logic.afs.appr_pushed = rtb_BusAssignment_m.logic.afs.appr_pushed; + FcuComputer_Y.out.logic.afs.spd_mach_switching_pushed = rtb_BusAssignment_m.logic.afs.spd_mach_switching_pushed; + FcuComputer_Y.out.logic.afs.lat_value_changed = rtb_Equal8; + FcuComputer_Y.out.logic.afs.alt_value_changed = rtb_Equal7; + FcuComputer_Y.out.logic.afs.vpath_value_changed = rtb_Equal6; + FcuComputer_Y.out.logic.afs.spd_mach_value_changed = rtb_OR3_j; + FcuComputer_Y.out.logic.capt_efis = rtb_BusAssignment_m.logic.capt_efis; + FcuComputer_Y.out.logic.fo_efis = rtb_BusAssignment_m.logic.fo_efis; + FcuComputer_Y.out.discrete_outputs.capt_efis_outputs.fd_light_on = rtb_BusAssignment_m.logic.capt_efis.fd_on; + FcuComputer_Y.out.discrete_outputs.capt_efis_outputs.ls_light_on = rtb_BusAssignment_m.logic.capt_efis.ls_on; + FcuComputer_Y.out.discrete_outputs.capt_efis_outputs.cstr_light_on = + (rtb_BusAssignment_m.logic.capt_efis.efis_filter == FcuComputer_P.EnumeratedConstant7_Value); + FcuComputer_Y.out.discrete_outputs.capt_efis_outputs.wpt_light_on = (rtb_BusAssignment_m.logic.capt_efis.efis_filter + == FcuComputer_P.EnumeratedConstant6_Value); + FcuComputer_Y.out.discrete_outputs.capt_efis_outputs.vord_light_on = + (rtb_BusAssignment_m.logic.capt_efis.efis_filter == FcuComputer_P.EnumeratedConstant8_Value); + FcuComputer_Y.out.discrete_outputs.capt_efis_outputs.ndb_light_on = (rtb_BusAssignment_m.logic.capt_efis.efis_filter + == FcuComputer_P.EnumeratedConstant9_Value); + FcuComputer_Y.out.discrete_outputs.capt_efis_outputs.arpt_light_on = + (rtb_BusAssignment_m.logic.capt_efis.efis_filter == FcuComputer_P.EnumeratedConstant10_Value); + FcuComputer_Y.out.discrete_outputs.capt_efis_outputs.baro_value_mode = rtb_capt_efis_outputs_baro_value_mode; + FcuComputer_Y.out.discrete_outputs.capt_efis_outputs.baro_value = rtb_capt_efis_outputs_baro_value; + FcuComputer_Y.out.discrete_outputs.capt_efis_outputs.baro_mode = rtb_capt_efis_outputs_baro_mode; + FcuComputer_Y.out.discrete_outputs.fo_efis_outputs.fd_light_on = rtb_BusAssignment_m.logic.fo_efis.fd_on; + FcuComputer_Y.out.discrete_outputs.fo_efis_outputs.ls_light_on = rtb_BusAssignment_m.logic.fo_efis.ls_on; + FcuComputer_Y.out.discrete_outputs.fo_efis_outputs.cstr_light_on = (rtb_efisFilter == + FcuComputer_P.EnumeratedConstant7_Value_b); + FcuComputer_Y.out.discrete_outputs.fo_efis_outputs.wpt_light_on = (rtb_efisFilter == + FcuComputer_P.EnumeratedConstant6_Value_m); + FcuComputer_Y.out.discrete_outputs.fo_efis_outputs.vord_light_on = (rtb_efisFilter == + FcuComputer_P.EnumeratedConstant8_Value_g); + FcuComputer_Y.out.discrete_outputs.fo_efis_outputs.ndb_light_on = (rtb_efisFilter == + FcuComputer_P.EnumeratedConstant9_Value_c); + FcuComputer_Y.out.discrete_outputs.fo_efis_outputs.arpt_light_on = (rtb_efisFilter == + FcuComputer_P.EnumeratedConstant10_Value_m); + FcuComputer_Y.out.discrete_outputs.fo_efis_outputs.baro_value_mode = rtb_baroValueMode; + FcuComputer_Y.out.discrete_outputs.fo_efis_outputs.baro_value = + rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_fo_efis_outputs_baro_value; + FcuComputer_Y.out.discrete_outputs.fo_efis_outputs.baro_mode = rtb_baroMode; + FcuComputer_Y.out.discrete_outputs.afs_outputs.loc_light_on = rtb_BusAssignment_m.logic.afs.loc_only_active; + FcuComputer_Y.out.discrete_outputs.afs_outputs.exped_light_on = rtb_BusAssignment_m.logic.afs.exped_active; + FcuComputer_Y.out.discrete_outputs.afs_outputs.appr_light_on = rtb_BusAssignment_m.logic.afs.appr_active; + FcuComputer_Y.out.discrete_outputs.afs_outputs.ap_1_light_on = FcuComputer_U.in.discrete_inputs.ap_1_engaged; + FcuComputer_Y.out.discrete_outputs.afs_outputs.ap_2_light_on = FcuComputer_U.in.discrete_inputs.ap_2_engaged; + FcuComputer_Y.out.discrete_outputs.afs_outputs.athr_light_on = (FcuComputer_U.in.discrete_inputs.athr_1_engaged || + FcuComputer_U.in.discrete_inputs.athr_2_engaged); + FcuComputer_Y.out.discrete_outputs.afs_outputs.trk_fpa_mode = FcuComputer_DWork.p_trk_fpa_active; + FcuComputer_Y.out.discrete_outputs.afs_outputs.mach_mode = FcuComputer_P.Constant15_Value; + FcuComputer_Y.out.discrete_outputs.afs_outputs.spd_mach_value = FcuComputer_DWork.pValue_g; + FcuComputer_Y.out.discrete_outputs.afs_outputs.spd_mach_dashes = rtb_BusAssignment_m.logic.afs.spd_mach_dashes; + FcuComputer_Y.out.discrete_outputs.afs_outputs.spd_mach_managed = rtb_AND_g; + FcuComputer_Y.out.discrete_outputs.afs_outputs.hdg_trk_value = FcuComputer_DWork.pValue_e; + FcuComputer_Y.out.discrete_outputs.afs_outputs.hdg_trk_dashes = FcuComputer_DWork.Delay_DSTATE; + FcuComputer_Y.out.discrete_outputs.afs_outputs.hdg_trk_managed = rtb_BusAssignment_m.logic.afs.hdg_trk_managed; + FcuComputer_Y.out.discrete_outputs.afs_outputs.alt_value = FcuComputer_DWork.pValue_a; + FcuComputer_Y.out.discrete_outputs.afs_outputs.lvl_ch_managed = rtb_BusAssignment_m.logic.afs.lvl_ch_managed; + FcuComputer_Y.out.discrete_outputs.afs_outputs.vs_fpa_value = FcuComputer_DWork.pValue; + FcuComputer_Y.out.discrete_outputs.afs_outputs.vs_fpa_dashes = rtb_y_e; + FcuComputer_Y.out.discrete_outputs.fcu_healthy = FcuComputer_P.Constant1_Value_i; + if (FcuComputer_DWork.Delay_DSTATE || FcuComputer_DWork.p_trk_fpa_active) { + FcuComputer_Y.out.bus_outputs.selected_hdg_deg.SSM = static_cast(FcuComputer_P.EnumeratedConstant_Value); + } else { + FcuComputer_Y.out.bus_outputs.selected_hdg_deg.SSM = static_cast(FcuComputer_P.EnumeratedConstant1_Value); + } + + FcuComputer_Y.out.bus_outputs.selected_hdg_deg.Data = FcuComputer_DWork.pValue_e; + FcuComputer_Y.out.bus_outputs.selected_alt_ft.SSM = static_cast(FcuComputer_P.EnumeratedConstant1_Value); + FcuComputer_Y.out.bus_outputs.selected_alt_ft.Data = FcuComputer_DWork.pValue_a; + if (rtb_BusAssignment_m.logic.afs.spd_mach_dashes || FcuComputer_P.Constant1_Value_d) { + FcuComputer_Y.out.bus_outputs.selected_spd_kts.SSM = static_cast(FcuComputer_P.EnumeratedConstant_Value); + } else { + FcuComputer_Y.out.bus_outputs.selected_spd_kts.SSM = static_cast(FcuComputer_P.EnumeratedConstant1_Value); + } + + FcuComputer_Y.out.bus_outputs.selected_spd_kts.Data = FcuComputer_DWork.pValue_g; + if (rtb_y_e || FcuComputer_DWork.p_trk_fpa_active) { + FcuComputer_Y.out.bus_outputs.selected_vz_ft_min.SSM = static_cast + (FcuComputer_P.EnumeratedConstant_Value); + } else { + FcuComputer_Y.out.bus_outputs.selected_vz_ft_min.SSM = static_cast + (FcuComputer_P.EnumeratedConstant1_Value); + } + + FcuComputer_Y.out.bus_outputs.selected_vz_ft_min.Data = FcuComputer_DWork.pValue; + if (rtb_BusAssignment_m.logic.afs.spd_mach_dashes || FcuComputer_P.Constant_Value) { + FcuComputer_Y.out.bus_outputs.selected_mach.SSM = static_cast(FcuComputer_P.EnumeratedConstant_Value); + } else { + FcuComputer_Y.out.bus_outputs.selected_mach.SSM = static_cast(FcuComputer_P.EnumeratedConstant1_Value); + } + + FcuComputer_Y.out.bus_outputs.selected_mach.Data = FcuComputer_DWork.pValue_g; + if (FcuComputer_DWork.Delay_DSTATE || rtb_DataTypeConversion_d) { + FcuComputer_Y.out.bus_outputs.selected_trk_deg.SSM = static_cast(FcuComputer_P.EnumeratedConstant_Value); + } else { + FcuComputer_Y.out.bus_outputs.selected_trk_deg.SSM = static_cast(FcuComputer_P.EnumeratedConstant1_Value); + } + + FcuComputer_Y.out.bus_outputs.selected_trk_deg.Data = FcuComputer_DWork.pValue_e; + if (rtb_y_e || rtb_DataTypeConversion_d) { + FcuComputer_Y.out.bus_outputs.selected_fpa_deg.SSM = static_cast(FcuComputer_P.EnumeratedConstant_Value); + } else { + FcuComputer_Y.out.bus_outputs.selected_fpa_deg.SSM = static_cast(FcuComputer_P.EnumeratedConstant1_Value); + } + + FcuComputer_Y.out.bus_outputs.selected_fpa_deg.Data = FcuComputer_DWork.pValue; + FcuComputer_Y.out.bus_outputs.ats_fma_discrete_word.SSM = rtb_Switch1_oa; + FcuComputer_Y.out.bus_outputs.ats_fma_discrete_word.Data = rtb_y; + FcuComputer_Y.out.bus_outputs.fcu_flex_to_temp_deg_c.SSM = rtb_Switch6_SSM; + FcuComputer_Y.out.bus_outputs.fcu_flex_to_temp_deg_c.Data = rtb_Switch6_Data; + FcuComputer_Y.out.bus_outputs.ats_discrete_word.SSM = rtb_Switch7_SSM; + FcuComputer_Y.out.bus_outputs.ats_discrete_word.Data = rtb_Switch7_Data; + FcuComputer_Y.out.bus_outputs.eis_discrete_word_1_left.SSM = static_cast + (FcuComputer_P.EnumeratedConstant1_Value); + FcuComputer_Y.out.bus_outputs.eis_discrete_word_1_left.Data = rtb_y_m; + FcuComputer_Y.out.bus_outputs.eis_discrete_word_1_right.SSM = static_cast + (FcuComputer_P.EnumeratedConstant1_Value); + FcuComputer_Y.out.bus_outputs.eis_discrete_word_1_right.Data = rtb_y_h; + FcuComputer_Y.out.bus_outputs.eis_discrete_word_2_left.SSM = static_cast + (FcuComputer_P.EnumeratedConstant1_Value); + FcuComputer_Y.out.bus_outputs.eis_discrete_word_2_left.Data = rtb_y_cy; + FcuComputer_Y.out.bus_outputs.eis_discrete_word_2_right.SSM = static_cast + (FcuComputer_P.EnumeratedConstant1_Value); + FcuComputer_Y.out.bus_outputs.eis_discrete_word_2_right.Data = rtb_y_b; + FcuComputer_Y.out.bus_outputs.baro_setting_left_hpa.SSM = static_cast + (FcuComputer_P.EnumeratedConstant1_Value); + FcuComputer_Y.out.bus_outputs.baro_setting_left_hpa.Data = rtb_BusAssignment_m.logic.capt_efis.baro_value_hpa; + FcuComputer_Y.out.bus_outputs.baro_setting_right_hpa.SSM = static_cast + (FcuComputer_P.EnumeratedConstant1_Value); + FcuComputer_Y.out.bus_outputs.baro_setting_right_hpa.Data = static_cast(rtb_DataTypeConversion3); + FcuComputer_Y.out.bus_outputs.baro_setting_left_inhg.SSM = static_cast + (FcuComputer_P.EnumeratedConstant1_Value); + FcuComputer_Y.out.bus_outputs.baro_setting_left_inhg.Data = rtb_BusAssignment_m.logic.capt_efis.baro_value_inhg; + FcuComputer_Y.out.bus_outputs.baro_setting_right_inhg.SSM = static_cast + (FcuComputer_P.EnumeratedConstant1_Value); + FcuComputer_Y.out.bus_outputs.baro_setting_right_inhg.Data = static_cast(rtb_DataTypeConversion2); + FcuComputer_Y.out.bus_outputs.fcu_discrete_word_2.SSM = static_cast + (FcuComputer_P.EnumeratedConstant1_Value); + FcuComputer_Y.out.bus_outputs.fcu_discrete_word_2.Data = rtb_y_f; + FcuComputer_Y.out.bus_outputs.fcu_discrete_word_1.SSM = static_cast + (FcuComputer_P.EnumeratedConstant1_Value); + FcuComputer_Y.out.bus_outputs.fcu_discrete_word_1.Data = rtb_y_gu; + FcuComputer_Y.out.bus_outputs.n1_cmd_percent.SSM = rtb_Switch4_b_SSM; + FcuComputer_Y.out.bus_outputs.n1_cmd_percent.Data = rtb_Switch4_b_Data; + FcuComputer_DWork.DelayInput1_DSTATE[0] = FcuComputer_DWork.pValue_e; + FcuComputer_DWork.DelayInput1_DSTATE[1] = FcuComputer_DWork.pValue_a; + FcuComputer_DWork.DelayInput1_DSTATE[2] = FcuComputer_DWork.pValue; + FcuComputer_DWork.DelayInput1_DSTATE[3] = FcuComputer_DWork.pValue_g; + } else { + FcuComputer_DWork.Runtime_MODE = false; + } +} + +void FcuComputer::initialize() +{ + FcuComputer_DWork.DelayInput1_DSTATE[0] = FcuComputer_P.DetectChange_vinit; + FcuComputer_DWork.DelayInput1_DSTATE[1] = FcuComputer_P.DetectChange_vinit; + FcuComputer_DWork.DelayInput1_DSTATE[2] = FcuComputer_P.DetectChange_vinit; + FcuComputer_DWork.DelayInput1_DSTATE[3] = FcuComputer_P.DetectChange_vinit; + FcuComputer_DWork.Delay_DSTATE = FcuComputer_P.Delay_InitialCondition; + FcuComputer_MATLABFunction_j_Init(&FcuComputer_DWork.sf_MATLABFunction_pr); + FcuComputer_MATLABFunction1_i_Init(&FcuComputer_DWork.sf_MATLABFunction1_h); + FcuComputer_MATLABFunction_j_Init(&FcuComputer_DWork.sf_MATLABFunction_jp); + FcuComputer_MATLABFunction1_i_Init(&FcuComputer_DWork.sf_MATLABFunction1_e3); + FcuComputer_Y.out = FcuComputer_P.out_Y0; +} + +void FcuComputer::terminate() +{ +} + +FcuComputer::FcuComputer(): + FcuComputer_U(), + FcuComputer_Y(), + FcuComputer_DWork() +{ +} + +FcuComputer::~FcuComputer() +{ +} diff --git a/fbw-a32nx/src/wasm/fbw_a320/src/model/FcuComputer.h b/fbw-a32nx/src/wasm/fbw_a320/src/model/FcuComputer.h new file mode 100644 index 000000000000..33a59b494b7a --- /dev/null +++ b/fbw-a32nx/src/wasm/fbw_a320/src/model/FcuComputer.h @@ -0,0 +1,381 @@ +#ifndef RTW_HEADER_FcuComputer_h_ +#define RTW_HEADER_FcuComputer_h_ +#include "rtwtypes.h" +#include "FcuComputer_types.h" + +class FcuComputer final +{ + public: + struct rtDW_MATLABFunction_FcuComputer_T { + real_T remainingTriggerTime; + boolean_T previousInput; + }; + + struct rtDW_MATLABFunction1_FcuComputer_T { + real_T eventTime; + boolean_T eventTime_not_empty; + }; + + struct rtDW_MATLABFunction_FcuComputer_e_T { + boolean_T previousInput; + boolean_T previousInput_not_empty; + }; + + struct rtDW_EFISFilterLogic_FcuComputer_T { + efis_filter_selection pEfisFilter; + }; + + struct rtDW_MATLABFunction_FcuComputer_b_T { + boolean_T std_active; + boolean_T qnh_active; + boolean_T qfe_active; + }; + + struct rtDW_MATLABFunction1_FcuComputer_b_T { + real_T pValueHpa; + real_T pValueInhg; + }; + + struct rtDW_MATLABFunction_FcuComputer_l_T { + boolean_T pY; + boolean_T pY_not_empty; + }; + + struct D_Work_FcuComputer_T { + real32_T DelayInput1_DSTATE[4]; + real32_T pValue; + real32_T pValue_g; + real32_T pValue_e; + real32_T pValue_a; + boolean_T Delay_DSTATE; + boolean_T pValue_not_empty; + boolean_T prevTrkFpaActive; + boolean_T prevTrkFpaActive_not_empty; + boolean_T p_metric_alt_active; + boolean_T p_trk_fpa_active; + boolean_T pValue_not_empty_i; + boolean_T prevMachActive; + boolean_T pValue_not_empty_o; + boolean_T prevTrkFpaActive_g; + boolean_T prevTrkFpaActive_not_empty_l; + boolean_T pValue_not_empty_g; + boolean_T Runtime_MODE; + rtDW_MATLABFunction_FcuComputer_e_T sf_MATLABFunction_je; + rtDW_MATLABFunction_FcuComputer_l_T sf_MATLABFunction_hk; + rtDW_MATLABFunction_FcuComputer_e_T sf_MATLABFunction_ja0; + rtDW_MATLABFunction_FcuComputer_l_T sf_MATLABFunction_ja; + rtDW_MATLABFunction_FcuComputer_e_T sf_MATLABFunction_gx; + rtDW_MATLABFunction_FcuComputer_e_T sf_MATLABFunction_ng; + rtDW_MATLABFunction1_FcuComputer_b_T sf_MATLABFunction1_e3; + rtDW_MATLABFunction_FcuComputer_b_T sf_MATLABFunction_jp; + rtDW_MATLABFunction_FcuComputer_e_T sf_MATLABFunction_cb; + rtDW_MATLABFunction_FcuComputer_e_T sf_MATLABFunction_df; + rtDW_MATLABFunction_FcuComputer_e_T sf_MATLABFunction_hlu; + rtDW_MATLABFunction_FcuComputer_e_T sf_MATLABFunction_ec; + rtDW_MATLABFunction_FcuComputer_e_T sf_MATLABFunction_fiq; + rtDW_EFISFilterLogic_FcuComputer_T sf_EFISFilterLogic_h; + rtDW_MATLABFunction_FcuComputer_e_T sf_MATLABFunction_jr; + rtDW_MATLABFunction_FcuComputer_l_T sf_MATLABFunction_kc; + rtDW_MATLABFunction_FcuComputer_e_T sf_MATLABFunction_ik; + rtDW_MATLABFunction_FcuComputer_l_T sf_MATLABFunction_mb; + rtDW_MATLABFunction_FcuComputer_e_T sf_MATLABFunction_b3; + rtDW_MATLABFunction_FcuComputer_e_T sf_MATLABFunction_hc; + rtDW_MATLABFunction1_FcuComputer_b_T sf_MATLABFunction1_h; + rtDW_MATLABFunction_FcuComputer_b_T sf_MATLABFunction_pr; + rtDW_MATLABFunction_FcuComputer_e_T sf_MATLABFunction_bpf; + rtDW_MATLABFunction_FcuComputer_e_T sf_MATLABFunction_gb; + rtDW_MATLABFunction_FcuComputer_e_T sf_MATLABFunction_id; + rtDW_MATLABFunction_FcuComputer_e_T sf_MATLABFunction_nz; + rtDW_MATLABFunction_FcuComputer_e_T sf_MATLABFunction_he; + rtDW_EFISFilterLogic_FcuComputer_T sf_EFISFilterLogic; + rtDW_MATLABFunction_FcuComputer_e_T sf_MATLABFunction_kw; + rtDW_MATLABFunction_FcuComputer_e_T sf_MATLABFunction_ch; + rtDW_MATLABFunction1_FcuComputer_T sf_MATLABFunction1_o; + rtDW_MATLABFunction_FcuComputer_e_T sf_MATLABFunction_ma; + rtDW_MATLABFunction_FcuComputer_e_T sf_MATLABFunction_a4; + rtDW_MATLABFunction_FcuComputer_e_T sf_MATLABFunction_kl; + rtDW_MATLABFunction1_FcuComputer_T sf_MATLABFunction1_p; + rtDW_MATLABFunction_FcuComputer_T sf_MATLABFunction_oi; + rtDW_MATLABFunction_FcuComputer_T sf_MATLABFunction_lh; + rtDW_MATLABFunction_FcuComputer_T sf_MATLABFunction_p5r; + rtDW_MATLABFunction_FcuComputer_T sf_MATLABFunction_av; + rtDW_MATLABFunction_FcuComputer_e_T sf_MATLABFunction_dc; + rtDW_MATLABFunction1_FcuComputer_T sf_MATLABFunction1; + rtDW_MATLABFunction_FcuComputer_T sf_MATLABFunction_g; + rtDW_MATLABFunction_FcuComputer_T sf_MATLABFunction_k0; + rtDW_MATLABFunction_FcuComputer_T sf_MATLABFunction_i; + rtDW_MATLABFunction_FcuComputer_T sf_MATLABFunction_d; + rtDW_MATLABFunction_FcuComputer_T sf_MATLABFunction_kh; + rtDW_MATLABFunction_FcuComputer_T sf_MATLABFunction_o; + rtDW_MATLABFunction_FcuComputer_T sf_MATLABFunction_a; + rtDW_MATLABFunction_FcuComputer_T sf_MATLABFunction_c; + rtDW_MATLABFunction_FcuComputer_T sf_MATLABFunction_f; + rtDW_MATLABFunction_FcuComputer_T sf_MATLABFunction_kr; + rtDW_MATLABFunction_FcuComputer_T sf_MATLABFunction_m; + rtDW_MATLABFunction_FcuComputer_T sf_MATLABFunction_l; + rtDW_MATLABFunction_FcuComputer_T sf_MATLABFunction_b; + rtDW_MATLABFunction_FcuComputer_T sf_MATLABFunction_n; + rtDW_MATLABFunction_FcuComputer_T sf_MATLABFunction_k; + rtDW_MATLABFunction_FcuComputer_T sf_MATLABFunction_e; + }; + + struct ExternalInputs_FcuComputer_T { + fcu_inputs in; + }; + + struct ExternalOutputs_FcuComputer_T { + fcu_outputs out; + }; + + struct Parameters_FcuComputer_T { + real_T BitfromLabel_bit; + real_T BitfromLabel1_bit; + real_T BitfromLabel4_bit; + real_T BitfromLabel3_bit; + real_T BitfromLabel6_bit; + real_T BitfromLabel5_bit; + real_T BitfromLabel8_bit; + real_T BitfromLabel7_bit; + real_T BitfromLabel9_bit; + real_T BitfromLabel10_bit; + real_T BitfromLabel2_bit; + real_T BitfromLabel1_bit_l; + real_T BitfromLabel2_bit_l; + real_T BitfromLabel12_bit; + real_T BitfromLabel11_bit; + real_T BitfromLabel4_bit_n; + real_T BitfromLabel3_bit_p; + real_T BitfromLabel17_bit; + real_T BitfromLabel16_bit; + real_T BitfromLabel15_bit; + real_T BitfromLabel14_bit; + real_T BitfromLabel13_bit; + real_T BitfromLabel9_bit_i; + real_T BitfromLabel6_bit_n; + real_T BitfromLabel5_bit_f; + real_T BitfromLabel8_bit_h; + real_T BitfromLabel7_bit_j; + real_T BitfromLabel10_bit_c; + real_T BitfromLabel2_bit_a; + real_T BitfromLabel1_bit_m; + real_T BitfromLabel6_bit_b; + real_T BitfromLabel1_bit_i; + real_T BitfromLabel2_bit_g; + real_T BitfromLabel5_bit_p; + real_T BitfromLabel4_bit_o; + real_T BitfromLabel3_bit_f; + real_T MTrigNode_isRisingEdge; + real_T MTrigNode1_isRisingEdge; + real_T MTrigNode2_isRisingEdge; + real_T MTrigNode_isRisingEdge_a; + real_T MTrigNode1_isRisingEdge_j; + real_T MTrigNode2_isRisingEdge_j; + real_T MTrigNode_isRisingEdge_k; + real_T MTrigNode1_isRisingEdge_o; + real_T MTrigNode2_isRisingEdge_h; + real_T MTrigNode_isRisingEdge_d; + real_T MTrigNode1_isRisingEdge_c; + real_T MTrigNode2_isRisingEdge_hx; + real_T MTrigNode_isRisingEdge_c; + real_T MTrigNode1_isRisingEdge_a; + real_T MTrigNode2_isRisingEdge_p; + real_T MTrigNode3_isRisingEdge; + real_T MTrigNode_isRisingEdge_i; + real_T MTrigNode1_isRisingEdge_m; + real_T MTrigNode2_isRisingEdge_hp; + real_T MTrigNode3_isRisingEdge_j; + real_T MTrigNode_retriggerable; + real_T MTrigNode1_retriggerable; + real_T MTrigNode2_retriggerable; + real_T MTrigNode_retriggerable_f; + real_T MTrigNode1_retriggerable_d; + real_T MTrigNode2_retriggerable_i; + real_T MTrigNode_retriggerable_h; + real_T MTrigNode1_retriggerable_j; + real_T MTrigNode2_retriggerable_h; + real_T MTrigNode_retriggerable_g; + real_T MTrigNode1_retriggerable_l; + real_T MTrigNode2_retriggerable_g; + real_T MTrigNode_retriggerable_i; + real_T MTrigNode1_retriggerable_ls; + real_T MTrigNode2_retriggerable_c; + real_T MTrigNode3_retriggerable; + real_T MTrigNode_retriggerable_k; + real_T MTrigNode1_retriggerable_p; + real_T MTrigNode2_retriggerable_k; + real_T MTrigNode3_retriggerable_a; + real_T KnobMtrigProcessing_triggerDuration; + real_T KnobMtrigProcessing1_triggerDuration; + real_T KnobMtrigProcessing2_triggerDuration; + real_T KnobMtrigProcessing3_triggerDuration; + real_T MTrigNode_triggerDuration; + real_T MTrigNode1_triggerDuration; + real_T MTrigNode2_triggerDuration; + real_T MTrigNode3_triggerDuration; + real_T MTrigNode_triggerDuration_m; + real_T MTrigNode1_triggerDuration_h; + real_T MTrigNode2_triggerDuration_a; + real_T MTrigNode3_triggerDuration_h; + SignStatusMatrix EnumeratedConstant_Value; + SignStatusMatrix EnumeratedConstant1_Value; + efis_filter_selection EnumeratedConstant7_Value; + efis_filter_selection EnumeratedConstant6_Value; + efis_filter_selection EnumeratedConstant8_Value; + efis_filter_selection EnumeratedConstant9_Value; + efis_filter_selection EnumeratedConstant10_Value; + efis_filter_selection EnumeratedConstant7_Value_b; + efis_filter_selection EnumeratedConstant6_Value_m; + efis_filter_selection EnumeratedConstant8_Value_g; + efis_filter_selection EnumeratedConstant9_Value_c; + efis_filter_selection EnumeratedConstant10_Value_m; + efis_filter_selection EnumeratedConstant7_Value_k; + efis_filter_selection EnumeratedConstant6_Value_l; + efis_filter_selection EnumeratedConstant8_Value_a; + efis_filter_selection EnumeratedConstant9_Value_g; + efis_filter_selection EnumeratedConstant10_Value_b; + efis_filter_selection EnumeratedConstant7_Value_a; + efis_filter_selection EnumeratedConstant6_Value_l4; + efis_filter_selection EnumeratedConstant8_Value_p; + efis_filter_selection EnumeratedConstant9_Value_o; + efis_filter_selection EnumeratedConstant10_Value_e; + efis_mode_selection EnumeratedConstant2_Value; + efis_mode_selection EnumeratedConstant1_Value_b; + efis_mode_selection EnumeratedConstant3_Value; + efis_mode_selection EnumeratedConstant4_Value; + efis_mode_selection EnumeratedConstant5_Value; + efis_mode_selection EnumeratedConstant2_Value_a; + efis_mode_selection EnumeratedConstant1_Value_m; + efis_mode_selection EnumeratedConstant3_Value_l; + efis_mode_selection EnumeratedConstant4_Value_b; + efis_mode_selection EnumeratedConstant5_Value_e; + efis_navaid_selection EnumeratedConstant12_Value; + efis_navaid_selection EnumeratedConstant11_Value; + efis_navaid_selection EnumeratedConstant12_Value_a; + efis_navaid_selection EnumeratedConstant11_Value_o; + efis_range_selection EnumeratedConstant2_Value_g; + efis_range_selection EnumeratedConstant1_Value_h; + efis_range_selection EnumeratedConstant3_Value_i; + efis_range_selection EnumeratedConstant4_Value_n; + efis_range_selection EnumeratedConstant5_Value_a; + efis_range_selection EnumeratedConstant2_Value_l; + efis_range_selection EnumeratedConstant1_Value_n; + efis_range_selection EnumeratedConstant3_Value_e; + efis_range_selection EnumeratedConstant4_Value_i; + efis_range_selection EnumeratedConstant5_Value_k; + real32_T A429ValueOrDefault_defaultValue; + real32_T A429ValueOrDefault1_defaultValue; + real32_T A429ValueOrDefault2_defaultValue; + real32_T A429ValueOrDefault3_defaultValue; + real32_T A429ValueOrDefault4_defaultValue; + real32_T A429ValueOrDefault5_defaultValue; + real32_T A429ValueOrDefault6_defaultValue; + real32_T DetectChange_vinit; + boolean_T TFlipFlop_init; + boolean_T TFlipFlop1_init; + boolean_T TFlipFlop_init_f; + boolean_T TFlipFlop1_init_a; + boolean_T PulseNode_isRisingEdge; + boolean_T PulseNode1_isRisingEdge; + boolean_T PulseNode2_isRisingEdge; + boolean_T PulseNode3_isRisingEdge; + boolean_T PulseNode4_isRisingEdge; + boolean_T PulseNode_isRisingEdge_n; + boolean_T PulseNode_isRisingEdge_nj; + boolean_T PulseNode_isRisingEdge_a; + boolean_T PulseNode1_isRisingEdge_h; + boolean_T PulseNode_isRisingEdge_m; + boolean_T PulseNode1_isRisingEdge_k; + boolean_T PulseNode2_isRisingEdge_a; + boolean_T PulseNode3_isRisingEdge_g; + boolean_T PulseNode4_isRisingEdge_a; + boolean_T PulseNode_isRisingEdge_i; + boolean_T PulseNode_isRisingEdge_h; + boolean_T PulseNode_isRisingEdge_o; + boolean_T PulseNode1_isRisingEdge_f; + boolean_T PulseNode_isRisingEdge_oa; + boolean_T PulseNode1_isRisingEdge_ke; + boolean_T PulseNode_isRisingEdge_l; + boolean_T PulseNode_isRisingEdge_hz; + boolean_T PulseNode1_isRisingEdge_e; + boolean_T PulseNode_isRisingEdge_d; + int8_T CompareToConstant_const; + int8_T CompareToConstant_const_p; + int8_T CompareToConstant_const_pg; + int8_T CompareToConstant_const_e; + int8_T CompareToConstant_const_p0; + int8_T CompareToConstant_const_es; + int8_T CompareToConstant_const_o; + fcu_outputs out_Y0; + base_fcu_bus Constant2_Value; + base_fcu_logic_outputs Constant1_Value; + base_fcu_discrete_outputs Constant3_Value; + boolean_T Delay_InitialCondition; + boolean_T Constant15_Value; + boolean_T Constant1_Value_i; + boolean_T Constant1_Value_d; + boolean_T Constant_Value; + boolean_T Constant10_Value; + boolean_T Constant10_Value_a; + boolean_T Constant10_Value_p; + boolean_T Constant10_Value_e; + boolean_T Constant19_Value; + boolean_T Constant20_Value; + }; + + FcuComputer(FcuComputer const&) = delete; + FcuComputer& operator= (FcuComputer const&) & = delete; + FcuComputer(FcuComputer &&) = delete; + FcuComputer& operator= (FcuComputer &&) = delete; + void setExternalInputs(const ExternalInputs_FcuComputer_T *pExternalInputs_FcuComputer_T) + { + FcuComputer_U = *pExternalInputs_FcuComputer_T; + } + + const ExternalOutputs_FcuComputer_T &getExternalOutputs() const + { + return FcuComputer_Y; + } + + void initialize(); + void step(); + static void terminate(); + FcuComputer(); + ~FcuComputer(); + private: + ExternalInputs_FcuComputer_T FcuComputer_U; + ExternalOutputs_FcuComputer_T FcuComputer_Y; + D_Work_FcuComputer_T FcuComputer_DWork; + static Parameters_FcuComputer_T FcuComputer_P; + static void FcuComputer_MATLABFunction_Reset(rtDW_MATLABFunction_FcuComputer_T *localDW); + static void FcuComputer_MATLABFunction(boolean_T rtu_u, real_T rtu_Ts, boolean_T *rty_y, real_T rtp_isRisingEdge, + real_T rtp_retriggerable, real_T rtp_triggerDuration, rtDW_MATLABFunction_FcuComputer_T *localDW); + static void FcuComputer_MATLABFunction_i(const base_arinc_429 *rtu_u, real32_T rtu_default, real32_T *rty_y); + static void FcuComputer_MATLABFunction1_Reset(rtDW_MATLABFunction1_FcuComputer_T *localDW); + static void FcuComputer_MATLABFunction1(const fcu_outputs *rtu_in, boolean_T rtu_set_dashes, boolean_T + rtu_set_selection, boolean_T *rty_dashes, rtDW_MATLABFunction1_FcuComputer_T *localDW); + static void FcuComputer_MATLABFunction_o_Reset(rtDW_MATLABFunction_FcuComputer_e_T *localDW); + static void FcuComputer_MATLABFunction_d(boolean_T rtu_u, boolean_T rtu_isRisingEdge, boolean_T *rty_y, + rtDW_MATLABFunction_FcuComputer_e_T *localDW); + static void FcuComputer_MATLABFunction_m(const base_arinc_429 *rtu_u, boolean_T *rty_y); + static void FcuComputer_MATLABFunction_a(const base_arinc_429 *rtu_u, real_T rtu_bit, uint32_T *rty_y); + static void FcuComputer_EFISFilterLogic_Reset(rtDW_EFISFilterLogic_FcuComputer_T *localDW); + static void FcuComputer_EFISFilterLogic(boolean_T rtu_cstr, boolean_T rtu_wpt, boolean_T rtu_vord, boolean_T rtu_ndb, + boolean_T rtu_arpt, efis_filter_selection *rty_efisFilter, rtDW_EFISFilterLogic_FcuComputer_T *localDW); + static void FcuComputer_MATLABFunction_j_Init(rtDW_MATLABFunction_FcuComputer_b_T *localDW); + static void FcuComputer_MATLABFunction_a_Reset(rtDW_MATLABFunction_FcuComputer_b_T *localDW); + static void FcuComputer_MATLABFunction_p(boolean_T rtu_knob_push, boolean_T rtu_knob_pull, boolean_T *rty_std, + boolean_T *rty_qnh, boolean_T *rty_qfe, rtDW_MATLABFunction_FcuComputer_b_T *localDW); + static void FcuComputer_MATLABFunction1_i_Init(rtDW_MATLABFunction1_FcuComputer_b_T *localDW); + static void FcuComputer_MATLABFunction1_c_Reset(rtDW_MATLABFunction1_FcuComputer_b_T *localDW); + static void FcuComputer_MATLABFunction1_h(boolean_T rtu_std_active, boolean_T rtu_inhg_active, real_T rtu_click_count, + real_T *rty_value_hpa, real_T *rty_value_inhg, rtDW_MATLABFunction1_FcuComputer_b_T *localDW); + static void FcuComputer_MATLABFunction_i_Reset(rtDW_MATLABFunction_FcuComputer_l_T *localDW); + static void FcuComputer_MATLABFunction_mb(boolean_T rtu_u, boolean_T *rty_y, boolean_T rtp_init, + rtDW_MATLABFunction_FcuComputer_l_T *localDW); + static void FcuComputer_MATLABFunction_e(const boolean_T rtu_u[19], real32_T *rty_y); + static void FcuComputer_MATLABFunction_n(const base_fcu_efis_logic_outputs *rtu_logic, const + base_fcu_efis_panel_inputs *rtu_data, int8_T *rty_baroValueMode, real32_T *rty_baroValue, int8_T *rty_baroMode); +}; + +#endif + diff --git a/fbw-a32nx/src/wasm/fbw_a320/src/model/FcuComputer_data.cpp b/fbw-a32nx/src/wasm/fbw_a320/src/model/FcuComputer_data.cpp new file mode 100644 index 000000000000..fe7a92e08f21 --- /dev/null +++ b/fbw-a32nx/src/wasm/fbw_a320/src/model/FcuComputer_data.cpp @@ -0,0 +1,1318 @@ +#include "FcuComputer.h" + +FcuComputer::Parameters_FcuComputer_T FcuComputer::FcuComputer_P{ + + 19.0, + + 20.0, + + 14.0, + + 16.0, + + 11.0, + + 12.0, + + 13.0, + + 14.0, + + 15.0, + + 14.0, + + 16.0, + + 17.0, + + 11.0, + + 22.0, + + 23.0, + + 24.0, + + 25.0, + + 19.0, + + 11.0, + + 12.0, + + 13.0, + + 14.0, + + 24.0, + + 15.0, + + 16.0, + + 22.0, + + 23.0, + + 14.0, + + 17.0, + + 18.0, + + 24.0, + + 14.0, + + 20.0, + + 13.0, + + 14.0, + + 16.0, + + 1.0, + + 1.0, + + 1.0, + + 1.0, + + 1.0, + + 1.0, + + 1.0, + + 1.0, + + 1.0, + + 1.0, + + 1.0, + + 1.0, + + 1.0, + + 1.0, + + 1.0, + + 1.0, + + 1.0, + + 1.0, + + 1.0, + + 1.0, + + 0.0, + + 0.0, + + 0.0, + + 0.0, + + 0.0, + + 0.0, + + 0.0, + + 0.0, + + 0.0, + + 0.0, + + 0.0, + + 0.0, + + 0.0, + + 0.0, + + 0.0, + + 0.0, + + 0.0, + + 0.0, + + 0.0, + + 0.0, + + 0.1, + + 0.1, + + 0.1, + + 0.1, + + 0.1, + + 0.1, + + 0.1, + + 0.1, + + 0.5, + + 0.5, + + 0.5, + + 0.5, + + SignStatusMatrix::NoComputedData, + + SignStatusMatrix::NormalOperation, + + efis_filter_selection::CSTR, + + efis_filter_selection::WPT, + + efis_filter_selection::VORD, + + efis_filter_selection::NDB, + + efis_filter_selection::ARPT, + + efis_filter_selection::CSTR, + + efis_filter_selection::WPT, + + efis_filter_selection::VORD, + + efis_filter_selection::NDB, + + efis_filter_selection::ARPT, + + efis_filter_selection::CSTR, + + efis_filter_selection::WPT, + + efis_filter_selection::VORD, + + efis_filter_selection::NDB, + + efis_filter_selection::ARPT, + + efis_filter_selection::CSTR, + + efis_filter_selection::WPT, + + efis_filter_selection::VORD, + + efis_filter_selection::NDB, + + efis_filter_selection::ARPT, + + efis_mode_selection::PLAN, + + efis_mode_selection::ARC, + + efis_mode_selection::ROSE_NAV, + + efis_mode_selection::ROSE_VOR, + + efis_mode_selection::ROSE_ILS, + + efis_mode_selection::PLAN, + + efis_mode_selection::ARC, + + efis_mode_selection::ROSE_NAV, + + efis_mode_selection::ROSE_VOR, + + efis_mode_selection::ROSE_ILS, + + efis_navaid_selection::ADF, + + efis_navaid_selection::VOR, + + efis_navaid_selection::ADF, + + efis_navaid_selection::VOR, + + efis_range_selection::RANGE_10, + + efis_range_selection::RANGE_20, + + efis_range_selection::RANGE_40, + + efis_range_selection::RANGE_80, + + efis_range_selection::RANGE_160, + + efis_range_selection::RANGE_10, + + efis_range_selection::RANGE_20, + + efis_range_selection::RANGE_40, + + efis_range_selection::RANGE_80, + + efis_range_selection::RANGE_160, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + true, + + false, + + true, + + false, + + true, + + true, + + true, + + true, + + true, + + true, + + true, + + true, + + true, + + true, + + true, + + true, + + true, + + true, + + true, + + true, + + true, + + true, + + true, + + true, + + true, + + true, + + true, + + true, + + 0, + + 0, + + 0, + + 0, + + 0, + + 0, + + 0, + + + { + { + { + 0.0, + 0.0, + 0.0 + }, + + { + false, + false, + false, + false, + false + }, + + { + false, + false, + false, + false, + false, + false, + false, + + { + efis_range_selection::RANGE_10, + efis_mode_selection::ROSE_ILS, + efis_navaid_selection::NONE, + efis_navaid_selection::NONE, + false, + + { + false, + false, + 0 + }, + false, + false, + false, + false, + false, + false, + false + }, + + { + efis_range_selection::RANGE_10, + efis_mode_selection::ROSE_ILS, + efis_navaid_selection::NONE, + efis_navaid_selection::NONE, + false, + + { + false, + false, + 0 + }, + false, + false, + false, + false, + false, + false, + false + }, + + { + false, + false, + false, + false, + false, + false, + + { + false, + false, + 0 + }, + + { + false, + false, + 0 + }, + + { + false, + false, + 0 + }, + false, + + { + false, + false, + 0 + } + } + }, + + { + { + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + } + }, + + { + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + } + } + } + }, + + { + { + false, + + { + 0.0F, + 0.0F, + 0.0F, + 0.0F, + 0.0F, + 0.0F, + 0.0F + }, + false, + false, + false, + false, + false, + 0.0F, + false, + false, + false, + 0.0F, + false, + false, + 0.0F, + false, + false, + 0.0F, + false, + false, + false, + false, + + { + false, + false, + 0 + }, + + { + false, + false, + 0 + }, + + { + false, + false, + 0 + }, + + { + false, + false, + 0 + }, + false, + false, + false, + false, + false, + false, + false, + false + }, + + { + false, + false, + efis_filter_selection::NONE, + false, + false, + false, + 0.0F, + 0.0F + }, + + { + false, + false, + efis_filter_selection::NONE, + false, + false, + false, + 0.0F, + 0.0F + } + }, + + { + { + false, + false, + false, + false, + false, + false, + false, + 0, + 0.0F, + 0 + }, + + { + false, + false, + false, + false, + false, + false, + false, + 0, + 0.0F, + 0 + }, + + { + false, + false, + false, + false, + false, + false, + false, + false, + 0.0, + false, + false, + 0.0, + false, + false, + 0.0, + false, + 0.0, + false + }, + false + }, + + { + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + } + } + }, + + + { + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + } + }, + + + { + { + false, + + { + 0.0F, + 0.0F, + 0.0F, + 0.0F, + 0.0F, + 0.0F, + 0.0F + }, + false, + false, + false, + false, + false, + 0.0F, + false, + false, + false, + 0.0F, + false, + false, + 0.0F, + false, + false, + 0.0F, + false, + false, + false, + false, + + { + false, + false, + 0 + }, + + { + false, + false, + 0 + }, + + { + false, + false, + 0 + }, + + { + false, + false, + 0 + }, + false, + false, + false, + false, + false, + false, + false, + false + }, + + { + false, + false, + efis_filter_selection::NONE, + false, + false, + false, + 0.0F, + 0.0F + }, + + { + false, + false, + efis_filter_selection::NONE, + false, + false, + false, + 0.0F, + 0.0F + } + }, + + + { + { + false, + false, + false, + false, + false, + false, + false, + 0, + 0.0F, + 0 + }, + + { + false, + false, + false, + false, + false, + false, + false, + 0, + 0.0F, + 0 + }, + + { + false, + false, + false, + false, + false, + false, + false, + false, + 0.0, + false, + false, + 0.0, + false, + false, + 0.0, + false, + 0.0, + false + }, + false + }, + + false, + + false, + + true, + + false, + + true, + + false, + + false, + + false, + + false, + + false, + + false +}; diff --git a/fbw-a32nx/src/wasm/fbw_a320/src/model/FcuComputer_private.h b/fbw-a32nx/src/wasm/fbw_a320/src/model/FcuComputer_private.h new file mode 100644 index 000000000000..e8557fcc6825 --- /dev/null +++ b/fbw-a32nx/src/wasm/fbw_a320/src/model/FcuComputer_private.h @@ -0,0 +1,5 @@ +#ifndef RTW_HEADER_FcuComputer_private_h_ +#define RTW_HEADER_FcuComputer_private_h_ +#include "rtwtypes.h" +#endif + diff --git a/fbw-a32nx/src/wasm/fbw_a320/src/model/FcuComputer_types.h b/fbw-a32nx/src/wasm/fbw_a320/src/model/FcuComputer_types.h new file mode 100644 index 000000000000..fe9ba4642404 --- /dev/null +++ b/fbw-a32nx/src/wasm/fbw_a320/src/model/FcuComputer_types.h @@ -0,0 +1,613 @@ +#ifndef RTW_HEADER_FcuComputer_types_h_ +#define RTW_HEADER_FcuComputer_types_h_ +#include "rtwtypes.h" + +#ifndef DEFINED_TYPEDEF_FOR_efis_range_selection_ +#define DEFINED_TYPEDEF_FOR_efis_range_selection_ + +enum class efis_range_selection + : int32_T { + RANGE_10 = 0, + RANGE_20, + RANGE_40, + RANGE_80, + RANGE_160, + RANGE_320 +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_efis_mode_selection_ +#define DEFINED_TYPEDEF_FOR_efis_mode_selection_ + +enum class efis_mode_selection + : int32_T { + ROSE_ILS = 0, + ROSE_VOR, + ROSE_NAV, + ARC, + PLAN +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_efis_filter_selection_ +#define DEFINED_TYPEDEF_FOR_efis_filter_selection_ + +enum class efis_filter_selection + : int32_T { + NONE = 0, + CSTR, + WPT, + VORD, + NDB, + ARPT +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_efis_navaid_selection_ +#define DEFINED_TYPEDEF_FOR_efis_navaid_selection_ + +enum class efis_navaid_selection + : int32_T { + NONE = 0, + VOR, + ADF +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_SignStatusMatrix_ +#define DEFINED_TYPEDEF_FOR_SignStatusMatrix_ + +enum class SignStatusMatrix + : int32_T { + FailureWarning = 0, + NoComputedData, + FunctionalTest, + NormalOperation +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_fcu_knob_inputs_ +#define DEFINED_TYPEDEF_FOR_base_fcu_knob_inputs_ + +struct base_fcu_knob_inputs +{ + boolean_T pushed; + boolean_T pulled; + int8_T turns; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_time_ +#define DEFINED_TYPEDEF_FOR_base_time_ + +struct base_time +{ + real_T dt; + real_T simulation_time; + real_T monotonic_time; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_sim_data_ +#define DEFINED_TYPEDEF_FOR_base_sim_data_ + +struct base_sim_data +{ + boolean_T slew_on; + boolean_T pause_on; + boolean_T tracking_mode_on_override; + boolean_T tailstrike_protection_on; + boolean_T computer_running; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_fcu_efis_panel_inputs_ +#define DEFINED_TYPEDEF_FOR_base_fcu_efis_panel_inputs_ + +struct base_fcu_efis_panel_inputs +{ + efis_range_selection efis_range; + efis_mode_selection efis_mode; + efis_navaid_selection efis_navaid_1; + efis_navaid_selection efis_navaid_2; + boolean_T baro_is_inhg; + base_fcu_knob_inputs baro_knob; + boolean_T fd_button_pushed; + boolean_T ls_button_pushed; + boolean_T cstr_button_pushed; + boolean_T wpt_button_pushed; + boolean_T vord_button_pushed; + boolean_T ndb_button_pushed; + boolean_T arpt_button_pushed; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_fcu_afs_panel_inputs_ +#define DEFINED_TYPEDEF_FOR_base_fcu_afs_panel_inputs_ + +struct base_fcu_afs_panel_inputs +{ + boolean_T loc_button_pressed; + boolean_T exped_button_pressed; + boolean_T appr_button_pressed; + boolean_T spd_mach_button_pressed; + boolean_T trk_fpa_button_pressed; + boolean_T metric_alt_button_pressed; + base_fcu_knob_inputs spd_knob; + base_fcu_knob_inputs hdg_trk_knob; + base_fcu_knob_inputs alt_knob; + boolean_T alt_increment_1000; + base_fcu_knob_inputs vs_fpa_knob; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_fcu_discrete_inputs_ +#define DEFINED_TYPEDEF_FOR_base_fcu_discrete_inputs_ + +struct base_fcu_discrete_inputs +{ + boolean_T ap_1_engaged; + boolean_T fd_1_engaged; + boolean_T athr_1_engaged; + boolean_T ap_2_engaged; + boolean_T fd_2_engaged; + boolean_T athr_2_engaged; + boolean_T lights_test; + base_fcu_efis_panel_inputs capt_efis_inputs; + base_fcu_efis_panel_inputs fo_efis_inputs; + base_fcu_afs_panel_inputs afs_inputs; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_arinc_429_ +#define DEFINED_TYPEDEF_FOR_base_arinc_429_ + +struct base_arinc_429 +{ + uint32_T SSM; + real32_T Data; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_fmgc_a_bus_ +#define DEFINED_TYPEDEF_FOR_base_fmgc_a_bus_ + +struct base_fmgc_a_bus +{ + base_arinc_429 pfd_sel_spd_kts; + base_arinc_429 runway_hdg_memorized_deg; + base_arinc_429 preset_mach_from_mcdu; + base_arinc_429 preset_speed_from_mcdu_kts; + base_arinc_429 roll_fd_command; + base_arinc_429 pitch_fd_command; + base_arinc_429 yaw_fd_command; + base_arinc_429 discrete_word_5; + base_arinc_429 discrete_word_4; + base_arinc_429 fm_alt_constraint_ft; + base_arinc_429 altitude_ft; + base_arinc_429 mach; + base_arinc_429 cas_kts; + base_arinc_429 flx_to_temp_deg_c; + base_arinc_429 ats_discrete_word; + base_arinc_429 ats_fma_discrete_word; + base_arinc_429 discrete_word_3; + base_arinc_429 discrete_word_1; + base_arinc_429 discrete_word_2; + base_arinc_429 discrete_word_6; + base_arinc_429 synchro_spd_mach_value; + base_arinc_429 low_target_speed_margin_kts; + base_arinc_429 high_target_speed_margin_kts; + base_arinc_429 delta_p_ail_voted_cmd_deg; + base_arinc_429 delta_p_splr_voted_cmd_deg; + base_arinc_429 delta_r_voted_cmd_deg; + base_arinc_429 delta_nosewheel_voted_cmd_deg; + base_arinc_429 delta_q_voted_cmd_deg; + base_arinc_429 track_deg; + base_arinc_429 heading_deg; + base_arinc_429 fpa_deg; + base_arinc_429 n1_command_percent; + base_arinc_429 vertical_speed_ft_min; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_fcu_bus_inputs_ +#define DEFINED_TYPEDEF_FOR_base_fcu_bus_inputs_ + +struct base_fcu_bus_inputs +{ + base_fmgc_a_bus fmgc_1_bus; + base_fmgc_a_bus fmgc_2_bus; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_fcu_inputs_ +#define DEFINED_TYPEDEF_FOR_fcu_inputs_ + +struct fcu_inputs +{ + base_time time; + base_sim_data sim_data; + base_fcu_discrete_inputs discrete_inputs; + base_fcu_bus_inputs bus_inputs; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_afs_fmgc_data_ +#define DEFINED_TYPEDEF_FOR_base_afs_fmgc_data_ + +struct base_afs_fmgc_data +{ + real32_T v_cas_kts; + real32_T v_mach; + real32_T hdg_deg; + real32_T trk_deg; + real32_T alt_ft; + real32_T vs_ft_min; + real32_T fpa_deg; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_afs_logic_outputs_ +#define DEFINED_TYPEDEF_FOR_base_afs_logic_outputs_ + +struct base_afs_logic_outputs +{ + boolean_T fmgc_1_has_priority; + base_afs_fmgc_data chosen_fmgc_data; + boolean_T any_ap_fd_engaged; + boolean_T trk_fpa_active; + boolean_T metric_alt_active; + boolean_T auto_speed_control; + boolean_T selected_speed_control; + real32_T spd_mach_display_value; + boolean_T spd_mach_dashes; + boolean_T hdg_trk_managed; + boolean_T hdg_trk_selected; + real32_T hdg_trk_display_value; + boolean_T hdg_trk_dashes; + boolean_T hdg_trk_preset_available; + real32_T alt_display_value; + boolean_T lvl_ch_managed; + boolean_T lvl_ch_vs_fpa; + real32_T vs_fpa_display_value; + boolean_T vs_fpa_dashes; + boolean_T exped_active; + boolean_T loc_only_active; + boolean_T appr_active; + base_fcu_knob_inputs hdg_trk_buttons; + base_fcu_knob_inputs spd_mach_buttons; + base_fcu_knob_inputs alt_buttons; + base_fcu_knob_inputs vs_fpa_buttons; + boolean_T loc_pushed; + boolean_T exped_pushed; + boolean_T appr_pushed; + boolean_T spd_mach_switching_pushed; + boolean_T lat_value_changed; + boolean_T alt_value_changed; + boolean_T vpath_value_changed; + boolean_T spd_mach_value_changed; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_fcu_efis_logic_outputs_ +#define DEFINED_TYPEDEF_FOR_base_fcu_efis_logic_outputs_ + +struct base_fcu_efis_logic_outputs +{ + boolean_T fd_on; + boolean_T ls_on; + efis_filter_selection efis_filter; + boolean_T baro_std; + boolean_T baro_qnh; + boolean_T baro_qfe; + real32_T baro_value_hpa; + real32_T baro_value_inhg; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_fcu_logic_outputs_ +#define DEFINED_TYPEDEF_FOR_base_fcu_logic_outputs_ + +struct base_fcu_logic_outputs +{ + base_afs_logic_outputs afs; + base_fcu_efis_logic_outputs capt_efis; + base_fcu_efis_logic_outputs fo_efis; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_fcu_efis_panel_outputs_ +#define DEFINED_TYPEDEF_FOR_base_fcu_efis_panel_outputs_ + +struct base_fcu_efis_panel_outputs +{ + boolean_T fd_light_on; + boolean_T ls_light_on; + boolean_T cstr_light_on; + boolean_T wpt_light_on; + boolean_T vord_light_on; + boolean_T ndb_light_on; + boolean_T arpt_light_on; + int8_T baro_value_mode; + real32_T baro_value; + int8_T baro_mode; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_fcu_afs_panel_outputs_ +#define DEFINED_TYPEDEF_FOR_base_fcu_afs_panel_outputs_ + +struct base_fcu_afs_panel_outputs +{ + boolean_T loc_light_on; + boolean_T exped_light_on; + boolean_T appr_light_on; + boolean_T ap_1_light_on; + boolean_T ap_2_light_on; + boolean_T athr_light_on; + boolean_T trk_fpa_mode; + boolean_T mach_mode; + real_T spd_mach_value; + boolean_T spd_mach_dashes; + boolean_T spd_mach_managed; + real_T hdg_trk_value; + boolean_T hdg_trk_dashes; + boolean_T hdg_trk_managed; + real_T alt_value; + boolean_T lvl_ch_managed; + real_T vs_fpa_value; + boolean_T vs_fpa_dashes; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_fcu_discrete_outputs_ +#define DEFINED_TYPEDEF_FOR_base_fcu_discrete_outputs_ + +struct base_fcu_discrete_outputs +{ + base_fcu_efis_panel_outputs capt_efis_outputs; + base_fcu_efis_panel_outputs fo_efis_outputs; + base_fcu_afs_panel_outputs afs_outputs; + boolean_T fcu_healthy; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_fcu_bus_ +#define DEFINED_TYPEDEF_FOR_base_fcu_bus_ + +struct base_fcu_bus +{ + base_arinc_429 selected_hdg_deg; + base_arinc_429 selected_alt_ft; + base_arinc_429 selected_spd_kts; + base_arinc_429 selected_vz_ft_min; + base_arinc_429 selected_mach; + base_arinc_429 selected_trk_deg; + base_arinc_429 selected_fpa_deg; + base_arinc_429 ats_fma_discrete_word; + base_arinc_429 fcu_flex_to_temp_deg_c; + base_arinc_429 ats_discrete_word; + base_arinc_429 eis_discrete_word_1_left; + base_arinc_429 eis_discrete_word_1_right; + base_arinc_429 eis_discrete_word_2_left; + base_arinc_429 eis_discrete_word_2_right; + base_arinc_429 baro_setting_left_hpa; + base_arinc_429 baro_setting_right_hpa; + base_arinc_429 baro_setting_left_inhg; + base_arinc_429 baro_setting_right_inhg; + base_arinc_429 fcu_discrete_word_2; + base_arinc_429 fcu_discrete_word_1; + base_arinc_429 n1_cmd_percent; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_fcu_outputs_ +#define DEFINED_TYPEDEF_FOR_fcu_outputs_ + +struct fcu_outputs +{ + fcu_inputs data; + base_fcu_logic_outputs logic; + base_fcu_discrete_outputs discrete_outputs; + base_fcu_bus bus_outputs; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_struct_nm25uKBLHRjCcZyzI1BLUB_ +#define DEFINED_TYPEDEF_FOR_struct_nm25uKBLHRjCcZyzI1BLUB_ + +struct struct_nm25uKBLHRjCcZyzI1BLUB +{ + real_T v_cas_kts; + real_T v_mach; + real_T hdg_deg; + real_T trk_deg; + real_T alt_ft; + real_T vs_ft_min; + real_T fpa_deg; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_struct_XAtn0711Lcc2c5LVlUmASD_ +#define DEFINED_TYPEDEF_FOR_struct_XAtn0711Lcc2c5LVlUmASD_ + +struct struct_XAtn0711Lcc2c5LVlUmASD +{ + boolean_T pushed; + boolean_T pulled; + real_T turns; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_struct_IdOX3oqwDJ1PzU9qaOdl1_ +#define DEFINED_TYPEDEF_FOR_struct_IdOX3oqwDJ1PzU9qaOdl1_ + +struct struct_IdOX3oqwDJ1PzU9qaOdl1 +{ + boolean_T fmgc_1_has_priority; + struct_nm25uKBLHRjCcZyzI1BLUB chosen_fmgc_data; + boolean_T any_ap_fd_engaged; + boolean_T trk_fpa_active; + boolean_T metric_alt_active; + boolean_T auto_speed_control; + boolean_T selected_speed_control; + real_T spd_mach_display_value; + boolean_T spd_mach_dashes; + boolean_T hdg_trk_managed; + boolean_T hdg_trk_selected; + real_T hdg_trk_display_value; + boolean_T hdg_trk_dashes; + boolean_T hdg_trk_preset_available; + real_T alt_display_value; + boolean_T lvl_ch_managed; + boolean_T lvl_ch_vs_fpa; + real_T vs_fpa_display_value; + boolean_T vs_fpa_dashes; + boolean_T exped_active; + boolean_T loc_only_active; + boolean_T appr_active; + struct_XAtn0711Lcc2c5LVlUmASD hdg_trk_buttons; + struct_XAtn0711Lcc2c5LVlUmASD spd_mach_buttons; + struct_XAtn0711Lcc2c5LVlUmASD alt_buttons; + struct_XAtn0711Lcc2c5LVlUmASD vs_fpa_buttons; + boolean_T loc_pushed; + boolean_T exped_pushed; + boolean_T appr_pushed; + boolean_T spd_mach_switching_pushed; + boolean_T lat_value_changed; + boolean_T alt_value_changed; + boolean_T vpath_value_changed; + boolean_T spd_mach_value_changed; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_struct_bqjSWtmatK4obwyFIPQOyC_ +#define DEFINED_TYPEDEF_FOR_struct_bqjSWtmatK4obwyFIPQOyC_ + +struct struct_bqjSWtmatK4obwyFIPQOyC +{ + boolean_T fd_on; + boolean_T ls_on; + efis_filter_selection efis_filter; + boolean_T baro_std; + boolean_T baro_qnh; + boolean_T baro_qfe; + real_T baro_value_hpa; + real_T baro_value_inhg; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_struct_1rLxL9ABQnU5BCfHWgsADF_ +#define DEFINED_TYPEDEF_FOR_struct_1rLxL9ABQnU5BCfHWgsADF_ + +struct struct_1rLxL9ABQnU5BCfHWgsADF +{ + struct_IdOX3oqwDJ1PzU9qaOdl1 afs; + struct_bqjSWtmatK4obwyFIPQOyC capt_efis; + struct_bqjSWtmatK4obwyFIPQOyC fo_efis; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_struct_2OohiAWrazWy5wDS5iisgF_ +#define DEFINED_TYPEDEF_FOR_struct_2OohiAWrazWy5wDS5iisgF_ + +struct struct_2OohiAWrazWy5wDS5iisgF +{ + real_T SSM; + real_T Data; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_struct_jKPQGsPwrNwDJirnuGEHpB_ +#define DEFINED_TYPEDEF_FOR_struct_jKPQGsPwrNwDJirnuGEHpB_ + +struct struct_jKPQGsPwrNwDJirnuGEHpB +{ + struct_2OohiAWrazWy5wDS5iisgF selected_hdg_deg; + struct_2OohiAWrazWy5wDS5iisgF selected_alt_ft; + struct_2OohiAWrazWy5wDS5iisgF selected_spd_kts; + struct_2OohiAWrazWy5wDS5iisgF selected_vz_ft_min; + struct_2OohiAWrazWy5wDS5iisgF selected_mach; + struct_2OohiAWrazWy5wDS5iisgF selected_trk_deg; + struct_2OohiAWrazWy5wDS5iisgF selected_fpa_deg; + struct_2OohiAWrazWy5wDS5iisgF ats_fma_discrete_word; + struct_2OohiAWrazWy5wDS5iisgF fcu_flex_to_temp_deg_c; + struct_2OohiAWrazWy5wDS5iisgF ats_discrete_word; + struct_2OohiAWrazWy5wDS5iisgF eis_discrete_word_1_left; + struct_2OohiAWrazWy5wDS5iisgF eis_discrete_word_1_right; + struct_2OohiAWrazWy5wDS5iisgF eis_discrete_word_2_left; + struct_2OohiAWrazWy5wDS5iisgF eis_discrete_word_2_right; + struct_2OohiAWrazWy5wDS5iisgF baro_setting_left_hpa; + struct_2OohiAWrazWy5wDS5iisgF baro_setting_right_hpa; + struct_2OohiAWrazWy5wDS5iisgF baro_setting_left_inhg; + struct_2OohiAWrazWy5wDS5iisgF baro_setting_right_inhg; + struct_2OohiAWrazWy5wDS5iisgF fcu_discrete_word_2; + struct_2OohiAWrazWy5wDS5iisgF fcu_discrete_word_1; + struct_2OohiAWrazWy5wDS5iisgF n1_cmd_percent; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_struct_Y6Zb6GuNhPISOIVdelTYXD_ +#define DEFINED_TYPEDEF_FOR_struct_Y6Zb6GuNhPISOIVdelTYXD_ + +struct struct_Y6Zb6GuNhPISOIVdelTYXD +{ + boolean_T fd_light_on; + boolean_T ls_light_on; + boolean_T cstr_light_on; + boolean_T wpt_light_on; + boolean_T vord_light_on; + boolean_T ndb_light_on; + boolean_T arpt_light_on; + real_T baro_value_mode; + real_T baro_value; + real_T baro_mode; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_struct_Ix96w8VELgZuPzNijTBYLB_ +#define DEFINED_TYPEDEF_FOR_struct_Ix96w8VELgZuPzNijTBYLB_ + +struct struct_Ix96w8VELgZuPzNijTBYLB +{ + struct_Y6Zb6GuNhPISOIVdelTYXD capt_efis_outputs; + struct_Y6Zb6GuNhPISOIVdelTYXD fo_efis_outputs; + base_fcu_afs_panel_outputs afs_outputs; + boolean_T fcu_healthy; +}; + +#endif +#endif + diff --git a/fbw-a32nx/src/wasm/fbw_a320/src/model/FmgcComputer.cpp b/fbw-a32nx/src/wasm/fbw_a320/src/model/FmgcComputer.cpp new file mode 100644 index 000000000000..be5ce0db219b --- /dev/null +++ b/fbw-a32nx/src/wasm/fbw_a320/src/model/FmgcComputer.cpp @@ -0,0 +1,2199 @@ +#include "FmgcComputer.h" +#include "rtwtypes.h" +#include "FmgcComputer_types.h" +#include + +void FmgcComputer::FmgcComputer_MATLABFunction_Reset(rtDW_MATLABFunction_FmgcComputer_T *localDW) +{ + localDW->output = false; + localDW->timeSinceCondition = 0.0; +} + +void FmgcComputer::FmgcComputer_MATLABFunction(boolean_T rtu_u, real_T rtu_Ts, boolean_T rtu_isRisingEdge, real_T + rtu_timeDelay, boolean_T *rty_y, rtDW_MATLABFunction_FmgcComputer_T *localDW) +{ + if (rtu_u == rtu_isRisingEdge) { + localDW->timeSinceCondition += rtu_Ts; + if (localDW->timeSinceCondition >= rtu_timeDelay) { + localDW->output = rtu_u; + } + } else { + localDW->timeSinceCondition = 0.0; + localDW->output = rtu_u; + } + + *rty_y = localDW->output; +} + +void FmgcComputer::FmgcComputer_MATLABFunction_m_Reset(rtDW_MATLABFunction_FmgcComputer_e_T *localDW) +{ + localDW->previousInput_not_empty = false; +} + +void FmgcComputer::FmgcComputer_MATLABFunction_i(boolean_T rtu_u, boolean_T rtu_isRisingEdge, boolean_T *rty_y, + rtDW_MATLABFunction_FmgcComputer_e_T *localDW) +{ + if (!localDW->previousInput_not_empty) { + localDW->previousInput = rtu_isRisingEdge; + localDW->previousInput_not_empty = true; + } + + if (rtu_isRisingEdge) { + *rty_y = (rtu_u && (!localDW->previousInput)); + } else { + *rty_y = ((!rtu_u) && localDW->previousInput); + } + + localDW->previousInput = rtu_u; +} + +void FmgcComputer::FmgcComputer_MATLABFunction_j(const base_arinc_429 *rtu_u, real32_T rtu_default, real32_T *rty_y) +{ + if (rtu_u->SSM == static_cast(SignStatusMatrix::NormalOperation)) { + *rty_y = rtu_u->Data; + } else { + *rty_y = rtu_default; + } +} + +void FmgcComputer::FmgcComputer_MATLABFunction_f(const base_arinc_429 *rtu_u, boolean_T *rty_y) +{ + *rty_y = (rtu_u->SSM != static_cast(SignStatusMatrix::FailureWarning)); +} + +void FmgcComputer::FmgcComputer_MATLABFunction_k(const base_arinc_429 *rtu_u, real_T rtu_bit, uint32_T *rty_y) +{ + real32_T tmp; + uint32_T a; + tmp = std::round(rtu_u->Data); + if (tmp < 4.2949673E+9F) { + if (tmp >= 0.0F) { + a = static_cast(tmp); + } else { + a = 0U; + } + } else { + a = MAX_uint32_T; + } + + if (-(rtu_bit - 1.0) >= 0.0) { + if (-(rtu_bit - 1.0) <= 31.0) { + a <<= static_cast(-(rtu_bit - 1.0)); + } else { + a = 0U; + } + } else if (-(rtu_bit - 1.0) >= -31.0) { + a >>= static_cast(rtu_bit - 1.0); + } else { + a = 0U; + } + + *rty_y = a & 1U; +} + +void FmgcComputer::FmgcComputer_MATLABFunction_g(const base_arinc_429 *rtu_u, boolean_T *rty_y) +{ + *rty_y = (rtu_u->SSM == static_cast(SignStatusMatrix::NormalOperation)); +} + +void FmgcComputer::FmgcComputer_MATLABFunction_pz_Reset(rtDW_MATLABFunction_FmgcComputer_ll_T *localDW) +{ + localDW->previousInput = false; + localDW->remainingTriggerTime = 0.0; +} + +void FmgcComputer::FmgcComputer_MATLABFunction_d(boolean_T rtu_u, real_T rtu_Ts, boolean_T *rty_y, real_T + rtp_isRisingEdge, real_T rtp_retriggerable, real_T rtp_triggerDuration, rtDW_MATLABFunction_FmgcComputer_ll_T *localDW) +{ + if (localDW->remainingTriggerTime > 0.0) { + localDW->remainingTriggerTime -= rtu_Ts; + } else if (localDW->remainingTriggerTime < 0.0) { + localDW->remainingTriggerTime = 0.0; + } + + if (((rtp_retriggerable != 0.0) || (localDW->remainingTriggerTime == 0.0)) && (((rtp_isRisingEdge != 0.0) && rtu_u && + (!localDW->previousInput)) || ((rtp_isRisingEdge == 0.0) && (!rtu_u) && localDW->previousInput))) { + localDW->remainingTriggerTime = rtp_triggerDuration; + } + + localDW->previousInput = rtu_u; + *rty_y = (localDW->remainingTriggerTime > 0.0); +} + +void FmgcComputer::FmgcComputer_MATLABFunction_gy(const boolean_T rtu_u[19], real32_T *rty_y) +{ + uint32_T out; + out = 0U; + for (int32_T i{0}; i < 19; i++) { + out |= static_cast(rtu_u[i]) << (i + 10); + } + + *rty_y = static_cast(out); +} + +void FmgcComputer::step() +{ + const base_arinc_429 *rtb_Switch_k_0; + base_arinc_429 rtb_BusAssignment_b_logic_ils_computation_data_glideslope_deviation_deg; + base_arinc_429 rtb_BusAssignment_f4_logic_ils_computation_data_localizer_deviation_deg; + base_arinc_429 rtb_BusAssignment_f4_logic_ils_computation_data_runway_heading_deg; + base_arinc_429 rtb_BusAssignment_k_logic_ils_computation_data_localizer_deviation_deg; + real32_T rtb_y_c; + real32_T rtb_y_g; + real32_T rtb_y_j; + real32_T rtb_y_je; + real32_T rtb_y_kc; + real32_T rtb_y_ke; + real32_T rtb_y_l; + real32_T rtb_y_p; + uint32_T rtb_y_en; + uint32_T rtb_y_gp; + uint32_T rtb_y_jz; + boolean_T rtb_VectorConcatenate[19]; + boolean_T rtb_VectorConcatenate_j[19]; + boolean_T rtb_Compare_pf; + boolean_T rtb_NOT1_p; + boolean_T rtb_NOT4_gb; + boolean_T rtb_y_dh; + boolean_T rtb_y_gd; + boolean_T rtb_y_gx; + boolean_T rtb_y_k; + boolean_T rtb_y_mq; + boolean_T rtb_y_nk; + if (FmgcComputer_U.in.sim_data.computer_running) { + real_T rtb_Abs1; + real_T rtb_BusAssignment_i_logic_ra_computation_data_ft; + real_T rtb_Sum1; + real32_T rtb_Switch_glideslope_deviation_deg_Data; + real32_T rtb_Switch_localizer_deviation_deg_Data; + real32_T rtb_Switch_runway_heading_deg_Data; + real32_T rtb_V_ias; + real32_T rtb_V_tas; + real32_T rtb_alpha; + real32_T rtb_alt; + real32_T rtb_fpa; + real32_T rtb_hdg; + real32_T rtb_mach_i; + real32_T rtb_n_x; + real32_T rtb_n_y; + real32_T rtb_n_z; + real32_T rtb_p_s_c; + real32_T rtb_phi; + real32_T rtb_phi_dot; + real32_T rtb_q; + real32_T rtb_r; + real32_T rtb_raComputationData; + real32_T rtb_theta; + real32_T rtb_theta_dot; + real32_T rtb_trk; + real32_T rtb_vz; + uint32_T rtb_Switch_glideslope_deviation_deg_SSM; + uint32_T rtb_Switch_localizer_deviation_deg_SSM; + boolean_T fdOppOff; + boolean_T fdOwnOff; + boolean_T in_land_or_ga_tmp; + boolean_T raOppInvalid; + boolean_T raOwnInvalid; + boolean_T rtb_AND10; + boolean_T rtb_BusAssignment_g_logic_both_ils_valid; + boolean_T rtb_BusAssignment_h_logic_fcu_failure; + boolean_T rtb_BusAssignment_m_ap_fd_logic_fmgc_opp_mode_sync_tmp; + boolean_T rtb_Compare; + boolean_T rtb_Logic_d_idx_0_tmp; + boolean_T rtb_Logic_gj_idx_0_tmp_tmp; + boolean_T rtb_Logic_gj_idx_0_tmp_tmp_tmp; + boolean_T rtb_Logic_gj_idx_0_tmp_tmp_tmp_0; + boolean_T rtb_Logic_idx_0_tmp; + boolean_T rtb_NOT3; + boolean_T rtb_OR1_j; + boolean_T rtb_OR2; + boolean_T rtb_OR2_tmp; + boolean_T rtb_OR9; + boolean_T rtb_OR9_b; + boolean_T rtb_OR_c_tmp; + boolean_T rtb_OR_nn; + boolean_T rtb_OR_nx; + boolean_T rtb_OR_od_tmp; + boolean_T rtb_OR_od_tmp_0; + boolean_T rtb_TmpSignalConversionAtSFunctionInport3_idx_1; + boolean_T rtb_adr3Invalid; + boolean_T rtb_adrOppInvalid; + boolean_T rtb_adrOwnInvalid; + boolean_T rtb_ap_fd_condition; + boolean_T rtb_ap_fd_condition_tmp; + boolean_T rtb_ap_inop_tmp; + boolean_T rtb_appInop_idx_0; + boolean_T rtb_bothRaValid; + boolean_T rtb_doubleAdrFault; + boolean_T rtb_doubleIrFault; + boolean_T rtb_dualRaFailure; + boolean_T rtb_fmgcOppPriority; + boolean_T rtb_fmgcOppPriority_tmp; + boolean_T rtb_ir3Invalid; + boolean_T rtb_irOppInvalid; + boolean_T rtb_irOwnInvalid; + boolean_T rtb_y_ae_tmp; + boolean_T rtb_y_ae_tmp_0; + boolean_T rtb_y_ae_tmp_1; + boolean_T rtb_y_ae_tmp_2; + boolean_T rtb_y_b; + if (!FmgcComputer_DWork.Runtime_MODE) { + FmgcComputer_DWork.Delay_DSTATE = FmgcComputer_P.Delay_InitialCondition; + FmgcComputer_DWork.Delay_DSTATE_p = FmgcComputer_P.Delay_InitialCondition_g; + FmgcComputer_DWork.Memory_PreviousInput = FmgcComputer_P.SRFlipFlop1_initial_condition; + FmgcComputer_DWork.Memory_PreviousInput_g = FmgcComputer_P.SRFlipFlop_initial_condition; + FmgcComputer_DWork.Memory_PreviousInput_g1 = FmgcComputer_P.SRFlipFlop1_initial_condition_n; + FmgcComputer_DWork.Delay_DSTATE_k = FmgcComputer_P.Delay_InitialCondition_gu; + FmgcComputer_DWork.Memory_PreviousInput_p = FmgcComputer_P.SRFlipFlop_initial_condition_b; + FmgcComputer_DWork.Memory_PreviousInput_k = FmgcComputer_P.SRFlipFlop_initial_condition_h; + FmgcComputer_DWork.Memory_PreviousInput_c = FmgcComputer_P.SRFlipFlop_initial_condition_i; + FmgcComputer_DWork.Memory_PreviousInput_b = FmgcComputer_P.SRFlipFlop_initial_condition_c; + FmgcComputer_DWork.Memory_PreviousInput_l = FmgcComputer_P.SRFlipFlop_initial_condition_d; + FmgcComputer_DWork.Memory_PreviousInput_d = FmgcComputer_P.SRFlipFlop_initial_condition_iz; + FmgcComputer_DWork.Memory_PreviousInput_dv = FmgcComputer_P.SRFlipFlop_initial_condition_l; + FmgcComputer_DWork.Memory_PreviousInput_f = FmgcComputer_P.SRFlipFlop_initial_condition_j; + FmgcComputer_DWork.Memory_PreviousInput_i = FmgcComputer_P.SRFlipFlop_initial_condition_h5; + FmgcComputer_DWork.Memory_PreviousInput_e = FmgcComputer_P.SRFlipFlop_initial_condition_e; + FmgcComputer_DWork.Memory_PreviousInput_f2 = FmgcComputer_P.SRFlipFlop_initial_condition_cs; + FmgcComputer_DWork.Memory_PreviousInput_i1 = FmgcComputer_P.SRFlipFlop_initial_condition_o; + FmgcComputer_DWork.Memory_PreviousInput_ip = FmgcComputer_P.SRFlipFlop_initial_condition_g; + FmgcComputer_DWork.Memory_PreviousInput_a = FmgcComputer_P.SRFlipFlop_initial_condition_n; + FmgcComputer_DWork.Memory_PreviousInput_cv = FmgcComputer_P.SRFlipFlop_initial_condition_of; + FmgcComputer_DWork.Memory_PreviousInput_lq = FmgcComputer_P.SRFlipFlop_initial_condition_on; + FmgcComputer_DWork.Memory_PreviousInput_n = FmgcComputer_P.SRFlipFlop1_initial_condition_b; + FmgcComputer_DWork.Memory_PreviousInput_ne = FmgcComputer_P.SRFlipFlop_initial_condition_ja; + FmgcComputer_DWork.Memory_PreviousInput_cb = FmgcComputer_P.SRFlipFlop_initial_condition_li; + FmgcComputer_DWork.Memory_PreviousInput_fg = FmgcComputer_P.SRFlipFlop1_initial_condition_i; + FmgcComputer_DWork.Memory_PreviousInput_m = FmgcComputer_P.SRFlipFlop_initial_condition_be; + FmgcComputer_DWork.Memory_PreviousInput_ec = FmgcComputer_P.SRFlipFlop_initial_condition_jv; + FmgcComputer_DWork.Memory_PreviousInput_nt = FmgcComputer_P.SRFlipFlop_initial_condition_p; + FmgcComputer_DWork.Memory_PreviousInput_b3 = FmgcComputer_P.SRFlipFlop_initial_condition_lz; + FmgcComputer_DWork.Memory_PreviousInput_ae = FmgcComputer_P.SRFlipFlop_initial_condition_oz; + FmgcComputer_DWork.Memory_PreviousInput_ev = FmgcComputer_P.SRFlipFlop_initial_condition_pr; + FmgcComputer_DWork.Memory_PreviousInput_fm = FmgcComputer_P.SRFlipFlop_initial_condition_ce; + FmgcComputer_DWork.Memory_PreviousInput_nu = FmgcComputer_P.SRFlipFlop_initial_condition_hs; + FmgcComputer_DWork.Memory_PreviousInput_as = FmgcComputer_P.SRFlipFlop_initial_condition_dp; + FmgcComputer_DWork.Memory_PreviousInput_cu = FmgcComputer_P.SRFlipFlop1_initial_condition_o; + FmgcComputer_DWork.Memory_PreviousInput_h = FmgcComputer_P.SRFlipFlop_initial_condition_n1; + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_i); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_f); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_c); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_h); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_k); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_o); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_kq); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_d); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_hz); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_gk); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_fx); + FmgcComputer_MATLABFunction_pz_Reset(&FmgcComputer_DWork.sf_MATLABFunction_db); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_fm); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_jl); + FmgcComputer_MATLABFunction_pz_Reset(&FmgcComputer_DWork.sf_MATLABFunction_mn); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_kz); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_hh); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_ha); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_kb); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_eb2); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_es); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_mq); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_crq); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_op); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_fa); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_fo); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_d3); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_hv); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_fn); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_lm); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_pn); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_mtz); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_di2); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_h4); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_gb); + FmgcComputer_MATLABFunction_pz_Reset(&FmgcComputer_DWork.sf_MATLABFunction_aw); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_at); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_hdw); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_m1); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_hu); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_h0); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_jle); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_ge4); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_ma); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_k4); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_ah); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_ol); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_p4); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_is); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_pr); + FmgcComputer_MATLABFunction_pz_Reset(&FmgcComputer_DWork.sf_MATLABFunction_bq); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_hw); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_ee); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_dt); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_nd); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_ds); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_cx); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_fe); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_gbq); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_p3); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_ax); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_ir); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_fz); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_mo); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_n5); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_f0h); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_go); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_ms); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_khd); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_pe); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_iv); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_bs); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_mu); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_dba); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_dtd); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_d5); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_jc); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_aba); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_ft); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_mrn); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_ih); + FmgcComputer_MATLABFunction_m_Reset(&FmgcComputer_DWork.sf_MATLABFunction_lr); + FmgcComputer_MATLABFunction_Reset(&FmgcComputer_DWork.sf_MATLABFunction_j3); + FmgcComputer_DWork.Runtime_MODE = true; + } + + rtb_adrOwnInvalid = ((FmgcComputer_U.in.bus_inputs.adr_own_bus.airspeed_computed_kn.SSM == static_cast + (SignStatusMatrix::FailureWarning)) || + (FmgcComputer_U.in.bus_inputs.adr_own_bus.aoa_corrected_deg.SSM == static_cast + (SignStatusMatrix::FailureWarning))); + rtb_adrOppInvalid = ((FmgcComputer_U.in.bus_inputs.adr_opp_bus.airspeed_computed_kn.SSM == static_cast + (SignStatusMatrix::FailureWarning)) || + (FmgcComputer_U.in.bus_inputs.adr_opp_bus.aoa_corrected_deg.SSM == static_cast + (SignStatusMatrix::FailureWarning))); + rtb_adr3Invalid = ((FmgcComputer_U.in.bus_inputs.adr_3_bus.airspeed_computed_kn.SSM == static_cast + (SignStatusMatrix::FailureWarning)) || + (FmgcComputer_U.in.bus_inputs.adr_3_bus.aoa_corrected_deg.SSM == static_cast + (SignStatusMatrix::FailureWarning))); + rtb_doubleAdrFault = ((rtb_adrOwnInvalid && rtb_adrOppInvalid) || (rtb_adrOwnInvalid && rtb_adr3Invalid) || + (rtb_adrOppInvalid && rtb_adr3Invalid)); + rtb_irOwnInvalid = ((FmgcComputer_U.in.bus_inputs.ir_own_bus.body_yaw_rate_deg_s.SSM != static_cast + (SignStatusMatrix::NormalOperation)) || + (FmgcComputer_U.in.bus_inputs.ir_own_bus.body_lat_accel_g.SSM != static_cast + (SignStatusMatrix::NormalOperation))); + rtb_irOppInvalid = ((FmgcComputer_U.in.bus_inputs.ir_opp_bus.body_yaw_rate_deg_s.SSM != static_cast + (SignStatusMatrix::NormalOperation)) || + (FmgcComputer_U.in.bus_inputs.ir_opp_bus.body_lat_accel_g.SSM != static_cast + (SignStatusMatrix::NormalOperation))); + rtb_ir3Invalid = ((FmgcComputer_U.in.bus_inputs.ir_3_bus.body_yaw_rate_deg_s.SSM != static_cast + (SignStatusMatrix::NormalOperation)) || + (FmgcComputer_U.in.bus_inputs.ir_3_bus.body_lat_accel_g.SSM != static_cast + (SignStatusMatrix::NormalOperation))); + rtb_doubleIrFault = ((rtb_irOwnInvalid && rtb_irOppInvalid) || (rtb_irOwnInvalid && rtb_ir3Invalid) || + (rtb_irOppInvalid && rtb_ir3Invalid)); + if (!rtb_adrOwnInvalid) { + rtb_V_ias = FmgcComputer_U.in.bus_inputs.adr_own_bus.airspeed_computed_kn.Data; + rtb_V_tas = FmgcComputer_U.in.bus_inputs.adr_own_bus.airspeed_true_kn.Data; + rtb_mach_i = FmgcComputer_U.in.bus_inputs.adr_own_bus.mach.Data; + rtb_alpha = FmgcComputer_U.in.bus_inputs.adr_own_bus.aoa_corrected_deg.Data; + rtb_p_s_c = FmgcComputer_U.in.bus_inputs.adr_own_bus.corrected_average_static_pressure.Data; + rtb_alt = FmgcComputer_U.in.bus_inputs.adr_own_bus.altitude_corrected_ft.Data; + } else if (!rtb_adr3Invalid) { + rtb_V_ias = FmgcComputer_U.in.bus_inputs.adr_3_bus.airspeed_computed_kn.Data; + rtb_V_tas = FmgcComputer_U.in.bus_inputs.adr_3_bus.airspeed_true_kn.Data; + rtb_mach_i = FmgcComputer_U.in.bus_inputs.adr_3_bus.mach.Data; + rtb_alpha = FmgcComputer_U.in.bus_inputs.adr_3_bus.aoa_corrected_deg.Data; + rtb_p_s_c = FmgcComputer_U.in.bus_inputs.adr_3_bus.corrected_average_static_pressure.Data; + rtb_alt = FmgcComputer_U.in.bus_inputs.adr_own_bus.altitude_corrected_ft.Data; + } else { + rtb_V_ias = 0.0F; + rtb_V_tas = 0.0F; + rtb_mach_i = 0.0F; + rtb_alpha = 0.0F; + rtb_p_s_c = 0.0F; + rtb_alt = 0.0F; + } + + if (!rtb_irOwnInvalid) { + rtb_theta = FmgcComputer_U.in.bus_inputs.ir_own_bus.pitch_angle_deg.Data; + rtb_phi = FmgcComputer_U.in.bus_inputs.ir_own_bus.roll_angle_deg.Data; + rtb_q = FmgcComputer_U.in.bus_inputs.ir_own_bus.body_pitch_rate_deg_s.Data; + rtb_r = FmgcComputer_U.in.bus_inputs.ir_own_bus.body_yaw_rate_deg_s.Data; + rtb_n_x = FmgcComputer_U.in.bus_inputs.ir_own_bus.body_long_accel_g.Data; + rtb_n_y = FmgcComputer_U.in.bus_inputs.ir_own_bus.body_lat_accel_g.Data; + rtb_n_z = FmgcComputer_U.in.bus_inputs.ir_own_bus.body_normal_accel_g.Data; + rtb_theta_dot = FmgcComputer_U.in.bus_inputs.ir_own_bus.pitch_att_rate_deg_s.Data; + rtb_phi_dot = FmgcComputer_U.in.bus_inputs.ir_own_bus.roll_att_rate_deg_s.Data; + rtb_hdg = FmgcComputer_U.in.bus_inputs.ir_own_bus.heading_magnetic_deg.Data; + rtb_trk = FmgcComputer_U.in.bus_inputs.ir_own_bus.track_angle_magnetic_deg.Data; + rtb_vz = FmgcComputer_U.in.bus_inputs.ir_own_bus.inertial_vertical_speed_ft_s.Data; + rtb_fpa = FmgcComputer_U.in.bus_inputs.ir_own_bus.flight_path_angle_deg.Data; + } else if (!rtb_ir3Invalid) { + rtb_theta = FmgcComputer_U.in.bus_inputs.ir_3_bus.pitch_angle_deg.Data; + rtb_phi = FmgcComputer_U.in.bus_inputs.ir_3_bus.roll_angle_deg.Data; + rtb_q = FmgcComputer_U.in.bus_inputs.ir_3_bus.body_pitch_rate_deg_s.Data; + rtb_r = FmgcComputer_U.in.bus_inputs.ir_3_bus.body_yaw_rate_deg_s.Data; + rtb_n_x = FmgcComputer_U.in.bus_inputs.ir_3_bus.body_long_accel_g.Data; + rtb_n_y = FmgcComputer_U.in.bus_inputs.ir_3_bus.body_lat_accel_g.Data; + rtb_n_z = FmgcComputer_U.in.bus_inputs.ir_3_bus.body_normal_accel_g.Data; + rtb_theta_dot = FmgcComputer_U.in.bus_inputs.ir_3_bus.pitch_att_rate_deg_s.Data; + rtb_phi_dot = FmgcComputer_U.in.bus_inputs.ir_3_bus.roll_att_rate_deg_s.Data; + rtb_hdg = FmgcComputer_U.in.bus_inputs.ir_3_bus.heading_magnetic_deg.Data; + rtb_trk = FmgcComputer_U.in.bus_inputs.ir_3_bus.track_angle_magnetic_deg.Data; + rtb_vz = FmgcComputer_U.in.bus_inputs.ir_3_bus.inertial_vertical_speed_ft_s.Data; + rtb_fpa = FmgcComputer_U.in.bus_inputs.ir_3_bus.flight_path_angle_deg.Data; + } else { + rtb_theta = 0.0F; + rtb_phi = 0.0F; + rtb_q = 0.0F; + rtb_r = 0.0F; + rtb_n_x = 0.0F; + rtb_n_y = 0.0F; + rtb_n_z = 0.0F; + rtb_theta_dot = 0.0F; + rtb_phi_dot = 0.0F; + rtb_hdg = 0.0F; + rtb_trk = 0.0F; + rtb_vz = 0.0F; + rtb_fpa = 0.0F; + } + + raOwnInvalid = (FmgcComputer_U.in.bus_inputs.ra_own_bus.radio_height_ft.SSM == static_cast + (SignStatusMatrix::FailureWarning)); + raOppInvalid = (FmgcComputer_U.in.bus_inputs.ra_opp_bus.radio_height_ft.SSM == static_cast + (SignStatusMatrix::FailureWarning)); + rtb_Compare = !raOppInvalid; + rtb_fmgcOppPriority = !raOwnInvalid; + if (rtb_fmgcOppPriority && rtb_Compare) { + rtb_raComputationData = FmgcComputer_U.in.bus_inputs.ra_own_bus.radio_height_ft.Data; + } else if (raOwnInvalid && rtb_Compare) { + rtb_raComputationData = FmgcComputer_U.in.bus_inputs.ra_opp_bus.radio_height_ft.Data; + } else if (rtb_fmgcOppPriority && raOppInvalid) { + rtb_raComputationData = FmgcComputer_U.in.bus_inputs.ra_own_bus.radio_height_ft.Data; + } else { + rtb_raComputationData = 250.0F; + } + + rtb_dualRaFailure = (raOwnInvalid && raOppInvalid); + rtb_bothRaValid = ((FmgcComputer_U.in.bus_inputs.ra_own_bus.radio_height_ft.SSM == static_cast + (SignStatusMatrix::NormalOperation)) && + (FmgcComputer_U.in.bus_inputs.ra_opp_bus.radio_height_ft.SSM == static_cast + (SignStatusMatrix::NormalOperation))); + if (FmgcComputer_U.in.discrete_inputs.fac_own_healthy) { + rtb_Switch_k_0 = &FmgcComputer_U.in.bus_inputs.fac_own_bus.discrete_word_5; + } else { + rtb_Switch_k_0 = &FmgcComputer_U.in.bus_inputs.fac_opp_bus.discrete_word_5; + } + + FmgcComputer_MATLABFunction_k(rtb_Switch_k_0, FmgcComputer_P.BitfromLabel_bit, &rtb_y_jz); + rtb_OR9 = (rtb_y_jz != 0U); + FmgcComputer_MATLABFunction_k(rtb_Switch_k_0, FmgcComputer_P.BitfromLabel1_bit, &rtb_y_jz); + rtb_AND10 = (rtb_y_jz != 0U); + FmgcComputer_MATLABFunction_k(rtb_Switch_k_0, FmgcComputer_P.BitfromLabel2_bit, &rtb_y_jz); + rtb_y_gd = (rtb_y_jz == 0U); + FmgcComputer_MATLABFunction_f(rtb_Switch_k_0, &rtb_Compare_pf); + rtb_OR9_b = (rtb_OR9 && rtb_AND10 && rtb_y_gd && rtb_Compare_pf); + rtb_y_b = ((!rtb_Compare_pf) || (!rtb_y_gd)); + if (FmgcComputer_U.in.discrete_inputs.fac_own_healthy) { + rtb_Switch_k_0 = &FmgcComputer_U.in.bus_inputs.fac_own_bus.fac_flap_angle; + } else { + rtb_Switch_k_0 = &FmgcComputer_U.in.bus_inputs.fac_opp_bus.fac_flap_angle; + } + + FmgcComputer_MATLABFunction_j(rtb_Switch_k_0, FmgcComputer_P.A429ValueOrDefault_defaultValue, &rtb_y_ke); + if (FmgcComputer_U.in.discrete_inputs.fac_own_healthy) { + rtb_Switch_k_0 = &FmgcComputer_U.in.bus_inputs.fac_own_bus.fac_slat_angle_deg; + } else { + rtb_Switch_k_0 = &FmgcComputer_U.in.bus_inputs.fac_opp_bus.fac_slat_angle_deg; + } + + FmgcComputer_MATLABFunction_j(rtb_Switch_k_0, FmgcComputer_P.A429ValueOrDefault1_defaultValue, &rtb_y_j); + if (FmgcComputer_U.in.discrete_inputs.fac_own_healthy) { + rtb_Switch_k_0 = &FmgcComputer_U.in.bus_inputs.fac_own_bus.discrete_word_5; + } else { + rtb_Switch_k_0 = &FmgcComputer_U.in.bus_inputs.fac_opp_bus.discrete_word_5; + } + + FmgcComputer_MATLABFunction_k(rtb_Switch_k_0, FmgcComputer_P.BitfromLabel2_bit_l, &rtb_y_jz); + FmgcComputer_MATLABFunction_f(rtb_Switch_k_0, &rtb_Compare_pf); + FmgcComputer_Y.out.logic.fac_flap_slat_data_failure = ((rtb_y_jz != 0U) || (!rtb_Compare_pf)); + rtb_BusAssignment_h_logic_fcu_failure = ((!FmgcComputer_U.in.discrete_inputs.fcu_opp_healthy) && + (!FmgcComputer_U.in.discrete_inputs.fcu_own_healthy)); + FmgcComputer_MATLABFunction_f(&FmgcComputer_U.in.bus_inputs.ils_opp_bus.glideslope_deviation_deg, &rtb_y_dh); + FmgcComputer_MATLABFunction_f(&FmgcComputer_U.in.bus_inputs.ils_opp_bus.localizer_deviation_deg, &rtb_Compare_pf); + rtb_y_gd = (rtb_y_dh && rtb_Compare_pf); + FmgcComputer_MATLABFunction_f(&FmgcComputer_U.in.bus_inputs.ils_own_bus.glideslope_deviation_deg, &rtb_y_dh); + FmgcComputer_MATLABFunction_f(&FmgcComputer_U.in.bus_inputs.ils_own_bus.localizer_deviation_deg, &rtb_Compare_pf); + rtb_AND10 = (rtb_y_dh && rtb_Compare_pf); + rtb_OR9 = ((!rtb_y_gd) && (!rtb_AND10)); + rtb_BusAssignment_g_logic_both_ils_valid = (rtb_y_gd && rtb_AND10); + if (rtb_AND10) { + rtb_y_jz = FmgcComputer_U.in.bus_inputs.ils_own_bus.runway_heading_deg.SSM; + rtb_Switch_runway_heading_deg_Data = FmgcComputer_U.in.bus_inputs.ils_own_bus.runway_heading_deg.Data; + FmgcComputer_Y.out.logic.ils_computation_data.ils_frequency_mhz = + FmgcComputer_U.in.bus_inputs.ils_own_bus.ils_frequency_mhz; + rtb_Switch_localizer_deviation_deg_SSM = FmgcComputer_U.in.bus_inputs.ils_own_bus.localizer_deviation_deg.SSM; + rtb_Switch_localizer_deviation_deg_Data = FmgcComputer_U.in.bus_inputs.ils_own_bus.localizer_deviation_deg.Data; + rtb_Switch_glideslope_deviation_deg_SSM = FmgcComputer_U.in.bus_inputs.ils_own_bus.glideslope_deviation_deg.SSM; + rtb_Switch_glideslope_deviation_deg_Data = FmgcComputer_U.in.bus_inputs.ils_own_bus.glideslope_deviation_deg.Data; + } else { + rtb_y_jz = FmgcComputer_U.in.bus_inputs.ils_opp_bus.runway_heading_deg.SSM; + rtb_Switch_runway_heading_deg_Data = FmgcComputer_U.in.bus_inputs.ils_opp_bus.runway_heading_deg.Data; + FmgcComputer_Y.out.logic.ils_computation_data.ils_frequency_mhz = + FmgcComputer_U.in.bus_inputs.ils_opp_bus.ils_frequency_mhz; + rtb_Switch_localizer_deviation_deg_SSM = FmgcComputer_U.in.bus_inputs.ils_opp_bus.localizer_deviation_deg.SSM; + rtb_Switch_localizer_deviation_deg_Data = FmgcComputer_U.in.bus_inputs.ils_opp_bus.localizer_deviation_deg.Data; + rtb_Switch_glideslope_deviation_deg_SSM = FmgcComputer_U.in.bus_inputs.ils_opp_bus.glideslope_deviation_deg.SSM; + rtb_Switch_glideslope_deviation_deg_Data = FmgcComputer_U.in.bus_inputs.ils_opp_bus.glideslope_deviation_deg.Data; + } + + in_land_or_ga_tmp = (FmgcComputer_DWork.Delay_DSTATE.lateral_modes.land_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_goaround_active); + if (rtb_fmgcOppPriority && rtb_Compare) { + rtb_y_c = FmgcComputer_U.in.bus_inputs.ra_own_bus.radio_height_ft.Data; + } else if (raOwnInvalid && rtb_Compare) { + rtb_y_c = FmgcComputer_U.in.bus_inputs.ra_opp_bus.radio_height_ft.Data; + } else if (rtb_fmgcOppPriority && raOppInvalid) { + rtb_y_c = FmgcComputer_U.in.bus_inputs.ra_own_bus.radio_height_ft.Data; + } else { + rtb_y_c = 250.0F; + } + + rtb_AND10 = ((!rtb_doubleAdrFault) && (!rtb_doubleIrFault) && ((!rtb_y_b) || in_land_or_ga_tmp) && + (FmgcComputer_U.in.fms_inputs.fm_valid || in_land_or_ga_tmp || + (FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.gs_trk_active && (rtb_y_c < 700.0F)))); + rtb_NOT4_gb = !FmgcComputer_DWork.Delay_DSTATE.armed_modes.land_armed; + rtb_OR_nn = !FmgcComputer_DWork.Delay_DSTATE.lateral_modes.land_active; + rtb_ap_fd_condition_tmp = !rtb_dualRaFailure; + rtb_OR1_j = !FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.gs_capt_active; + rtb_OR_nx = !FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.gs_trk_active; + rtb_ap_fd_condition = (((!FmgcComputer_P.Constant1_Value.fac_weights_failure) || in_land_or_ga_tmp) && + ((!FmgcComputer_P.Constant1_Value.fac_speeds_failure) || FmgcComputer_DWork.Delay_DSTATE.lateral_modes.land_active) + && (rtb_ap_fd_condition_tmp || (rtb_NOT4_gb && rtb_OR1_j && rtb_OR_nx && rtb_OR_nn)) && + ((!rtb_BusAssignment_h_logic_fcu_failure) || in_land_or_ga_tmp)); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fcu_bus.fcu_discrete_word_2, + FmgcComputer_P.BitfromLabel_bit_n, &rtb_y_en); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fcu_bus.fcu_discrete_word_2, + FmgcComputer_P.BitfromLabel1_bit_i, &rtb_y_gp); + if (FmgcComputer_U.in.discrete_inputs.is_unit_1) { + fdOwnOff = (rtb_y_en != 0U); + fdOppOff = (rtb_y_gp != 0U); + } else { + fdOwnOff = (rtb_y_gp != 0U); + fdOppOff = (rtb_y_en != 0U); + } + + fdOwnOff = (rtb_AND10 && rtb_ap_fd_condition && ((!fdOwnOff) || ((!fdOppOff) && + (!FmgcComputer_U.in.discrete_inputs.fd_opp_engaged)))); + FmgcComputer_MATLABFunction_i(FmgcComputer_U.in.discrete_inputs.fcu_ap_button, FmgcComputer_P.PulseNode_isRisingEdge, + &rtb_y_dh, &FmgcComputer_DWork.sf_MATLABFunction_i); + FmgcComputer_MATLABFunction(!rtb_OR9_b, FmgcComputer_U.in.time.dt, FmgcComputer_P.ConfirmNode1_isRisingEdge, + FmgcComputer_P.ConfirmNode1_timeDelay, &rtb_y_gd, &FmgcComputer_DWork.sf_MATLABFunction_f); + fdOppOff = ((FmgcComputer_U.in.discrete_inputs.eng_opp_stop && FmgcComputer_U.in.discrete_inputs.eng_own_stop && + rtb_OR9_b) || rtb_y_gd); + FmgcComputer_MATLABFunction_i(FmgcComputer_U.in.discrete_inputs.ap_opp_engaged, + FmgcComputer_P.PulseNode2_isRisingEdge, &rtb_y_gx, &FmgcComputer_DWork.sf_MATLABFunction_c); + rtb_appInop_idx_0 = !FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_goaround_active; + rtb_OR2_tmp = (rtb_NOT4_gb && rtb_OR_nn); + rtb_OR2 = (rtb_OR2_tmp && rtb_appInop_idx_0); + FmgcComputer_MATLABFunction_i(rtb_OR2, FmgcComputer_P.PulseNode1_isRisingEdge, &rtb_Compare_pf, + &FmgcComputer_DWork.sf_MATLABFunction_h); + rtb_TmpSignalConversionAtSFunctionInport3_idx_1 = ((!FmgcComputer_U.in.discrete_inputs.ap_instinctive_disc) && + ((!FmgcComputer_U.in.discrete_inputs.elac_own_ap_disc) || (!FmgcComputer_U.in.discrete_inputs.elac_opp_ap_disc))); + rtb_NOT3 = !rtb_AND10; + rtb_ap_inop_tmp = (rtb_NOT3 || (!rtb_ap_fd_condition) || (!rtb_TmpSignalConversionAtSFunctionInport3_idx_1)); + rtb_Logic_idx_0_tmp = !FmgcComputer_U.in.discrete_inputs.is_unit_1; + FmgcComputer_DWork.Memory_PreviousInput = FmgcComputer_P.Logic_table[(((static_cast(rtb_y_dh && + (!FmgcComputer_DWork.Delay_DSTATE_p) && fdOppOff && rtb_ap_fd_condition && rtb_AND10 && + rtb_TmpSignalConversionAtSFunctionInport3_idx_1) << 1) + (rtb_ap_inop_tmp || (rtb_y_dh && + FmgcComputer_DWork.Delay_DSTATE_p) || FmgcComputer_U.in.discrete_inputs.ap_instinctive_disc || ((rtb_y_gx && + rtb_OR2) || (FmgcComputer_U.in.discrete_inputs.ap_opp_engaged && rtb_Compare_pf && rtb_Logic_idx_0_tmp)))) << 1) + + FmgcComputer_DWork.Memory_PreviousInput]; + FmgcComputer_MATLABFunction(FmgcComputer_DWork.Memory_PreviousInput, FmgcComputer_U.in.time.dt, + FmgcComputer_P.ConfirmNode_isRisingEdge, FmgcComputer_P.ConfirmNode_timeDelay, &rtb_y_gx, + &FmgcComputer_DWork.sf_MATLABFunction); + FmgcComputer_DWork.Delay_DSTATE_p = FmgcComputer_P.Logic_table_h[(((static_cast(rtb_y_dh && + FmgcComputer_DWork.Memory_PreviousInput) << 1) + ((!rtb_y_gx) || + FmgcComputer_U.in.discrete_inputs.ap_instinctive_disc)) << 1) + FmgcComputer_DWork.Memory_PreviousInput_g]; + if (rtb_fmgcOppPriority && rtb_Compare) { + rtb_BusAssignment_i_logic_ra_computation_data_ft = FmgcComputer_U.in.bus_inputs.ra_own_bus.radio_height_ft.Data; + } else if (raOwnInvalid && rtb_Compare) { + rtb_BusAssignment_i_logic_ra_computation_data_ft = FmgcComputer_U.in.bus_inputs.ra_opp_bus.radio_height_ft.Data; + } else if (rtb_fmgcOppPriority && raOppInvalid) { + rtb_BusAssignment_i_logic_ra_computation_data_ft = FmgcComputer_U.in.bus_inputs.ra_own_bus.radio_height_ft.Data; + } else { + rtb_BusAssignment_i_logic_ra_computation_data_ft = 250.0; + } + + FmgcComputer_Y.out.logic.slat_position = rtb_y_j; + FmgcComputer_MATLABFunction(FmgcComputer_U.in.discrete_inputs.athr_instinctive_disc, FmgcComputer_U.in.time.dt, + FmgcComputer_P.ConfirmNode1_isRisingEdge_n, FmgcComputer_P.ConfirmNode1_timeDelay_l, &rtb_y_gx, + &FmgcComputer_DWork.sf_MATLABFunction_k); + FmgcComputer_DWork.Memory_PreviousInput_g1 = FmgcComputer_P.Logic_table_f[(((static_cast(rtb_y_gx) << 1) + + FmgcComputer_P.Constant_Value) << 1) + FmgcComputer_DWork.Memory_PreviousInput_g1]; + FmgcComputer_MATLABFunction_i(FmgcComputer_U.in.discrete_inputs.fcu_athr_button, + FmgcComputer_P.PulseNode_isRisingEdge_k, &rtb_y_gd, &FmgcComputer_DWork.sf_MATLABFunction_o); + FmgcComputer_MATLABFunction_i(FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_goaround_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_takeoff_active, FmgcComputer_P.PulseNode1_isRisingEdge_m, + &rtb_y_dh, &FmgcComputer_DWork.sf_MATLABFunction_kq); + FmgcComputer_MATLABFunction_j(&FmgcComputer_U.in.bus_inputs.fadec_opp_bus.selected_tla_deg, + FmgcComputer_P.A429ValueOrDefault_defaultValue_n, &rtb_y_j); + rtb_Compare = (rtb_y_j < FmgcComputer_P.CompareToConstant_const); + FmgcComputer_MATLABFunction_j(&FmgcComputer_U.in.bus_inputs.fadec_own_bus.selected_tla_deg, + FmgcComputer_P.A429ValueOrDefault1_defaultValue_p, &rtb_y_j); + FmgcComputer_MATLABFunction_i(rtb_Compare && (rtb_y_j < FmgcComputer_P.CompareToConstant1_const), + FmgcComputer_P.PulseNode2_isRisingEdge_n, &rtb_Compare_pf, &FmgcComputer_DWork.sf_MATLABFunction_d); + raOwnInvalid = !FmgcComputer_DWork.Memory_PreviousInput_g1; + rtb_Compare = (rtb_NOT3 || (!raOwnInvalid)); + FmgcComputer_DWork.Delay_DSTATE_k = FmgcComputer_P.Logic_table_n[(((static_cast(rtb_AND10 && raOwnInvalid && + ((rtb_y_gd && ((rtb_raComputationData > 100.0F) || rtb_dualRaFailure)) || rtb_y_dh)) << 1) + (rtb_Compare || + (FmgcComputer_DWork.Delay_DSTATE_k && rtb_y_gd && + (!FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.lateral_modes.land_active)) || + FmgcComputer_U.in.discrete_inputs.athr_instinctive_disc || rtb_Compare_pf)) << 1) + + FmgcComputer_DWork.Memory_PreviousInput_p]; + raOwnInvalid = (FmgcComputer_U.in.discrete_inputs.ap_opp_engaged || FmgcComputer_U.in.discrete_inputs.fd_opp_engaged); + rtb_fmgcOppPriority_tmp = !FmgcComputer_DWork.Delay_DSTATE_p; + raOppInvalid = !fdOwnOff; + rtb_fmgcOppPriority = (raOwnInvalid || FmgcComputer_U.in.discrete_inputs.athr_opp_engaged); + rtb_NOT3 = !FmgcComputer_DWork.Delay_DSTATE_k; + rtb_fmgcOppPriority = ((rtb_Logic_idx_0_tmp || (rtb_fmgcOppPriority_tmp && + (FmgcComputer_U.in.discrete_inputs.ap_opp_engaged || raOppInvalid) && (raOwnInvalid || rtb_NOT3) && + rtb_fmgcOppPriority)) && (FmgcComputer_U.in.discrete_inputs.is_unit_1 || ((rtb_fmgcOppPriority_tmp || + FmgcComputer_U.in.discrete_inputs.ap_opp_engaged) && (raOwnInvalid || raOppInvalid) && (rtb_fmgcOppPriority || + rtb_NOT3) && (FmgcComputer_DWork.Delay_DSTATE_p || fdOwnOff || FmgcComputer_DWork.Delay_DSTATE_k || + (!FmgcComputer_U.in.discrete_inputs.fmgc_opp_healthy))))); + rtb_BusAssignment_m_ap_fd_logic_fmgc_opp_mode_sync_tmp = !FmgcComputer_U.in.discrete_inputs.ap_opp_engaged; + raOwnInvalid = (rtb_fmgcOppPriority && (rtb_fmgcOppPriority_tmp || + rtb_BusAssignment_m_ap_fd_logic_fmgc_opp_mode_sync_tmp)); + raOppInvalid = (FmgcComputer_DWork.Delay_DSTATE_p || FmgcComputer_U.in.discrete_inputs.ap_opp_engaged || fdOwnOff || + FmgcComputer_U.in.discrete_inputs.fd_opp_engaged); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_1, + FmgcComputer_P.BitfromLabel_bit_c, &rtb_y_gp); + FmgcComputer_MATLABFunction(rtb_OR9_b, FmgcComputer_U.in.time.dt, FmgcComputer_P.ConfirmNode_isRisingEdge_h, + FmgcComputer_P.ConfirmNode_timeDelay_i, &rtb_y_dh, &FmgcComputer_DWork.sf_MATLABFunction_hz); + FmgcComputer_MATLABFunction_j(&FmgcComputer_U.in.bus_inputs.fadec_opp_bus.selected_tla_deg, + FmgcComputer_P.A429ValueOrDefault_defaultValue_l, &rtb_y_j); + rtb_y_mq = (rtb_y_j < FmgcComputer_P.CompareToConstant3_const); + rtb_NOT3 = !rtb_y_mq; + FmgcComputer_MATLABFunction_g(&FmgcComputer_U.in.bus_inputs.fadec_opp_bus.selected_flex_temp_deg, &rtb_y_gd); + rtb_y_gx = (rtb_y_mq && (rtb_y_j > FmgcComputer_P.CompareToConstant4_const) && rtb_y_gd); + FmgcComputer_MATLABFunction_j(&FmgcComputer_U.in.bus_inputs.fadec_own_bus.selected_tla_deg, + FmgcComputer_P.A429ValueOrDefault1_defaultValue_b, &rtb_y_j); + rtb_y_mq = (rtb_y_j < FmgcComputer_P.CompareToConstant5_const); + FmgcComputer_MATLABFunction_g(&FmgcComputer_U.in.bus_inputs.fadec_own_bus.selected_flex_temp_deg, &rtb_Compare_pf); + FmgcComputer_MATLABFunction_i(rtb_NOT3 || rtb_y_gx || (!rtb_y_mq) || (rtb_y_mq && (rtb_y_j > + FmgcComputer_P.CompareToConstant6_const) && rtb_Compare_pf), FmgcComputer_P.PulseNode_isRisingEdge_p, + &rtb_Compare_pf, &FmgcComputer_DWork.sf_MATLABFunction_gk); + rtb_y_gx = !raOwnInvalid; + rtb_OR_od_tmp = !FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_takeoff_active; + rtb_OR_od_tmp_0 = (rtb_y_gx && rtb_OR_od_tmp && rtb_appInop_idx_0); + rtb_NOT3 = (((FmgcComputer_U.in.fms_inputs.v_2_kts > FmgcComputer_P.CompareToConstant1_const_k) && (rtb_y_gp != 0U) && + raOwnInvalid) || (rtb_OR_od_tmp_0 && rtb_y_dh && (FmgcComputer_U.in.fms_inputs.v_2_kts > + FmgcComputer_P.CompareToConstant2_const) && (FmgcComputer_P.Constant_Value_o >= + FmgcComputer_P.CompareToConstant_const_b) && rtb_Compare_pf)); + FmgcComputer_MATLABFunction(rtb_NOT3, FmgcComputer_U.in.time.dt, FmgcComputer_P.ConfirmNode_isRisingEdge_c, + FmgcComputer_P.ConfirmNode_timeDelay_h, &rtb_Compare_pf, &FmgcComputer_DWork.sf_MATLABFunction_fx); + rtb_OR2 = !raOppInvalid; + rtb_Logic_gj_idx_0_tmp_tmp_tmp = (FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.vs_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.fpa_active); + rtb_Logic_gj_idx_0_tmp_tmp_tmp_0 = (rtb_Logic_gj_idx_0_tmp_tmp_tmp || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.alt_acq_active); + rtb_Logic_gj_idx_0_tmp_tmp = (rtb_Logic_gj_idx_0_tmp_tmp_tmp_0 || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.alt_hold_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.clb_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.des_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.exp_clb_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.exp_des_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.final_des_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.gs_capt_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.gs_trk_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.op_clb_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.op_des_active); + rtb_NOT1_p = (rtb_Logic_gj_idx_0_tmp_tmp || FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_goaround_active + || FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.tcas_active); + FmgcComputer_DWork.Memory_PreviousInput_k = FmgcComputer_P.Logic_table_b[(((rtb_OR2 || ((rtb_NOT1_p || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.land_active) && (!rtb_Compare_pf))) + (static_cast + (rtb_NOT3) << 1)) << 1) + FmgcComputer_DWork.Memory_PreviousInput_k]; + rtb_BusAssignment_f4_logic_ils_computation_data_runway_heading_deg.SSM = rtb_y_jz; + rtb_BusAssignment_f4_logic_ils_computation_data_runway_heading_deg.Data = rtb_Switch_runway_heading_deg_Data; + rtb_BusAssignment_f4_logic_ils_computation_data_localizer_deviation_deg.SSM = rtb_Switch_localizer_deviation_deg_SSM; + rtb_BusAssignment_f4_logic_ils_computation_data_localizer_deviation_deg.Data = + rtb_Switch_localizer_deviation_deg_Data; + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_2, + FmgcComputer_P.BitfromLabel_bit_m, &rtb_y_gp); + rtb_y_mq = (rtb_y_gp != 0U); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_2, + FmgcComputer_P.BitfromLabel1_bit_g, &rtb_y_gp); + FmgcComputer_MATLABFunction_d(FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_takeoff_active, + FmgcComputer_U.in.time.dt, &rtb_Compare_pf, FmgcComputer_P.MTrigNode_isRisingEdge, + FmgcComputer_P.MTrigNode_retriggerable, FmgcComputer_P.MTrigNode_triggerDuration, + &FmgcComputer_DWork.sf_MATLABFunction_db); + FmgcComputer_MATLABFunction_j(&rtb_BusAssignment_f4_logic_ils_computation_data_runway_heading_deg, + FmgcComputer_P.A429ValueOrDefault1_defaultValue_m, &rtb_y_j); + rtb_Abs1 = std::abs(static_cast(rtb_y_j) - rtb_hdg); + FmgcComputer_MATLABFunction_j(&rtb_BusAssignment_f4_logic_ils_computation_data_localizer_deviation_deg, + FmgcComputer_P.A429ValueOrDefault_defaultValue_e, &rtb_y_j); + FmgcComputer_MATLABFunction_g(&rtb_BusAssignment_f4_logic_ils_computation_data_localizer_deviation_deg, &rtb_y_gd); + FmgcComputer_MATLABFunction(rtb_OR9_b, FmgcComputer_U.in.time.dt, FmgcComputer_P.ConfirmNode_isRisingEdge_p, + FmgcComputer_P.ConfirmNode_timeDelay_o, &rtb_y_dh, &FmgcComputer_DWork.sf_MATLABFunction_fm); + if (rtb_y_j < 0.0F) { + rtb_Sum1 = -rtb_y_j; + } else { + rtb_Sum1 = rtb_y_j; + } + + rtb_NOT3 = ((rtb_y_mq && (rtb_y_gp != 0U) && raOwnInvalid) || (rtb_y_gx && + (!FmgcComputer_DWork.Delay_DSTATE.lateral_modes.rwy_loc_submode_active) && ((FmgcComputer_P.Constant_Value_o >= + FmgcComputer_P.CompareToConstant_const_cq) && rtb_Compare_pf && (rtb_Abs1 <= + FmgcComputer_P.CompareToConstant2_const_b) && (rtb_Sum1 < FmgcComputer_P.CompareToConstant1_const_i) && + FmgcComputer_P.Constant_Value_j && rtb_y_gd && rtb_y_dh))); + FmgcComputer_MATLABFunction(rtb_NOT3, FmgcComputer_U.in.time.dt, FmgcComputer_P.ConfirmNode_isRisingEdge_l, + FmgcComputer_P.ConfirmNode_timeDelay_f, &rtb_Compare_pf, &FmgcComputer_DWork.sf_MATLABFunction_jl); + rtb_y_dh = !rtb_Compare_pf; + FmgcComputer_MATLABFunction_g(&rtb_BusAssignment_f4_logic_ils_computation_data_localizer_deviation_deg, + &rtb_Compare_pf); + FmgcComputer_DWork.Memory_PreviousInput_c = FmgcComputer_P.Logic_table_hz[((((rtb_y_dh && + (FmgcComputer_DWork.Delay_DSTATE.lateral_modes.rwy_trk_submode_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.roll_goaround_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.nav_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.loc_trk_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.loc_cpt_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.hdg_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.trk_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.land_active)) || rtb_OR2 || (!rtb_Compare_pf)) + + (static_cast(rtb_NOT3) << 1)) << 1) + FmgcComputer_DWork.Memory_PreviousInput_c]; + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_2, + FmgcComputer_P.BitfromLabel_bit_f, &rtb_y_gp); + rtb_y_mq = (rtb_y_gp != 0U); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_2, + FmgcComputer_P.BitfromLabel1_bit_n, &rtb_y_gp); + FmgcComputer_MATLABFunction_d(rtb_raComputationData >= FmgcComputer_P.CompareToConstant_const_l, + FmgcComputer_U.in.time.dt, &rtb_Compare_pf, FmgcComputer_P.MTrigNode_isRisingEdge_j, + FmgcComputer_P.MTrigNode_retriggerable_p, FmgcComputer_P.MTrigNode_triggerDuration_n, + &FmgcComputer_DWork.sf_MATLABFunction_mn); + rtb_OR_c_tmp = !FmgcComputer_DWork.Delay_DSTATE.lateral_modes.nav_active; + rtb_NOT3 = ((rtb_y_mq && (rtb_y_gp != 0U) && raOwnInvalid) || (rtb_y_gx && (rtb_OR_c_tmp && + (!FmgcComputer_DWork.Delay_DSTATE.armed_modes.nav_armed)) && rtb_Compare_pf)); + FmgcComputer_MATLABFunction(rtb_NOT3, FmgcComputer_U.in.time.dt, FmgcComputer_P.ConfirmNode_isRisingEdge_hu, + FmgcComputer_P.ConfirmNode_timeDelay_j, &rtb_Compare_pf, &FmgcComputer_DWork.sf_MATLABFunction_kz); + FmgcComputer_DWork.Memory_PreviousInput_b = FmgcComputer_P.Logic_table_d[(((((!rtb_Compare_pf) && + (FmgcComputer_DWork.Delay_DSTATE.lateral_modes.rwy_loc_submode_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.roll_goaround_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.nav_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.loc_trk_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.loc_cpt_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.hdg_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.trk_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.land_active)) || rtb_OR2) + (static_cast(rtb_NOT3) << 1)) + << 1) + FmgcComputer_DWork.Memory_PreviousInput_b]; + FmgcComputer_Y.out.logic.flap_position = rtb_y_ke; + rtb_NOT3 = (FmgcComputer_DWork.Memory_PreviousInput_c || FmgcComputer_DWork.Memory_PreviousInput_b); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_3, + FmgcComputer_P.BitfromLabel_bit_k, &rtb_y_gp); + rtb_y_nk = ((rtb_y_gp != 0U) && raOwnInvalid); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fcu_bus.fcu_discrete_word_1, + FmgcComputer_P.BitfromLabel2_bit_b, &rtb_y_gp); + FmgcComputer_MATLABFunction_i(rtb_y_gp != 0U, FmgcComputer_P.PulseNode_isRisingEdge_l, &rtb_y_gd, + &FmgcComputer_DWork.sf_MATLABFunction_hh); + FmgcComputer_MATLABFunction(FmgcComputer_DWork.Delay_DSTATE.armed_modes.land_armed, FmgcComputer_U.in.time.dt, + FmgcComputer_P.ConfirmNode_isRisingEdge_f, FmgcComputer_P.ConfirmNode_timeDelay_d, &rtb_Compare_pf, + &FmgcComputer_DWork.sf_MATLABFunction_ha); + FmgcComputer_MATLABFunction_j(&FmgcComputer_U.in.bus_inputs.ils_opp_bus.ils_frequency_mhz, + FmgcComputer_P.A429ValueOrDefault_defaultValue_ek, &rtb_y_c); + FmgcComputer_MATLABFunction_j(&FmgcComputer_U.in.bus_inputs.ils_own_bus.ils_frequency_mhz, + FmgcComputer_P.A429ValueOrDefault1_defaultValue_f, &rtb_y_je); + FmgcComputer_MATLABFunction_j(&FmgcComputer_U.in.bus_inputs.ils_opp_bus.runway_heading_deg, + FmgcComputer_P.A429ValueOrDefault2_defaultValue, &rtb_y_ke); + FmgcComputer_MATLABFunction_j(&FmgcComputer_U.in.bus_inputs.ils_own_bus.runway_heading_deg, + FmgcComputer_P.A429ValueOrDefault3_defaultValue, &rtb_y_j); + rtb_y_ae_tmp = !FmgcComputer_P.Constant2_Value_p; + rtb_NOT4_gb = !FmgcComputer_DWork.Delay_DSTATE.lateral_modes.rwy_active; + rtb_y_ae_tmp_0 = !FmgcComputer_DWork.Delay_DSTATE.lateral_modes.roll_goaround_active; + rtb_y_ae_tmp_1 = !FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.final_des_active; + rtb_y_ae_tmp_2 = !rtb_OR9; + rtb_y_mq = (rtb_OR_nn && (rtb_y_nk || (rtb_y_gx && (FmgcComputer_P.Constant_Value_l && rtb_y_ae_tmp_2 && + (rtb_BusAssignment_i_logic_ra_computation_data_ft >= FmgcComputer_P.CompareToConstant_const_g) && + rtb_ap_fd_condition_tmp && rtb_y_gd && (!rtb_Compare_pf) && (rtb_y_ae_tmp_1 && + (!FmgcComputer_DWork.Delay_DSTATE.armed_modes.final_des_armed))) && rtb_OR_od_tmp && rtb_appInop_idx_0 && + rtb_NOT4_gb && rtb_y_ae_tmp_0 && rtb_y_ae_tmp && rtb_y_ae_tmp && ((rtb_y_c == rtb_y_je) && (rtb_y_ke == rtb_y_j))))); + rtb_y_k = (FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.gs_capt_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.gs_trk_active); + rtb_TmpSignalConversionAtSFunctionInport3_idx_1 = (FmgcComputer_DWork.Delay_DSTATE.lateral_modes.loc_cpt_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.loc_trk_active); + FmgcComputer_MATLABFunction_i(FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.vs_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.fpa_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.op_clb_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.op_des_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.exp_clb_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.exp_des_active, FmgcComputer_P.PulseNode2_isRisingEdge_e, + &rtb_y_dh, &FmgcComputer_DWork.sf_MATLABFunction_kb); + FmgcComputer_MATLABFunction_i(FmgcComputer_DWork.Delay_DSTATE.lateral_modes.hdg_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.trk_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.nav_active, FmgcComputer_P.PulseNode3_isRisingEdge, &rtb_Compare_pf, + &FmgcComputer_DWork.sf_MATLABFunction_eb2); + rtb_y_nk = (rtb_TmpSignalConversionAtSFunctionInport3_idx_1 && rtb_Compare_pf); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fcu_bus.fcu_discrete_word_2, + FmgcComputer_P.BitfromLabel1_bit_l, &rtb_y_gp); + FmgcComputer_MATLABFunction_i(rtb_y_gp != 0U, FmgcComputer_P.PulseNode1_isRisingEdge_c, &rtb_Compare_pf, + &FmgcComputer_DWork.sf_MATLABFunction_es); + FmgcComputer_DWork.Memory_PreviousInput_l = FmgcComputer_P.Logic_table_k[(((in_land_or_ga_tmp || ((!rtb_y_k) && + (!rtb_TmpSignalConversionAtSFunctionInport3_idx_1) && FmgcComputer_DWork.Delay_DSTATE.armed_modes.nav_armed) || + ((rtb_y_k && rtb_y_dh) || rtb_y_nk) || (rtb_y_gd && FmgcComputer_DWork.Delay_DSTATE.armed_modes.land_armed) || + rtb_Compare_pf || rtb_OR2) + (static_cast(rtb_y_mq) << 1)) << 1) + + FmgcComputer_DWork.Memory_PreviousInput_l]; + FmgcComputer_MATLABFunction(!FmgcComputer_DWork.Delay_DSTATE.lateral_modes.land_active, FmgcComputer_U.in.time.dt, + FmgcComputer_P.ConfirmNode_isRisingEdge_e, FmgcComputer_P.ConfirmNode_timeDelay_l, &rtb_y_dh, + &FmgcComputer_DWork.sf_MATLABFunction_mq); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_4, + FmgcComputer_P.BitfromLabel_bit_ff, &rtb_y_gp); + FmgcComputer_MATLABFunction(rtb_raComputationData < FmgcComputer_P.CompareToConstant_const_d, + FmgcComputer_U.in.time.dt, FmgcComputer_P.ConfirmNode1_isRisingEdge_g, FmgcComputer_P.ConfirmNode1_timeDelay_d, + &rtb_Compare_pf, &FmgcComputer_DWork.sf_MATLABFunction_crq); + rtb_y_mq = (rtb_y_dh && (((rtb_y_gp != 0U) && raOwnInvalid) || (rtb_y_gx && + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.gs_trk_active && + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.loc_trk_active && rtb_Compare_pf))); + FmgcComputer_MATLABFunction(rtb_y_mq, FmgcComputer_U.in.time.dt, FmgcComputer_P.ConfirmNode_isRisingEdge_d, + FmgcComputer_P.ConfirmNode_timeDelay_a, &rtb_Compare_pf, &FmgcComputer_DWork.sf_MATLABFunction_op); + rtb_y_k = !rtb_Compare_pf; + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fcu_bus.fcu_discrete_word_1, + FmgcComputer_P.BitfromLabel2_bit_f, &rtb_y_gp); + FmgcComputer_MATLABFunction_i(rtb_y_gp != 0U, FmgcComputer_P.PulseNode_isRisingEdge_a, &rtb_Compare_pf, + &FmgcComputer_DWork.sf_MATLABFunction_fa); + FmgcComputer_MATLABFunction(rtb_OR9_b, FmgcComputer_U.in.time.dt, FmgcComputer_P.ConfirmNode2_isRisingEdge, + FmgcComputer_P.ConfirmNode2_timeDelay, &rtb_y_dh, &FmgcComputer_DWork.sf_MATLABFunction_fo); + in_land_or_ga_tmp = (FmgcComputer_DWork.Delay_DSTATE.lateral_modes.rwy_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.roll_goaround_active); + rtb_y_gd = (in_land_or_ga_tmp || FmgcComputer_DWork.Delay_DSTATE.lateral_modes.loc_cpt_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.loc_trk_active); + rtb_Logic_d_idx_0_tmp = (rtb_y_gd || FmgcComputer_DWork.Delay_DSTATE.lateral_modes.hdg_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.trk_active); + FmgcComputer_DWork.Memory_PreviousInput_d = FmgcComputer_P.Logic_table_p[(((((rtb_NOT1_p || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_takeoff_active || (rtb_Logic_d_idx_0_tmp || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.nav_active)) && rtb_y_k) || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_goaround_active || (rtb_fmgcOppPriority_tmp && + rtb_BusAssignment_m_ap_fd_logic_fmgc_opp_mode_sync_tmp && rtb_Compare_pf && rtb_y_dh) || rtb_OR2) + + (static_cast(rtb_y_mq) << 1)) << 1) + FmgcComputer_DWork.Memory_PreviousInput_d]; + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_3, + FmgcComputer_P.BitfromLabel_bit_l, &rtb_y_gp); + rtb_y_mq = ((rtb_y_gp != 0U) && raOwnInvalid); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fcu_bus.fcu_discrete_word_1, + FmgcComputer_P.BitfromLabel2_bit_e, &rtb_y_gp); + FmgcComputer_MATLABFunction_i(rtb_y_gp != 0U, FmgcComputer_P.PulseNode_isRisingEdge_h, &rtb_Compare_pf, + &FmgcComputer_DWork.sf_MATLABFunction_d3); + rtb_NOT1_p = (rtb_OR_od_tmp && rtb_NOT4_gb && rtb_appInop_idx_0 && rtb_y_ae_tmp_0 && rtb_y_ae_tmp_1 && + rtb_Compare_pf); + FmgcComputer_DWork.Memory_PreviousInput_dv = FmgcComputer_P.Logic_table_c[(((static_cast(rtb_OR_nn && + rtb_y_mq) << 1) + false) << 1) + FmgcComputer_DWork.Memory_PreviousInput_dv]; + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_1, + FmgcComputer_P.BitfromLabel_bit_a, &rtb_y_gp); + FmgcComputer_DWork.Memory_PreviousInput_f = FmgcComputer_P.Logic_table_pl[(((static_cast((rtb_y_gp != 0U) && + raOwnInvalid) << 1) + false) << 1) + FmgcComputer_DWork.Memory_PreviousInput_f]; + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_1, + FmgcComputer_P.BitfromLabel_bit_cs, &rtb_y_gp); + FmgcComputer_MATLABFunction(rtb_OR9_b, FmgcComputer_U.in.time.dt, FmgcComputer_P.ConfirmNode_isRisingEdge_m, + FmgcComputer_P.ConfirmNode_timeDelay_j5, &rtb_NOT4_gb, &FmgcComputer_DWork.sf_MATLABFunction_hv); + FmgcComputer_MATLABFunction_j(&FmgcComputer_U.in.bus_inputs.fadec_opp_bus.selected_tla_deg, + FmgcComputer_P.A429ValueOrDefault_defaultValue_p, &rtb_y_j); + rtb_y_dh = (rtb_y_j >= FmgcComputer_P.CompareToConstant3_const_i); + FmgcComputer_MATLABFunction_j(&FmgcComputer_U.in.bus_inputs.fadec_own_bus.selected_tla_deg, + FmgcComputer_P.A429ValueOrDefault1_defaultValue_d, &rtb_y_j); + FmgcComputer_MATLABFunction_i(rtb_y_dh || (rtb_y_j >= FmgcComputer_P.CompareToConstant5_const_k), + FmgcComputer_P.PulseNode_isRisingEdge_c, &rtb_Compare_pf, &FmgcComputer_DWork.sf_MATLABFunction_fn); + rtb_y_dh = (((rtb_y_gp != 0U) && raOwnInvalid) || (rtb_OR_od_tmp_0 && (!rtb_NOT4_gb) && + (FmgcComputer_P.Constant_Value_o >= FmgcComputer_P.CompareToConstant_const_j) && rtb_Compare_pf)); + FmgcComputer_MATLABFunction(rtb_y_dh, FmgcComputer_U.in.time.dt, FmgcComputer_P.ConfirmNode_isRisingEdge_hj, + FmgcComputer_P.ConfirmNode_timeDelay_a3, &rtb_Compare_pf, &FmgcComputer_DWork.sf_MATLABFunction_lm); + FmgcComputer_DWork.Memory_PreviousInput_i = FmgcComputer_P.Logic_table_o[(((rtb_OR2 || ((rtb_Logic_gj_idx_0_tmp_tmp || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_takeoff_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.tcas_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.land_active) && (!rtb_Compare_pf))) + (static_cast + (rtb_y_dh) << 1)) << 1) + FmgcComputer_DWork.Memory_PreviousInput_i]; + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_2, + FmgcComputer_P.BitfromLabel_bit_e, &rtb_y_gp); + FmgcComputer_MATLABFunction_i(FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_goaround_active, + FmgcComputer_P.PulseNode_isRisingEdge_f, &rtb_Compare_pf, &FmgcComputer_DWork.sf_MATLABFunction_pn); + rtb_y_dh = (((rtb_y_gp != 0U) && raOwnInvalid) || (rtb_y_gx && (rtb_y_ae_tmp_0 && rtb_Compare_pf))); + FmgcComputer_MATLABFunction(rtb_y_dh, FmgcComputer_U.in.time.dt, FmgcComputer_P.ConfirmNode_isRisingEdge_mf, + FmgcComputer_P.ConfirmNode_timeDelay_dw, &rtb_Compare_pf, &FmgcComputer_DWork.sf_MATLABFunction_mtz); + FmgcComputer_DWork.Memory_PreviousInput_e = FmgcComputer_P.Logic_table_c2[(((rtb_OR2 || + ((FmgcComputer_DWork.Delay_DSTATE.lateral_modes.rwy_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.nav_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.loc_cpt_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.loc_trk_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.hdg_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.trk_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.land_active) && (!rtb_Compare_pf))) + (static_cast + (rtb_y_dh) << 1)) << 1) + FmgcComputer_DWork.Memory_PreviousInput_e]; + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_2, + FmgcComputer_P.BitfromLabel_bit_p, &rtb_y_gp); + rtb_y_dh = (rtb_y_gp != 0U); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_2, + FmgcComputer_P.BitfromLabel1_bit_o, &rtb_y_gp); + rtb_y_dh = (rtb_y_dh || (rtb_y_gp != 0U)); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fcu_bus.fcu_discrete_word_2, + FmgcComputer_P.BitfromLabel2_bit_i, &rtb_y_gp); + FmgcComputer_MATLABFunction_i(rtb_y_gp != 0U, FmgcComputer_P.PulseNode_isRisingEdge_i, &rtb_Compare_pf, + &FmgcComputer_DWork.sf_MATLABFunction_di2); + rtb_y_k = (fdOppOff && rtb_Compare_pf && rtb_OR_nn && (rtb_y_ae_tmp_0 || + (rtb_BusAssignment_i_logic_ra_computation_data_ft >= FmgcComputer_P.CompareToConstant_const_a))); + rtb_y_ae_tmp = !FmgcComputer_U.in.fms_inputs.lateral_flight_plan_valid; + rtb_y_mq = (FmgcComputer_DWork.Delay_DSTATE.lateral_modes.nav_active && rtb_y_ae_tmp && rtb_y_ae_tmp_1); + FmgcComputer_MATLABFunction_i(raOppInvalid, FmgcComputer_P.PulseNode1_isRisingEdge_e, &rtb_Compare_pf, + &FmgcComputer_DWork.sf_MATLABFunction_h4); + rtb_Logic_gj_idx_0_tmp_tmp = !rtb_OR9_b; + rtb_y_nk = (rtb_Logic_gj_idx_0_tmp_tmp && rtb_Compare_pf); + FmgcComputer_MATLABFunction_i(FmgcComputer_DWork.Delay_DSTATE.armed_modes.land_armed || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.land_active, FmgcComputer_P.PulseNode3_isRisingEdge_l, + &rtb_Compare_pf, &FmgcComputer_DWork.sf_MATLABFunction_gb); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fcu_bus.fcu_discrete_word_2, + FmgcComputer_P.BitfromLabel4_bit, &rtb_y_gp); + FmgcComputer_MATLABFunction_d(rtb_y_gp != 0U, FmgcComputer_U.in.time.dt, &rtb_NOT1_p, + FmgcComputer_P.MTrigNode_isRisingEdge_g, FmgcComputer_P.MTrigNode_retriggerable_f, + FmgcComputer_P.MTrigNode_triggerDuration_b, &FmgcComputer_DWork.sf_MATLABFunction_aw); + rtb_NOT4_gb = (rtb_TmpSignalConversionAtSFunctionInport3_idx_1 && rtb_Compare_pf && (!rtb_NOT1_p)); + FmgcComputer_MATLABFunction_i(rtb_y_gp != 0U, FmgcComputer_P.PulseNode2_isRisingEdge_b, &rtb_Compare_pf, + &FmgcComputer_DWork.sf_MATLABFunction_at); + rtb_NOT1_p = (rtb_TmpSignalConversionAtSFunctionInport3_idx_1 && rtb_OR2_tmp && rtb_Compare_pf); + rtb_y_dh = ((rtb_y_dh && raOwnInvalid) || (rtb_y_gx && (rtb_y_k || rtb_y_mq || rtb_y_nk || rtb_NOT4_gb || rtb_NOT1_p))); + FmgcComputer_MATLABFunction(rtb_y_dh, FmgcComputer_U.in.time.dt, FmgcComputer_P.ConfirmNode_isRisingEdge_a, + FmgcComputer_P.ConfirmNode_timeDelay_a2, &rtb_Compare_pf, &FmgcComputer_DWork.sf_MATLABFunction_hdw); + FmgcComputer_DWork.Memory_PreviousInput_f2 = FmgcComputer_P.Logic_table_i[(((((!rtb_Compare_pf) && (rtb_y_gd || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.nav_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.land_active)) || rtb_OR2) + (static_cast(rtb_y_dh) << 1)) << + 1) + FmgcComputer_DWork.Memory_PreviousInput_f2]; + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fcu_bus.fcu_discrete_word_1, + FmgcComputer_P.BitfromLabel3_bit, &rtb_y_gp); + rtb_OR2_tmp = ((rtb_y_gp != 0U) && FmgcComputer_DWork.Memory_PreviousInput_f2); + rtb_NOT4_gb = (FmgcComputer_DWork.Memory_PreviousInput_f2 && (rtb_y_gp == 0U)); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_3, + FmgcComputer_P.BitfromLabel_bit_fu, &rtb_y_gp); + rtb_y_dh = (rtb_y_gp != 0U); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fcu_bus.fcu_discrete_word_2, + FmgcComputer_P.BitfromLabel2_bit_m, &rtb_y_gp); + FmgcComputer_MATLABFunction_i(rtb_y_gp != 0U, FmgcComputer_P.PulseNode_isRisingEdge_j, &rtb_Compare_pf, + &FmgcComputer_DWork.sf_MATLABFunction_m1); + rtb_BusAssignment_m_ap_fd_logic_fmgc_opp_mode_sync_tmp = + !FmgcComputer_DWork.Delay_DSTATE.lateral_modes.loc_cpt_active; + rtb_OR_od_tmp_0 = !FmgcComputer_DWork.Delay_DSTATE.lateral_modes.loc_trk_active; + rtb_y_k = (rtb_BusAssignment_m_ap_fd_logic_fmgc_opp_mode_sync_tmp && rtb_OR_od_tmp_0 && rtb_OR_nn && rtb_Compare_pf); + FmgcComputer_MATLABFunction_g(&FmgcComputer_U.in.bus_inputs.fcu_bus.selected_hdg_deg, &rtb_y_nk); + FmgcComputer_MATLABFunction_g(&FmgcComputer_U.in.bus_inputs.fcu_bus.selected_trk_deg, &rtb_y_mq); + rtb_y_gd = ((!rtb_y_nk) && (!rtb_y_mq)); + FmgcComputer_MATLABFunction_i(FmgcComputer_U.in.fms_inputs.lateral_flight_plan_valid, + FmgcComputer_P.PulseNode3_isRisingEdge_e, &rtb_Compare_pf, &FmgcComputer_DWork.sf_MATLABFunction_hu); + rtb_fmgcOppPriority_tmp = ((!FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.any_lateral_mode_engaged) || + FmgcComputer_DWork.Memory_PreviousInput_c); + rtb_y_nk = rtb_fmgcOppPriority_tmp; + rtb_y_gd = (rtb_y_gx && FmgcComputer_U.in.fms_inputs.lateral_flight_plan_valid && (rtb_y_k || (rtb_OR9_b && + (rtb_y_gd || rtb_Compare_pf) && rtb_fmgcOppPriority_tmp))); + rtb_y_dh = ((rtb_y_dh && raOwnInvalid) || rtb_y_gd); + FmgcComputer_MATLABFunction_g(&FmgcComputer_U.in.bus_inputs.fcu_bus.selected_hdg_deg, &rtb_y_gd); + FmgcComputer_MATLABFunction_g(&FmgcComputer_U.in.bus_inputs.fcu_bus.selected_trk_deg, &rtb_Compare_pf); + FmgcComputer_MATLABFunction_i(rtb_y_gd || rtb_Compare_pf, FmgcComputer_P.PulseNode2_isRisingEdge_i, &rtb_Compare_pf, + &FmgcComputer_DWork.sf_MATLABFunction_h0); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fcu_bus.fcu_discrete_word_2, + FmgcComputer_P.BitfromLabel1_bit_p, &rtb_y_gp); + FmgcComputer_MATLABFunction_i(rtb_y_gp != 0U, FmgcComputer_P.PulseNode1_isRisingEdge_k, &rtb_y_nk, + &FmgcComputer_DWork.sf_MATLABFunction_jle); + FmgcComputer_DWork.Memory_PreviousInput_i1 = FmgcComputer_P.Logic_table_g[(((rtb_Compare_pf || rtb_y_nk || + (rtb_TmpSignalConversionAtSFunctionInport3_idx_1 || FmgcComputer_DWork.Delay_DSTATE.lateral_modes.land_active) || + rtb_y_ae_tmp || FmgcComputer_DWork.Delay_DSTATE.lateral_modes.nav_active || rtb_OR2) + (static_cast + (rtb_y_dh) << 1)) << 1) + FmgcComputer_DWork.Memory_PreviousInput_i1]; + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_2, + FmgcComputer_P.BitfromLabel_bit_nk, &rtb_y_gp); + rtb_y_dh = (((rtb_y_gp != 0U) && raOwnInvalid) || (rtb_y_gx && FmgcComputer_U.in.fms_inputs.nav_capture_condition && + (FmgcComputer_DWork.Delay_DSTATE.armed_modes.nav_armed || FmgcComputer_U.in.fms_inputs.direct_to_nav_engage) && + ((rtb_BusAssignment_i_logic_ra_computation_data_ft >= FmgcComputer_P.CompareToConstant_const_o) || + rtb_dualRaFailure))); + FmgcComputer_MATLABFunction(rtb_y_dh, FmgcComputer_U.in.time.dt, FmgcComputer_P.ConfirmNode_isRisingEdge_co, + FmgcComputer_P.ConfirmNode_timeDelay_d1, &rtb_Compare_pf, &FmgcComputer_DWork.sf_MATLABFunction_ge4); + FmgcComputer_DWork.Memory_PreviousInput_ip = FmgcComputer_P.Logic_table_a[(((rtb_y_ae_tmp || rtb_OR2 || + ((rtb_Logic_d_idx_0_tmp || FmgcComputer_DWork.Delay_DSTATE.lateral_modes.land_active) && (!rtb_Compare_pf))) + ( + static_cast(rtb_y_dh) << 1)) << 1) + FmgcComputer_DWork.Memory_PreviousInput_ip]; + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_3, + FmgcComputer_P.BitfromLabel_bit_o, &rtb_y_gp); + rtb_y_dh = (rtb_y_gp != 0U); + rtb_y_gd = rtb_y_gx; + FmgcComputer_MATLABFunction_i(FmgcComputer_DWork.Delay_DSTATE.armed_modes.land_armed || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.land_active, FmgcComputer_P.PulseNode1_isRisingEdge_cs, &rtb_NOT1_p, + &FmgcComputer_DWork.sf_MATLABFunction_ma); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fcu_bus.fcu_discrete_word_2, + FmgcComputer_P.BitfromLabel1_bit_ls, &rtb_y_gp); + FmgcComputer_MATLABFunction_i(rtb_y_gp != 0U, FmgcComputer_P.PulseNode2_isRisingEdge_o, &rtb_Compare_pf, + &FmgcComputer_DWork.sf_MATLABFunction_k4); + rtb_y_mq = (rtb_Compare_pf && rtb_y_ae_tmp_2 && (rtb_raComputationData >= FmgcComputer_P.CompareToConstant_const_m) && + ((FmgcComputer_P.EnumeratedConstant_Value_a != FmgcComputer_U.in.fms_inputs.fms_flight_phase) && + (FmgcComputer_U.in.fms_inputs.fms_flight_phase != FmgcComputer_P.EnumeratedConstant1_Value_dg))); + FmgcComputer_MATLABFunction(rtb_y_mq, FmgcComputer_U.in.time.dt, FmgcComputer_P.ConfirmNode_isRisingEdge_n, + FmgcComputer_P.ConfirmNode_timeDelay_g, &rtb_y_gd, &FmgcComputer_DWork.sf_MATLABFunction_ah); + FmgcComputer_MATLABFunction_i(FmgcComputer_DWork.Delay_DSTATE.armed_modes.land_armed, + FmgcComputer_P.PulseNode_isRisingEdge_g, &rtb_Compare_pf, &FmgcComputer_DWork.sf_MATLABFunction_ol); + FmgcComputer_DWork.Memory_PreviousInput_a = FmgcComputer_P.Logic_table_ku[(((((!rtb_y_gd) && rtb_Compare_pf) || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.loc_cpt_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.loc_trk_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_goaround_active) + (static_cast((rtb_y_dh && + raOwnInvalid) || (rtb_y_gx && (rtb_NOT1_p || rtb_y_mq))) << 1)) << 1) + FmgcComputer_DWork.Memory_PreviousInput_a]; + rtb_BusAssignment_k_logic_ils_computation_data_localizer_deviation_deg.SSM = rtb_Switch_localizer_deviation_deg_SSM; + rtb_BusAssignment_k_logic_ils_computation_data_localizer_deviation_deg.Data = + rtb_Switch_localizer_deviation_deg_Data; + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_2, + FmgcComputer_P.BitfromLabel_bit_j, &rtb_y_gp); + FmgcComputer_MATLABFunction_j(&rtb_BusAssignment_k_logic_ils_computation_data_localizer_deviation_deg, + FmgcComputer_P.A429ValueOrDefault_defaultValue_o, &rtb_y_j); + if (rtb_y_j < 0.0F) { + rtb_Abs1 = -rtb_y_j; + } else { + rtb_Abs1 = rtb_y_j; + } + + FmgcComputer_MATLABFunction_g(&rtb_BusAssignment_k_logic_ils_computation_data_localizer_deviation_deg, + &rtb_Compare_pf); + rtb_y_dh = (((rtb_y_gp != 0U) && raOwnInvalid) || (rtb_y_gx && FmgcComputer_DWork.Delay_DSTATE.armed_modes.loc_armed + && FmgcComputer_P.Constant_Value_d && (rtb_Abs1 < FmgcComputer_P.CompareToConstant1_const_b) && + (FmgcComputer_P.Constant_Value_d && (rtb_Abs1 < FmgcComputer_P.CompareToConstant2_const_n)) && rtb_Compare_pf)); + FmgcComputer_MATLABFunction(rtb_y_dh, FmgcComputer_U.in.time.dt, FmgcComputer_P.ConfirmNode_isRisingEdge_at, + FmgcComputer_P.ConfirmNode_timeDelay_h4, &rtb_Compare_pf, &FmgcComputer_DWork.sf_MATLABFunction_p4); + rtb_y_gd = (in_land_or_ga_tmp || FmgcComputer_DWork.Delay_DSTATE.lateral_modes.nav_active); + FmgcComputer_DWork.Memory_PreviousInput_cv = FmgcComputer_P.Logic_table_g4[(((((!rtb_Compare_pf) && (rtb_y_gd || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.loc_trk_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.hdg_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.trk_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.land_active)) || rtb_OR2) + (static_cast(rtb_y_dh) << 1)) << + 1) + FmgcComputer_DWork.Memory_PreviousInput_cv]; + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_2, + FmgcComputer_P.BitfromLabel_bit_es, &rtb_y_gp); + FmgcComputer_MATLABFunction_j(&rtb_BusAssignment_k_logic_ils_computation_data_localizer_deviation_deg, + FmgcComputer_P.A429ValueOrDefault_defaultValue_b, &rtb_y_j); + if (rtb_y_j < 0.0F) { + rtb_Sum1 = -rtb_y_j; + } else { + rtb_Sum1 = rtb_y_j; + } + + FmgcComputer_MATLABFunction(rtb_Sum1 < FmgcComputer_P.CompareToConstant1_const_n, FmgcComputer_U.in.time.dt, + FmgcComputer_P.ConfirmNode_isRisingEdge_nd, FmgcComputer_P.ConfirmNode_timeDelay_e, &rtb_Compare_pf, + &FmgcComputer_DWork.sf_MATLABFunction_is); + rtb_y_dh = (((rtb_y_gp != 0U) && raOwnInvalid) || (rtb_y_gx && + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.loc_cpt_active && rtb_Compare_pf)); + FmgcComputer_MATLABFunction(rtb_y_dh, FmgcComputer_U.in.time.dt, FmgcComputer_P.ConfirmNode_isRisingEdge_ea, + FmgcComputer_P.ConfirmNode_timeDelay_es, &rtb_Compare_pf, &FmgcComputer_DWork.sf_MATLABFunction_pr); + FmgcComputer_DWork.Memory_PreviousInput_lq = FmgcComputer_P.Logic_table_j[(((((!rtb_Compare_pf) && (rtb_y_gd || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.loc_cpt_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.hdg_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.trk_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.land_active)) || rtb_OR2) + (static_cast(rtb_y_dh) << 1)) << + 1) + FmgcComputer_DWork.Memory_PreviousInput_lq]; + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fcu_bus.fcu_discrete_word_1, + FmgcComputer_P.BitfromLabel1_bit_m, &rtb_y_gp); + FmgcComputer_MATLABFunction_j(&FmgcComputer_U.in.bus_inputs.fcu_bus.selected_alt_ft, + FmgcComputer_P.A429ValueOrDefault_defaultValue_pm, &rtb_y_je); + rtb_Sum1 = static_cast(rtb_alt) - rtb_y_je; + rtb_Abs1 = std::abs(rtb_Sum1); + FmgcComputer_DWork.Memory_PreviousInput_n = FmgcComputer_P.Logic_table_pk[(((static_cast((rtb_y_gp != 0U) || + (rtb_Abs1 > FmgcComputer_P.CompareToConstant1_const_h)) << 1) + + (FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.alt_hold_active && (rtb_Abs1 <= + FmgcComputer_P.CompareToConstant_const_mh))) << 1) + FmgcComputer_DWork.Memory_PreviousInput_n]; + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_3, + FmgcComputer_P.BitfromLabel_bit_et, &rtb_y_gp); + FmgcComputer_MATLABFunction_j(&FmgcComputer_U.in.bus_inputs.fcu_bus.selected_vz_ft_min, + FmgcComputer_P.A429ValueOrDefault1_defaultValue_j, &rtb_y_ke); + FmgcComputer_MATLABFunction_j(&FmgcComputer_U.in.bus_inputs.fcu_bus.selected_fpa_deg, + FmgcComputer_P.A429ValueOrDefault2_defaultValue_j, &rtb_y_j); + if (FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.vs_active) { + rtb_y_j = rtb_y_ke; + } else if (!FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.fpa_active) { + rtb_y_j = 0.0F; + } + + if (rtb_Sum1 < 0.0) { + rtb_Compare_pf = (rtb_y_j <= 0.0F); + } else { + rtb_Compare_pf = ((rtb_Sum1 > 0.0) && (rtb_y_j >= 0.0F)); + } + + in_land_or_ga_tmp = (((rtb_y_gp != 0U) && raOwnInvalid) || (rtb_y_gx && + (!FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.alt_acq_active) && + (!FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.alt_hold_active) && rtb_OR1_j && rtb_OR_nx && rtb_y_ae_tmp_1 && + rtb_OR_nn && ((!rtb_Compare_pf) || ((!FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.vs_active) && + (!FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.fpa_active))) && ((rtb_appInop_idx_0 && rtb_OR_od_tmp) || + (rtb_Sum1 <= FmgcComputer_P.CompareToConstant2_const_j)) && raOppInvalid && + FmgcComputer_DWork.Memory_PreviousInput_n)); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_1, + FmgcComputer_P.BitfromLabel1_bit_ng, &rtb_y_gp); + rtb_y_dh = (rtb_y_gp != 0U); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_1, + FmgcComputer_P.BitfromLabel2_bit_n, &rtb_y_gp); + rtb_y_dh = (rtb_y_dh && (rtb_y_gp != 0U)); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fcu_bus.fcu_discrete_word_1, + FmgcComputer_P.BitfromLabel3_bit_f, &rtb_y_gp); + FmgcComputer_MATLABFunction_d(rtb_y_gp != 0U, FmgcComputer_U.in.time.dt, &rtb_Compare_pf, + FmgcComputer_P.MTrigNode_isRisingEdge_k, FmgcComputer_P.MTrigNode_retriggerable_pd, + FmgcComputer_P.MTrigNode_triggerDuration_bh, &FmgcComputer_DWork.sf_MATLABFunction_bq); + rtb_y_dh = (rtb_y_dh && raOwnInvalid); + FmgcComputer_MATLABFunction(rtb_y_dh, FmgcComputer_U.in.time.dt, FmgcComputer_P.ConfirmNode_isRisingEdge_hux, + FmgcComputer_P.ConfirmNode_timeDelay_lk, &rtb_Compare_pf, &FmgcComputer_DWork.sf_MATLABFunction_hw); + rtb_Logic_d_idx_0_tmp = (rtb_Logic_gj_idx_0_tmp_tmp_tmp || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.alt_hold_active); + FmgcComputer_DWork.Memory_PreviousInput_ne = FmgcComputer_P.Logic_table_nz[(((rtb_OR2 || ((rtb_Logic_d_idx_0_tmp || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.clb_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.des_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.exp_clb_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.exp_des_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.final_des_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.gs_capt_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.gs_trk_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.op_clb_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.op_des_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_goaround_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_takeoff_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.tcas_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.land_active) && (!rtb_Compare_pf))) + (static_cast + (rtb_y_dh) << 1)) << 1) + FmgcComputer_DWork.Memory_PreviousInput_ne]; + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_1, + FmgcComputer_P.BitfromLabel1_bit_p2, &rtb_y_gp); + rtb_y_dh = (rtb_y_gp != 0U); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_1, + FmgcComputer_P.BitfromLabel2_bit_fr, &rtb_y_gp); + FmgcComputer_MATLABFunction_j(&FmgcComputer_U.in.bus_inputs.fcu_bus.selected_alt_ft, + FmgcComputer_P.A429ValueOrDefault_defaultValue_a, &rtb_y_j); + FmgcComputer_MATLABFunction(std::abs(static_cast(rtb_y_j) - rtb_alt) < + FmgcComputer_P.CompareToConstant_const_f, FmgcComputer_U.in.time.dt, FmgcComputer_P.ConfirmNode_isRisingEdge_nf, + FmgcComputer_P.ConfirmNode_timeDelay_at, &rtb_Compare_pf, &FmgcComputer_DWork.sf_MATLABFunction_ee); + rtb_y_dh = ((rtb_y_dh && (rtb_y_gp != 0U) && raOwnInvalid) || (rtb_y_gx && + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.alt_acq_active && rtb_Compare_pf)); + FmgcComputer_MATLABFunction(rtb_y_dh, FmgcComputer_U.in.time.dt, FmgcComputer_P.ConfirmNode_isRisingEdge_lj, + FmgcComputer_P.ConfirmNode_timeDelay_b, &rtb_Compare_pf, &FmgcComputer_DWork.sf_MATLABFunction_dt); + FmgcComputer_DWork.Memory_PreviousInput_cb = FmgcComputer_P.Logic_table_ob[(((rtb_OR2 || + ((rtb_Logic_gj_idx_0_tmp_tmp_tmp_0 || FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.clb_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.des_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.exp_clb_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.exp_des_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.final_des_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.gs_capt_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.gs_trk_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.op_clb_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.op_des_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_goaround_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_takeoff_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.tcas_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.land_active) && (!rtb_Compare_pf))) + (static_cast + (rtb_y_dh) << 1)) << 1) + FmgcComputer_DWork.Memory_PreviousInput_cb]; + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_1, + FmgcComputer_P.BitfromLabel1_bit_a, &rtb_y_gp); + rtb_y_dh = (rtb_y_gp != 0U); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_1, + FmgcComputer_P.BitfromLabel2_bit_k, &rtb_y_gp); + rtb_y_dh = (rtb_y_dh || (rtb_y_gp != 0U)); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fcu_bus.fcu_discrete_word_1, + FmgcComputer_P.BitfromLabel4_bit_g, &rtb_y_gp); + FmgcComputer_MATLABFunction_i(rtb_y_gp != 0U, FmgcComputer_P.PulseNode_isRisingEdge_d, &rtb_Compare_pf, + &FmgcComputer_DWork.sf_MATLABFunction_nd); + rtb_y_k = (fdOppOff && rtb_Compare_pf && rtb_OR_nn); + FmgcComputer_MATLABFunction_i(raOppInvalid, FmgcComputer_P.PulseNode1_isRisingEdge_ky, &rtb_Compare_pf, + &FmgcComputer_DWork.sf_MATLABFunction_ds); + rtb_y_mq = (rtb_Logic_gj_idx_0_tmp_tmp && rtb_Compare_pf); + FmgcComputer_MATLABFunction_i(FmgcComputer_DWork.Delay_DSTATE_p || FmgcComputer_U.in.discrete_inputs.ap_opp_engaged, + FmgcComputer_P.PulseNode2_isRisingEdge_bh, &rtb_Compare_pf, &FmgcComputer_DWork.sf_MATLABFunction_cx); + rtb_y_nk = (rtb_Logic_gj_idx_0_tmp_tmp && rtb_Compare_pf && + (!FmgcComputer_DWork.Delay_DSTATE.any_longitudinal_mode_engaged)); + FmgcComputer_MATLABFunction_i(FmgcComputer_DWork.Delay_DSTATE.armed_modes.land_armed || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.land_active, FmgcComputer_P.PulseNode3_isRisingEdge_n, + &rtb_Compare_pf, &FmgcComputer_DWork.sf_MATLABFunction_fe); + FmgcComputer_MATLABFunction_j(&FmgcComputer_U.in.bus_inputs.fcu_bus.selected_alt_ft, + FmgcComputer_P.A429ValueOrDefault_defaultValue_m, &rtb_y_j); + rtb_Abs1 = static_cast(rtb_y_j) - rtb_alt; + rtb_y_gd = ((FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.des_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.exp_des_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.op_des_active) && (rtb_Abs1 > + FmgcComputer_P.CompareToConstant1_const_o)); + rtb_y_ae_tmp_2 = !FmgcComputer_U.in.fms_inputs.vertical_flight_plan_valid; + rtb_y_k = (rtb_y_k || rtb_y_mq || rtb_y_nk || ((FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.gs_trk_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.gs_capt_active) && rtb_Compare_pf) || + (FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.des_active && + ((FmgcComputer_P.EnumeratedConstant_Value_p == FmgcComputer_U.in.fms_inputs.fms_flight_phase) || + (FmgcComputer_U.in.fms_inputs.fms_flight_phase == FmgcComputer_P.EnumeratedConstant1_Value_m) || + (FmgcComputer_U.in.fms_inputs.fms_flight_phase == FmgcComputer_P.EnumeratedConstant2_Value) || + (rtb_OR_c_tmp && rtb_BusAssignment_m_ap_fd_logic_fmgc_opp_mode_sync_tmp && rtb_OR_od_tmp_0) || + rtb_y_ae_tmp_2)) || rtb_y_gd || ((FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.clb_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.exp_clb_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.op_clb_active) && (rtb_Abs1 < + FmgcComputer_P.CompareToConstant2_const_g))); + rtb_Compare_pf = ((rtb_y_dh && raOwnInvalid) || (rtb_y_gx && rtb_y_k)); + FmgcComputer_MATLABFunction(rtb_Compare_pf, FmgcComputer_U.in.time.dt, FmgcComputer_P.ConfirmNode_isRisingEdge_lu, + FmgcComputer_P.ConfirmNode_timeDelay_ll, &rtb_y_gd, &FmgcComputer_DWork.sf_MATLABFunction_gbq); + FmgcComputer_DWork.Memory_PreviousInput_fg = FmgcComputer_P.Logic_table_ny[(((rtb_OR2 || + ((FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.alt_acq_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.alt_hold_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.clb_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.des_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.exp_clb_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.exp_des_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.final_des_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.gs_capt_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.gs_trk_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.op_clb_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.op_des_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_goaround_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_takeoff_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.tcas_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.land_active) && (!rtb_y_gd))) + (static_cast + (rtb_Compare_pf) << 1)) << 1) + FmgcComputer_DWork.Memory_PreviousInput_fg]; + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fcu_bus.fcu_discrete_word_1, + FmgcComputer_P.BitfromLabel3_bit_e, &rtb_y_gp); + rtb_Logic_gj_idx_0_tmp_tmp_tmp_0 = ((rtb_y_gp != 0U) && FmgcComputer_DWork.Memory_PreviousInput_fg); + rtb_Logic_gj_idx_0_tmp_tmp_tmp = (FmgcComputer_DWork.Memory_PreviousInput_fg && (rtb_y_gp == 0U)); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_3, + FmgcComputer_P.BitfromLabel_bit_jh, &rtb_y_gp); + rtb_Compare_pf = (rtb_y_gp != 0U); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fcu_bus.fcu_discrete_word_2, + FmgcComputer_P.BitfromLabel2_bit_p, &rtb_y_gp); + FmgcComputer_MATLABFunction_i(rtb_y_gp != 0U, FmgcComputer_P.PulseNode_isRisingEdge_b, &rtb_y_k, + &FmgcComputer_DWork.sf_MATLABFunction_p3); + FmgcComputer_MATLABFunction_i(FmgcComputer_U.in.fms_inputs.lateral_flight_plan_valid, + FmgcComputer_P.PulseNode3_isRisingEdge_d, &rtb_y_mq, &FmgcComputer_DWork.sf_MATLABFunction_ax); + rtb_y_nk = (rtb_OR9_b || FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_goaround_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_takeoff_active); + FmgcComputer_DWork.Memory_PreviousInput_m = FmgcComputer_P.Logic_table_ns[(((static_cast((rtb_Compare_pf && + raOwnInvalid) || (rtb_y_gx && (rtb_y_nk && rtb_y_mq && rtb_fmgcOppPriority_tmp))) << 1) + rtb_OR2) << 1) + + FmgcComputer_DWork.Memory_PreviousInput_m]; + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_1, + FmgcComputer_P.BitfromLabel1_bit_g3, &rtb_y_gp); + rtb_Compare_pf = (rtb_y_gp != 0U); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_1, + FmgcComputer_P.BitfromLabel2_bit_is, &rtb_y_gp); + rtb_y_gd = (rtb_OR_nn && rtb_OR_nx); + FmgcComputer_MATLABFunction_j(&FmgcComputer_U.in.bus_inputs.fcu_bus.selected_alt_ft, + FmgcComputer_P.A429ValueOrDefault_defaultValue_h, &rtb_y_j); + rtb_y_k = (rtb_y_j > rtb_alt); + rtb_y_mq = ((FmgcComputer_P.EnumeratedConstant_Value_pq != FmgcComputer_U.in.fms_inputs.fms_flight_phase) && + (FmgcComputer_U.in.fms_inputs.fms_flight_phase != FmgcComputer_P.EnumeratedConstant1_Value_i)); + rtb_Compare_pf = (rtb_Compare_pf && (rtb_y_gp == 0U) && raOwnInvalid); + FmgcComputer_MATLABFunction(rtb_Compare_pf, FmgcComputer_U.in.time.dt, FmgcComputer_P.ConfirmNode_isRisingEdge_fc, + FmgcComputer_P.ConfirmNode_timeDelay_n, &rtb_y_gd, &FmgcComputer_DWork.sf_MATLABFunction_ir); + rtb_Logic_d_idx_0_tmp = (rtb_Logic_d_idx_0_tmp || FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.alt_acq_active); + rtb_y_dh = (rtb_Logic_d_idx_0_tmp || FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.des_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.exp_clb_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.exp_des_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.final_des_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.gs_capt_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.gs_trk_active); + FmgcComputer_DWork.Memory_PreviousInput_ec = FmgcComputer_P.Logic_table_kw[(((rtb_OR2 || ((rtb_y_dh || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.op_clb_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.op_des_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_goaround_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_takeoff_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.tcas_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.land_active) && (!rtb_y_gd))) + (static_cast + (rtb_Compare_pf) << 1)) << 1) + FmgcComputer_DWork.Memory_PreviousInput_ec]; + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_3, + FmgcComputer_P.BitfromLabel_bit_cq, &rtb_y_gp); + rtb_Compare_pf = (rtb_y_gp != 0U); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fcu_bus.fcu_discrete_word_2, + FmgcComputer_P.BitfromLabel2_bit_p5, &rtb_y_gp); + FmgcComputer_MATLABFunction_i(rtb_y_gp != 0U, FmgcComputer_P.PulseNode_isRisingEdge_o, &rtb_y_k, + &FmgcComputer_DWork.sf_MATLABFunction_fz); + FmgcComputer_MATLABFunction_i(FmgcComputer_U.in.fms_inputs.lateral_flight_plan_valid, + FmgcComputer_P.PulseNode3_isRisingEdge_j, &rtb_y_mq, &FmgcComputer_DWork.sf_MATLABFunction_mo); + FmgcComputer_DWork.Memory_PreviousInput_nt = FmgcComputer_P.Logic_table_he[(((static_cast((rtb_Compare_pf && + raOwnInvalid) || (rtb_y_gx && (rtb_y_nk && rtb_y_mq && rtb_fmgcOppPriority_tmp))) << 1) + !raOppInvalid) << 1) + + FmgcComputer_DWork.Memory_PreviousInput_nt]; + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_1, + FmgcComputer_P.BitfromLabel1_bit_mi, &rtb_y_gp); + rtb_Compare_pf = (rtb_y_gp != 0U); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_1, + FmgcComputer_P.BitfromLabel2_bit_j, &rtb_y_gp); + rtb_y_gd = (rtb_OR_nx && rtb_OR_nn && (!FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.des_active) && + rtb_y_ae_tmp_1 && rtb_appInop_idx_0 && rtb_OR_od_tmp); + FmgcComputer_MATLABFunction_j(&FmgcComputer_U.in.bus_inputs.fcu_bus.selected_alt_ft, + FmgcComputer_P.A429ValueOrDefault_defaultValue_mo, &rtb_y_j); + rtb_Compare_pf = (rtb_Compare_pf && (rtb_y_gp == 0U) && raOwnInvalid); + FmgcComputer_MATLABFunction(rtb_Compare_pf, FmgcComputer_U.in.time.dt, FmgcComputer_P.ConfirmNode_isRisingEdge_j, + FmgcComputer_P.ConfirmNode_timeDelay_dy, &rtb_y_gd, &FmgcComputer_DWork.sf_MATLABFunction_n5); + rtb_appInop_idx_0 = (rtb_Logic_d_idx_0_tmp || FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.clb_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.exp_clb_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.exp_des_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.final_des_active); + rtb_OR_od_tmp = (rtb_appInop_idx_0 || FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.gs_capt_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.gs_trk_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.op_clb_active); + FmgcComputer_DWork.Memory_PreviousInput_b3 = FmgcComputer_P.Logic_table_cv[(((rtb_OR2 || ((rtb_OR_od_tmp || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.op_des_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_goaround_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_takeoff_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.tcas_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.land_active) && (!rtb_y_gd))) + (static_cast + (rtb_Compare_pf) << 1)) << 1) + FmgcComputer_DWork.Memory_PreviousInput_b3]; + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_1, + FmgcComputer_P.BitfromLabel1_bit_nv, &rtb_y_gp); + rtb_Compare_pf = (rtb_y_gp != 0U); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_1, + FmgcComputer_P.BitfromLabel2_bit_i1, &rtb_y_gp); + rtb_Compare_pf = (rtb_Compare_pf && (rtb_y_gp != 0U)); + rtb_y_gd = rtb_OR_nn; + FmgcComputer_MATLABFunction_j(&FmgcComputer_U.in.bus_inputs.fcu_bus.selected_alt_ft, + FmgcComputer_P.A429ValueOrDefault_defaultValue_ht, &rtb_y_j); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fcu_bus.fcu_discrete_word_1, + FmgcComputer_P.BitfromLabel4_bit_d, &rtb_y_gp); + FmgcComputer_MATLABFunction_i(rtb_y_gp != 0U, FmgcComputer_P.PulseNode_isRisingEdge_n, &rtb_y_gd, + &FmgcComputer_DWork.sf_MATLABFunction_f0h); + rtb_y_nk = (FmgcComputer_U.in.fms_inputs.fms_flight_phase == FmgcComputer_P.EnumeratedConstant1_Value_c); + rtb_y_mq = (rtb_y_gd || (FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.clb_active && + ((FmgcComputer_P.EnumeratedConstant_Value_c == FmgcComputer_U.in.fms_inputs.fms_flight_phase) || rtb_y_nk || + rtb_OR_c_tmp || rtb_y_ae_tmp_2))); + rtb_fmgcOppPriority_tmp = (rtb_y_gx && FmgcComputer_DWork.Delay_DSTATE.armed_modes.alt_acq_arm_possible && fdOppOff && + rtb_OR_nn); + rtb_Compare_pf = ((rtb_Compare_pf && raOwnInvalid) || (rtb_fmgcOppPriority_tmp && (rtb_y_j > rtb_alt) && rtb_y_mq)); + FmgcComputer_MATLABFunction(rtb_Compare_pf, FmgcComputer_U.in.time.dt, FmgcComputer_P.ConfirmNode_isRisingEdge_ca, + FmgcComputer_P.ConfirmNode_timeDelay_ib, &rtb_y_gd, &FmgcComputer_DWork.sf_MATLABFunction_go); + FmgcComputer_DWork.Memory_PreviousInput_ae = FmgcComputer_P.Logic_table_jq[(((rtb_OR2 || ((rtb_y_dh || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.clb_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.op_des_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_goaround_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_takeoff_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.tcas_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.land_active) && (!rtb_y_gd))) + (static_cast + (rtb_Compare_pf) << 1)) << 1) + FmgcComputer_DWork.Memory_PreviousInput_ae]; + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_1, + FmgcComputer_P.BitfromLabel1_bit_b, &rtb_y_gp); + rtb_Compare_pf = (rtb_y_gp != 0U); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_1, + FmgcComputer_P.BitfromLabel2_bit_kr, &rtb_y_gp); + rtb_Compare_pf = (rtb_Compare_pf && (rtb_y_gp != 0U)); + rtb_y_gd = rtb_OR_nn; + FmgcComputer_MATLABFunction_j(&FmgcComputer_U.in.bus_inputs.fcu_bus.selected_alt_ft, + FmgcComputer_P.A429ValueOrDefault_defaultValue_i, &rtb_y_j); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fcu_bus.fcu_discrete_word_1, + FmgcComputer_P.BitfromLabel4_bit_i, &rtb_y_gp); + FmgcComputer_MATLABFunction_i(rtb_y_gp != 0U, FmgcComputer_P.PulseNode_isRisingEdge_fw, &rtb_y_mq, + &FmgcComputer_DWork.sf_MATLABFunction_ms); + rtb_OR_nn = ((rtb_Compare_pf && raOwnInvalid) || (rtb_fmgcOppPriority_tmp && (rtb_y_j < rtb_alt) && rtb_y_mq)); + FmgcComputer_MATLABFunction(rtb_OR_nn, FmgcComputer_U.in.time.dt, FmgcComputer_P.ConfirmNode_isRisingEdge_ep, + FmgcComputer_P.ConfirmNode_timeDelay_ob, &rtb_y_gd, &FmgcComputer_DWork.sf_MATLABFunction_khd); + FmgcComputer_DWork.Memory_PreviousInput_ev = FmgcComputer_P.Logic_table_l[(((rtb_OR2 || ((rtb_OR_od_tmp || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.des_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_goaround_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_takeoff_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.tcas_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.land_active) && (!rtb_y_gd))) + (static_cast(rtb_OR_nn) << + 1)) << 1) + FmgcComputer_DWork.Memory_PreviousInput_ev]; + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_3, + FmgcComputer_P.BitfromLabel_bit_b, &rtb_y_gp); + rtb_y_dh = rtb_y_gx; + FmgcComputer_MATLABFunction_i(FmgcComputer_DWork.Delay_DSTATE.armed_modes.land_armed || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.land_active, FmgcComputer_P.PulseNode1_isRisingEdge_b, &rtb_y_mq, + &FmgcComputer_DWork.sf_MATLABFunction_pe); + FmgcComputer_MATLABFunction_i(FmgcComputer_DWork.Delay_DSTATE.armed_modes.land_armed, + FmgcComputer_P.PulseNode_isRisingEdge_lz, &rtb_y_dh, &FmgcComputer_DWork.sf_MATLABFunction_iv); + FmgcComputer_DWork.Memory_PreviousInput_fm = FmgcComputer_P.Logic_table_dr[(((static_cast(((rtb_y_gp != 0U) + && raOwnInvalid) || (rtb_y_gx && (rtb_y_mq && rtb_OR1_j && rtb_OR_nx))) << 1) + (rtb_y_dh || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.gs_capt_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.gs_trk_active)) << 1) + + FmgcComputer_DWork.Memory_PreviousInput_fm]; + rtb_BusAssignment_b_logic_ils_computation_data_glideslope_deviation_deg.SSM = + rtb_Switch_glideslope_deviation_deg_SSM; + rtb_BusAssignment_b_logic_ils_computation_data_glideslope_deviation_deg.Data = + rtb_Switch_glideslope_deviation_deg_Data; + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_1, + FmgcComputer_P.BitfromLabel2_bit_n0, &rtb_y_gp); + rtb_Compare_pf = (rtb_y_gp != 0U); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_1, + FmgcComputer_P.BitfromLabel3_bit_d, &rtb_y_gp); + rtb_y_gd = rtb_TmpSignalConversionAtSFunctionInport3_idx_1; + FmgcComputer_MATLABFunction_j(&rtb_BusAssignment_b_logic_ils_computation_data_glideslope_deviation_deg, + FmgcComputer_P.A429ValueOrDefault_defaultValue_g, &rtb_y_j); + if (rtb_y_j < 0.0F) { + rtb_Sum1 = -rtb_y_j; + } else { + rtb_Sum1 = rtb_y_j; + } + + rtb_y_k = (rtb_Sum1 < FmgcComputer_P.CompareToConstant2_const_i); + FmgcComputer_MATLABFunction_g(&rtb_BusAssignment_b_logic_ils_computation_data_glideslope_deviation_deg, &rtb_y_mq); + rtb_y_dh = (rtb_y_gx && FmgcComputer_DWork.Delay_DSTATE.armed_modes.glide_armed && + rtb_TmpSignalConversionAtSFunctionInport3_idx_1 && rtb_y_k && rtb_y_mq); + rtb_OR_nx = ((rtb_Compare_pf && (rtb_y_gp != 0U) && raOwnInvalid) || rtb_y_dh); + FmgcComputer_MATLABFunction(rtb_OR_nx, FmgcComputer_U.in.time.dt, FmgcComputer_P.ConfirmNode_isRisingEdge_g, + FmgcComputer_P.ConfirmNode_timeDelay_a3g, &rtb_y_dh, &FmgcComputer_DWork.sf_MATLABFunction_bs); + rtb_OR1_j = (rtb_appInop_idx_0 || FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.op_des_active); + FmgcComputer_DWork.Memory_PreviousInput_nu = FmgcComputer_P.Logic_table_d3[(((((!rtb_y_dh) && (rtb_OR1_j || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.gs_trk_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.op_clb_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.des_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_goaround_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_takeoff_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.tcas_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.land_active)) || rtb_OR2) + (static_cast(rtb_OR_nx) << 1)) + << 1) + FmgcComputer_DWork.Memory_PreviousInput_nu]; + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_1, + FmgcComputer_P.BitfromLabel2_bit_nl, &rtb_y_gp); + rtb_Compare_pf = (rtb_y_gp != 0U); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_1, + FmgcComputer_P.BitfromLabel3_bit_g, &rtb_y_gp); + rtb_y_dh = rtb_y_gx; + FmgcComputer_MATLABFunction(FmgcComputer_DWork.Memory_PreviousInput_nu, FmgcComputer_U.in.time.dt, + FmgcComputer_P.ConfirmNode_isRisingEdge_gr, FmgcComputer_P.ConfirmNode_timeDelay_m, &rtb_y_gd, + &FmgcComputer_DWork.sf_MATLABFunction_mu); + FmgcComputer_MATLABFunction_j(&rtb_BusAssignment_b_logic_ils_computation_data_glideslope_deviation_deg, + FmgcComputer_P.A429ValueOrDefault_defaultValue_k, &rtb_y_j); + if (rtb_y_j < 0.0F) { + rtb_Sum1 = -rtb_y_j; + } else { + rtb_Sum1 = rtb_y_j; + } + + rtb_OR_nx = ((rtb_Compare_pf && (rtb_y_gp != 0U) && raOwnInvalid) || (rtb_y_gx && rtb_y_gd && (rtb_Sum1 < + FmgcComputer_P.CompareToConstant2_const_h))); + FmgcComputer_MATLABFunction(rtb_OR_nx, FmgcComputer_U.in.time.dt, FmgcComputer_P.ConfirmNode_isRisingEdge_o, + FmgcComputer_P.ConfirmNode_timeDelay_mu, &rtb_y_dh, &FmgcComputer_DWork.sf_MATLABFunction_dba); + FmgcComputer_DWork.Memory_PreviousInput_as = FmgcComputer_P.Logic_table_fi[(((((!rtb_y_dh) && (rtb_OR1_j || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.gs_capt_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.op_clb_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.des_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_goaround_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_takeoff_active || + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.tcas_active || + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.land_active)) || rtb_OR2) + (static_cast(rtb_OR_nx) << 1)) + << 1) + FmgcComputer_DWork.Memory_PreviousInput_as]; + rtb_ap_fd_condition_tmp = (rtb_OR9_b || ((rtb_BusAssignment_i_logic_ra_computation_data_ft < + FmgcComputer_P.CompareToConstant_const_c) && rtb_ap_fd_condition_tmp) || + (FmgcComputer_DWork.Memory_PreviousInput_cv || FmgcComputer_DWork.Memory_PreviousInput_lq || + FmgcComputer_DWork.Memory_PreviousInput_d || FmgcComputer_DWork.Memory_PreviousInput_f || + FmgcComputer_DWork.Memory_PreviousInput_e)); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_5, + FmgcComputer_P.BitfromLabel1_bit_aw, &rtb_y_gp); + rtb_Compare_pf = ((rtb_y_gp != 0U) && raOwnInvalid); + FmgcComputer_MATLABFunction_i(raOppInvalid, FmgcComputer_P.PulseNode1_isRisingEdge_kl, &rtb_y_k, + &FmgcComputer_DWork.sf_MATLABFunction_dtd); + rtb_y_gd = (rtb_y_k && (FmgcComputer_U.in.fms_inputs.fms_flight_phase != FmgcComputer_P.EnumeratedConstant_Value_ad)); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fcu_bus.fcu_discrete_word_1, + FmgcComputer_P.BitfromLabel3_bit_gv, &rtb_y_gp); + FmgcComputer_MATLABFunction_i(rtb_y_gp != 0U, FmgcComputer_P.PulseNode2_isRisingEdge_f, &rtb_y_k, + &FmgcComputer_DWork.sf_MATLABFunction_d5); + rtb_y_k = (rtb_y_k && fdOppOff); + rtb_OR1_j = (rtb_Compare_pf || (rtb_y_gx && (rtb_y_gd || rtb_y_k))); + FmgcComputer_MATLABFunction(rtb_OR1_j, FmgcComputer_U.in.time.dt, FmgcComputer_P.ConfirmNode_isRisingEdge_ch, + FmgcComputer_P.ConfirmNode_timeDelay_ht, &rtb_Compare_pf, &FmgcComputer_DWork.sf_MATLABFunction_jc); + FmgcComputer_DWork.Memory_PreviousInput_cu = FmgcComputer_P.Logic_table_kg + [((((FmgcComputer_DWork.Delay_DSTATE.auto_spd_control_active && (!rtb_Compare_pf)) || (rtb_OR9_b && raOppInvalid)) + + (static_cast(rtb_OR1_j) << 1)) << 1) + FmgcComputer_DWork.Memory_PreviousInput_cu]; + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_5, + FmgcComputer_P.BitfromLabel_bit_kq, &rtb_y_gp); + rtb_Compare_pf = ((rtb_y_gp != 0U) && raOwnInvalid); + FmgcComputer_MATLABFunction_i(raOppInvalid, FmgcComputer_P.PulseNode1_isRisingEdge_n, &rtb_y_mq, + &FmgcComputer_DWork.sf_MATLABFunction_aba); + rtb_OR1_j = (FmgcComputer_U.in.fms_inputs.v_2_kts != FmgcComputer_P.CompareToConstant_const_e); + FmgcComputer_MATLABFunction_i(rtb_OR1_j, FmgcComputer_P.PulseNode2_isRisingEdge_iu, &rtb_y_k, + &FmgcComputer_DWork.sf_MATLABFunction_ft); + rtb_y_k = (raOppInvalid && rtb_y_k); + rtb_y_gd = ((rtb_y_mq && rtb_OR1_j) || rtb_y_k); + FmgcComputer_MATLABFunction_i(FmgcComputer_DWork.Memory_PreviousInput_i || FmgcComputer_DWork.Memory_PreviousInput_k, + FmgcComputer_P.PulseNode3_isRisingEdge_i, &rtb_y_mq, &FmgcComputer_DWork.sf_MATLABFunction_mrn); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fcu_bus.fcu_discrete_word_1, + FmgcComputer_P.BitfromLabel2_bit_ie, &rtb_y_gp); + FmgcComputer_MATLABFunction_i(rtb_y_gp != 0U, FmgcComputer_P.PulseNode_isRisingEdge_jp, &rtb_y_nk, + &FmgcComputer_DWork.sf_MATLABFunction_ih); + FmgcComputer_MATLABFunction_i(FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.longitudinal_modes.exp_clb_active || + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.longitudinal_modes.exp_des_active, + FmgcComputer_P.PulseNode4_isRisingEdge, &rtb_y_k, &FmgcComputer_DWork.sf_MATLABFunction_lr); + rtb_OR1_j = (rtb_Compare_pf || (rtb_y_gx && ((rtb_OR9_b && rtb_y_gd) || (rtb_y_mq || rtb_y_nk || rtb_y_k)))); + FmgcComputer_MATLABFunction(rtb_OR1_j, FmgcComputer_U.in.time.dt, FmgcComputer_P.ConfirmNode_isRisingEdge_h2, + FmgcComputer_P.ConfirmNode_timeDelay_gz, &rtb_Compare_pf, &FmgcComputer_DWork.sf_MATLABFunction_j3); + rtb_y_gd = (FmgcComputer_U.in.fms_inputs.v_2_kts == FmgcComputer_P.CompareToConstant1_const_m); + FmgcComputer_DWork.Memory_PreviousInput_h = FmgcComputer_P.Logic_table_ds + [((((FmgcComputer_DWork.Delay_DSTATE.manual_spd_control_active && (!rtb_Compare_pf)) || (rtb_OR9_b && + ((!FmgcComputer_DWork.Memory_PreviousInput_i) && (!FmgcComputer_DWork.Memory_PreviousInput_k)) && rtb_y_gd)) + + (static_cast(rtb_OR1_j) << 1)) << 1) + FmgcComputer_DWork.Memory_PreviousInput_h]; + rtb_y_dh = (rtb_Logic_gj_idx_0_tmp_tmp_tmp_0 || rtb_Logic_gj_idx_0_tmp_tmp_tmp || + FmgcComputer_DWork.Memory_PreviousInput_cb || FmgcComputer_DWork.Memory_PreviousInput_ne || + FmgcComputer_DWork.Memory_PreviousInput_ec || FmgcComputer_DWork.Memory_PreviousInput_b3 || + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.longitudinal_modes.exp_clb_active || + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.longitudinal_modes.exp_des_active || + FmgcComputer_DWork.Memory_PreviousInput_f || FmgcComputer_DWork.Memory_PreviousInput_nu || + FmgcComputer_DWork.Memory_PreviousInput_as || FmgcComputer_DWork.Memory_PreviousInput_ae || + FmgcComputer_DWork.Memory_PreviousInput_ev || FmgcComputer_DWork.Memory_PreviousInput_i || + FmgcComputer_DWork.Memory_PreviousInput_k || + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.longitudinal_modes.tcas_active || + FmgcComputer_DWork.Memory_PreviousInput_d); + rtb_OR1_j = (rtb_NOT3 || FmgcComputer_DWork.Memory_PreviousInput_e || FmgcComputer_DWork.Memory_PreviousInput_cv || + FmgcComputer_DWork.Memory_PreviousInput_lq || rtb_OR2_tmp || rtb_NOT4_gb || + FmgcComputer_DWork.Memory_PreviousInput_ip || FmgcComputer_DWork.Memory_PreviousInput_d); + rtb_OR_nx = rtb_y_dh; + FmgcComputer_MATLABFunction_g(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_3, &rtb_y_gd); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_3, + FmgcComputer_P.BitfromLabel_bit_i, &rtb_y_gp); + FmgcComputer_MATLABFunction_g(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_4, &rtb_y_dh); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_4, + FmgcComputer_P.BitfromLabel1_bit_i5, &rtb_y_gp); + rtb_Compare_pf = (FmgcComputer_DWork.Delay_DSTATE_p && (FmgcComputer_DWork.Memory_PreviousInput_l || + FmgcComputer_DWork.Memory_PreviousInput_d)); + rtb_appInop_idx_0 = ((!rtb_ap_inop_tmp) && (FmgcComputer_U.in.discrete_inputs.fwc_own_valid || + FmgcComputer_U.in.discrete_inputs.fwc_opp_valid) && FmgcComputer_U.in.discrete_inputs.pfd_own_valid && + FmgcComputer_U.in.discrete_inputs.pfd_opp_valid && rtb_BusAssignment_g_logic_both_ils_valid); + rtb_y_gx = (rtb_appInop_idx_0 && (!rtb_Compare) && rtb_bothRaValid); + rtb_OR_nn = (rtb_y_gx && rtb_Compare_pf && FmgcComputer_DWork.Delay_DSTATE_k); + rtb_Compare_pf = (rtb_appInop_idx_0 && rtb_Compare_pf && (!rtb_OR_nn)); + rtb_appInop_idx_0 = !rtb_appInop_idx_0; + rtb_y_gx = !rtb_y_gx; + FmgcComputer_MATLABFunction_g(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_4, &rtb_y_dh); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_4, + FmgcComputer_P.BitfromLabel2_bit_o, &rtb_y_gp); + rtb_OR2 = ((rtb_y_gp != 0U) && rtb_y_dh); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_4, + FmgcComputer_P.BitfromLabel3_bit_l, &rtb_y_gp); + rtb_TmpSignalConversionAtSFunctionInport3_idx_1 = ((rtb_y_gp != 0U) && rtb_y_dh); + FmgcComputer_MATLABFunction_k(&FmgcComputer_U.in.bus_inputs.fmgc_opp_bus.discrete_word_4, + FmgcComputer_P.BitfromLabel4_bit_f, &rtb_y_gp); + rtb_y_dh = ((rtb_y_gp != 0U) && rtb_y_dh); + if (FmgcComputer_DWork.Delay_DSTATE_p && FmgcComputer_U.in.discrete_inputs.ap_opp_engaged) { + if (FmgcComputer_U.in.discrete_inputs.is_unit_1) { + rtb_OR2 = rtb_Compare_pf; + rtb_TmpSignalConversionAtSFunctionInport3_idx_1 = rtb_OR_nn; + } + + rtb_y_dh = (rtb_Logic_idx_0_tmp && rtb_y_dh); + } else { + if (!rtb_fmgcOppPriority) { + rtb_OR2 = rtb_Compare_pf; + rtb_TmpSignalConversionAtSFunctionInport3_idx_1 = rtb_OR_nn; + } + + if (!rtb_fmgcOppPriority) { + rtb_y_dh = false; + } + } + + rtb_y_en = static_cast(FmgcComputer_P.EnumeratedConstant_Value); + rtb_VectorConcatenate[0] = FmgcComputer_P.Constant10_Value; + rtb_VectorConcatenate[1] = FmgcComputer_P.Constant10_Value; + rtb_VectorConcatenate[2] = FmgcComputer_P.Constant10_Value; + rtb_VectorConcatenate[3] = FmgcComputer_P.Constant10_Value; + rtb_VectorConcatenate[4] = FmgcComputer_P.Constant10_Value; + rtb_VectorConcatenate[5] = FmgcComputer_P.Constant10_Value; + rtb_VectorConcatenate[6] = FmgcComputer_P.Constant10_Value; + rtb_VectorConcatenate[7] = FmgcComputer_P.Constant10_Value; + rtb_VectorConcatenate[8] = FmgcComputer_DWork.Memory_PreviousInput_h; + rtb_VectorConcatenate[9] = FmgcComputer_DWork.Memory_PreviousInput_cu; + rtb_VectorConcatenate[10] = FmgcComputer_P.Constant10_Value; + rtb_VectorConcatenate[11] = FmgcComputer_P.Constant10_Value; + rtb_VectorConcatenate[12] = FmgcComputer_P.Constant10_Value; + rtb_VectorConcatenate[13] = FmgcComputer_P.Constant10_Value; + rtb_VectorConcatenate[14] = FmgcComputer_P.Constant10_Value; + rtb_VectorConcatenate[15] = FmgcComputer_P.Constant10_Value; + rtb_VectorConcatenate[16] = FmgcComputer_P.Constant10_Value; + rtb_VectorConcatenate[17] = FmgcComputer_P.Constant10_Value; + rtb_VectorConcatenate[18] = FmgcComputer_P.Constant10_Value; + FmgcComputer_MATLABFunction_gy(rtb_VectorConcatenate, &rtb_y_j); + rtb_VectorConcatenate[0] = FmgcComputer_U.in.discrete_inputs.ap_instinctive_disc; + rtb_VectorConcatenate[1] = FmgcComputer_DWork.Delay_DSTATE_p; + rtb_VectorConcatenate[2] = fdOwnOff; + rtb_VectorConcatenate[3] = FmgcComputer_DWork.Memory_PreviousInput_d; + rtb_VectorConcatenate[4] = FmgcComputer_P.Constant3_Value; + rtb_VectorConcatenate[5] = rtb_Compare_pf; + rtb_VectorConcatenate[6] = rtb_OR_nn; + rtb_VectorConcatenate[7] = false; + rtb_VectorConcatenate[8] = rtb_ap_inop_tmp; + rtb_VectorConcatenate[9] = rtb_appInop_idx_0; + rtb_VectorConcatenate[10] = rtb_y_gx; + rtb_VectorConcatenate[11] = true; + rtb_VectorConcatenate[12] = rtb_OR2; + rtb_VectorConcatenate[13] = rtb_TmpSignalConversionAtSFunctionInport3_idx_1; + rtb_VectorConcatenate[14] = rtb_y_dh; + rtb_VectorConcatenate[15] = FmgcComputer_P.Constant3_Value; + rtb_VectorConcatenate[16] = FmgcComputer_P.Constant3_Value; + rtb_VectorConcatenate[17] = FmgcComputer_P.Constant3_Value; + rtb_VectorConcatenate[18] = FmgcComputer_P.Constant3_Value; + FmgcComputer_MATLABFunction_gy(rtb_VectorConcatenate, &rtb_y_ke); + if (FmgcComputer_U.in.fms_inputs.flex_temp_deg_c != FmgcComputer_P.CompareToConstant_const_ce) { + rtb_y_en = static_cast(FmgcComputer_P.EnumeratedConstant1_Value); + } + + rtb_VectorConcatenate[0] = FmgcComputer_P.Constant4_Value_g; + rtb_VectorConcatenate[1] = FmgcComputer_P.Constant4_Value_g; + rtb_VectorConcatenate[2] = FmgcComputer_DWork.Delay_DSTATE_k; + rtb_VectorConcatenate[3] = false; + rtb_VectorConcatenate[4] = FmgcComputer_P.Constant4_Value_g; + rtb_VectorConcatenate[5] = FmgcComputer_P.Constant4_Value_g; + rtb_VectorConcatenate[6] = FmgcComputer_U.in.discrete_inputs.athr_instinctive_disc; + rtb_VectorConcatenate[7] = FmgcComputer_P.Constant4_Value_g; + rtb_VectorConcatenate[8] = FmgcComputer_P.Constant4_Value_g; + rtb_VectorConcatenate[9] = FmgcComputer_P.Constant4_Value_g; + rtb_VectorConcatenate[10] = FmgcComputer_P.Constant4_Value_g; + rtb_VectorConcatenate[11] = FmgcComputer_P.Constant4_Value_g; + rtb_VectorConcatenate[12] = FmgcComputer_P.Constant4_Value_g; + rtb_VectorConcatenate[13] = rtb_Compare; + rtb_VectorConcatenate[14] = FmgcComputer_P.Constant4_Value_g; + rtb_VectorConcatenate[15] = FmgcComputer_P.Constant4_Value_g; + rtb_VectorConcatenate[16] = FmgcComputer_P.Constant4_Value_g; + rtb_VectorConcatenate[17] = FmgcComputer_P.Constant4_Value_g; + rtb_VectorConcatenate[18] = FmgcComputer_P.Constant4_Value_g; + FmgcComputer_MATLABFunction_gy(rtb_VectorConcatenate, &rtb_y_je); + rtb_VectorConcatenate[0] = FmgcComputer_P.Constant5_Value; + rtb_VectorConcatenate[1] = FmgcComputer_P.Constant5_Value; + rtb_VectorConcatenate[2] = FmgcComputer_P.Constant5_Value; + rtb_VectorConcatenate[3] = FmgcComputer_P.Constant5_Value; + rtb_VectorConcatenate[4] = FmgcComputer_P.Constant5_Value; + rtb_VectorConcatenate[5] = FmgcComputer_P.Constant5_Value; + rtb_VectorConcatenate[6] = FmgcComputer_P.Constant5_Value; + rtb_VectorConcatenate[7] = FmgcComputer_P.Constant5_Value; + rtb_VectorConcatenate[8] = FmgcComputer_P.Constant5_Value; + rtb_VectorConcatenate[9] = FmgcComputer_P.Constant5_Value; + rtb_VectorConcatenate[10] = FmgcComputer_P.Constant5_Value; + rtb_VectorConcatenate[11] = FmgcComputer_P.Constant5_Value; + rtb_VectorConcatenate[12] = FmgcComputer_P.Constant5_Value; + rtb_VectorConcatenate[13] = FmgcComputer_P.Constant5_Value; + rtb_VectorConcatenate[14] = FmgcComputer_P.Constant5_Value; + rtb_VectorConcatenate[15] = FmgcComputer_P.Constant5_Value; + rtb_VectorConcatenate[16] = FmgcComputer_P.Constant5_Value; + rtb_VectorConcatenate[17] = FmgcComputer_P.Constant5_Value; + rtb_VectorConcatenate[18] = FmgcComputer_P.Constant5_Value; + FmgcComputer_MATLABFunction_gy(rtb_VectorConcatenate, &rtb_y_c); + rtb_VectorConcatenate[0] = rtb_ap_fd_condition_tmp; + rtb_VectorConcatenate[1] = in_land_or_ga_tmp; + rtb_VectorConcatenate[2] = FmgcComputer_DWork.Memory_PreviousInput_n; + rtb_VectorConcatenate[3] = FmgcComputer_DWork.Memory_PreviousInput_i1; + rtb_VectorConcatenate[4] = FmgcComputer_P.Constant6_Value; + rtb_VectorConcatenate[5] = FmgcComputer_DWork.Memory_PreviousInput_a; + rtb_VectorConcatenate[6] = FmgcComputer_P.Constant6_Value; + rtb_VectorConcatenate[7] = FmgcComputer_P.Constant6_Value; + rtb_VectorConcatenate[8] = FmgcComputer_P.Constant6_Value; + rtb_VectorConcatenate[9] = FmgcComputer_DWork.Memory_PreviousInput_l; + rtb_VectorConcatenate[10] = FmgcComputer_P.Constant6_Value; + rtb_VectorConcatenate[11] = FmgcComputer_DWork.Memory_PreviousInput_fm; + rtb_VectorConcatenate[12] = FmgcComputer_DWork.Memory_PreviousInput_dv; + rtb_VectorConcatenate[13] = FmgcComputer_DWork.Memory_PreviousInput_m; + rtb_VectorConcatenate[14] = FmgcComputer_DWork.Memory_PreviousInput_nt; + rtb_VectorConcatenate[15] = FmgcComputer_P.Constant6_Value; + rtb_VectorConcatenate[16] = FmgcComputer_P.Constant6_Value; + rtb_VectorConcatenate[17] = FmgcComputer_P.Constant6_Value; + rtb_VectorConcatenate[18] = FmgcComputer_P.Constant6_Value; + FmgcComputer_MATLABFunction_gy(rtb_VectorConcatenate, &rtb_y_kc); + rtb_VectorConcatenate_j[0] = (FmgcComputer_DWork.Memory_PreviousInput_ec || + FmgcComputer_DWork.Memory_PreviousInput_ae || + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.longitudinal_modes.exp_clb_active); + rtb_VectorConcatenate_j[1] = (FmgcComputer_DWork.Memory_PreviousInput_b3 || + FmgcComputer_DWork.Memory_PreviousInput_ev || + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.longitudinal_modes.exp_des_active); + rtb_VectorConcatenate_j[2] = FmgcComputer_P.Constant7_Value; + rtb_VectorConcatenate_j[3] = (FmgcComputer_DWork.Memory_PreviousInput_ae || + FmgcComputer_DWork.Memory_PreviousInput_ev); + rtb_VectorConcatenate_j[4] = FmgcComputer_DWork.Memory_PreviousInput_k; + rtb_VectorConcatenate_j[5] = FmgcComputer_DWork.Memory_PreviousInput_i; + rtb_VectorConcatenate_j[6] = rtb_Logic_gj_idx_0_tmp_tmp_tmp_0; + rtb_VectorConcatenate_j[7] = rtb_Logic_gj_idx_0_tmp_tmp_tmp; + rtb_VectorConcatenate_j[8] = (FmgcComputer_DWork.Memory_PreviousInput_ne || + FmgcComputer_DWork.Memory_PreviousInput_cb); + rtb_VectorConcatenate_j[9] = (FmgcComputer_DWork.Memory_PreviousInput_cb || + FmgcComputer_DWork.Memory_PreviousInput_as); + rtb_VectorConcatenate_j[10] = (FmgcComputer_DWork.Memory_PreviousInput_ne || + FmgcComputer_DWork.Memory_PreviousInput_nu); + rtb_VectorConcatenate_j[11] = (FmgcComputer_DWork.Memory_PreviousInput_nu || + FmgcComputer_DWork.Memory_PreviousInput_as); + rtb_VectorConcatenate_j[12] = FmgcComputer_DWork.Memory_PreviousInput_f; + rtb_VectorConcatenate_j[13] = (FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.longitudinal_modes.exp_des_active + || FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.longitudinal_modes.exp_clb_active); + rtb_VectorConcatenate_j[14] = FmgcComputer_P.Constant7_Value; + rtb_VectorConcatenate_j[15] = FmgcComputer_P.Constant7_Value; + rtb_VectorConcatenate_j[16] = FmgcComputer_P.Constant7_Value; + rtb_VectorConcatenate_j[17] = FmgcComputer_P.Constant7_Value; + rtb_VectorConcatenate_j[18] = FmgcComputer_P.Constant7_Value; + FmgcComputer_MATLABFunction_gy(rtb_VectorConcatenate_j, &rtb_y_p); + rtb_VectorConcatenate_j[0] = rtb_NOT3; + rtb_VectorConcatenate_j[1] = FmgcComputer_DWork.Memory_PreviousInput_ip; + rtb_VectorConcatenate_j[2] = FmgcComputer_DWork.Memory_PreviousInput_cv; + rtb_VectorConcatenate_j[3] = FmgcComputer_DWork.Memory_PreviousInput_lq; + rtb_VectorConcatenate_j[4] = FmgcComputer_DWork.Memory_PreviousInput_e; + rtb_VectorConcatenate_j[5] = rtb_OR2_tmp; + rtb_VectorConcatenate_j[6] = rtb_NOT4_gb; + rtb_VectorConcatenate_j[7] = FmgcComputer_P.Constant8_Value; + rtb_VectorConcatenate_j[8] = FmgcComputer_P.Constant8_Value; + rtb_VectorConcatenate_j[9] = FmgcComputer_DWork.Memory_PreviousInput_c; + rtb_VectorConcatenate_j[10] = FmgcComputer_P.Constant8_Value; + rtb_VectorConcatenate_j[11] = FmgcComputer_P.Constant8_Value; + rtb_VectorConcatenate_j[12] = FmgcComputer_DWork.Memory_PreviousInput_b; + rtb_VectorConcatenate_j[13] = FmgcComputer_P.Constant8_Value; + rtb_VectorConcatenate_j[14] = FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.lateral_modes.align_submode_active; + rtb_VectorConcatenate_j[15] = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.lateral_modes.rollout_submode_active; + rtb_VectorConcatenate_j[16] = FmgcComputer_P.Constant8_Value; + rtb_VectorConcatenate_j[17] = FmgcComputer_P.Constant8_Value; + rtb_VectorConcatenate_j[18] = FmgcComputer_P.Constant8_Value; + FmgcComputer_MATLABFunction_gy(rtb_VectorConcatenate_j, &rtb_y_l); + rtb_VectorConcatenate_j[0] = FmgcComputer_P.Constant9_Value; + rtb_VectorConcatenate_j[1] = FmgcComputer_P.Constant9_Value; + rtb_VectorConcatenate_j[2] = FmgcComputer_P.Constant9_Value; + rtb_VectorConcatenate_j[3] = FmgcComputer_P.Constant9_Value; + rtb_VectorConcatenate_j[4] = FmgcComputer_P.Constant9_Value; + rtb_VectorConcatenate_j[5] = FmgcComputer_P.Constant9_Value; + rtb_VectorConcatenate_j[6] = FmgcComputer_P.Constant9_Value; + rtb_VectorConcatenate_j[7] = FmgcComputer_P.Constant9_Value; + rtb_VectorConcatenate_j[8] = FmgcComputer_P.Constant9_Value; + rtb_VectorConcatenate_j[9] = FmgcComputer_P.Constant9_Value; + rtb_VectorConcatenate_j[10] = FmgcComputer_P.Constant9_Value; + rtb_VectorConcatenate_j[11] = FmgcComputer_P.Constant9_Value; + rtb_VectorConcatenate_j[12] = FmgcComputer_P.Constant9_Value; + rtb_VectorConcatenate_j[13] = FmgcComputer_P.Constant9_Value; + rtb_VectorConcatenate_j[14] = FmgcComputer_P.Constant9_Value; + rtb_VectorConcatenate_j[15] = FmgcComputer_P.Constant9_Value; + rtb_VectorConcatenate_j[16] = FmgcComputer_P.Constant9_Value; + rtb_VectorConcatenate_j[17] = FmgcComputer_P.Constant9_Value; + rtb_VectorConcatenate_j[18] = FmgcComputer_P.Constant9_Value; + FmgcComputer_MATLABFunction_gy(rtb_VectorConcatenate_j, &rtb_y_g); + rtb_y_gp = static_cast(FmgcComputer_P.EnumeratedConstant1_Value_d); + FmgcComputer_Y.out.data = FmgcComputer_U.in; + FmgcComputer_Y.out.logic.on_ground = rtb_OR9_b; + FmgcComputer_Y.out.logic.gnd_eng_stop_flt_5s = fdOppOff; + FmgcComputer_Y.out.logic.ap_fd_athr_common_condition = rtb_AND10; + FmgcComputer_Y.out.logic.ap_fd_common_condition = rtb_ap_fd_condition; + FmgcComputer_Y.out.logic.fd_own_engaged = fdOwnOff; + FmgcComputer_Y.out.logic.ap_own_engaged = FmgcComputer_DWork.Delay_DSTATE_p; + FmgcComputer_Y.out.logic.athr_own_engaged = FmgcComputer_DWork.Delay_DSTATE_k; + FmgcComputer_Y.out.logic.athr_active = false; + FmgcComputer_Y.out.logic.ap_inop = rtb_ap_inop_tmp; + FmgcComputer_Y.out.logic.athr_inop = rtb_Compare; + FmgcComputer_Y.out.logic.fmgc_opp_priority = rtb_fmgcOppPriority; + FmgcComputer_Y.out.logic.double_adr_failure = rtb_doubleAdrFault; + FmgcComputer_Y.out.logic.double_ir_failure = rtb_doubleIrFault; + FmgcComputer_Y.out.logic.all_adr_valid = ((!rtb_adrOwnInvalid) && (!rtb_adrOppInvalid) && (!rtb_adr3Invalid)); + FmgcComputer_Y.out.logic.all_ir_valid = ((!rtb_irOwnInvalid) && (!rtb_irOppInvalid) && (!rtb_ir3Invalid)); + FmgcComputer_Y.out.logic.adr_computation_data.V_ias_kn = rtb_V_ias; + FmgcComputer_Y.out.logic.adr_computation_data.V_tas_kn = rtb_V_tas; + FmgcComputer_Y.out.logic.adr_computation_data.mach = rtb_mach_i; + FmgcComputer_Y.out.logic.adr_computation_data.alpha_deg = rtb_alpha; + FmgcComputer_Y.out.logic.adr_computation_data.p_s_c_hpa = rtb_p_s_c; + FmgcComputer_Y.out.logic.adr_computation_data.altitude_corrected_ft = rtb_alt; + FmgcComputer_Y.out.logic.ir_computation_data.theta_deg = rtb_theta; + FmgcComputer_Y.out.logic.ir_computation_data.phi_deg = rtb_phi; + FmgcComputer_Y.out.logic.ir_computation_data.q_deg_s = rtb_q; + FmgcComputer_Y.out.logic.ir_computation_data.r_deg_s = rtb_r; + FmgcComputer_Y.out.logic.ir_computation_data.n_x_g = rtb_n_x; + FmgcComputer_Y.out.logic.ir_computation_data.n_y_g = rtb_n_y; + FmgcComputer_Y.out.logic.ir_computation_data.n_z_g = rtb_n_z; + FmgcComputer_Y.out.logic.ir_computation_data.theta_dot_deg_s = rtb_theta_dot; + FmgcComputer_Y.out.logic.ir_computation_data.phi_dot_deg_s = rtb_phi_dot; + FmgcComputer_Y.out.logic.ir_computation_data.hdg_deg = rtb_hdg; + FmgcComputer_Y.out.logic.ir_computation_data.trk_deg = rtb_trk; + FmgcComputer_Y.out.logic.ir_computation_data.vz_bi_ft_min = rtb_vz; + FmgcComputer_Y.out.logic.ir_computation_data.fpa_deg = rtb_fpa; + FmgcComputer_Y.out.logic.ra_computation_data_ft = rtb_raComputationData; + FmgcComputer_Y.out.logic.dual_ra_failure = rtb_dualRaFailure; + FmgcComputer_Y.out.logic.both_ra_valid = rtb_bothRaValid; + FmgcComputer_Y.out.logic.fac_lg_data_failure = rtb_y_b; + FmgcComputer_Y.out.logic.flap_slat_lever_position = FmgcComputer_P.Constant_Value_o; + FmgcComputer_Y.out.logic.fac_speeds_failure = FmgcComputer_P.Constant1_Value.fac_speeds_failure; + FmgcComputer_Y.out.logic.fac_weights_failure = FmgcComputer_P.Constant1_Value.fac_weights_failure; + FmgcComputer_Y.out.logic.fcu_failure = rtb_BusAssignment_h_logic_fcu_failure; + FmgcComputer_Y.out.logic.ils_failure = rtb_OR9; + FmgcComputer_Y.out.logic.both_ils_valid = rtb_BusAssignment_g_logic_both_ils_valid; + FmgcComputer_Y.out.logic.ils_computation_data.runway_heading_deg.SSM = rtb_y_jz; + FmgcComputer_Y.out.logic.ils_computation_data.runway_heading_deg.Data = rtb_Switch_runway_heading_deg_Data; + FmgcComputer_Y.out.logic.ils_computation_data.localizer_deviation_deg.SSM = rtb_Switch_localizer_deviation_deg_SSM; + FmgcComputer_Y.out.logic.ils_computation_data.localizer_deviation_deg.Data = rtb_Switch_localizer_deviation_deg_Data; + FmgcComputer_Y.out.logic.ils_computation_data.glideslope_deviation_deg.SSM = rtb_Switch_glideslope_deviation_deg_SSM; + FmgcComputer_Y.out.logic.ils_computation_data.glideslope_deviation_deg.Data = + rtb_Switch_glideslope_deviation_deg_Data; + FmgcComputer_Y.out.ap_fd_logic.lateral_modes.rwy_active = rtb_NOT3; + FmgcComputer_Y.out.ap_fd_logic.lateral_modes.nav_active = FmgcComputer_DWork.Memory_PreviousInput_ip; + FmgcComputer_Y.out.ap_fd_logic.lateral_modes.loc_cpt_active = FmgcComputer_DWork.Memory_PreviousInput_cv; + FmgcComputer_Y.out.ap_fd_logic.lateral_modes.loc_trk_active = FmgcComputer_DWork.Memory_PreviousInput_lq; + FmgcComputer_Y.out.ap_fd_logic.lateral_modes.roll_goaround_active = FmgcComputer_DWork.Memory_PreviousInput_e; + FmgcComputer_Y.out.ap_fd_logic.lateral_modes.hdg_active = rtb_OR2_tmp; + FmgcComputer_Y.out.ap_fd_logic.lateral_modes.trk_active = rtb_NOT4_gb; + FmgcComputer_Y.out.ap_fd_logic.lateral_modes.rwy_loc_submode_active = FmgcComputer_DWork.Memory_PreviousInput_c; + FmgcComputer_Y.out.ap_fd_logic.lateral_modes.rwy_trk_submode_active = FmgcComputer_DWork.Memory_PreviousInput_b; + FmgcComputer_Y.out.ap_fd_logic.lateral_modes.land_active = FmgcComputer_DWork.Memory_PreviousInput_d; + FmgcComputer_Y.out.ap_fd_logic.lateral_modes.align_submode_active = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.lateral_modes.align_submode_active; + FmgcComputer_Y.out.ap_fd_logic.lateral_modes.rollout_submode_active = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.lateral_modes.rollout_submode_active; + FmgcComputer_Y.out.ap_fd_logic.longitudinal_modes.clb_active = FmgcComputer_DWork.Memory_PreviousInput_ec; + FmgcComputer_Y.out.ap_fd_logic.longitudinal_modes.des_active = FmgcComputer_DWork.Memory_PreviousInput_b3; + FmgcComputer_Y.out.ap_fd_logic.longitudinal_modes.op_clb_active = FmgcComputer_DWork.Memory_PreviousInput_ae; + FmgcComputer_Y.out.ap_fd_logic.longitudinal_modes.op_des_active = FmgcComputer_DWork.Memory_PreviousInput_ev; + FmgcComputer_Y.out.ap_fd_logic.longitudinal_modes.exp_clb_active = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.longitudinal_modes.exp_clb_active; + FmgcComputer_Y.out.ap_fd_logic.longitudinal_modes.exp_des_active = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.longitudinal_modes.exp_des_active; + FmgcComputer_Y.out.ap_fd_logic.longitudinal_modes.pitch_takeoff_active = FmgcComputer_DWork.Memory_PreviousInput_k; + FmgcComputer_Y.out.ap_fd_logic.longitudinal_modes.pitch_goaround_active = FmgcComputer_DWork.Memory_PreviousInput_i; + FmgcComputer_Y.out.ap_fd_logic.longitudinal_modes.vs_active = rtb_Logic_gj_idx_0_tmp_tmp_tmp_0; + FmgcComputer_Y.out.ap_fd_logic.longitudinal_modes.fpa_active = rtb_Logic_gj_idx_0_tmp_tmp_tmp; + FmgcComputer_Y.out.ap_fd_logic.longitudinal_modes.alt_acq_active = FmgcComputer_DWork.Memory_PreviousInput_ne; + FmgcComputer_Y.out.ap_fd_logic.longitudinal_modes.alt_hold_active = FmgcComputer_DWork.Memory_PreviousInput_cb; + FmgcComputer_Y.out.ap_fd_logic.longitudinal_modes.gs_capt_active = FmgcComputer_DWork.Memory_PreviousInput_nu; + FmgcComputer_Y.out.ap_fd_logic.longitudinal_modes.gs_trk_active = FmgcComputer_DWork.Memory_PreviousInput_as; + FmgcComputer_Y.out.ap_fd_logic.longitudinal_modes.final_des_active = FmgcComputer_DWork.Memory_PreviousInput_f; + FmgcComputer_Y.out.ap_fd_logic.longitudinal_modes.flare_active = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.longitudinal_modes.flare_active; + FmgcComputer_Y.out.ap_fd_logic.longitudinal_modes.cruise_active = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.longitudinal_modes.cruise_active; + FmgcComputer_Y.out.ap_fd_logic.longitudinal_modes.tcas_active = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.longitudinal_modes.tcas_active; + FmgcComputer_Y.out.ap_fd_logic.armed_modes.alt_acq_armed = in_land_or_ga_tmp; + FmgcComputer_Y.out.ap_fd_logic.armed_modes.alt_acq_arm_possible = FmgcComputer_DWork.Memory_PreviousInput_n; + FmgcComputer_Y.out.ap_fd_logic.armed_modes.nav_armed = FmgcComputer_DWork.Memory_PreviousInput_i1; + FmgcComputer_Y.out.ap_fd_logic.armed_modes.loc_armed = FmgcComputer_DWork.Memory_PreviousInput_a; + FmgcComputer_Y.out.ap_fd_logic.armed_modes.land_armed = FmgcComputer_DWork.Memory_PreviousInput_l; + FmgcComputer_Y.out.ap_fd_logic.armed_modes.glide_armed = FmgcComputer_DWork.Memory_PreviousInput_fm; + FmgcComputer_Y.out.ap_fd_logic.armed_modes.final_des_armed = FmgcComputer_DWork.Memory_PreviousInput_dv; + FmgcComputer_Y.out.ap_fd_logic.armed_modes.clb_armed = FmgcComputer_DWork.Memory_PreviousInput_m; + FmgcComputer_Y.out.ap_fd_logic.armed_modes.des_armed = FmgcComputer_DWork.Memory_PreviousInput_nt; + FmgcComputer_Y.out.ap_fd_logic.armed_modes.tcas_armed = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.armed_modes.tcas_armed; + FmgcComputer_Y.out.ap_fd_logic.auto_spd_control_active = FmgcComputer_DWork.Memory_PreviousInput_h; + FmgcComputer_Y.out.ap_fd_logic.manual_spd_control_active = FmgcComputer_DWork.Memory_PreviousInput_cu; + FmgcComputer_Y.out.ap_fd_logic.fmgc_opp_mode_sync = raOwnInvalid; + FmgcComputer_Y.out.ap_fd_logic.any_ap_fd_engaged = raOppInvalid; + FmgcComputer_Y.out.ap_fd_logic.any_lateral_mode_engaged = rtb_OR1_j; + FmgcComputer_Y.out.ap_fd_logic.any_longitudinal_mode_engaged = rtb_OR_nx; + FmgcComputer_Y.out.ap_fd_logic.hdg_trk_preset_available = rtb_ap_fd_condition_tmp; + FmgcComputer_Y.out.ap_fd_logic.ap_fd_mode_reversion = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.ap_fd_mode_reversion; + FmgcComputer_Y.out.ap_fd_logic.pitch_fd_bars_flashing = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.pitch_fd_bars_flashing; + FmgcComputer_Y.out.ap_fd_logic.roll_fd_bars_flashing = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.roll_fd_bars_flashing; + FmgcComputer_Y.out.ap_fd_logic.loc_bc_selection = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.loc_bc_selection; + FmgcComputer_Y.out.ap_fd_logic.vs_target_not_held = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.vs_target_not_held; + FmgcComputer_Y.out.ap_fd_logic.tcas_ra_inhibited = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.tcas_ra_inhibited; + FmgcComputer_Y.out.ap_fd_logic.trk_fpa_deselected = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.trk_fpa_deselected; + FmgcComputer_Y.out.ap_fd_logic.longi_large_box_tcas = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.longi_large_box_tcas; + FmgcComputer_Y.out.ap_fd_logic.land_2_capability = rtb_Compare_pf; + FmgcComputer_Y.out.ap_fd_logic.land_3_fail_passive_capability = rtb_OR_nn; + FmgcComputer_Y.out.ap_fd_logic.land_3_fail_op_capability = false; + FmgcComputer_Y.out.ap_fd_logic.land_2_inop = rtb_appInop_idx_0; + FmgcComputer_Y.out.ap_fd_logic.land_3_fail_passive_inop = rtb_y_gx; + FmgcComputer_Y.out.ap_fd_logic.land_3_fail_op_inop = true; + FmgcComputer_Y.out.ap_fd_logic.land_2_capacity = rtb_OR2; + FmgcComputer_Y.out.ap_fd_logic.land_3_fail_passive_capacity = rtb_TmpSignalConversionAtSFunctionInport3_idx_1; + FmgcComputer_Y.out.ap_fd_logic.land_3_fail_op_capacity = rtb_y_dh; + FmgcComputer_Y.out.discrete_outputs.athr_own_engaged = FmgcComputer_DWork.Delay_DSTATE_k; + FmgcComputer_Y.out.discrete_outputs.fd_own_engaged = fdOwnOff; + FmgcComputer_Y.out.discrete_outputs.ap_own_engaged = FmgcComputer_DWork.Delay_DSTATE_p; + FmgcComputer_Y.out.discrete_outputs.fcu_own_fail = FmgcComputer_P.Constant_Value_m; + FmgcComputer_Y.out.discrete_outputs.fmgc_healthy = FmgcComputer_P.Constant1_Value_i; + FmgcComputer_Y.out.discrete_outputs.ils_test_inhibit = FmgcComputer_P.Constant_Value_m; + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.pfd_sel_spd_kts.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.pfd_sel_spd_kts.Data = FmgcComputer_P.Constant17_Value; + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.runway_hdg_memorized_deg.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.runway_hdg_memorized_deg.Data = FmgcComputer_P.Constant18_Value; + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.preset_mach_from_mcdu.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.preset_mach_from_mcdu.Data = FmgcComputer_P.Constant19_Value; + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.preset_speed_from_mcdu_kts.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.preset_speed_from_mcdu_kts.Data = FmgcComputer_P.Constant20_Value; + rtb_Compare = !FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.lateral_modes.rollout_submode_active; + if (rtb_OR1_j && (!FmgcComputer_DWork.Memory_PreviousInput_c) && rtb_Compare) { + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.roll_fd_command.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + } else { + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.roll_fd_command.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant_Value); + } + + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.roll_fd_command.Data = FmgcComputer_P.Constant16_Value; + if (rtb_OR_nx && rtb_Compare) { + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.pitch_fd_command.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + } else { + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.pitch_fd_command.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant_Value); + } + + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.pitch_fd_command.Data = FmgcComputer_P.Constant1_Value_g; + if (FmgcComputer_DWork.Memory_PreviousInput_c || + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.lateral_modes.align_submode_active || + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.lateral_modes.rollout_submode_active) { + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.yaw_fd_command.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + } else { + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.yaw_fd_command.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant_Value); + } + + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.yaw_fd_command.Data = FmgcComputer_P.Constant2_Value; + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.discrete_word_5.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.discrete_word_5.Data = rtb_y_j; + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.discrete_word_4.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.discrete_word_4.Data = rtb_y_ke; + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.fm_alt_constraint_ft.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.fm_alt_constraint_ft.Data = FmgcComputer_P.Constant22_Value; + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.altitude_ft.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.altitude_ft.Data = rtb_alt; + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.mach.SSM = static_cast(FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.mach.Data = rtb_mach_i; + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.cas_kts.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.cas_kts.Data = rtb_V_ias; + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.flx_to_temp_deg_c.SSM = rtb_y_en; + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.flx_to_temp_deg_c.Data = static_cast + (FmgcComputer_U.in.fms_inputs.flex_temp_deg_c); + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.ats_discrete_word.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.ats_discrete_word.Data = rtb_y_je; + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.ats_fma_discrete_word.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.ats_fma_discrete_word.Data = rtb_y_c; + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.discrete_word_3.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.discrete_word_3.Data = rtb_y_kc; + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.discrete_word_1.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.discrete_word_1.Data = rtb_y_p; + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.discrete_word_2.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.discrete_word_2.Data = rtb_y_l; + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.discrete_word_6.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.discrete_word_6.Data = rtb_y_g; + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.synchro_spd_mach_value.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.synchro_spd_mach_value.Data = FmgcComputer_P.Constant26_Value; + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.low_target_speed_margin_kts.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.low_target_speed_margin_kts.Data = FmgcComputer_P.Constant27_Value; + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.high_target_speed_margin_kts.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.high_target_speed_margin_kts.Data = FmgcComputer_P.Constant28_Value; + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.delta_p_ail_voted_cmd_deg.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.delta_p_ail_voted_cmd_deg.Data = FmgcComputer_P.Constant11_Value; + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.delta_p_splr_voted_cmd_deg.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.delta_p_splr_voted_cmd_deg.Data = FmgcComputer_P.Constant12_Value; + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.delta_r_voted_cmd_deg.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.delta_r_voted_cmd_deg.Data = FmgcComputer_P.Constant13_Value; + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.delta_nosewheel_voted_cmd_deg.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.delta_nosewheel_voted_cmd_deg.Data = FmgcComputer_P.Constant14_Value; + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.delta_q_voted_cmd_deg.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.delta_q_voted_cmd_deg.Data = FmgcComputer_P.Constant15_Value; + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.track_deg.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.track_deg.Data = rtb_trk; + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.heading_deg.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.heading_deg.Data = rtb_hdg; + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.fpa_deg.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.fpa_deg.Data = rtb_fpa; + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.n1_command_percent.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.n1_command_percent.Data = FmgcComputer_P.Constant32_Value; + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.vertical_speed_ft_min.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_a_bus.vertical_speed_ft_min.Data = rtb_vz; + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.fac_weight_lbs.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value_d); + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.fac_weight_lbs.Data = FmgcComputer_P.Constant1_Value_k; + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.fm_weight_lbs.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value_d); + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.fm_weight_lbs.Data = FmgcComputer_P.Constant1_Value_k; + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.fac_cg_percent.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value_d); + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.fac_cg_percent.Data = FmgcComputer_P.Constant1_Value_k; + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.fm_cg_percent.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value_d); + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.fm_cg_percent.Data = FmgcComputer_P.Constant1_Value_k; + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.fg_radio_height_ft.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value_d); + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.fg_radio_height_ft.Data = FmgcComputer_P.Constant1_Value_k; + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.discrete_word_4.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.discrete_word_4.Data = rtb_y_ke; + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.ats_discrete_word.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.ats_discrete_word.Data = rtb_y_je; + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.discrete_word_3.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.discrete_word_3.Data = rtb_y_kc; + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.discrete_word_1.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.discrete_word_1.Data = rtb_y_p; + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.discrete_word_2.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.discrete_word_2.Data = rtb_y_l; + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.approach_spd_target_kn.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value_d); + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.approach_spd_target_kn.Data = FmgcComputer_P.Constant11_Value_m; + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.delta_p_ail_cmd_deg.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.delta_p_ail_cmd_deg.Data = FmgcComputer_P.Constant11_Value; + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.delta_p_splr_cmd_deg.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.delta_p_splr_cmd_deg.Data = FmgcComputer_P.Constant12_Value; + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.delta_r_cmd_deg.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.delta_r_cmd_deg.Data = FmgcComputer_P.Constant13_Value; + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.delta_nose_wheel_cmd_deg.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.delta_nose_wheel_cmd_deg.Data = FmgcComputer_P.Constant14_Value; + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.delta_q_cmd_deg.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value); + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.delta_q_cmd_deg.Data = FmgcComputer_P.Constant15_Value; + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.n1_left_percent.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value_d); + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.n1_left_percent.Data = FmgcComputer_P.Constant2_Value_n; + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.n1_right_percent.SSM = static_cast + (FmgcComputer_P.EnumeratedConstant1_Value_d); + FmgcComputer_Y.out.bus_outputs.fmgc_b_bus.n1_right_percent.Data = FmgcComputer_P.Constant2_Value_n; + FmgcComputer_MATLABFunction_k(rtb_Switch_k_0, FmgcComputer_P.BitfromLabel1_bit_d, &rtb_y_jz); + FmgcComputer_MATLABFunction_k(rtb_Switch_k_0, FmgcComputer_P.BitfromLabel3_bit_j, &rtb_y_jz); + FmgcComputer_MATLABFunction_k(rtb_Switch_k_0, FmgcComputer_P.BitfromLabel4_bit_o, &rtb_y_en); + FmgcComputer_MATLABFunction_k(rtb_Switch_k_0, FmgcComputer_P.BitfromLabel5_bit, &rtb_y_en); + FmgcComputer_MATLABFunction_k(rtb_Switch_k_0, FmgcComputer_P.BitfromLabel6_bit, &rtb_y_gp); + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.rwy_active = rtb_NOT3; + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.nav_active = FmgcComputer_DWork.Memory_PreviousInput_ip; + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.loc_cpt_active = FmgcComputer_DWork.Memory_PreviousInput_cv; + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.loc_trk_active = FmgcComputer_DWork.Memory_PreviousInput_lq; + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.roll_goaround_active = FmgcComputer_DWork.Memory_PreviousInput_e; + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.hdg_active = rtb_OR2_tmp; + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.trk_active = rtb_NOT4_gb; + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.rwy_loc_submode_active = FmgcComputer_DWork.Memory_PreviousInput_c; + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.rwy_trk_submode_active = FmgcComputer_DWork.Memory_PreviousInput_b; + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.land_active = FmgcComputer_DWork.Memory_PreviousInput_d; + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.align_submode_active = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.lateral_modes.align_submode_active; + FmgcComputer_DWork.Delay_DSTATE.lateral_modes.rollout_submode_active = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.lateral_modes.rollout_submode_active; + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.clb_active = FmgcComputer_DWork.Memory_PreviousInput_ec; + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.des_active = FmgcComputer_DWork.Memory_PreviousInput_b3; + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.op_clb_active = FmgcComputer_DWork.Memory_PreviousInput_ae; + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.op_des_active = FmgcComputer_DWork.Memory_PreviousInput_ev; + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.exp_clb_active = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.longitudinal_modes.exp_clb_active; + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.exp_des_active = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.longitudinal_modes.exp_des_active; + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_takeoff_active = FmgcComputer_DWork.Memory_PreviousInput_k; + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.pitch_goaround_active = FmgcComputer_DWork.Memory_PreviousInput_i; + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.vs_active = rtb_Logic_gj_idx_0_tmp_tmp_tmp_0; + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.fpa_active = rtb_Logic_gj_idx_0_tmp_tmp_tmp; + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.alt_acq_active = FmgcComputer_DWork.Memory_PreviousInput_ne; + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.alt_hold_active = FmgcComputer_DWork.Memory_PreviousInput_cb; + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.gs_capt_active = FmgcComputer_DWork.Memory_PreviousInput_nu; + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.gs_trk_active = FmgcComputer_DWork.Memory_PreviousInput_as; + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.final_des_active = FmgcComputer_DWork.Memory_PreviousInput_f; + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.flare_active = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.longitudinal_modes.flare_active; + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.cruise_active = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.longitudinal_modes.cruise_active; + FmgcComputer_DWork.Delay_DSTATE.longitudinal_modes.tcas_active = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.longitudinal_modes.tcas_active; + FmgcComputer_DWork.Delay_DSTATE.armed_modes.alt_acq_armed = in_land_or_ga_tmp; + FmgcComputer_DWork.Delay_DSTATE.armed_modes.alt_acq_arm_possible = FmgcComputer_DWork.Memory_PreviousInput_n; + FmgcComputer_DWork.Delay_DSTATE.armed_modes.nav_armed = FmgcComputer_DWork.Memory_PreviousInput_i1; + FmgcComputer_DWork.Delay_DSTATE.armed_modes.loc_armed = FmgcComputer_DWork.Memory_PreviousInput_a; + FmgcComputer_DWork.Delay_DSTATE.armed_modes.land_armed = FmgcComputer_DWork.Memory_PreviousInput_l; + FmgcComputer_DWork.Delay_DSTATE.armed_modes.glide_armed = FmgcComputer_DWork.Memory_PreviousInput_fm; + FmgcComputer_DWork.Delay_DSTATE.armed_modes.final_des_armed = FmgcComputer_DWork.Memory_PreviousInput_dv; + FmgcComputer_DWork.Delay_DSTATE.armed_modes.clb_armed = FmgcComputer_DWork.Memory_PreviousInput_m; + FmgcComputer_DWork.Delay_DSTATE.armed_modes.des_armed = FmgcComputer_DWork.Memory_PreviousInput_nt; + FmgcComputer_DWork.Delay_DSTATE.armed_modes.tcas_armed = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.armed_modes.tcas_armed; + FmgcComputer_DWork.Delay_DSTATE.auto_spd_control_active = FmgcComputer_DWork.Memory_PreviousInput_h; + FmgcComputer_DWork.Delay_DSTATE.manual_spd_control_active = FmgcComputer_DWork.Memory_PreviousInput_cu; + FmgcComputer_DWork.Delay_DSTATE.fmgc_opp_mode_sync = raOwnInvalid; + FmgcComputer_DWork.Delay_DSTATE.any_ap_fd_engaged = raOppInvalid; + FmgcComputer_DWork.Delay_DSTATE.any_lateral_mode_engaged = rtb_OR1_j; + FmgcComputer_DWork.Delay_DSTATE.any_longitudinal_mode_engaged = rtb_OR_nx; + FmgcComputer_DWork.Delay_DSTATE.hdg_trk_preset_available = rtb_ap_fd_condition_tmp; + FmgcComputer_DWork.Delay_DSTATE.ap_fd_mode_reversion = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.ap_fd_mode_reversion; + FmgcComputer_DWork.Delay_DSTATE.pitch_fd_bars_flashing = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.pitch_fd_bars_flashing; + FmgcComputer_DWork.Delay_DSTATE.roll_fd_bars_flashing = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.roll_fd_bars_flashing; + FmgcComputer_DWork.Delay_DSTATE.loc_bc_selection = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.loc_bc_selection; + FmgcComputer_DWork.Delay_DSTATE.vs_target_not_held = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.vs_target_not_held; + FmgcComputer_DWork.Delay_DSTATE.tcas_ra_inhibited = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.tcas_ra_inhibited; + FmgcComputer_DWork.Delay_DSTATE.trk_fpa_deselected = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.trk_fpa_deselected; + FmgcComputer_DWork.Delay_DSTATE.longi_large_box_tcas = + FmgcComputer_P.fmgc_ap_fd_logic_output_MATLABStruct.longi_large_box_tcas; + FmgcComputer_DWork.Delay_DSTATE.land_2_capability = rtb_Compare_pf; + FmgcComputer_DWork.Delay_DSTATE.land_3_fail_passive_capability = rtb_OR_nn; + FmgcComputer_DWork.Delay_DSTATE.land_3_fail_op_capability = false; + FmgcComputer_DWork.Delay_DSTATE.land_2_inop = rtb_appInop_idx_0; + FmgcComputer_DWork.Delay_DSTATE.land_3_fail_passive_inop = rtb_y_gx; + FmgcComputer_DWork.Delay_DSTATE.land_3_fail_op_inop = true; + FmgcComputer_DWork.Delay_DSTATE.land_2_capacity = rtb_OR2; + FmgcComputer_DWork.Delay_DSTATE.land_3_fail_passive_capacity = rtb_TmpSignalConversionAtSFunctionInport3_idx_1; + FmgcComputer_DWork.Delay_DSTATE.land_3_fail_op_capacity = rtb_y_dh; + FmgcComputer_DWork.Memory_PreviousInput_g = FmgcComputer_DWork.Delay_DSTATE_p; + FmgcComputer_DWork.Memory_PreviousInput_p = FmgcComputer_DWork.Delay_DSTATE_k; + } else { + FmgcComputer_DWork.Runtime_MODE = false; + } +} + +void FmgcComputer::initialize() +{ + FmgcComputer_DWork.Delay_DSTATE = FmgcComputer_P.Delay_InitialCondition; + FmgcComputer_DWork.Delay_DSTATE_p = FmgcComputer_P.Delay_InitialCondition_g; + FmgcComputer_DWork.Memory_PreviousInput = FmgcComputer_P.SRFlipFlop1_initial_condition; + FmgcComputer_DWork.Memory_PreviousInput_g = FmgcComputer_P.SRFlipFlop_initial_condition; + FmgcComputer_DWork.Memory_PreviousInput_g1 = FmgcComputer_P.SRFlipFlop1_initial_condition_n; + FmgcComputer_DWork.Delay_DSTATE_k = FmgcComputer_P.Delay_InitialCondition_gu; + FmgcComputer_DWork.Memory_PreviousInput_p = FmgcComputer_P.SRFlipFlop_initial_condition_b; + FmgcComputer_DWork.Memory_PreviousInput_k = FmgcComputer_P.SRFlipFlop_initial_condition_h; + FmgcComputer_DWork.Memory_PreviousInput_c = FmgcComputer_P.SRFlipFlop_initial_condition_i; + FmgcComputer_DWork.Memory_PreviousInput_b = FmgcComputer_P.SRFlipFlop_initial_condition_c; + FmgcComputer_DWork.Memory_PreviousInput_l = FmgcComputer_P.SRFlipFlop_initial_condition_d; + FmgcComputer_DWork.Memory_PreviousInput_d = FmgcComputer_P.SRFlipFlop_initial_condition_iz; + FmgcComputer_DWork.Memory_PreviousInput_dv = FmgcComputer_P.SRFlipFlop_initial_condition_l; + FmgcComputer_DWork.Memory_PreviousInput_f = FmgcComputer_P.SRFlipFlop_initial_condition_j; + FmgcComputer_DWork.Memory_PreviousInput_i = FmgcComputer_P.SRFlipFlop_initial_condition_h5; + FmgcComputer_DWork.Memory_PreviousInput_e = FmgcComputer_P.SRFlipFlop_initial_condition_e; + FmgcComputer_DWork.Memory_PreviousInput_f2 = FmgcComputer_P.SRFlipFlop_initial_condition_cs; + FmgcComputer_DWork.Memory_PreviousInput_i1 = FmgcComputer_P.SRFlipFlop_initial_condition_o; + FmgcComputer_DWork.Memory_PreviousInput_ip = FmgcComputer_P.SRFlipFlop_initial_condition_g; + FmgcComputer_DWork.Memory_PreviousInput_a = FmgcComputer_P.SRFlipFlop_initial_condition_n; + FmgcComputer_DWork.Memory_PreviousInput_cv = FmgcComputer_P.SRFlipFlop_initial_condition_of; + FmgcComputer_DWork.Memory_PreviousInput_lq = FmgcComputer_P.SRFlipFlop_initial_condition_on; + FmgcComputer_DWork.Memory_PreviousInput_n = FmgcComputer_P.SRFlipFlop1_initial_condition_b; + FmgcComputer_DWork.Memory_PreviousInput_ne = FmgcComputer_P.SRFlipFlop_initial_condition_ja; + FmgcComputer_DWork.Memory_PreviousInput_cb = FmgcComputer_P.SRFlipFlop_initial_condition_li; + FmgcComputer_DWork.Memory_PreviousInput_fg = FmgcComputer_P.SRFlipFlop1_initial_condition_i; + FmgcComputer_DWork.Memory_PreviousInput_m = FmgcComputer_P.SRFlipFlop_initial_condition_be; + FmgcComputer_DWork.Memory_PreviousInput_ec = FmgcComputer_P.SRFlipFlop_initial_condition_jv; + FmgcComputer_DWork.Memory_PreviousInput_nt = FmgcComputer_P.SRFlipFlop_initial_condition_p; + FmgcComputer_DWork.Memory_PreviousInput_b3 = FmgcComputer_P.SRFlipFlop_initial_condition_lz; + FmgcComputer_DWork.Memory_PreviousInput_ae = FmgcComputer_P.SRFlipFlop_initial_condition_oz; + FmgcComputer_DWork.Memory_PreviousInput_ev = FmgcComputer_P.SRFlipFlop_initial_condition_pr; + FmgcComputer_DWork.Memory_PreviousInput_fm = FmgcComputer_P.SRFlipFlop_initial_condition_ce; + FmgcComputer_DWork.Memory_PreviousInput_nu = FmgcComputer_P.SRFlipFlop_initial_condition_hs; + FmgcComputer_DWork.Memory_PreviousInput_as = FmgcComputer_P.SRFlipFlop_initial_condition_dp; + FmgcComputer_DWork.Memory_PreviousInput_cu = FmgcComputer_P.SRFlipFlop1_initial_condition_o; + FmgcComputer_DWork.Memory_PreviousInput_h = FmgcComputer_P.SRFlipFlop_initial_condition_n1; + FmgcComputer_Y.out = FmgcComputer_P.out_Y0; +} + +void FmgcComputer::terminate() +{ +} + +FmgcComputer::FmgcComputer(): + FmgcComputer_U(), + FmgcComputer_Y(), + FmgcComputer_DWork() +{ +} + +FmgcComputer::~FmgcComputer() +{ +} diff --git a/fbw-a32nx/src/wasm/fbw_a320/src/model/FmgcComputer.h b/fbw-a32nx/src/wasm/fbw_a320/src/model/FmgcComputer.h new file mode 100644 index 000000000000..90861382a3f2 --- /dev/null +++ b/fbw-a32nx/src/wasm/fbw_a320/src/model/FmgcComputer.h @@ -0,0 +1,599 @@ +#ifndef RTW_HEADER_FmgcComputer_h_ +#define RTW_HEADER_FmgcComputer_h_ +#include "rtwtypes.h" +#include "FmgcComputer_types.h" + +class FmgcComputer final +{ + public: + struct rtDW_MATLABFunction_FmgcComputer_T { + real_T timeSinceCondition; + boolean_T output; + }; + + struct rtDW_MATLABFunction_FmgcComputer_e_T { + boolean_T previousInput; + boolean_T previousInput_not_empty; + }; + + struct rtDW_MATLABFunction_FmgcComputer_ll_T { + real_T remainingTriggerTime; + boolean_T previousInput; + }; + + struct D_Work_FmgcComputer_T { + base_fmgc_ap_fd_logic_outputs Delay_DSTATE; + boolean_T Delay_DSTATE_p; + boolean_T Delay_DSTATE_k; + boolean_T Memory_PreviousInput; + boolean_T Memory_PreviousInput_g; + boolean_T Memory_PreviousInput_g1; + boolean_T Memory_PreviousInput_p; + boolean_T Memory_PreviousInput_k; + boolean_T Memory_PreviousInput_c; + boolean_T Memory_PreviousInput_b; + boolean_T Memory_PreviousInput_l; + boolean_T Memory_PreviousInput_d; + boolean_T Memory_PreviousInput_dv; + boolean_T Memory_PreviousInput_f; + boolean_T Memory_PreviousInput_i; + boolean_T Memory_PreviousInput_e; + boolean_T Memory_PreviousInput_f2; + boolean_T Memory_PreviousInput_i1; + boolean_T Memory_PreviousInput_ip; + boolean_T Memory_PreviousInput_a; + boolean_T Memory_PreviousInput_cv; + boolean_T Memory_PreviousInput_lq; + boolean_T Memory_PreviousInput_n; + boolean_T Memory_PreviousInput_ne; + boolean_T Memory_PreviousInput_cb; + boolean_T Memory_PreviousInput_fg; + boolean_T Memory_PreviousInput_m; + boolean_T Memory_PreviousInput_ec; + boolean_T Memory_PreviousInput_nt; + boolean_T Memory_PreviousInput_b3; + boolean_T Memory_PreviousInput_ae; + boolean_T Memory_PreviousInput_ev; + boolean_T Memory_PreviousInput_fm; + boolean_T Memory_PreviousInput_nu; + boolean_T Memory_PreviousInput_as; + boolean_T Memory_PreviousInput_cu; + boolean_T Memory_PreviousInput_h; + boolean_T Runtime_MODE; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_d5; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_dtd; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_jc; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_lr; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_mrn; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_ft; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_aba; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_ih; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_j3; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_fe; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_cx; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_ds; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_nd; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_gbq; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_ms; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_khd; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_f0h; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_go; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_dba; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_mu; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_bs; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_pe; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_iv; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_mo; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_fz; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_n5; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_ax; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_p3; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_ir; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_dt; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_ee; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_hw; + rtDW_MATLABFunction_FmgcComputer_ll_T sf_MATLABFunction_bq; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_hu; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_h0; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_jle; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_m1; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_ge4; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_pr; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_is; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_p4; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_k4; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_ma; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_ol; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_ah; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_gb; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_at; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_h4; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_di2; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_hdw; + rtDW_MATLABFunction_FmgcComputer_ll_T sf_MATLABFunction_aw; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_kz; + rtDW_MATLABFunction_FmgcComputer_ll_T sf_MATLABFunction_mn; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_jl; + rtDW_MATLABFunction_FmgcComputer_ll_T sf_MATLABFunction_db; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_fm; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_gk; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_fx; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_hz; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_pn; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_mtz; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_fn; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_lm; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_hv; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_eb2; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_kb; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_es; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_hh; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_ha; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_fa; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_op; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_fo; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_crq; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_mq; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_d3; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_d; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_kq; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_o; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_k; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_c; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_h; + rtDW_MATLABFunction_FmgcComputer_e_T sf_MATLABFunction_i; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction_f; + rtDW_MATLABFunction_FmgcComputer_T sf_MATLABFunction; + }; + + struct ExternalInputs_FmgcComputer_T { + fmgc_inputs in; + }; + + struct ExternalOutputs_FmgcComputer_T { + fmgc_outputs out; + }; + + struct Parameters_FmgcComputer_T { + base_fmgc_ap_fd_logic_outputs fmgc_ap_fd_logic_output_MATLABStruct; + base_fmgc_discrete_outputs fmgc_discrete_output_MATLABStruct; + real_T BitfromLabel_bit; + real_T BitfromLabel1_bit; + real_T BitfromLabel2_bit; + real_T BitfromLabel2_bit_l; + real_T BitfromLabel_bit_n; + real_T BitfromLabel1_bit_i; + real_T BitfromLabel_bit_c; + real_T BitfromLabel_bit_m; + real_T BitfromLabel1_bit_g; + real_T BitfromLabel_bit_f; + real_T BitfromLabel1_bit_n; + real_T BitfromLabel_bit_k; + real_T BitfromLabel2_bit_b; + real_T BitfromLabel1_bit_l; + real_T BitfromLabel_bit_ff; + real_T BitfromLabel2_bit_f; + real_T BitfromLabel_bit_l; + real_T BitfromLabel2_bit_e; + real_T BitfromLabel_bit_a; + real_T BitfromLabel_bit_cs; + real_T BitfromLabel_bit_e; + real_T BitfromLabel_bit_p; + real_T BitfromLabel1_bit_o; + real_T BitfromLabel2_bit_i; + real_T BitfromLabel4_bit; + real_T BitfromLabel3_bit; + real_T BitfromLabel_bit_fu; + real_T BitfromLabel2_bit_m; + real_T BitfromLabel1_bit_p; + real_T BitfromLabel_bit_nk; + real_T BitfromLabel_bit_o; + real_T BitfromLabel1_bit_ls; + real_T BitfromLabel_bit_j; + real_T BitfromLabel_bit_es; + real_T BitfromLabel1_bit_m; + real_T BitfromLabel_bit_et; + real_T BitfromLabel1_bit_ng; + real_T BitfromLabel2_bit_n; + real_T BitfromLabel3_bit_f; + real_T BitfromLabel1_bit_p2; + real_T BitfromLabel2_bit_fr; + real_T BitfromLabel1_bit_a; + real_T BitfromLabel2_bit_k; + real_T BitfromLabel4_bit_g; + real_T BitfromLabel3_bit_e; + real_T BitfromLabel_bit_jh; + real_T BitfromLabel2_bit_p; + real_T BitfromLabel1_bit_g3; + real_T BitfromLabel2_bit_is; + real_T BitfromLabel_bit_cq; + real_T BitfromLabel2_bit_p5; + real_T BitfromLabel1_bit_mi; + real_T BitfromLabel2_bit_j; + real_T BitfromLabel1_bit_nv; + real_T BitfromLabel2_bit_i1; + real_T BitfromLabel4_bit_d; + real_T BitfromLabel1_bit_b; + real_T BitfromLabel2_bit_kr; + real_T BitfromLabel4_bit_i; + real_T BitfromLabel_bit_b; + real_T BitfromLabel2_bit_n0; + real_T BitfromLabel3_bit_d; + real_T BitfromLabel2_bit_nl; + real_T BitfromLabel3_bit_g; + real_T BitfromLabel1_bit_aw; + real_T BitfromLabel3_bit_gv; + real_T BitfromLabel_bit_kq; + real_T BitfromLabel2_bit_ie; + real_T BitfromLabel_bit_i; + real_T BitfromLabel1_bit_i5; + real_T BitfromLabel2_bit_o; + real_T BitfromLabel3_bit_l; + real_T BitfromLabel4_bit_f; + real_T BitfromLabel1_bit_d; + real_T BitfromLabel3_bit_j; + real_T BitfromLabel4_bit_o; + real_T BitfromLabel5_bit; + real_T BitfromLabel6_bit; + real_T CompareToConstant_const; + real_T CompareToConstant1_const; + real_T CompareToConstant1_const_k; + real_T CompareToConstant2_const; + real_T CompareToConstant3_const; + real_T CompareToConstant4_const; + real_T CompareToConstant5_const; + real_T CompareToConstant6_const; + real_T CompareToConstant2_const_b; + real_T CompareToConstant1_const_i; + real_T CompareToConstant_const_l; + real_T CompareToConstant_const_g; + real_T CompareToConstant_const_d; + real_T CompareToConstant3_const_i; + real_T CompareToConstant5_const_k; + real_T CompareToConstant_const_a; + real_T CompareToConstant_const_o; + real_T CompareToConstant_const_m; + real_T CompareToConstant1_const_b; + real_T CompareToConstant2_const_n; + real_T CompareToConstant1_const_n; + real_T CompareToConstant1_const_h; + real_T CompareToConstant_const_mh; + real_T CompareToConstant2_const_j; + real_T CompareToConstant_const_l5; + real_T CompareToConstant_const_f; + real_T CompareToConstant1_const_o; + real_T CompareToConstant2_const_g; + real_T CompareToConstant1_const_n2; + real_T CompareToConstant2_const_i; + real_T CompareToConstant2_const_h; + real_T CompareToConstant_const_c; + real_T CompareToConstant_const_e; + real_T CompareToConstant1_const_m; + real_T CompareToConstant_const_ce; + real_T MTrigNode_isRisingEdge; + real_T MTrigNode_isRisingEdge_j; + real_T MTrigNode_isRisingEdge_g; + real_T MTrigNode_isRisingEdge_k; + real_T MTrigNode_retriggerable; + real_T MTrigNode_retriggerable_p; + real_T MTrigNode_retriggerable_f; + real_T MTrigNode_retriggerable_pd; + real_T ConfirmNode1_timeDelay; + real_T ConfirmNode_timeDelay; + real_T ConfirmNode1_timeDelay_l; + real_T ConfirmNode_timeDelay_i; + real_T ConfirmNode_timeDelay_h; + real_T ConfirmNode_timeDelay_o; + real_T ConfirmNode_timeDelay_f; + real_T ConfirmNode_timeDelay_j; + real_T ConfirmNode_timeDelay_d; + real_T ConfirmNode_timeDelay_l; + real_T ConfirmNode1_timeDelay_d; + real_T ConfirmNode_timeDelay_a; + real_T ConfirmNode2_timeDelay; + real_T ConfirmNode_timeDelay_j5; + real_T ConfirmNode_timeDelay_a3; + real_T ConfirmNode_timeDelay_dw; + real_T ConfirmNode_timeDelay_a2; + real_T ConfirmNode_timeDelay_d1; + real_T ConfirmNode_timeDelay_g; + real_T ConfirmNode_timeDelay_h4; + real_T ConfirmNode_timeDelay_e; + real_T ConfirmNode_timeDelay_es; + real_T ConfirmNode_timeDelay_lk; + real_T ConfirmNode_timeDelay_at; + real_T ConfirmNode_timeDelay_b; + real_T ConfirmNode_timeDelay_ll; + real_T ConfirmNode_timeDelay_n; + real_T ConfirmNode_timeDelay_dy; + real_T ConfirmNode_timeDelay_ib; + real_T ConfirmNode_timeDelay_ob; + real_T ConfirmNode_timeDelay_a3g; + real_T ConfirmNode_timeDelay_m; + real_T ConfirmNode_timeDelay_mu; + real_T ConfirmNode_timeDelay_ht; + real_T ConfirmNode_timeDelay_gz; + real_T MTrigNode_triggerDuration; + real_T MTrigNode_triggerDuration_n; + real_T MTrigNode_triggerDuration_b; + real_T MTrigNode_triggerDuration_bh; + SignStatusMatrix EnumeratedConstant1_Value; + SignStatusMatrix EnumeratedConstant_Value; + SignStatusMatrix EnumeratedConstant1_Value_d; + fmgc_flight_phase EnumeratedConstant_Value_a; + fmgc_flight_phase EnumeratedConstant1_Value_dg; + fmgc_flight_phase EnumeratedConstant_Value_p; + fmgc_flight_phase EnumeratedConstant1_Value_m; + fmgc_flight_phase EnumeratedConstant2_Value; + fmgc_flight_phase EnumeratedConstant_Value_pq; + fmgc_flight_phase EnumeratedConstant1_Value_i; + fmgc_flight_phase EnumeratedConstant_Value_m; + fmgc_flight_phase EnumeratedConstant1_Value_k; + fmgc_flight_phase EnumeratedConstant2_Value_p; + fmgc_flight_phase EnumeratedConstant_Value_c; + fmgc_flight_phase EnumeratedConstant1_Value_c; + fmgc_flight_phase EnumeratedConstant_Value_ad; + real32_T A429ValueOrDefault_defaultValue; + real32_T A429ValueOrDefault1_defaultValue; + real32_T A429ValueOrDefault_defaultValue_n; + real32_T A429ValueOrDefault1_defaultValue_p; + real32_T A429ValueOrDefault_defaultValue_l; + real32_T A429ValueOrDefault1_defaultValue_b; + real32_T A429ValueOrDefault1_defaultValue_m; + real32_T A429ValueOrDefault_defaultValue_e; + real32_T A429ValueOrDefault_defaultValue_ek; + real32_T A429ValueOrDefault1_defaultValue_f; + real32_T A429ValueOrDefault2_defaultValue; + real32_T A429ValueOrDefault3_defaultValue; + real32_T A429ValueOrDefault_defaultValue_p; + real32_T A429ValueOrDefault1_defaultValue_d; + real32_T A429ValueOrDefault_defaultValue_o; + real32_T A429ValueOrDefault_defaultValue_b; + real32_T A429ValueOrDefault_defaultValue_pm; + real32_T A429ValueOrDefault1_defaultValue_j; + real32_T A429ValueOrDefault2_defaultValue_j; + real32_T A429ValueOrDefault_defaultValue_a; + real32_T A429ValueOrDefault_defaultValue_m; + real32_T A429ValueOrDefault_defaultValue_h; + real32_T A429ValueOrDefault_defaultValue_mo; + real32_T A429ValueOrDefault_defaultValue_ht; + real32_T A429ValueOrDefault_defaultValue_i; + real32_T A429ValueOrDefault_defaultValue_g; + real32_T A429ValueOrDefault_defaultValue_k; + boolean_T SRFlipFlop1_initial_condition; + boolean_T SRFlipFlop_initial_condition; + boolean_T SRFlipFlop1_initial_condition_n; + boolean_T SRFlipFlop_initial_condition_b; + boolean_T SRFlipFlop_initial_condition_h; + boolean_T SRFlipFlop_initial_condition_i; + boolean_T SRFlipFlop_initial_condition_c; + boolean_T SRFlipFlop_initial_condition_d; + boolean_T SRFlipFlop_initial_condition_iz; + boolean_T SRFlipFlop_initial_condition_l; + boolean_T SRFlipFlop_initial_condition_j; + boolean_T SRFlipFlop_initial_condition_h5; + boolean_T SRFlipFlop_initial_condition_e; + boolean_T SRFlipFlop_initial_condition_cs; + boolean_T SRFlipFlop_initial_condition_o; + boolean_T SRFlipFlop_initial_condition_g; + boolean_T SRFlipFlop_initial_condition_n; + boolean_T SRFlipFlop_initial_condition_of; + boolean_T SRFlipFlop_initial_condition_on; + boolean_T SRFlipFlop1_initial_condition_b; + boolean_T SRFlipFlop_initial_condition_ja; + boolean_T SRFlipFlop_initial_condition_li; + boolean_T SRFlipFlop1_initial_condition_i; + boolean_T SRFlipFlop_initial_condition_be; + boolean_T SRFlipFlop_initial_condition_jv; + boolean_T SRFlipFlop_initial_condition_p; + boolean_T SRFlipFlop_initial_condition_lz; + boolean_T SRFlipFlop_initial_condition_oz; + boolean_T SRFlipFlop_initial_condition_pr; + boolean_T SRFlipFlop_initial_condition_ce; + boolean_T SRFlipFlop_initial_condition_hs; + boolean_T SRFlipFlop_initial_condition_dp; + boolean_T SRFlipFlop1_initial_condition_o; + boolean_T SRFlipFlop_initial_condition_n1; + boolean_T PulseNode_isRisingEdge; + boolean_T ConfirmNode1_isRisingEdge; + boolean_T PulseNode2_isRisingEdge; + boolean_T PulseNode1_isRisingEdge; + boolean_T ConfirmNode_isRisingEdge; + boolean_T ConfirmNode1_isRisingEdge_n; + boolean_T PulseNode_isRisingEdge_k; + boolean_T PulseNode1_isRisingEdge_m; + boolean_T PulseNode2_isRisingEdge_n; + boolean_T ConfirmNode_isRisingEdge_h; + boolean_T PulseNode_isRisingEdge_p; + boolean_T ConfirmNode_isRisingEdge_c; + boolean_T ConfirmNode_isRisingEdge_p; + boolean_T ConfirmNode_isRisingEdge_l; + boolean_T ConfirmNode_isRisingEdge_hu; + boolean_T PulseNode_isRisingEdge_l; + boolean_T ConfirmNode_isRisingEdge_f; + boolean_T PulseNode2_isRisingEdge_e; + boolean_T PulseNode3_isRisingEdge; + boolean_T PulseNode1_isRisingEdge_c; + boolean_T ConfirmNode_isRisingEdge_e; + boolean_T ConfirmNode1_isRisingEdge_g; + boolean_T ConfirmNode_isRisingEdge_d; + boolean_T PulseNode_isRisingEdge_a; + boolean_T ConfirmNode2_isRisingEdge; + boolean_T PulseNode_isRisingEdge_h; + boolean_T ConfirmNode_isRisingEdge_m; + boolean_T PulseNode_isRisingEdge_c; + boolean_T ConfirmNode_isRisingEdge_hj; + boolean_T PulseNode_isRisingEdge_f; + boolean_T ConfirmNode_isRisingEdge_mf; + boolean_T PulseNode_isRisingEdge_i; + boolean_T PulseNode1_isRisingEdge_e; + boolean_T PulseNode3_isRisingEdge_l; + boolean_T PulseNode2_isRisingEdge_b; + boolean_T ConfirmNode_isRisingEdge_a; + boolean_T PulseNode_isRisingEdge_j; + boolean_T PulseNode3_isRisingEdge_e; + boolean_T PulseNode2_isRisingEdge_i; + boolean_T PulseNode1_isRisingEdge_k; + boolean_T ConfirmNode_isRisingEdge_co; + boolean_T PulseNode1_isRisingEdge_cs; + boolean_T PulseNode2_isRisingEdge_o; + boolean_T ConfirmNode_isRisingEdge_n; + boolean_T PulseNode_isRisingEdge_g; + boolean_T ConfirmNode_isRisingEdge_at; + boolean_T ConfirmNode_isRisingEdge_nd; + boolean_T ConfirmNode_isRisingEdge_ea; + boolean_T ConfirmNode_isRisingEdge_hux; + boolean_T ConfirmNode_isRisingEdge_nf; + boolean_T ConfirmNode_isRisingEdge_lj; + boolean_T PulseNode_isRisingEdge_d; + boolean_T PulseNode1_isRisingEdge_ky; + boolean_T PulseNode2_isRisingEdge_bh; + boolean_T PulseNode3_isRisingEdge_n; + boolean_T ConfirmNode_isRisingEdge_lu; + boolean_T PulseNode_isRisingEdge_b; + boolean_T PulseNode3_isRisingEdge_d; + boolean_T ConfirmNode_isRisingEdge_fc; + boolean_T PulseNode_isRisingEdge_o; + boolean_T PulseNode3_isRisingEdge_j; + boolean_T ConfirmNode_isRisingEdge_j; + boolean_T PulseNode_isRisingEdge_n; + boolean_T ConfirmNode_isRisingEdge_ca; + boolean_T PulseNode_isRisingEdge_fw; + boolean_T ConfirmNode_isRisingEdge_ep; + boolean_T PulseNode1_isRisingEdge_b; + boolean_T PulseNode_isRisingEdge_lz; + boolean_T ConfirmNode_isRisingEdge_g; + boolean_T ConfirmNode_isRisingEdge_gr; + boolean_T ConfirmNode_isRisingEdge_o; + boolean_T PulseNode1_isRisingEdge_kl; + boolean_T PulseNode2_isRisingEdge_f; + boolean_T ConfirmNode_isRisingEdge_ch; + boolean_T PulseNode1_isRisingEdge_n; + boolean_T PulseNode2_isRisingEdge_iu; + boolean_T PulseNode3_isRisingEdge_i; + boolean_T PulseNode_isRisingEdge_jp; + boolean_T PulseNode4_isRisingEdge; + boolean_T ConfirmNode_isRisingEdge_h2; + int8_T CompareToConstant_const_b; + int8_T CompareToConstant_const_cq; + int8_T CompareToConstant_const_j; + fmgc_outputs out_Y0; + base_fmgc_bus_outputs Constant4_Value; + base_fmgc_logic_outputs Constant1_Value; + base_fmgc_ap_fd_logic_outputs Delay_InitialCondition; + real32_T Constant17_Value; + real32_T Constant18_Value; + real32_T Constant19_Value; + real32_T Constant20_Value; + real32_T Constant16_Value; + real32_T Constant1_Value_g; + real32_T Constant2_Value; + real32_T Constant22_Value; + real32_T Constant26_Value; + real32_T Constant27_Value; + real32_T Constant28_Value; + real32_T Constant11_Value; + real32_T Constant12_Value; + real32_T Constant13_Value; + real32_T Constant14_Value; + real32_T Constant15_Value; + real32_T Constant32_Value; + real32_T Constant1_Value_k; + real32_T Constant11_Value_m; + real32_T Constant2_Value_n; + boolean_T Delay_InitialCondition_g; + boolean_T Logic_table[16]; + boolean_T Logic_table_h[16]; + boolean_T Constant_Value; + boolean_T Logic_table_f[16]; + boolean_T Delay_InitialCondition_gu; + boolean_T Logic_table_n[16]; + boolean_T Logic_table_b[16]; + boolean_T Constant_Value_j; + boolean_T Logic_table_hz[16]; + boolean_T Logic_table_d[16]; + boolean_T Constant_Value_l; + boolean_T Constant2_Value_p; + boolean_T Logic_table_k[16]; + boolean_T Logic_table_p[16]; + boolean_T Logic_table_c[16]; + boolean_T Logic_table_pl[16]; + boolean_T Logic_table_o[16]; + boolean_T Logic_table_c2[16]; + boolean_T Logic_table_i[16]; + boolean_T Logic_table_g[16]; + boolean_T Logic_table_a[16]; + boolean_T Logic_table_ku[16]; + boolean_T Constant_Value_d; + boolean_T Logic_table_g4[16]; + boolean_T Logic_table_j[16]; + boolean_T Logic_table_pk[16]; + boolean_T Logic_table_nz[16]; + boolean_T Logic_table_ob[16]; + boolean_T Logic_table_ny[16]; + boolean_T Logic_table_ns[16]; + boolean_T Logic_table_kw[16]; + boolean_T Logic_table_he[16]; + boolean_T Logic_table_cv[16]; + boolean_T Logic_table_jq[16]; + boolean_T Logic_table_l[16]; + boolean_T Logic_table_dr[16]; + boolean_T Logic_table_d3[16]; + boolean_T Logic_table_fi[16]; + boolean_T Logic_table_kg[16]; + boolean_T Logic_table_ds[16]; + boolean_T Constant_Value_m; + boolean_T Constant1_Value_i; + boolean_T Constant10_Value; + boolean_T Constant3_Value; + boolean_T Constant4_Value_g; + boolean_T Constant5_Value; + boolean_T Constant6_Value; + boolean_T Constant7_Value; + boolean_T Constant8_Value; + boolean_T Constant9_Value; + int8_T Constant_Value_o; + }; + + FmgcComputer(FmgcComputer const&) = delete; + FmgcComputer& operator= (FmgcComputer const&) & = delete; + FmgcComputer(FmgcComputer &&) = delete; + FmgcComputer& operator= (FmgcComputer &&) = delete; + void setExternalInputs(const ExternalInputs_FmgcComputer_T *pExternalInputs_FmgcComputer_T) + { + FmgcComputer_U = *pExternalInputs_FmgcComputer_T; + } + + const ExternalOutputs_FmgcComputer_T &getExternalOutputs() const + { + return FmgcComputer_Y; + } + + void initialize(); + void step(); + static void terminate(); + FmgcComputer(); + ~FmgcComputer(); + private: + ExternalInputs_FmgcComputer_T FmgcComputer_U; + ExternalOutputs_FmgcComputer_T FmgcComputer_Y; + D_Work_FmgcComputer_T FmgcComputer_DWork; + static Parameters_FmgcComputer_T FmgcComputer_P; + static void FmgcComputer_MATLABFunction_Reset(rtDW_MATLABFunction_FmgcComputer_T *localDW); + static void FmgcComputer_MATLABFunction(boolean_T rtu_u, real_T rtu_Ts, boolean_T rtu_isRisingEdge, real_T + rtu_timeDelay, boolean_T *rty_y, rtDW_MATLABFunction_FmgcComputer_T *localDW); + static void FmgcComputer_MATLABFunction_m_Reset(rtDW_MATLABFunction_FmgcComputer_e_T *localDW); + static void FmgcComputer_MATLABFunction_i(boolean_T rtu_u, boolean_T rtu_isRisingEdge, boolean_T *rty_y, + rtDW_MATLABFunction_FmgcComputer_e_T *localDW); + static void FmgcComputer_MATLABFunction_j(const base_arinc_429 *rtu_u, real32_T rtu_default, real32_T *rty_y); + static void FmgcComputer_MATLABFunction_f(const base_arinc_429 *rtu_u, boolean_T *rty_y); + static void FmgcComputer_MATLABFunction_k(const base_arinc_429 *rtu_u, real_T rtu_bit, uint32_T *rty_y); + static void FmgcComputer_MATLABFunction_g(const base_arinc_429 *rtu_u, boolean_T *rty_y); + static void FmgcComputer_MATLABFunction_pz_Reset(rtDW_MATLABFunction_FmgcComputer_ll_T *localDW); + static void FmgcComputer_MATLABFunction_d(boolean_T rtu_u, real_T rtu_Ts, boolean_T *rty_y, real_T rtp_isRisingEdge, + real_T rtp_retriggerable, real_T rtp_triggerDuration, rtDW_MATLABFunction_FmgcComputer_ll_T *localDW); + static void FmgcComputer_MATLABFunction_gy(const boolean_T rtu_u[19], real32_T *rty_y); +}; + +#endif + diff --git a/fbw-a32nx/src/wasm/fbw_a320/src/model/FmgcComputer_data.cpp b/fbw-a32nx/src/wasm/fbw_a320/src/model/FmgcComputer_data.cpp new file mode 100644 index 000000000000..09df4d8007af --- /dev/null +++ b/fbw-a32nx/src/wasm/fbw_a320/src/model/FmgcComputer_data.cpp @@ -0,0 +1,3326 @@ +#include "FmgcComputer.h" + +FmgcComputer::Parameters_FmgcComputer_T FmgcComputer::FmgcComputer_P{ + + { + { + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + }, + + { + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + }, + + { + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + }, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + }, + + + { + false, + false, + false, + false, + false, + false + }, + + 18.0, + + 19.0, + + 17.0, + + 22.0, + + 26.0, + + 27.0, + + 15.0, + + 11.0, + + 20.0, + + 11.0, + + 23.0, + + 20.0, + + 23.0, + + 13.0, + + 14.0, + + 23.0, + + 23.0, + + 23.0, + + 23.0, + + 16.0, + + 15.0, + + 16.0, + + 17.0, + + 12.0, + + 13.0, + + 24.0, + + 14.0, + + 11.0, + + 12.0, + + 12.0, + + 16.0, + + 13.0, + + 13.0, + + 14.0, + + 13.0, + + 12.0, + + 19.0, + + 21.0, + + 13.0, + + 19.0, + + 20.0, + + 17.0, + + 18.0, + + 19.0, + + 24.0, + + 24.0, + + 11.0, + + 11.0, + + 14.0, + + 25.0, + + 11.0, + + 12.0, + + 14.0, + + 11.0, + + 14.0, + + 18.0, + + 12.0, + + 14.0, + + 18.0, + + 22.0, + + 21.0, + + 22.0, + + 20.0, + + 22.0, + + 20.0, + + 12.0, + + 19.0, + + 11.0, + + 20.0, + + 14.0, + + 16.0, + + 17.0, + + 18.0, + + 11.0, + + 12.0, + + 13.0, + + 14.0, + + 15.0, + + 2.6, + + 2.6, + + 0.0, + + 0.0, + + 36.7, + + 33.3, + + 36.7, + + 33.3, + + 20.0, + + 0.4, + + 30.0, + + 400.0, + + 400.0, + + 36.7, + + 36.7, + + 100.0, + + 30.0, + + 400.0, + + 1.92, + + 1.1, + + 0.16, + + 250.0, + + 40.0, + + 0.0, + + 400.0, + + 40.0, + + 0.0, + + 0.0, + + 0.8, + + 0.133, + + 0.133, + + 30.0, + + 0.0, + + 0.0, + + 0.0, + + 1.0, + + 1.0, + + 1.0, + + 1.0, + + 0.0, + + 0.0, + + 0.0, + + 1.0, + + 5.0, + + 0.2, + + 15.0, + + 30.0, + + 0.72, + + 30.0, + + 0.72, + + 0.72, + + 0.45, + + 0.72, + + 1.2, + + 0.72, + + 10.0, + + 30.0, + + 0.72, + + 0.72, + + 0.72, + + 0.72, + + 0.72, + + 0.72, + + 10.0, + + 0.72, + + 0.72, + + 0.8, + + 0.72, + + 0.72, + + 0.72, + + 0.72, + + 0.72, + + 0.72, + + 0.72, + + 15.0, + + 0.72, + + 0.72, + + 0.72, + + 0.9, + + 0.9, + + 0.72, + + 3.0, + + SignStatusMatrix::NormalOperation, + + SignStatusMatrix::NoComputedData, + + SignStatusMatrix::NormalOperation, + + fmgc_flight_phase::Takeoff, + + fmgc_flight_phase::Goaround, + + fmgc_flight_phase::Takeoff, + + fmgc_flight_phase::Climb, + + fmgc_flight_phase::Goaround, + + fmgc_flight_phase::Descent, + + fmgc_flight_phase::Approach, + + fmgc_flight_phase::Takeoff, + + fmgc_flight_phase::Climb, + + fmgc_flight_phase::Goaround, + + fmgc_flight_phase::Descent, + + fmgc_flight_phase::Approach, + + fmgc_flight_phase::Approach, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + false, + + false, + + false, + + false, + + false, + + false, + + false, + + false, + + false, + + false, + + false, + + false, + + false, + + false, + + false, + + false, + + false, + + false, + + false, + + true, + + false, + + false, + + false, + + false, + + false, + + false, + + false, + + false, + + false, + + false, + + false, + + false, + + false, + + false, + + true, + + true, + + true, + + true, + + false, + + true, + + true, + + true, + + true, + + true, + + true, + + false, + + true, + + false, + + false, + + true, + + true, + + true, + + true, + + true, + + true, + + true, + + false, + + true, + + true, + + true, + + true, + + true, + + false, + + true, + + false, + + true, + + true, + + false, + + true, + + false, + + true, + + true, + + true, + + true, + + false, + + true, + + true, + + false, + + false, + + false, + + true, + + false, + + false, + + true, + + false, + + true, + + true, + + true, + + false, + + false, + + true, + + true, + + false, + + true, + + true, + + false, + + true, + + false, + + true, + + false, + + true, + + false, + + false, + + true, + + false, + + false, + + true, + + false, + + true, + + true, + + true, + + true, + + true, + + false, + + 1, + + 1, + + 1, + + + { + { + { + 0.0, + 0.0, + 0.0 + }, + + { + false, + false, + false, + false, + false + }, + + { + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + }, + + { + false, + fmgc_flight_phase::Preflight, + fmgc_approach_type::None, + 0.0, + 0.0, + 0.0, + false, + false, + 0.0, + 0.0, + 0.0, + 0.0, + false, + false, + false, + 0.0, + fmgc_des_submode::None, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + }, + + { + { + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + } + }, + + { + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + } + }, + + { + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + } + }, + + { + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + } + }, + + { + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + } + }, + + { + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + } + }, + + { + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + } + }, + + { + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + } + }, + + { + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + } + }, + + { + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + } + }, + + { + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + } + }, + + { + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + } + }, + + { + { + 0U, + 0.0F + } + }, + + { + { + 0U, + 0.0F + } + }, + + { + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + } + }, + + { + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + } + }, + + { + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + } + }, + + { + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + } + } + } + }, + + { + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + + { + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + }, + + { + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + }, + 0.0, + false, + false, + false, + false, + 0.0F, + 0.0F, + 0, + false, + false, + false, + false, + false, + + { + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + } + } + }, + + { + { + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + }, + + { + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + }, + + { + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + }, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + }, + + { + false, + false, + false, + false, + false, + false + }, + + { + { + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + } + }, + + { + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + } + } + } + }, + + + { + { + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + } + }, + + { + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + } + } + }, + + + { + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + + { + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + }, + + { + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + }, + 0.0, + false, + false, + false, + false, + 0.0F, + 0.0F, + 0, + false, + false, + false, + false, + false, + + { + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + }, + + { + 0U, + 0.0F + } + } + }, + + + { + { + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + }, + + { + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + }, + + { + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + }, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + }, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + 0.0F, + + false, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + false, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + false, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + true, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + true, + + false, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + true, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + + { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }, + + false, + + true, + + false, + + false, + + false, + + false, + + false, + + false, + + false, + + false, + + 1 +}; diff --git a/fbw-a32nx/src/wasm/fbw_a320/src/model/FmgcComputer_private.h b/fbw-a32nx/src/wasm/fbw_a320/src/model/FmgcComputer_private.h new file mode 100644 index 000000000000..8e80e5f1d2d4 --- /dev/null +++ b/fbw-a32nx/src/wasm/fbw_a320/src/model/FmgcComputer_private.h @@ -0,0 +1,5 @@ +#ifndef RTW_HEADER_FmgcComputer_private_h_ +#define RTW_HEADER_FmgcComputer_private_h_ +#include "rtwtypes.h" +#endif + diff --git a/fbw-a32nx/src/wasm/fbw_a320/src/model/FmgcComputer_types.h b/fbw-a32nx/src/wasm/fbw_a320/src/model/FmgcComputer_types.h new file mode 100644 index 000000000000..4f2e207a06ce --- /dev/null +++ b/fbw-a32nx/src/wasm/fbw_a320/src/model/FmgcComputer_types.h @@ -0,0 +1,842 @@ +#ifndef RTW_HEADER_FmgcComputer_types_h_ +#define RTW_HEADER_FmgcComputer_types_h_ +#include "rtwtypes.h" + +#ifndef DEFINED_TYPEDEF_FOR_fmgc_flight_phase_ +#define DEFINED_TYPEDEF_FOR_fmgc_flight_phase_ + +enum class fmgc_flight_phase + : int32_T { + Preflight = 0, + Takeoff, + Climb, + Cruise, + Descent, + Approach, + Goaround, + Done +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_SignStatusMatrix_ +#define DEFINED_TYPEDEF_FOR_SignStatusMatrix_ + +enum class SignStatusMatrix + : int32_T { + FailureWarning = 0, + NoComputedData, + FunctionalTest, + NormalOperation +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_arinc_429_ +#define DEFINED_TYPEDEF_FOR_base_arinc_429_ + +struct base_arinc_429 +{ + uint32_T SSM; + real32_T Data; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_ecu_bus_ +#define DEFINED_TYPEDEF_FOR_base_ecu_bus_ + +struct base_ecu_bus +{ + base_arinc_429 selected_tla_deg; + base_arinc_429 selected_flex_temp_deg; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_ils_bus_ +#define DEFINED_TYPEDEF_FOR_base_ils_bus_ + +struct base_ils_bus +{ + base_arinc_429 runway_heading_deg; + base_arinc_429 ils_frequency_mhz; + base_arinc_429 localizer_deviation_deg; + base_arinc_429 glideslope_deviation_deg; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_fmgc_approach_type_ +#define DEFINED_TYPEDEF_FOR_fmgc_approach_type_ + +enum class fmgc_approach_type + : int32_T { + None = 0 +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_fmgc_des_submode_ +#define DEFINED_TYPEDEF_FOR_fmgc_des_submode_ + +enum class fmgc_des_submode + : int32_T { + None = 0, + SPEED_THRUST, + VPATH_THRUST, + VPATH_SPEED, + FPA_SPEED, + VS_SPEED +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_fms_inputs_ +#define DEFINED_TYPEDEF_FOR_base_fms_inputs_ + +struct base_fms_inputs +{ + boolean_T fm_valid; + fmgc_flight_phase fms_flight_phase; + fmgc_approach_type selected_approach_type; + real_T fms_loc_distance; + real_T fms_weight_lbs; + real_T fms_cg_percent; + boolean_T lateral_flight_plan_valid; + boolean_T nav_capture_condition; + real_T phi_c_deg; + real_T xtk_nmi; + real_T tke_deg; + real_T phi_limit_deg; + boolean_T direct_to_nav_engage; + boolean_T vertical_flight_plan_valid; + boolean_T final_app_can_engage; + real_T next_alt_cstr_ft; + fmgc_des_submode requested_des_submode; + real_T alt_profile_tgt_ft; + real_T vs_target_ft_min; + real_T v_2_kts; + real_T v_app_kts; + real_T v_managed_kts; + real_T flex_temp_deg_c; + real_T acceleration_alt_ft; + real_T acceleration_alt_eo_ft; + real_T thrust_reduction_alt_ft; + real_T cruise_alt_ft; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_time_ +#define DEFINED_TYPEDEF_FOR_base_time_ + +struct base_time +{ + real_T dt; + real_T simulation_time; + real_T monotonic_time; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_sim_data_ +#define DEFINED_TYPEDEF_FOR_base_sim_data_ + +struct base_sim_data +{ + boolean_T slew_on; + boolean_T pause_on; + boolean_T tracking_mode_on_override; + boolean_T tailstrike_protection_on; + boolean_T computer_running; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_fmgc_discrete_inputs_ +#define DEFINED_TYPEDEF_FOR_base_fmgc_discrete_inputs_ + +struct base_fmgc_discrete_inputs +{ + boolean_T is_unit_1; + boolean_T athr_opp_engaged; + boolean_T fcu_athr_button; + boolean_T athr_instinctive_disc; + boolean_T fd_opp_engaged; + boolean_T ap_opp_engaged; + boolean_T fcu_ap_button; + boolean_T ap_instinctive_disc; + boolean_T powersupply_split; + boolean_T fcu_opp_healthy; + boolean_T fcu_own_healthy; + boolean_T fac_opp_healthy; + boolean_T fac_own_healthy; + boolean_T fmgc_opp_healthy; + boolean_T mcdu_opp_fail; + boolean_T mcdu_own_fail; + boolean_T nav_control_opp; + boolean_T nav_control_own; + boolean_T fwc_opp_valid; + boolean_T fwc_own_valid; + boolean_T pfd_opp_valid; + boolean_T pfd_own_valid; + boolean_T adc_3_switch; + boolean_T att_3_switch; + boolean_T left_wheel_spd_abv_70_kts; + boolean_T right_wheel_spd_abv_70_kts; + boolean_T bscu_opp_valid; + boolean_T bscu_own_valid; + boolean_T nose_gear_pressed_opp; + boolean_T nose_gear_pressed_own; + boolean_T elac_opp_ap_disc; + boolean_T elac_own_ap_disc; + boolean_T eng_opp_stop; + boolean_T eng_own_stop; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_fac_bus_ +#define DEFINED_TYPEDEF_FOR_base_fac_bus_ + +struct base_fac_bus +{ + base_arinc_429 discrete_word_1; + base_arinc_429 gamma_a_deg; + base_arinc_429 gamma_t_deg; + base_arinc_429 total_weight_lbs; + base_arinc_429 center_of_gravity_pos_percent; + base_arinc_429 sideslip_target_deg; + base_arinc_429 fac_slat_angle_deg; + base_arinc_429 fac_flap_angle; + base_arinc_429 discrete_word_2; + base_arinc_429 rudder_travel_limit_command_deg; + base_arinc_429 delta_r_yaw_damper_deg; + base_arinc_429 estimated_sideslip_deg; + base_arinc_429 v_alpha_lim_kn; + base_arinc_429 v_ls_kn; + base_arinc_429 v_stall_kn; + base_arinc_429 v_alpha_prot_kn; + base_arinc_429 v_stall_warn_kn; + base_arinc_429 speed_trend_kn; + base_arinc_429 v_3_kn; + base_arinc_429 v_4_kn; + base_arinc_429 v_man_kn; + base_arinc_429 v_max_kn; + base_arinc_429 v_fe_next_kn; + base_arinc_429 discrete_word_3; + base_arinc_429 discrete_word_4; + base_arinc_429 discrete_word_5; + base_arinc_429 delta_r_rudder_trim_deg; + base_arinc_429 rudder_trim_pos_deg; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_adr_bus_ +#define DEFINED_TYPEDEF_FOR_base_adr_bus_ + +struct base_adr_bus +{ + base_arinc_429 altitude_standard_ft; + base_arinc_429 altitude_corrected_ft; + base_arinc_429 mach; + base_arinc_429 airspeed_computed_kn; + base_arinc_429 airspeed_true_kn; + base_arinc_429 vertical_speed_ft_min; + base_arinc_429 aoa_corrected_deg; + base_arinc_429 corrected_average_static_pressure; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_ir_bus_ +#define DEFINED_TYPEDEF_FOR_base_ir_bus_ + +struct base_ir_bus +{ + base_arinc_429 discrete_word_1; + base_arinc_429 latitude_deg; + base_arinc_429 longitude_deg; + base_arinc_429 ground_speed_kn; + base_arinc_429 track_angle_true_deg; + base_arinc_429 heading_true_deg; + base_arinc_429 wind_speed_kn; + base_arinc_429 wind_direction_true_deg; + base_arinc_429 track_angle_magnetic_deg; + base_arinc_429 heading_magnetic_deg; + base_arinc_429 drift_angle_deg; + base_arinc_429 flight_path_angle_deg; + base_arinc_429 flight_path_accel_g; + base_arinc_429 pitch_angle_deg; + base_arinc_429 roll_angle_deg; + base_arinc_429 body_pitch_rate_deg_s; + base_arinc_429 body_roll_rate_deg_s; + base_arinc_429 body_yaw_rate_deg_s; + base_arinc_429 body_long_accel_g; + base_arinc_429 body_lat_accel_g; + base_arinc_429 body_normal_accel_g; + base_arinc_429 track_angle_rate_deg_s; + base_arinc_429 pitch_att_rate_deg_s; + base_arinc_429 roll_att_rate_deg_s; + base_arinc_429 inertial_alt_ft; + base_arinc_429 along_track_horiz_acc_g; + base_arinc_429 cross_track_horiz_acc_g; + base_arinc_429 vertical_accel_g; + base_arinc_429 inertial_vertical_speed_ft_s; + base_arinc_429 north_south_velocity_kn; + base_arinc_429 east_west_velocity_kn; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_fcdc_bus_ +#define DEFINED_TYPEDEF_FOR_base_fcdc_bus_ + +struct base_fcdc_bus +{ + base_arinc_429 efcs_status_word_1; + base_arinc_429 efcs_status_word_2; + base_arinc_429 efcs_status_word_3; + base_arinc_429 efcs_status_word_4; + base_arinc_429 efcs_status_word_5; + base_arinc_429 capt_roll_command_deg; + base_arinc_429 fo_roll_command_deg; + base_arinc_429 rudder_pedal_position_deg; + base_arinc_429 capt_pitch_command_deg; + base_arinc_429 fo_pitch_command_deg; + base_arinc_429 aileron_left_pos_deg; + base_arinc_429 elevator_left_pos_deg; + base_arinc_429 aileron_right_pos_deg; + base_arinc_429 elevator_right_pos_deg; + base_arinc_429 horiz_stab_trim_pos_deg; + base_arinc_429 spoiler_1_left_pos_deg; + base_arinc_429 spoiler_2_left_pos_deg; + base_arinc_429 spoiler_3_left_pos_deg; + base_arinc_429 spoiler_4_left_pos_deg; + base_arinc_429 spoiler_5_left_pos_deg; + base_arinc_429 spoiler_1_right_pos_deg; + base_arinc_429 spoiler_2_right_pos_deg; + base_arinc_429 spoiler_3_right_pos_deg; + base_arinc_429 spoiler_4_right_pos_deg; + base_arinc_429 spoiler_5_right_pos_deg; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_ra_bus_ +#define DEFINED_TYPEDEF_FOR_base_ra_bus_ + +struct base_ra_bus +{ + base_arinc_429 radio_height_ft; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_fmgc_a_bus_ +#define DEFINED_TYPEDEF_FOR_base_fmgc_a_bus_ + +struct base_fmgc_a_bus +{ + base_arinc_429 pfd_sel_spd_kts; + base_arinc_429 runway_hdg_memorized_deg; + base_arinc_429 preset_mach_from_mcdu; + base_arinc_429 preset_speed_from_mcdu_kts; + base_arinc_429 roll_fd_command; + base_arinc_429 pitch_fd_command; + base_arinc_429 yaw_fd_command; + base_arinc_429 discrete_word_5; + base_arinc_429 discrete_word_4; + base_arinc_429 fm_alt_constraint_ft; + base_arinc_429 altitude_ft; + base_arinc_429 mach; + base_arinc_429 cas_kts; + base_arinc_429 flx_to_temp_deg_c; + base_arinc_429 ats_discrete_word; + base_arinc_429 ats_fma_discrete_word; + base_arinc_429 discrete_word_3; + base_arinc_429 discrete_word_1; + base_arinc_429 discrete_word_2; + base_arinc_429 discrete_word_6; + base_arinc_429 synchro_spd_mach_value; + base_arinc_429 low_target_speed_margin_kts; + base_arinc_429 high_target_speed_margin_kts; + base_arinc_429 delta_p_ail_voted_cmd_deg; + base_arinc_429 delta_p_splr_voted_cmd_deg; + base_arinc_429 delta_r_voted_cmd_deg; + base_arinc_429 delta_nosewheel_voted_cmd_deg; + base_arinc_429 delta_q_voted_cmd_deg; + base_arinc_429 track_deg; + base_arinc_429 heading_deg; + base_arinc_429 fpa_deg; + base_arinc_429 n1_command_percent; + base_arinc_429 vertical_speed_ft_min; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_fcu_bus_ +#define DEFINED_TYPEDEF_FOR_base_fcu_bus_ + +struct base_fcu_bus +{ + base_arinc_429 selected_hdg_deg; + base_arinc_429 selected_alt_ft; + base_arinc_429 selected_spd_kts; + base_arinc_429 selected_vz_ft_min; + base_arinc_429 selected_mach; + base_arinc_429 selected_trk_deg; + base_arinc_429 selected_fpa_deg; + base_arinc_429 ats_fma_discrete_word; + base_arinc_429 fcu_flex_to_temp_deg_c; + base_arinc_429 ats_discrete_word; + base_arinc_429 eis_discrete_word_1_left; + base_arinc_429 eis_discrete_word_1_right; + base_arinc_429 eis_discrete_word_2_left; + base_arinc_429 eis_discrete_word_2_right; + base_arinc_429 baro_setting_left_hpa; + base_arinc_429 baro_setting_right_hpa; + base_arinc_429 baro_setting_left_inhg; + base_arinc_429 baro_setting_right_inhg; + base_arinc_429 fcu_discrete_word_2; + base_arinc_429 fcu_discrete_word_1; + base_arinc_429 n1_cmd_percent; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_fmgc_bus_inputs_ +#define DEFINED_TYPEDEF_FOR_base_fmgc_bus_inputs_ + +struct base_fmgc_bus_inputs +{ + base_fac_bus fac_opp_bus; + base_fac_bus fac_own_bus; + base_adr_bus adr_3_bus; + base_ir_bus ir_3_bus; + base_adr_bus adr_opp_bus; + base_ir_bus ir_opp_bus; + base_adr_bus adr_own_bus; + base_ir_bus ir_own_bus; + base_ecu_bus fadec_opp_bus; + base_ecu_bus fadec_own_bus; + base_fcdc_bus fcdc_opp_bus; + base_fcdc_bus fcdc_own_bus; + base_ra_bus ra_opp_bus; + base_ra_bus ra_own_bus; + base_ils_bus ils_opp_bus; + base_ils_bus ils_own_bus; + base_fmgc_a_bus fmgc_opp_bus; + base_fcu_bus fcu_bus; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_fmgc_inputs_ +#define DEFINED_TYPEDEF_FOR_fmgc_inputs_ + +struct fmgc_inputs +{ + base_time time; + base_sim_data sim_data; + base_fmgc_discrete_inputs discrete_inputs; + base_fms_inputs fms_inputs; + base_fmgc_bus_inputs bus_inputs; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_fmgc_adr_computation_data_ +#define DEFINED_TYPEDEF_FOR_base_fmgc_adr_computation_data_ + +struct base_fmgc_adr_computation_data +{ + real_T V_ias_kn; + real_T V_tas_kn; + real_T mach; + real_T alpha_deg; + real_T p_s_c_hpa; + real_T altitude_corrected_ft; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_fmgc_ir_computation_data_ +#define DEFINED_TYPEDEF_FOR_base_fmgc_ir_computation_data_ + +struct base_fmgc_ir_computation_data +{ + real_T theta_deg; + real_T phi_deg; + real_T q_deg_s; + real_T r_deg_s; + real_T n_x_g; + real_T n_y_g; + real_T n_z_g; + real_T theta_dot_deg_s; + real_T phi_dot_deg_s; + real_T hdg_deg; + real_T trk_deg; + real_T vz_bi_ft_min; + real_T fpa_deg; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_fmgc_logic_outputs_ +#define DEFINED_TYPEDEF_FOR_base_fmgc_logic_outputs_ + +struct base_fmgc_logic_outputs +{ + boolean_T on_ground; + boolean_T gnd_eng_stop_flt_5s; + boolean_T ap_fd_athr_common_condition; + boolean_T ap_fd_common_condition; + boolean_T fd_own_engaged; + boolean_T ap_own_engaged; + boolean_T athr_own_engaged; + boolean_T athr_active; + boolean_T ap_inop; + boolean_T athr_inop; + boolean_T fmgc_opp_priority; + boolean_T double_adr_failure; + boolean_T double_ir_failure; + boolean_T all_adr_valid; + boolean_T all_ir_valid; + base_fmgc_adr_computation_data adr_computation_data; + base_fmgc_ir_computation_data ir_computation_data; + real_T ra_computation_data_ft; + boolean_T dual_ra_failure; + boolean_T both_ra_valid; + boolean_T fac_lg_data_failure; + boolean_T fac_flap_slat_data_failure; + real32_T flap_position; + real32_T slat_position; + int8_T flap_slat_lever_position; + boolean_T fac_speeds_failure; + boolean_T fac_weights_failure; + boolean_T fcu_failure; + boolean_T ils_failure; + boolean_T both_ils_valid; + base_ils_bus ils_computation_data; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_fmgc_lateral_modes_ +#define DEFINED_TYPEDEF_FOR_base_fmgc_lateral_modes_ + +struct base_fmgc_lateral_modes +{ + boolean_T rwy_active; + boolean_T nav_active; + boolean_T loc_cpt_active; + boolean_T loc_trk_active; + boolean_T roll_goaround_active; + boolean_T hdg_active; + boolean_T trk_active; + boolean_T rwy_loc_submode_active; + boolean_T rwy_trk_submode_active; + boolean_T land_active; + boolean_T align_submode_active; + boolean_T rollout_submode_active; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_fmgc_longitudinal_modes_ +#define DEFINED_TYPEDEF_FOR_base_fmgc_longitudinal_modes_ + +struct base_fmgc_longitudinal_modes +{ + boolean_T clb_active; + boolean_T des_active; + boolean_T op_clb_active; + boolean_T op_des_active; + boolean_T exp_clb_active; + boolean_T exp_des_active; + boolean_T pitch_takeoff_active; + boolean_T pitch_goaround_active; + boolean_T vs_active; + boolean_T fpa_active; + boolean_T alt_acq_active; + boolean_T alt_hold_active; + boolean_T gs_capt_active; + boolean_T gs_trk_active; + boolean_T final_des_active; + boolean_T flare_active; + boolean_T cruise_active; + boolean_T tcas_active; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_fmgc_armed_modes_ +#define DEFINED_TYPEDEF_FOR_base_fmgc_armed_modes_ + +struct base_fmgc_armed_modes +{ + boolean_T alt_acq_armed; + boolean_T alt_acq_arm_possible; + boolean_T nav_armed; + boolean_T loc_armed; + boolean_T land_armed; + boolean_T glide_armed; + boolean_T final_des_armed; + boolean_T clb_armed; + boolean_T des_armed; + boolean_T tcas_armed; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_fmgc_ap_fd_logic_outputs_ +#define DEFINED_TYPEDEF_FOR_base_fmgc_ap_fd_logic_outputs_ + +struct base_fmgc_ap_fd_logic_outputs +{ + base_fmgc_lateral_modes lateral_modes; + base_fmgc_longitudinal_modes longitudinal_modes; + base_fmgc_armed_modes armed_modes; + boolean_T auto_spd_control_active; + boolean_T manual_spd_control_active; + boolean_T fmgc_opp_mode_sync; + boolean_T any_ap_fd_engaged; + boolean_T any_lateral_mode_engaged; + boolean_T any_longitudinal_mode_engaged; + boolean_T hdg_trk_preset_available; + boolean_T ap_fd_mode_reversion; + boolean_T pitch_fd_bars_flashing; + boolean_T roll_fd_bars_flashing; + boolean_T loc_bc_selection; + boolean_T vs_target_not_held; + boolean_T tcas_ra_inhibited; + boolean_T trk_fpa_deselected; + boolean_T longi_large_box_tcas; + boolean_T land_2_capability; + boolean_T land_3_fail_passive_capability; + boolean_T land_3_fail_op_capability; + boolean_T land_2_inop; + boolean_T land_3_fail_passive_inop; + boolean_T land_3_fail_op_inop; + boolean_T land_2_capacity; + boolean_T land_3_fail_passive_capacity; + boolean_T land_3_fail_op_capacity; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_fmgc_discrete_outputs_ +#define DEFINED_TYPEDEF_FOR_base_fmgc_discrete_outputs_ + +struct base_fmgc_discrete_outputs +{ + boolean_T athr_own_engaged; + boolean_T fd_own_engaged; + boolean_T ap_own_engaged; + boolean_T fcu_own_fail; + boolean_T fmgc_healthy; + boolean_T ils_test_inhibit; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_fmgc_b_bus_ +#define DEFINED_TYPEDEF_FOR_base_fmgc_b_bus_ + +struct base_fmgc_b_bus +{ + base_arinc_429 fac_weight_lbs; + base_arinc_429 fm_weight_lbs; + base_arinc_429 fac_cg_percent; + base_arinc_429 fm_cg_percent; + base_arinc_429 fg_radio_height_ft; + base_arinc_429 discrete_word_4; + base_arinc_429 ats_discrete_word; + base_arinc_429 discrete_word_3; + base_arinc_429 discrete_word_1; + base_arinc_429 discrete_word_2; + base_arinc_429 approach_spd_target_kn; + base_arinc_429 delta_p_ail_cmd_deg; + base_arinc_429 delta_p_splr_cmd_deg; + base_arinc_429 delta_r_cmd_deg; + base_arinc_429 delta_nose_wheel_cmd_deg; + base_arinc_429 delta_q_cmd_deg; + base_arinc_429 n1_left_percent; + base_arinc_429 n1_right_percent; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_fmgc_bus_outputs_ +#define DEFINED_TYPEDEF_FOR_base_fmgc_bus_outputs_ + +struct base_fmgc_bus_outputs +{ + base_fmgc_a_bus fmgc_a_bus; + base_fmgc_b_bus fmgc_b_bus; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_fmgc_outputs_ +#define DEFINED_TYPEDEF_FOR_fmgc_outputs_ + +struct fmgc_outputs +{ + fmgc_inputs data; + base_fmgc_logic_outputs logic; + base_fmgc_ap_fd_logic_outputs ap_fd_logic; + base_fmgc_discrete_outputs discrete_outputs; + base_fmgc_bus_outputs bus_outputs; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_struct_2OohiAWrazWy5wDS5iisgF_ +#define DEFINED_TYPEDEF_FOR_struct_2OohiAWrazWy5wDS5iisgF_ + +struct struct_2OohiAWrazWy5wDS5iisgF +{ + real_T SSM; + real_T Data; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_struct_sTSYrIQee0MGLLzlZbRkQD_ +#define DEFINED_TYPEDEF_FOR_struct_sTSYrIQee0MGLLzlZbRkQD_ + +struct struct_sTSYrIQee0MGLLzlZbRkQD +{ + struct_2OohiAWrazWy5wDS5iisgF runway_heading_deg; + struct_2OohiAWrazWy5wDS5iisgF ils_frequency_mhz; + struct_2OohiAWrazWy5wDS5iisgF localizer_deviation_deg; + struct_2OohiAWrazWy5wDS5iisgF glideslope_deviation_deg; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_struct_5FieiEDq7UUIfrm6T3XMED_ +#define DEFINED_TYPEDEF_FOR_struct_5FieiEDq7UUIfrm6T3XMED_ + +struct struct_5FieiEDq7UUIfrm6T3XMED +{ + boolean_T on_ground; + boolean_T gnd_eng_stop_flt_5s; + boolean_T ap_fd_athr_common_condition; + boolean_T ap_fd_common_condition; + boolean_T fd_own_engaged; + boolean_T ap_own_engaged; + boolean_T athr_own_engaged; + boolean_T athr_active; + boolean_T ap_inop; + boolean_T athr_inop; + boolean_T fmgc_opp_priority; + boolean_T double_adr_failure; + boolean_T double_ir_failure; + boolean_T all_adr_valid; + boolean_T all_ir_valid; + base_fmgc_adr_computation_data adr_computation_data; + base_fmgc_ir_computation_data ir_computation_data; + real_T ra_computation_data_ft; + boolean_T dual_ra_failure; + boolean_T both_ra_valid; + boolean_T fac_lg_data_failure; + boolean_T fac_flap_slat_data_failure; + boolean_T flap_position; + boolean_T slat_position; + boolean_T flap_slat_lever_position; + boolean_T fac_speeds_failure; + boolean_T fac_weights_failure; + boolean_T fcu_failure; + boolean_T ils_failure; + boolean_T both_ils_valid; + struct_sTSYrIQee0MGLLzlZbRkQD ils_computation_data; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_struct_AZzDN1joaTge1y2GmVvuYD_ +#define DEFINED_TYPEDEF_FOR_struct_AZzDN1joaTge1y2GmVvuYD_ + +struct struct_AZzDN1joaTge1y2GmVvuYD +{ + struct_2OohiAWrazWy5wDS5iisgF pfd_sel_spd_kts; + struct_2OohiAWrazWy5wDS5iisgF runway_hdg_memorized_deg; + struct_2OohiAWrazWy5wDS5iisgF preset_mach_from_mcdu; + struct_2OohiAWrazWy5wDS5iisgF preset_speed_from_mcdu_kts; + struct_2OohiAWrazWy5wDS5iisgF roll_fd_command; + struct_2OohiAWrazWy5wDS5iisgF pitch_fd_command; + struct_2OohiAWrazWy5wDS5iisgF yaw_fd_command; + struct_2OohiAWrazWy5wDS5iisgF discrete_word_5; + struct_2OohiAWrazWy5wDS5iisgF discrete_word_4; + struct_2OohiAWrazWy5wDS5iisgF fm_alt_constraint_ft; + struct_2OohiAWrazWy5wDS5iisgF altitude_ft; + struct_2OohiAWrazWy5wDS5iisgF mach; + struct_2OohiAWrazWy5wDS5iisgF cas_kts; + struct_2OohiAWrazWy5wDS5iisgF flx_to_temp_deg_c; + struct_2OohiAWrazWy5wDS5iisgF ats_discrete_word; + struct_2OohiAWrazWy5wDS5iisgF ats_fma_discrete_word; + struct_2OohiAWrazWy5wDS5iisgF discrete_word_3; + struct_2OohiAWrazWy5wDS5iisgF discrete_word_1; + struct_2OohiAWrazWy5wDS5iisgF discrete_word_2; + struct_2OohiAWrazWy5wDS5iisgF discrete_word_6; + struct_2OohiAWrazWy5wDS5iisgF synchro_spd_mach_value; + struct_2OohiAWrazWy5wDS5iisgF low_target_speed_margin_kts; + struct_2OohiAWrazWy5wDS5iisgF high_target_speed_margin_kts; + struct_2OohiAWrazWy5wDS5iisgF delta_p_ail_voted_cmd_deg; + struct_2OohiAWrazWy5wDS5iisgF delta_p_splr_voted_cmd_deg; + struct_2OohiAWrazWy5wDS5iisgF delta_r_voted_cmd_deg; + struct_2OohiAWrazWy5wDS5iisgF delta_nosewheel_voted_cmd_deg; + struct_2OohiAWrazWy5wDS5iisgF delta_q_voted_cmd_deg; + struct_2OohiAWrazWy5wDS5iisgF track_deg; + struct_2OohiAWrazWy5wDS5iisgF heading_deg; + struct_2OohiAWrazWy5wDS5iisgF fpa_deg; + struct_2OohiAWrazWy5wDS5iisgF n1_command_percent; + struct_2OohiAWrazWy5wDS5iisgF vertical_speed_ft_min; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_struct_4xpe111mhgRDizxiF0fNDB_ +#define DEFINED_TYPEDEF_FOR_struct_4xpe111mhgRDizxiF0fNDB_ + +struct struct_4xpe111mhgRDizxiF0fNDB +{ + struct_2OohiAWrazWy5wDS5iisgF fac_weight_lbs; + struct_2OohiAWrazWy5wDS5iisgF fm_weight_lbs; + struct_2OohiAWrazWy5wDS5iisgF fac_cg_percent; + struct_2OohiAWrazWy5wDS5iisgF fm_cg_percent; + struct_2OohiAWrazWy5wDS5iisgF fg_radio_height_ft; + struct_2OohiAWrazWy5wDS5iisgF discrete_word_4; + struct_2OohiAWrazWy5wDS5iisgF ats_discrete_word; + struct_2OohiAWrazWy5wDS5iisgF discrete_word_3; + struct_2OohiAWrazWy5wDS5iisgF discrete_word_1; + struct_2OohiAWrazWy5wDS5iisgF discrete_word_2; + struct_2OohiAWrazWy5wDS5iisgF approach_spd_target_kn; + struct_2OohiAWrazWy5wDS5iisgF delta_p_ail_cmd_deg; + struct_2OohiAWrazWy5wDS5iisgF delta_p_splr_cmd_deg; + struct_2OohiAWrazWy5wDS5iisgF delta_r_cmd_deg; + struct_2OohiAWrazWy5wDS5iisgF delta_nose_wheel_cmd_deg; + struct_2OohiAWrazWy5wDS5iisgF delta_q_cmd_deg; + struct_2OohiAWrazWy5wDS5iisgF n1_left_percent; + struct_2OohiAWrazWy5wDS5iisgF n1_right_percent; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_struct_0Fb2AZNt5ksiPDHGUGmLRC_ +#define DEFINED_TYPEDEF_FOR_struct_0Fb2AZNt5ksiPDHGUGmLRC_ + +struct struct_0Fb2AZNt5ksiPDHGUGmLRC +{ + struct_AZzDN1joaTge1y2GmVvuYD fmgc_a_bus; + struct_4xpe111mhgRDizxiF0fNDB fmgc_b_bus; +}; + +#endif +#endif +