sumo检测器设置及输出(E1,E2,E3)

操作步骤:新建Ex_info.xml→编辑sumocfg→运行sumocfg本文同时新增三种检测器,其中sumocfg文件内容如下:

<configuration>

    <input>
        <net-file value="ds-wc.net.xml"/>
        <route-files value="ds-wc.rou.xml"/>
        <additional-files value="E1_info.xml,E2_info.xml,E3_info.xml"/>
    </input>

    <time>
        <begin value="0"/>
        <end value="1500"/>
    </time>

</configuration>

运行sumocfg后可以观察检测器布设情况

 

 下面介绍三种检测器具体布设情况:

 一、线圈检测器(单点)

1.检测内容

流量、占有率、时间平均速度、空间平均速度、车辆平均长度、通过车辆数。

检测器通过确定车辆的时间来计算值 首先进入和离开探测器。这意味着,a)一些 只要车辆在探测器上,值就不可用,并且 b) 如果车辆通过以下方式进入检测器:变道 ,则无法计算某些值 - 因为车辆没有完全通过探测器。

2.新建E1_info.xml

在建立路网之后的同一文件夹下新建E1_info.xml,官网文件:

<additional>
   <inductionLoop id="<ID>" lane="<LANE_ID>" pos="<POSITION_ON_LANE>" period="<AGGREGATION_TIME>"
   file="<OUTPUT_FILE>" friendlyPos="true"/>
</additional>


“id”是可用于命名检测器的任何字符串。属性“lane”和“pos”描述了探测器放置在哪个车道上以及该车道上的哪个位置。“period”属性描述了应聚合收集的值的时间段。“file”属性告诉模拟探测器应将结果写入哪个文件。

tribute NameValue TypeDescription
idid (string)The id of the detector
lanereferenced lane idThe id of the lane the detector shall be laid on. The lane must be a part of the network used.
posfloatThe position on the lane the detector shall be laid on in meters. The position must be a value between -1*lane's length and the lane's length. In the case of a negative value, the position will be computed backward from the lane's end (the position the vehicles drive towards).
period (alias freq)int (time)The aggregation period the values the detector collects shall be summed up (default: whole simulation time).
filefilenameThe path to the output file. See Writing Files for further information.
friendlyPosboolIf set, no error will be reported if the detector is placed behind the lane. Instead, the detector will be placed 0.1 meters from the lane's end or at position 0.1, if the position was negative and larger than the lane's length after multiplication with -1; default: false.
vTypesstringspace separated list of vehicle type ids to consider, "" means all; default "".
detectPersonsstringdetect persons instead of vehicles (pedestrians or passengers)
lengthfloatlength of the detection zone downstream of pos (default 0)

设置情况:

<additional>
   <inductionLoop id="01" lane="-E0_0" 
   pos="20" freq="30" file="output_E1.xml" friendlyPos="true"/>
   <inductionLoop id="02" lane="-E0_1" 
   pos="20" freq="30" file="output_E1.xml" friendlyPos="true"/>
   <inductionLoop id="03" lane="-E0_0" 
   pos="1" freq="30" file="output_E1.xml" friendlyPos="true"/>
   <inductionLoop id="04" lane="-E0_1" 
   pos="1" freq="30" file="output_E1.xml" friendlyPos="true"/>
</additional>

设置了4个线圈检测器(01 02 03 04)

3.输出output_E1.xml

<interval begin="''<BEGIN_TIME>''" end="''<END_TIME>''" id="''<DETECTOR_ID>''" \ nVehContrib="''<MEASURED_VEHICLES>''" flow="''<FLOW>''" occupancy="''<OCCUPANCY>''" \ speed="''<MEAN_SPEED>''" harmonicMeanSpeed="''<HARM_MEAN_SPEED>''" length="''<MEAN_LENGTH>''" nVehEntered="''<ENTERED_VEHICLES>''"/> ... further intervals ...

The values are described in the following table.

NameTypeDescription
begin(simulation) secondsThe first time step the values were collected in
end(simulation) secondsThe last time step + DELTA_T the values were collected in
ididThe id of the detector
nVehContrib#vehiclesThe number of vehicles that have completely passed the detector within the interval在间隔内完全通过检测器的车辆数量
flow#vehicles/hourThe number of contributing vehicles extrapolated to an hour扩展到一个小时的流量
occupancy%The percentage (0-100%) of the time a vehicle was at the detector. If multiple vehicles are on the detector simulataneously (due to its length or in sublane simulation), values above 100 are possible)占有率:车辆在检测器上的时间百分比 (0-100%)。如果多个车辆同时在探测器上(由于其长度或在副车道模拟中),则值可能大于 100)
speedm/sThe arithmetic mean of the velocities of all completely collected vehicles (-1 indicates that no vehicles were collected). This gives the time mean speed.所有完全收集的车辆的速度的算术平均值(-1 表示未收集车辆)。这给出了时间平均速度。
harmonicMeanSpeedm/sThe harmonic mean of the velocities of all completely collected vehicles (-1 indicates that no vehicles were collected). This gives the space mean speed.所有完全收集的车辆的速度的调和平均值(-1 表示未收集车辆)。这给出了空间的平均速度。
lengthmThe mean length of all completely collected vehicles (-1 indicates that no vehicles were collected).所有完全收集的车辆的平均长度(-1 表示未收集车辆)。
nVehEntered#vehiclesAll vehicles that have touched the detector. Includes vehicles which have not passed the detector completely (and which do not contribute to collected values).所有接触过探测器的车辆。包括未完全通过检测器的车辆(并且对收集的值没有贡献)。

nVehEntered“包括所有车辆 在探测器上(即使他们通过变道或到达或离开或 间隔结束时仍在探测器上)。这些值是 为车辆收集的对应于.nVehContrib

<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/det_e1_file.xsd">
    <interval begin="0.00" end="30.00" id="01" nVehContrib="0" flow="0.00" occupancy="0.00" speed="-1.00" harmonicMeanSpeed="-1.00" length="-1.00" nVehEntered="0"/>
    <interval begin="0.00" end="30.00" id="02" nVehContrib="2" flow="240.00" occupancy="2.67" speed="12.47" harmonicMeanSpeed="12.47" length="5.00" nVehEntered="2"/>
    <interval begin="0.00" end="30.00" id="03" nVehContrib="0" flow="0.00" occupancy="0.00" speed="-1.00" harmonicMeanSpeed="-1.00" length="-1.00" nVehEntered="0"/>
    <interval begin="0.00" end="30.00" id="04" nVehContrib="2" flow="240.00" occupancy="2.72" speed="12.27" harmonicMeanSpeed="12.27" length="5.00" nVehEntered="2"/>
    <interval begin="30.00" end="60.00" id="01" nVehContrib="5" flow="600.00" occupancy="7.21" speed="11.64" harmonicMeanSpeed="11.55" length="5.00" nVehEntered="5"/>

二、路段检测器E2

1.检测内容

        车道区域检测器用于捕获沿车道或车道的区域的交通。实际上,这类似于车辆跟踪摄像机。与感应环路相比,车道区域检测器具有一定的长度,该长度由长度属性或属性pos,endPos指定。E2 检测器的输出专为测量站立/堵塞车辆的队列而量身定制,并跟踪当前在其区域内的所有车辆,请参阅下表中的属性时间阈值、速度阈值和堵塞阈值。此外,可以将E2探测器与交通信号灯耦合,请参阅属性tl和to。

检测内容:进出入车辆数、平均速度、占有率、停车时间

2.新建E2_info.xml,官网

<additional>
   <laneAreaDetector id="<ID>" lanes="<LANE_ID1> <LANE_ID2> ... <LANE_IDN>" 
   pos="<START_POSITION_ON_FIRST_LANE>" endPos="<END_POSITION_ON_LAST_LANE>" 
   friendlyPos="<BOOL>" period="<AGGREGATION_TIME>" file="<OUTPUT_FILE>" 
   timeThreshold="<FLOAT>" speedThreshold="<FLOAT>" jamThreshold="<FLOAT>"
   tl="<TRAFFIC_LIGHT_ID>"  to="<LANE_ID>"/>  
</additional>


 

Attribute Name

Value Type

Description

id

id (string)

A string holding the id of the detector

lane

referenced lane id

The id of the lane the detector shall be laid on. The lane must be a part of the network used. This argument excludes the argument lanes.

lanes

referenced lane id list

A space-separated list of lane-ids which are to be covered by the detector. All lanes must be a part of the network and form a continuous sequence. This argument excludes the arguments lane and length.

pos

float

The position on the first lane covered by the detector. See information about the same attribute within the detector loop description for further information. Per default, the start position is placed at the first lane's begin.

endPos

float

The end position on the last lane covered by the detector. Per default the end position is placed at the last lane's end.

length

float

The length of the detector in meters. If the detector reaches over the lane's end, it is extended to preceding / consecutive lanes.

file

filename

The path to the output file. The path may be relative.

period (alias freq)

int

The aggregation period for aggregation collected data. If neither period nor tl are set, data will be aggregated over the whole simulation

tl

id

The traffic light that triggers aggregation when switching. Either period or tl must be specified

to

id

The id of an outgoing lane that triggers aggregation in conjunction with traffic light switching. This is only used together with tl.

timeThreshold

float

The time-based阈值 that describes how much time has to pass until a vehicle is recognized as halting; in s, default: 1s.

speedThreshold

float

The speed-based threshold that describes how slow a vehicle has to be to be recognized as halting; in m/s, default: 5/3.6m/s.

jamThreshold

float

The maximum distance to the next standing vehicle in order to make this vehicle count as a participant to the jam; in m, default: 10m.

friendlyPos

bool

If set, no error will be reported if the detector is placed behind the lane. Instead, the detector will be placed 0.1 meters from the lane's end or at position 0.1, if the position was negative and larger than the lane's length after multiplication with -1; default: false.

vTypes

string

space separated list of vehicle type ids to consider, "" means all; default "".

detectPersons

string

detect persons instead of vehicles (pedestrians or passengers)

实际设置:

<additional>
   <laneAreaDetector id="1" lane="-E0_0" pos="1" endPos="30" friendlyPos="1" freq="30" file="output_E2"/>
 <laneAreaDetector id="2" lane="-E0_1" pos="1" endPos="30" friendlyPos="1" freq="30" file="output_E2"/>
</additional>

设置两条路段区域检测器

4.输出output_E2

         车道区域检测器会注意 进入该区域的每辆车。只要车辆不完全离开 该区域。在这种情况下,每个车辆状态称为“数据样本”,并且 车道区域检测器的输出由 在完整数据收集期间(“期间”)内的所有车辆 间隔。

        由于车道区域检测器覆盖车道,车辆在这些车道上进行分类, 可以识别沿探测器区域的堵塞并测量 他们。因为该区域可能同时发生不止一次堵塞, 这些值涵盖了所有堵塞的平均测量值 (“jamLengthIn...总和“)作为最长(最大值)的显式度量堵塞。对于最长的堵塞,平均值(“meanMaxJamLengthIn...”)和 写入最大值(“maxJamLengthIn...”)值。[注]注意

        以米为单位的堵塞长度可能大于车辆长度的总和, 因为车辆之间的位置也被考虑在内。

        除了堵塞计算外,车辆停止的持续时间是 收集。它们都是在车辆的整个时间跨度内收集的 在检测器区域(“...停止持续时间“和”停止持续时间总和“), 并为每个间隔显式表示(“...间隔停止持续时间“和 “间隔停止持续时间总和”)。

NameTypeDescription
begin(simulation) secondsThe first time step the values were collected in
end(simulation) secondsThe last time step + DELTA_T the values were collected in (may be equal to begin)
ididThe id of the detector (needed if several detectors share an output file)
sampledSecondssThe total time all vehicles which contributed data were on the detector. this may be fractional even if the time step is one second, because the times when the vehicle enters and leaves are interpolated.所有提供数据的车辆在探测器上的总时间。即使时间步长为一秒,这也可能是小数,因为车辆进入和离开的时间是插值的。
nVehEntered#The number of vehicles that entered the detector in the corresponding interval. (vehicle front has passed 'pos')在相应间隔内进入检测器的车辆数量。(车辆前部已通过“POS”)
nVehLeft#The number of vehicles that left the detector in the corresponding interval. (vehicle back has passed 'endPos')在相应间隔内离开检测器的车辆数量。(车辆后退已通过“结束位置”)
nVehSeen#The number of vehicles that were on the detector in the corresponding interval (were "seen" by the detector).在相应时间间隔内在检测器上的车辆数量(被检测器“看到”)。
meanSpeedm/sThe mean velocity over all collected data samples.所有收集的数据样本的平均速度。
meanTimeLosssThe average time loss per vehicle in the corresponding interval. The total time loss can be obtained by multiplying this value with nVehSeen.相应时间间隔内每辆车的平均时间损失。总时间损失可以通过将此值乘以 nVehSeen 来获得。
meanOccupancy%The percentage (0-100%) of the detector's place that was occupied by vehicles, summed up for each time step and averaged by the interval duration.车辆占据的探测器位置的百分比(0-100%),为每个时间步长求和,并按间隔持续时间取平均值。
maxOccupancy%The maximum percentage (0-100%) of the detector's place that was occupied by vehicles during the interval.在间隔期间车辆占据的探测器位置的最大百分比 (0-100%)。
meanMaxJamLengthInVehicles#vehiclesThe length of the longest jams recognized during each step, averaged over the interval duration. In vehicles that have contributed to these jams.在每一步中识别的最长堵塞的长度,在间隔持续时间内取平均值。在导致这些堵塞的车辆中。
meanMaxJamLengthInMetersmAs prior, but in meters (see notes)和上一样,但以米为单位(见注释)
maxJamLengthInVehicles#vehiclesThe length of the longest jam recognized during the interval duration. In vehicles that have contributed to this jams.在间隔持续时间内识别的最长堵塞的长度。在导致这种堵塞的车辆中。
maxJamLengthInMetersmAs prior, but in meters. This includes the gaps between jammed vehicles和上一样,但以米为单位。这包括堵塞车辆之间的间隙
jamLengthInVehiclesSum#vehiclesThe sum of all lengths of all jams recognized during the interval. In vehicles that have contributed to these jams.间隔期间识别的所有堵塞队列的所有长度的总和。在导致这些堵塞的车辆中。
jamLengthInMetersSummAs prior, but in meters. This includes the gaps between jammed vehicles和以前一样,但以米为单位。这包括堵塞车辆之间的间隙
meanHaltingDurationsThe mean halting duration of vehicles that entered the area and are still inside or have left the area within the reported interval.进入该区域且仍在区域内或在检测的时间间隔内离开该区域的车辆的平均停车时间。
maxHaltingDurationsThe maximum halting duration of vehicles that entered the area and are still inside or have left the area within the reported interval.进入该区域且仍在区域内或在报告的时间间隔内离开该区域的车辆的最长停车时间。
haltingDurationSumsThe sum of all halting durations of vehicles that entered the area and are still inside or have left the area within the reported interval.在报告的时间间隔内进入该区域但仍在区域内或已离开该区域的车辆的所有停车时间的总和。
meanIntervalHaltingDurationsThe mean halting duration of vehicles that entered the area and are still inside or have left the area within the reported interval, counted from the interval's begin.进入该区域且仍在检测间隔内或已离开该区域的车辆的平均停车持续时间,从间隔开始计算。
maxIntervalHaltingDurationsThe maximum halting duration of vehicles that entered the area and are still inside or have left the area within the reported interval, counted from the interval's begin.进入该区域且仍在检测间隔内或已离开该区域的车辆的最长停车持续时间,从间隔开始计算。
intervalHaltingDurationSumsThe sum of all halting durations of vehicles that entered the area and are still inside or have left the area within the reported interval, counted from the interval's begin.在检测的间隔内进入该区域但仍在区域内或已离开该区域的车辆的所有停车时间的总和,从间隔开始计算。
startedHalts#The number of started halts. Please note that during an interval a vehicle may stop halting and enter a new halting state.启动的停止次数。请注意,在一段时间内,车辆可能会停止停车并进入新的停车状态。
meanVehicleNumber#The mean number of vehicles that were on the detector (averaged over the interval duration).检测器上的平均车辆数(间隔持续时间内的平均值)。
maxVehicleNumber#The maximum number of vehicles that were on the detector area during the interval.间隔期间检测器区域上的最大车辆数。

  <interval begin="0.00" end="30.00" id="1" sampledSeconds="0.00" nVehEntered="0" nVehLeft="0" nVehSeen="0" meanSpeed="-1.00" meanTimeLoss="-1.00" meanOccupancy="0.00" maxOccupancy="0.00" meanMaxJamLengthInVehicles="0.00" meanMaxJamLengthInMeters="0.00" maxJamLengthInVehicles="0" maxJamLengthInMeters="0.00" jamLengthInVehiclesSum="0" jamLengthInMetersSum="0.00" meanHaltingDuration="0.00" maxHaltingDuration="0.00" haltingDurationSum="0.00" meanIntervalHaltingDuration="0.00" maxIntervalHaltingDuration="0.00" intervalHaltingDurationSum="0.00" startedHalts="0.00" meanVehicleNumber="0.00" maxVehicleNumber="0" />
 

三、双截面检测器E3

1.检测内容

多入口-出口检测器在必须加载的附加文件中定义 通过模拟。

多入口-出口探测器的描述必须包括一组 入口和出口横截面集。因此,它不是 可以使用单个标签来指定检测器。相反, 说明由以下部分组成:

  • 描述 检测器就像电感回路的描述一样 探测器区域 探测器确实如此。
  • 描述检测器入口点的一组标记。
  • 描述检测器出口点的一组标记。
  • 必须与开始标记匹配的结束标记。

         Multi-Entry-Exit Detectors(E3)可以用来检测通过检测区域的平均速度、车辆通过检测区域的平均停车次数、车辆通过区域的平均延误、一段时间内进入检测区域车辆数、一段时间内进入检测区域但还未离开的所有车辆的平均速度、一段时间内进入检测区域但还未离开的所有车辆的平均停车次数等,详见下表。

2.新建E3_info.xml
 

<additional>
   <entryExitDetector id="<ID>" period="<AGGREGATION_TIME>" file="<OUTPUT_XMLFILE>" 
   timeThreshold="<FLOAT>" speedThreshold="<FLOAT>">
      <detEntry lane="<LANE_ID1>" pos="<POSITION_ON_LANE>" friendlyPos="<BOOL>"/>
      <detEntry lane="<LANE_ID2>" pos="<POSITION_ON_LANE>" friendlyPos="<BOOL>"/>
      <detExit lane="<LANE_ID1>" pos="<POSITION_ON_LANE>" friendlyPos="<BOOL>"/>
      <detExit lane="<LANE_ID3>" pos="<POSITION_ON_LANE>" friendlyPos="<BOOL>"/>

      ... further entries ...

   </entryExitDetector>
</additional>

根据自己的实际需要修改其中的参数。

输入参数包括:

ttribute NameValue TypeDescription
idid (string)A string holding the id of the detector
filefilenameThe path to the output file. The path may be relative.
period (alias freq)intThe aggregation period the values the detector collects shall be summed up (default: whole simulation time).
timeThresholdfloatThe time-based threshold that describes how much time has to pass until a vehicle is recognized as halting; in s, default: 1s.
speedThresholdfloatThe speed-based threshold that describes how slow a vehicle has to be to be recognized as halting; in m/s, default: 5/3.6m/s.
openEntryboolIf set to true, no error will be reported if vehicles leave the detector without first entering it. This can be useful when tracking vehicles for a particular combination of entry and exit lane at an intersection and other vehicles may also use the exit lane. default: false.
vTypesstringspace separated list of vehicle type ids to consider, "" means all; default "".
detectPersonsstringdetect persons instead of vehicles (pedestrians or passengers)

一个Entry和它对应的Exit组成一个检测器。

