SUMO入门(三) - 使用XML定义网络
Networks/PlainXML
SUMO-Networks有两种表示形式:
– 一组 plain-xml 文件,描述网络拓扑和几何
– 加载到模拟中的 .net.xml 文件。 这包含许多生成的信息,例如交叉点内的结构和路权逻辑。
要定义网络,至少需要两个文件:一个用于node的文件,另一个用于它们之间的edge。Besides defining the nodes and edges, you can also join edge attributes by type and set explicit connections between edges or lanes。运行NETCONVERT来构建网络。
netconvert --node-files=MyNodes.nod.xml --edge-files=MyEdges.edg.xml
–output-file=MySUMONet.net.xml
netconvert --node-files=MyNodes.nod.xml --edge-files=MyEdges.edg.xml
–connection-files=MyConnections.con.xml --type-files=MyTypes.typ.xml
–output-file=MySUMONet.net.xml
Node Descriptions
在nodes-files中,通常具有扩展名 .nod.xml,每个节点都在一行中描述,如下所示:
<node id =<STRING> x =<FLOAT> y =<FLOAT> [type =<TYPE>] />
直括号(’[‘和’]’)表示参数type是可选的。
tlType
static: Each phase of the traffic light will last for a fixed duration
actuated: Green phases may be prolonged depending on traffic measurements from automatically added induction loops
type
priority:低优先级边缘的车辆必须等到高优先级边缘的车辆通过交叉点。
traffic_light:交叉点由交通灯控制。(如果冲突的链路同时绿灯,则使用优先级规则来避免冲突)。
traffic_light_unregulated:交叉点由交通信号灯控制,没有任何进一步的规则。如果使用不安全的信号规则,这可能会导致冲突。请注意,交叉点内的冲突不会检测到。
traffic_light_right_on_red:交叉点由交通灯控制,类型为traffic_light。此外,右转车辆可以在安全的情况下(在停止一次之后)在任何阶段行驶。此行为称为 right-turn-on-red。
//SUMO_HOME\docs\examples\netconvert\types\cross_notypes\input_nodes.nod.xml
<nodes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/nodes_file.xsd">
<node id="0" x="0.0" y="0.0" type="traffic_light"/>
<node id="1" x="-500.0" y="0.0" type="priority"/>
<node id="2" x="+500.0" y="0.0" type="priority"/>
<node id="3" x="0.0" y="-500.0" type="priority"/>
<node id="4" x="0.0" y="+500.0" type="priority"/>
<node id="m1" x="-250.0" y="0.0" type="priority"/>
<node id="m2" x="+250.0" y="0.0" type="priority"/>
<node id="m3" x="0.0" y="-250.0" type="priority"/>
<node id="m4" x="0.0" y="+250.0" type="priority"/>
</nodes>
As you may notice, only the first nod