Documentation
¶
Index ¶
- Constants
- Variables
- func CheckVideoMapManifest(filename string, e *util.ErrorLogger)
- func IsValidACID(acid string) bool
- func PlausibleFinalAltitude(fp av.FlightPlan, perf av.AircraftPerformance, nmPerLongitude float32, ...) int
- func PrintVideoMaps(path string, e *util.ErrorLogger)
- func TurnAngle(from, to float32, turn TurnMethod) float32
- type ACID
- type Aircraft
- func (ac *Aircraft) ATPAVolume() *av.ATPAVolume
- func (ac *Aircraft) AircraftPerformance() av.AircraftPerformance
- func (ac *Aircraft) Altitude() float32
- func (ac *Aircraft) AltitudeOurDiscretion() *RadioTransmission
- func (ac *Aircraft) ArrivalAirportElevation() float32
- func (ac *Aircraft) ArrivalAirportLocation() math.Point2LL
- func (ac *Aircraft) AssignAltitude(altitude int, afterSpeed bool) *RadioTransmission
- func (ac *Aircraft) AssignHeading(heading int, turn TurnMethod) *RadioTransmission
- func (ac *Aircraft) AssignSpeed(speed int, afterAltitude bool) *RadioTransmission
- func (ac *Aircraft) AssignedApproach() string
- func (ac *Aircraft) AssociateFlightPlan(fp *STARSFlightPlan)
- func (ac *Aircraft) AtFixCleared(fix, approach string) *RadioTransmission
- func (ac *Aircraft) CWT() string
- func (ac *Aircraft) CancelApproachClearance() *RadioTransmission
- func (ac *Aircraft) Check(lg *log.Logger)
- func (ac *Aircraft) ClearedApproach(id string, lg *log.Logger) (*RadioTransmission, error)
- func (ac *Aircraft) ClearedStraightInApproach(id string, lg *log.Logger) (*RadioTransmission, error)
- func (ac *Aircraft) ClimbViaSID() *RadioTransmission
- func (ac *Aircraft) ContactMessage(reportingPoints []av.ReportingPoint) *RadioTransmission
- func (ac *Aircraft) ContactTower(lg *log.Logger) *RadioTransmission
- func (ac *Aircraft) CrossFixAt(fix string, ar *av.AltitudeRestriction, speed int) *RadioTransmission
- func (ac *Aircraft) DepartFixDirect(fixa, fixb string) *RadioTransmission
- func (ac *Aircraft) DepartFixHeading(fix string, hdg int) *RadioTransmission
- func (ac *Aircraft) DepartOnCourse(lg *log.Logger)
- func (ac *Aircraft) DepartureAirportElevation() float32
- func (ac *Aircraft) DepartureAirportLocation() math.Point2LL
- func (ac *Aircraft) DescendViaSTAR() *RadioTransmission
- func (ac *Aircraft) DirectFix(fix string) *RadioTransmission
- func (ac *Aircraft) DisassociateFlightPlan() *STARSFlightPlan
- func (ac *Aircraft) DistanceAlongRoute(fix string) (float32, error)
- func (ac *Aircraft) DistanceToEndOfApproach() (float32, error)
- func (ac *Aircraft) ExpectApproach(id string, ap *av.Airport, lg *log.Logger) *RadioTransmission
- func (ac *Aircraft) ExpediteClimb() *RadioTransmission
- func (ac *Aircraft) ExpediteDescent() *RadioTransmission
- func (ac *Aircraft) FlyPresentHeading() *RadioTransmission
- func (ac *Aircraft) GS() float32
- func (ac *Aircraft) GetRadarTrack(now time.Time) av.RadarTrack
- func (ac *Aircraft) GoAround() *RadioTransmission
- func (ac *Aircraft) Heading() float32
- func (ac *Aircraft) IAS() float32
- func (ac *Aircraft) Ident(now time.Time) *RadioTransmission
- func (ac *Aircraft) InitializeArrival(ap *av.Airport, arr *av.Arrival, nmPerLongitude float32, ...) error
- func (ac *Aircraft) InitializeDeparture(ap *av.Airport, departureAirport string, dep *av.Departure, runway string, ...) error
- func (ac *Aircraft) InitializeFlightPlan(r av.FlightRules, acType, dep, arr string)
- func (ac *Aircraft) InitializeOverflight(of *av.Overflight, nmPerLongitude float32, magneticVariation float32, ...) error
- func (ac *Aircraft) InitializeVFRDeparture(ap *av.Airport, wps av.WaypointArray, randomizeAltitudeRange bool, ...) error
- func (ac *Aircraft) InterceptApproach(lg *log.Logger) *RadioTransmission
- func (ac *Aircraft) IsAirborne() bool
- func (ac *Aircraft) IsArrival() bool
- func (ac *Aircraft) IsAssociated() bool
- func (ac *Aircraft) IsDeparture() bool
- func (ac *Aircraft) IsOverflight() bool
- func (ac *Aircraft) IsUnassociated() bool
- func (ac *Aircraft) MVAsApply() bool
- func (ac *Aircraft) MagneticVariation() float32
- func (ac *Aircraft) MaintainMaximumForward() *RadioTransmission
- func (ac *Aircraft) MaintainSlowestPractical() *RadioTransmission
- func (ac *Aircraft) NavSummary(model *wx.WeatherModel, lg *log.Logger) string
- func (ac *Aircraft) NmPerLongitude() float32
- func (ac *Aircraft) OnApproach(checkAltitude bool) bool
- func (ac *Aircraft) OnExtendedCenterline(maxNmDeviation float32) bool
- func (ac *Aircraft) Position() math.Point2LL
- func (ac *Aircraft) ResumeOwnNavigation() *RadioTransmission
- func (ac *Aircraft) RouteIncludesFix(fix string) bool
- func (ac *Aircraft) SayAltitude() *RadioTransmission
- func (ac *Aircraft) SayHeading() *RadioTransmission
- func (ac *Aircraft) SaySpeed() *RadioTransmission
- func (ac *Aircraft) TAS() float32
- func (ac *Aircraft) TurnLeft(deg int) *RadioTransmission
- func (ac *Aircraft) TurnRight(deg int) *RadioTransmission
- func (ac *Aircraft) Update(model *wx.WeatherModel, bravo *av.AirspaceGrid, lg *log.Logger) *av.Waypoint
- func (ac *Aircraft) Waypoints() []av.Waypoint
- func (ac *Aircraft) WillDoAirwork() bool
- type AircraftDisplayState
- type AircraftTypeSnippetFormatter
- type AirportSnippetFormatter
- type AirspaceAwareness
- type AltRestrictionSnippetFormatter
- type AltSnippetFormatter
- type AppControllerSnippetFormatter
- type ApproachSnippetFormatter
- type ArrivalRunway
- type BasicNumberSnippetFormatter
- type BeaconCodeSnippetFormatter
- type CallsignSnippetFormatter
- type CoordinationList
- type DeferredNavHeading
- type DepControllerSnippetFormatter
- type DepartureAircraft
- type DepartureRunway
- type ERAMComputer
- type Event
- type EventStream
- type EventSubscriberId
- type EventType
- type EventsSubscription
- type FilterRegion
- type FilterRegions
- type FixSnippetFormatter
- type FlightState
- type FlyRacetrackPT
- type FlyStandard45PT
- type FrequencySnippetFormatter
- type FutureChangeSquawk
- type FutureControllerContact
- type FutureOnCourse
- type GlobalMessage
- type GroupFormSnippetFormatter
- type Handoff
- type HeadingArgs
- type HeadingSnippetFormatter
- type InterceptState
- type LaunchConfig
- func (lc *LaunchConfig) CheckRateLimits(limit float32) bool
- func (lc *LaunchConfig) ClampRates(limit float32)
- func (lc *LaunchConfig) TotalArrivalRate() float32
- func (lc *LaunchConfig) TotalDepartureRate() float32
- func (lc *LaunchConfig) TotalInboundFlowRate() float32
- func (lc *LaunchConfig) TotalOverflightRate() float32
- type LetterSnippetFormatter
- type Nav
- func (nav *Nav) AltitudeOurDiscretion() *RadioTransmission
- func (nav *Nav) ApproachHeading(model *wx.WeatherModel, lg *log.Logger) (heading float32, turn TurnMethod)
- func (nav *Nav) AssignAltitude(alt float32, afterSpeed bool) *RadioTransmission
- func (nav *Nav) AssignHeading(hdg float32, turn TurnMethod) *RadioTransmission
- func (nav *Nav) AssignSpeed(speed float32, afterAltitude bool) *RadioTransmission
- func (nav *Nav) AssignedHeading() (float32, bool)
- func (nav *Nav) AssignedWaypoints() []av.Waypoint
- func (nav *Nav) AtFixCleared(fix, id string) *RadioTransmission
- func (nav *Nav) CancelApproachClearance() *RadioTransmission
- func (nav *Nav) Check(lg *log.Logger)
- func (nav *Nav) ClimbViaSID() *RadioTransmission
- func (nav *Nav) ContactMessage(reportingPoints []av.ReportingPoint, star string) *RadioTransmission
- func (nav *Nav) CrossFixAt(fix string, ar *av.AltitudeRestriction, speed int) *RadioTransmission
- func (nav *Nav) DepartFixDirect(fixa string, fixb string) *RadioTransmission
- func (nav *Nav) DepartFixHeading(fix string, hdg float32) *RadioTransmission
- func (nav *Nav) DepartOnCourse(alt float32, exit string)
- func (nav *Nav) DepartureMessage() *RadioTransmission
- func (nav *Nav) DescendViaSTAR() *RadioTransmission
- func (nav *Nav) DirectFix(fix string) *RadioTransmission
- func (nav *Nav) DistanceAlongRoute(fix string) (float32, error)
- func (nav *Nav) EnqueueDirectFix(wps []av.Waypoint)
- func (nav *Nav) EnqueueHeading(hdg float32, turn TurnMethod)
- func (nav *Nav) EnqueueOnCourse()
- func (nav *Nav) ExpectApproach(airport *av.Airport, id string, runwayWaypoints map[string]av.WaypointArray, ...) *RadioTransmission
- func (nav *Nav) ExpediteClimb() *RadioTransmission
- func (nav *Nav) ExpediteDescent() *RadioTransmission
- func (nav *Nav) FlyPresentHeading() *RadioTransmission
- func (nav *Nav) GoAround() *RadioTransmission
- func (nav *Nav) InterceptApproach(airport string, lg *log.Logger) *RadioTransmission
- func (nav *Nav) InterceptedButNotCleared() bool
- func (nav *Nav) IsAirborne() bool
- func (nav *Nav) MaintainMaximumForward() *RadioTransmission
- func (nav *Nav) MaintainSlowestPractical() *RadioTransmission
- func (nav *Nav) OnApproach(checkAltitude bool) bool
- func (nav *Nav) OnExtendedCenterline(maxNmDeviation float32) bool
- func (nav *Nav) ResumeOwnNavigation() *RadioTransmission
- func (nav *Nav) SayAltitude() *RadioTransmission
- func (nav *Nav) SayHeading() *RadioTransmission
- func (nav *Nav) SaySpeed() *RadioTransmission
- func (nav *Nav) Summary(fp av.FlightPlan, model *wx.WeatherModel, lg *log.Logger) string
- func (nav *Nav) TAS() float32
- func (nav *Nav) TargetAltitude(lg *log.Logger) (float32, float32)
- func (nav *Nav) TargetHeading(model *wx.WeatherModel, lg *log.Logger) (heading float32, turn TurnMethod, rate float32)
- func (nav *Nav) TargetSpeed(targetAltitude float32, fp *av.FlightPlan, model *wx.WeatherModel, ...) (float32, float32)
- func (nav *Nav) Update(model *wx.WeatherModel, fp *av.FlightPlan, bravo *av.AirspaceGrid, ...) *av.Waypoint
- type NavAirwork
- type NavAltitude
- type NavApproach
- type NavFixAssignment
- type NavHeading
- type NavSpeed
- type NewSimConfiguration
- type PhraseFormatString
- type PilotSpeech
- type PointOut
- type RadioTransmission
- type RedirectedHandoff
- type ReleaseDeparture
- type RunwayLaunchState
- type SIDSnippetFormatter
- type STARSComputer
- func (sc *STARSComputer) AddHeldDeparture(ac *Aircraft)
- func (sc *STARSComputer) CreateFlightPlan(fp STARSFlightPlan) (STARSFlightPlan, error)
- func (sc *STARSComputer) GetReleaseDepartures() []*Aircraft
- func (sc *STARSComputer) ReleaseDeparture(callsign av.ADSBCallsign) error
- func (sc *STARSComputer) Update(s *Sim)
- type STARSControllerConfig
- type STARSFacilityAdaptation
- type STARSFlightPlan
- type STARSFlightPlanSpecifier
- type STARSFlightPlanType
- type STARSnippetFormatter
- type SignificantPoint
- type Sim
- func (s *Sim) AcceptHandoff(tcp string, acid ACID) error
- func (s *Sim) AcceptRedirectedHandoff(tcp string, acid ACID) error
- func (s *Sim) AcknowledgePointOut(tcp string, acid ACID) error
- func (s *Sim) Activate(lg *log.Logger, ttsProvider TTSProvider)
- func (s *Sim) ActivateFlightPlan(tcp string, callsign av.ADSBCallsign, acid ACID, ...) error
- func (s *Sim) ActiveControllers() []string
- func (s *Sim) AltitudeOurDiscretion(tcp string, callsign av.ADSBCallsign) error
- func (s *Sim) AssignAltitude(tcp string, callsign av.ADSBCallsign, altitude int, afterSpeed bool) error
- func (s *Sim) AssignHeading(hdg *HeadingArgs) error
- func (s *Sim) AssignSpeed(tcp string, callsign av.ADSBCallsign, speed int, afterAltitude bool) error
- func (s *Sim) AssociateFlightPlan(callsign av.ADSBCallsign, spec STARSFlightPlanSpecifier) error
- func (s *Sim) AtFixCleared(tcp string, callsign av.ADSBCallsign, fix, approach string) error
- func (s *Sim) CallsignForACID(acid ACID) (av.ADSBCallsign, bool)
- func (s *Sim) CancelApproachClearance(tcp string, callsign av.ADSBCallsign) error
- func (s *Sim) CancelHandoff(tcp string, acid ACID) error
- func (s *Sim) ChangeControlPosition(fromTCP, toTCP string, keepTracks bool) error
- func (s *Sim) ChangeSquawk(tcp string, callsign av.ADSBCallsign, sq av.Squawk) error
- func (s *Sim) ChangeTransponderMode(tcp string, callsign av.ADSBCallsign, mode av.TransponderMode) error
- func (s *Sim) CheckLeaks()
- func (s *Sim) ClearedApproach(tcp string, callsign av.ADSBCallsign, approach string, straightIn bool) error
- func (s *Sim) ClimbViaSID(tcp string, callsign av.ADSBCallsign) error
- func (s *Sim) ContactController(tcp string, acid ACID, toTCP string) error
- func (s *Sim) ContactTower(tcp string, callsign av.ADSBCallsign) error
- func (s *Sim) ContactTrackingController(tcp string, acid ACID) error
- func (s *Sim) CreateArrival(arrivalGroup string, arrivalAirport string) (*Aircraft, error)
- func (s *Sim) CreateFlightPlan(tcp string, spec STARSFlightPlanSpecifier) error
- func (s *Sim) CreateIFRDeparture(departureAirport, runway, category string) (*Aircraft, error)
- func (s *Sim) CreateOverflight(group string) (*Aircraft, error)
- func (s *Sim) CreateRestrictionArea(ra av.RestrictionArea) (int, error)
- func (s *Sim) CreateVFRDeparture(departureAirport string) (*Aircraft, error)
- func (s *Sim) CrossFixAt(tcp string, callsign av.ADSBCallsign, fix string, ar *av.AltitudeRestriction, ...) error
- func (s *Sim) DeleteAircraft(tcp string, callsign av.ADSBCallsign) error
- func (s *Sim) DeleteAircraftSlice(tcp string, aircraft []Aircraft) error
- func (s *Sim) DeleteAllAircraft(tcp string) error
- func (s *Sim) DeleteFlightPlan(tcp string, acid ACID) error
- func (s *Sim) DeleteRestrictionArea(idx int) error
- func (s *Sim) DepartFixDirect(tcp string, callsign av.ADSBCallsign, fixa string, fixb string) error
- func (s *Sim) DepartFixHeading(tcp string, callsign av.ADSBCallsign, fix string, heading int) error
- func (s *Sim) DescendViaSTAR(tcp string, callsign av.ADSBCallsign) error
- func (s *Sim) Destroy()
- func (s *Sim) DirectFix(tcp string, callsign av.ADSBCallsign, fix string) error
- func (s *Sim) ExpectApproach(tcp string, callsign av.ADSBCallsign, approach string) error
- func (s *Sim) ExpediteClimb(tcp string, callsign av.ADSBCallsign) error
- func (s *Sim) ExpediteDescent(tcp string, callsign av.ADSBCallsign) error
- func (s *Sim) FastForward(tcp string) error
- func (s *Sim) ForceQL(tcp string, acid ACID, controller string) error
- func (s *Sim) GetAircraftDisplayState(callsign av.ADSBCallsign) (AircraftDisplayState, error)
- func (s *Sim) GetAvailableCoveredPositions() (map[string]av.Controller, map[string]av.Controller)
- func (s *Sim) GetControllerSpeech(tcp string) []PilotSpeech
- func (s *Sim) GetFlightPlanForACID(acid ACID) (*STARSFlightPlan, *Aircraft, bool)
- func (s *Sim) GetSerializeSim() Sim
- func (s *Sim) GetStateUpdate(tcp string, update *StateUpdate)
- func (s *Sim) GlobalMessage(tcp, message string) error
- func (s *Sim) GoAround(tcp string, callsign av.ADSBCallsign) error
- func (s *Sim) HandoffTrack(tcp string, acid ACID, toTCP string) error
- func (s *Sim) Ident(tcp string, callsign av.ADSBCallsign) error
- func (s *Sim) IdleTime() time.Duration
- func (s *Sim) InterceptLocalizer(tcp string, callsign av.ADSBCallsign) error
- func (s *Sim) LaunchAircraft(ac Aircraft, departureRunway string)
- func (s *Sim) LogValue() slog.Value
- func (s *Sim) MaintainMaximumForward(tcp string, callsign av.ADSBCallsign) error
- func (s *Sim) MaintainSlowestPractical(tcp string, callsign av.ADSBCallsign) error
- func (s *Sim) ModifyFlightPlan(tcp string, acid ACID, spec STARSFlightPlanSpecifier) error
- func (s *Sim) PointOut(fromTCP string, acid ACID, toTCP string) error
- func (s *Sim) PostEvent(e Event)
- func (s *Sim) Prespawn()
- func (s *Sim) RadarServicesTerminated(tcp string, callsign av.ADSBCallsign) error
- func (s *Sim) RecallPointOut(tcp string, acid ACID) error
- func (s *Sim) RedirectHandoff(tcp string, acid ACID, controller string) error
- func (s *Sim) RejectPointOut(tcp string, acid ACID) error
- func (s *Sim) ReleaseDeparture(tcp string, callsign av.ADSBCallsign) error
- func (s *Sim) RepositionTrack(tcp string, acid ACID, callsign av.ADSBCallsign, p math.Point2LL) error
- func (s *Sim) RequestFlightFollowing() error
- func (s *Sim) ResumeOwnNavigation(tcp string, callsign av.ADSBCallsign) error
- func (s *Sim) SayAltitude(tcp string, callsign av.ADSBCallsign) error
- func (s *Sim) SayHeading(tcp string, callsign av.ADSBCallsign) error
- func (s *Sim) SaySpeed(tcp string, callsign av.ADSBCallsign) error
- func (s *Sim) SetLaunchConfig(tcp string, lc LaunchConfig) error
- func (s *Sim) SetSimRate(tcp string, rate float32) error
- func (s *Sim) SignOff(tcp string) error
- func (s *Sim) SignOn(tcp string, instructor bool, disableTextToSpeech bool) (*State, error)
- func (s *Sim) Step(elapsed time.Duration) bool
- func (s *Sim) TakeOrReturnLaunchControl(tcp string) error
- func (s *Sim) TogglePause(tcp string) error
- func (s *Sim) Update()
- func (s *Sim) UpdateRestrictionArea(idx int, ra av.RestrictionArea) error
- type SnippetFormatter
- type SpeedSnippetFormatter
- type State
- func (ss *State) AreInstructorOrRPO(tcp string) bool
- func (ss *State) BeaconCodeInUse(sq av.Squawk) bool
- func (ss *State) FacilityFromController(callsign string) (string, bool)
- func (ss *State) FindMatchingFlightPlan(s string) *STARSFlightPlan
- func (ss *State) GetAllReleaseDepartures() []ReleaseDeparture
- func (ss *State) GetConsolidatedPositions(id string) []string
- func (ss *State) GetFlightPlanForACID(acid ACID) *STARSFlightPlan
- func (ss *State) GetInitialCenter() math.Point2LL
- func (ss *State) GetInitialRange() float32
- func (ss *State) GetOurTrackByACID(acid ACID) (*Track, bool)
- func (ss *State) GetOurTrackByCallsign(callsign av.ADSBCallsign) (*Track, bool)
- func (ss *State) GetRegularReleaseDepartures() []ReleaseDeparture
- func (ss *State) GetSTARSReleaseDepartures() []ReleaseDeparture
- func (ss *State) GetStateForController(tcp string) *State
- func (ss *State) GetTrackByACID(acid ACID) (*Track, bool)
- func (ss *State) GetTrackByCallsign(callsign av.ADSBCallsign) (*Track, bool)
- func (ss *State) IsExternalController(tcp string) bool
- func (ss *State) IsLocalController(tcp string) bool
- func (ss *State) Locate(s string) (math.Point2LL, bool)
- func (ss *State) ResolveController(tcp string) string
- type StateUpdate
- type TTSProvider
- type TTSSpeechFuture
- type TTSVoicesFuture
- type Track
- type TurnMethod
- type VideoMap
- type VideoMapLibrary
- type VideoMapManifest
- type Voice
- type WaypointCrossingConstraint
Constants ¶
const ( PTStateApproaching = iota PTStateTurningOutbound PTStateFlyingOutbound PTStateTurningInbound PTStateFlyingInbound // parallel entry only )
const ( PT45StateApproaching = iota PT45StateTurningOutbound PT45StateFlyingOutbound PT45StateTurningAway PT45StateFlyingAway PT45StateTurningIn PT45StateFlyingIn PT45StateTurningToIntercept )
const ( LaunchAutomatic int32 = iota LaunchManual )
const MaxIAS = 290
const MaximumRate = 100000
const StandardTurnRate = 3
const UnsetSTARSListIndex = 0
Variables ¶
var ( ErrAircraftAlreadyReleased = errors.New("Aircraft already released") ErrBeaconMismatch = errors.New("Beacon code mismatch") ErrControllerAlreadySignedIn = errors.New("Controller with that callsign already signed in") ErrClearedForUnexpectedApproach = errors.New("Cleared for unexpected approach") ErrDuplicateACID = errors.New("Duplicate ACID") ErrDuplicateBeacon = errors.New("Duplicate beacon code") ErrFixIsTooFarAway = errors.New("Fix is too far away") ErrFixNotInRoute = errors.New("Fix not in aircraft's route") ErrIllegalACID = errors.New("Illegal ACID") ErrIllegalACType = errors.New("Illegal aircraft type") ErrIllegalBeaconCode = errors.New("Illegal beacon code") ErrIllegalFunction = errors.New("Illegal function") ErrIllegalScratchpad = errors.New("Illegal scratchpad") ErrInvalidAbbreviatedFP = errors.New("Invalid abbreviated flight plan") ErrInvalidApproach = errors.New("Invalid approach") ErrInvalidDepartureController = errors.New("Invalid departure controller") ErrInvalidFix = errors.New("Invalid fix") ErrInvalidRestrictionAreaIndex = errors.New("Invalid restriction area index") ErrNoMatchingFlight = errors.New("No matching flight") ErrNoMatchingFlightPlan = errors.New("No matching flight plan") ErrNoVFRAircraftForFlightFollowing = errors.New("No VFR aircraft available for flight following") ErrNotClearedForApproach = errors.New("Aircraft has not been cleared for an approach") ErrNotFlyingRoute = errors.New("Aircraft is not currently flying its assigned route") ErrNotLaunchController = errors.New("Not signed in as the launch controller") ErrTooManyRestrictionAreas = errors.New("Too many restriction areas specified") ErrTrackIsActive = errors.New("Track is already active") ErrTrackIsBeingHandedOff = errors.New("Track is currently being handed off") ErrTrackIsNotActive = errors.New("Track is not active") ErrUnableCommand = errors.New("Unable") ErrUnknownAircraftType = errors.New("Unknown aircraft type") ErrUnknownApproach = errors.New("Unknown approach") ErrUnknownController = errors.New("Unknown controller") ErrUnknownControllerFacility = errors.New("Unknown controller facility") ErrVFRSimTookTooLong = errors.New("VFR simulation took too long") ErrViolatedAirspace = errors.New("Violated B/C airspace") )
Functions ¶
func CheckVideoMapManifest ¶
func CheckVideoMapManifest(filename string, e *util.ErrorLogger)
func IsValidACID ¶
func PlausibleFinalAltitude ¶
func PlausibleFinalAltitude(fp av.FlightPlan, perf av.AircraftPerformance, nmPerLongitude float32, magneticVariation float32, r *rand.Rand) int
func PrintVideoMaps ¶
func PrintVideoMaps(path string, e *util.ErrorLogger)
func TurnAngle ¶
func TurnAngle(from, to float32, turn TurnMethod) float32
Types ¶
type Aircraft ¶
type Aircraft struct {
// This is ADS-B callsign of the aircraft. Just because different the
// callsign in the flight plan can be different across multiple STARS
// facilities, so two different facilities can show different
// callsigns; however, the ADS-B callsign is transmitted from the
// aircraft and would be the same to all facilities.
ADSBCallsign av.ADSBCallsign
Squawk av.Squawk
Mode av.TransponderMode
IdentStartTime, IdentEndTime time.Time
FlightPlan av.FlightPlan
TypeOfFlight av.TypeOfFlight
Strip av.FlightStrip
Nav Nav
// Arrival-related state
STAR string
STARRunwayWaypoints map[string]av.WaypointArray
GotContactTower bool
STARSFlightPlan *STARSFlightPlan
HoldForRelease bool
Released bool // only used for hold for release
ReleaseTime time.Time
WaitingForLaunch bool // for departures
MissingFlightPlan bool
GoAroundDistance *float32
// Departure related state
DepartureContactAltitude float32
// The controller who gave approach clearance
ApproachController string
// Who had control when the fp disassociated due to an arrival filter.
PreArrivalDropController string
InDepartureFilter bool
FirstSeen time.Time
RequestedFlightFollowing bool
Voice Voice
}
func (*Aircraft) ATPAVolume ¶
func (ac *Aircraft) ATPAVolume() *av.ATPAVolume
func (*Aircraft) AircraftPerformance ¶
func (ac *Aircraft) AircraftPerformance() av.AircraftPerformance
func (*Aircraft) AltitudeOurDiscretion ¶
func (ac *Aircraft) AltitudeOurDiscretion() *RadioTransmission
func (*Aircraft) ArrivalAirportElevation ¶
func (*Aircraft) ArrivalAirportLocation ¶
func (*Aircraft) AssignAltitude ¶
func (ac *Aircraft) AssignAltitude(altitude int, afterSpeed bool) *RadioTransmission
func (*Aircraft) AssignHeading ¶
func (ac *Aircraft) AssignHeading(heading int, turn TurnMethod) *RadioTransmission
func (*Aircraft) AssignSpeed ¶
func (ac *Aircraft) AssignSpeed(speed int, afterAltitude bool) *RadioTransmission
func (*Aircraft) AssignedApproach ¶
func (*Aircraft) AssociateFlightPlan ¶
func (ac *Aircraft) AssociateFlightPlan(fp *STARSFlightPlan)
func (*Aircraft) AtFixCleared ¶
func (ac *Aircraft) AtFixCleared(fix, approach string) *RadioTransmission
func (*Aircraft) CancelApproachClearance ¶
func (ac *Aircraft) CancelApproachClearance() *RadioTransmission
func (*Aircraft) ClearedApproach ¶
func (*Aircraft) ClearedStraightInApproach ¶
func (*Aircraft) ClimbViaSID ¶
func (ac *Aircraft) ClimbViaSID() *RadioTransmission
func (*Aircraft) ContactMessage ¶
func (ac *Aircraft) ContactMessage(reportingPoints []av.ReportingPoint) *RadioTransmission
func (*Aircraft) ContactTower ¶
func (ac *Aircraft) ContactTower(lg *log.Logger) *RadioTransmission
func (*Aircraft) CrossFixAt ¶
func (ac *Aircraft) CrossFixAt(fix string, ar *av.AltitudeRestriction, speed int) *RadioTransmission
func (*Aircraft) DepartFixDirect ¶
func (ac *Aircraft) DepartFixDirect(fixa, fixb string) *RadioTransmission
func (*Aircraft) DepartFixHeading ¶
func (ac *Aircraft) DepartFixHeading(fix string, hdg int) *RadioTransmission
func (*Aircraft) DepartOnCourse ¶
func (*Aircraft) DepartureAirportElevation ¶
func (*Aircraft) DepartureAirportLocation ¶
func (*Aircraft) DescendViaSTAR ¶
func (ac *Aircraft) DescendViaSTAR() *RadioTransmission
func (*Aircraft) DirectFix ¶
func (ac *Aircraft) DirectFix(fix string) *RadioTransmission
func (*Aircraft) DisassociateFlightPlan ¶
func (ac *Aircraft) DisassociateFlightPlan() *STARSFlightPlan
func (*Aircraft) DistanceAlongRoute ¶
func (*Aircraft) DistanceToEndOfApproach ¶
func (*Aircraft) ExpectApproach ¶
func (*Aircraft) ExpediteClimb ¶
func (ac *Aircraft) ExpediteClimb() *RadioTransmission
func (*Aircraft) ExpediteDescent ¶
func (ac *Aircraft) ExpediteDescent() *RadioTransmission
func (*Aircraft) FlyPresentHeading ¶
func (ac *Aircraft) FlyPresentHeading() *RadioTransmission
func (*Aircraft) GetRadarTrack ¶
func (ac *Aircraft) GetRadarTrack(now time.Time) av.RadarTrack
func (*Aircraft) GoAround ¶
func (ac *Aircraft) GoAround() *RadioTransmission
func (*Aircraft) InitializeArrival ¶
func (*Aircraft) InitializeDeparture ¶
func (*Aircraft) InitializeFlightPlan ¶
func (ac *Aircraft) InitializeFlightPlan(r av.FlightRules, acType, dep, arr string)
func (*Aircraft) InitializeOverflight ¶
func (*Aircraft) InitializeVFRDeparture ¶
func (*Aircraft) InterceptApproach ¶
func (ac *Aircraft) InterceptApproach(lg *log.Logger) *RadioTransmission
func (*Aircraft) IsAirborne ¶
func (*Aircraft) IsAssociated ¶
func (*Aircraft) IsDeparture ¶
func (*Aircraft) IsOverflight ¶
func (*Aircraft) IsUnassociated ¶
func (*Aircraft) MagneticVariation ¶
func (*Aircraft) MaintainMaximumForward ¶
func (ac *Aircraft) MaintainMaximumForward() *RadioTransmission
func (*Aircraft) MaintainSlowestPractical ¶
func (ac *Aircraft) MaintainSlowestPractical() *RadioTransmission
func (*Aircraft) NavSummary ¶
func (*Aircraft) NmPerLongitude ¶
func (*Aircraft) OnApproach ¶
func (*Aircraft) OnExtendedCenterline ¶
func (*Aircraft) ResumeOwnNavigation ¶
func (ac *Aircraft) ResumeOwnNavigation() *RadioTransmission
func (*Aircraft) RouteIncludesFix ¶
func (*Aircraft) SayAltitude ¶
func (ac *Aircraft) SayAltitude() *RadioTransmission
func (*Aircraft) SayHeading ¶
func (ac *Aircraft) SayHeading() *RadioTransmission
func (*Aircraft) SaySpeed ¶
func (ac *Aircraft) SaySpeed() *RadioTransmission
func (*Aircraft) TurnLeft ¶
func (ac *Aircraft) TurnLeft(deg int) *RadioTransmission
func (*Aircraft) TurnRight ¶
func (ac *Aircraft) TurnRight(deg int) *RadioTransmission
func (*Aircraft) Update ¶
func (ac *Aircraft) Update(model *wx.WeatherModel, bravo *av.AirspaceGrid, lg *log.Logger) *av.Waypoint
func (*Aircraft) WillDoAirwork ¶
type AircraftDisplayState ¶
type AircraftTypeSnippetFormatter ¶
type AircraftTypeSnippetFormatter struct{}
func (AircraftTypeSnippetFormatter) Spoken ¶
func (AircraftTypeSnippetFormatter) Spoken(r *rand.Rand, arg any) string
func (AircraftTypeSnippetFormatter) Validate ¶
func (AircraftTypeSnippetFormatter) Validate(arg any) error
func (AircraftTypeSnippetFormatter) Written ¶
func (AircraftTypeSnippetFormatter) Written(arg any) string
type AirportSnippetFormatter ¶
type AirportSnippetFormatter struct{}
func (AirportSnippetFormatter) Spoken ¶
func (AirportSnippetFormatter) Spoken(r *rand.Rand, arg any) string
func (AirportSnippetFormatter) Validate ¶
func (AirportSnippetFormatter) Validate(arg any) error
func (AirportSnippetFormatter) Written ¶
func (AirportSnippetFormatter) Written(arg any) string
type AirspaceAwareness ¶
type AltRestrictionSnippetFormatter ¶
type AltRestrictionSnippetFormatter struct{}
func (AltRestrictionSnippetFormatter) Spoken ¶
func (AltRestrictionSnippetFormatter) Spoken(r *rand.Rand, arg any) string
func (AltRestrictionSnippetFormatter) Validate ¶
func (AltRestrictionSnippetFormatter) Validate(arg any) error
func (AltRestrictionSnippetFormatter) Written ¶
func (AltRestrictionSnippetFormatter) Written(arg any) string
type AltSnippetFormatter ¶
type AltSnippetFormatter struct{}
AltSnippetFormatter formats altitudes, which may be given as ints or float32s.
func (*AltSnippetFormatter) Spoken ¶
func (a *AltSnippetFormatter) Spoken(r *rand.Rand, arg any) string
func (*AltSnippetFormatter) Validate ¶
func (a *AltSnippetFormatter) Validate(arg any) error
func (*AltSnippetFormatter) Written ¶
func (a *AltSnippetFormatter) Written(arg any) string
type AppControllerSnippetFormatter ¶
type AppControllerSnippetFormatter struct{}
func (AppControllerSnippetFormatter) Spoken ¶
func (AppControllerSnippetFormatter) Spoken(r *rand.Rand, arg any) string
func (AppControllerSnippetFormatter) Validate ¶
func (AppControllerSnippetFormatter) Validate(arg any) error
func (AppControllerSnippetFormatter) Written ¶
func (AppControllerSnippetFormatter) Written(arg any) string
type ApproachSnippetFormatter ¶
type ApproachSnippetFormatter struct{}
func (ApproachSnippetFormatter) Spoken ¶
func (ApproachSnippetFormatter) Spoken(r *rand.Rand, arg any) string
func (ApproachSnippetFormatter) Validate ¶
func (ApproachSnippetFormatter) Validate(arg any) error
func (ApproachSnippetFormatter) Written ¶
func (ApproachSnippetFormatter) Written(arg any) string
type ArrivalRunway ¶
type BasicNumberSnippetFormatter ¶
type BasicNumberSnippetFormatter struct{}
func (BasicNumberSnippetFormatter) Spoken ¶
func (BasicNumberSnippetFormatter) Spoken(r *rand.Rand, arg any) string
func (BasicNumberSnippetFormatter) Validate ¶
func (BasicNumberSnippetFormatter) Validate(arg any) error
func (BasicNumberSnippetFormatter) Written ¶
func (BasicNumberSnippetFormatter) Written(arg any) string
type BeaconCodeSnippetFormatter ¶
type BeaconCodeSnippetFormatter struct{}
func (BeaconCodeSnippetFormatter) Spoken ¶
func (BeaconCodeSnippetFormatter) Spoken(r *rand.Rand, arg any) string
func (BeaconCodeSnippetFormatter) Validate ¶
func (BeaconCodeSnippetFormatter) Validate(arg any) error
func (BeaconCodeSnippetFormatter) Written ¶
func (BeaconCodeSnippetFormatter) Written(arg any) string
type CallsignSnippetFormatter ¶
type CallsignSnippetFormatter struct{}
func (CallsignSnippetFormatter) Spoken ¶
func (CallsignSnippetFormatter) Spoken(r *rand.Rand, arg any) string
func (CallsignSnippetFormatter) Validate ¶
func (CallsignSnippetFormatter) Validate(arg any) error
func (CallsignSnippetFormatter) Written ¶
func (CallsignSnippetFormatter) Written(arg any) string
type CoordinationList ¶
type DeferredNavHeading ¶
type DeferredNavHeading struct {
// Time is just plain old wallclock time; it should be sim time, but a
// lot of replumbing would be required to have that available where
// needed. The downsides are minor: 1. On quit and resume, any pending
// assignments will generally be followed immediately, and 2. if the
// sim rate is increased, the delay will end up being longer than
// intended.
Waypoints []av.Waypoint
}
DeferredNavHeading stores a heading assignment from the controller and the time at which to start executing it; this time is set to be a few seconds after the controller issues it in order to model the delay before pilots start to follow assignments.
type DepControllerSnippetFormatter ¶
type DepControllerSnippetFormatter struct{}
func (DepControllerSnippetFormatter) Spoken ¶
func (DepControllerSnippetFormatter) Spoken(r *rand.Rand, arg any) string
func (DepControllerSnippetFormatter) Validate ¶
func (DepControllerSnippetFormatter) Validate(arg any) error
func (DepControllerSnippetFormatter) Written ¶
func (DepControllerSnippetFormatter) Written(arg any) string
type DepartureAircraft ¶
type DepartureAircraft struct {
ADSBCallsign av.ADSBCallsign
MinSeparation time.Duration // How long after takeoff it will be at ~6000' and airborne
SpawnTime time.Time // when it was first spawned
LaunchTime time.Time // when it was actually launched; used for wake turbulence separation, etc.
// When they're ready to leave the gate
ReadyDepartGateTime time.Time
// HFR-only.
ReleaseRequested bool
ReleaseDelay time.Duration // minimum wait after release before the takeoff roll
RequestReleaseTime time.Time
}
DepartureAircraft represents a departing aircraft, either still on the ground or recently-launched.
type DepartureRunway ¶
type ERAMComputer ¶
type ERAMComputer struct {
SquawkCodePool *av.EnrouteSquawkCodePool
Identifier string
Adaptation av.ERAMAdaptation
}
func (*ERAMComputer) CreateSquawk ¶
func (ec *ERAMComputer) CreateSquawk() (av.Squawk, error)
func (*ERAMComputer) ReturnSquawk ¶
func (ec *ERAMComputer) ReturnSquawk(code av.Squawk) error
func (*ERAMComputer) Update ¶
func (ec *ERAMComputer) Update(s *Sim)
type Event ¶
type Event struct {
Type EventType
ADSBCallsign av.ADSBCallsign
ACID ACID
FromController string
ToController string // For radio transmissions, the controlling controller.
WrittenText string
SpokenText string
RadioTransmissionType av.RadioTransmissionType // For radio transmissions only
LeaderLineDirection *math.CardinalOrdinalDirection // SetGlobalLeaderLineEvent
}
type EventStream ¶
type EventStream struct {
// contains filtered or unexported fields
}
EventStream provides a basic pub/sub event interface that allows any part of the system to post an event to the stream and other parts to subscribe and receive messages from the stream. It is the backbone for communicating events, world updates, and user actions across the various parts of the system.
func NewEventStream ¶
func NewEventStream(lg *log.Logger) *EventStream
func (*EventStream) Destroy ¶
func (e *EventStream) Destroy()
func (*EventStream) LogValue ¶
func (e *EventStream) LogValue() slog.Value
implements slog.LogValuer
func (*EventStream) Post ¶
func (e *EventStream) Post(event Event)
Post adds an event to the event stream. The type used to encode the event is arbitrary; it's up to the EventStream users to establish conventions.
func (*EventStream) Subscribe ¶
func (e *EventStream) Subscribe() *EventsSubscription
Subscribe registers a new subscriber to the stream and returns an EventSubscriberId for the subscriber that can then be passed to other EventStream methods.
type EventSubscriberId ¶
type EventSubscriberId int
type EventType ¶
type EventType int
const ( PushedFlightStripEvent EventType = iota PointOutEvent OfferedHandoffEvent AcceptedHandoffEvent AcceptedRedirectedHandoffEvent CanceledHandoffEvent RejectedHandoffEvent RadioTransmissionEvent StatusMessageEvent ServerBroadcastMessageEvent GlobalMessageEvent AcknowledgedPointOutEvent RejectedPointOutEvent HandoffControlEvent SetGlobalLeaderLineEvent ForceQLEvent TransferAcceptedEvent TransferRejectedEvent RecalledPointOutEvent FlightPlanAssociatedEvent NumEventTypes )
type EventsSubscription ¶
type EventsSubscription struct {
// contains filtered or unexported fields
}
func (*EventsSubscription) Get ¶
func (e *EventsSubscription) Get() []Event
Get returns all of the events from the stream since the last time Get was called with the given id. Note that events before an id was created with Subscribe are never reported for that id.
func (*EventsSubscription) LogValue ¶
func (e *EventsSubscription) LogValue() slog.Value
func (*EventsSubscription) PostEvent ¶
func (e *EventsSubscription) PostEvent(event Event)
func (*EventsSubscription) Unsubscribe ¶
func (e *EventsSubscription) Unsubscribe()
Unsubscribe removes a subscriber from the subscriber list
type FilterRegion ¶
type FilterRegion struct {
av.AirspaceVolume
InvertTest bool
}
type FilterRegions ¶
type FilterRegions []FilterRegion
func (FilterRegions) HaveId ¶
func (r FilterRegions) HaveId(s string) bool
type FixSnippetFormatter ¶
type FixSnippetFormatter struct{}
func (FixSnippetFormatter) Spoken ¶
func (f FixSnippetFormatter) Spoken(r *rand.Rand, arg any) string
func (FixSnippetFormatter) Validate ¶
func (FixSnippetFormatter) Validate(arg any) error
func (FixSnippetFormatter) Written ¶
func (FixSnippetFormatter) Written(arg any) string
type FlightState ¶
type FlightState struct {
InitialDepartureClimb bool
DepartureAirportLocation math.Point2LL
DepartureAirportElevation float32
ArrivalAirport av.Waypoint
ArrivalAirportLocation math.Point2LL
ArrivalAirportElevation float32
MagneticVariation float32
NmPerLongitude float32
Position math.Point2LL
Heading float32
Altitude float32
PrevAltitude float32
IAS, GS float32 // speeds...
BankAngle float32 // degrees
AltitudeRate float32 // + -> climb, - -> descent
}
func (FlightState) LogValue ¶
func (fs FlightState) LogValue() slog.Value
func (*FlightState) Summary ¶
func (fs *FlightState) Summary() string
type FlyRacetrackPT ¶
type FlyRacetrackPT struct {
ProcedureTurn *av.ProcedureTurn
Fix string
FixLocation math.Point2LL
Entry av.RacetrackPTEntry
InboundHeading float32
OutboundHeading float32
OutboundTurnRate float32
OutboundTurnMethod TurnMethod
OutboundLegLength float32
State int
}
func MakeFlyRacetrackPT ¶
func MakeFlyRacetrackPT(nav *Nav, wp []av.Waypoint) *FlyRacetrackPT
func (*FlyRacetrackPT) GetAltitude ¶
func (fp *FlyRacetrackPT) GetAltitude(nav *Nav) (float32, bool)
func (*FlyRacetrackPT) GetHeading ¶
func (fp *FlyRacetrackPT) GetHeading(nav *Nav, model *wx.WeatherModel, lg *log.Logger) (float32, TurnMethod, float32)
type FlyStandard45PT ¶
type FlyStandard45PT struct {
ProcedureTurn *av.ProcedureTurn
Fix string
FixLocation math.Point2LL
InboundHeading float32 // fix->airport
AwayHeading float32 // outbound + 45 offset
State int
SecondsRemaining int
}
func MakeFlyStandard45PT ¶
func MakeFlyStandard45PT(nav *Nav, wp []av.Waypoint) *FlyStandard45PT
func (*FlyStandard45PT) GetHeading ¶
func (fp *FlyStandard45PT) GetHeading(nav *Nav, model *wx.WeatherModel, lg *log.Logger) (float32, TurnMethod, float32)
type FrequencySnippetFormatter ¶
type FrequencySnippetFormatter struct{}
func (FrequencySnippetFormatter) Spoken ¶
func (FrequencySnippetFormatter) Spoken(r *rand.Rand, arg any) string
func (FrequencySnippetFormatter) Validate ¶
func (FrequencySnippetFormatter) Validate(arg any) error
func (FrequencySnippetFormatter) Written ¶
func (FrequencySnippetFormatter) Written(arg any) string
type FutureChangeSquawk ¶
type FutureChangeSquawk struct {
ADSBCallsign av.ADSBCallsign
Code av.Squawk
Mode av.TransponderMode
Time time.Time
}
type FutureControllerContact ¶
type FutureControllerContact struct {
ADSBCallsign av.ADSBCallsign
TCP string
Time time.Time
}
type FutureOnCourse ¶
type FutureOnCourse struct {
ADSBCallsign av.ADSBCallsign
Time time.Time
}
type GlobalMessage ¶
type GroupFormSnippetFormatter ¶
type GroupFormSnippetFormatter struct{}
func (GroupFormSnippetFormatter) Spoken ¶
func (GroupFormSnippetFormatter) Spoken(r *rand.Rand, arg any) string
func (GroupFormSnippetFormatter) Validate ¶
func (GroupFormSnippetFormatter) Validate(arg any) error
func (GroupFormSnippetFormatter) Written ¶
func (GroupFormSnippetFormatter) Written(arg any) string
type HeadingArgs ¶
type HeadingArgs struct {
TCP string
ADSBCallsign av.ADSBCallsign
Heading int
Present bool
LeftDegrees int
RightDegrees int
Turn TurnMethod
}
type HeadingSnippetFormatter ¶
type HeadingSnippetFormatter struct{}
func (HeadingSnippetFormatter) Spoken ¶
func (HeadingSnippetFormatter) Spoken(r *rand.Rand, arg any) string
func (HeadingSnippetFormatter) Validate ¶
func (HeadingSnippetFormatter) Validate(arg any) error
func (HeadingSnippetFormatter) Written ¶
func (HeadingSnippetFormatter) Written(arg any) string
type InterceptState ¶
type InterceptState int
const ( NotIntercepting InterceptState = iota InitialHeading TurningToJoin OnApproachCourse )
type LaunchConfig ¶
type LaunchConfig struct {
// Controller is the controller in charge of the launch settings; if empty then
// launch control may be taken by any signed in controller.
Controller string
// LaunchManual or LaunchAutomatic
Mode int32
GoAroundRate float32
// airport -> runway -> category -> rate
DepartureRates map[string]map[string]map[string]float32
DepartureRateScale float32
VFRDepartureRateScale float32
VFRAirportRates map[string]int // name -> VFRRateSum()
VFFRequestRate int32
HaveVFRReportingRegions bool
// inbound flow -> airport / "overflights" -> rate
InboundFlowRates map[string]map[string]float32
InboundFlowRateScale float32
ArrivalPushes bool
ArrivalPushFrequencyMinutes int
ArrivalPushLengthMinutes int
}
LaunchConfig collects settings related to launching aircraft in the sim; it's passed back and forth between client and server: server provides them so client can draw the UI for what's available, then client returns one back when launching.
func MakeLaunchConfig ¶
func MakeLaunchConfig(dep []DepartureRunway, vfrRateScale float32, vfrAirports map[string]*av.Airport, inbound map[string]map[string]int, haveVFRReportingRegions bool) LaunchConfig
func (*LaunchConfig) CheckRateLimits ¶
func (lc *LaunchConfig) CheckRateLimits(limit float32) bool
CheckRateLimits returns true if both total departure rates and total inbound flow rates sum to less than the provided limit (aircraft per hour)
func (*LaunchConfig) ClampRates ¶
func (lc *LaunchConfig) ClampRates(limit float32)
ClampRates adjusts the rate scale variables to ensure the total launch rate does not exceed the given limit (aircraft per hour)
func (*LaunchConfig) TotalArrivalRate ¶
func (lc *LaunchConfig) TotalArrivalRate() float32
TotalArrivalRate returns the total arrival rate (aircraft per hour) excluding overflights
func (*LaunchConfig) TotalDepartureRate ¶
func (lc *LaunchConfig) TotalDepartureRate() float32
TotalDepartureRate returns the total departure rate (aircraft per hour) for all airports and runways
func (*LaunchConfig) TotalInboundFlowRate ¶
func (lc *LaunchConfig) TotalInboundFlowRate() float32
TotalInboundFlowRate returns the total inbound flow rate (aircraft per hour) for all flows
func (*LaunchConfig) TotalOverflightRate ¶
func (lc *LaunchConfig) TotalOverflightRate() float32
TotalOverflightRate returns the total overflight rate (aircraft per hour)
type LetterSnippetFormatter ¶
type LetterSnippetFormatter struct{}
func (LetterSnippetFormatter) Spoken ¶
func (LetterSnippetFormatter) Spoken(r *rand.Rand, arg any) string
func (LetterSnippetFormatter) Validate ¶
func (LetterSnippetFormatter) Validate(arg any) error
func (LetterSnippetFormatter) Written ¶
func (LetterSnippetFormatter) Written(arg any) string
type Nav ¶
type Nav struct {
// controller that the pilot has not yet started to follow. Note that
// only a single such assignment is stored; for example, if the
// controller issues a first heading and then a second shortly
// afterward, before the first has been followed, it's fine for the
// second to override it.
DeferredNavHeading *DeferredNavHeading
}
State related to navigation. Pointers are used for optional values; nil -> unset/unspecified.
func MakeArrivalNav ¶
func MakeArrivalNav(callsign av.ADSBCallsign, arr *av.Arrival, fp av.FlightPlan, perf av.AircraftPerformance, nmPerLongitude float32, magneticVariation float32, model *wx.WeatherModel, lg *log.Logger) *Nav
func MakeDepartureNav ¶
func MakeDepartureNav(callsign av.ADSBCallsign, fp av.FlightPlan, perf av.AircraftPerformance, assignedAlt, clearedAlt, speedRestriction int, wp []av.Waypoint, randomizeAltitudeRange bool, nmPerLongitude float32, magneticVariation float32, model *wx.WeatherModel, lg *log.Logger) *Nav
func MakeOverflightNav ¶
func MakeOverflightNav(callsign av.ADSBCallsign, of *av.Overflight, fp av.FlightPlan, perf av.AircraftPerformance, nmPerLongitude float32, magneticVariation float32, model *wx.WeatherModel, lg *log.Logger) *Nav
func (*Nav) AltitudeOurDiscretion ¶
func (nav *Nav) AltitudeOurDiscretion() *RadioTransmission
func (*Nav) ApproachHeading ¶
func (nav *Nav) ApproachHeading(model *wx.WeatherModel, lg *log.Logger) (heading float32, turn TurnMethod)
func (*Nav) AssignAltitude ¶
func (nav *Nav) AssignAltitude(alt float32, afterSpeed bool) *RadioTransmission
func (*Nav) AssignHeading ¶
func (nav *Nav) AssignHeading(hdg float32, turn TurnMethod) *RadioTransmission
func (*Nav) AssignSpeed ¶
func (nav *Nav) AssignSpeed(speed float32, afterAltitude bool) *RadioTransmission
func (*Nav) AssignedHeading ¶
AssignedHeading returns the aircraft's current heading assignment, if any, regardless of whether the pilot has yet started following it.
func (*Nav) AssignedWaypoints ¶
AssignedWaypoints returns the route that should be flown following a controller instruction. If an instruction has been issued but the delay hasn't passed, these are different than the waypoints currently being used for navigation.
func (*Nav) AtFixCleared ¶
func (nav *Nav) AtFixCleared(fix, id string) *RadioTransmission
func (*Nav) CancelApproachClearance ¶
func (nav *Nav) CancelApproachClearance() *RadioTransmission
func (*Nav) ClimbViaSID ¶
func (nav *Nav) ClimbViaSID() *RadioTransmission
func (*Nav) ContactMessage ¶
func (nav *Nav) ContactMessage(reportingPoints []av.ReportingPoint, star string) *RadioTransmission
func (*Nav) CrossFixAt ¶
func (nav *Nav) CrossFixAt(fix string, ar *av.AltitudeRestriction, speed int) *RadioTransmission
func (*Nav) DepartFixDirect ¶
func (nav *Nav) DepartFixDirect(fixa string, fixb string) *RadioTransmission
func (*Nav) DepartFixHeading ¶
func (nav *Nav) DepartFixHeading(fix string, hdg float32) *RadioTransmission
func (*Nav) DepartOnCourse ¶
func (*Nav) DepartureMessage ¶
func (nav *Nav) DepartureMessage() *RadioTransmission
func (*Nav) DescendViaSTAR ¶
func (nav *Nav) DescendViaSTAR() *RadioTransmission
func (*Nav) DirectFix ¶
func (nav *Nav) DirectFix(fix string) *RadioTransmission
func (*Nav) EnqueueDirectFix ¶
func (*Nav) EnqueueHeading ¶
func (nav *Nav) EnqueueHeading(hdg float32, turn TurnMethod)
EnqueueHeading enqueues the given heading assignment to be followed a few seconds in the future. It should only be called for heading changes due to controller instructions to the pilot and never in cases where the autopilot is changing the heading assignment.
func (*Nav) EnqueueOnCourse ¶
func (nav *Nav) EnqueueOnCourse()
func (*Nav) ExpectApproach ¶
func (nav *Nav) ExpectApproach(airport *av.Airport, id string, runwayWaypoints map[string]av.WaypointArray, lg *log.Logger) *RadioTransmission
func (*Nav) ExpediteClimb ¶
func (nav *Nav) ExpediteClimb() *RadioTransmission
func (*Nav) ExpediteDescent ¶
func (nav *Nav) ExpediteDescent() *RadioTransmission
func (*Nav) FlyPresentHeading ¶
func (nav *Nav) FlyPresentHeading() *RadioTransmission
func (*Nav) GoAround ¶
func (nav *Nav) GoAround() *RadioTransmission
func (*Nav) InterceptApproach ¶
func (nav *Nav) InterceptApproach(airport string, lg *log.Logger) *RadioTransmission
func (*Nav) InterceptedButNotCleared ¶
func (*Nav) IsAirborne ¶
func (*Nav) MaintainMaximumForward ¶
func (nav *Nav) MaintainMaximumForward() *RadioTransmission
func (*Nav) MaintainSlowestPractical ¶
func (nav *Nav) MaintainSlowestPractical() *RadioTransmission
func (*Nav) OnApproach ¶
func (*Nav) OnExtendedCenterline ¶
OnExtendedCenterline checks if the flight position is less than maxNmDeviation from the infinite line defined by the assigned approach localizer
func (*Nav) ResumeOwnNavigation ¶
func (nav *Nav) ResumeOwnNavigation() *RadioTransmission
func (*Nav) SayAltitude ¶
func (nav *Nav) SayAltitude() *RadioTransmission
func (*Nav) SayHeading ¶
func (nav *Nav) SayHeading() *RadioTransmission
func (*Nav) SaySpeed ¶
func (nav *Nav) SaySpeed() *RadioTransmission
func (*Nav) Summary ¶
func (nav *Nav) Summary(fp av.FlightPlan, model *wx.WeatherModel, lg *log.Logger) string
Full human-readable summary of nav state for use when paused and mouse hover on the scope
func (*Nav) TargetHeading ¶
func (nav *Nav) TargetHeading(model *wx.WeatherModel, lg *log.Logger) (heading float32, turn TurnMethod, rate float32)
func (*Nav) TargetSpeed ¶
func (nav *Nav) TargetSpeed(targetAltitude float32, fp *av.FlightPlan, model *wx.WeatherModel, bravo *av.AirspaceGrid, lg *log.Logger) (float32, float32)
func (*Nav) Update ¶
func (nav *Nav) Update(model *wx.WeatherModel, fp *av.FlightPlan, bravo *av.AirspaceGrid, lg *log.Logger) *av.Waypoint
returns passed waypoint if any
type NavAirwork ¶
type NavAirwork struct {
}
func StartAirwork ¶
func StartAirwork(wp av.Waypoint, nav Nav) *NavAirwork
func (*NavAirwork) Start360 ¶
func (aw *NavAirwork) Start360(nav Nav)
func (*NavAirwork) TargetAltitude ¶
func (aw *NavAirwork) TargetAltitude() (float32, float32)
func (*NavAirwork) TargetHeading ¶
func (aw *NavAirwork) TargetHeading() (heading float32, turn TurnMethod, rate float32)
func (*NavAirwork) TargetSpeed ¶
func (aw *NavAirwork) TargetSpeed() (float32, float32, bool)
func (*NavAirwork) Update ¶
func (aw *NavAirwork) Update(nav *Nav) bool
type NavAltitude ¶
type NavAltitude struct {
// restriction at the way point; we keep trying until we get there (or
// are given another instruction..)
Restriction *av.AltitudeRestriction
}
type NavApproach ¶
type NavApproach struct {
}
type NavFixAssignment ¶
type NavHeading ¶
type NavHeading struct {
}
type NewSimConfiguration ¶
type NewSimConfiguration struct {
TRACON string
Description string
Airports map[string]*av.Airport
PrimaryAirport string
DepartureRunways []DepartureRunway
ArrivalRunways []ArrivalRunway
InboundFlows map[string]*av.InboundFlow
LaunchConfig LaunchConfig
Fixes map[string]math.Point2LL
VFRReportingPoints []av.VFRReportingPoint
ControlPositions map[string]*av.Controller
PrimaryController string
ControllerAirspace map[string][]string
VirtualControllers []string
MultiControllers av.SplitConfiguration
SignOnPositions map[string]*av.Controller
TFRs []av.TFR
Wind map[math.Point2LL][]wx.WindLayer
STARSFacilityAdaptation STARSFacilityAdaptation
IsLocal bool
EnforceUniqueCallsignSuffix bool
ReportingPoints []av.ReportingPoint
MagneticVariation float32
NmPerLongitude float32
Center math.Point2LL
Range float32
DefaultMaps []string
Airspace av.Airspace
TTSProvider TTSProvider
}
NewSimConfiguration collects all of the information required to create a new Sim
type PhraseFormatString ¶
type PhraseFormatString string
PhraseFormatString is a string that potentially includes
func (PhraseFormatString) Spoken ¶
func (s PhraseFormatString) Spoken(r *rand.Rand, args []any) string
type PilotSpeech ¶
type PilotSpeech struct {
Callsign av.ADSBCallsign
Type av.RadioTransmissionType
Text string
MP3 []byte
}
type RadioTransmission ¶
type RadioTransmission struct {
Strings []PhraseFormatString
Args [][]any // each slice contains values passed to the corresponding PhraseFormatString
Controller string
Type av.RadioTransmissionType
}
RadioTransmission holds components that together represent a single radio transmission by a pilot; they may be built up from multiple instructions provided in a single controller command.
func MakeContactTransmission ¶
func MakeContactTransmission(s string, args ...any) *RadioTransmission
MakeContactRadioTransmission is a helper function to make a pilot transmission for initial contact from a single formatting string and set of arguments.
func MakeReadbackTransmission ¶
func MakeReadbackTransmission(s string, args ...any) *RadioTransmission
MakeReadbackTransmission is a helper function to make a pilot transmission of a readback from a single formatting string and set of arguments.
func MakeUnexpectedTransmission ¶
func MakeUnexpectedTransmission(s string, args ...any) *RadioTransmission
MakeUnexpectedTransmission similarly makes a single pilot transmission from the provided format string and arguments, but also marks the transmission as unexpected.
func (*RadioTransmission) Add ¶
func (rt *RadioTransmission) Add(s string, args ...any)
Add is a convenience function to add a transmission snippet to the RadioTransmission. It's more or less equivalent to calling Merge(MakeRadioTransmission(...)).
func (*RadioTransmission) Merge ¶
func (rt *RadioTransmission) Merge(r *RadioTransmission)
Merge takes a separately-constructed RadioTransmission and merges its contents with the current one.
func (RadioTransmission) Spoken ¶
func (rt RadioTransmission) Spoken(r *rand.Rand) string
Spoken returns a string corresponding to how the transmission should be spoken, which appropriate phonetic substitutions made (e.g. "9" -> "niner").
func (*RadioTransmission) Validate ¶
func (rt *RadioTransmission) Validate(lg *log.Logger)
Validate ensures that the types of arguments match with the formatting directives in the PhraseFormatStrings; errors are logged to the provided logger.
type RedirectedHandoff ¶
type RedirectedHandoff struct {
OriginalOwner string // Controller callsign
Redirector []string // Controller callsign
RedirectedTo string // Controller callsign
}
func (*RedirectedHandoff) AddRedirector ¶
func (rd *RedirectedHandoff) AddRedirector(ctrl *av.Controller)
func (*RedirectedHandoff) GetLastRedirector ¶
func (rd *RedirectedHandoff) GetLastRedirector() string
func (*RedirectedHandoff) ShouldFallbackToHandoff ¶
func (rd *RedirectedHandoff) ShouldFallbackToHandoff(ctrl, octrl string) bool
func (*RedirectedHandoff) ShowRDIndicator ¶
func (rd *RedirectedHandoff) ShowRDIndicator(callsign string, RDIndicatorEnd time.Time) bool
type ReleaseDeparture ¶
type RunwayLaunchState ¶
type RunwayLaunchState struct {
IFRSpawnRate float32
VFRSpawnRate float32
// For each runway, when to create the next departing aircraft, based
// on the runway departure rate. The actual time an aircraft is
// launched may be later, e.g. if we need longer for wake turbulence
// separation, etc.
NextIFRSpawn time.Time
NextVFRSpawn time.Time
// At the gate, flight plan filed (if IFR), not yet ready to go
Gate []DepartureAircraft
// Ready to go, in hold for release purgatory.
Held []DepartureAircraft
// Ready to go.
ReleasedIFR []DepartureAircraft
ReleasedVFR []DepartureAircraft
// Sequenced departures, pulled from Released. These are launched in-order.
Sequenced []DepartureAircraft
LastDeparture *DepartureAircraft
LastArrivalLandingTime time.Time // when the last arrival landed on this runway
LastArrivalFlightRules av.FlightRules // flight rules of the last arrival that landed
VFRAttempts int
VFRSuccesses int
}
type SIDSnippetFormatter ¶
type SIDSnippetFormatter struct{}
func (SIDSnippetFormatter) Validate ¶
func (SIDSnippetFormatter) Validate(arg any) error
func (SIDSnippetFormatter) Written ¶
func (s SIDSnippetFormatter) Written(arg any) string
type STARSComputer ¶
type STARSComputer struct {
Identifier string
FlightPlans []*STARSFlightPlan
HoldForRelease []*Aircraft
AvailableIndices []int
}
func (*STARSComputer) AddHeldDeparture ¶
func (sc *STARSComputer) AddHeldDeparture(ac *Aircraft)
func (*STARSComputer) CreateFlightPlan ¶
func (sc *STARSComputer) CreateFlightPlan(fp STARSFlightPlan) (STARSFlightPlan, error)
func (*STARSComputer) GetReleaseDepartures ¶
func (sc *STARSComputer) GetReleaseDepartures() []*Aircraft
func (*STARSComputer) ReleaseDeparture ¶
func (sc *STARSComputer) ReleaseDeparture(callsign av.ADSBCallsign) error
func (*STARSComputer) Update ¶
func (sc *STARSComputer) Update(s *Sim)
type STARSControllerConfig ¶
type STARSControllerConfig struct {
VideoMapNames []string `json:"video_maps"`
DefaultMaps []string `json:"default_maps"`
Center math.Point2LL `json:"-"`
CenterString string `json:"center"`
Range float32 `json:"range"`
MonitoredBeaconCodeBlocksString *string `json:"beacon_code_blocks"`
MonitoredBeaconCodeBlocks []av.Squawk
FlightFollowingAirspace []av.AirspaceVolume `json:"flight_following_airspace"`
}
type STARSFacilityAdaptation ¶
type STARSFacilityAdaptation struct {
AirspaceAwareness []AirspaceAwareness `json:"airspace_awareness"`
ForceQLToSelf bool `json:"force_ql_self"`
AllowLongScratchpad bool `json:"allow_long_scratchpad"`
VideoMapNames []string `json:"stars_maps"`
VideoMapLabels map[string]string `json:"map_labels"`
ControllerConfigs map[string]*STARSControllerConfig `json:"controller_configs"`
RadarSites map[string]*av.RadarSite `json:"radar_sites"`
Center math.Point2LL `json:"-"`
CenterString string `json:"center"`
Range float32 `json:"range"`
Scratchpads map[string]string `json:"scratchpads"`
SignificantPoints map[string]SignificantPoint `json:"significant_points"`
Altimeters []string `json:"altimeters"`
// Airpsace filters
Filters struct {
ArrivalAcquisition FilterRegions `json:"arrival_acquisition"`
ArrivalDrop FilterRegions `json:"arrival_drop"`
DepartureAcquisition FilterRegions `json:"departure_acquisition"`
InhibitCA FilterRegions `json:"inhibit_ca"`
InhibitMSAW FilterRegions `json:"inhibit_msaw"`
Quicklook FilterRegions `json:"quicklook"`
SecondaryDrop FilterRegions `json:"secondary_drop"`
SurfaceTracking FilterRegions `json:"surface_tracking"`
VFRInhibit FilterRegions `json:"vfr_inhibit"`
} `json:"filters"`
MonitoredBeaconCodeBlocksString *string
MonitoredBeaconCodeBlocks []av.Squawk
UntrackedPositionSymbolOverrides struct {
CodeRangesString string `json:"beacon_codes"`
CodeRanges [][2]av.Squawk // inclusive
Symbol string `json:"symbol"`
} `json:"untracked_position_symbol_overrides"`
VideoMapFile string `json:"video_map_file"`
CoordinationFixes map[string]av.AdaptationFixes `json:"coordination_fixes"`
SingleCharAIDs map[string]string `json:"single_char_aids"` // Char to airport
KeepLDB bool `json:"keep_ldb"`
FullLDBSeconds int `json:"full_ldb_seconds"`
SSRCodes av.LocalSquawkCodePoolSpecifier `json:"ssr_codes"`
HandoffAcceptFlashDuration int `json:"handoff_acceptance_flash_duration"`
DisplayHOFacilityOnly bool `json:"display_handoff_facility_only"`
HOSectorDisplayDuration int `json:"handoff_sector_display_duration"`
FlightPlan struct {
QuickACID string `json:"quick_acid"`
ACIDExpansions map[string]string `json:"acid_expansions"`
ModifyAfterDisplay bool `json:"modify_after_display"`
} `json:"flight_plan"`
PDB struct {
ShowScratchpad2 bool `json:"show_scratchpad2"`
HideGroundspeed bool `json:"hide_gs"`
ShowAircraftType bool `json:"show_aircraft_type"`
SplitGSAndCWT bool `json:"split_gs_and_cwt"`
DisplayCustomSPCs bool `json:"display_custom_spcs"`
} `json:"pdb"`
FDB struct {
DisplayRequestedAltitude bool `json:"display_requested_altitude"`
Scratchpad2OnLine3 bool `json:"scratchpad2_on_line3"`
} `json:"fdb"`
Scratchpad1 struct {
DisplayExitFix bool `json:"display_exit_fix"`
DisplayExitFix1 bool `json:"display_exit_fix_1"`
DisplayExitGate bool `json:"display_exit_gate"`
DisplayAltExitGate bool `json:"display_alternate_exit_gate"`
} `json:"scratchpad1"`
CustomSPCs []string `json:"custom_spcs"`
CoordinationLists []CoordinationList `json:"coordination_lists"`
VFRList struct {
Format string `json:"format"`
} `json:"vfr_list"`
TABList struct {
Format string `json:"format"`
} `json:"tab_list"`
CoastSuspendList struct {
Format string `json:"format"`
} `json:"coast_suspend_list"`
MCISuppressionList struct {
Format string `json:"format"`
} `json:"mci_suppression_list"`
TowerList struct {
Format string `json:"format"`
} `json:"tower_list"`
RestrictionAreas []av.RestrictionArea `json:"restriction_areas"`
UseLegacyFont bool `json:"use_legacy_font"`
}
func (STARSFacilityAdaptation) CheckScratchpad ¶
func (fa STARSFacilityAdaptation) CheckScratchpad(sp string) bool
func (*STARSFacilityAdaptation) PostDeserialize ¶
func (fa *STARSFacilityAdaptation) PostDeserialize(loc av.Locator, controlledAirports []string, allAirports []string, e *util.ErrorLogger)
type STARSFlightPlan ¶
type STARSFlightPlan struct {
ACID ACID
EntryFix string
ExitFix string
ExitFixIsIntermediate bool
Rules av.FlightRules
CoordinationTime time.Time
PlanType STARSFlightPlanType
AssignedSquawk av.Squawk
TrackingController string // Who has the radar track
ControllingController string // Who has control; not necessarily the same as TrackingController
HandoffTrackController string // Handoff offered but not yet accepted
LastLocalController string // (May be the current controller.)
AircraftCount int
AircraftType string
EquipmentSuffix string
TypeOfFlight av.TypeOfFlight
AssignedAltitude int
RequestedAltitude int
PilotReportedAltitude int
Scratchpad string
SecondaryScratchpad string
PriorScratchpad string
PriorSecondaryScratchpad string
RNAV bool
Location math.Point2LL
PointOutHistory []string
InhibitModeCAltitudeDisplay bool
SPCOverride string
DisableMSAW bool
DisableCA bool
MCISuppressedCode av.Squawk
GlobalLeaderLineDirection *math.CardinalOrdinalDirection
QuickFlightPlan bool
HoldState bool
Suspended bool
CoastSuspendIndex int
// FIXME: the following are all used internally by NAS code. It's
// convenient to have them here but this stuff should just be managed
// internally there.
ListIndex int
// First controller in the local facility to get the track: used both
// for /ho and for departures
InboundHandoffController string
CoordinationFix string
ContainedFacilities []string
RedirectedHandoff RedirectedHandoff
InhibitACTypeDisplay bool
ForceACTypeDisplayEndTime time.Time
CWTCategory string
// After fps are dropped, we hold on to them for a bit before they're
// actually deleted.
DeleteTime time.Time
// Used so that such FPs can associate regardless of acquisition filters.
ManuallyCreated bool
}
func (*STARSFlightPlan) Update ¶
func (fp *STARSFlightPlan) Update(spec STARSFlightPlanSpecifier, localPool *av.LocalSquawkCodePool, nasPool *av.EnrouteSquawkCodePool) (err error)
type STARSFlightPlanSpecifier ¶
type STARSFlightPlanSpecifier struct {
ACID util.Optional[ACID]
EntryFix util.Optional[string]
ExitFix util.Optional[string]
ExitFixIsIntermediate util.Optional[bool]
Rules util.Optional[av.FlightRules]
CoordinationTime util.Optional[time.Time]
PlanType util.Optional[STARSFlightPlanType]
SquawkAssignment util.Optional[string]
ImplicitSquawkAssignment util.Optional[av.Squawk] // only used when taking the track's current code
TrackingController util.Optional[string]
AircraftCount util.Optional[int]
AircraftType util.Optional[string]
EquipmentSuffix util.Optional[string]
TypeOfFlight util.Optional[av.TypeOfFlight]
AssignedAltitude util.Optional[int]
RequestedAltitude util.Optional[int]
PilotReportedAltitude util.Optional[int]
Scratchpad util.Optional[string]
SecondaryScratchpad util.Optional[string]
RNAV util.Optional[bool]
RNAVToggle util.Optional[bool]
Location util.Optional[math.Point2LL]
PointOutHistory util.Optional[[]string]
InhibitModeCAltitudeDisplay util.Optional[bool]
SPCOverride util.Optional[string]
DisableMSAW util.Optional[bool]
DisableCA util.Optional[bool]
MCISuppressedCode util.Optional[av.Squawk]
GlobalLeaderLineDirection util.Optional[*math.CardinalOrdinalDirection]
QuickFlightPlan util.Optional[bool]
HoldState util.Optional[bool]
Suspended util.Optional[bool]
CoastSuspendIndex util.Optional[int]
InhibitACTypeDisplay util.Optional[bool]
ForceACTypeDisplayEndTime util.Optional[time.Time]
}
func (STARSFlightPlanSpecifier) GetFlightPlan ¶
func (s STARSFlightPlanSpecifier) GetFlightPlan(localPool *av.LocalSquawkCodePool, nasPool *av.EnrouteSquawkCodePool) (STARSFlightPlan, error)
type STARSFlightPlanType ¶
type STARSFlightPlanType int
const ( UnknownFlightPlanType STARSFlightPlanType = iota // Flight plan received from a NAS ARTCC. This is a flight plan that // has been sent over by an overlying ERAM facility. RemoteEnroute // Flight plan received from an adjacent terminal facility This is a // flight plan that has been sent over by another STARS facility. RemoteNonEnroute // VFR interfacility flight plan entered locally for which the NAS // ARTCC has not returned a flight plan This is a flight plan that is // made by a STARS facility that gets a NAS code. LocalEnroute // Flight plan entered by TCW or flight plan from an adjacent terminal // that has been handed off to this STARS facility This is a flight // plan that is made at a STARS facility and gets a local code. LocalNonEnroute )
Flight plan types (STARS)
type STARSnippetFormatter ¶
type STARSnippetFormatter struct{}
func (STARSnippetFormatter) Spoken ¶
func (STARSnippetFormatter) Spoken(r *rand.Rand, arg any) string
func (STARSnippetFormatter) Validate ¶
func (STARSnippetFormatter) Validate(arg any) error
func (STARSnippetFormatter) Written ¶
func (s STARSnippetFormatter) Written(arg any) string
type SignificantPoint ¶
type Sim ¶
type Sim struct {
State *State
Aircraft map[av.ADSBCallsign]*Aircraft
SignOnPositions map[string]*av.Controller
STARSComputer *STARSComputer
ERAMComputer *ERAMComputer
LocalCodePool *av.LocalSquawkCodePool
GenerationIndex int // for sequencing StateUpdates
VFRReportingPoints []av.VFRReportingPoint
// Airport -> runway -> state
DepartureState map[string]map[string]*RunwayLaunchState
// Key is inbound flow group name
NextInboundSpawn map[string]time.Time
NextVFFRequest time.Time
Handoffs map[ACID]Handoff
PointOuts map[ACID]PointOut
ReportingPoints []av.ReportingPoint
EnforceUniqueCallsignSuffix bool
FutureControllerContacts []FutureControllerContact
FutureOnCourse []FutureOnCourse
FutureSquawkChanges []FutureChangeSquawk
NextPushStart time.Time // both w.r.t. sim time
PushEnd time.Time
Instructors map[string]bool
Rand *rand.Rand
SquawkWarnedACIDs map[ACID]interface{} // Warn once in CheckLeaks(); don't spam the logs
// contains filtered or unexported fields
}
func NewSim ¶
func NewSim(config NewSimConfiguration, manifest *VideoMapManifest, lg *log.Logger) *Sim
func (*Sim) AcceptRedirectedHandoff ¶
func (*Sim) ActivateFlightPlan ¶
func (s *Sim) ActivateFlightPlan(tcp string, callsign av.ADSBCallsign, acid ACID, spec *STARSFlightPlanSpecifier) error
Flight plan for acid must already exist; spec gives optional amendments.
func (*Sim) ActiveControllers ¶
func (*Sim) AltitudeOurDiscretion ¶
func (s *Sim) AltitudeOurDiscretion(tcp string, callsign av.ADSBCallsign) error
func (*Sim) AssignAltitude ¶
func (*Sim) AssignHeading ¶
func (s *Sim) AssignHeading(hdg *HeadingArgs) error
func (*Sim) AssignSpeed ¶
func (*Sim) AssociateFlightPlan ¶
func (s *Sim) AssociateFlightPlan(callsign av.ADSBCallsign, spec STARSFlightPlanSpecifier) error
Associate the specified flight plan with the track. Flight plan for ACID must not already exist.
func (*Sim) AtFixCleared ¶
func (*Sim) CallsignForACID ¶
func (s *Sim) CallsignForACID(acid ACID) (av.ADSBCallsign, bool)
func (*Sim) CancelApproachClearance ¶
func (s *Sim) CancelApproachClearance(tcp string, callsign av.ADSBCallsign) error
func (*Sim) ChangeControlPosition ¶
func (*Sim) ChangeSquawk ¶
func (*Sim) ChangeTransponderMode ¶
func (s *Sim) ChangeTransponderMode(tcp string, callsign av.ADSBCallsign, mode av.TransponderMode) error
func (*Sim) CheckLeaks ¶
func (s *Sim) CheckLeaks()
Make sure we're not leaking beacon codes or list indices.
func (*Sim) ClearedApproach ¶
func (*Sim) ClimbViaSID ¶
func (s *Sim) ClimbViaSID(tcp string, callsign av.ADSBCallsign) error
func (*Sim) ContactController ¶
func (*Sim) ContactTower ¶
func (s *Sim) ContactTower(tcp string, callsign av.ADSBCallsign) error
func (*Sim) ContactTrackingController ¶
func (*Sim) CreateArrival ¶
func (*Sim) CreateFlightPlan ¶
func (s *Sim) CreateFlightPlan(tcp string, spec STARSFlightPlanSpecifier) error
func (*Sim) CreateIFRDeparture ¶
func (*Sim) CreateRestrictionArea ¶
func (s *Sim) CreateRestrictionArea(ra av.RestrictionArea) (int, error)
func (*Sim) CreateVFRDeparture ¶
Note that this may fail without an error if it's having trouble finding a route.
func (*Sim) CrossFixAt ¶
func (s *Sim) CrossFixAt(tcp string, callsign av.ADSBCallsign, fix string, ar *av.AltitudeRestriction, speed int) error
func (*Sim) DeleteAircraft ¶
func (s *Sim) DeleteAircraft(tcp string, callsign av.ADSBCallsign) error
func (*Sim) DeleteAircraftSlice ¶
func (*Sim) DeleteAllAircraft ¶
func (*Sim) DeleteRestrictionArea ¶
func (*Sim) DepartFixDirect ¶
func (*Sim) DepartFixHeading ¶
func (*Sim) DescendViaSTAR ¶
func (s *Sim) DescendViaSTAR(tcp string, callsign av.ADSBCallsign) error
func (*Sim) ExpectApproach ¶
func (*Sim) ExpediteClimb ¶
func (s *Sim) ExpediteClimb(tcp string, callsign av.ADSBCallsign) error
func (*Sim) ExpediteDescent ¶
func (s *Sim) ExpediteDescent(tcp string, callsign av.ADSBCallsign) error
func (*Sim) FastForward ¶
func (*Sim) GetAircraftDisplayState ¶
func (s *Sim) GetAircraftDisplayState(callsign av.ADSBCallsign) (AircraftDisplayState, error)
func (*Sim) GetAvailableCoveredPositions ¶
func (s *Sim) GetAvailableCoveredPositions() (map[string]av.Controller, map[string]av.Controller)
func (*Sim) GetControllerSpeech ¶
func (s *Sim) GetControllerSpeech(tcp string) []PilotSpeech
func (*Sim) GetFlightPlanForACID ¶
func (s *Sim) GetFlightPlanForACID(acid ACID) (*STARSFlightPlan, *Aircraft, bool)
*Aircraft may be nil. bool indicates whether the flight plan is active.
func (*Sim) GetSerializeSim ¶
func (*Sim) GetStateUpdate ¶
func (s *Sim) GetStateUpdate(tcp string, update *StateUpdate)
func (*Sim) GlobalMessage ¶
func (*Sim) InterceptLocalizer ¶
func (s *Sim) InterceptLocalizer(tcp string, callsign av.ADSBCallsign) error
func (*Sim) LaunchAircraft ¶
func (*Sim) MaintainMaximumForward ¶
func (s *Sim) MaintainMaximumForward(tcp string, callsign av.ADSBCallsign) error
func (*Sim) MaintainSlowestPractical ¶
func (s *Sim) MaintainSlowestPractical(tcp string, callsign av.ADSBCallsign) error
func (*Sim) ModifyFlightPlan ¶
func (s *Sim) ModifyFlightPlan(tcp string, acid ACID, spec STARSFlightPlanSpecifier) error
func (*Sim) RadarServicesTerminated ¶
func (s *Sim) RadarServicesTerminated(tcp string, callsign av.ADSBCallsign) error
func (*Sim) RedirectHandoff ¶
func (*Sim) ReleaseDeparture ¶
func (s *Sim) ReleaseDeparture(tcp string, callsign av.ADSBCallsign) error
func (*Sim) RepositionTrack ¶
func (*Sim) RequestFlightFollowing ¶
func (*Sim) ResumeOwnNavigation ¶
func (s *Sim) ResumeOwnNavigation(tcp string, callsign av.ADSBCallsign) error
func (*Sim) SayAltitude ¶
func (s *Sim) SayAltitude(tcp string, callsign av.ADSBCallsign) error
func (*Sim) SayHeading ¶
func (s *Sim) SayHeading(tcp string, callsign av.ADSBCallsign) error
func (*Sim) SetLaunchConfig ¶
func (s *Sim) SetLaunchConfig(tcp string, lc LaunchConfig) error
func (*Sim) Step ¶
Step advances the simulation by the given elapsed time duration. This method encapsulates the core simulation stepping logic that was previously inline in Update().
func (*Sim) TakeOrReturnLaunchControl ¶
func (*Sim) TogglePause ¶
func (*Sim) UpdateRestrictionArea ¶
func (s *Sim) UpdateRestrictionArea(idx int, ra av.RestrictionArea) error
type SnippetFormatter ¶
type SnippetFormatter interface {
// Written
Written(arg any) string
Spoken(r *rand.Rand, arg any) string
Validate(arg any) error
}
SnippetFormatter defines an interface for formatting short text snippets corresponding to various aviation-related concepts into both speech and text. Each is takes a single value specifying the value of the corresponding thing (altitude, speed, etc.)
type SpeedSnippetFormatter ¶
type SpeedSnippetFormatter struct{}
func (SpeedSnippetFormatter) Spoken ¶
func (SpeedSnippetFormatter) Spoken(r *rand.Rand, arg any) string
func (SpeedSnippetFormatter) Validate ¶
func (SpeedSnippetFormatter) Validate(arg any) error
func (SpeedSnippetFormatter) Written ¶
func (SpeedSnippetFormatter) Written(arg any) string
type State ¶
type State struct {
Tracks map[av.ADSBCallsign]*Track
// Unassociated ones, including unsupported DBs
UnassociatedFlightPlans []*STARSFlightPlan
ACFlightPlans map[av.ADSBCallsign]av.FlightPlan // needed for flight strips...
Airports map[string]*av.Airport
DepartureAirports map[string]interface{}
ArrivalAirports map[string]interface{}
Fixes map[string]math.Point2LL
VFRRunways map[string]av.Runway // assume just one runway per airport
ReleaseDepartures []ReleaseDeparture
// Signed in human controllers + virtual controllers
Controllers map[string]*av.Controller
HumanControllers []string
PrimaryController string
MultiControllers av.SplitConfiguration
UserTCP string
Airspace map[string]map[string][]av.ControllerAirspaceVolume // ctrl id -> vol name -> definition
GenerationIndex int
DepartureRunways []DepartureRunway
ArrivalRunways []ArrivalRunway
InboundFlows map[string]*av.InboundFlow
LaunchConfig LaunchConfig
Center math.Point2LL
Range float32
ScenarioDefaultVideoMaps []string
UserRestrictionAreas []av.RestrictionArea
STARSFacilityAdaptation STARSFacilityAdaptation
TRACON string
MagneticVariation float32
NmPerLongitude float32
PrimaryAirport string
WX *wx.WeatherModel
TotalIFR, TotalVFR int
Paused bool
SimRate float32
SimDescription string
SimTime time.Time // this is our fake time--accounting for pauses & simRate..
QuickFlightPlanIndex int // for auto ACIDs for quick ACID flight plan 5-145
Instructors map[string]bool
VideoMapLibraryHash []byte
// Set in State returned by GetStateForController
ControllerVideoMaps []string
ControllerDefaultVideoMaps []string
ControllerMonitoredBeaconCodeBlocks []av.Squawk
RadioTransmissions [][]byte
}
State serves two purposes: first, the Sim object holds one to organize assorted information about the world state that it updates as part of the simulation. Second, an instance of it is given to clients when they join a sim. As the sim runs, the client's State is updated roughly once a second. Clients can then use the State as a read-only reference for assorted information they may need (the state of aircraft in the sim, etc.)
func (*State) AreInstructorOrRPO ¶
func (*State) FacilityFromController ¶
func (*State) FindMatchingFlightPlan ¶
func (ss *State) FindMatchingFlightPlan(s string) *STARSFlightPlan
func (*State) GetAllReleaseDepartures ¶
func (ss *State) GetAllReleaseDepartures() []ReleaseDeparture
func (*State) GetConsolidatedPositions ¶
func (*State) GetFlightPlanForACID ¶
func (ss *State) GetFlightPlanForACID(acid ACID) *STARSFlightPlan
FOOTGUN: this should not be called from server-side code, since Tracks isn't initialized there. FIXME FIXME FIXME
func (*State) GetInitialCenter ¶
func (*State) GetInitialRange ¶
func (*State) GetOurTrackByCallsign ¶
func (ss *State) GetOurTrackByCallsign(callsign av.ADSBCallsign) (*Track, bool)
func (*State) GetRegularReleaseDepartures ¶
func (ss *State) GetRegularReleaseDepartures() []ReleaseDeparture
func (*State) GetSTARSReleaseDepartures ¶
func (ss *State) GetSTARSReleaseDepartures() []ReleaseDeparture
func (*State) GetStateForController ¶
func (*State) GetTrackByCallsign ¶
func (ss *State) GetTrackByCallsign(callsign av.ADSBCallsign) (*Track, bool)
func (*State) IsExternalController ¶
func (*State) IsLocalController ¶
func (*State) ResolveController ¶
type StateUpdate ¶
type StateUpdate struct {
GenerationIndex int
Tracks map[av.ADSBCallsign]*Track
UnassociatedFlightPlans []*STARSFlightPlan
ACFlightPlans map[av.ADSBCallsign]av.FlightPlan
ReleaseDepartures []ReleaseDeparture
Controllers map[string]*av.Controller
HumanControllers []string
Time time.Time
LaunchConfig LaunchConfig
UserRestrictionAreas []av.RestrictionArea
SimIsPaused bool
SimRate float32
TotalIFR, TotalVFR int
Events []Event
QuickFlightPlanIndex int
}
func (*StateUpdate) Apply ¶
func (su *StateUpdate) Apply(state *State, eventStream *EventStream)
type TTSProvider ¶
type TTSProvider interface {
GetAllVoices() TTSVoicesFuture
TextToSpeech(voice Voice, text string) TTSSpeechFuture
}
type TTSSpeechFuture ¶
type TTSVoicesFuture ¶
type Track ¶
type Track struct {
av.RadarTrack
FlightPlan *STARSFlightPlan
// Sort of hacky to carry these along here but it's convenient...
DepartureAirport string
DepartureAirportElevation float32
DepartureAirportLocation math.Point2LL
ArrivalAirport string
ArrivalAirportElevation float32
ArrivalAirportLocation math.Point2LL
OnExtendedCenterline bool
OnApproach bool
ATPAVolume *av.ATPAVolume
MVAsApply bool
HoldForRelease bool
MissingFlightPlan bool
Route []math.Point2LL
IsTentative bool // first 5 seconds after first contact
}
func (*Track) HandingOffTo ¶
func (*Track) IsAssociated ¶
func (*Track) IsDeparture ¶
func (*Track) IsOverflight ¶
func (*Track) IsUnassociated ¶
func (*Track) IsUnsupportedDB ¶
type TurnMethod ¶
type TurnMethod int
const ( TurnClosest TurnMethod = iota // default TurnLeft TurnRight )
func (TurnMethod) String ¶
func (t TurnMethod) String() string
type VideoMap ¶
type VideoMap struct {
Label string // for DCB
Group int // 0 -> A, 1 -> B
Name string // For maps system list
Id int
Category int
Restriction struct {
Id int
Text [2]string
TextBlink bool
HideText bool
}
Color int
Lines [][]math.Point2LL
CommandBuffer renderer.CommandBuffer
}
Note: this should match ViceMapSpec/VideoMap in crc2vice/dat2vice. (crc2vice doesn't support all of these, though.)
type VideoMapLibrary ¶
type VideoMapLibrary struct {
Maps []VideoMap
}
This should match VideoMapLibrary in dat2vice
func HashCheckLoadVideoMap ¶
func HashCheckLoadVideoMap(path string, wantHash []byte) (*VideoMapLibrary, error)
Loads the specified video map file, though only if its hash matches the provided hash. Returns an error otherwise.
func LoadVideoMapLibrary ¶
func LoadVideoMapLibrary(path string) (*VideoMapLibrary, error)
type VideoMapManifest ¶
type VideoMapManifest struct {
// contains filtered or unexported fields
}
VideoMapManifest stores which maps are available in a video map file and is also able to provide the video map file's hash.
func LoadVideoMapManifest ¶
func LoadVideoMapManifest(filename string) (*VideoMapManifest, error)
func (VideoMapManifest) HasMap ¶
func (v VideoMapManifest) HasMap(s string) bool
func (VideoMapManifest) Hash ¶
func (v VideoMapManifest) Hash() ([]byte, error)
Hash returns a hash of the underlying video map file (i.e., not the manifest!)