Difference between revisions of "TraCI/Induction Loop Value Retrieval"

From Sumo
Jump to navigation Jump to search
(fixed links)
 
(20 intermediate revisions by 4 users not shown)
Line 1: Line 1:
= Induction Loop Value Retrieval =
 
 
== Command 0xa0: Get Induction Loop Variable ==
 
== Command 0xa0: Get Induction Loop Variable ==
 
{| cellpadding="4" cellspacing="0" border="0"
 
{| cellpadding="4" cellspacing="0" border="0"
Line 8: Line 7:
 
! style="border: 1pt solid;" | Induction Loop ID
 
! style="border: 1pt solid;" | Induction Loop ID
 
|}
 
|}
Asks for the value of a certain variable of the named [[SUMO_OUTPUT_E1|induction loop (e1 detector)]]. The value returned is the state of the asked variable/value within the last simulation step. Please note that for asking values from your [[SUMO_OUTPUT_E1|induction loops]] with TraCI, you have to:
+
Asks for the value of a certain variable of the named [[Simulation/Output/Induction Loops Detectors (E1)|induction loop (e1 detector)]]. The value returned is the state of the asked variable/value within the last simulation step. Please note that for asking values from your detectors [[Simulation/Output/Induction Loops Detectors (E1)|you have to define them]] within an {{AdditionalFile}} and load them at the start of the simulation. The {{XML|freq}} and {{XML|file}} attributes do not matter for TraCI.
* define them
+
 
* set their frequency to 1s
 
 
The following variable values can be retrieved, the type of the return value is also shown in the table.
 
The following variable values can be retrieved, the type of the return value is also shown in the table.
  
Line 19: Line 17:
 
! ValueType
 
! ValueType
 
! Description
 
! Description
 +
! [[TraCI/Interfacing_TraCI_from_Python|Python Method]]
 
|-
 
|-
 
| id list (0x00)
 
| id list (0x00)
| string*
+
| stringList
| Returns a list of ids of all known induction loops within the scenario (the given Induction Loop ID is ignored)
+
| Returns a list of ids of all induction loops within the scenario (the given Induction Loop ID is ignored)
 +
