sim

package
v0.11.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2024 License: GPL-3.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InitiatedTrackEvent = iota
	DroppedTrackEvent
	PushedFlightStripEvent
	PointOutEvent
	OfferedHandoffEvent
	AcceptedHandoffEvent
	AcceptedRedirectedHandoffEvent
	CanceledHandoffEvent
	RejectedHandoffEvent
	RadioTransmissionEvent
	StatusMessageEvent
	ServerBroadcastMessageEvent
	GlobalMessageEvent
	AcknowledgedPointOutEvent
	RejectedPointOutEvent
	IdentEvent
	HandoffControllEvent
	SetGlobalLeaderLineEvent
	TrackClickedEvent
	ForceQLEvent
	TransferAcceptedEvent
	TransferRejectedEvent
	NumEventTypes
)
View Source
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

View Source
const (
	// Flight plan received from a NAS ARTCC.  This is a flight plan that
	// has been sent over by an overlying ERAM facility.
	RemoteEnroute = iota

	// 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)

View Source
const (
	DepartureTime  = "P"
	ArrivalTime    = "A"
	OverflightTime = "E"
)
View Source
const (
	ACID = iota
	BCN
	ControllingPosition
	TypeOfFlight // Figure out this
	SC1
	SC2
	AircraftType
	RequestedALT
	Rules
	DepartureAirport // Specified with type of flight (maybe)
	Errors
)
View Source
const (
	LaunchAutomatic = iota
	LaunchManual
)
View Source
const (
	NewSimCreateLocal = iota
	NewSimCreateRemote
	NewSimJoinRemote
)
View Source
const MaxRestrictionAreas = 100

This many adapted and then this many user-defined

View Source
const STARSTriangleCharacter = string(rune(0x80))

FIXME: yuck, duplicated here

View Source
const ServerSimCallsign = "__SERVER__"
View Source
const TransmitFPMessageTime = 30 * time.Minute
View Source
const ViceRPCVersion = 19
View Source
const ViceServerAddress = "vice.pharr.org"
View Source
const ViceServerPort = 8000 + ViceRPCVersion

Variables

View Source
var (
	ErrAircraftAlreadyReleased     = errors.New("Aircraft already released")
	ErrAircraftNotReleased         = errors.New("Aircraft not released")
	ErrBeaconMismatch              = errors.New("Beacon code mismatch")
	ErrControllerAlreadySignedIn   = errors.New("Controller with that callsign already signed in")
	ErrDuplicateSimName            = errors.New("A sim with that name already exists")
	ErrIllegalACID                 = errors.New("Illegal ACID")
	ErrIllegalACType               = errors.New("Illegal aircraft type")
	ErrIllegalScratchpad           = errors.New("Illegal scratchpad")
	ErrInvalidAbbreviatedFP        = errors.New("Invalid abbreviated flight plan")
	ErrInvalidCommandSyntax        = errors.New("Invalid command syntax")
	ErrInvalidControllerToken      = errors.New("Invalid controller token")
	ErrInvalidDepartureController  = errors.New("Invalid departure controller")
	ErrInvalidPassword             = errors.New("Invalid password")
	ErrInvalidRestrictionAreaIndex = errors.New("Invalid restriction area index")
	ErrNoCoordinationFix           = errors.New("No coordination fix found")
	ErrNoMatchingFlight            = errors.New("No matching flight")
	ErrNoNamedSim                  = errors.New("No Sim with that name")
	ErrNoSimForControllerToken     = errors.New("No Sim running for controller token")
	ErrNotLaunchController         = errors.New("Not signed in as the launch controller")
	ErrRPCTimeout                  = errors.New("RPC call timed out")
	ErrRPCVersionMismatch          = errors.New("Client and server RPC versions don't match")
	ErrRestoringSavedState         = errors.New("Errors during state restoration")
	ErrServerDisconnected          = errors.New("Server disconnected")
	ErrTooManyRestrictionAreas     = errors.New("Too many restriction areas specified")
	ErrUnknownFacility             = errors.New("Unknown facility (ARTCC/TRACON)")
	ErrUnknownControllerFacility   = errors.New("Unknown controller facility")
)

Functions

func BroadcastMessage

func BroadcastMessage(hostname, msg, password string, lg *log.Logger)

func InAirspace

func InAirspace(p math.Point2LL, alt float32, volumes []ControllerAirspaceVolume) (bool, [][2]int)

func LaunchLocalServer

func LaunchLocalServer(extraScenario string, extraVideoMap string, e *util.ErrorLogger, lg *log.Logger) (chan *Server, error)

func LoadScenarioGroups

func LoadScenarioGroups(isLocal bool, extraScenarioFilename string, extraVideoMapFilename string,
	e *util.ErrorLogger, lg *log.Logger) (map[string]map[string]*ScenarioGroup, map[string]map[string]*Configuration, map[string]*av.VideoMapManifest)

LoadScenarioGroups loads all of the available scenarios, both from the scenarios/ directory in the source code distribution as well as, optionally, a scenario file provided on the command line. It doesn't try to do any sort of meaningful error handling but it does try to continue on in the presence of errors; all errors will be printed and the program will exit if there are any. We'd rather force any errors due to invalid scenario definitions to be fixed...

func PostRadioEvents

func PostRadioEvents(from string, transmissions []av.RadioTransmission, ep EventPoster)

func RunServer

func RunServer(extraScenario string, extraVideoMap string, serverPort int, lg *log.Logger)

func TryConnectRemoteServer

func TryConnectRemoteServer(hostname string, lg *log.Logger) chan *serverConnection

func TryDecodeError

func TryDecodeError(e error) error

func TryDecodeErrorString added in v0.11.6

func TryDecodeErrorString(s string) 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 STARSFacilityAdaptation, fields []string) AbbreviatedFPFields

type AcceptHandoffArgs

type AcceptHandoffArgs AircraftSpecifier

type AircraftCommandsArgs

type AircraftCommandsArgs struct {
	ControllerToken string
	Callsign        string
	Commands        string
}

type AircraftCommandsResult

type AircraftCommandsResult struct {
	ErrorMessage   string
	RemainingInput string
}

If an RPC call returns an error, then the result argument is not returned(!?). So we don't use the error type for syntax errors...

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 AircraftSpecifier

type AircraftSpecifier struct {
	ControllerToken string
	Callsign        string
}

type Airspace

type Airspace struct {
	Boundaries map[string][]math.Point2LL            `json:"boundaries"`
	Volumes    map[string][]ControllerAirspaceVolume `json:"volumes"`
}

type AirspaceAwareness

type AirspaceAwareness struct {
	Fix                 []string `json:"fixes"`
	AltitudeRange       [2]int   `json:"altitude_range"`
	ReceivingController string   `json:"receiving_controller"`
	AircraftType        []string `json:"aircraft_type"`
}

type AssignAltitudeArgs

type AssignAltitudeArgs struct {
	ControllerToken string
	Callsign        string
	Altitude        int
}

type CancelHandoffArgs

type CancelHandoffArgs AircraftSpecifier

type ChangeControlPositionArgs

