Zum Inhalt

Migration

Diese Seite wurde aus der AirSimTech MediaWiki migriert.

INET Register Protocol

Overview

INetActor is the bridge between the Akka.NET actor system and the external simulator modules (MCDU displays, Navigation Displays, FCU) that communicate over UDP broadcast via the ASTLibrary BroadcastRcv1 and INetClient1 WinForms controls on frmMain. The FMGC identifies itself to the network as module ID 55, set via INetClient1.SetModuleID(55, "FMGC") in frmMain_Load before the actor system starts. All INET messages are integer register numbers with string value payloads; the protocol is 1:1 compatible with the original VB6 implementation.

Architecture

Inbound Path

Inbound registers arrive as UDP broadcasts from external modules and flow through the following steps:

  1. An external module (FCU, MCDU display, ND, flight simulator) sends a register value via UDP broadcast.
  2. The BroadcastRcv1 or INetClient1 ASTLibrary control fires its DataRx event on the Windows UI thread.
  3. frmMain.INetClient1_DataRx(cmd As Integer, data As String) — the event handler — calls _inetActor.Tell(New RegisterReceived(cmd, data)), crossing from the UI thread into the actor system.
  4. INetActor.HandleRegisterReceived publishes the RegisterReceived message to Context.System.EventStream.
  5. Subscriber actors (KernelActor, McduActors) receive the event via their EventStream subscriptions, registered in PreStart.

Outbound Path

Outbound registers are initiated by actors and marshalled back to the UI thread for transmission:

  1. An actor (typically GuidanceActor, McduActor, or AcarsActor) calls _inetActor.Tell(New RegisterSend(registerNumber, targetModule, value)).
  2. INetActor.HandleRegisterSend checks whether _frmMain is available. If not (e.g., during startup before InitINet arrives), the message is queued in _pendingQueue.
  3. Once _frmMain is available, INetActor calls frmMain.BeginInvoke(New Action(...)) to marshal the send to the UI thread.
  4. On the UI thread: _frmMain.INetClient1.DataTX(msg.RegisterNumber, CByte(msg.TargetModule), msg.Value) transmits the register.
  5. Note: The second parameter of DataTX is Byte, not Integer — the CByte cast is required; omitting it causes a compile or runtime error.

Startup Queue Drain

Sends that arrive before InitINet (which delivers the frmMain reference) are queued in _pendingQueue As Queue(Of RegisterSend). When InitINet arrives, INetActor drains the queue in FIFO order before processing new messages.

CreateRoute Register Subscription

INetActor supports CallCreateRoute and CallCreateRoutes messages that marshal INetClient1.CREATEROUTE(dataLink, moduleId) calls to the UI thread via BeginInvoke. CreateRoute tells ASTServer which registers the FMGC module wants to receive. ASTServer sends register data in CreateRoute request order, so the ordering of calls determines which data arrives first.

Two-Phase 8999 Handshake

Register 8999 is the routing-complete signal. The startup uses a two-phase handshake matching VB6 frmMain.frm:

  1. After NavDb preload completes, FmgcSupervisor sends CallCreateRoute("8999") — first subscribe (VB6 line 4067)
  2. ASTServer echoes 8999 back — FmgcSupervisor fires SEQ 5 ("SERVER DATA RECEIVING") and sends ~97 bulk CallCreateRoutes in exact VB6 order (lines 5165-5293), with "8999" as the last entry
  3. ASTServer processes all CreateRoutes and echoes 8999 again — FmgcSupervisor fires SEQ 6, sends merged OPCAMI+AIRAC StatusSnapshot, MCDUs auto-navigate to STATUS

Because 8999 is the last CreateRoute in the bulk sequence, receiving it guarantees all other registers have been routed. MCDU keypresses are discarded during this entire sequence (while on the Startup page).

Inbound Register Table

All 18 registers cached by KernelActor for AircraftState assembly, plus 6 MCDU input registers consumed by McduActors.

Aircraft State Registers (Consumer: KernelActor)

Register Scaling Parameter Notes
1703 raw / 10000 Latitude (decimal degrees) Also forwarded via KernelStateSnapshot → McduContext for GPS Monitor page
1704 raw / 10000 Longitude (decimal degrees) Also forwarded via KernelStateSnapshot → McduContext for GPS Monitor page
1768 raw / 10 True track (degrees) Also forwarded to GPS Monitor page (TTRK field)
1706 raw / 10 True heading (degrees) Magnetic heading derived: TrueHeading − MagVariation
1705 raw / 10 Magnetic variation (degrees) Re-derives MagHeading on each update
1025 raw True airspeed (knots)
1766 raw Ground speed (knots) Also forwarded to GPS Monitor page (GS field)
1099 raw Pressure altitude (feet)
1009 raw Barometric altitude (feet) Also forwarded to GPS Monitor page (GPS ALT field)
1718 raw / 10 Wind direction (degrees true)
1717 raw Wind speed (knots)
2345 raw Flap lever position (0–4)
2381 raw Thrust detent position
1001 1 = on ground On-ground flag Boolean: CInt(raw) = 1
2284 bit 16 FCU managed heading mode Boolean: (flags And 16) = 16
1082 raw Gross weight (kg)
1071 raw OAT (°C)

MCDU Input Registers (Consumer: McduActors)

