文章目录
- 一.简要介绍
- 1.node file
- 2.edge file
- 3.lane definitions
- (1)路段细分
- (2)邻近的对向车道
- (3)删除边或车道
- 4.type file
- (1)简要概述
- (2)edge定义中引用type文件的示例
- (3)指定车辆种类的速度限制
- 5.connections file
- (1)简要概述:
- (2)connection的属性参数
- (3)删除连接
- (4)设置连接的优先级
- (5)同一边的多个连接
- 二.演示示例:
- 1.自定义编写node file
- 2.自定义编写edge file
- 3.自定义编写type file(用以设置edge的类型)
- 4.自定义编写connection file
- 5.使用netconvert生成net file
- 6.用netedit打开生成的net file
- 三.参考资料:
一.简要介绍
1.node file
节点文件(node file)的文件扩展名为“*.nod.xml”。节点是构建路网最基本的单元,节点文件内部包含的内容是关于道路节点(node/junction)的相关信息。
设置节点(node)的代码格式如下所示:
<node id=“NOED_NAME” x=“X_AXIS_NUMBER” y=“Y_AXIS_NUMBER” type=“TYPE” <other attributes>/>
其中"id"表示单个节点的名称或者编号,用来区分不同的节点(node);"x"表示单个节点的横坐标数值;"y"表示节点的纵坐标数值;“type"表示节点的可选择类型,主要有"Priority(优先级)”、"Traffic_light(信号灯)"等参数(详细说明可以下载我上传的学习资料)。
2.edge file
边文件(edge file)的文件扩展名为"edg.xml"。在路网构建中,edge是通过node来形成连接。在edge file中,设置的每一条edge的描述都如下形式所示:
<edge id="<STRING>" from="<NODE_ID>" to="<NODE_ID>" [type="<STRING>"] [numLanes="<INT>"] [speed="<FLOAT>"] [priority="<UINT>"] [length="<FLOAT>"] [shape="<2D-POSITION>[ <2D-POSITION>]*"] [spreadType="center"] [allow="<VEHICLE_CLASS>[ <VEHICLE_CLASS>]*"] [disallow="<VEHICLE_CLASS>[ <VEHICLE_CLASS>]*"]/>
- “id”—— 每条边的编号或名称,用来区分不同的edge。每条edge的ID都是独一无二的,不能够出现重复名称,否则在运行过程中会出现错误;
- “from”—— edge起始点的节点(node)ID,该节点作为边的起始点(origin);
- “to”—— edge终点的节点(node)ID,该节点作为边的终端点(destination);
- “numLanes”—— edge上设置的车道数量;
- “speed”—— edge上设置的最大车辆速度(m/s)
- “priority”—— 边的优先级(主要用于路权的计算);
- “length”—— 设置的边的长度(m);
- “spreadType”—— 用以描述如何从边缘几何结构来计算车道几何结构(选项值:“right”、“center”、“roadCenter”);
- “allow”—— 用以设置允许在边上行驶的车辆种类集合,如下所示:
<edge id="2si" from="m2" to="0" priority="3" numLanes="3" speed="13.89" allow="passenger taxi bus">
- “disallow”—— 用以设置不允许或禁止在边上行驶的车辆种类集合(语句写法与allow相同);
- “width”—— 用已设置边的宽度(注意:你输入的宽度表示的是边上车道的宽度);
- “sidewalkWidth”—— 用以添加给定宽度的人行道(默认值给定为-1,表示不在边上添加人行道);
- “type”—— 为什么最后才介绍type属性值呢?因为这与下面要讲的type file有关,其实上面讲到的一些edge的属性值可以在type file中设置好,统一在edge file中使用,这样做的好处是让edge file在编辑过程中对某些属性值做有针对性的编写,其他一些附属或相对不重要的属性值可以在type file中集中编写,减少了代码的重复率,提高效率。下面给出了简单的示例:
edge file:
<edges>
<edge id="1fi" from="1" to="m1" type="b"/>
<edge id="1si" from="m1" to="0" type="a"/>
<edge id="1o" from="0" to="1" type="c"/>
<edge id="2fi" from="2" to="m2" type="b"/>
<edge id="2si" from="m2" to="0" type="a"/>
<edge id="2o" from="0" to="2" type="c"/>
<edge id="3fi" from="3" to="m3" type="b"/>
<edge id="3si" from="m3" to="0" type="a"/>
<edge id="3o" from="0" to="3" type="c"/>
<edge id="4fi" from="4" to="m4" type="b"/>
<edge id="4si" from="m4" to="0" type="a"/>
<edge id="4o" from="0" to="4" type="c"/>
</edges>
type file:
<types>
<type id="a" priority="3" numLanes="3" speed="13.889">
<lane index="0" allow="passenger taxi"/>
<lane index="2" disallow="bus"/>
</type>
<type id="b" priority="2" numLanes="2" speed="11.111">
<lane index="0" allow="passenger taxi"/>
<lane index="2" disallow="bus"/>
</type>
<type id="c" priority="1" numLanes="1" speed="11.111">
<lane index="0" allow="passenger taxi"/>
<lane index="2" disallow="bus"/>
</type>
</types>
3.lane definitions
车道(lane)是通过edge的属性值numLanes来设置的,关于车道定义的一些属性参数介绍如下:
- “index”—— 车道编号(边的行驶方向最右侧的车道从0开始编号 ,然后其余车道的index依次+1向后编号);
- “allow”—— 允许在车道上行驶的车辆种类的列表;
- “disallow”—— 禁止在车道上行驶的车辆种类的列表;
- “speed”—— 设置车道上的速度,速度的单位是:m/s;
- “width”—— 设置车道的宽度,单位为:米;
(1)路段细分
简要介绍:
通常,每条边(edge)都有确定数量的车道(lane)和固定不变的车速(fixed speed),道路的拓宽和减速(speed reductions)设置是通过后缘(consequence edges)定义的。不过在一些情况下,设置一条边,并改变这条边的车道数或者是沿着这条边的长度方向改变速度会更加的合适。
通过“split”属性参数来改变车道数量和按边的长度来改变速度,代码如下所示:
<edges>
<edge id="2si" from="m2" to="0" priority="3" numLanes="3" speed="13.89">
<split pos="30" lanes="0 1" speed="10"/>
</edge>
</edges>
- 在边上从距离起点30米处的位置作为分界点,在分界点插入一个以<EDGE_ID>.(边ID.位置信息)为命名的节点(本例中在分界点处插入的节点名称为“2si.30”);
- 在插入这个分界点之前,边(edge)是包含了边上所有的车道(lane)。在插入分界点之后,只有指定了相应车道属性的车道才会做出减速行为(本示例中为车道index为0和1的两条车道指定了速度的属性参数,故只有0和1两条车道的速度会降低至10m/s);
- 插入该分界点这意味着将原先的一条边(edge)分成了两条边。一条边是原先的边,该边上只有一条index为2的车道,另一条边则是之后生成的,该边上有index为0和1的两条车道,并且该边的最大速度也设定为了10m/s。
(2)邻近的对向车道
为了实现对向车道车辆的驾驶(opposite-direction-driving),则必须要定义对向车道的邻接信息(adjacency information)。这可以在边缘文件(edge file)中通过“neigh”参数来设置邻近对向车道(neighboring opposite-direction lane),示例代码如下所示:
<edges>
<edge id="a" from="X" to="Y" numLanes="2">
<neigh lane="b_0"/>
</edge>
<edge id="b" from="Y" to="X">
<neigh lane="a_1"/>
</edge>
</edges>
上述代码说明了,将边a和边b的各自最内侧的车道声明为一组相邻的对向车道。
(3)删除边或车道
删除不必要的边(edge)或车道(lane),可以使用下述示例代码:
<edges>
<delete id="a"/> <!-- deletes the edge "a" -->
<delete id="b" index="0"/> <!-- deletes the first lane of edge "a" -->
</edges>
- “delete id=“a”” —— 表示删除边a;
- "delete id=“b” index=“0"” —— 表示删除边b上车道编号为0的车道;
也可以通过为“type”赋予“remove=”true””的属性来删除指定类型的所有边,如下所示:
<edges>
<edge id="1fi" from="1" to="m1" type="b"/>
<edge id="1si" from="m1" to="0" type="a"/>
<edge id="1o" from="0" to="1" type="c"/>
<edge id="2fi" from="2" to="m2" type="b"/>
<edge id="2si" from="m2" to="0" type="a"/>
<edge id="2o" from="0" to="2" type="c"/>
<edge id="3fi" from="3" to="m3" type="b"/>
<edge id="3si" from="m3" to="0" type="a"/>
<edge id="3o" from="0" to="3" type="c"/>
<edge id="4fi" from="4" to="m4" type="b"/>
<edge id="4si" from="m4" to="0" type="a"/>
<edge id="4o" from="0" to="4" type="c"/>
</edges>
<types>
<type id="a" priority="3" numLanes="3" speed="13.889" remove="true">
<lane index="0" allow="passenger taxi"/>
<lane index="2" disallow="bus"/>
</type>
<type id="b" priority="2" numLanes="2" speed="11.111">
<lane index="0" allow="passenger taxi"/>
<lane index="2" disallow="bus"/>
</type>
<type id="c" priority="1" numLanes="1" speed="11.111">
<lane index="0" allow="passenger taxi"/>
<lane index="2" disallow="bus"/>
</type>
- 这就意味着,凡是type为a的边都将被删除。
4.type file
(1)简要概述
正如上述所述,边的类型(edge type)是用来化简边的定义的(the definition of edges)。对于每条边的描述都应该包括车道数量的相关信息、该边上的最大允许速度、此边可选的优先级和允许与禁止的车辆种类。有关边的类型和文件格式的完整描述。可以参考《SUMO edge type file》。
类型属性(type attributes)与边本身的属性是完全相同的。关于边的开始节点(start node)和结束节点(end node)的相关信息并没有在类型描述(type description)中给出,只能在边属性中进行设置。
(2)edge定义中引用type文件的示例
<edges>
<edge id="1fi" from="1" to="m1" type="b"/>
<edge id="1si" from="m1" to="0" type="a"/>
<edge id="1o" from="0" to="1" type="c"/>
<edge id="2fi" from="2" to="m2" type="b"/>
<edge id="2si" from="m2" to="0" type="a"/>
<edge id="2o" from="0" to="2" type="c"/>
<edge id="3fi" from="3" to="m3" type="b"/>
<edge id="3si" from="m3" to="0" type="a"/>
<edge id="3o" from="0" to="3" type="c"/>
<edge id="4fi" from="4" to="m4" type="b"/>
<edge id="4si" from="m4" to="0" type="a"/>
<edge id="4o" from="0" to="4" type="c"/>
</edges>
<types>
<type id="a" priority="3" numLanes="3" speed="13.889"/>
<type id="b" priority="2" numLanes="2" speed="11.111"/>
<type id="c" priority="1" numLanes="1" speed="11.111"/>
</types>
正如用户所看到的,边定义的文件中将所有定义的边连接到“a”、“b”、“c”三个类型(type),每一个类型在类型定义文件中都有一个相对应的描述。
(3)指定车辆种类的速度限制
使用“type”定义能够实现车辆种类的指定速度限制,演示代码如下所示:
<type id="a" priority="3" numLanes="3" speed="38.89"/>
<restriction vClass="truck" speed="27.89"/>
</type>
5.connections file
(1)简要概述:
- “connection”描述了一个节点上的驶入边(incoming edge)和驶出边(outgoing edge)是如何进行连接的(例如在某些交叉口禁止车辆左转)。用户能够在边缘层级上指定连接(connections),也可以详细声明哪条驶入车道与哪条驶出车道进行连接。如果保留了一些未指定的连接,那么“netconvert”将会根据启发式算法自动地计算丢失的信息。
- 如果只是想描述从某一条边连接到某一条边的话,可以使用如下定义:
<connection from="<FROM_EDGE_ID>" to="<T0_EDGE_ID>"/>
- 这不仅让“netconvert”知道车辆能够从边名称为<FROM_EDGE_ID>的一边驶向边名称为<T0_EDGE_ID>的另一边,而且也禁止了所有从<FROM_EDGE_ID>边到其他边的驾驶行为,除非在连接文件中有特殊说明<FROM_EDGE_ID>边与其他边也有连接,否则车辆的驾驶行为会被禁止。
- 如果用户想要在设置连接边(connection edge)的同时设置连接车道(connection lane),那么可以使用以下命令代码:
<connection from="<FROM_EDGE_ID>" to="<TO_EDGE_ID>" fromLane="<INT_1>" toLane="<INT_2>"/>
- 上述命令代码表示将边<FROM_EDGE_ID>上的车道<INT_1>与边<TO_EDGE_ID>上的车道<INT_2>建立联系。车道的index编号是最外侧向最内侧进行编号的,从0开始编。
(2)connection的属性参数
- “from”—— 连接的起始边的ID;
- “to”—— 连接的终端边的ID;
- “fromLane”—— 连接的起始车道的index;
- “toLane”—— 连接的终端车道的index;
- “pass”—— 如果设置了该属性参数,那么通过此连接的车辆将不会停车等待。默认值为:false;
- “keepClear”—— 如果该属性值设置为false,那么通过该连接的车辆将不会担心交叉口阻塞。默认值为:true;
- “speed”—— 当从该连接通过交叉口时,指定通过交叉口的最大车速(单位:m/s)。默认情况下,指定的最大车速是连接的前后边的平均速度(mean speed);
- “uncontrolled”—— 如果该属性参数设置为“true”,则表示尽管交通信号灯控制了节点(node),但是该连接(connection)并不会被交通信号灯所控制。默认值为:false
- “allow”—— 设置独立于“from-lane”和“to-lane”权限的自定义权限(custom permissions),即设置连接上允许哪些种类的车辆行驶,设置了允许行驶的车辆类型后,其余种类的车辆将不被运行在该连接行驶;
- “disallow”—— 设置独立于“from-lane”和“to-lane”权限的自定义权限(custom permissions),即设置连接上不允许哪些种类的车辆行驶,设置了不允许性的车辆种类后,其余种类的车辆将会被允许在该连接上行驶。
(3)删除连接
- 删除边(edge)连接:
<delete from="<FROM_EDGE_ID>" to="<T0_EDGE_ID>"/>
- 删除车道(lane)连接:
<delete fromLane="<FROM_LANE-INDEX>" toLane="<T0_LANE_INDEX>"/>
(4)设置连接的优先级
以下示例中定义了在垂直边上的右转车辆要让行水平边上的直行车辆:
<connections>
<!-- The next four connection definitions are same as in
"Network with explicit edge-2-edge connections" -->
<connection from="1si" to="3o"/>
<connection from="1si" to="2o"/>
<connection from="2si" to="4o"/>
<connection from="2si" to="1o"/>
<!-- now, let's prohibit the vertical connections by the horizontal -->
<!-- prohibit moving right from top to left by straight from right to left -->
<prohibition prohibitor="2si->1o" prohibited="4si->1o"/>
<!-- prohibit moving straight from top to bottom by straight from right to left -->
<prohibition prohibitor="2si->1o" prohibited="4si->3o"/>
<!-- prohibit moving left from top to right by straight from right to left -->
<prohibition prohibitor="2si->1o" prohibited="4si->2o"/>
<!-- prohibit moving right from bottom to right by straight from left to right -->
<prohibition prohibitor="1si->2o" prohibited="3si->2o"/>
<!-- prohibit moving straight from bottom to top by straight from left to right -->
<prohibition prohibitor="1si->2o" prohibited="3si->4o"/>
<!-- prohibit moving left from bottom to right by straight from left to right -->
<prohibition prohibitor="1si->2o" prohibited="3si->1o"/>
</connections>
(5)同一边的多个连接
指定来自同一个边缘的多个连接(会产生冲突)将会使得在各连接之间建立起优先级顺序,而且会在模拟中产生无碰撞模拟(collision-free)仿真。
默认情况下,最右侧车道将会拥有通行权,但是可以使用“pass”属性参数来定义,示例如下所示:设置pass属性后,此时并不是最右侧车道拥有路权了。
<connections>
<connection from="WC" to="CE" fromLane="0" toLane="0"/>
<connection from="WC" to="CE" fromLane="1" toLane="0" pass="true"/>
</connections>
二.演示示例:
1.自定义编写node file
<nodes>
<node id="1" x="-100.0" y="0.0" type="priority"/>
<node id="2" x="0.0" y="0.0" type="traffic_light"/>
<node id="3" x="100.0" y="0.0" type="traffic_light"/>
<node id="4" x="200.0" y="0.0" type="priority"/>
<node id="5" x="0.0" y="100.0" type="priority"/>
<node id="6" x="100.0" y="100.0" type="priority"/>
<node id="7" x="0.0" y="-100.0" type="priority"/>
<node id="8" x="100.0" y="-100.0" type="priority"/>
</nodes>
2.自定义编写edge file
<edges>
<edge id="edge1" from="1" to="2" type="type2"/>
<edge id="edge2" from="2" to="3" type="type2"/>
<edge id="edge3" from="3" to="4" type="type2"/>
<edge id="edge4" from="2" to="1" type="type2"/>
<edge id="edge5" from="3" to="2" type="type2"/>
<edge id="edge6" from="4" to="3" type="type2"/>
<edge id="edge7" from="7" to="2" type="type1"/>
<edge id="edge8" from="2" to="5" type="type1"/>
<edge id="edge9" from="8" to="3" type="type1"/>
<edge id="edge10" from="3" to="6" type="type1"/>
<edge id="edge11" from="2" to="7" type="type1"/>
<edge id="edge12" from="5" to="2" type="type1"/>
<edge id="edge13" from="3" to="8" type="type1"/>
<edge id="edge14" from="6" to="3" type="type1"/>
</edges>
3.自定义编写type file(用以设置edge的类型)
<types>
<type id="type1" numLanes="3" speed="13.89" priority="3">
<lane index="2" allow="bus"/>
<lane index="0" disallow="truck"/>
</type>
<type id="type2" numLanes="3" speed="15" priority="6">
<lane index="2" allow="bus"/>
<lane index="0" disallow="truck"/>
</type>
</types>
4.自定义编写connection file
<connections>
<!-- edge1 -->
<!-- edge1 to edge2 straight-->
<connection from="edge1" to="edge2" fromLane="0" toLane="0"/>
<connection from="edge1" to="edge2" fromLane="0" toLane="1"/>
<connection from="edge1" to="edge2" fromLane="0" toLane="2"/>
<connection from="edge1" to="edge2" fromLane="1" toLane="0"/>
<connection from="edge1" to="edge2" fromLane="1" toLane="1"/>
<connection from="edge1" to="edge2" fromLane="1" toLane="2"/>
<connection from="edge1" to="edge2" fromLane="2" toLane="0"/>
<connection from="edge1" to="edge2" fromLane="2" toLane="1"/>
<connection from="edge1" to="edge2" fromLane="2" toLane="2"/>
<!-- edge1 to edge11 right -->
<connection from="edge1" to="edge11" fromLane="0" toLane="0"/>
<connection from="edge1" to="edge11" fromLane="0" toLane="1"/>
<connection from="edge1" to="edge11" fromLane="0" toLane="2"/>
<!-- edge1 to edge8 left -->
<connection from="edge1" to="edge8" fromLane="2" toLane="0"/>
<connection from="edge1" to="edge8" fromLane="2" toLane="1"/>
<connection from="edge1" to="edge8" fromLane="2" toLane="2"/>
<!-- edge2 -->
<!-- edge2 to edge3 straight -->
<connection from="edge2" to="edge3" fromLane="0" toLane="0"/>
<connection from="edge2" to="edge3" fromLane="0" toLane="1"/>
<connection from="edge2" to="edge3" fromLane="0" toLane="2"/>
<connection from="edge2" to="edge3" fromLane="1" toLane="0"/>
<connection from="edge2" to="edge3" fromLane="1" toLane="1"/>
<connection from="edge2" to="edge3" fromLane="1" toLane="2"/>
<connection from="edge2" to="edge3" fromLane="2" toLane="0"/>
<connection from="edge2" to="edge3" fromLane="2" toLane="1"/>
<connection from="edge2" to="edge3" fromLane="2" toLane="2"/>
<!-- edge2 to edge13 right -->
<connection from="edge2" to="edge13" fromLane="0" toLane="0"/>
<connection from="edge2" to="edge13" fromLane="0" toLane="1"/>
<connection from="edge2" to="edge13" fromLane="0" toLane="2"/>
<!-- edge2 to edge10 left -->
<connection from="edge2" to="edge10" fromLane="2" toLane="0"/>
<connection from="edge2" to="edge10" fromLane="2" toLane="1"/>
<connection from="edge2" to="edge10" fromLane="2" toLane="2"/>
<!-- edge7 -->
<!-- edge7 to edge8 straight -->
<connection from="edge7" to="edge8" fromLane="0" toLane="0"/>
<connection from="edge7" to="edge8" fromLane="0" toLane="1"/>
<connection from="edge7" to="edge8" fromLane="0" toLane="2"/>
<connection from="edge7" to="edge8" fromLane="1" toLane="0"/>
<connection from="edge7" to="edge8" fromLane="1" toLane="1"/>
<connection from="edge7" to="edge8" fromLane="1" toLane="2"/>
<connection from="edge7" to="edge8" fromLane="2" toLane="0"/>
<connection from="edge7" to="edge8" fromLane="2" toLane="1"/>
<connection from="edge7" to="edge8" fromLane="2" toLane="2"/>
<!-- edge7 to edge2 right -->
<connection from="edge7" to="edge2" fromLane="0" toLane="0"/>
<connection from="edge7" to="edge2" fromLane="0" toLane="1"/>
<connection from="edge7" to="edge2" fromLane="0" toLane="2"/>
<!-- edge7 to edge4 left -->
<connection from="edge7" to="edge4" fromLane="2" toLane="0"/>
<connection from="edge7" to="edge4" fromLane="2" toLane="1"/>
<connection from="edge7" to="edge4" fromLane="2" toLane="2"/>
<!-- edge12 -->
<!-- edge12 to edge11 sraight -->
<connection from="edge12" to="edge11" fromLane="0" toLane="0"/>
<connection from="edge12" to="edge11" fromLane="0" toLane="1"/>
<connection from="edge12" to="edge11" fromLane="0" toLane="2"/>
<connection from="edge12" to="edge11" fromLane="1" toLane="0"/>
<connection from="edge12" to="edge11" fromLane="1" toLane="1"/>
<connection from="edge12" to="edge11" fromLane="1" toLane="2"/>
<connection from="edge12" to="edge11" fromLane="2" toLane="0"/>
<connection from="edge12" to="edge11" fromLane="2" toLane="1"/>
<connection from="edge12" to="edge11" fromLane="2" toLane="2"/>
<!-- edge12 to edge4 right -->
<connection from="edge12" to="edge4" fromLane="0" toLane="0"/>
<connection from="edge12" to="edge4" fromLane="0" toLane="1"/>
<connection from="edge12" to="edge4" fromLane="0" toLane="2"/>
<!-- edge12 to edge2 left -->
<connection from="edge12" to="edge2" fromLane="2" toLane="0"/>
<connection from="edge12" to="edge2" fromLane="2" toLane="1"/>
<connection from="edge12" to="edge2" fromLane="2" toLane="2"/>
<!-- edge9 -->
<!-- edge9 to edge10 straight -->
<connection from="edge9" to="edge10" fromLane="0" toLane="0"/>
<connection from="edge9" to="edge10" fromLane="0" toLane="1"/>
<connection from="edge9" to="edge10" fromLane="0" toLane="2"/>
<connection from="edge9" to="edge10" fromLane="1" toLane="0"/>
<connection from="edge9" to="edge10" fromLane="1" toLane="1"/>
<connection from="edge9" to="edge10" fromLane="1" toLane="2"/>
<connection from="edge9" to="edge10" fromLane="2" toLane="0"/>
<connection from="edge9" to="edge10" fromLane="2" toLane="1"/>
<connection from="edge9" to="edge10" fromLane="2" toLane="2"/>
<!-- edge9 to edge3 right -->
<connection from="edge9" to="edge3" fromLane="0" toLane="0"/>
<connection from="edge9" to="edge3" fromLane="0" toLane="1"/>
<connection from="edge9" to="edge3" fromLane="0" toLane="2"/>
<!-- edge9 to edge5 left -->
<connection from="edge9" to="edge5" fromLane="2" toLane="0"/>
<connection from="edge9" to="edge5" fromLane="2" toLane="1"/>
<connection from="edge9" to="edge5" fromLane="2" toLane="2"/>
<!-- edge14 -->
<!-- edge14 to edge13 straight -->
<connection from="edge14" to="edge13" fromLane="0" toLane="0"/>
<connection from="edge14" to="edge13" fromLane="0" toLane="1"/>
<connection from="edge14" to="edge13" fromLane="0" toLane="2"/>
<connection from="edge14" to="edge13" fromLane="1" toLane="0"/>
<connection from="edge14" to="edge13" fromLane="1" toLane="1"/>
<connection from="edge14" to="edge13" fromLane="1" toLane="2"/>
<connection from="edge14" to="edge13" fromLane="2" toLane="0"/>
<connection from="edge14" to="edge13" fromLane="2" toLane="1"/>
<connection from="edge14" to="edge13" fromLane="2" toLane="2"/>
<!-- edge14 to edge5 right -->
<connection from="edge14" to="edge5" fromLane="0" toLane="0"/>
<connection from="edge14" to="edge5" fromLane="0" toLane="1"/>
<connection from="edge14" to="edge5" fromLane="0" toLane="2"/>
<!-- edge14 to edge3 left -->
<connection from="edge14" to="edge3" fromLane="2" toLane="0"/>
<connection from="edge14" to="edge3" fromLane="2" toLane="1"/>
<connection from="edge14" to="edge3" fromLane="2" toLane="2"/>
<!-- edge6 -->
<!-- edge6 to edge5 -->
<connection from="edge6" to="edge5" fromLane="0" toLane="0"/>
<connection from="edge6" to="edge5" fromLane="0" toLane="1"/>
<connection from="edge6" to="edge5" fromLane="0" toLane="2"/>
<connection from="edge6" to="edge5" fromLane="1" toLane="0"/>
<connection from="edge6" to="edge5" fromLane="1" toLane="1"/>
<connection from="edge6" to="edge5" fromLane="1" toLane="2"/>
<connection from="edge6" to="edge5" fromLane="2" toLane="0"/>
<connection from="edge6" to="edge5" fromLane="2" toLane="1"/>
<connection from="edge6" to="edge5" fromLane="2" toLane="2"/>
<!-- edge6 to edge10 -->
<connection from="edge6" to="edge10" fromLane="0" toLane="0"/>
<connection from="edge6" to="edge10" fromLane="0" toLane="1"/>
<connection from="edge6" to="edge10" fromLane="0" toLane="2"/>
<!-- edge6 to edge13 -->
<connection from="edge6" to="edge13" fromLane="2" toLane="0"/>
<connection from="edge6" to="edge13" fromLane="2" toLane="1"/>
<connection from="edge6" to="edge13" fromLane="2" toLane="2"/>
</connections>
5.使用netconvert生成net file
netconvert --node-files=test.nod.xml --edge-files=test.edg.xml --connection-files=test.con.xml --type-files=test.typ.xml --output-file=test.xml
6.用netedit打开生成的net file
这样就完成了通过xml语句编码来完成路网的构建。
三.参考资料:
- netconvert用法介绍;
- node描述;
- edge描述;
- type描述;
- connections描述;
- 交通信号灯描述;
(本系列教程将持续更新,敬请关注!)
更多推荐
SUMO仿真教程(5) —— 使用“XML“语言自定义构建路网
发布评论