Compare commits

..

2 Commits

Author SHA1 Message Date
ea788bdd04 Getting station data 2025-06-09 06:00:14 +02:00
afa806de61 Live CG calculation 2025-06-09 05:35:26 +02:00
4 changed files with 133 additions and 0 deletions

View File

@ -1,5 +1,8 @@
import { FC, StrictMode, useEffect, useRef, useState } from 'react';
import styles from './App.module.scss';
import { ArmsFreight, PayloadFreight } from './configs/freighter';
import { ArmsPax, PayloadPax } from './configs/pax';
import { ArmsFuel, EmptyArm, Fuel, toPercentMAC } from './configs/shared';
interface IAppProps {
dataListener: ViewListener.ViewListener;

View File

@ -0,0 +1,36 @@
export interface PayloadFreight {
pilot: number;
firstOfficer: number;
engineer: number;
upper1Left: number;
upper1Right: number;
upper2Left: number;
upper2Right: number;
upper3Left: number;
upper3Right: number;
upper4Left: number;
upper4Right: number;
lowerForward: number;
lowerRear: number;
leftAuxF: number;
rightAuxF: number;
}
// TODO: Extract from CFG at runtime.
export const ArmsFreight = {
pilot: 984,
firstOfficer: 984,
engineer: 960,
upper1Left: 660,
upper1Right: 660,
upper2Left: 240,
upper2Right: 240,
upper3Left: -240,
upper3Right: -240,
upper4Left: -600,
upper4Right: -600,
lowerForward: 360,
lowerRear: -360,
leftAuxF: 60,
rightAuxF: 60,
}

View File

@ -0,0 +1,49 @@
export interface PayloadPax {
pilot: number;
firstOfficer: number;
engineer: number;
cabinCrewFront: number;
business1Left: number;
business1Center: number;
business1Right: number;
business2Left: number;
business2Center: number;
business2Right: number;
economy1Left: number;
economy1Center: number;
economy1Right: number;
economy2Left: number;
economy2Center: number;
economy2Right: number;
cabinCrewRear: number;
forwardCargo: number;
rearCargo: number;
leftAuxPax: number;
rightAuxPax: number;
}
// TODO: Extract from CFG at runtime.
// FIXME: Copy over values
export const ArmsPax = {
pilot: 0,
firstOfficer: 0,
engineer: 0,
cabinCrewFront: 0,
business1Left: 0,
business1Center: 0,
business1Right: 0,
business2Left: 0,
business2Center: 0,
business2Right: 0,
economy1Left: 0,
economy1Center: 0,
economy1Right: 0,
economy2Left: 0,
economy2Center: 0,
economy2Right: 0,
cabinCrewRear: 0,
forwardCargo: 0,
rearCargo: 0,
leftAuxPax: 0,
rightAuxPax: 0,
};

View File

@ -0,0 +1,45 @@
export interface Fuel {
main1: number;
main3: number;
main2: number;
upperAux: number;
lowerAux: number;
main1Tip: number;
main3Tip: number;
tail: number;
forwardAux1: number;
forwardAux2: number;
}
// TODO: Extract from CFG at runtime.
export const EmptyArm = -159.6;
// TODO: Extract from CFG at runtime.
export const ArmsFuel = {
main1: -240,
main3: -240,
main2: 120,
upperAux: 0,
lowerAux: 0,
main1Tip: -468,
main3Tip: -468,
tail: -840,
forwardAux1: 60,
forwardAux2: 60,
};
// TODO: Extract following four from CFG at runtime
const rootChord = 34.68;
const wingSpan = 170.5;
const wingArea = 3648;
const quarterMAC = -165; //aero_center
const tipChord = (2 * wingArea) / wingSpan - rootChord;
const taperRatio = tipChord / rootChord;
const MAC = (2 / 3) * rootChord * ((1 + taperRatio + taperRatio ** 2) / (1 + taperRatio)) * 12;
const LEMAC = quarterMAC + (1 / 4) * MAC;
export const toPercentMAC = (positionInInches: number) => {
return Math.abs(((positionInInches - LEMAC) / MAC) * 100);
};