Zum Inhalt

Migration

Diese Seite wurde aus der AirSimTech MediaWiki migriert.

External Integrations

Overview

The FMGC integrates with four external subsystems beyond the core INET register protocol. SimBriefActor fetches Operational Flight Plan (OFP) data from the SimBrief API over HTTP, parsing the XML response and applying it to the kernel flight plan. AcarsActor handles weather data retrieval from the ActiveSky snapshot file and ACARS message persistence to ACARS.mdb, with printer output via INET register 5535. UserdataActor manages flight situation persistence and company route storage in Userdata.mdb. FSFlightControl route synchronisation operates through KernelActor register sends over the INET protocol. Each subsystem runs in its own dedicated actor, following the one-actor-per-MDB-file principle that prevents OleDb threading conflicts.

Integration Map

SimBrief OFP Import

SimBriefActor fetches the Operational Flight Plan XML from the SimBrief API using a single static HttpClient instance. The static instance prevents socket exhaustion that occurs when a new HttpClient is created per request.

Fetch Flow

  1. FetchSimBriefRequest(PilotId) arrives in SimBriefActor mailbox
  2. Actor validates PilotId, builds URL: https://www.simbrief.com/api/xml.fetcher.php?userid={id}&nocache={timestamp}
  3. Calls _Http.GetStringAsync(url).PipeTo(Self, ...) — actor mailbox continues processing while HTTP request is in flight
  4. On success: SimBriefFetchSuccess(xmlContent) is piped to Self
  5. On failure: SimBriefFetchFailure(errorMessage) is piped to Self

XML Parsing

SimBriefXmlParser is a Friend Module that parses the SimBrief OFP XML using System.Xml.Linq.XDocument. It extracts:

Field XML Source Usage
Origin ICAO origin/icao_code Departure airport
Destination ICAO destination/icao_code Arrival airport
Flight number general/flight_number Displayed on MCDU
Zero Fuel Weight (ZFW) weights/est_zfw INIT B perf entry
Block fuel fuel/plan_ramp FOB entry
Cost Index general/costindex CI for trajectory computation
Alternate ICAO alternate/icao_code ALTN entry
Cruise FL general/initial_altitude CRZ FL
Navlog fixes navlog/fix (ENROUTE stage) Route waypoints

Weights are converted from LBS to KG when params/units = "LBS". Only ENROUTE stage navlog entries are included in the route waypoints.

Actor Wiring

SetSimBriefRefs(McduCptActor, McduFoActor, KernelActor) is called from FmgcSupervisor after all actors are created. This single message wires all three actor references into SimBriefActor. Without this message, actor refs default to ActorRefs.Nobody.

Result Delivery

On successful parse:

  • KernelActor.Tell(ApplySimBriefOFP(ofp)) — applies OFP fields atomically to kernel state
  • Both MCDU actors receive ShowScratchpadMessage("AOC ACT F-PLN UPLINK", Green)

On error:

  • Both MCDU actors receive ShowScratchpadMessage(errorText, Amber)

ACARS Communication

AcarsActor takes an inetActor reference in its constructor, enabling direct INET register writes for ACARS printer output without a separate wiring message.

Weather Retrieval

Weather data is read from the ActiveSky snapshot file. The file uses :: delimiters:

EGLL::EGLL::METAR EGLL 301020Z 27015KT ...::TAF EGLL ...::

CheckWeatherRequest(AirportIcao, WxType) searches the file for the requested ICAO and returns either the METAR or STAF (TAF) text. If the file is missing or the airport is not found, returns "NO METAR AVAILABLE".

ACARS Message Persistence

SaveMessageRequest persists ACARS messages (preflight, enroute, postflight, and message log entries) to ACARS.mdb via OleDb, using the Using block pattern (open-per-request).

ReadMessagesRequest retrieves the stored message log for display on the ACARS message log page.

ACARS Printer Output

PrintAcarsMessage(text) sends the message text to INET register 5535 via INetActor.Tell(SendRegister(5535, text)). Register 5535 is the ACARS printer output register defined in the VB6 INET protocol.

Position Reports

FAA domestic position reports return NOT AVAILABLE on all ACARS phase pages. This is by design — the FMGC provides guidance outputs but not real-time ADS-B position data for FAA reporting.

ACARS Message Handler Summary

Message Action
CheckWeatherRequest Read ActiveSky snapshot file; return WeatherResult
ReadMessagesRequest Query ACARS.mdb; return message list
SaveMessageRequest INSERT to ACARS.mdb
PrintAcarsMessage Tell INetActor to write register 5535

Userdata Persistence

UserdataActor manages all user-specific persistence in Userdata.mdb. OleDb connections are opened per request using the Using block pattern — there is no persistent connection. This mirrors the NavDbActor pattern.

Company Routes (CO RTE)

Company routes are stored in the CompanyRoutes table. Each route has a name, departure ICAO (ADEP), arrival ICAO (ADES), and a serialised waypoint list stored as VIA/WPT string pairs matching the VB6 DatabaseHandle.cls format.

Message Action
LoadCoRteListRequest(Adep, Ades) SELECT from CompanyRoutes filtered by ADEP/ADES; return CoRteListResult
LoadCoRteByNameRequest(name) Load full route details including waypoints by route name
SaveCoRteRequest INSERT or UPDATE route in CompanyRoutes
DeleteCoRteRequest(name) DELETE route by name

Situation Save / Load

Flight situations are stored in the FMGCData table in Userdata.mdb. Each saved situation captures the complete flight state:

  • Flight plan legs (serialised as SituationLegData records)
  • Performance values: ZFW, FOB, cost index, cruise FL, V-speeds
  • Wind tables (climb, cruise, descent)
  • Route identifiers (origin, destination, alternate, company route name)

Up to 500 saved situations are supported. SituationLegData uses the field name Longitude (not Long) to avoid collision with the VB.NET Long keyword — the underlying OleDb column in the database remains Long.

Message Action
SaveSituationRequest INSERT new situation into FMGCData; returns slot number
LoadSituationListRequest SELECT all saved situations; return SituationListResult
LoadSituationRequest(slot) Load complete situation by slot number; return SituationResult
DeleteSituationRequest(slot) DELETE situation by slot number

FSFlightControl Sync

FSFlightControl route synchronisation operates through KernelActor register sends over the INET protocol. KernelActor sends route data to designated INET registers that FSFlightControl subscribes to via the broadcast protocol. This requires no dedicated actor — route sync is a side effect of the existing INET register infrastructure.

Source Files

File Purpose
A320_FMGC/SimBrief/SimBriefActor.vb OFP fetch actor with static HttpClient and PipeTo pattern
A320_FMGC/SimBrief/SimBriefXmlParser.vb XDocument-based OFP XML parser; Friend Module
A320_FMGC/SimBrief/SimBriefMessages.vb FetchSimBriefRequest, SetSimBriefRefs, ApplySimBriefOFP, result types
A320_FMGC/Acars/AcarsActor.vb ACARS weather, message persistence, and printer output
A320_FMGC/Acars/AcarsMessages.vb CheckWeatherRequest, PrintAcarsMessage, and related types
A320_FMGC/Userdata/UserdataActor.vb Company route and situation save/load
A320_FMGC/Userdata/UserdataMessages.vb All CO RTE and situation message types
A320_FMGC/Userdata/UserdataModels.vb CoRteEntry, SituationLegData, SituationSummary
A320_FMGC/Kernel/FmgcSupervisor.vb SetSimBriefRefs wiring call after actor creation