Skip to content

Commit

Permalink
feat(a32nx): takeoff performance calculator (#8678)
Browse files Browse the repository at this point in the history
* feat(efb): aircraft provides perf calculators

* fix: improve facility typing

* feat(efb): uppercase SimpleInput

* feat(efb): disabled SelectInput

* feat(efb): takeoff performance calculator

* fix(efb): landing widget slope

* doc: changelog

* fix: shared path duplicate after fms-v2 merge

* fix(shared): erroneous import from fmgc

* fix(efb): import

* Update a32nx_takeoff.ts

* Update a32nx_takeoff.ts

* fix(takeoff): correct v2 threshold

* Update a32nx_takeoff.ts

* Update a32nx_takeoff.ts

* Update a32nx_takeoff.ts

* Update a32nx_takeoff.ts

* Update a32nx_takeoff.ts

* Update a32nx_takeoff.ts

* Update a32nx_takeoff.ts

* Update a32nx_takeoff.ts

* Update a32nx_takeoff.ts

* Update a32nx_takeoff.ts

* Update a32nx_takeoff.ts

* Update a32nx_takeoff.ts

* Update a32nx_takeoff.ts

* Update a32nx_takeoff.ts

* Update a32nx_takeoff.ts

* fix: change default config to 1+F

* fix: remove slope ui limits

* fix: clear state on input change

* fix: avoid line break in select

* fix: wind not clearing and fields displaying erroneous limited values

* fix: lint after merge of new lint rules

* fix: wind entry

---------

Co-authored-by: donstim <[email protected]>
  • Loading branch information
tracernz and donstim authored Jun 28, 2024
1 parent 49209eb commit 5c88ab8
Show file tree
Hide file tree
Showing 24 changed files with 5,571 additions and 85 deletions.
1 change: 1 addition & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
1. [ISIS] Fixed localiser deviation when on the back beam - @tracernz (Mike)
1. [FMS/AP/ND/PFD] Added support for localiser back course approaches - @tracer (Mike)
1. [ND] Fix color of navaids at the active leg termination - @BlueberryKing (BlueberryKing)
1. [EFB] Added a takeoff performance calculator - @donstim (donbikes), @tracernz (Mike)

## 0.11.0

Expand Down
22 changes: 13 additions & 9 deletions fbw-a32nx/src/systems/instruments/src/EFB/config.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
{
"index": "./index.tsx",
"isInteractive": true,
"dimensions": {
"width": 1430,
"height": 1000
},
"additionalImports": [
"/Pages/VCockpit/Instruments/Shared/Map/MapInstrument.html"
]
"index": "./index.tsx",
"isInteractive": true,
"dimensions": {
"width": 1430,
"height": 1000
},
"additionalImports": [
"/Pages/VCockpit/Instruments/Shared/Map/MapInstrument.html"
],
"extraDeps": [
"fbw-common/src/systems/instruments/src/EFB",
"fbw-a32nx/src/systems/shared/src/performance"
]
}
6 changes: 6 additions & 0 deletions fbw-a32nx/src/systems/instruments/src/EFB/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import React from 'react';
import { render } from '@instruments/common/index';
import { AircraftContext, EfbWrapper, syncSettingsFromPersistentStorage } from '@flybywiresim/flypad';
import { A320FailureDefinitions } from '@failures';
import { A320251NLandingCalculator } from '@shared/performance/a32nx_landing';
import { A320251NTakeoffPerformanceCalculator } from '@shared/performance/a32nx_takeoff';
import { AutomaticCallOutsPage } from './Pages/AutomaticCallOutsPage';
import { a32nxSyncedSettings } from 'instruments/src/EFB/settingsSync';

Expand All @@ -18,6 +20,10 @@ function aircraftEfbSetup(): void {
render(
<AircraftContext.Provider
value={{
performanceCalculators: {
takeoff: new A320251NTakeoffPerformanceCalculator(),
landing: new A320251NLandingCalculator(),
},
settingsPages: {
autoCalloutsPage: AutomaticCallOutsPage,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,12 @@

// Data and calculations obtained from Quick Reference Handbook (In Flight Procedures, Landing Performance Assessment/Landing Distance)

import { getTailWind } from './CommonCalculations';

export enum LandingRunwayConditions {
Dry,
Good,
GoodMedium,
Medium,
MediumPoor,
Poor,
}

export enum LandingFlapsConfig {
Conf3,
Full,
}

export enum AutobrakeMode {
Low,
Medium,
Max, // Manual brake is the same as max auto
}
import {
AutobrakeMode,
LandingPerformanceCalculator,
LandingFlapsConfig,
LandingRunwayConditions,
} from '@flybywiresim/fbw-sdk';

/**
* Landing data for a specific aircraft configuration with a specific runway condition
Expand Down Expand Up @@ -588,7 +573,19 @@ const getInterpolatedVlsTableValue = (mass: number, vlsSpeedTable: number[]): nu
return lower + oneTonSpeedIncrement * (mass % 5);
};

export class LandingCalculator {
function getTailWind(windDirection: number, windMagnitude: number, runwayHeading: number): number {
const windDirectionRelativeToRwy = windDirection - runwayHeading;
const windDirectionRelativeToRwyRadians = toRadians(windDirectionRelativeToRwy);

const tailWind = Math.cos(Math.PI - windDirectionRelativeToRwyRadians) * windMagnitude;
return tailWind;
}

function toRadians(degrees: number): number {
return degrees * (Math.PI / 180);
}

export class A320251NLandingCalculator implements LandingPerformanceCalculator {
/**
* Calculates the landing distances for each autobrake mode for the given conditions
* @param weight Aircraft weight in KGs
Expand Down
Loading

0 comments on commit 5c88ab8

Please sign in to comment.