<additional>
   <entryExitDetector id="01" freq="30" file="output_E3.xml"
   timeThreshold="1" speedThreshold="3.6">
      <detEntry lane="E2_0" pos="40" friendlyPos="1"/> #S
      <detEntry lane="E0_0" pos="40" friendlyPos="1"/> #W
      <detEntry lane="-E4_0" pos="40" friendlyPos="1"/> #E
      <detEntry lane="E2_1" pos="40" friendlyPos="1"/> #S
      <detEntry lane="E0_1" pos="40" friendlyPos="1"/> #W
      <detEntry lane="-E4_1" pos="40" friendlyPos="1"/> #E
      <detExit lane="E4_0" pos="40" friendlyPos="1"/> #Sr
      <detExit lane="-E2_0" pos="40" friendlyPos="1"/> #WR
      <detExit lane="-E0_0" pos="40" friendlyPos="1"/> #ER
    <detExit lane="-E0_1" pos="40" friendlyPos="1"/> #SL
      <detExit lane="E4_1" pos="40" friendlyPos="1"/> #WL
      <detExit lane="-E2_1" pos="40" friendlyPos="1"/> #EL
      
      ... further entries ...
 
   </entryExitDetector>
</additional>

3.输出output_E3.xml

NameTypeDescription
begin(simulation) secondsThe first time step the values were collected in
end(simulation) secondsThe last time step + DELTA_T the values were collected in (may be equal to begin)
ididThe id of the detector
meanTravelTimesThe time vehicles needed to pass the area (the crossing of the vehicle front counts). Averaged over all vehicles which left the detector completely during the interval duration.平均行程时间:车辆通过该区域所需的时间(车辆前部的交叉计数)。在间隔期间完全离开检测器的所有车辆的平均值。
meanOverlapTravelTimesThe time vehicles needed to pass the area (any time a part of the vehicle was in the detection range counts). Averaged over all vehicles that have left the detector completely during the interval duration.车辆通过该区域所需的时间(车辆的一部分在检测范围内的任何时间都很重要)。在间隔期间完全离开检测器的所有车辆的平均值。
meanSpeedm/sThe mean speed of vehicles that have passed the area. Averaged over the interval and vehicles.已通过该区域的车辆的平均速度。在间隔和车辆上取平均值。
meanHaltsPerVehicle#The number of halts of vehicles that have passed the area. Averaged over all vehicles that have left the detector during the interval duration.已通过该区域的车辆的停车次数。在间隔持续时间内离开检测器的所有车辆的平均值。
meanTimeLosssThe average time loss for all vehicles that have passed the area.已通过该区域的所有车辆的平均时间损失。
vehicleSum#The number of vehicles that have left the area during the interval.在间隔内离开该区域的车辆数量。
meanSpeedWithinm/sThe mean speed of those vehicles that have entered, but not yet left the area. Averaged over the time each vehicle was in the area and vehicles.已进入但尚未离开该区域的车辆的平均速度。每辆车在该区域和车辆中的时间的平均值
meanHaltsPerVehicleWithinm/sThe mean number of haltings of those vehicles that have entered, but not yet left the area. Averaged over the time each vehicle was in the area and vehicles.已进入但尚未离开该区域的车辆的平均停车次数。每辆车在该区域和车辆中的时间的平均值。
meanDurationWithinsThe mean duration within the area of those vehicles that have entered, but not yet left the area. Averaged over the time each vehicle was in the area and vehicles.已进入但尚未离开该区域的车辆区域内的平均持续时间。每辆车在该区域和车辆中的时间的平均值。
vehicleSumWithinsThe number of vehicles that have entered but not yet left the area.已进入但尚未离开该区域的车辆数量。
meanIntervalSpeedWithinm/sThe mean speed of those vehicles that have entered, but not yet left the area, collected during the written interval. Averaged over the interval and vehicles.在写入间隔内收集的已进入但尚未离开该区域的车辆的平均速度。在间隔和车辆上取平均值。
meanIntervalHaltsPerVehicleWithin#The number of halts per vehicles that have entered, but not yet left the area, collected during the written interval. Averaged over the vehicles.在写入间隔内收集的已进入但尚未离开该区域的每辆车的停车次数。平均在车辆上。
meanIntervalDurationWithinsThe mean duration within the area of those vehicles that have entered, but not yet left the area, collected during the written interval. Averaged over the vehicles.在写入间隔内收集的已进入但尚未离开该区域的车辆区域内的平均持续时间。平均在车辆上。
meanTimeLossWithinsThe average time loss collected by vehicles that have entered but not yet left the area during the written interval.在写入间隔内已进入但尚未离开该区域的车辆收集的平均时间损失。

