Skip to content

oscarsanzsanchez/acars

Repository files navigation

ACARS

Aircraft Communication Addressing and Reporting System client for Microsoft Flight Simulator. Connects to a running FSUIPC7 instance over WebSocket and streams real-time flight data including position, fuel state, and simulator time.

How It Works

FSUIPC7 exposes simulator memory through a WebSocket API. This app declares a set of memory offsets to read, subscribes to periodic updates (every 1 second), and outputs processed flight data to the console.

The system is aircraft-agnostic — it works with any MSFS aircraft (Fenix A320, FlyByWire A32NX, PMDG 737, etc.) because FSUIPC exposes common offsets that are consistent across all installed aircraft.

Communication Flow

MSFS <──> FSUIPC7 <──WebSocket──> ACARS Client
  1. The client connects to FSUIPC7 via WebSocket
  2. Sends an offsets.declare message registering which memory addresses to monitor
  3. Sends an offsets.read message to subscribe to periodic reads at a given interval
  4. FSUIPC7 pushes updates which the client processes and outputs

Output

Each update produces a structured object containing:

{
  date: "27/02/2026",           // Zulu (UTC) date — dd/MM/yyyy
  time: "14:30:45",             // Zulu (UTC) time — hh:mm:ss
  position: {
    latitude: 40.47218,          // Degrees (5 decimal places)
    longitude: -3.56124,         // Degrees (5 decimal places)
    altitude: 36012,             // Feet (nearest integer)
    heading: 247                // Degrees (nearest integer)
  },
  fuel: {
    centerKg: 2150,             // Centre tank fuel in kg
    leftMainKg: 3420,           // Left main tank
    leftAuxKg: 0,               // Left auxiliary tank
    leftTipKg: 0,               // Left tip tank
    rightMainKg: 3418,          // Right main tank
    rightAuxKg: 0,              // Right auxiliary tank
    rightTipKg: 0,              // Right tip tank
    totalKg: 8988               // Sum of all tanks
  }
}

Data Conversions

Field Raw FSUIPC value Conversion
Latitude / Longitude 64-bit float (degrees) Direct from offset 0x6010/0x6018, rounded to 5 decimals
Altitude 64-bit float (metres) value * 3.28084 to feet, rounded to nearest integer
Heading 64-bit float (radians) value * (180 / PI) to degrees, rounded to nearest integer
Tank level 32-bit int value / (128 * 65536) gives percentage (0–1)
Tank capacity 32-bit int US Gallons
Fuel weight/gallon 16-bit int value / 256 gives lbs/gallon
Tank fuel (kg) percentage * capacity * lbsPerGallon * 0.453592

FSUIPC Offsets Used

Position

Offset Size Name
0x6010 8 Latitude (degrees, float)
0x6018 8 Longitude (degrees, float)
0x6020 8 Altitude (metres, float)
0x6038 8 Heading (radians, float)

Fuel Tanks

Offset Size Name
0x0AF4 2 Fuel weight per gallon (* 256)
0x0B74 4 Centre tank level
0x0B78 4 Centre tank capacity
0x0B7C 4 Left main tank level
0x0B80 4 Left main tank capacity
0x0B84 4 Left aux tank level
0x0B88 4 Left aux tank capacity
0x0B8C 4 Left tip tank level
0x0B90 4 Left tip tank capacity
0x0B94 4 Right main tank level
0x0B98 4 Right main tank capacity
0x0B9C 4 Right aux tank level
0x0BA0 4 Right aux tank capacity
0x0BA4 4 Right tip tank level
0x0BA8 4 Right tip tank capacity

Time (Zulu/UTC)

Offset Size Name
0x023A 1 Second (0–59)
0x023B 1 Hour (0–23)
0x023C 1 Minute (0–59)
0x023D 2 Day of month
0x0240 2 Year
0x0242 1 Month of year

Mock Server

A local development server is included that simulates FSUIPC7's WebSocket API without requiring MSFS or FSUIPC7 to be running. It serves pre-generated flight data that advances through a full simulated flight on each interval tick, looping back to the start once exhausted.

Simulated Flight

