Zum Inhalt

Migration

Diese Seite wurde aus der AirSimTech MediaWiki migriert.

Guidance and Speed Management

Overview

GuidanceActor is the FMGC subsystem that runs once per second, driven by a GuidanceInput message assembled and delivered by KernelActor. On each cycle it computes the active lateral guidance data — cross-track error (XTE), heading-to-FCU, magnetic track and distance to the active waypoint — alongside managed speed guidance for the current flight phase, DECEL point placement for the approach transition, and radio navigation autotune. Results are published to the Akka.NET EventStream as a GuidanceResult and sent directly to external simulator modules (FCU, speed tape display) via INET registers through INetActor.

GuidanceInput Assembly

KernelActor assembles a GuidanceInput single-message bundle each tick (after receiving a FlightPlanSnapshot from FlightPlanActor via Ask+PipeTo) and sends it to GuidanceActor. The bundle contains three fields:

  • Aircraft As AircraftState — immutable snapshot of the 18-field INET register cache
  • Trajectory As TrajectoryResult — the latest trajectory computation result (may be Nothing until first computation completes)
  • FlightPlan As FlightPlanSnapshot — current primary flight plan snapshot

AircraftState Fields and Source Registers

Field Register Scaling Unit
Latitude 1703 raw / 10000 Decimal degrees
Longitude 1704 raw / 10000 Decimal degrees
TrueTrack 1768 raw / 10 Degrees
TrueHeading 1706 raw / 10 Degrees
MagHeading — (derived) TrueHeading − MagVariation Degrees
MagneticVariation 1705 raw / 10 Degrees
TasKts 1025 raw Knots
GroundSpeedKts 1766 raw Knots
PressureAltFt 1099 raw Feet
AltitudeFt 1009 raw Feet
WindDirectionDeg 1718 raw / 10 Degrees true
WindSpeedKts 1717 raw Knots
FlapLever 2345 raw 0–4
ThrustDetent 2381 raw Integer
OnGround 1001 1 = on ground Boolean
ManagedHdg 2284 bit 16 set Boolean
GrossWeightKg 1082 raw kg
OatDegC 1071 raw °C

Guidance Computation Cycle

Active Leg Sequencing

GuidanceActor maintains a private _activeWptIndex integer tracking which leg in the flight plan list is currently active. On each cycle, it calculates bearing and distance from the aircraft position to the active waypoint using GeoCalculations.Bearing and GeoCalculations.DistanceNm.

Waypoint passage is detected by HasPassedAbeam, which compares the inbound track angle of the leg against the current bearing to the waypoint. When the bearing difference indicates the aircraft has passed abeam, _activeWptIndex is incremented and the cycle returns immediately — the next tick recalculates from scratch with the new active waypoint. This is a faithful port of the VB6 clsGuidance.cls early-exit fix from 2025-12-20.

A _suppressOffset flag is set on passage and holds XTE at zero until the aircraft is back within 0.5 NM of the new leg track, preventing spurious XTE spikes during the leg transition.

XTE uses a track-angle difference formula with a 6-degree dead band (port of VB6 Calc_Crosstrack_Error), ensuring the aircraft must be more than 6 degrees off track before a non-zero XTE is reported.

Speed Guidance

ComputeSpeedGuidance runs at the start of every guidance cycle, regardless of whether a flight plan is loaded. It computes all speed values from the current AircraftState and sends changed values to the FCU speed tape registers.

Managed Speed Computation per Phase

Flight Phase Commanded Speed Mach Mode Trigger
Preflight / Takeoff DefaultClimbIas (300 kt) limited below 10,000 ft to 250 kt No
Climb DefaultClimbIas (300 kt) limited below 10,000 ft to 250 kt When IAS equivalent Mach >= 0.78
Cruise DefaultCruiseIas (310 kt) When IAS equivalent Mach >= 0.78
Descent DefaultDescentIas (280 kt) limited below 10,000 ft to 250 kt When IAS equivalent Mach >= 0.78
Approach / GoAround VApp No

VLS Protection

VlsCheckedSpeed ensures the commanded speed never falls below VLS for the current flap/weight configuration. VLS is derived from CalcVlsForConfig, which interpolates the VSS weight table (6 flap configs x 8 weight bands) and applies a multiplier depending on flap configuration. The ground state (weight-on-wheels) suppresses VLS protection to allow taxi operations.

SpeedGuidanceResult

SpeedGuidanceResult is a Friend Class that groups all outputs of ComputeSpeedGuidance to avoid ByRef return parameters:

  • CmdSpeedKts As Integer — commanded managed speed
  • VlsKts As Integer — VLS for current config
  • GreendotKts As Integer — green dot (best-lift) speed
  • SSpeedKts As Integer — S-speed (flaps retraction speed)
  • FSpeedKts As Integer — F-speed (slats retraction speed)
  • VAppKts As Integer — approach speed
  • IsMachMode As Boolean — true when Mach display applies

CalcDecelDistanceNm

CalcDecelDistanceNm(fromSpeedKts, toSpeedKts, decelRateFtPerSecSq) computes the distance in nautical miles required to decelerate from one speed to another. The deceleration rate is passed as a parameter at call sites with the value 0.05 * 32.174 ft/s² (0.05 g), matching the VB6 performance model. This parameterisation allows unit tests to inject a different rate.

DECEL Point Placement

The (DECEL) pseudo-waypoint is placed by ComputedFlightPlanBuilder.InsertDecelMarker based on the trajectory descent profile data. It marks the point where approach deceleration begins — the aircraft is still at full descent speed (e.g. 250 kt) at DECEL.

Trajectory-driven placement: The trajectory descent profile models a distance-based deceleration zone using 0.1 g horizontal deceleration rate (see Trajectory: Approach Deceleration). InsertDecelMarker scans the descent profile points in forward order (T/D to ADES) and finds the last point still at full IAS before the first drop exceeding 3 kt below FL100. This point becomes the (DECEL) marker position, with all predicted values (altitude, IAS, GS, fuel, ETA) taken directly from the trajectory profile point.

Guidance runtime: During the Descent flight phase, CheckDecelPassage scans the leg list for the (DECEL) pseudo-waypoint. Since the marker now always has coordinates from the trajectory, the actor computes distance from the aircraft to that position. When passage is confirmed and FCU managed heading mode is active, ActivateApproachPhase is called, setting _approachPhaseActive = True and triggering the flight phase transition to Approach.

Radio Nav Autotune

RadioNavModule (a Friend Module with pure functions) performs radio navigation autotune on every guidance cycle.

VOR/NDB Continuous Autotune

FindAheadVorNdb scans up to 5 legs forward from the active waypoint index looking for a leg with NavaidType = "VOR" or "NDB" and Frequency > 0. The first match is formatted as a compound register value and sent to register 5339 on change.

Format for VOR: "02446FV1{freq}" where freq has the decimal point removed (e.g., 113.60 MHz → "02446FV111360"). Format for NDB: "02446FA1{freq}" where freq is the ADF frequency in kHz without decimal point.

ILS Approach-Phase-Only Autotune

FindAheadIls is guarded: it returns Nothing unless approachPhaseActive = True. When active, it scans the last 10 legs of the flight plan for a leg with NavaidType = "ILS". The ILS frequency and course are then sent to register 5111:

  • Frequency: "&h03502{bcd5}" — 5-digit BCD-encoded MHz value (e.g., 110.30 MHz → BCD digits 1, 0, 3, 0 → &h03502 + k)
  • Course: "&h0c4e2{course5}" — 5-digit decimal course (e.g., 274° → &h0c4e200274)

Autotune Send-on-Change

Both VOR/NDB and ILS register values are cached in OldGuidanceCache (VorNdbRegisterValue, IlsFreqRegisterValue, IlsCourseRegisterValue) and only sent when the value has changed, preventing unnecessary INET traffic.

Flight Phase State Machine

GuidanceActor tracks the current phase as a GuidanceFlightPhase enum (Integer backing, matching VB6 FLIGHTPHASE_* constants):

Phase Value Transition In Transition Out
Preflight 0 Initial state On takeoff roll
Takeoff 1 (manual/external trigger) Altitude > 1,500 ft AGL
Climb 2 AltitudeFt > AccelAlt (1,500 ft) from Takeoff or GoAround Within 200 ft of cruise altitude from TrajectoryResult
Cruise 3 Climb → Cruise on altitude capture (manual T/D activation via MCDU)
Descent 4 (manual T/D via MCDU/PERF page) DECEL passage detected
Approach 5 DECEL passage or manual activation TOGA thrust detected (ThrustDetent = 7)
GoAround 6 TOGA thrust in Approach phase AltitudeFt > AccelAlt → back to Climb

Source Files

  • A320_FMGC/Guidance/GuidanceActor.vb — main guidance cycle, speed guidance, DECEL detection, flight phase state machine, send-on-change register outputs
  • A320_FMGC/Guidance/GuidanceModels.vbAircraftState, GuidanceInput, GuidanceResult, OldGuidanceCache, HoldStateMachine, GuidanceFlightPhase enum
  • A320_FMGC/Guidance/RadioNavModule.vb — VOR/NDB/ILS autotune, register format helpers (registers 5339, 5111, 2605)
  • A320_FMGC/Kernel/KernelActor.vb — GuidanceInput assembly, AircraftState construction from 18-field register cache