SUMO
Simulation of Urban MObility

- Home
- Download
- Documentation
- Wiki
- Trac
- Blog
- Contact
- SF-Project

# TraCI/Simulation Value Retrieval

## 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.

Overview Retrievable Simulation Variables
Variable | ValueType | Description
--- | --- | ---
current simulation time (0x70) | int | Returns the current simulation time (in ms)
number of loaded vehicles (id 0x71) | int | The number of vehicles which were loaded in this time step.
ids of loaded vehicles (id 0x72) | stringList | A list of ids of vehicles which were loaded in this time step.
number of departed vehicles (id 0x73) | int | The number of vehicles which departed (were inserted into the road network) in this time step.
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.
number of vehicles that start to teleport (id 0x75) | int | The number of vehicles which started to teleport in this time step.
ids of vehicles that start to teleport (id 0x76) | stringList | A list of ids of vehicles which started to teleport in this time step.
number of vehicles that end being teleported (id 0x77) | int | The number of vehicles which ended to be teleported in this time step.
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.
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.
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.
network boundaries (id 0x7c) | boundary box | The boundary box of the simulation network.
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.

## 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.

Overview Extended Variables Retrieval
Variable | Request ValueType | Response ValueType | Description
--- | --- | --- | ---
position conversion (0x58) | compound, see below | Position, as wished | Reads a position information and returns it converted into the given representation.
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.

### 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.

This page was last modified on 15 April 2013, at 18:29.