Source code reference
Environments
BaseEnv
Bases: Env
(Gymnasium) Base Environment for the simulator.
The simulator wrapped around gymnasium (gym) API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
render_mode
|
str | None
|
the mode to visualize (render) the simulator. It can
only be set to None or one of the following:
'human', 'rgb_array', 'file'.
Defaults to |
None
|
config
|
EnvConfig | None
|
defines the configuration parameters for the gymnasium environment and the underlying simulator. |
None
|
out_sector_control
property
writable
Get the flag which determine out of sector control.
actions_gym_to_simulator(action)
Helper method to convert gym env actions to simulator actions
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
action
|
ActionType
|
defines the gym action to convert to the
simulator action(s). |
required |
Returns
two-element tuple:
- dict with each key-value pair representing a callsign and the
corresponding action (using the integer representation of
actions per aircraft).
- dict with each key-value pair that represents callsign and a
corresponding simulator action.
actions_simulator_to_gym(actions_st)
Helper method to convert simulator actions to gym actions
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
actions_st
|
dict[str, Action]
|
defines the actions to convert to gym actions. a dict, with each key-value pair representing a callsign and a corresponding simulator action as the value. |
required |
Returns
three-element tuple:
- gym action as int for centralized setup and dict for
decentralized setup.
- the reformatted action specific to each aircraft.
- the action information specific to each aircraft.
check_pos_information(callsign, prev_position_status, prev_incomm_status, prev_outcomm_status, prev_incorrect_exit_position)
Check the status of an aircraft in relation to the sector.
Checks include: the position status, whether incommed, outcommed, distance to sector entry (pre-incomm), distance away from sector exit (after outcomm and exit from the sector).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
callsign
|
str
|
the name of the aircraft. |
required |
prev_position_status
|
int
|
the previous step position status |
required |
prev_incomm_status
|
bool
|
the previous step incomm status |
required |
prev_outcomm_status
|
bool
|
the previous step outcomm status |
required |
prev_incorrect_exit_position
|
None | Pos2D
|
the previous step tracker of the position where an aircraft incorrectly exited the ssector. If set to None, it means that the aircraft has not incorrectly exited the sector at an earlier time step. |
required |
Returns:
| Type | Description |
|---|---|
ACPositionInfo
|
the position information of the aircraft which contains the |
ACPositionInfo
|
following information: |
ACPositionInfo
|
|
ACPositionInfo
|
|
ACPositionInfo
|
|
ACPositionInfo
|
|
ACPositionInfo
|
|
ACPositionInfo
|
|
ACPositionInfo
|
|
compute_reward(callsign, action)
Compute reward given the current state and action.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
callsign
|
str
|
the identifier/name of the aircraft. |
required |
action
|
int
|
the action taken by the agent. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, float]
|
|
compute_success_metric(callsign, previous_value)
Metric to judge whether an aircraft exit the sector correctly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
callsign
|
str
|
defines the aircraft's identifier. |
required |
previous_value
|
int
|
defines the value of the success metric at the previous time step. |
required |
Returns:
| Type | Description |
|---|---|
SuccessMetric
|
success metric value defined as a tenary integer: 1 => PASS: if the aircraft correctly exited the sector |
SuccessMetric
|
-1 => FAIL: if the aircraft incorrectly exited the sector: either via an excursion (incorrect exit position) or the correct exit position but at a wrong flight level. 0 => PENDING: if the aircraft is still in the sector |
debug_get_actions_for_aircraft(callsign)
Get the available actions for a given aircraft.
A useful debugging method
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
callsign
|
str
|
defines the identifier of the aircraft |
required |
Returns:
| Type | Description |
|---|---|
dict[int, str] | None
|
the available actions for the aircraft. |
dict[int, str] | None
|
note, in centralized setup, if the aircraft was not selected in |
dict[int, str] | None
|
the generation of state for the current time step, then |
dict[int, str] | None
|
is returned. this does not apply to decentralized setup. |
debug_get_actions_history()
Returns the history of actions taken within an episode.
disable_auto_route_following()
Disable automatic route following for aircraft.
enable_auto_route_following()
Enable automatic route following for aircraft.
get_action_parser()
Get the action parser instance that manages the action space.
get_active_airspace_sector()
Get the active airspace sector in use.
get_default_env_config(view_type=ViewType.CENTRALIZED)
classmethod
Class method: Get the default config for an environment instance.
Defined in each child class that inherits this base class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cls
|
the class |
required | |
view_type
|
ViewType | str
|
the type of agent view, centralized (single agent) or decentralized (multi-agent). Defaults to "centralized". |
CENTRALIZED
|
Returns:
| Type | Description |
|---|---|
EnvConfig
|
dict, the default config. |
get_forward_fixes_info()
Get the forward fixes configuration.
get_manager()
Get the current simulator environment manager.
get_radar_figure()
Get the figure and axes used to plot the simulation radar display.
get_render_mode()
Retrieve the render mode of the simulator.
Returns:
| Name | Type | Description |
|---|---|---|
render_mode |
str or None
|
the render mode set. It contains either None or one of the following: 'human', 'rgb_array', 'file'. |
get_rollout_predictor()
Get the predictor used for aircraft future rollout prediction.
get_simulator()
Get the current simulator.
get_simulator_env()
Get the current simulator environment.
get_tracked_aircraft_data(callsign=None, copy_data=False)
Returns aircraft tracked data.
Retrieves either the tracked data of all active aircraft, or the
tracked data of a specific aircraft as indicated by the callsign
argument.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
callsign
|
str
|
the callsign to retrieved tracked data.
Optional, if set to |
None
|
copy_data
|
bool
|
defines whether a copy of the data should
be returned.
Defaults to |
False
|
Returns
dict of tracked information for all aircraft or tracked
information for a specific aircraft or None.
if callsign is set, the method returns the tracked data for
the specific aircraft to which the callsign belongs. if the set
callsign is invalid (i.e, not in the tracker dict), then None
is returned.
if `callsign` is set to None, then a `dict` containing the
tracked data for all aircraft is returned.
get_tracked_aircraft_data_previous(callsign=None, copy_data=False)
Returns aircraft tracked data for the previous step.
Retrieves either the tracked data of all active aircraft, or the
tracked data of a specific aircraft as indicated by the callsign
argument.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
callsign
|
str
|
the callsign to retrieved tracked data.
Optional, if set to |
None
|
copy_data
|
bool
|
defines whether a copy of the data should
be returned.
Defaults to |
False
|
Returns
dict of tracked information for all aircraft or tracked
information for a specific aircraft or None.
if callsign is set, the method returns the tracked data for
the specific aircraft to which the callsign belongs. if the set
callsign is invalid (i.e, not in the tracker dict), then None
is returned.
if `callsign` is set to None, then a `dict` containing the
tracked data for all aircraft is returned.
get_traffic_monitor()
Get the traffic monitor.
render()
Render a frame and save to disk the current simulator state.
Render a frame based on the current state of simulator and save to disk. The rendered frame is an image that is generated using the defined radar.
render_w_overlay_trajectory(traj_dict=None)
Render a frame and save to disk the current simulator state.
Render a frame based on the current state of simulator and render the alternate trajectory of aircraft received from the external caller, and save the generated frame to disk. The rendered frame is an image that is generated using the defined radar.
Note, this method is for debugging purpose and should be only used when all associated gymnasium wrappers have been removed/stripped and the environment object can be accessed directly.
Also note, only "file" render mode is currently supported.
reset(*, seed=None, options=None)
Environment reset.
Reset the environment to an initial state, randomising the scenario.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
seed
|
int
|
seed for random number generator. Defaults to None. |
None
|
options
|
dict
|
additional configuration for the reset. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
ObsType
|
tuple, containing two elements, the state representation and |
InfoType
|
the log information at the initial state. |
tuple[ObsType, InfoType]
|
if |
tuple[ObsType, InfoType]
|
then the state representation is a |
tuple[ObsType, InfoType]
|
information is a |
tuple[ObsType, InfoType]
|
at the initial state, the state is represented using a zero |
tuple[ObsType, InfoType]
|
vector. |
tuple[ObsType, InfoType]
|
if |
tuple[ObsType, InfoType]
|
then the state representation is a |
tuple[ObsType, InfoType]
|
specific to an aircraft (aircraft callsign |
tuple[ObsType, InfoType]
|
`numpy.ndarray as the corresponding value). The log information |
tuple[ObsType, InfoType]
|
is a |
tuple[ObsType, InfoType]
|
is the aircraft callsign |
tuple[ObsType, InfoType]
|
there are no aircraft in the airspace at the initial state, the |
tuple[ObsType, InfoType]
|
state and log dictionaries are empty. |
save_simulation_logs()
Save the logs of the simulation.
Save the logs of the simulation based on the history of the events and aircraft trajectory in the simulation. The operation is based on the underlying save operation defined in simulator which saves the logs to disk as csv and parquet files. The logs are saved to the simulator's log directory.
The saved files can be analyzed and used to replay the simulation (example, replay via the HMI).
send_actions_to_simulator(actions_st)
Send the simulator action(s) to the simulator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
actions_st
|
list[Action]
|
stores the action of each aircraft to be sent to the simulator. each dict item has its key as an aircraft callsign and value as the simulator action for the corresponding aircraft. |
required |
set_radar()
Configure the radar for the simulator visualisation.
set_render_mode(render_mode)
Set the render mode of the simulator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
render_mode
|
str or None
|
the render mode to set. It can only be set to None or one of the following: 'human', 'rgb_array', 'file'. |
required |
step(action)
Move simulation forward one step.
Move the simulation forward one step, performing actions and compute reward/next observation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
action
|
ActionType
|
action(s) for the aircraft. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
ObsType
|
A tuple containing next state, reward, done, truncated, info |
|
Note |
RewardType
|
if the value of the "type" key in |
DoneType
|
"centralized", then next state is |
|
TruncatedType
|
float, done is a bool, truncated is a bool and info is a dict. |
|
InfoType
|
Otherwise, if "decentralized", then each item in the returned |
|
tuple[ObsType, RewardType, DoneType, TruncatedType, InfoType]
|
tuple is a dict, with key-value pairs as an aircraft callsign and |
|
tuple[ObsType, RewardType, DoneType, TruncatedType, InfoType]
|
the corresponding value for the aircraft. For example, next state |
|
tuple[ObsType, RewardType, DoneType, TruncatedType, InfoType]
|
is a dict with each key-value pair as aircraft callsign and |
|
tuple[ObsType, RewardType, DoneType, TruncatedType, InfoType]
|
|
update_ac_tracker_prev_step(tracked_data, exclude=None)
Set previous step aircraft state tracker to the current data.
update_selected_aircraft_prev_step(value)
Set the list of selected aircraft's callsigns in the previous step
SectorIEnv
Bases: BaseEnv
gymnasium environment for the I sector airspace.
Artificially generated aircraft scenarios and a configurable I sector airspace, defined in the simulation framework.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
render_mode
|
str | None
|
the mode to visualize (render) the simulator. It can
only be set to None or one of the following:
'human', 'rgb_array', 'file'.
Defaults to |
None
|
config
|
EnvConfig | None
|
defines the configuration parameters for the gymnasium environment and the underlying simulator. |
None
|
get_default_env_config(view_type=ViewType.CENTRALIZED)
classmethod
Class method: Get the default config for an environment instance.
Defined in each child class that inherits this base class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cls
|
the class |
required | |
view_type
|
ViewType | str
|
the type of agent view, centralized (single agent) or decentralized (multi-agent). Defaults to "centralized". |
CENTRALIZED
|
Returns:
| Type | Description |
|---|---|
EnvConfig
|
dict, the default config. |
SectorXEnv
Bases: BaseEnv
gymnasium environment for the X sector airspace.
Artificially generated aircraft scenarios and a configurable X sector airspace, defined in the simulation framework.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
render_mode
|
str | None
|
the mode to visualize (render) the simulator. It can
only be set to None or one of the following:
'human', 'rgb_array', 'file'.
Defaults to |
None
|
config
|
EnvConfig | None
|
defines the configuration parameters for the gymnasium environment and the underlying simulator. |
None
|
get_default_env_config(view_type=ViewType.CENTRALIZED)
classmethod
Class method: Get the default config for an environment instance.
Defined in each child class that inherits this base class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cls
|
the class |
required | |
view_type
|
ViewType | str
|
the type of agent view, centralized (single agent) or decentralized (multi-agent). Defaults to "centralized". |
CENTRALIZED
|
Returns:
| Type | Description |
|---|---|
EnvConfig
|
dict, the default config. |
SectorXPlusEnv
Bases: BaseEnv
gymnasium environment for the X-plus sector airspace.
Artificially generated aircraft scenarios and a configurable X-plus sector airspace, defined in the simulation framework.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
render_mode
|
str | None
|
the mode to visualize (render) the simulator. It can
only be set to None or one of the following:
'human', 'rgb_array', 'file'.
Defaults to |
None
|
config
|
EnvConfig | None
|
defines the configuration parameters for the gymnasium environment and the underlying simulator. |
None
|
get_default_env_config(view_type=ViewType.CENTRALIZED)
classmethod
Class method: Get the default config for an environment instance.
Defined in each child class that inherits this base class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cls
|
the class |
required | |
view_type
|
ViewType | str
|
the type of agent view, centralized (single agent) or decentralized (multi-agent). Defaults to "centralized". |
CENTRALIZED
|
Returns:
| Type | Description |
|---|---|
EnvConfig
|
dict, the default config. |
SectorYEnv
Bases: BaseEnv
gymnasium environment for the Y sector airspace.
Artificially generated aircraft scenarios and a configurable Y sector airspace, defined in the simulation framework.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
render_mode
|
str | None
|
the mode to visualize (render) the simulator. It can
only be set to None or one of the following:
'human', 'rgb_array', 'file'.
Defaults to |
None
|
config
|
EnvConfig | None
|
defines the configuration parameters for the gymnasium environment and the underlying simulator. |
None
|
get_default_env_config(view_type=ViewType.CENTRALIZED)
classmethod
Class method: Get the default config for an environment instance.
Defined in each child class that inherits this base class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cls
|
the class |
required | |
view_type
|
ViewType | str
|
the type of agent view, centralized (single agent) or decentralized (multi-agent). Defaults to "centralized". |
CENTRALIZED
|
Returns:
| Type | Description |
|---|---|
EnvConfig
|
dict, the default config. |
SpringfieldEnv
Bases: BaseEnv
gymnasium environment for the Springfield airspace.
gym environment for the Springfield training sector/airspace, defined in simulation framework. Designed to simulate challenging air traffic control scenarios. In addition, the aircraft scenarios can be based on either real-world (historical) data or artificially generated. Based on the simulator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
render_mode
|
str | None
|
the mode to visualize (render) the simulator. It can
only be set to None or one of the following:
'human', 'rgb_array', 'file'.
Defaults to |
None
|
config
|
EnvConfig | None
|
defines the configuration parameters for the gymnasium environment and the underlying simulator. |
None
|
get_default_env_config(view_type=ViewType.CENTRALIZED)
classmethod
Class method: Get the default config for an environment instance.
Defined in each child class that inherits this base class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cls
|
the class |
required | |
view_type
|
ViewType | str
|
the type of agent view, centralized (single agent) or decentralized (multi-agent). Defaults to "centralized". |
CENTRALIZED
|
Returns:
| Type | Description |
|---|---|
EnvConfig
|
dict, the default config. |