reading xml file in ns3

1,416 views
Skip to first unread message

Ohoud Abdullah A Alzamzami

unread,
Mar 30, 2014, 10:03:02 AM3/30/14
to ns-3-...@googlegroups.com
Hello everyone,
 
I am simulating a VANET protocol in which I need to use some road topology information generated by a trffic simulator. Have anyone tried reading network topology information from xml files and use this information in the simualtion. Please direct me on howto do so.
 
Best Regards,
Ohoud

Konstantinos

unread,
Mar 30, 2014, 10:25:31 AM3/30/14
to ns-3-...@googlegroups.com
What exactly does the XML file have? Is it the position/mobility of the nodes, or other information? 
Because you mention road topology information and then network topology. These two could be different things.

Have a look at the XmlConfigLoad class which reads a XML file and sets attributes of ns-3 classes in order to run a scenario.

Also, if the XML file is for position/mobility and it is generated from SUMO, you can export it as NS-2 trace file and load it in NS-3 using Ns2MobiltyHelper class.

Ohoud

unread,
Mar 31, 2014, 11:12:14 AM3/31/14
to ns-3-...@googlegroups.com

Hi Konstantionos,

What I need is to store the map information which is basically the edges and junctions in order to identify any node location on the map during the simulation (on which road section and not only coordinate positions priveided by ns-2 mobility trace files). This information is to be used for routing decisions in my protocol.

Thanks

Konstantinos

unread,
Mar 31, 2014, 11:35:56 AM3/31/14
to ns-3-...@googlegroups.com
I assume you work with SUMO. Have you considered using VSimRTI or iTETRIS which couple SUMO with NS-3? In these simulators you can directly access the road information.

If you do not want that, and you need to load it in NS-3 directly, you have to create a 'parser'.
You have two options I can think of:
libxml2 library: http://www.xmlsoft.org/examples/ (ns-3 uses this for xml-config, so you can see examples there)
xerces-c library: http://www.yolinux.com/TUTORIALS/XML-Xerces-C.html

Then you have to create your own class to save the map (simple) but also query the map to identify on which road each vehicle is (more difficult). I do not know how much of that code you can find/port from SUMO sources.

Ohoud

unread,
Mar 31, 2014, 12:02:33 PM3/31/14
to ns-3-...@googlegroups.com
Yes, I am using SUMO and I cannot use any of these bi-directionally coupled tools because I am using the latest version of ns-3 which is 3.19.
My idea is to use an appropriate data structure (map or multimap) to store road network information (edges and junctions) generated by SUMO which could be found in .net.xml file. Then this information could be used in conjunctions with ns-2 mobility traces to identify a particular vehicle position on the map and use this information in routing decisions.
Do you think that this could be done ?
Do you think that other files might also be needed for routing decisions .rou.xml files generated by SUMO?
Do you have any suggestions of alternative solutions?

Thanks Ohoud

Konstantinos

unread,
Mar 31, 2014, 12:43:18 PM3/31/14
to ns-3-...@googlegroups.com
If you read the net.xml it has almost all the information and further information that might not be needed. 
Perhaps it would be easier to read only the nod.xml and edge.xml files. From these two files you can generate a graph. 

Personally, I have created such model for CLWPR [1][2], but not reading SUMO files yet, just a custom txt file since my road topologies are small. What I found hard and time consuming (personally and in simulation) was to identify the road based on the position of the vehicle. The larger the map, the more time it takes. Perhaps I need to consider a more efficient way to do it, or couple SUMO directly with one of the two simulators I suggested.


[1] Konstantinos Katsaros, Mehrdad Dianati and Karsten Roscher. A Position-based Routing Module for Simulation of VANETs in NS-3 In Workshop on ns-3, International ICST Conference on Simulation Tools and Techniques (SIMUTools), 2012.
[2] Konstantinos Katsaros, Mehrdad Dianati, Rahim Tafazolli, and Ralf Kernchen. CLWPR - A Novel Cross-Layer Optimized Position Based Routing Protocol for VANETs. In IEEE Vehicular Networking Conference, pages 139-146, 2011

Ohoud

unread,
Mar 31, 2014, 3:12:19 PM3/31/14
to ns-3-...@googlegroups.com


Ho did you identify the road based on the position of vehicles?

Konstantinos

unread,
Mar 31, 2014, 4:04:35 PM3/31/14
to ns-3-...@googlegroups.com
I had to check each road bounds and 'slope', that's why I said it is in-efficient especially for large areas (many roads). Check how SUMO has implemented this. I assume they have a better way

Ohoud

unread,
Mar 31, 2014, 6:51:26 PM3/31/14
to ns-3-...@googlegroups.com
How did you check road slope?

Konstantinos

unread,
Mar 31, 2014, 6:56:29 PM3/31/14
to ns-3-...@googlegroups.com

Ricardo G.

unread,
Jul 23, 2014, 5:46:45 PM7/23/14
to ns-3-...@googlegroups.com
Hi, I have a similar problem.

I'd like to know the position of the nodes and broadcast it in HELLOs. With the received location, the receiver node can do routing decisions. And calculate the route towards some geographic area, it doesn't matter if it is the shortest, the fastest, etc.

Can this be done with some tool, plug-in or something in NS3?

Thank you, saludos :)
Reply all
Reply to author
Forward
0 new messages