Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works
Anything · Lazarus or Delphi
Random projectRandom project

trimair

View on GitHub

Member rating

No ratings yet.

Sign in to rate this project.

README

Trimair

Aircraft weight & balance, load planning and trim-sheet library for Delphi / Embarcadero RAD Studio (XE7+ tested, also builds on 11 Alexandria).

Trimair is the computation core behind a departure-control / load-control desk. It models:

  • Aircraft master records (DOW, DOI, fuel/cargo stations, CG envelopes).
  • Loadable items: passengers (zones), bags, cargo (loose / ULD), fuel.
  • Index-based moment arithmetic (Boeing-style index units).
  • CG envelope checks (zero-fuel, take-off, landing).
  • Trip-fuel and burn-off profile interpolation.
  • Loadsheet rendering (IATA-style ASCII and PDF via the host app).
  • Persistence to ODBC / FireDAC for archival.

The library is presentation-agnostic: the VCL/FMX desk apps consume the units below. No GUI dependencies in src/.

Layout

pascal
src/
  Trimair.Units.pas         unit conversions, fixed-point helpers
  Trimair.Aircraft.pas      aircraft types, stations, CG envelope
  Trimair.LoadItems.pas     pax, bag, cargo, ULD, fuel item classes
  Trimair.Moment.pas        index/moment arithmetic
  Trimair.Fuel.pas          density corrections, burn profile
  Trimair.Envelope.pas      CG envelope polygon checks
  Trimair.WeightBalance.pas main W&B engine
  Trimair.Manifest.pas      manifest (ASM/PTM/LDM/CPM) parsing
  Trimair.Validation.pas    pre-flight rules and limits
  Trimair.Persistence.pas   FireDAC / ODBC storage
  Trimair.Loadsheet.pas     IATA loadsheet rendering
  Trimair.Registry.pas      aircraft master registry (singleton)
tests/
  ...

Quick start

pascal
uses
  Trimair.Aircraft, Trimair.WeightBalance, Trimair.LoadItems;

var
  AC : TAircraft;
  WB : TWeightBalance;
begin
  AC := TRegistry.Default.LookupTail('OY-KAB');
  WB := TWeightBalance.Create(AC);
  try
    WB.AddPax(zoneA, 32);
    WB.AddPax(zoneB, 28);
    WB.AddBag(holdFwd, 480.0);   // kg
    WB.SetTripFuel(2150.0);
    WB.SetTakeoffFuel(2900.0);
    if WB.WithinEnvelope then
      WriteLn(WB.Loadsheet)
    else
      WriteLn('OUT OF LIMITS: ', WB.LastViolation);
  finally
    WB.Free;
  end;
end;

Units

Internal SI: kilograms and metres for arms; index reference and constants are configurable per-aircraft (Boeing C=29500, Airbus C=50 by default). Imperial inputs are converted at the API boundary.

Threading

TWeightBalance is not thread-safe; create one per flight. TRegistry is a process-wide singleton with internal locking.

License

Proprietary. (c) Stagebridge Aviation Systems ApS.