Networks/PlainXML

From Sumo
Revision as of 08:03, 25 March 2009 by Dkrajzew (talk | contribs) (New page: =Building Networks from own XML-descriptions= Almost all examples within the distribution were made by hand. For doing this, you need at least two files: one file for nodes and another one...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Building Networks from own XML-descriptions

Almost all examples within the distribution were made by hand. For doing this, you need at least two files: one file for nodes and another one for the streets between them. Please notice that herein, "node" and "junction" mean the same as well as "edge" and "street" do. Besides defining the nodes and edges, you can also join edges by type and set explicit connections between lanes. We will describe how each of these four file types should look like in the following chapters. Further information may be also found in the introduction to road networks in SUMO.

Nodes Descriptions

Within the nodes-files, normally having the extension ".nod.xml" (see Known Extensions), every node is described in a single line which looks like this: <node id="<STRING>" x="<FLOAT>" y="<FLOAT>" [type="<TYPE>"]/> - the straight brackets ('[' and ']') indicate that the parameter is optional. Each of these attributes has a certain meaning and value range:

Attribute Name Mandatory Value Type Description
id y id (string) The name of the node
x y float The x-position of the node on the plane in meters
y y float The y-position of the node on the plane in meters
type enum ( "priority", "traffic_light" ) An optional type for the node

If you leave out the type of the node, it is automatically guessed by NETCONVERT but may not be the one you intentionally thought of. The following types are possible, any other string is counted as an error and will yield in a program stop:

  • priority: Vehicles have to wait until vehicles right to them have passed the junction.
  • traffic_light: The junction is controlled by a traffic light.

When writing your nodes-file, please do not forget to embed your node definitions into an opening and a closing "tag". A complete file should like the example below, which is the node file "cross3l.nod.xml" for the examples "<SUMO>/data/examples/netbuild/types/cross_usingtypes/" and "<SUMO>/data/examples/netbuild/types/cross_notypes/" example.

<nodes> <!-- The opening tag -->

   <node id="0" x="0.0" y="0.0" type="traffic_light"/> <!-- def. of node "0" -->

   <node id="1" x="-500.0" y="0.0" type="priority"/> <!-- def. of node "1" -->
   <node id="2" x="+500.0" y="0.0" type="priority"/> <!-- def. of node "2" -->
   <node id="3" x="0.0" y="-500.0" type="priority"/> <!-- def. of node "3" -->
   <node id="4" x="0.0" y="+500.0" type="priority"/> <!-- def. of node "4" -->

   <node id="m1" x="-250.0" y="0.0" type="priority"/> <!-- def. of node "m1" -->
   <node id="m2" x="+250.0" y="0.0" type="priority"/> <!-- def. of node "m2" -->
   <node id="m3" x="0.0" y="-250.0" type="priority"/> <!-- def. of node "m3" -->
   <node id="m4" x="0.0" y="+250.0" type="priority"/> <!-- def. of node "m4" -->

</nodes> <!-- The closing tag -->

As you may notice, only the first node named "0", which is the node in the middle of the network, is a traffic light controlled junction. All other nodes are uncontrolled. You may also notice, that each of both ends of a street needs an according node. This is not really necessary as you may see soon, but it eases the understanding of the concept: every edge (street/road) is a connection between two nodes (junctions).