Runtime observation and control for LOFT-Sim
Introduction to ACI
ACI, the Airspace Control Interface, is LOFT-Sim's Python interface for observing a running simulation and applying real-time control decisions. It connects an external controller to simulation state without replacing the scenario, airspace network, or strategic-layer configuration.
The configured strategic layer provides the operating baseline. During a run, an ACI controller can inspect requests, vehicles, airspace elements, and environmental conditions, then override supported decisions or commands. If no ACI controller is connected, the scenario continues with its configured internal models.
Concepts
Control model
The optional operation-strategy file defines the internal baseline: a strategic model can propose admission, delay, or decline; tactical defaults and per-element rules govern local movement; and a contingency model can change resource state. ACI can override those ordinary operational decisions at runtime, while hard route, vehicle-dynamics, resource-compatibility, and separation-safety constraints remain authoritative.
For a runtime-controllable value, LOFT-Sim applies the built-in or XML baseline first, then the selected internal model, then an active ACI override, and finally all hard physical and safety constraints. Clearing an override restores the latest baseline or internally computed value; it does not force the opposite state.
For corridor, junction, and vertiport properties, typed get...Source() methods and getControlSources() report whether the effective value came from aci, internal, operation_strategy, network_representation, derived, or default. The aggregate getControlSource() returns the common source only when every reported property shares one and returns mixed otherwise. getClosure() includes its source in the returned record, whereas getTacticalRule() returns only the effective rule value.
IDs and method conventions
Corridors, junctions, and vertiports use semantic IDs from the Digital Airspace Network rather than raw JOSM/OSM numeric IDs. Requests and vehicles use runtime IDs, and each vehicle exposes its source request through aci.vehicle.getRequestID(vehicleID).
get...methods are read-only and have no operational side effects.- State-changing methods are typed commands that return structured results and explicitly reject invalid IDs, values, routes, or states.
- Values use SI base units unless documented otherwise; temperatures are in degrees Celsius. Unit suffixes are used only for non-SI-base quantities such as
capacity_veh_per_houranddensity_veh_per_km. The one exception is the record returned byaci.environment.getSample(), whose keys all name their units (wind_mps,density_kgpm3,temperature_c). - Persistent parameter or decision overrides provide an explicit clear-to-baseline method. Route and destination changes are committed vehicle commands rather than reversible parameter overlays.
- In state-changing commands, required values, such as an ID, a speed, a rule or a capacity, are positional, and optional arguments, such as
reason,until,duration,delayandscheduled_departure_time, are keyword-only; so are the arguments ofaci.environment.getSample()afterx, y, z. Writeaci.corridor.close(corridorID, duration=60), notaci.corridor.close(corridorID, 60). The signatures on the domain pages mark keyword-only arguments with*. - Errors: an unknown ID, or an invalid value, route or state, raises
ACIException, from getters and commands alike, and a rejected command leaves the state as it was. Catch it asaci.ACIException, or import it withfrom loft.aci import ACIException. A positional value for a keyword-only argument, or an unknown keyword, raises Python's ownTypeError.
Interface scope
ACI is a runtime override layer, not a model selected in configuration. Do not declare ACI in operation_strategy.xml; the same scenario configuration can run unattended or under an ACI controller.
ACI is organized into typed domains rather than a generic parameter API. Demand is represented by request objects; network state comes from the airspace-element domains or the simulation snapshot; and route information belongs to requests and vehicles. Strategic, tactical, and contingency models are observed or overridden through these object domains rather than exposed as separate command domains. There is no public network, operation, contingency, metrics, events, model, or generic parameter domain; their useful behavior is available through the typed domains, the simulation snapshot, and configured output files.
Detailed offline metrics remain output-file products, while aci.simulation.getStatistics() provides compact live counters. ACI is the supported external real-time control interface; the browser visualization is a viewer, not another control surface.
ACI Commands
Select a command domain below. Each domain page contains both the available retrieval methods and its supported state-changing commands, so every concrete instruction is one step away from this directory.
Session and simulation
Traffic and demand commands
Airspace network commands
Operating-condition commands
Minimal example
A complete session: start the bundled default scenario headless, confirm every pending
request that no controller has decided yet, advance the clock, and close.
Run it from the repository root.
from loft import aci
aci.start(
config_file="example/scenarios/default/config/simulation_config.xml",
gui=False,
)
try:
for _ in range(500):
for request_id in aci.request.getPendingIDList():
if aci.request.getDecisionOverride(request_id) is None:
aci.request.confirm(request_id)
aci.simulationStep()
print(aci.simulation.getStatistics())
finally:
aci.close()
The controller reads one consistent simulation instant, applies typed
overrides, and then advances the clock. File-based and ACI-submitted demand use
the same request ledger, and a new request is observable before its vehicle is
created, which gives the controller a decision opportunity. A controller can
also decide per request, for example confirm only the requests whose
aci.request.getPriority(request_id)["rank"] is above 0 and
aci.request.delay(request_id, delay=30) the others.
The Session Lifecycle page explains the start options, and the Build an ACI Controller tutorial grows this loop into a controller that also acts on vehicles and airspace elements.