TraCI/Simulation Value Retrieval
Contents
Command 0xab: Get Simulation Variable
| ubyte | string |
| Variable | Simulation ID (always unused) |
|---|
Asks for the value of a certain simulation variable
The following variable values can be retrieved, the type of the return value is also shown in the table.
| Variable | ValueType | Description | Python Method |
|---|---|---|---|
| current simulation time (0x70) | int | Returns the current simulation time (in ms) | getCurrentTime |
| number of loaded vehicles (id 0x71) | int | The number of vehicles which were loaded in this time step. | getLoadedNumber |
| ids of loaded vehicles (id 0x72) | stringList | A list of ids of vehicles which were loaded in this time step. | getLoadedIDList |
| number of departed vehicles (id 0x73) | int | The number of vehicles which departed (were inserted into the road network) in this time step. | getDepartedNumber |
| ids of departed vehicles (id 0x74) | stringList | A list of ids of vehicles which departed (were inserted into the road network) in this time step. | getDepartedIDList |
| number of vehicles that start to teleport (id 0x75) |
int | The number of vehicles which started to teleport in this time step. | getStartingTeleportNumber |
| ids of vehicles that start to teleport (id 0x76) | stringList | A list of ids of vehicles which started to teleport in this time step. | getStartingTeleportIDList |
| number of vehicles that end being teleported (id 0x77) |
int | The number of vehicles which ended to be teleported in this time step. | getEndingTeleportNumber |
| ids of vehicles that end being teleported (id 0x78) |
stringList | A list of ids of vehicles which ended to be teleported in this time step. | getEndingTeleportIDList |
| number of arrived vehicles (id 0x79) | int | The number of vehicles which arrived (have reached their destination and are removed from the road network) in this time step. | getArrivedNumber |
| ids of arrived vehicles (id 0x7a) | stringList | A list of ids of vehicles which arrived (have reached their destination and are removed from the road network) in this time step. | getArrivedIDList |
| network boundaries (id 0x7c) | boundary box | The boundary box of the simulation network. | getNetBoundary |
| minimum number of vehicles that are still expected to leave the net (id 0x7d) | int | The number of vehicles which are in the net plus the ones still waiting to start. This number may be smaller than the actual number of vehicles still to come because of delayed route file parsing. | getMinExpectedNumber |
| number of vehicles that begin a stop (id 0x68) | int | The number of vehicles that halted on a scheduled stop in this time step. | getStopStartingVehiclesNumber |
| ids of vehicles that begin a stop (id 0x69) | stringList | A list of ids of vehicles that halted on a scheduled stop in this time step. | getStopStartingVehiclesIDList |
| number of vehicles that end a stop (id 0x6a) | int | The number of vehicles that begin to continue their journey, leaving a scheduled stop in this time step. | getStopEndingVehiclesNumber |
| ids of vehicles that end a stop (id 0x6b) | stringList | A list of ids of vehicles that begin to continue their journey, leaving a scheduled stop in this time step. | getStopEndingVehiclesIDList |
| number of vehicles that begin to be parked (id 0x6c) |
int | The number of vehicles that enter a parking position in this time step. | getParkingStartingVehiclesNumber |
| ids of vehicles that begin to be parked (id 0x6d) |
stringList | A list of ids of vehicles that enter a parking position in this time step. | getParkingStartingVehiclesIDList |
| number of vehicles that end to be parked (id 0x6e) |
int | The number of vehicles that begin to continue their journey, leaving a scheduled parking in this time step. | getParkingEndingVehiclesNumber |
| ids of vehicles that end being parked (id 0x6f) | stringList | A list of ids of vehicles that begin to continue their journey, leaving a scheduled parking in this time step. | getParkingEndingVehiclesIDList |
| bus stop waiting (id 0x67) | int | Get the total number of waiting persons at the named bus stop. | getBusStopWaiting |
| delta T (id 0x7b) | int | Returns the length of one simulation step in milliseconds. | getDeltaT |
Response 0xbb: Simulation Variable
| ubyte | string | ubyte | <return_type> |
| Variable | <invalid> | Return type of the variable | <VARIABLE_VALUE> |
|---|
The respond to a "Command Get Simulation Variable".
Extended retrieval messages
Some further messages require additional parameters.
| Variable | Request ValueType | Response ValueType | Description | Python Method |
|---|---|---|---|---|
| position conversion (0x58) | compound, see below | Position, as wished | Reads a position information and returns it converted into the given representation. | convert2D convert3D convertGeo convertRoad |
| distance request (0x59) | compound, see below | double | Reads two positions and an indicator whether the air or the driving distance shall be computed. Returns the according distance. | getDistanceRoad getDistance2D |
Command 0x82: Position Conversion
The request needs the following parameter:
| byte | integer | Position | byte | ubyte |
| value type compound | item number (always 2) | position to convert | value type ubyte | Type of the Position to return |
|---|
Use this command to convert between the different position types used by TraCI. The specified Position is converted into the requested format given through PositionId. The result is the closest position that was found to match the given one. The return values consists of the converted value only.
See TraCI/Protocol#Position Representations for available position formats.
Command 0x83: Distance Request
The request needs the following parameter:
| byte | integer | Position | Position | ubyte |
| value type compound | item number (always 3) | start position | end position | Distance Type |
|---|
where
- Distance Type==0: air distance
- Distance Type==1: driving distance
The resulting distance is returned.