The mock server generates 7020 sequential FlightData records representing a 117-minute gate-to-gate Madrid (LEMD) to Barcelona (LEBL) flight. All values are in raw FSUIPC format (metres, radians, raw fuel integers) exactly as FSUIPC7 would emit them. Zulu time runs from 14:30:00Z to 16:26:59Z on 27 Feb 2026.

Phase Time (s) Duration Altitude Notes
Stand 0–300 5 min 610 m (field) Parked at LEMD gate, hdg 180°
Pushback 300–360 1 min 610 m Push and turn to taxiway
Taxi out 360–1260 15 min 610 m Taxi to runway 32R
Takeoff & climb 1260–1860 10 min 610→10668 m Rotate, climb to FL350
Cruise 1860–5460 60 min 10668 m FL350, heading ~070°
Descent 5460–5940 8 min 10668→600 m Descend for approach
Approach & landing 5940–6060 2 min 600→4 m ILS 25R, touchdown at LEBL
Taxi in 6060–6960 15 min 4 m (field) Vacate runway, taxi to gate
Parking & shutdown 6960–7020 1 min 4 m Parked at gate, engines off

Position is linearly interpolated between waypoints using shortest-path angle interpolation for heading changes. Left and right main tank fuel levels burn linearly from 80% to 40% over the flight; all other tanks remain empty. The date is fixed at 27 Feb 2026.

Running the Mock Server

The server requires a pre-generated flight-data.json file. Run the generate step once before starting the server for the first time, and again any time you want to regenerate the flight data.

cd mock-server
npm install
npm run generate   # writes flight-data.json (7020 records, ~2.9 MB)
npm start          # reads flight-data.json and serves via WebSocket

flight-data.json is a generated artifact and is gitignored — it is not committed to the repository.

The server listens on ws://localhost:2048/fsuipc/ using the fsuipc sub-protocol — the same address and protocol the ACARS client is configured for by default. It handles offsets.declare and offsets.read commands and respects the requested interval.

Prerequisites

Setup

  1. Clone the repository
  2. Install dependencies:
    npm install
  3. Edit src/config/sim_conn_details.json with your FSUIPC7 WebSocket host and port:
    {
      "host": "192.168.1.67",
      "port": 2048,
      "protocol": "fsuipc"
    }
  4. Start MSFS and ensure FSUIPC7 is running
  5. Run the client:
    npm start

Project Structure

src/
  index.ts                — Entry point: connects, subscribes, processes and outputs flight data
  config/
    sim_conn_details.json — FSUIPC7 connection configuration (host, port, protocol)
    variables.ts          — FSUIPC offset declarations (position, fuel, time) and read subscription
  connector/
    connector.ts          — WebSocket client (extends EventEmitter) wrapping the FSUIPC7 connection
  utils/
    constants.ts          — Conversion constants (LBS_TO_KG, FEET_PER_METRE, fuel divisors)
    conversions.ts        — Unit conversion functions (metresToFeet, radiansToDegrees, tankFuelKg)
    formatting.ts         — String formatting helpers (padZero)
  types/
    ConnectorClass.ts     — Interface for the Connector class
    FsuipcMessage.ts      — Generic message envelope type (command + name + data)
    topics/
      FlightData.ts       — TypeScript interface for the combined flight data payload
mock-server/
  server.ts               — WebSocket server that emulates FSUIPC7 for local development
  generate-flight.ts      — Generates 7020 FlightData records simulating a LEMD → LEBL flight
  package.json            — Standalone package with its own dependencies (ws, tsx)
fsuipc-vars.json          — Full dump of available FSUIPC simulator variables (L:Vars, H:Vars)

Tech Stack

  • TypeScript with strict mode
  • tsx for direct .ts execution (no build step)
  • ws for WebSocket communication
  • Node.js EventEmitter for internal message routing

License

ISC

About

Aircraft Communication Addressing and Reporting System client for Microsoft Flight Simulator. Connects to a running FSUIPC7 instance over WebSocket and streams real-time flight data including position, fuel state, and simulator time.

Topics

Resources

Stars

Watchers

Forks

Contributors