type ChangeControlPositionArgs struct {
	ControllerToken string
	Callsign        string
	KeepTracks      bool
}

type Configuration

type Configuration struct {
	ScenarioConfigs  map[string]*SimScenarioConfiguration
	ControlPositions map[string]*av.Controller
	DefaultScenario  string
}

type Connection

type Connection struct {
	SimState State
	SimProxy *proxy
}

type ConnectionManager

type ConnectionManager struct {
	// contains filtered or unexported fields
}

func MakeServerConnection

func MakeServerConnection(address, additionalScenario, additionalVideoMap string, e *util.ErrorLogger, lg *log.Logger,
	onNewClient func(*ControlClient), onError func(error)) (*ConnectionManager, error)

func (*ConnectionManager) ClientIsLocal

func (cm *ConnectionManager) ClientIsLocal() bool

func (*ConnectionManager) Connected

func (cm *ConnectionManager) Connected() bool

func (*ConnectionManager) ConnectionStartTime

func (cm *ConnectionManager) ConnectionStartTime() time.Time

func (*ConnectionManager) Disconnect

func (cm *ConnectionManager) Disconnect()

func (*ConnectionManager) LoadLocalSim

func (cm *ConnectionManager) LoadLocalSim(s *Sim, lg *log.Logger) (*ControlClient, error)

func (*ConnectionManager) NewConnection

func (cm *ConnectionManager) NewConnection(c Connection)

func (*ConnectionManager) Update

func (cm *ConnectionManager) Update(es *EventStream, lg *log.Logger)

type ControlClient

type ControlClient struct {

	// This is all read-only data that we expect other parts of the system
	// to access directly.
	State
	// contains filtered or unexported fields
}

func NewControlClient

func NewControlClient(ss State, controllerToken string, client *util.RPCClient, lg *log.Logger) *ControlClient

func (*ControlClient) AcceptHandoff

func (c *ControlClient) AcceptHandoff(callsign string, success func(any), err func(error))

func (*ControlClient) AcceptRedirectedHandoff

func (c *ControlClient) AcceptRedirectedHandoff(callsign string, success func(any), err func(error))

func (*ControlClient) AcknowledgePointOut

func (c *ControlClient) AcknowledgePointOut(callsign string, success func(any), err func(error))

func (*ControlClient) AmendFlightPlan

func (c *ControlClient) AmendFlightPlan(callsign string, fp av.FlightPlan) error

func (*ControlClient) AutoAssociateFP

func (c *ControlClient) AutoAssociateFP(callsign string, fp *STARSFlightPlan, success func(any),
	err func(error))

func (*ControlClient) CancelHandoff

func (c *ControlClient) CancelHandoff(callsign string, success func(any), err func(error))

func (*ControlClient) ChangeControlPosition

func (c *ControlClient) ChangeControlPosition(callsign string, keepTracks bool) error

func (*ControlClient) Connected

func (c *ControlClient) Connected() bool

func (*ControlClient) CreateArrival

func (c *ControlClient) CreateArrival(group, airport string, ac *av.Aircraft, success func(any), err func(error))

func (*ControlClient) CreateDeparture

func (c *ControlClient) CreateDeparture(airport, runway, category string, ac *av.Aircraft, success func(any), err func(error))

func (*ControlClient) CreateOverflight added in v0.11.2

func (c *ControlClient) CreateOverflight(group string, ac *av.Aircraft, success func(any), err func(error))

func (*ControlClient) CreateRestrictionArea added in v0.11.6

func (c *ControlClient) CreateRestrictionArea(ra RestrictionArea, success func(int), err func(error))

Note that the success callback is passed an integer, giving the index of the newly-created restriction area.

func (*ControlClient) CreateUnsupportedTrack

func (c *ControlClient) CreateUnsupportedTrack(callsign string, ut *UnsupportedTrack,
	success func(any), err func(error))

func (*ControlClient) CurrentTime

func (c *ControlClient) CurrentTime() time.Time

CurrentTime returns an extrapolated value that models the current Sim's time. (Because the Sim may be running remotely, we have to make some approximations, though they shouldn't cause much trouble since we get an update from the Sim at least once a second...)

func (*ControlClient) DeleteAllAircraft

func (c *ControlClient) DeleteAllAircraft(onErr func(err error))

func (*ControlClient) DeleteRestrictionArea added in v0.11.6

func (c *ControlClient) DeleteRestrictionArea(idx int, success func(any), err func(error))

func (*ControlClient) Disconnect

func (c *ControlClient) Disconnect()

func (*ControlClient) DrawScenarioInfoWindow

func (c *ControlClient) DrawScenarioInfoWindow(lg *log.Logger) (show bool)

func (*ControlClient) DropTrack

func (c *ControlClient) DropTrack(callsign string, success func(any), err func(error))

func (*ControlClient) ForceQL

func (c *ControlClient) ForceQL(callsign, controller string, success func(any), err func(error))

func (*ControlClient) GetSerializeSim

func (c *ControlClient) GetSerializeSim() (*Sim, error)

func (*ControlClient) GetSimRate

func (c *ControlClient) GetSimRate() float32

func (*ControlClient) GetUpdates

func (c *ControlClient) GetUpdates(eventStream *EventStream, onErr func(error))

func (*ControlClient) GetVideoMapLibrary added in v0.11.6

func (c *ControlClient) GetVideoMapLibrary(filename string) (*av.VideoMapLibrary, error)

func (*ControlClient) HandoffTrack

func (c *ControlClient) HandoffTrack(callsign string, controller string, success func(any), err func(error))

func (*ControlClient) InitiateTrack

func (c *ControlClient) InitiateTrack(callsign string, fp *STARSFlightPlan, success func(any),
	err func(error))

func (*ControlClient) LaunchAircraft

func (c *ControlClient) LaunchAircraft(ac av.Aircraft)

func (*ControlClient) PointOut

func (c *ControlClient) PointOut(callsign string, controller string, success func(any), err func(error))

func (*ControlClient) RPCClient

func (c *ControlClient) RPCClient() *util.RPCClient

func (*ControlClient) RedirectHandoff

func (c *ControlClient) RedirectHandoff(callsign, controller string, success func(any), err func(error))

func (*ControlClient) RejectPointOut

func (c *ControlClient) RejectPointOut(callsign string, success func(any), err func(error))

func (*ControlClient) ReleaseDeparture added in v0.11.5

func (c *ControlClient) ReleaseDeparture(callsign string, success func(any), err func(error))

func (*ControlClient) RunAircraftCommands

func (c *ControlClient) RunAircraftCommands(callsign string, cmds string, handleResult func(message string, remainingInput string))

func (*ControlClient) ScopeDrawApproaches

func (c *ControlClient) ScopeDrawApproaches() map[string]map[string]bool

func (*ControlClient) ScopeDrawArrivals

func (c *ControlClient) ScopeDrawArrivals() map[string]map[int]bool

func (*ControlClient) ScopeDrawDepartures

func (c *ControlClient) ScopeDrawDepartures() map[string]map[string]map[string]bool

func (*ControlClient) ScopeDrawOverflights added in v0.11.2

