Discussion:
[sumo-user] Dynamically edit add.xml and parse trinpinfo.xml
Liao Jian Ting via sumo-user
8 years ago
Permalink
Hello, I'm trying to edit the traffic light phase duration to evaluate the traffic flow in my plan.

I have two questions and don't find the answers.


(1) Because I need to execute my process to produce new phase duration more times, I just want to edit the traffic light duration in additional file then the sumo can load it to change the phase duration. Is there any easy way to edit it in add.xml automatically?

ex: <phase duration="25" state="GGrr"/>


(2) I need some output data in tripinfo.xml, is there any easy way to obtain it?

ex: <tripinfo id="1_5_20" depart="0.00" departLane="D1_0" departPos="5.10" departSpeed="0.00" departDelay="0.00" arrival="39.00" arrivalLane="D5_0" arrivalPos="238.65" arrivalSpeed="13.10" duration="39.00" routeLength="480.11" waitSteps="0" timeLoss="4.26" rerouteNo="0" devices="tripinfo_1_5_20" vType="passenger" vaporized=""/>


Thank for help.
Jakob Erdmann via sumo-user
8 years ago
Permalink
Hello,
1) its not quite clear what you mean. If you just want to edit the
duration, open up the file in your favorite text editor. If you need
something done automatically you will have to do some programming or find
someone else who can do it for you.
2) maybe this helps you: http://sumo.dlr.de/wiki/Tools/Xml#xml2csv.py
regards,
Jakob

2017-07-11 21:56 GMT+02:00 Liao Jian Ting via sumo-user <
sumo-***@lists.sourceforge.net>:

> Hello, I'm trying to edit the traffic light phase duration to evaluate the
> traffic flow in my plan.
>
> I have two questions and don't find the answers.
>
>
> (1) Because I need to execute my process to produce new phase duration
> more times, I just want to edit the traffic light duration in additional
> file then the sumo can load it to change the phase duration. Is there any
> easy way to edit it in add.xml automatically?
>
> ex: <phase duration="25" state="GGrr"/>
>
>
> (2) I need some output data in tripinfo.xml, is there any easy way to
> obtain it?
>
> ex: <tripinfo id="1_5_20" depart="0.00" departLane="D1_0"
> departPos="5.10" departSpeed="0.00" departDelay="0.00" arrival="39.00"
> arrivalLane="D5_0" arrivalPos="238.65" arrivalSpeed="13.10"
> duration="39.00" routeLength="480.11" waitSteps="0" timeLoss="4.26"
> rerouteNo="0" devices="tripinfo_1_5_20" vType="passenger" vaporized=""/>
>
>
> Thank for help.
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> sumo-user mailing list
> sumo-***@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sumo-user
>
Liao Jian Ting via sumo-user
8 years ago
Permalink
Hello, thank for your helping and sorry for my unclear question.

First, I use my c++ program to generate the new traffic phase duration. Then I will open the add.xml in text editor and manually modify the duration replaced with the new duration. After that, work sumo to simulate the urban area(OSM) and get the tripinfo.xml in the end. I will repeat the above steps many times.

Because the traffic lights in urban are too much and I need to execute the simulation many times, manually modify the add.xml must be troublesome.

My questions are :

1) Is there any way to automatically modify the phase duration in add.xml after my c++ program generate the new duration or you have some other suggestions (tool) for me?

2) In addition to xml2csv.py<http://sumo.dlr.de/wiki/Tools/Xml#xml2csv.py>, is there any other way to parse the tripinfo for c++?

________________________________
寄件者: Jakob Erdmann <***@googlemail.com>
寄件日期: 2017年7月11日 下午 10:29
收件者: Liao Jian Ting
副本: sumo-***@lists.sourceforge.net
主旨: Re: [sumo-user] Dynamically edit add.xml and parse trinpinfo.xml

Hello,
1) its not quite clear what you mean. If you just want to edit the duration, open up the file in your favorite text editor. If you need something done automatically you will have to do some programming or find someone else who can do it for you.
2) maybe this helps you: http://sumo.dlr.de/wiki/Tools/Xml#xml2csv.py
Tools/Xml - Sumo<http://sumo.dlr.de/wiki/Tools/Xml#xml2csv.py>
sumo.dlr.de
xml2csv.py. This converts any of the sumo xml files into a flat csv (character separated values) representation. CSV-Files are easy to parse and can be opened in ...



regards,
Jakob

2017-07-11 21:56 GMT+02:00 Liao Jian Ting via sumo-user <sumo-***@lists.sourceforge.net<mailto:sumo-***@lists.sourceforge.net>>:
Hello, I'm trying to edit the traffic light phase duration to evaluate the traffic flow in my plan.

I have two questions and don't find the answers.


(1) Because I need to execute my process to produce new phase duration more times, I just want to edit the traffic light duration in additional file then the sumo can load it to change the phase duration. Is there any easy way to edit it in add.xml automatically?

ex: <phase duration="25" state="GGrr"/>


(2) I need some output data in tripinfo.xml, is there any easy way to obtain it?

ex: <tripinfo id="1_5_20" depart="0.00" departLane="D1_0" departPos="5.10" departSpeed="0.00" departDelay="0.00" arrival="39.00" arrivalLane="D5_0" arrivalPos="238.65" arrivalSpeed="13.10" duration="39.00" routeLength="480.11" waitSteps="0" timeLoss="4.26" rerouteNo="0" devices="tripinfo_1_5_20" vType="passenger" vaporized=""/>


Thank for help.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
sumo-user mailing list
sumo-***@lists.sourceforge.net<mailto:sumo-***@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/sumo-user
Jakob Erdmann via sumo-user
8 years ago
Permalink
You may want to search google for C++ XML libraries and adapt your program
to read and write the add.xml as well as trip tripinfo.xml. If you were to
use python instead of C++ you could use sumolib to do this (
http://sumo.dlr.de/wiki/Tools/Sumolib).

2017-07-12 8:59 GMT+02:00 Liao Jian Ting via sumo-user <
sumo-***@lists.sourceforge.net>:

> Hello, thank for your helping and sorry for my unclear question.
>
> First, I use my c++ program to generate the new traffic phase duration.
> Then I will open the add.xml in text editor and manually modify the
> duration replaced with the new duration. After that, work sumo to simulate
> the urban area(OSM) and get the tripinfo.xml in the end. I will repeat the
> above steps many times.
>
> Because the traffic lights in urban are too much and I need to execute the
> simulation many times, manually modify the add.xml must be troublesome.
>
> My questions are :
>
> 1) Is there any way to automatically modify the phase duration in add.xml
> after my c++ program generate the new duration or you have some other
> suggestions (tool) for me?
>
> 2) In addition to xml2csv.py<http://sumo.dlr.de/wiki/Tools/Xml#xml2csv.py>,
> is there any other way to parse the tripinfo for c++?
>
> ________________________________
> 寄件者: Jakob Erdmann <***@googlemail.com>
> 寄件日期: 2017年7月11日 下午 10:29
> 收件者: Liao Jian Ting
> 副本: sumo-***@lists.sourceforge.net
> 主旨: Re: [sumo-user] Dynamically edit add.xml and parse trinpinfo.xml
>
> Hello,
> 1) its not quite clear what you mean. If you just want to edit the
> duration, open up the file in your favorite text editor. If you need
> something done automatically you will have to do some programming or find
> someone else who can do it for you.
> 2) maybe this helps you: http://sumo.dlr.de/wiki/Tools/Xml#xml2csv.py
> Tools/Xml - Sumo<http://sumo.dlr.de/wiki/Tools/Xml#xml2csv.py>
> sumo.dlr.de
> xml2csv.py. This converts any of the sumo xml files into a flat csv
> (character separated values) representation. CSV-Files are easy to parse
> and can be opened in ...
>
>
>
> regards,
> Jakob
>
> 2017-07-11 21:56 GMT+02:00 Liao Jian Ting via sumo-user <
> sumo-***@lists.sourceforge.net<mailto:sumo-***@lists.sourceforge.net>>:
> Hello, I'm trying to edit the traffic light phase duration to evaluate the
> traffic flow in my plan.
>
> I have two questions and don't find the answers.
>
>
> (1) Because I need to execute my process to produce new phase duration
> more times, I just want to edit the traffic light duration in additional
> file then the sumo can load it to change the phase duration. Is there any
> easy way to edit it in add.xml automatically?
>
> ex: <phase duration="25" state="GGrr"/>
>
>
> (2) I need some output data in tripinfo.xml, is there any easy way to
> obtain it?
>
> ex: <tripinfo id="1_5_20" depart="0.00" departLane="D1_0"
> departPos="5.10" departSpeed="0.00" departDelay="0.00" arrival="39.00"
> arrivalLane="D5_0" arrivalPos="238.65" arrivalSpeed="13.10"
> duration="39.00" routeLength="480.11" waitSteps="0" timeLoss="4.26"
> rerouteNo="0" devices="tripinfo_1_5_20" vType="passenger" vaporized=""/>
>
>
> Thank for help.
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> sumo-user mailing list
> sumo-***@lists.sourceforge.net<mailto:sumo-***@lists.sourceforge.net>
> https://lists.sourceforge.net/lists/listinfo/sumo-user
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> sumo-user mailing list
> sumo-***@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sumo-user
>
Loading...