<e3Detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/det_e3_file.xsd">
   <interval begin="0.00" end="30.00" id="E2" meanTravelTime="9.58" meanOverlapTravelTime="9.99" meanSpeed="12.48" meanHaltsPerVehicle="0.00" meanTimeLoss="0.77" vehicleSum="6" meanSpeedWithin="9.14" meanHaltsPerVehicleWithin="0.43" meanDurationWithin="15.67" vehicleSumWithin="7" meanIntervalSpeedWithin="9.14" meanIntervalHaltsPerVehicleWithin="0.43" meanIntervalDurationWithin="15.67" meanTimeLossWithin="7.32"/>
   <interval begin="30.00" end="60.00" id="E2" meanTravelTime="23.59" meanOverlapTravelTime="23.97" meanSpeed="8.71" meanHaltsPerVehicle="0.50" meanTimeLoss="13.33" vehicleSum="12" meanSpeedWithin="8.11" meanHaltsPerVehicleWithin="0.62" meanDurationWithin="13.84" vehicleSumWithin="8" meanIntervalSpeedWithin="8.11" meanIntervalHaltsPerVehicleWithin="0.62" meanIntervalDurationWithin="13.84" meanTimeLossWithin="5.69"/>
   <interval begin="60.00" end="90.00" id="E2" meanTravelTime="15.14" meanOverlapTravelTime="15.54" meanSpeed="10.88" meanHaltsPerVehicle="0.12" meanTimeLoss="3.50" vehicleSum="8" meanSpeedWithin="4.77" meanHaltsPerVehicleWithin="0.92" meanDurationWithin="24.22" vehicleSumWithin="13" meanIntervalSpeedWithin="4.25" meanIntervalHaltsPerVehicleWithin="0.62" meanIntervalDurationWithin="20.51" meanTimeLossWithin="16.88"/>

  • 18
    点赞
  • 58
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
以下是一个简单的 SUMO 车辆编队控制代码示例: ```python import traci # 定义车队中的车辆ID VEHICLE_IDS = ["vehicle1", "vehicle2", "vehicle3"] # 定义车队目标速度和跟随距离 TARGET_SPEED = 10 FOLLOW_DISTANCE = 10 # 在 SUMO 中启动车队 traci.start(["sumo", "-c", "config.sumocfg", "--start"]) # 获取车队中的车辆对象 vehicles = {vehicle_id: traci.vehicle.getIDList().index(vehicle_id) for vehicle_id in VEHICLE_IDS} # 控制车辆速度和跟随距离 while traci.simulation.getMinExpectedNumber() > 0: for vehicle_id, index in vehicles.items(): traci.vehicle.setSpeedMode(vehicle_id, 0) traci.vehicle.setSpeed(vehicle_id, TARGET_SPEED) if index == 0: leading_vehicle_id = None else: leading_vehicle_id = VEHICLE_IDS[index-1] leading_vehicle_position = traci.vehicle.getPosition(leading_vehicle_id) current_vehicle_position = traci.vehicle.getPosition(vehicle_id) distance_to_leading_vehicle = traci.simulation.getDistance2D(leading_vehicle_position, current_vehicle_position) traci.vehicle.setDistance(vehicle_id, leading_vehicle_id, FOLLOW_DISTANCE + distance_to_leading_vehicle) traci.simulationStep() # 在 SUMO 中停止车队 traci.close() ``` 在以上示例中,我们定义了一个包括三辆车的车队,通过设置目标速度和跟随距离来控制车辆行驶。在这个例子中,车队的车辆将从 SUMO 配置文件 `config.sumocfg` 中启动,循环中的每个车辆都将以给定的速度行驶,并且距离前面的车辆保持一定的距离。
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值