func (c *ControlClient) ScopeDrawOverflights() map[string]map[int]bool

func (*ControlClient) SendGlobalMessage

func (c *ControlClient) SendGlobalMessage(global GlobalMessage)

func (*ControlClient) SetGlobalLeaderLine

func (c *ControlClient) SetGlobalLeaderLine(callsign string, dir *math.CardinalOrdinalDirection, success func(any), err func(error))

func (*ControlClient) SetLaunchConfig

func (c *ControlClient) SetLaunchConfig(lc LaunchConfig)

func (*ControlClient) SetScratchpad

func (c *ControlClient) SetScratchpad(callsign string, scratchpad string, success func(any), err func(error))

func (*ControlClient) SetSecondaryScratchpad

func (c *ControlClient) SetSecondaryScratchpad(callsign string, scratchpad string, success func(any), err func(error))

func (*ControlClient) SetSimRate

func (c *ControlClient) SetSimRate(r float32)

func (*ControlClient) SetSquawk

func (c *ControlClient) SetSquawk(callsign string, squawk av.Squawk) error

func (*ControlClient) SetSquawkAutomatic

func (c *ControlClient) SetSquawkAutomatic(callsign string) error

func (*ControlClient) SetTemporaryAltitude

func (c *ControlClient) SetTemporaryAltitude(callsign string, alt int, success func(any), err func(error))

func (*ControlClient) Status

func (c *ControlClient) Status() string

func (*ControlClient) TakeOrReturnLaunchControl

func (c *ControlClient) TakeOrReturnLaunchControl(eventStream *EventStream)

func (*ControlClient) ToggleSPCOverride

func (c *ControlClient) ToggleSPCOverride(callsign string, spc string, success func(any), err func(error))

func (*ControlClient) ToggleSimPause

func (c *ControlClient) ToggleSimPause()

func (*ControlClient) TowerListAirports added in v0.11.5

func (c *ControlClient) TowerListAirports() []string

func (*ControlClient) UpdateRestrictionArea added in v0.11.6

func (c *ControlClient) UpdateRestrictionArea(idx int, ra RestrictionArea, success func(any), err func(error))

func (*ControlClient) UpdateWorld

func (c *ControlClient) UpdateWorld(wu *WorldUpdate, eventStream *EventStream)

func (*ControlClient) UploadFlightPlan

func (c *ControlClient) UploadFlightPlan(fp *STARSFlightPlan, typ int, success func(any), err func(error))

type ControllerAirspaceVolume

type ControllerAirspaceVolume struct {
	LowerLimit    int               `json:"lower"`
	UpperLimit    int               `json:"upper"`
	Boundaries    [][]math.Point2LL `json:"boundary_polylines"` // not in JSON
	BoundaryNames []string          `json:"boundaries"`
}

type CoordinationList added in v0.11.5

type CoordinationList struct {
	Name          string   `json:"name"`
	Id            string   `json:"id"`
	Airports      []string `json:"airports"`
	YellowEntries bool     `json:"yellow_entries"`
}

type CoordinationTime

type CoordinationTime struct {
	Time time.Time
	Type string // A for arrivals, P for Departures, E for overflights
}

type CreateArrivalArgs

type CreateArrivalArgs struct {
	ControllerToken string
	Group           string
	Airport         string
}

type CreateDepartureArgs

type CreateDepartureArgs struct {
	ControllerToken string
	Airport         string
	Runway          string
	Category        string
}

type CreateOverflightArgs added in v0.11.2

type CreateOverflightArgs struct {
	ControllerToken string
	Group           string
}

type CreateUnsupportedTrackArgs

type CreateUnsupportedTrackArgs struct {
	ControllerToken  string
	Callsign         string
	UnsupportedTrack *UnsupportedTrack
}

type DeleteAircraftArgs

type DeleteAircraftArgs AircraftSpecifier

type DepartureAircraft added in v0.11.5

type DepartureAircraft struct {
	Callsign         string
	Runway           string
	ReleaseRequested bool
	Index            int
	MinSeparation    time.Duration // How long after takeoff it will be at ~6000' and airborne
	LaunchTime       time.Time
}

DepartureAircraft represents a departing aircraft, either still on the ground or recently-launched.

type Dispatcher

type Dispatcher struct {
	// contains filtered or unexported fields
}

func (*Dispatcher) AcceptHandoff

func (sd *Dispatcher) AcceptHandoff(ah *AcceptHandoffArgs, _ *struct{}) error

func (*Dispatcher) AcceptRedirectedHandoff

func (sd *Dispatcher) AcceptRedirectedHandoff(po *AcceptHandoffArgs, _ *struct{}) error

func (*Dispatcher) AcknowledgePointOut

func (sd *Dispatcher) AcknowledgePointOut(po *PointOutArgs, _ *struct{}) error

func (*Dispatcher) AutoAssociateFP

func (sd *Dispatcher) AutoAssociateFP(it *InitiateTrackArgs, _ *struct{}) error

func (*Dispatcher) CancelHandoff

func (sd *Dispatcher) CancelHandoff(ch *CancelHandoffArgs, _ *struct{}) error

func (*Dispatcher) ChangeControlPosition

func (sd *Dispatcher) ChangeControlPosition(cs *ChangeControlPositionArgs, _ *struct{}) error

func (*Dispatcher) CreateArrival

func (sd *Dispatcher) CreateArrival(aa *CreateArrivalArgs, arrAc *av.Aircraft) error

func (*Dispatcher) CreateDeparture

func (sd *Dispatcher) CreateDeparture(da *CreateDepartureArgs, depAc *av.Aircraft) error

func (*Dispatcher) CreateOverflight added in v0.11.2

func (sd *Dispatcher) CreateOverflight(oa *CreateOverflightArgs, ofAc *av.Aircraft) error

func (*Dispatcher) CreateRestrictionArea added in v0.11.6

func (sd *Dispatcher) CreateRestrictionArea(ra *RestrictionAreaArgs, idx *int) error

func (*Dispatcher) CreateUnsupportedTrack

func (sd *Dispatcher) CreateUnsupportedTrack(it *CreateUnsupportedTrackArgs, _ *struct{}) error

func (*Dispatcher) DeleteAllAircraft

func (sd *Dispatcher) DeleteAllAircraft(da *DeleteAircraftArgs, _ *struct{}) error

func (*Dispatcher) DeleteRestrictionArea added in v0.11.6

func (sd *Dispatcher) DeleteRestrictionArea(ra *RestrictionAreaArgs, _ *struct{}) error

func (*Dispatcher) DropTrack

func (sd *Dispatcher) DropTrack(dt *DropTrackArgs, _ *struct{}) error

func (*Dispatcher) ForceQL added in v0.11.4

func (sd *Dispatcher) ForceQL(ql *ForceQLArgs, _ *struct{}) error

func (*Dispatcher) GetVideoMapLibrary added in v0.11.6

func (sd *Dispatcher) GetVideoMapLibrary(vm *VideoMapsArgs, vmf *av.VideoMapLibrary) error

func (*Dispatcher) GetWorldUpdate

