SUMO 仿真建模--事件模拟
本篇介绍几种常见交通事件场景在sumo软件中如何模拟。交通事件包括:- 停车事件(车辆事故)- 车道临时关闭- 交叉口溢流死锁长话短说,模拟的方法有两种:- 在xml文件中硬编码设置- 利用traci api 动态模拟
SUMO 仿真建模–事件模拟
本篇介绍几种常见交通事件场景在sumo软件中如何模拟。交通事件包括:
- 停车事件(车辆事故)
- 车道临时关闭
- 交叉口溢流死锁
长话短说,模拟的方法有两种:
- 在xml文件中硬编码设置
- 利用traci api 动态模拟
xml 编码模拟事件
停车事件
官方提供了比较系统的方法,可参见:
https://sumo.dlr.de/docs/FAQ.html#how_can_i_contribute_to_sumo

这里重点介绍第一种方法。在交通需求文件*.rou.xml中,针对 特定车编写如下xml代码,强制特定车辆在指定的车道和位置处停车预设的时间:
<routes>
<route id="route0" edges="beg middle end rend">
<stop lane="middle_0" endPos="50" duration="20"/>
</route>
<vehicle id="v0" route="route0" depart="0">
<stop lane="end_0" endPos="10" until="50"/>
</vehicle>
</routes>
详细内容可参见官方文档:
https://sumo.dlr.de/docs/Definition_of_Vehicles%2C_Vehicle_Types%2C_and_Routes.html
相似的场景还有公交停靠站,停车场模拟,参见:
https://sumo.dlr.de/docs/Simulation/ParkingArea.html
https://sumo.dlr.de/docs/Simulation/Public_Transport.html
车道关闭事件
设置node中的 车道属性 allow or disallow
| allow | list of vehicle classes | List of permitted vehicle classes (see access permissions) |
|---|---|---|
| disallow | list of vehicle classes | List of forbidden vehicle classes (see |
车道关闭,可设置为:
disallow=“all”
... previous definitions ...
<edge id="2si" from="m2" to="0" priority="3" numLanes="3" speed="13.89">
<lane index="2" disallow="all"/>
</edge>
... further definitions ...
详情:
https://sumo.dlr.de/docs/Networks/PlainXML.html#node_types
https://sumo.dlr.de/docs/Networks/PlainXML.html#road_access_permissions_allow_disallow
交叉口溢流死锁deadlock
nod.xml 中node 的属性设置
keepClear=false
| keepClear | bool | Whether the junction-blocking-heuristic should be activated at this node (default true) |
|---|---|---|
详情: https://sumo.dlr.de/docs/Networks/PlainXML.html#node_types
或者更精细的控制,选择设置connection的 属性
-
keepClear=false (必选)
-
contPos=0 or 合适的正数 (可选)
| keepClear | bool | true | if set to false, vehicles which pass this (lane-2-lane) connection) will not worry about blocking the intersection. |
|---|---|---|---|
| contPos | float | -1 | if set to 0, no internal junction will be built for this connection. If set to a positive value, an internal junction will be built at this position (in m) from the start of the internal lane for this connection. |
详见
https://sumo.dlr.de/docs/Networks/PlainXML.html
https://sumo.dlr.de/docs/Simulation/Intersections.html#junction_blocking
Traci API 动态模拟事件
停车事件
关键函数:traci._vehicle 下的 setStop 函数
setStop(self, vehID, edgeID, pos=1.0, laneIndex=0, duration=-1073741824.0, flags=0, startPos=-1073741824.0, until=-1073741824.0)
setStop(string, string, double, integer, double, integer, double, double) -> None
Adds or modifies a stop with the given parameters. The duration and the until attribute are
in seconds.
详见: https://sumo.dlr.de/daily/pydoc/traci._vehicle.html
车道关闭事件
关键函数:traci._lane 的setDisallowed()
setDisallowed(self, laneID, disallowedClasses)
setDisallowed(string, list) -> None
Sets a list of disallowed vehicle classes.
详见: https://sumo.dlr.de/daily/pydoc/traci._lane.html
注意: 车道关闭后需要关注后续车辆的轨迹和运动特征
可参见:
交叉口溢流死锁deadlock
traci api 无特殊方法,同xml编码的方式
核心思想为: 交通流量加到足够大,使其出现溢流现象;同时设置keepClear=false选项,保证溢流后,车辆还会继续驶入交叉口。
tricks:
交通流量成倍数增大/减小的快捷方法
sumocfg文件中设置
--scale 的值为 10.0 (放大十倍) or 0.1(减小10), 其默认值为1.0
<process>
<scale value="10.0" />
</process>
效果
停车事件

车道关闭

溢流锁死

更多推荐




所有评论(0)