[sumo-user] Change the volume of traffic flows in TraCI

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[sumo-user] Change the volume of traffic flows in TraCI

MohamadReza-Haghani
Hi,

I am writing a code in TraCI module of Python. I was wondering to know
whether there is any way to change the traffic volume of a flow in TraCI. I
appreciate for any help.

Best,
Reza.



--
Sent from: http://sumo-user-mailing-list.90755.n8.nabble.com/
_______________________________________________
sumo-user mailing list
[hidden email]
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
Reply | Threaded
Open this post in threaded view
|

Re: [sumo-user] Change the volume of traffic flows in TraCI

Maria.Armellini
Hi,

I think it is not possible to control a flow via TraCI.
Based on an old answer from Jakob (https://sourceforge.net/p/sumo/mailman/sumo-user/thread/CAGApggN9mkxDO0Y-dKZ6x4eDzLEyJVGao3TZLj1Dib0Qg0WrbQ%40mail.gmail.com/#msg35668525), what you can do is insert additional vehicles using the same parameters or delete vehicles from the flow after they have departed. See: https://sumo.dlr.de/docs/TraCI/Change_Vehicle_State.html#remove_0x81 and https://sumo.dlr.de/docs/TraCI/Add_Vehicle.html.

Regards,
Giuliana

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of MohamadReza-Haghani
Sent: Mittwoch, 22. Juli 2020 17:40
To: [hidden email]
Subject: [sumo-user] Change the volume of traffic flows in TraCI

Hi,

I am writing a code in TraCI module of Python. I was wondering to know
whether there is any way to change the traffic volume of a flow in TraCI. I
appreciate for any help.

Best,
Reza.



--
Sent from: http://sumo-user-mailing-list.90755.n8.nabble.com/
_______________________________________________
sumo-user mailing list
[hidden email]
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
[hidden email]
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
Reply | Threaded
Open this post in threaded view
|

Re: [sumo-user] Change the volume of traffic flows in TraCI

MohamadReza-Haghani
Hi Giuliana,

Thank you very much for your answer. What I am trying to do is not changing
the traffic flow in the middle of simulation. I wrote a loop for running the
simulation several times that you can see it here.

<http://sumo-user-mailing-list.90755.n8.nabble.com/file/t374/Capture3.png>


I was wondering to know is there any cmd command that I can add it in
"traci.start()" to change the traffic volume at the start of every
simulation.

Best,
Reza.



--
Sent from: http://sumo-user-mailing-list.90755.n8.nabble.com/
_______________________________________________
sumo-user mailing list
[hidden email]
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
Reply | Threaded
Open this post in threaded view
|

Re: [sumo-user] Change the volume of traffic flows in TraCI

Maria.Armellini
Hi Reza,

you can try to define different route/flow files and call them from the cmd line with the option --route-files (see https://sumo.dlr.de/docs/sumo.html for all possible options). You can name the files with the number 1 to 5 at the end and can use the "i" value in your loop. For example "--route-files", "flows" + srt(i) + ".rou.xml"
Otherwise you can create different .sumocfg files with different routes/flows file or other parameters. For example "--c", "VEL" + srt(i) + ".sumocfg"

Maybe there is a better way to do what you want, but I can only think of this one.

Regards,
Giuliana

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of MohamadReza-Haghani
Sent: Donnerstag, 23. Juli 2020 17:12
To: [hidden email]
Subject: Re: [sumo-user] Change the volume of traffic flows in TraCI

Hi Giuliana,

Thank you very much for your answer. What I am trying to do is not changing
the traffic flow in the middle of simulation. I wrote a loop for running the
simulation several times that you can see it here.

<http://sumo-user-mailing-list.90755.n8.nabble.com/file/t374/Capture3.png>


I was wondering to know is there any cmd command that I can add it in
"traci.start()" to change the traffic volume at the start of every
simulation.

Best,
Reza.



--
Sent from: http://sumo-user-mailing-list.90755.n8.nabble.com/
_______________________________________________
sumo-user mailing list
[hidden email]
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
[hidden email]
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
Reply | Threaded
Open this post in threaded view
|

Re: [sumo-user] Change the volume of traffic flows in TraCI

MohamadReza-Haghani
Hi Giuliana,

Thank you. That was really a great help. I intend to use a random number for
volume in each run. I searched about that if a random number can be
generated in xml and found a command. However, it did not worked and gave
the following error in Python.

"Error: Attribute 'number' in definition of flow 'f1' is not of type int."

Do you know whether a random number can be generated in xml? Please find
attached a screenshot of the route file.

Best,
Reza.

<http://sumo-user-mailing-list.90755.n8.nabble.com/file/t374/Capture.png>



--
Sent from: http://sumo-user-mailing-list.90755.n8.nabble.com/
_______________________________________________
sumo-user mailing list
[hidden email]
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
Reply | Threaded
Open this post in threaded view
|

Re: [sumo-user] Change the volume of traffic flows in TraCI

Harald Schaefer-2
Hi Reza,

i would write a small python script, which modifies your xml file
(search in the internet for 'python insert random number in xml file')

Best  regards,

Harald

Am 31.07.20 um 02:52 schrieb MohamadReza-Haghani:

> Hi Giuliana,
>
> Thank you. That was really a great help. I intend to use a random number for
> volume in each run. I searched about that if a random number can be
> generated in xml and found a command. However, it did not worked and gave
> the following error in Python.
>
> "Error: Attribute 'number' in definition of flow 'f1' is not of type int."
>
> Do you know whether a random number can be generated in xml? Please find
> attached a screenshot of the route file.
>
> Best,
> Reza.
>
> <http://sumo-user-mailing-list.90755.n8.nabble.com/file/t374/Capture.png>
>
>
>
> --
> Sent from: http://sumo-user-mailing-list.90755.n8.nabble.com/
> _______________________________________________
> sumo-user mailing list
> [hidden email]
> To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
[hidden email]
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
Reply | Threaded
Open this post in threaded view
|

Re: [sumo-user] Change the volume of traffic flows in TraCI

Jakob Erdmann
in traci.start you can also pass the "--scale" option to upscale/downscale all traffic.

Am Fr., 31. Juli 2020 um 08:09 Uhr schrieb Harald Schaefer <[hidden email]>:
Hi Reza,

i would write a small python script, which modifies your xml file
(search in the internet for 'python insert random number in xml file')

Best  regards,

Harald

Am 31.07.20 um 02:52 schrieb MohamadReza-Haghani:
> Hi Giuliana,
>
> Thank you. That was really a great help. I intend to use a random number for
> volume in each run. I searched about that if a random number can be
> generated in xml and found a command. However, it did not worked and gave
> the following error in Python.
>
> "Error: Attribute 'number' in definition of flow 'f1' is not of type int."
>
> Do you know whether a random number can be generated in xml? Please find
> attached a screenshot of the route file.
>
> Best,
> Reza.
>
> <http://sumo-user-mailing-list.90755.n8.nabble.com/file/t374/Capture.png>
>
>
>
> --
> Sent from: http://sumo-user-mailing-list.90755.n8.nabble.com/
> _______________________________________________
> sumo-user mailing list
> [hidden email]
> To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
[hidden email]
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user

_______________________________________________
sumo-user mailing list
[hidden email]
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
Reply | Threaded
Open this post in threaded view
|

Re: [sumo-user] Change the volume of traffic flows in TraCI

MohamadReza-Haghani
Thank you very much Herald and Jakob. I really appreciate for your help.



--
Sent from: http://sumo-user-mailing-list.90755.n8.nabble.com/
_______________________________________________
sumo-user mailing list
[hidden email]
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user