func (sd *Dispatcher) GetWorldUpdate(token string, update *WorldUpdate) error

func (*Dispatcher) GlobalMessage

func (sd *Dispatcher) GlobalMessage(po *GlobalMessageArgs, _ *struct{}) error

func (*Dispatcher) HandoffTrack

func (sd *Dispatcher) HandoffTrack(h *HandoffArgs, _ *struct{}) error

func (*Dispatcher) InitiateTrack

func (sd *Dispatcher) InitiateTrack(it *InitiateTrackArgs, _ *struct{}) error

func (*Dispatcher) LaunchAircraft

func (sd *Dispatcher) LaunchAircraft(ls *LaunchAircraftArgs, _ *struct{}) error

func (*Dispatcher) PointOut

func (sd *Dispatcher) PointOut(po *PointOutArgs, _ *struct{}) error

func (*Dispatcher) RedirectHandoff

func (sd *Dispatcher) RedirectHandoff(h *HandoffArgs, _ *struct{}) error

func (*Dispatcher) RejectPointOut

func (sd *Dispatcher) RejectPointOut(po *PointOutArgs, _ *struct{}) error

func (*Dispatcher) ReleaseDeparture added in v0.11.5

func (sd *Dispatcher) ReleaseDeparture(hd *HeldDepartureArgs, _ *struct{}) error

func (*Dispatcher) RunAircraftCommands

func (sd *Dispatcher) RunAircraftCommands(cmds *AircraftCommandsArgs, result *AircraftCommandsResult) error

func (*Dispatcher) SetGlobalLeaderLine

func (sd *Dispatcher) SetGlobalLeaderLine(a *SetGlobalLeaderLineArgs, _ *struct{}) error

func (*Dispatcher) SetLaunchConfig

func (sd *Dispatcher) SetLaunchConfig(lc *SetLaunchConfigArgs, _ *struct{}) error

func (*Dispatcher) SetScratchpad

func (sd *Dispatcher) SetScratchpad(a *SetScratchpadArgs, _ *struct{}) error

func (*Dispatcher) SetSecondaryScratchpad

func (sd *Dispatcher) SetSecondaryScratchpad(a *SetScratchpadArgs, _ *struct{}) error

func (*Dispatcher) SetSimRate

func (sd *Dispatcher) SetSimRate(r *SetSimRateArgs, _ *struct{}) error

func (*Dispatcher) SetTemporaryAltitude

func (sd *Dispatcher) SetTemporaryAltitude(alt *AssignAltitudeArgs, _ *struct{}) error

func (*Dispatcher) SignOff

func (sd *Dispatcher) SignOff(token string, _ *struct{}) error

func (*Dispatcher) TakeOrReturnLaunchControl

func (sd *Dispatcher) TakeOrReturnLaunchControl(token string, _ *struct{}) error

func (*Dispatcher) TogglePause

func (sd *Dispatcher) TogglePause(token string, _ *struct{}) error

func (*Dispatcher) ToggleSPCOverride

func (sd *Dispatcher) ToggleSPCOverride(ts *ToggleSPCArgs, _ *struct{}) error

func (*Dispatcher) UpdateRestrictionArea added in v0.11.6

func (sd *Dispatcher) UpdateRestrictionArea(ra *RestrictionAreaArgs, _ *struct{}) error

func (*Dispatcher) UploadFlightPlan

func (sd *Dispatcher) UploadFlightPlan(it *UploadPlanArgs, _ *struct{}) error

type DropTrackArgs

type DropTrackArgs AircraftSpecifier

type ERAMComputer

type ERAMComputer struct {
	STARSComputers   map[string]*STARSComputer
	ReceivedMessages []FlightPlanMessage
	FlightPlans      map[av.Squawk]*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 *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) DropTrack

func (comp *ERAMComputer) DropTrack(ac *av.Aircraft) error

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 *STARSFlightPlan) error

func (*ERAMComputer) SendFlightPlan

func (comp *ERAMComputer) SendFlightPlan(fp *STARSFlightPlan, tracon string, simTime time.Time) error

For individual plans being sent.

func (*ERAMComputer) SendFlightPlans

func (comp *ERAMComputer) SendFlightPlans(tracon string, simTime time.Time, lg *log.Logger)

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 STARSFacilityAdaptation, simTime time.Time) error

func (*ERAMComputers) CompletelyDeleteAircraft

func (ec *ERAMComputers) CompletelyDeleteAircraft(ac *av.Aircraft)

func (ERAMComputers) DumpMap

func (e ERAMComputers) DumpMap()

For debugging purposes

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) (*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 ERAMTrackInfo struct {
	Location          math.Point2LL
	Owner             string
	HandoffController string
}

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
}

func (Event) LogValue

func (e Event) LogValue() slog.Value

func (*Event) String

func (e *Event) String() string

type EventPoster

type EventPoster interface {
	PostEvent(Event)
}

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 EventType

type EventType int

func (EventType) String

func (t EventType) String() string

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 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 (FlightPlanMessage) FlightPlan

func (s FlightPlanMessage) FlightPlan() *STARSFlightPlan

Converts the message to a STARS flight plan.

type ForceQLArgs

type ForceQLArgs struct {
	ControllerToken string
	Callsign        string
	Controller      string
}

type GlobalMessage

type GlobalMessage struct {
	Message        string
	FromController string
}

type GlobalMessageArgs

type GlobalMessageArgs struct {
	ControllerToken string
	FromController  string
	Message         string
}

type Handoff

type Handoff struct {
	Time              time.Time
	ReceivingFacility string // only for auto accept
}

type HandoffArgs

type HandoffArgs struct {
	ControllerToken string
	Callsign        string
	Controller      string
}

type HeadingArgs

type HeadingArgs struct {
	ControllerToken string
	Callsign        string
	Heading         int
	Present         bool
	LeftDegrees     int
	RightDegrees    int
	Turn            av.TurnMethod
}

type HeldDepartureArgs added in v0.11.5

type HeldDepartureArgs AircraftSpecifier

type InboundFlow added in v0.11.2

type InboundFlow struct {
	Arrivals    []av.Arrival    `json:"arrivals"`
	Overflights []av.Overflight `json:"overflights"`
}

type InitiateTrackArgs

type InitiateTrackArgs struct {
	AircraftSpecifier
	Plan *STARSFlightPlan
}

type IntermTrackArgs

type IntermTrackArgs struct {
	Token, Callsign, Initial string
	// contains filtered or unexported fields
}

type LaunchAircraftArgs

type LaunchAircraftArgs struct {
	ControllerToken string
	Aircraft        av.Aircraft
}

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
	// 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.

func MakeLaunchConfig

func MakeLaunchConfig(dep []ScenarioGroupDepartureRunway, inbound map[string]map[string]int) LaunchConfig

func (*LaunchConfig) DrawArrivalUI

func (lc *LaunchConfig) DrawArrivalUI(p platform.Platform) (changed bool)

func (*LaunchConfig) DrawDepartureUI

func (lc *LaunchConfig) DrawDepartureUI(p platform.Platform) (changed bool)

