Demand/Introduction to demand modelling in SUMO
在生成网络之后,可以使用SUMO-GUI来查看它,但是没有汽车可以行驶。人们仍然需要对车辆进行某种描述,这称为交通需求traffic demand
从现在开始,我们将使用以下术语:
行程 trip 是由起始边缘,目的地边缘和出发时间定义的从一个地方到另一个地方的车辆移动。
路线 route 是扩展的行程 trip,这意味着路线定义不仅包含第一个和最后一个边,而且还包含车辆将通过的所有边。
SUMO和SUMO-GUI需要路线 route 作为车辆运动的输入。有几种方法可以为SUMO生成路线 route:
1)Using trip definitions
行程 trip 至少包括起始、结束边缘以及出发时间。当您想要手动创建需求或编写自己的脚本以导入自定义数据时,这非常有用。您可以使用DUAROUTER将您的行程trip转变为路线route。 DUAROUTER is responsible for importing routes or their definitions from other simulation packages and for computing routes using the shortest-path algorithm by Dijkstra.
2)Using flow definitions
This is mostly the same approach as using trip definitions, but one may join vehicles having the same departure and arrival edge using this method
3)Using OD-matrices
Origin-Destination-Matrices(或OD-matrices)通常可从交通管理部门获得。必须使用OD2TRIPS将它们转换为行程 trip。
4)By hand
You can of course generate route XML-files by hand
Definition of Vehicles, Vehicle Types, and Routes
有各种应用程序可用于定义SUMO的车辆需求。 当然,也可以手动定义需求文件。 在开始之前,重要的是要知道SUMO中的车辆由三部分组成:描述车辆物理特性的车辆类型,车辆应走的路线,和车辆本身。
最初,我们定义一辆带有他自己的路线的车辆:
<routes>
<vType id="type1" accel="0.8" decel="4.5" sigma="0.5" length="5" maxSpeed="70"/>
<vehicle id="0" type="type1" depart="0" color="1,0,0">
<route edges="beg middle end rend"/>
vehicle>
routes>
通过向SUMO(或SUMO-GUI)提供这样的路径定义,SUMO将构建一个id为“0”、类型为“type1”、红色(颜色= 1,0,0)的车辆,该车辆在时间0开始。车辆将沿着街道 “beg”, “middle”, “end”,一旦它已经到达边缘"rend",它将从仿真中移除。
该车辆有自己的内部路线,不与其他车辆共用。 也可以使用相同的路线定义两辆车。 在这种情况下,路线必须“外部化” - 在车辆引用路线之前定义。 此外,路线必须通过一个id来命名。 使用该路线的车辆使用“route”属性引用它。 如下所示:
<routes>
<vType id="type1" accel="0.8" decel="4.5" sigma="0.5" length="5" maxSpeed="70"/>
<route id="route0" color="1,1,0" edges="beg middle end rend"/>
<vehicle id="0" type="type1" route="route0" depart="0" color="1,0,0"/>
<vehicle id="1" type="type1" route="route0" depart="0" color="0,1,0"/>
routes>
A vehicle may be defined using the following attributes:
A vehicle is defined using the vType element as shown below:
<routes>
<vType id="type1" accel="2.6" decel="4.5" sigma="0.5" length="5" maxSpeed="70"/>
routes>
Having defined this, one can build vehicles of type “type1”. The values used above are the ones most of the examples use. They resemble a standard vehicle as used within the Stefan Krauß’ thesis.
<routes>
<vType id="type1" accel="2.6" decel="4.5" sigma="0.5" length="5" maxSpeed="70"/>
<vehicle id="veh1" type="type1" depart="0">
<route edges="edge1 edge2 edge3"/>
vehicle>
routes>
该定义是初始定义,包括车辆“纯物理”参数的定义,例如其长度,颜色或最大速度,以及使用的汽车跟随模型的参数。
默认的汽车跟随型号基于Krauß的工作,但也可以选择其他型号。 通过设置进一步的vType-attribures来完成模型选择和参数化,如下所示:
<routes>
<vType id="type1" length="5" maxSpeed="70" carFollowModel="Krauss" accel="2.6" decel="4.5" sigma="0.5"/>
routes>
可以使用vClass属性将SUMO车辆分配为定义的“抽象车辆类”。 这些类用于车道定义,车道允许/禁止使用某些车辆类型。 人们可能会想到有一条有三条车道的道路,最右边的道路只能由“出租车”或“公共汽车”使用。 默认车辆类别是乘客(表示普通乘用车)。
A color is defined as red,green,blue or red,green,blue,alpha either in a vehicle, route or vType.
<route id="r0" color="0,255,255"/>
<vehicle id="v0" color="255,0,0,0"/>
In the default visualization settings, the vehicle color will be used if define, otherwise the type and finally the route color.
可视化。为了更好地观察交通,可以通过使用guiShape属性为其分配特定形状来改变车辆的外观。 当将车辆的绘制模式设置为简单形状时,使用这些形状。 以下形状是已知的:
<route id="route0" color="1,1,0" edges="beg middle end rend"/>
It is possible to define repeated vehicle emissions ("flow"s), which have the same parameters as the vehicle except for the departure time.
创建的车辆的id是“flowId.runningNumber”,它们在给定的间隔内平均分配。
<route edges="beg middle end rend"/>
<stop busStop="station1" duration="30"/>
flow>
模拟的需求信息也可以采用起始、目的边缘的形式,而不是完整的边缘列表。 在这种情况下,模拟根据交通状况来执行最快路径路由。 可选地,可以使用via属性指定中间边缘列表。
<vehicles>
<trip id="t" depart="0" from="beg" to="end"/>
<flow id="f" begin="0" end="100" number="23" from="beg" to="end"/>
<flow id="f2" begin="0" end="100" number="23" from="beg" to="end" via="e1 e23 e7"/>
vehicles>
the following attributes are supported for incomplete routes (trips and flows):