Register Parameter Side
2258 CPT scratchpad input Captain
2260 CPT keystroke (LSK: 1000–1011, hardkeys: other values) Captain
2254 CPT CLR key Captain
2357 FO scratchpad input First Officer
2358 FO keystroke (LSK: 1000–1011, hardkeys: other values) First Officer
2353 FO CLR key First Officer
2731 EPR mode (1=EPR, 0=N1) Both — processed before startup guard; updates _eprMode in McduActor; re-renders SCREENING page if active

Outbound Registers

Registers sent by GuidanceActor and other actors to external simulator modules:

Register Parameter Source Actor Notes
2240 Cross-track error (XTE × 10, signed) GuidanceActor Send-on-change
2288 Heading to FCU (degrees magnetic) GuidanceActor Send-on-change; wind-corrected
2293 Commanded managed speed (knots) GuidanceActor Send-on-change
2307 Mach mode target (Mach × 1000) GuidanceActor
2334 Reference speed (IAS for current phase) GuidanceActor
2344 Mach mode flag (0 or 1) GuidanceActor
2331 Approach phase active flag (0 or 1) GuidanceActor Set on DECEL passage
2539 FMS NAV allowed flag (1 = valid) GuidanceActor
5339 Multiplex: VOR/NDB autotune + MCDU screen text + scratchpad + ADEP/ADES GuidanceActor, INetActor, McduActor Autotune: "02446FV1{freq}"/"02446FA1{freq}". Screen: "02631"/"02632" + lstMCDU payload (CPT/FO). Heartbeat: "02637"/"02638" + counter. Scratchpad: "02257" (CPT) / "02356" (FO) + text (clear="a"). ADEP/ADES: "02706" + "EDDF/LPMA"
5111 ILS autotune frequency and course GuidanceActor (RadioNavModule) Approach phase only; BCD format
2605 Autotune bits bitmask GuidanceActor (RadioNavModule)
5340 Multiplex register: ident, track, dist, UTC GuidanceActor Sequential sub-address multiplexing (GUID-06)
5535 ACARS printer output AcarsActor Print ACARS messages
5601 GSX menu trigger McduActor (AocGroundServicePage) D-14

Screen Buffer Output

MCDU screen content is sent via two parallel paths:

Path 1 — ARINC 429 binary (hardware MCDU displays): : Each McduActor owns an Arinc429ScreenBuffer instance, builds a differential binary message via BuildDifferentialMessage, and sends it as a SendScreenBuffer message to INetActor. INetActor delegates to Arinc429UdpSender.SendMessage, which applies XOR scrambling and sends the payload via UdpClient to 255.255.255.255:65520 as a raw binary datagram (register 7100 equivalent).

Path 2 — INET register 5339 text (software MCDU display / ASTServer): : After rendering, BuildLstMcduLines() reconstructs VB6-format text lines from the binary buffer. INetActor joins them with Chr(26) and sends via INetClient1.DataTX 5339, 0, prefix & payload. Sub-address prefixes: "02631" (CPT screen), "02632" (FO screen), "02637" (CPT heartbeat), "02638" (FO heartbeat). The A320_MCDU software display app subscribes to CMD 2631/2632/2637/2638 to render pages.

Path 3 — Scratchpad text (software MCDU display): : McduActor.SendScratchpad() sends the current scratchpad text to the external MCDU display via register 5339. Sub-address prefixes: "02257" (CPT), "02356" (FO). A clear command (prefix & "a") is sent first, then the content string. This matches VB6 PageHandle.cls SendScratchpad.

See ARINC 429 Screen Buffer Pipeline for the full pipeline.

Message Contracts

All INET actor messages are defined in A320_FMGC/Inet/INetMessages.vb:

Message Class Constructor Parameters Direction Purpose
InitINet formMain As frmMain Supervisor → INetActor Delivers frmMain reference after actor creation; triggers queue drain
RegisterSend registerNumber As Integer, targetModule As Integer, value As String Any actor → INetActor Outbound register send; value must be pre-formatted with InvariantCulture
RegisterReceived command As Integer, data As String frmMain → INetActor → EventStream Inbound register from DataRx; published to EventStream for subscribers
SendScreenBuffer isCaptain As Boolean, screenData As Byte(), lstMcduLines As String() McduActor → INetActor Dual-path screen output: ARINC 429 binary via Arinc429UdpSender + INET register 5339 text via INetClient1.DataTX

Value Formatting

All values in RegisterSend must be formatted with CultureInfo.InvariantCulture by the sending actor before construction. INetActor passes the string directly to DataTX without transformation.

Source Files

  • A320_FMGC/Inet/INetActor.vb — inbound/outbound handler, BeginInvoke marshalling, queue drain, PostStop cleanup
  • A320_FMGC/Inet/INetMessages.vbInitINet, RegisterSend, RegisterReceived, SendScreenBuffer
  • A320_FMGC/Kernel/KernelActor.vb — 18-register cache, AircraftState assembly, EventStream subscription
  • A320_FMGC/Mcdu/McduActor.vb — MCDU register constants (2258, 2260, 2254, 2357, 2358, 2353), scratchpad/keystroke handling
  • A320_FMGC/frmMain.vbSetModuleID(55, "FMGC"), INetClient1_DataRx handler, BeginInvoke target