func (*LaunchConfig) DrawOverflightUI added in v0.11.2

func (lc *LaunchConfig) DrawOverflightUI(p platform.Platform) (changed bool)

type NewSimConfiguration

type NewSimConfiguration struct {
	TRACONName   string
	TRACON       map[string]*Configuration
	GroupName    string
	Scenario     *SimScenarioConfiguration
	ScenarioName string

	NewSimName      string // for create remote only
	RequirePassword bool   // for create remote only
	Password        string // for create remote only
	NewSimType      int
	TFRs            []av.TFR

	LiveWeather               bool
	InstructorAllowed         bool
	Instructor                bool
	SelectedRemoteSim         string
	SelectedRemoteSimPosition string
	RemoteSimPassword         string // for join remote only

	DisplayError error
	// contains filtered or unexported fields
}

func MakeNewSimConfiguration

func MakeNewSimConfiguration(mgr *ConnectionManager, defaultTRACON *string, tfrCache *av.TFRCache, lg *log.Logger) *NewSimConfiguration

func (*NewSimConfiguration) DrawRatesUI

func (c *NewSimConfiguration) DrawRatesUI(p platform.Platform) bool

func (*NewSimConfiguration) DrawUI

func (*NewSimConfiguration) OkDisabled

func (c *NewSimConfiguration) OkDisabled() bool

func (*NewSimConfiguration) SetScenario

func (c *NewSimConfiguration) SetScenario(groupName, scenarioName string)

func (*NewSimConfiguration) SetTRACON

func (c *NewSimConfiguration) SetTRACON(name string)

func (*NewSimConfiguration) ShowRatesWindow

func (c *NewSimConfiguration) ShowRatesWindow() bool

func (*NewSimConfiguration) Start

func (c *NewSimConfiguration) Start() error

func (*NewSimConfiguration) UIButtonText

func (c *NewSimConfiguration) UIButtonText() string

type NewSimResult

type NewSimResult struct {
	SimState        *State
	ControllerToken string
}

type PointOut

type PointOut struct {
	FromController string
	AcceptTime     time.Time
}

type PointOutArgs

type PointOutArgs struct {
	ControllerToken string
	Callsign        string
	Controller      string
}

type RemoteSim

type RemoteSim struct {
	GroupName          string
	ScenarioName       string
	PrimaryController  string
	RequirePassword    bool
	InstructorAllowed  bool
	AvailablePositions map[string]struct{}
	CoveredPositions   map[string]struct{}
}

type RestrictionArea added in v0.11.6

type RestrictionArea struct {
	Title        string           `json:"title"`
	Text         [2]string        `json:"text"`
	BlinkingText bool             `json:"blinking_text"`
	HideId       bool             `json:"hide_id"`
	TextPosition math.Point2LL    `json:"text_position"`
	CircleCenter math.Point2LL    `json:"circle_center"`
	CircleRadius float32          `json:"circle_radius"`
	VerticesUser av.WaypointArray `json:"vertices"`
	Vertices     [][]math.Point2LL
	Closed       bool `json:"closed"`
	Shaded       bool `json:"shade_region"`
	Color        int  `json:"color"`

	Tris    [][3]math.Point2LL
	Deleted bool
}

func RestrictionAreaFromTFR added in v0.11.6

func RestrictionAreaFromTFR(tfr av.TFR) RestrictionArea

func (*RestrictionArea) AverageVertexPosition added in v0.11.6

func (ra *RestrictionArea) AverageVertexPosition() math.Point2LL

func (*RestrictionArea) MoveTo added in v0.11.6

func (ra *RestrictionArea) MoveTo(p math.Point2LL)

func (*RestrictionArea) UpdateTriangles added in v0.11.6

func (ra *RestrictionArea) UpdateTriangles()

type RestrictionAreaArgs added in v0.11.6

type RestrictionAreaArgs struct {
	ControllerToken string
	Index           int
	RestrictionArea RestrictionArea
}

type STARSComputer

type STARSComputer struct {
	Identifier        string
	ContainedPlans    map[av.Squawk]*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 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 *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 *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) DropTrack

func (comp *STARSComputer) DropTrack(ac *av.Aircraft) error

func (*STARSComputer) GetFlightPlan

func (comp *STARSComputer) GetFlightPlan(identifier string) (*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 *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) 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) 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 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"`
}

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"`
	InhibitCAVolumes    []av.AirspaceVolume              `json:"inhibit_ca_volumes"`
	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"`

	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
	BeaconBank        int                           `json:"beacon_bank"`
	KeepLDB           bool                          `json:"keep_ldb"`
	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"`
	} `json:"pdb"`
	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"`
	CoordinationLists []CoordinationList `json:"coordination_lists"`
	RestrictionAreas  []RestrictionArea  `json:"restriction_areas"`
	UseLegacyFont     bool               `json:"use_legacy_font"`
}

func (*STARSFacilityAdaptation) GetCoordinationFix

func (fa *STARSFacilityAdaptation) GetCoordinationFix(fp *STARSFlightPlan, acpos math.Point2LL, waypoints []av.Waypoint) (string, bool)

func (*STARSFacilityAdaptation) PostDeserialize

func (s *STARSFacilityAdaptation) PostDeserialize(e *util.ErrorLogger, sg *ScenarioGroup, manifest *av.VideoMapManifest)

type STARSFlightPlan

type STARSFlightPlan struct {
	*av.FlightPlan
	FlightPlanType      int
	CoordinationTime    CoordinationTime
	CoordinationFix     string
	ContainedFacilities []string
	Altitude            string
	SP1                 string
	SP2                 string
	InitialController   string // For abbreviated FPs
}

func MakeSTARSFlightPlan

func MakeSTARSFlightPlan(fp *av.FlightPlan) *STARSFlightPlan

func MakeSTARSFlightPlanFromAbbreviated

func MakeSTARSFlightPlanFromAbbreviated(abbr string, stars *STARSComputer, facilityAdaptation STARSFacilityAdaptation) (*STARSFlightPlan, error)

func (STARSFlightPlan) Message

func (fp STARSFlightPlan) Message() FlightPlanMessage

func (*STARSFlightPlan) SetCoordinationFix

func (fp *STARSFlightPlan) SetCoordinationFix(fa STARSFacilityAdaptation, ac *av.Aircraft, simTime time.Time) error

type Scenario

type Scenario struct {
	SoloController      string                   `json:"solo_controller"`
	SplitConfigurations av.SplitConfigurationSet `json:"multi_controllers"`
	DefaultSplit        string                   `json:"default_split"`
	Wind                av.Wind                  `json:"wind"`
	VirtualControllers  []string                 `json:"controllers"`

	// Map from inbound flow names to a map from airport name to default rate,
	// with "overflights" a special case to denote overflights
	InboundFlowDefaultRates map[string]map[string]int `json:"inbound_rates"`
	// Temporary backwards compatibility
	ArrivalGroupDefaultRates map[string]map[string]int `json:"arrivals"`

	ApproachAirspace       []ControllerAirspaceVolume `json:"approach_airspace_volumes"`  // not in JSON
	DepartureAirspace      []ControllerAirspaceVolume `json:"departure_airspace_volumes"` // not in JSON
	ApproachAirspaceNames  []string                   `json:"approach_airspace"`
	DepartureAirspaceNames []string                   `json:"departure_airspace"`

	DepartureRunways []ScenarioGroupDepartureRunway `json:"departure_runways,omitempty"`
	ArrivalRunways   []ScenarioGroupArrivalRunway   `json:"arrival_runways,omitempty"`

	Center       math.Point2LL `json:"-"`
	CenterString string        `json:"center"`
	Range        float32       `json:"range"`
	DefaultMaps  []string      `json:"default_maps"`
}

