ensemble.metaclass package¶
Submodules¶
ensemble.metaclass.connector module¶
Abstract Connector¶
This module implements a general metaclass for a connector.
- class ensemble.metaclass.connector.AbsConnector[source]¶
Bases:
object
- abstract property get_vehicle_data¶
List of dictionaries containing vehicle data
- abstract register_simulation(scenarioPath: str)[source]¶
Registers a scenario file into the simulator
- abstract property simulation_step¶
Current simulation iteration
ensemble.metaclass.controller module¶
Abstract Controller¶
This module implements a general metaclass for the operatinonal controller.
ensemble.metaclass.coordinator module¶
Abstract Gap Coordinator¶
This module implements a general metaclass for a vehicle gap coordinator.
- class ensemble.metaclass.coordinator.AbsSingleGapCoord[source]¶
Bases:
object
- abstract property acceleration¶
Acceleration @current time
- abstract property comv2x¶
Communication availability
- abstract property control¶
Applied control @current time
- abstract property dv¶
Differential speed @current time
- abstract property dx¶
Headway space @current time
- abstract property history_control¶
Historical control
- abstract property history_reference¶
Historical control
- abstract property history_state¶
Historical status
- abstract property joinable¶
Indicates if the coordinator is joinable
- abstract property platoon¶
Platoon enabled
- abstract property positionid¶
Position within the platoon
- abstract property speed¶
Speed @current time
- abstract property status¶
Platoon status @current time
- abstract property ttd¶
Total travel distance @current time
- abstract property vehid¶
Vehicle identifier
- abstract property x¶
Distance on link @current time
ensemble.metaclass.dynamics module¶
Abstract Dynamics¶
This module implements a general metaclass for the dynamics.
ensemble.metaclass.observer module¶
Abstract Observer¶
This module implements a general metaclass of the observer.
ensemble.metaclass.state module¶
States¶
This module presents a state implementation that should be generic for state descriptions.
ensemble.metaclass.stream module¶
Data Query¶
This module handles the Simulation response converting it into proper formats for querying data afterwards.
- class ensemble.metaclass.stream.DataQuery(**kwargs)[source]¶
Bases:
ensemble.logic.publisher.Publisher
This general dataquery model implements a general publisher pattern to broadcast information towards different subscribers. Subscribers are intented to be objects such as vehicles, front/rear gap coordinators.
In particular this creates a subject that can notify to a specific channel where subscribers are registered.
Example
Create a DataQuery for 2 type of channels,
automated
andregular
and perform a subscription>>> channels = ('auto','regular') >>> p = Publisher(channels) >>> s = Subscriber(p,'auto') # Registers a s into p
- abstract property current_nbveh: int¶
Provides current number of vehicles
- abstract property current_time: float¶
Provides current time step
- filter_vehicle_property(property: str, *args)[source]¶
Filter out a property for a subset of vehicles
- Parameters
property (str) – one of the following options abscissa, acceleration, distance, elevation, lane, link, ordinate, speed, vehid, vehtype,
vehids (int) – separate the
vehid
via commas to get the corresponding property
- abstract get_vehicle_data() List[Dict[str, Union[str, int, float]]] [source]¶
Provides current vehicle data
- get_vehicle_properties(vehid: int) dict [source]¶
Return all properties for a given vehicle id
- Returns
Dictionary with all vehicle properties
- Return type
vehdata (dict)
- get_vehicles_property(property: str) Tuple[Union[float, int, str]] [source]¶
Extracts a specific property and returns a tuple containing this property for all vehicles in the buffer string
- Parameters
property (str) – one of the following options abscissa, acceleration, distance, elevation, lane, link, ordinate, speed, vehid, vehtype,
- Returns
tuple with corresponding values e.g (0,1), (0,),(None,)
- Return type
values (tuple)
- is_vehicle_in_link(veh: int, link: str) bool [source]¶
Returns true if a vehicle is in a link at current state
- Parameters
vehid (int) – vehicle id
link (str) – link name
- Returns
True if veh is in link
- Return type
present (bool)
- is_vehicle_in_network(vehid: int, *args) bool [source]¶
True if veh id is in the network at current state, for multiple arguments. True if all veh ids are in the network.
- Parameters
vehid (int) – Integer of vehicle id, comma separated if testing for multiple
- Returns
True if vehicle is in the network otherwise false.
- Return type
present (bool)
- abstract property query¶
A method to store data as received from the simulator
- abstract update_vehicle_registry(configurator)[source]¶
Updates the vehicle registry within the stream
- vehicle_downstream_of(vehid: int) tuple [source]¶
Get ids of vehicles downstream to vehid
- Parameters
vehid (str) – vehicle id
- Returns
vehicles downstream of vehicle id
- Return type
vehid (tuple)
ensemble.metaclass.subject module¶
Abstract Subject¶
This module implements a general metaclass of the subject/publisher of information.