HPC module
METS-R HPC is used to control multiple simulation instances that can run and exchange data through WebSocket connects. Apache Kafka is used to explicitly model the data stream. The overall HPC framework is shown in the figure below, note this framework allows us to separate the logics of modeling data processing, decision generation, traffic simulation, and potentially cyber attacks.

HPC framework
Code structure
Four types of classes are used:
Client
for interfacing the data communication between simulators and other components.Runner
for defining different types of experiments.Model
for implementing operational algorithms.Config
for storing the configuration templates.
Besides these, we provide the example scripts:
hpc_example.py
,interactive_example.ipynb
,
cosim_example.py
.
Operational algorithms
Eco-routing module
The online energy-efficient routing aims to find the paths with minimal expected energy consumption for multiple EVs (EV taxis and EV buses), which is developed from the sample-efficient online algorithms and the combinatorial multi-arm bandit problem (CMAB). Specifically, we make use of the information obtained from the simulation side to update our eco-routing strategy, as shown below.

The strategy of eco-routing updates
Bus scheduling module
The demand-adaptive transit planning module generated the EV bus routes and the corresponding transit schedules using hourly-based predicted travel demand from or to the hubs. The demand prediction module was implemented in Python and it stored the demand as a CSV table that can be indexed by hub, date, hour, and taxi zone. The result of the demand prediction module served as the input of the EV transit planning and scheduling algorithms, and the outputs are the EV transit routes and the numbers of assigned EV buses on different routes.
Interactive APIs
The following APIs are implemented to interact with the METS-R SIM
,
here sim_client
is an instance of METSRClient
.
STEP
Name |
Description |
Examples |
Return |
---|---|---|---|
tick |
Move the simulation one tick forward |
|
QUERY
If an agent ID is provided, a query would return the information of the specific agent, otherwise, it will return a list containing the ID of all agents.
Name |
Description |
Examples |
Return |
---|---|---|---|
|
Get the information of one or more vehicles. By default, queries public vehicles. Set private_veh=True for private vehicles and transform_coords=True to convert coordinates to SUMO format. |
|
x, y, speed, acceleration, bearing, origin zone, destination zone, vehicle state |
|
Get the information of one or more EV buses. |
|
battery state, route ID, current stop, passenger number |
|
Get the information of one or more EV taxis. |
|
x, y, passenger number, vehicle state, origin zone, destination zone |
|
Get the information of one or more roads. |
|
speed limit, number of on-road vehicles, average travel time, road length (m), energy consumed, road type |
|
Get the information of one or more demand zones. |
|
vehicle stock, taxi demand, bus demand, x, y, zone type |
|
Get the information of one or more traffic signals. |
|
current phase, next phase, next update time |
|
Get the information of one or more EV charging stations. |
|
x, y, number of available chargers |
|
Get the vehicle IDs currently located on the co-simulation road. |
|
list of vehicle IDs on the co-sim road |
CONTROL
Name |
Description |
Examples |
Inputs |
---|---|---|---|
|
Generate a vehicle trip between origin and destination zones. |
|
vehID, origin, destination |
|
Generate a vehicle trip between origin and destination roads. |
|
vehID, origin, destination |
|
Set one or more roads for co-simulation. |
|
roadID |
|
Release one or more co-simulation roads. |
|
roadID |
|
Teleport a vehicle to a location on a co-sim road using coordinates. |
|
vehID, roadID, x, y, private_veh, transform_coords |
|
Teleport a vehicle using road ID, lane ID, and distance from downstream junction. |
|
vehID, roadID, laneID, dist, private_veh |
|
Move vehicle to next road in its planned route. |
|
vehID, private_veh |
|
Directly control vehicle acceleration. |
|
vehID, acc, private_veh |
|
Change the sensor type of a vehicle. |
|
vehID, sensorType, private_veh |
|
Dispatch a taxi between two zones. |
|
vehID, orig, dest, num |
|
Dispatch a taxi between roads. |
|
vehID, orig, dest, num |
|
Add taxi passenger request at a zone. |
|
zoneID, dest, num |
|
Add road-based taxi request from a zone. |
|
zoneID, orig, dest, num |
|
Assign passenger request to a specific bus. |
|
vehID, orig, dest, num |
|
Add a bus passenger request at a zone. |
|
zoneID, dest, num |
|
Reset simulation using a specified property file. |
|
prop_file |
|
Reset simulation using a predefined map (CARLA, NYC, UA). |
|
map_name |
|
Fully terminate the simulation and close the client. |
|
None |
|
Close the client while leaving the simulation running. |
|
None |