func (*Scenario) PostDeserialize

func (s *Scenario) PostDeserialize(sg *ScenarioGroup, e *util.ErrorLogger, manifest *av.VideoMapManifest)

type ScenarioGroup

type ScenarioGroup struct {
	TRACON           string                    `json:"tracon"`
	Name             string                    `json:"name"`
	Airports         map[string]*av.Airport    `json:"airports"`
	Fixes            map[string]math.Point2LL  `json:"-"`
	FixesStrings     util.OrderedMap           `json:"fixes"`
	Scenarios        map[string]*Scenario      `json:"scenarios"`
	DefaultScenario  string                    `json:"default_scenario"`
	ControlPositions map[string]*av.Controller `json:"control_positions"`
	Airspace         Airspace                  `json:"airspace"`
	InboundFlows     map[string]InboundFlow    `json:"inbound_flows"`

	PrimaryAirport string `json:"primary_airport"`

	ReportingPointStrings []string            `json:"reporting_points"`
	ReportingPoints       []av.ReportingPoint // not in JSON

	NmPerLatitude           float32 // Always 60
	NmPerLongitude          float32 // Derived from Center
	MagneticVariation       float32
	MagneticAdjustment      float32                 `json:"magnetic_adjustment"`
	STARSFacilityAdaptation STARSFacilityAdaptation `json:"stars_config"`
}

func (*ScenarioGroup) Locate

func (sg *ScenarioGroup) Locate(s string) (math.Point2LL, bool)

func (*ScenarioGroup) PostDeserialize

func (sg *ScenarioGroup) PostDeserialize(multiController bool, e *util.ErrorLogger, simConfigurations map[string]map[string]*Configuration,
	manifest *av.VideoMapManifest)

type ScenarioGroupArrivalRunway

type ScenarioGroupArrivalRunway struct {
	Airport string `json:"airport"`
	Runway  string `json:"runway"`
}

type ScenarioGroupDepartureRunway

type ScenarioGroupDepartureRunway struct {
	Airport     string `json:"airport"`
	Runway      string `json:"runway"`
	Category    string `json:"category,omitempty"`
	DefaultRate int    `json:"rate"`

	ExitRoutes map[string]av.ExitRoute // copied from airport's  departure_routes
}

type Server

type Server struct {
	*util.RPCClient
	// contains filtered or unexported fields
}

func (*Server) Close

func (s *Server) Close() error

type ServerController

type ServerController struct {
	Callsign string
	// contains filtered or unexported fields
}

func (*ServerController) LogValue

func (sc *ServerController) LogValue() slog.Value

type SetGlobalLeaderLineArgs

type SetGlobalLeaderLineArgs struct {
	ControllerToken string
	Callsign        string
	Direction       *math.CardinalOrdinalDirection
}

type SetLaunchConfigArgs

type SetLaunchConfigArgs struct {
	ControllerToken string
	Config          LaunchConfig
}

type SetScratchpadArgs

type SetScratchpadArgs struct {
	ControllerToken string
	Callsign        string
	Scratchpad      string
}

type SetSimRateArgs

type SetSimRateArgs struct {
	ControllerToken string
	Rate            float32
}

type SignOnResult

type SignOnResult struct {
	Configurations map[string]map[string]*Configuration
	RunningSims    map[string]*RemoteSim
}

type SignificantPoint added in v0.11.5

type SignificantPoint struct {
	Name         string        // JSON comes in as a map from name to SignificantPoint; we set this.
	ShortName    string        `json:"short_name"`
	Abbreviation string        `json:"abbreviation"`
	Description  string        `json:"description"`
	Location     math.Point2LL `json:"location"`
}

type Sim

type Sim struct {
	Name string

	ScenarioGroup string
	Scenario      string

	State *State

	SignOnPositions map[string]*av.Controller

	LaunchConfig LaunchConfig

	// For each airport, at what time we would like to launch a departure,
	// based on the airport's departure rate. The actual time an aircraft
	// is launched may be later, e.g. if we need longer for wake turbulence
	// separation, etc.
	NextDepartureLaunch map[string]time.Time
	// Map from airport to aircraft that are ready to go. The slice is
	// ordered according to the departure sequence.
	DeparturePool map[string][]DepartureAircraft
	// Index to track departing aircraft; we use this to make sure we don't
	// keep pushing an aircraft to the end of the queue.
	DepartureIndex map[string]int
	// Airport -> runway -> *DepartureAircraft (nil if none launched yet)
	LastDeparture map[string]map[string]*DepartureAircraft

	// Key is inbound flow group name
	NextInboundSpawn map[string]time.Time

	Handoffs map[string]Handoff
	// callsign -> "to" controller
	PointOuts map[string]map[string]PointOut

	TotalDepartures  int
	TotalArrivals    int
	TotalOverflights int

	ReportingPoints []av.ReportingPoint

	RequirePassword bool
	Password        string

	SimTime time.Time // this is our fake time--accounting for pauses & simRate..

	SimRate float32
	Paused  bool

	NextPushStart time.Time // both w.r.t. sim time
	PushEnd       time.Time

	InstructorAllowed bool
	Instructors       map[string]bool
	// contains filtered or unexported fields
}

func NewSim

func NewSim(ssc NewSimConfiguration, scenarioGroups map[string]map[string]*ScenarioGroup, isLocal bool,
	manifests map[string]*av.VideoMapManifest, lg *log.Logger) *Sim

func (*Sim) AcceptHandoff

func (s *Sim) AcceptHandoff(token, callsign string) error

func (*Sim) AcceptRedirectedHandoff

func (s *Sim) AcceptRedirectedHandoff(token, callsign string) error

func (*Sim) AcknowledgePointOut

func (s *Sim) AcknowledgePointOut(token, callsign string) error

func (*Sim) Activate

func (s *Sim) Activate(lg *log.Logger)

func (*Sim) AssignAltitude

func (s *Sim) AssignAltitude(token, callsign string, altitude int, afterSpeed bool) error

func (*Sim) AssignHeading

func (s *Sim) AssignHeading(hdg *HeadingArgs) error

func (*Sim) AssignSpeed

func (s *Sim) AssignSpeed(token, callsign string, speed int, afterAltitude bool) error

func (*Sim) AtFixCleared

func (s *Sim) AtFixCleared(token, callsign, fix, approach string) error

func (*Sim) AutoAssociateFP

func (s *Sim) AutoAssociateFP(token, callsign string, fp *STARSFlightPlan) error

