Documentation
¶
Index ¶
- Constants
- Variables
- func MakeSTARSFlightPlanFromAbbreviated(abbr string, stars *STARSComputer, ...) (*av.STARSFlightPlan, error)
- type AbbreviatedFPFields
- type AircraftDataMessage
- type ArrivalRunway
- type DepartureAircraft
- type DepartureRunway
- type ERAMComputer
- func (comp *ERAMComputer) Activate(ec *ERAMComputers)
- func (ec *ERAMComputer) AdaptationFixForAltitude(fix string, altitude string) *av.AdaptationFix
- func (comp *ERAMComputer) AddDeparture(fp *av.FlightPlan, tracon string, simTime time.Time)
- func (comp *ERAMComputer) AddFlightPlan(plan *av.STARSFlightPlan)
- func (comp *ERAMComputer) AddTrackInformation(callsign string, trk TrackInformation)
- func (comp *ERAMComputer) CompletelyDeleteAircraft(ac *av.Aircraft)
- func (comp *ERAMComputer) CreateSquawk() (av.Squawk, error)
- func (comp *ERAMComputer) DropTrack(ac *av.Aircraft) error
- func (ec *ERAMComputer) FixForRouteAndAltitude(route string, altitude string) *av.AdaptationFix
- func (comp *ERAMComputer) HandoffTrack(ac *av.Aircraft, from, to *av.Controller, simTime time.Time) error
- func (comp *ERAMComputer) InitiateTrack(callsign string, controller string, fp *av.STARSFlightPlan) error
- func (comp *ERAMComputer) ReturnSquawk(code av.Squawk) error
- func (comp *ERAMComputer) SendFlightPlan(fp *av.STARSFlightPlan, tracon string, simTime time.Time) error
- func (comp *ERAMComputer) SendFlightPlans(tracon string, simTime time.Time, lg *log.Logger)
- func (comp *ERAMComputer) SendMessageToERAM(facility string, msg FlightPlanMessage) error
- func (comp *ERAMComputer) SendMessageToSTARSFacility(facility string, msg FlightPlanMessage) error
- func (comp *ERAMComputer) SortMessages(simTime time.Time, lg *log.Logger)
- func (comp *ERAMComputer) Update(s *Sim)
- type ERAMComputers
- func (ec *ERAMComputers) Activate()
- func (ec *ERAMComputers) AddArrival(ac *av.Aircraft, facility string, fa av.STARSFacilityAdaptation, ...) error
- func (ec *ERAMComputers) CompletelyDeleteAircraft(ac *av.Aircraft)
- func (e ERAMComputers) DumpMap()
- func (ec *ERAMComputers) FacilityComputers(fac string) (*ERAMComputer, *STARSComputer, error)
- func (ec ERAMComputers) GetSTARSFlightPlan(tracon string, identifier string) (*av.STARSFlightPlan, error)
- func (ec *ERAMComputers) HandoffTrack(ac *av.Aircraft, from, to string, controllers map[string]*av.Controller, ...) error
- func (ec *ERAMComputers) SetScratchpad(callsign, facility, scratchpad string) error
- func (ec *ERAMComputers) SetSecondaryScratchpad(callsign, facility, scratchpad string) error
- func (ec ERAMComputers) Update(s *Sim)
- type ERAMTrackInfo
- type Event
- type EventStream
- type EventSubscriberId
- type EventType
- type EventsSubscription
- type FlightPlanMessage
- type FutureChangeSquawk
- type FutureControllerContact
- type FutureOnCourse
- type GlobalMessage
- type Handoff
- type HeadingArgs
- type LaunchConfig
- type NewSimConfiguration
- type PointOut
- type RunwayLaunchState
- type STARSComputer
- func (comp *STARSComputer) AcceptHandoff(ac *av.Aircraft, ctrl *av.Controller, controllers map[string]*av.Controller, ...) error
- func (comp *STARSComputer) AcceptRedirectedHandoff(ac *av.Aircraft, ctrl *av.Controller) error
- func (comp *STARSComputer) AcknowledgePointOut(callsign, controller string) error
- func (comp *STARSComputer) Activate(pool *av.SquawkCodePool)
- func (comp *STARSComputer) AddFlightPlan(plan *av.STARSFlightPlan)
- func (comp *STARSComputer) AddHeldDeparture(ac *av.Aircraft)
- func (comp *STARSComputer) AddTrackInformation(callsign string, info TrackInformation)
- func (comp *STARSComputer) AddUnsupportedTrack(ut UnsupportedTrack)
- func (comp *STARSComputer) AssociateFlightPlans(s *Sim)
- func (comp *STARSComputer) AutoAssociateFP(ac *av.Aircraft, fp *av.STARSFlightPlan)
- func (comp *STARSComputer) AutomatedAcceptHandoff(ac *av.Aircraft, controller string, receivingSTARS *STARSComputer, ...) error
- func (comp *STARSComputer) CancelHandoff(ac *av.Aircraft, ctrl *av.Controller, controllers map[string]*av.Controller, ...) error
- func (comp *STARSComputer) CompletelyDeleteAircraft(ac *av.Aircraft)
- func (comp *STARSComputer) CreateSquawk() (av.Squawk, error)
- func (comp *STARSComputer) DropTrack(ac *av.Aircraft) error
- func (comp *STARSComputer) GetFlightPlan(identifier string) (*av.STARSFlightPlan, error)
- func (comp *STARSComputer) GetReleaseDepartures() []*av.Aircraft
- func (comp *STARSComputer) HandoffControl(callsign string, nextController string) error
- func (comp *STARSComputer) HandoffTrack(callsign string, from *av.Controller, to *av.Controller, simTime time.Time) error
- func (comp *STARSComputer) InitiateTrack(callsign string, controller string, fp *av.STARSFlightPlan, haveControl bool) error
- func (comp *STARSComputer) LookupTrackIndex(idx int) *TrackInformation
- func (comp *STARSComputer) PointOut(callsign, toController string) error
- func (comp *STARSComputer) RecallPointOut(callsign, controller string) error
- func (comp *STARSComputer) RedirectHandoff(ac *av.Aircraft, ctrl, octrl *av.Controller) error
- func (comp *STARSComputer) RejectPointOut(callsign, controller string) error
- func (comp *STARSComputer) ReleaseDeparture(callsign string) error
- func (comp *STARSComputer) RequestFlightPlan(bcn av.Squawk, simTime time.Time)
- func (comp *STARSComputer) ReturnSquawk(code av.Squawk) error
- func (comp *STARSComputer) SendToOverlyingERAMFacility(msg FlightPlanMessage)
- func (comp *STARSComputer) SendTrackInfo(receivingFacility string, msg FlightPlanMessage, simTime time.Time)
- func (comp *STARSComputer) SortReceivedMessages(e *EventStream)
- func (comp *STARSComputer) Update(s *Sim)
- func (comp *STARSComputer) UpdateAssociatedFlightPlans(aircraft []*av.Aircraft)
- type Sim
- func (s *Sim) AcceptHandoff(tcp, callsign string) error
- func (s *Sim) AcceptRedirectedHandoff(tcp, callsign string) error
- func (s *Sim) AcknowledgePointOut(tcp, callsign string) error
- func (s *Sim) Activate(lg *log.Logger)
- func (s *Sim) ActiveControllers() []string
- func (s *Sim) AssignAltitude(tcp, callsign string, altitude int, afterSpeed bool) error
- func (s *Sim) AssignHeading(hdg *HeadingArgs) error
- func (s *Sim) AssignSpeed(tcp, callsign string, speed int, afterAltitude bool) error
- func (s *Sim) AtFixCleared(tcp, callsign, fix, approach string) error
- func (s *Sim) AutoAssociateFP(tcp, callsign string, fp *av.STARSFlightPlan) error
- func (s *Sim) CancelApproachClearance(tcp, callsign string) error
- func (s *Sim) CancelHandoff(tcp, callsign string) error
- func (s *Sim) ChangeControlPosition(fromTCP, toTCP string, keepTracks bool) error
- func (s *Sim) ChangeSquawk(tcp, callsign string, sq av.Squawk) error
- func (s *Sim) ChangeTransponderMode(tcp, callsign string, mode av.TransponderMode) error
- func (s *Sim) ClearedApproach(tcp, callsign, approach string, straightIn bool) error
- func (s *Sim) ClimbViaSID(tcp, callsign string) error
- func (s *Sim) ContactTower(tcp, callsign string) error
- func (s *Sim) CreateArrival(arrivalGroup string, arrivalAirport string) (*av.Aircraft, error)
- func (s *Sim) CreateIFRDeparture(departureAirport, runway, category string) (*av.Aircraft, error)
- func (s *Sim) CreateOverflight(group string) (*av.Aircraft, error)
- func (s *Sim) CreateRestrictionArea(ra av.RestrictionArea) (int, error)
- func (s *Sim) CreateUnsupportedTrack(tcp, callsign string, ut *UnsupportedTrack) error
- func (s *Sim) CreateVFRDeparture(departureAirport string) (*av.Aircraft, error)
- func (s *Sim) CrossFixAt(tcp, callsign, fix string, ar *av.AltitudeRestriction, speed int) error
- func (s *Sim) DeleteAircraft(tcp, callsign string) error
- func (s *Sim) DeleteAllAircraft(tcp string) error
- func (s *Sim) DeleteRestrictionArea(idx int) error
- func (s *Sim) DepartFixDirect(tcp, callsign, fixa string, fixb string) error
- func (s *Sim) DepartFixHeading(tcp, callsign, fix string, heading int) error
- func (s *Sim) DescendViaSTAR(tcp, callsign string) error
- func (s *Sim) DirectFix(tcp, callsign, fix string) error
- func (s *Sim) DropTrack(tcp, callsign string) error
- func (s *Sim) ExpectApproach(tcp, callsign, approach string) error
- func (s *Sim) ExpediteClimb(tcp, callsign string) error
- func (s *Sim) ExpediteDescent(tcp, callsign string) error
- func (s *Sim) ForceQL(tcp, callsign, controller string) error
- func (s *Sim) GetAvailableCoveredPositions() (map[string]av.Controller, map[string]av.Controller)
- func (s *Sim) GetSerializeSim() Sim
- func (s *Sim) GetWorldUpdate(tcp string, update *WorldUpdate, localServer bool)
- func (s *Sim) GlobalMessage(tcp, message string) error
- func (s *Sim) GoAround(tcp, callsign string) error
- func (s *Sim) HandoffControl(tcp, callsign string) error
- func (s *Sim) HandoffTrack(tcp, callsign, toTCP string) error
- func (s *Sim) Ident(tcp, callsign string) error
- func (s *Sim) IdleTime() time.Duration
- func (s *Sim) InitiateTrack(tcp, callsign string, fp *av.STARSFlightPlan) error
- func (s *Sim) InterceptLocalizer(tcp, callsign string) error
- func (s *Sim) LaunchAircraft(ac av.Aircraft, departureRunway string)
- func (s *Sim) LogValue() slog.Value
- func (s *Sim) MaintainMaximumForward(tcp, callsign string) error
- func (s *Sim) MaintainSlowestPractical(tcp, callsign string) error
- func (s *Sim) PointOut(fromTCP, callsign, toTCP string) error
- func (s *Sim) PostEvent(e Event)
- func (s *Sim) Prespawn()
- func (s *Sim) RecallPointOut(tcp, callsign string) error
- func (s *Sim) RedirectHandoff(tcp, callsign, controller string) error
- func (s *Sim) RejectPointOut(tcp, callsign string) error
- func (s *Sim) ReleaseDeparture(tcp, callsign string) error
- func (s *Sim) ResolveController(tcp string) string
- func (s *Sim) SayAltitude(tcp, callsign string) error
- func (s *Sim) SayHeading(tcp, callsign string) error
- func (s *Sim) SaySpeed(tcp, callsign string) error
- func (s *Sim) SetGlobalLeaderLine(tcp, callsign string, dir *math.CardinalOrdinalDirection) error
- func (s *Sim) SetLaunchConfig(tcp string, lc LaunchConfig) error
- func (s *Sim) SetPilotReportedAltitude(tcp, callsign string, altitude int) error
- func (s *Sim) SetScratchpad(tcp, callsign, scratchpad string) error
- func (s *Sim) SetSecondaryScratchpad(tcp, callsign, scratchpad string) error
- func (s *Sim) SetSimRate(tcp string, rate float32) error
- func (s *Sim) SetTemporaryAltitude(tcp, callsign string, altitude int) error
- func (s *Sim) SignOff(tcp string) error
- func (s *Sim) SignOn(tcp string, instructor bool) (*State, error)
- func (s *Sim) TakeOrReturnLaunchControl(tcp string) error
- func (s *Sim) ToggleDisplayModeCAltitude(tcp, callsign string) error
- func (s *Sim) TogglePause(tcp string) error
- func (s *Sim) ToggleSPCOverride(tcp, callsign, spc string) error
- func (s *Sim) Update()
- func (s *Sim) UpdateRestrictionArea(idx int, ra av.RestrictionArea) error
- func (s *Sim) UploadFlightPlan(tcp string, planType int, plan *av.STARSFlightPlan) error
- type State
- func (s *State) Activate(lg *log.Logger)
- func (ss *State) AircraftFromCallsignSuffix(suffix string, instructor bool) []*av.Aircraft
- func (ss *State) AmInstructor() bool
- func (ss *State) AverageWindVector() [2]float32
- func (ss *State) DeleteAircraft(ac *av.Aircraft)
- func (ss *State) DepartureController(ac *av.Aircraft, lg *log.Logger) string
- func (ss *State) ERAMComputer() *ERAMComputer
- func (ss *State) FacilityFromController(callsign string) (string, bool)
- func (ss *State) GetAllReleaseDepartures() []*av.Aircraft
- func (ss *State) GetConsolidatedPositions(id string) []string
- func (ss *State) GetInitialCenter() math.Point2LL
- func (ss *State) GetInitialRange() float32
- func (ss *State) GetRegularReleaseDepartures() []*av.Aircraft
- func (ss *State) GetSTARSReleaseDepartures() []*av.Aircraft
- func (s *State) GetStateForController(tcp string) *State
- func (ss *State) GetWindVector(p math.Point2LL, alt float32) [2]float32
- func (ss *State) InhibitCAVolumes() []av.AirspaceVolume
- func (s *State) IsArrival(ac *av.Aircraft) bool
- func (s *State) IsDeparture(ac *av.Aircraft) bool
- func (s *State) IsIntraFacility(ac *av.Aircraft) bool
- func (s *State) IsOverflight(ac *av.Aircraft) bool
- func (ss *State) Locate(s string) (math.Point2LL, bool)
- func (ss *State) STARSComputer() *STARSComputer
- type TrackInformation
- type UnsupportedTrack
- type WorldUpdate
Constants ¶
const ( InitiatedTrackEvent = iota DroppedTrackEvent PushedFlightStripEvent PointOutEvent OfferedHandoffEvent AcceptedHandoffEvent AcceptedRedirectedHandoffEvent CanceledHandoffEvent RejectedHandoffEvent RadioTransmissionEvent StatusMessageEvent ServerBroadcastMessageEvent GlobalMessageEvent AcknowledgedPointOutEvent RejectedPointOutEvent IdentEvent HandoffControlEvent SetGlobalLeaderLineEvent TrackClickedEvent ForceQLEvent TransferAcceptedEvent TransferRejectedEvent RecalledPointOutEvent NumEventTypes )
const ( Unset = iota // Have this so we can catch unset types. Plan // Both STARS & ERAM send this. Amendment // ERAM (STARS?) Cancellation // ERAM (STARS?) RequestFlightPlan // STARS DepartureDM // STARS BeaconTerminate // STARS InitiateTransfer // When handoff gets sent. Sends the flightplan, contains track location AcceptRecallTransfer // Accept/ recall handoff )
Message types sent from either ERAM or STARS
const ( DepartureTime = "P" ArrivalTime = "A" OverflightTime = "E" )
const ( ACID = iota BCN ControllingPosition TypeOfFlight // Figure out this SC1 SC2 AircraftType RequestedALT Rules DepartureAirport // Specified with type of flight (maybe) Errors )
const ( LaunchAutomatic = iota LaunchManual )
const STARSTriangleCharacter = string(rune(0x80))
FIXME: yuck, duplicated here
const TransmitFPMessageTime = 30 * time.Minute
Variables ¶
var ( ErrAircraftAlreadyReleased = errors.New("Aircraft already released") ErrBeaconMismatch = errors.New("Beacon code mismatch") ErrControllerAlreadySignedIn = errors.New("Controller with that callsign already signed in") ErrIllegalACID = errors.New("Illegal ACID") ErrIllegalACType = errors.New("Illegal aircraft type") ErrIllegalFunction = errors.New("Illegal function") ErrIllegalScratchpad = errors.New("Illegal scratchpad") ErrInvalidAbbreviatedFP = errors.New("Invalid abbreviated flight plan") ErrInvalidDepartureController = errors.New("Invalid departure controller") ErrInvalidRestrictionAreaIndex = errors.New("Invalid restriction area index") ErrNoMatchingFlight = errors.New("No matching flight") ErrNotLaunchController = errors.New("Not signed in as the launch controller") ErrTooManyRestrictionAreas = errors.New("Too many restriction areas specified") ErrUnknownController = errors.New("Unknown controller") ErrUnknownControllerFacility = errors.New("Unknown controller facility") ErrViolatedAirspace = errors.New("Violated B/C airspace") ErrVFRSimTookTooLong = errors.New("VFR simulation took too long") )
Functions ¶
func MakeSTARSFlightPlanFromAbbreviated ¶
func MakeSTARSFlightPlanFromAbbreviated(abbr string, stars *STARSComputer, facilityAdaptation av.STARSFacilityAdaptation) (*av.STARSFlightPlan, error)
Types ¶
type AbbreviatedFPFields ¶
type AbbreviatedFPFields struct { ACID string BCN av.Squawk ControllingPosition string TypeOfFlight string // Figure out this SC1 string SC2 string AircraftType string RequestedALT string Rules av.FlightRules DepartureAirport string // Specified with type of flight (maybe) // TODO: why is there an error stored here (vs just returned from the // parsing function)? Error error }
func ParseAbbreviatedFPFields ¶
func ParseAbbreviatedFPFields(facilityAdaptation av.STARSFacilityAdaptation, fields []string) AbbreviatedFPFields
type AircraftDataMessage ¶
type AircraftDataMessage struct { DepartureLocation string // Only for departures. ArrivalLocation string // Only for arrivals. I think this is made up, but I don't know where to get the arrival info from. NumberOfAircraft int // Default this at one for now. AircraftType string // A20N, B737, etc. // V = VFR (not heavy jet), // H = Heavy, // W = Heavy + VFR, // U = Heavy + OTP. AircraftCategory string Equipment string // /L, /G, /A, etc }
type ArrivalRunway ¶ added in v0.11.9
type DepartureAircraft ¶ added in v0.11.5
type DepartureAircraft struct { Callsign string 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. // HFR-only. AddedToList bool ReleaseRequested bool ReleaseDelay time.Duration // minimum wait after release before the takeoff roll AddToHFRListTime time.Time RequestReleaseTime time.Time }
DepartureAircraft represents a departing aircraft, either still on the ground or recently-launched.
type DepartureRunway ¶ added in v0.11.9
type ERAMComputer ¶
type ERAMComputer struct { STARSComputers map[string]*STARSComputer ReceivedMessages []FlightPlanMessage FlightPlans map[av.Squawk]*av.STARSFlightPlan TrackInformation map[string]*TrackInformation SquawkCodePool *av.SquawkCodePool // This is shared among all STARS computers for our facility; we keep a // copy in ERAMComputer so that when we deserialize after loading a // saved sim, we are still sharing the same one. STARSCodePool *av.SquawkCodePool Identifier string Adaptation av.ERAMAdaptation // contains filtered or unexported fields }
func MakeERAMComputer ¶
func MakeERAMComputer(fac string, adapt av.ERAMAdaptation, starsBeaconBank int, eramComputers *ERAMComputers) *ERAMComputer
func (*ERAMComputer) Activate ¶ added in v0.11.2
func (comp *ERAMComputer) Activate(ec *ERAMComputers)
func (*ERAMComputer) AdaptationFixForAltitude ¶
func (ec *ERAMComputer) AdaptationFixForAltitude(fix string, altitude string) *av.AdaptationFix
func (*ERAMComputer) AddDeparture ¶
func (comp *ERAMComputer) AddDeparture(fp *av.FlightPlan, tracon string, simTime time.Time)
func (*ERAMComputer) AddFlightPlan ¶
func (comp *ERAMComputer) AddFlightPlan(plan *av.STARSFlightPlan)
func (*ERAMComputer) AddTrackInformation ¶
func (comp *ERAMComputer) AddTrackInformation(callsign string, trk TrackInformation)
func (*ERAMComputer) CompletelyDeleteAircraft ¶
func (comp *ERAMComputer) CompletelyDeleteAircraft(ac *av.Aircraft)
func (*ERAMComputer) CreateSquawk ¶
func (comp *ERAMComputer) CreateSquawk() (av.Squawk, error)
For NAS codes
func (*ERAMComputer) FixForRouteAndAltitude ¶
func (ec *ERAMComputer) FixForRouteAndAltitude(route string, altitude string) *av.AdaptationFix
func (*ERAMComputer) HandoffTrack ¶
func (comp *ERAMComputer) HandoffTrack(ac *av.Aircraft, from, to *av.Controller, simTime time.Time) error
func (*ERAMComputer) InitiateTrack ¶
func (comp *ERAMComputer) InitiateTrack(callsign string, controller string, fp *av.STARSFlightPlan) error
func (*ERAMComputer) ReturnSquawk ¶ added in v0.11.9
func (comp *ERAMComputer) ReturnSquawk(code av.Squawk) error
func (*ERAMComputer) SendFlightPlan ¶
func (comp *ERAMComputer) SendFlightPlan(fp *av.STARSFlightPlan, tracon string, simTime time.Time) error
For individual plans being sent.
func (*ERAMComputer) SendFlightPlans ¶
func (*ERAMComputer) SendMessageToERAM ¶
func (comp *ERAMComputer) SendMessageToERAM(facility string, msg FlightPlanMessage) error
func (*ERAMComputer) SendMessageToSTARSFacility ¶
func (comp *ERAMComputer) SendMessageToSTARSFacility(facility string, msg FlightPlanMessage) error
Sends a message, whether that be a flight plan or any other message type to a STARS computer. The STARS computer will sort messages by itself
func (*ERAMComputer) SortMessages ¶
func (comp *ERAMComputer) SortMessages(simTime time.Time, lg *log.Logger)
func (*ERAMComputer) Update ¶
func (comp *ERAMComputer) Update(s *Sim)
type ERAMComputers ¶
type ERAMComputers struct {
Computers map[string]*ERAMComputer
}
func MakeERAMComputers ¶
func MakeERAMComputers(starsBeaconBank int, lg *log.Logger) *ERAMComputers
func (*ERAMComputers) Activate ¶
func (ec *ERAMComputers) Activate()
func (*ERAMComputers) AddArrival ¶
func (ec *ERAMComputers) AddArrival(ac *av.Aircraft, facility string, fa av.STARSFacilityAdaptation, simTime time.Time) error
func (*ERAMComputers) CompletelyDeleteAircraft ¶
func (ec *ERAMComputers) CompletelyDeleteAircraft(ac *av.Aircraft)
func (*ERAMComputers) FacilityComputers ¶
func (ec *ERAMComputers) FacilityComputers(fac string) (*ERAMComputer, *STARSComputer, error)
If given an ARTCC, returns the corresponding ERAMComputer; if given a TRACON, returns both the associated ERMANComputer and STARSComputer
func (ERAMComputers) GetSTARSFlightPlan ¶
func (ec ERAMComputers) GetSTARSFlightPlan(tracon string, identifier string) (*av.STARSFlightPlan, error)
identifier can be bcn or callsign
func (*ERAMComputers) HandoffTrack ¶
func (ec *ERAMComputers) HandoffTrack(ac *av.Aircraft, from, to string, controllers map[string]*av.Controller, simTime time.Time) error
func (*ERAMComputers) SetScratchpad ¶
func (ec *ERAMComputers) SetScratchpad(callsign, facility, scratchpad string) error
func (*ERAMComputers) SetSecondaryScratchpad ¶
func (ec *ERAMComputers) SetSecondaryScratchpad(callsign, facility, scratchpad string) error
func (ERAMComputers) Update ¶
func (ec ERAMComputers) Update(s *Sim)
Give the computers a chance to sort through their received messages and do assorted housekeeping.
type ERAMTrackInfo ¶
type Event ¶
type Event struct { Type EventType Callsign string FromController string ToController string // For radio transmissions, the controlling controller. Message 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) 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 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 FlightPlanMessage ¶
type FlightPlanMessage struct { SourceID string // LLLdddd e.g. ZCN2034 (ZNY at 2034z) MessageType int FlightID string // ddaLa(a)(a)(a)(a)(a)ECID (3 chars start w/ digit), Aircraft ID (2-7 chars start with letter) AircraftData AircraftDataMessage BCN av.Squawk CoordinationFix string CoordinationTime av.CoordinationTime // Altitude will either be requested (cruise altitude) for departures, // or the assigned altitude for arrivals. ERAM has the ability to // assign interm alts (and is used much more than STARS interm alts) // with `QQ`. This interim altiude gets sent down to the STARS // computer instead of the cruising altitude. If no interim altitude is // set, use the cruise altitude (check this) Examples of altitudes // could be 310, VFR/170, VFR, 170B210 (block altitude), etc. Altitude string Route string TrackInformation // For track messages }
func FlightPlanDepartureMessage ¶
func FlightPlanDepartureMessage(fp av.FlightPlan, sendingFacility string, simTime time.Time) FlightPlanMessage
Prepare the message to sent to a STARS facility after a RF message
func MakeFlightPlanMessage ¶ added in v0.11.9
func MakeFlightPlanMessage(fp *av.STARSFlightPlan) FlightPlanMessage
func (FlightPlanMessage) FlightPlan ¶
func (s FlightPlanMessage) FlightPlan() *av.STARSFlightPlan
Converts the message to a STARS flight plan.
type FutureChangeSquawk ¶ added in v0.11.8
type FutureControllerContact ¶ added in v0.11.7
type FutureOnCourse ¶ added in v0.11.7
type GlobalMessage ¶
type HeadingArgs ¶
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 int GoAroundRate float32 // airport -> runway -> category -> rate DepartureRates map[string]map[string]map[string]float32 DepartureRateScale float32 VFRDepartureRateScale float32 VFRAirports map[string]*av.Airport // 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) LaunchConfig
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 ControlPositions map[string]*av.Controller PrimaryController string ControllerAirspace map[string][]string VirtualControllers []string MultiControllers av.SplitConfiguration SignOnPositions map[string]*av.Controller TFRs []av.TFR LiveWeather bool Wind av.Wind STARSFacilityAdaptation av.STARSFacilityAdaptation IsLocal bool ReportingPoints []av.ReportingPoint MagneticVariation float32 NmPerLongitude float32 Center math.Point2LL Range float32 DefaultMaps []string Airspace av.Airspace }
NewSimConfiguration collects all of the information required to create a new Sim
type RunwayLaunchState ¶ added in v0.11.9
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 // Aircraft flow through two or three of the following lists. // Hold for release purgatory. Held []DepartureAircraft // Released, either manually from Held, or VFR, or if there is no HFR // at the airport, IFR departures go here initially. Released []DepartureAircraft // Sequenced departures, pulled from Released. These are launched in-order. Sequenced []DepartureAircraft BufferReleased bool LastDeparture *DepartureAircraft VFRAttempts int VFRSuccesses int }
type STARSComputer ¶
type STARSComputer struct { Identifier string ContainedPlans map[av.Squawk]*av.STARSFlightPlan ReceivedMessages []FlightPlanMessage TrackInformation map[string]*TrackInformation ERAMInbox *[]FlightPlanMessage // The address of the overlying ERAM's message inbox. STARSInbox map[string]*[]FlightPlanMessage // Other STARS Facilities' inboxes UnsupportedTracks []UnsupportedTrack SquawkCodePool *av.SquawkCodePool HoldForRelease []*av.Aircraft }
func MakeSTARSComputer ¶
func MakeSTARSComputer(id string, sq *av.SquawkCodePool) *STARSComputer
func (*STARSComputer) AcceptHandoff ¶
func (comp *STARSComputer) AcceptHandoff(ac *av.Aircraft, ctrl *av.Controller, controllers map[string]*av.Controller, adaptation av.STARSFacilityAdaptation, simTime time.Time) error
func (*STARSComputer) AcceptRedirectedHandoff ¶
func (comp *STARSComputer) AcceptRedirectedHandoff(ac *av.Aircraft, ctrl *av.Controller) error
func (*STARSComputer) AcknowledgePointOut ¶
func (comp *STARSComputer) AcknowledgePointOut(callsign, controller string) error
func (*STARSComputer) Activate ¶ added in v0.11.2
func (comp *STARSComputer) Activate(pool *av.SquawkCodePool)
func (*STARSComputer) AddFlightPlan ¶
func (comp *STARSComputer) AddFlightPlan(plan *av.STARSFlightPlan)
func (*STARSComputer) AddHeldDeparture ¶ added in v0.11.5
func (comp *STARSComputer) AddHeldDeparture(ac *av.Aircraft)
func (*STARSComputer) AddTrackInformation ¶
func (comp *STARSComputer) AddTrackInformation(callsign string, info TrackInformation)
func (*STARSComputer) AddUnsupportedTrack ¶
func (comp *STARSComputer) AddUnsupportedTrack(ut UnsupportedTrack)
func (*STARSComputer) AssociateFlightPlans ¶
func (comp *STARSComputer) AssociateFlightPlans(s *Sim)
func (*STARSComputer) AutoAssociateFP ¶
func (comp *STARSComputer) AutoAssociateFP(ac *av.Aircraft, fp *av.STARSFlightPlan)
func (*STARSComputer) AutomatedAcceptHandoff ¶
func (comp *STARSComputer) AutomatedAcceptHandoff(ac *av.Aircraft, controller string, receivingSTARS *STARSComputer, controllers map[string]*av.Controller, simTime time.Time) error
func (*STARSComputer) CancelHandoff ¶
func (comp *STARSComputer) CancelHandoff(ac *av.Aircraft, ctrl *av.Controller, controllers map[string]*av.Controller, simTime time.Time) error
func (*STARSComputer) CompletelyDeleteAircraft ¶
func (comp *STARSComputer) CompletelyDeleteAircraft(ac *av.Aircraft)
func (*STARSComputer) CreateSquawk ¶
func (comp *STARSComputer) CreateSquawk() (av.Squawk, error)
For local codes
func (*STARSComputer) GetFlightPlan ¶
func (comp *STARSComputer) GetFlightPlan(identifier string) (*av.STARSFlightPlan, error)
func (*STARSComputer) GetReleaseDepartures ¶ added in v0.11.5
func (comp *STARSComputer) GetReleaseDepartures() []*av.Aircraft
func (*STARSComputer) HandoffControl ¶
func (comp *STARSComputer) HandoffControl(callsign string, nextController string) error
func (*STARSComputer) HandoffTrack ¶
func (comp *STARSComputer) HandoffTrack(callsign string, from *av.Controller, to *av.Controller, simTime time.Time) error
func (*STARSComputer) InitiateTrack ¶
func (comp *STARSComputer) InitiateTrack(callsign string, controller string, fp *av.STARSFlightPlan, haveControl bool) error
func (*STARSComputer) LookupTrackIndex ¶
func (comp *STARSComputer) LookupTrackIndex(idx int) *TrackInformation
func (*STARSComputer) PointOut ¶
func (comp *STARSComputer) PointOut(callsign, toController string) error
func (*STARSComputer) RecallPointOut ¶ added in v0.11.8
func (comp *STARSComputer) RecallPointOut(callsign, controller string) error
func (*STARSComputer) RedirectHandoff ¶
func (comp *STARSComputer) RedirectHandoff(ac *av.Aircraft, ctrl, octrl *av.Controller) error
func (*STARSComputer) RejectPointOut ¶
func (comp *STARSComputer) RejectPointOut(callsign, controller string) error
func (*STARSComputer) ReleaseDeparture ¶ added in v0.11.5
func (comp *STARSComputer) ReleaseDeparture(callsign string) error
func (*STARSComputer) RequestFlightPlan ¶
func (comp *STARSComputer) RequestFlightPlan(bcn av.Squawk, simTime time.Time)
func (*STARSComputer) ReturnSquawk ¶ added in v0.11.9
func (comp *STARSComputer) ReturnSquawk(code av.Squawk) error
func (*STARSComputer) SendToOverlyingERAMFacility ¶
func (comp *STARSComputer) SendToOverlyingERAMFacility(msg FlightPlanMessage)
func (*STARSComputer) SendTrackInfo ¶
func (comp *STARSComputer) SendTrackInfo(receivingFacility string, msg FlightPlanMessage, simTime time.Time)
func (*STARSComputer) SortReceivedMessages ¶
func (comp *STARSComputer) SortReceivedMessages(e *EventStream)
Sorting the STARS messages. This will store flight plans with FP messages, change flight plans with AM messages, cancel flight plans with CX messages, etc.
func (*STARSComputer) Update ¶
func (comp *STARSComputer) Update(s *Sim)
func (*STARSComputer) UpdateAssociatedFlightPlans ¶
func (comp *STARSComputer) UpdateAssociatedFlightPlans(aircraft []*av.Aircraft)
type Sim ¶
type Sim struct { State *State SignOnPositions map[string]*av.Controller // Airport -> runway -> state DepartureState map[string]map[string]*RunwayLaunchState // Key is inbound flow group name NextInboundSpawn map[string]time.Time Handoffs map[string]Handoff // a/c callsign -> PointOut PointOuts map[string]PointOut ReportingPoints []av.ReportingPoint FutureControllerContacts []FutureControllerContact FutureOnCourse []FutureOnCourse FutureSquawkChanges []FutureChangeSquawk NextPushStart time.Time // both w.r.t. sim time PushEnd time.Time Instructors map[string]bool // contains filtered or unexported fields }
func NewSim ¶
func NewSim(config NewSimConfiguration, manifest *av.VideoMapManifest, lg *log.Logger) *Sim
func (*Sim) AcceptHandoff ¶
func (*Sim) AcceptRedirectedHandoff ¶
func (*Sim) AcknowledgePointOut ¶
func (*Sim) ActiveControllers ¶ added in v0.11.9
func (*Sim) AssignAltitude ¶
func (*Sim) AssignHeading ¶
func (s *Sim) AssignHeading(hdg *HeadingArgs) error
func (*Sim) AssignSpeed ¶
func (*Sim) AtFixCleared ¶
func (*Sim) AutoAssociateFP ¶
func (s *Sim) AutoAssociateFP(tcp, callsign string, fp *av.STARSFlightPlan) error
func (*Sim) CancelApproachClearance ¶
func (*Sim) CancelHandoff ¶
func (*Sim) ChangeControlPosition ¶
func (*Sim) ChangeTransponderMode ¶ added in v0.11.9
func (s *Sim) ChangeTransponderMode(tcp, callsign string, mode av.TransponderMode) error
func (*Sim) ClearedApproach ¶
func (*Sim) ClimbViaSID ¶
func (*Sim) ContactTower ¶
func (*Sim) CreateArrival ¶
func (*Sim) CreateIFRDeparture ¶ added in v0.11.9
func (*Sim) CreateOverflight ¶ added in v0.11.2
func (*Sim) CreateRestrictionArea ¶ added in v0.11.6
func (s *Sim) CreateRestrictionArea(ra av.RestrictionArea) (int, error)
func (*Sim) CreateUnsupportedTrack ¶
func (s *Sim) CreateUnsupportedTrack(tcp, callsign string, ut *UnsupportedTrack) error
func (*Sim) CreateVFRDeparture ¶ added in v0.11.9
Note that this may fail without an error if it's having trouble finding a route.
func (*Sim) CrossFixAt ¶
func (*Sim) DeleteAircraft ¶
func (*Sim) DeleteAllAircraft ¶
func (*Sim) DeleteRestrictionArea ¶ added in v0.11.6
func (*Sim) DepartFixDirect ¶
func (*Sim) DepartFixHeading ¶
func (*Sim) DescendViaSTAR ¶
func (*Sim) ExpectApproach ¶
func (*Sim) ExpediteClimb ¶
func (*Sim) ExpediteDescent ¶
func (*Sim) GetAvailableCoveredPositions ¶ added in v0.11.9
func (s *Sim) GetAvailableCoveredPositions() (map[string]av.Controller, map[string]av.Controller)
func (*Sim) GetSerializeSim ¶ added in v0.11.9
func (*Sim) GetWorldUpdate ¶
func (s *Sim) GetWorldUpdate(tcp string, update *WorldUpdate, localServer bool)
func (*Sim) GlobalMessage ¶
func (*Sim) HandoffControl ¶
func (*Sim) HandoffTrack ¶
func (*Sim) InitiateTrack ¶
func (s *Sim) InitiateTrack(tcp, callsign string, fp *av.STARSFlightPlan) error
func (*Sim) InterceptLocalizer ¶
func (*Sim) MaintainMaximumForward ¶
func (*Sim) MaintainSlowestPractical ¶
func (*Sim) RecallPointOut ¶ added in v0.11.8
func (*Sim) RedirectHandoff ¶
func (*Sim) RejectPointOut ¶
func (*Sim) ReleaseDeparture ¶ added in v0.11.5
func (*Sim) ResolveController ¶
func (*Sim) SayAltitude ¶
func (*Sim) SayHeading ¶
func (*Sim) SetGlobalLeaderLine ¶
func (s *Sim) SetGlobalLeaderLine(tcp, callsign string, dir *math.CardinalOrdinalDirection) error
func (*Sim) SetLaunchConfig ¶
func (s *Sim) SetLaunchConfig(tcp string, lc LaunchConfig) error
func (*Sim) SetPilotReportedAltitude ¶ added in v0.11.9
func (*Sim) SetScratchpad ¶
func (*Sim) SetSecondaryScratchpad ¶
func (*Sim) SetTemporaryAltitude ¶
func (*Sim) TakeOrReturnLaunchControl ¶
func (*Sim) ToggleDisplayModeCAltitude ¶ added in v0.11.9
func (*Sim) TogglePause ¶
func (*Sim) ToggleSPCOverride ¶
func (*Sim) UpdateRestrictionArea ¶ added in v0.11.6
func (s *Sim) UpdateRestrictionArea(idx int, ra av.RestrictionArea) error
func (*Sim) UploadFlightPlan ¶
type State ¶
type State struct { Aircraft map[string]*av.Aircraft Airports map[string]*av.Airport DepartureAirports map[string]*av.Airport ArrivalAirports map[string]*av.Airport Fixes map[string]math.Point2LL VFRRunways map[string]av.Runway // assume just one runway per airport // 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 DepartureRunways []DepartureRunway ArrivalRunways []ArrivalRunway InboundFlows map[string]*av.InboundFlow LaunchConfig LaunchConfig Center math.Point2LL Range float32 ScenarioDefaultVideoMaps []string UserRestrictionAreas []av.RestrictionArea ERAMComputers *ERAMComputers STARSFacilityAdaptation av.STARSFacilityAdaptation TRACON string MagneticVariation float32 NmPerLongitude float32 PrimaryAirport string METAR map[string]*av.METAR Wind av.Wind TotalIFR, TotalVFR int Paused bool SimRate float32 SimDescription string SimTime time.Time // this is our fake time--accounting for pauses & simRate.. Instructors map[string]bool VideoMapLibraryHash []byte // Set in State returned by GetStateForController ControllerVideoMaps []string ControllerDefaultVideoMaps []string ControllerMonitoredBeaconCodeBlocks []av.Squawk }
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) AircraftFromCallsignSuffix ¶ added in v0.11.7
Returns all aircraft that match the given suffix. If instructor is true, returns all matching aircraft; otherwise only ones under the current controller's control are considered for matching.
func (*State) AmInstructor ¶ added in v0.11.7
func (*State) AverageWindVector ¶
func (*State) DeleteAircraft ¶
func (*State) DepartureController ¶
func (*State) ERAMComputer ¶
func (ss *State) ERAMComputer() *ERAMComputer
func (*State) FacilityFromController ¶
func (*State) GetAllReleaseDepartures ¶ added in v0.11.6
func (*State) GetConsolidatedPositions ¶ added in v0.11.7
func (*State) GetInitialCenter ¶
func (*State) GetInitialRange ¶
func (*State) GetRegularReleaseDepartures ¶ added in v0.11.6
func (*State) GetSTARSReleaseDepartures ¶ added in v0.11.6
func (*State) GetStateForController ¶
func (*State) GetWindVector ¶
func (*State) InhibitCAVolumes ¶
func (ss *State) InhibitCAVolumes() []av.AirspaceVolume
func (*State) IsIntraFacility ¶ added in v0.11.2
func (*State) STARSComputer ¶
func (ss *State) STARSComputer() *STARSComputer
type TrackInformation ¶
type TrackInformation struct { Identifier string TrackOwner string HandoffController string FlightPlan *av.STARSFlightPlan PointOut string PointOutHistory []string RedirectedHandoff av.RedirectedHandoff SP1 string SP2 string AutoAssociateFP bool // If it's white or not }
func (TrackInformation) HandingOffTo ¶ added in v0.11.2
func (trk TrackInformation) HandingOffTo(ctrl string) bool
type UnsupportedTrack ¶
type WorldUpdate ¶
type WorldUpdate struct { Aircraft map[string]*av.Aircraft Controllers map[string]*av.Controller HumanControllers []string Time time.Time ERAMComputers *ERAMComputers LaunchConfig LaunchConfig UserRestrictionAreas []av.RestrictionArea SimIsPaused bool SimRate float32 TotalIFR, TotalVFR int Events []Event Instructors map[string]bool }