| [https://sumo.dlr.de/pydoc/traci._inductionloop.html#InductionLoopDomain-getIDList getIDList]
 +
|-
 +
| position (0x42)
 +
| double
 +
| Returns the position of the induction loop at it's lane, counted from the lane's begin, in meters.
 +
| [https://sumo.dlr.de/pydoc/traci._inductionloop.html#InductionLoopDomain-getPosition getPosition]
 +
|-
 +
| lane ID (0x51)
 +
| string
 +
| Returns the ID of the lane the induction loop is placed at.
 +
| [https://sumo.dlr.de/pydoc/traci._inductionloop.html#InductionLoopDomain-getLaneID getLaneID]
 +
|-
 +
| count (0x01)
 +
| int
 +
| Returns the number of induction loops within the scenario (the given Induction Loop ID is ignored)
 +
| [https://sumo.dlr.de/pydoc/traci._inductionloop.html#InductionLoopDomain-getIDCount getIDCount]
 
|-
 
|-
 
| last step vehicle number (0x10)
 
| last step vehicle number (0x10)
| integer
+
| int
| Returns the number of vehicles that were on the named induction loop within the last simulation step [#]; {{Note|This value corresponds to the ''nVehEntered'' measure of [[SUMO_OUTPUT_E1|induction loops]].}}
+
| Returns the number of vehicles that were on the named induction loop within the last simulation step [#]; {{Note|This value corresponds to the ''nVehEntered'' measure of [[Simulation/Output/Induction Loops Detectors (E1)|induction loops]].}}
 +
| [https://sumo.dlr.de/pydoc/traci._inductionloop.html#InductionLoopDomain-getLastStepVehicleNumber getLastStepVehicleNumber]
 
|-
 
|-
 
| last step mean speed (0x11)
 
| last step mean speed (0x11)
| float
+
| double
 
| Returns the mean speed of vehicles that were on the named induction loop within the last simulation step [m/s]
 
| Returns the mean speed of vehicles that were on the named induction loop within the last simulation step [m/s]
 +
| [https://sumo.dlr.de/pydoc/traci._inductionloop.html#InductionLoopDomain-getLastStepMeanSpeed getLastStepMeanSpeed]
 
|-
 
|-
 
| last step vehicle ids (0x12)
 
| last step vehicle ids (0x12)
| string*
+
| stringList
 
| Returns the list of ids of vehicles that were on the named induction loop in the last simulation step
 
| Returns the list of ids of vehicles that were on the named induction loop in the last simulation step
 +
| [https://sumo.dlr.de/pydoc/traci._inductionloop.html#InductionLoopDomain-getLastStepVehicleIDs getLastStepVehicleIDs]
 +
|-
 +
| last step occupancy (0x13)
 +
| double
 +
| Returns the percentage of time the detector was occupied by a vehicle [%]
 +
| [https://sumo.dlr.de/pydoc/traci._inductionloop.html#InductionLoopDomain-getLastStepOccupancy getLastStepOccupancy]
 +
|-
 +
| last step mean vehicle length (0x15)
 +
| double
 +
| The mean length of vehicles which were on the detector in the last step [m]
 +
| [https://sumo.dlr.de/pydoc/traci._inductionloop.html#InductionLoopDomain-getLastStepMeanLength getLastStepMeanLength]
 +
|-
 +
| last step's time since last detection (0x16)
 +
| double
 +
| The time since last detection [s]
 +
| [https://sumo.dlr.de/pydoc/traci._inductionloop.html#InductionLoopDomain-getTimeSinceDetection getTimeSinceDetection]
 +
|-
 +
| last step's vehicle data (0x17)
 +
| complex (see below)
 +
| A complex structure containing several information about vehicles which passed the detector
 +
| [https://sumo.dlr.de/pydoc/traci._inductionloop.html#InductionLoopDomain-getVehicleData getVehicleData]
 
|-
 
|-
 
|}
 
|}
Line 51: Line 89:
 
|}
 
|}
 
The respond to a '''"Command Get Induction Loop Variable"'''.
 
The respond to a '''"Command Get Induction Loop Variable"'''.
 +
 +
===Response to "last step's vehicle data" (0x17)===
 +
The return type is "complex", the following fields are:
 +
 +
{| cellpadding="4" cellspacing="0" border="0"
 +
| width="75" align="center"| ubyte
 +
| width="75" align="center"| int
 +
| width="150" align="center"| <INFORMATION_PACKET>
 +
| width="150" align="center"| ...
 +
| width="150" align="center"| <INFORMATION_PACKET>
 +
|-
 +
! style="border: 1pt solid;" | "int"
 +
! style="border: 1pt solid;" | number of information packets
 +
! style="border: 1pt solid;" | <INFORMATION_PACKET>
 +
! style="border: 1pt solid;" | ...
 +
! style="border: 1pt solid;" | <INFORMATION_PACKET>
 +
|}
 +
 +
Where each information packet looks like:
 +
{| cellpadding="4" cellspacing="0" border="0"
 +
| width="75" align="center"| ubyte
 +
| width="75" align="center"| string
 +
| width="150" align="center"| ubyte
 +
| width="75" align="center"| double
 +
| width="150" align="center"| ubyte
 +
| width="75" align="center"| double
 +
| width="150" align="center"| ubyte
 +
| width="75" align="center"| double
 +
| width="75" align="center"| ubyte
 +
| width="75" align="center"| string
 +
|-
 +
! style="border: 1pt solid;" | "string"
 +
! style="border: 1pt solid;" | Vehicle ID
 +
! style="border: 1pt solid;" | "double"
 +
! style="border: 1pt solid;" | Vehicle Length
 +
! style="border: 1pt solid;" | "double"
 +
! style="border: 1pt solid;" | Entry Time [s]
 +
! style="border: 1pt solid;" | "double"
 +
! style="border: 1pt solid;" | Leave Time [s]
 +
! style="border: 1pt solid;" | "string"
 +
! style="border: 1pt solid;" | Vehicle Type ID
 +
|}
  
 
== Notes ==
 
== Notes ==
* You can find [[SUMO_OUTPUT_E1|some further description on induction loops]]
+
* You can find [[Simulation/Output/Induction Loops Detectors (E1)|some further description on induction loops]]

Latest revision as of 18:01, 26 March 2019

Command 0xa0: Get Induction Loop Variable

ubyte string
Variable Induction Loop ID

Asks for the value of a certain variable of the named induction loop (e1 detector). The value returned is the state of the asked variable/value within the last simulation step. Please note that for asking values from your detectors you have to define them within an additional-file and load them at the start of the simulation. The freq and file attributes do not matter for TraCI.

The following variable values can be retrieved, the type of the return value is also shown in the table.

Overview Retrievable Induction Loop Variables
Variable ValueType Description Python Method
id list (0x00) stringList Returns a list of ids of all induction loops within the scenario (the given Induction Loop ID is ignored) getIDList
position (0x42) double Returns the position of the induction loop at it's lane, counted from the lane's begin, in meters. getPosition
lane ID (0x51) string Returns the ID of the lane the induction loop is placed at. getLaneID
count (0x01) int Returns the number of induction loops within the scenario (the given Induction Loop ID is ignored) getIDCount
last step vehicle number (0x10) int Returns the number of vehicles that were on the named induction loop within the last simulation step [#];
Note:
This value corresponds to the nVehEntered measure of induction loops.
getLastStepVehicleNumber
last step mean speed (0x11) double Returns the mean speed of vehicles that were on the named induction loop within the last simulation step [m/s] getLastStepMeanSpeed
last step vehicle ids (0x12) stringList Returns the list of ids of vehicles that were on the named induction loop in the last simulation step getLastStepVehicleIDs
last step occupancy (0x13) double Returns the percentage of time the detector was occupied by a vehicle [%] getLastStepOccupancy
last step mean vehicle length (0x15) double The mean length of vehicles which were on the detector in the last step [m] getLastStepMeanLength
last step's time since last detection (0x16) double The time since last detection [s] getTimeSinceDetection
last step's vehicle data (0x17) complex (see below) A complex structure containing several information about vehicles which passed the detector getVehicleData

Response 0xb0: Induction Loop Variable

ubyte string ubyte <return_type>
Variable Induction Loop ID Return type of the variable <VARIABLE_VALUE>

The respond to a "Command Get Induction Loop Variable".

Response to "last step's vehicle data" (0x17)

The return type is "complex", the following fields are:

ubyte int <INFORMATION_PACKET> ... <INFORMATION_PACKET>
"int" number of information packets <INFORMATION_PACKET> ... <INFORMATION_PACKET>

Where each information packet looks like:

ubyte string ubyte double ubyte double ubyte double ubyte string
"string" Vehicle ID "double" Vehicle Length "double" Entry Time [s] "double" Leave Time [s] "string" Vehicle Type ID

Notes