func (*Sim) CancelApproachClearance

func (s *Sim) CancelApproachClearance(token, callsign string) error

func (*Sim) CancelHandoff

func (s *Sim) CancelHandoff(token, callsign string) error

func (*Sim) ChangeControlPosition

func (s *Sim) ChangeControlPosition(token string, callsign string, keepTracks bool) error

func (*Sim) ChangeSquawk

func (s *Sim) ChangeSquawk(token, callsign string, sq av.Squawk) error

func (*Sim) ClearedApproach

func (s *Sim) ClearedApproach(token, callsign, approach string, straightIn bool) error

func (*Sim) ClimbViaSID

func (s *Sim) ClimbViaSID(token, callsign string) error

func (*Sim) ContactTower

func (s *Sim) ContactTower(token, callsign string) error

func (*Sim) CreateArrival

func (s *Sim) CreateArrival(arrivalGroup string, arrivalAirport string) (*av.Aircraft, error)

func (*Sim) CreateDeparture

func (s *Sim) CreateDeparture(departureAirport, runway, category string) (*av.Aircraft, error)

func (*Sim) CreateOverflight added in v0.11.2

func (s *Sim) CreateOverflight(group string) (*av.Aircraft, error)

func (*Sim) CreateRestrictionArea added in v0.11.6

func (s *Sim) CreateRestrictionArea(ra RestrictionArea) (int, error)

func (*Sim) CreateUnsupportedTrack

func (s *Sim) CreateUnsupportedTrack(token, callsign string, ut *UnsupportedTrack) error

func (*Sim) CrossFixAt

func (s *Sim) CrossFixAt(token, callsign, fix string, ar *av.AltitudeRestriction, speed int) error

func (*Sim) DeleteAircraft

func (s *Sim) DeleteAircraft(token, callsign string) error

func (*Sim) DeleteAllAircraft

func (s *Sim) DeleteAllAircraft(token string) error

func (*Sim) DeleteRestrictionArea added in v0.11.6

func (s *Sim) DeleteRestrictionArea(idx int) error

func (*Sim) DepartFixDirect

func (s *Sim) DepartFixDirect(token, callsign, fixa string, fixb string) error

func (*Sim) DepartFixHeading

func (s *Sim) DepartFixHeading(token, callsign, fix string, heading int) error

func (*Sim) DescendViaSTAR

func (s *Sim) DescendViaSTAR(token, callsign string) error

func (*Sim) DirectFix

func (s *Sim) DirectFix(token, callsign, fix string) error

func (*Sim) DropTrack

func (s *Sim) DropTrack(token, callsign string) error

func (*Sim) ExpectApproach

func (s *Sim) ExpectApproach(token, callsign, approach string) error

func (*Sim) ExpediteClimb

func (s *Sim) ExpediteClimb(token, callsign string) error

func (*Sim) ExpediteDescent

func (s *Sim) ExpediteDescent(token, callsign string) error

func (*Sim) ForceQL

func (s *Sim) ForceQL(token, callsign, controller string) error

func (*Sim) GetVideoMapLibrary added in v0.11.6

func (s *Sim) GetVideoMapLibrary(filename string) (*av.VideoMapLibrary, error)

func (*Sim) GetWorldUpdate

func (s *Sim) GetWorldUpdate(token string, update *WorldUpdate) error

func (*Sim) GlobalMessage

func (s *Sim) GlobalMessage(global GlobalMessageArgs) error

func (*Sim) GoAround

func (s *Sim) GoAround(token, callsign string) error

func (*Sim) HandoffControl

func (s *Sim) HandoffControl(token, callsign string) error

func (*Sim) HandoffTrack

func (s *Sim) HandoffTrack(token, callsign, controller string) error

func (*Sim) Ident

func (s *Sim) Ident(token, callsign string) error

func (*Sim) IdleTime

func (s *Sim) IdleTime() time.Duration

func (*Sim) InitiateTrack

func (s *Sim) InitiateTrack(token, callsign string, fp *STARSFlightPlan) error

func (*Sim) InterceptLocalizer

func (s *Sim) InterceptLocalizer(token, callsign string) error

func (*Sim) LaunchAircraft

func (s *Sim) LaunchAircraft(ac av.Aircraft)

func (*Sim) LogValue

func (s *Sim) LogValue() slog.Value

func (*Sim) MaintainMaximumForward

func (s *Sim) MaintainMaximumForward(token, callsign string) error

func (*Sim) MaintainSlowestPractical

func (s *Sim) MaintainSlowestPractical(token, callsign string) error

func (*Sim) PointOut

func (s *Sim) PointOut(token, callsign, controller string) error

func (*Sim) PostEvent

func (s *Sim) PostEvent(e Event)

func (*Sim) RedirectHandoff

func (s *Sim) RedirectHandoff(token, callsign, controller string) error

func (*Sim) RejectPointOut

func (s *Sim) RejectPointOut(token, callsign string) error

func (*Sim) ReleaseDeparture added in v0.11.5

func (s *Sim) ReleaseDeparture(token, callsign string) error

func (*Sim) ResolveController

func (s *Sim) ResolveController(callsign string) string

func (*Sim) SayAltitude

func (s *Sim) SayAltitude(token, callsign string) error

func (*Sim) SayHeading

func (s *Sim) SayHeading(token, callsign string) error

func (*Sim) SaySpeed

func (s *Sim) SaySpeed(token, callsign string) error

func (*Sim) SetGlobalLeaderLine

func (s *Sim) SetGlobalLeaderLine(token, callsign string, dir *math.CardinalOrdinalDirection) error

func (*Sim) SetLaunchConfig

func (s *Sim) SetLaunchConfig(token string, lc LaunchConfig) error

func (*Sim) SetScratchpad

func (s *Sim) SetScratchpad(token, callsign, scratchpad string) error

func (*Sim) SetSecondaryScratchpad

func (s *Sim) SetSecondaryScratchpad(token, callsign, scratchpad string) error

func (*Sim) SetSimRate

func (s *Sim) SetSimRate(token string, rate float32) error

func (*Sim) SetTemporaryAltitude

func (s *Sim) SetTemporaryAltitude(token, callsign string, altitude int) error

func (*Sim) SignOff

func (s *Sim) SignOff(token string) error

func (*Sim) SignOn

func (s *Sim) SignOn(callsign string, instructor bool) (*State, string, error)

func (*Sim) TakeOrReturnLaunchControl

func (s *Sim) TakeOrReturnLaunchControl(token string) error

func (*Sim) TogglePause

func (s *Sim) TogglePause(token string) error

func (*Sim) ToggleSPCOverride

func (s *Sim) ToggleSPCOverride(token, callsign, spc string) error

func (*Sim) Update

func (s *Sim) Update()

func (*Sim) UpdateRestrictionArea added in v0.11.6

func (s *Sim) UpdateRestrictionArea(idx int, ra RestrictionArea) error

func (*Sim) UploadFlightPlan

func (s *Sim) UploadFlightPlan(token string, Type int, plan *STARSFlightPlan) error

type SimBroadcastMessage

type SimBroadcastMessage struct {
	Password string
	Message  string
}

type SimManager

type SimManager struct {
	// contains filtered or unexported fields
}

func NewSimManager

func NewSimManager(scenarioGroups map[string]map[string]*ScenarioGroup,
	simConfigurations map[string]map[string]*Configuration, manifests map[string]*av.VideoMapManifest,
	lg *log.Logger) *SimManager

func (*SimManager) Add

func (sm *SimManager) Add(sim *Sim, result *NewSimResult) error

func (*SimManager) Broadcast

func (sm *SimManager) Broadcast(m *SimBroadcastMessage, _ *struct{}) error

func (*SimManager) ControllerTokenToSim

func (sm *SimManager) ControllerTokenToSim(token string) (*Sim, bool)

func (*SimManager) GetRunningSims

func (sm *SimManager) GetRunningSims(_ int, result *map[string]*RemoteSim) error

func (*SimManager) GetSerializeSim

func (sm *SimManager) GetSerializeSim(token string, s *Sim) error

func (*SimManager) New

func (sm *SimManager) New(config *NewSimConfiguration, result *NewSimResult) error

func (*SimManager) SignOn

func (sm *SimManager) SignOn(version int, result *SignOnResult) error

func (*SimManager) SimShouldExit

func (sm *SimManager) SimShouldExit(sim *Sim) bool

type SimScenarioConfiguration

type SimScenarioConfiguration struct {
	SelectedController  string
	SelectedSplit       string
	SplitConfigurations av.SplitConfigurationSet
	PrimaryAirport      string

	Wind         av.Wind
	LaunchConfig LaunchConfig

	DepartureRunways []ScenarioGroupDepartureRunway
	ArrivalRunways   []ScenarioGroupArrivalRunway
}

type State

type State struct {
	Aircraft    map[string]*av.Aircraft
	METAR       map[string]*av.METAR
	Controllers map[string]*av.Controller

	DepartureAirports map[string]*av.Airport
	ArrivalAirports   map[string]*av.Airport

	ERAMComputers *ERAMComputers

	TRACON                   string
	LaunchConfig             LaunchConfig
	PrimaryController        string
	MultiControllers         av.SplitConfiguration
	SimIsPaused              bool
	SimRate                  float32
	SimName                  string
	SimDescription           string
	SimTime                  time.Time
	MagneticVariation        float32
	NmPerLongitude           float32
	Airports                 map[string]*av.Airport
	Fixes                    map[string]math.Point2LL
	PrimaryAirport           string
	RadarSites               map[string]*av.RadarSite
	Center                   math.Point2LL
	Range                    float32
	Wind                     av.Wind
	Callsign                 string
	ScenarioDefaultVideoMaps []string
	ApproachAirspace         []ControllerAirspaceVolume
	DepartureAirspace        []ControllerAirspaceVolume
	DepartureRunways         []ScenarioGroupDepartureRunway
	ArrivalRunways           []ScenarioGroupArrivalRunway
	Scratchpads              map[string]string
	InboundFlows             map[string]InboundFlow
	TotalDepartures          int
	TotalArrivals            int
	TotalOverflights         int
	STARSFacilityAdaptation  STARSFacilityAdaptation
	UserRestrictionAreas     []RestrictionArea

	ControllerVideoMaps        []string
	ControllerDefaultVideoMaps []string
	VideoMapLibraryHash        []byte
	// contains filtered or unexported fields
}

func (*State) Activate

func (s *State) Activate(lg *log.Logger)

func (*State) AircraftFromPartialCallsign

func (ss *State) AircraftFromPartialCallsign(c string) *av.Aircraft

func (*State) AverageWindVector

func (ss *State) AverageWindVector() [2]float32

func (*State) DeleteAircraft

func (ss *State) DeleteAircraft(ac *av.Aircraft)

func (*State) DepartureController

func (ss *State) DepartureController(ac *av.Aircraft, lg *log.Logger) string

func (*State) ERAMComputer

func (ss *State) ERAMComputer() *ERAMComputer

func (*State) FacilityFromController

func (ss *State) FacilityFromController(callsign string) (string, bool)

func (*State) GetAllReleaseDepartures added in v0.11.6

func (ss *State) GetAllReleaseDepartures() []*av.Aircraft

func (*State) GetControllerVideoMaps added in v0.11.6

func (s *State) GetControllerVideoMaps() ([]string, []string)

func (*State) GetInitialCenter

func (ss *State) GetInitialCenter() math.Point2LL

func (*State) GetInitialRange

func (ss *State) GetInitialRange() float32

func (*State) GetRegularReleaseDepartures added in v0.11.6

func (ss *State) GetRegularReleaseDepartures() []*av.Aircraft

func (*State) GetSTARSReleaseDepartures added in v0.11.6

func (ss *State) GetSTARSReleaseDepartures() []*av.Aircraft

func (*State) GetStateForController

func (s *State) GetStateForController(callsign string) *State

func (*State) GetVideoMapLibrary added in v0.11.6

func (s *State) GetVideoMapLibrary(client *ControlClient) (*av.VideoMapLibrary, error)

func (*State) GetWindVector

func (ss *State) GetWindVector(p math.Point2LL, alt float32) math.Point2LL

func (*State) InhibitCAVolumes

func (ss *State) InhibitCAVolumes() []av.AirspaceVolume

func (*State) IsArrival added in v0.11.2

func (s *State) IsArrival(ac *av.Aircraft) bool

func (*State) IsDeparture added in v0.11.2

func (s *State) IsDeparture(ac *av.Aircraft) bool

func (*State) IsIntraFacility added in v0.11.2

func (s *State) IsIntraFacility(ac *av.Aircraft) bool

func (*State) IsOverflight added in v0.11.2

func (s *State) IsOverflight(ac *av.Aircraft) bool

func (*State) Locate

func (ss *State) Locate(s string) (math.Point2LL, bool)

func (*State) STARSComputer

func (ss *State) STARSComputer() *STARSComputer

type ToggleSPCArgs

type ToggleSPCArgs struct {
	ControllerToken string
	Callsign        string
	SPC             string
}

type TrackInformation

type TrackInformation struct {
	Identifier        string
	TrackOwner        string
	HandoffController string
	FlightPlan        *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 UnsupportedTrack struct {
	TrackLocation     math.Point2LL
	Owner             string
	HandoffController string
	FlightPlan        *STARSFlightPlan
}

type UploadPlanArgs

type UploadPlanArgs struct {
	ControllerToken string
	Type            int
	Plan            *STARSFlightPlan
}

type VideoMapsArgs added in v0.11.6

type VideoMapsArgs struct {
	ControllerToken string
	Filename        string
}

type WorldUpdate

type WorldUpdate struct {
	Aircraft    map[string]*av.Aircraft
	Controllers map[string]*av.Controller
	Time        time.Time

	ERAMComputers *ERAMComputers

	LaunchConfig LaunchConfig

	UserRestrictionAreas []RestrictionArea

	SimIsPaused      bool
	SimRate          float32
	Events           []Event
	TotalDepartures  int
	TotalArrivals    int
	TotalOverflights int
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL