Incorporating External Schedulers in the Simulator - nasa-airport/airport-simulation GitHub Wiki
Please note that aircraft movement is being changed from one-node-per-tick to to velocity-based. The code in the
masterbranch may not reflect the latest design. See #16 for details.
Scheduler Interface
See Deterministic Scheduler for a more detailed example.
class Scheduler(AbstractScheduler):
"""The deterministic scheduler scheduler implements the `Abstractscheduler`
by offering `scheduler(simulation)`. The scheduler first generates a list
of itinerary ignoring any conflict then it resolves the conflicts by
cloning the simulation and ticking on the cloned simulation. Conflicts are
resolved by adding delays on one of the aircrafts.
"""
def schedule(self, simulation):
# 1. Schedule an itinerary for each aircraft (call schedule_aircraft in AbstractScheduler)
# 2. Resolves conflicts (call __resolve_conflicts)
# 3. Return a conflict-free schedule
pass
...
Currently, the Schedule is part of the whole system. As a result, it shares all the resources with the Simulator in memory. In order to incorporate external schedulers, we need to agree on an interface which the Scheduler communicates with an external program.
Scheduler Input
World State
Note that the node_location will be the next node it will traverse in the node-link network.
{"time": "00:00:00", "aircrafts": [{"callsign": "F1", "state": "moving", "is_delayed": false, "location": {"lat": 37.4115719, "lng": -122.0571613}, "itinerary": [{"node_name": "G2", "node_location": {"lat": 37.4115719, "lng": -122.0571613}}, {"node_name": "n-id-8", "node_location": {"lat": 37.4115719, "lng": -122.0571613}}, {"node_name": "n-id-9", "node_location": {"lat": 37.4122835, "lng": -122.0549726}}, {"node_name": "n-id-5", "node_location": {"lat": 37.4122835, "lng": -122.0549726}}, {"node_name": "n-id-4", "node_location": {"lat": 37.4128544, "lng": -122.0552731}}, {"node_name": "n-id-2", "node_location": {"lat": 37.4128544, "lng": -122.0552731}}, {"node_name": "n-id-3", "node_location": {"lat": 37.4142946, "lng": -122.0560133}}, {"node_name": "n-id-0", "node_location": {"lat": 37.4142946, "lng": -122.0560133}}], "itinerary_index": 1, "uncertainty_delayed_index": [], "scheduler_delayed_index": []}]}
Node-Link Graph
Currently, the ouput is a Python object. We need to find a way to serialize it on our end and de-serialize on ther external client.
Routiong Expert
It has the shortest routes from any node -> runway_start and any node -> gate. Currently, the ouput is a Python object. We need to find a way to serialize it on our end and de-serialize on ther external client.
Scheduler Output
Same as scheduler input. Should give an itinerary for each aircraft.
{"time": "00:00:00", "aircrafts": [{"callsign": "F1", "state": "moving", "is_delayed": false, "location": {"lat": 37.4115719, "lng": -122.0571613}, "itinerary": [{"node_name": "G2", "node_location": {"lat": 37.4115719, "lng": -122.0571613}}, {"node_name": "n-id-8", "node_location": {"lat": 37.4115719, "lng": -122.0571613}}, {"node_name": "n-id-9", "node_location": {"lat": 37.4122835, "lng": -122.0549726}}, {"node_name": "n-id-5", "node_location": {"lat": 37.4122835, "lng": -122.0549726}}, {"node_name": "n-id-4", "node_location": {"lat": 37.4128544, "lng": -122.0552731}}, {"node_name": "n-id-2", "node_location": {"lat": 37.4128544, "lng": -122.0552731}}, {"node_name": "n-id-3", "node_location": {"lat": 37.4142946, "lng": -122.0560133}}, {"node_name": "n-id-0", "node_location": {"lat": 37.4142946, "lng": -122.0560133}}], "itinerary_index": 1, "uncertainty_delayed_index": [], "scheduler_delayed_index": []}]}
Uncertainty & Delay
TBD