Skip to content

Refactor Scenario Definitions#790

Open
checkandmate1 wants to merge 11 commits intommp:masterfrom
checkandmate1:refactor-scenario-defs
Open

Refactor Scenario Definitions#790
checkandmate1 wants to merge 11 commits intommp:masterfrom
checkandmate1:refactor-scenario-defs

Conversation

@checkandmate1
Copy link
Collaborator

  • Moves stars_config from scenario files into each facilities' own dedicated configuration files in resources/configurations/<artcc>/<facility>.
    • These configuration files were derived from current scenarios.
    • For facilities that have not yet been made in vice, controllers were imported from CRC configuration files.
  • Configuration files have:
    • stars_config.
    • Neighboring facilities and their ID.
    • Area configurations (i.e., default airport for an area rather than a specific TCW). More can be added later.
    • airspace_awareness/ coordination_fixes.
    • control_positions for that facility.
  • Removes controllers from scenarios. All controllers in that facility and neighboring facilities are loaded.
  • Standardized the naming convention of controllers:
    • <Facility> <##> <Name> for all enroute positions (eg, ZNY 56 Kennedy).
    • <XXX>_<X>_APP/<XXX>_<X>_DEP for all terminal positions (eg, EWR_P_APP).
  • When naming a facility outside of that scenario's facility, initial_facility, departure_facility, or receiving_facility must be specified.
  • Updated index.html to reflect new definition changes.

@checkandmate1 checkandmate1 requested a review from mmp February 16, 2026 06:40
Copy link
Owner

@mmp mmp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, this is a huge step forward.

Couple of comments; for all of them feel free to leave them as TODOs for future work (though I'll wait for responses before merging.)

(Looks like the build is failing due to some stt test merge issues; we can clean those up post merge if needed.)

if _, ok := pos[id]; ok {
e.ErrorString("%s: TCP / sector_id used for multiple \"control_positions\"", id)
if existing, ok := pos[id]; ok {
// Allow aliases: the same controller stored under multiple keys
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels a little fragile; what's it needed for?

// BOS, MCO, etc. that aren't in the TRACONs database.
resourcesFS := util.GetResourcesFS()
filename := facility + ".json"
_ = fs.WalkDir(resourcesFS, "configurations", func(p string, d fs.DirEntry, err error) error {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how often this path runs, but it could be expensive to keep walking the directory tree versus doing it once and maintaining a map from facility to paths.

if !(ctrl.SectorID[0] >= 'A' && ctrl.SectorID[0] <= 'Z') {
e.ErrorString("first character of center controller \"sector_id\" must be a letter")
}
if _, err := strconv.Atoi(ctrl.SectorID[1:]); err != nil {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirming, removing this was intended?

// aircraft parameters. Returns the index into the FixPairs slice and true
// if a match is found, or -1 and false otherwise.
func MatchFixPair(fixPairs []FixPairDefinition, entryFix, exitFix string, flightType av.TypeOfFlight, altitude int) (int, bool) {
// Sort by priority (lower = higher priority)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth doing this sort once in PostDeserialize and then relying on it here.

This should be safe in practice due to the Sim holding a mutex when an RPC comes in, but if two goroutines ran MatchFixPair at the same time with the same underlying fixPairs, it could end up scrambled / with duplicate entries and missing entries if both sorted it at the same time.

@@ -0,0 +1,121 @@
// sim/facility_config.go
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meta-comment: does it make sense moving some of the PostDeserialize code for these into this file to keep it closer to where things are defined? (That may not be doable / may not be worth the trouble depending on how much external info is needed to validate.)

if sg.Airports == nil {
sg.Airports = make(map[string]*av.Airport)
}
sg.Airports[airport] = &av.Airport{}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This initially made me nervous since Airport is left totally uninitialized. I guess it's ok since it's not an airport in the local facility (so we don't care about departure procedures, etc.)? Maybe add a comment explaining a bit?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants