Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Issues with Traci Python Script

The changes in passenger counts can also be obtained from stop-output. See https://sumo.dlr.de/docs/Tools/Output.html#computepassengercountspy
(requires the latest development version)


Am Sa., 9. Okt. 2021 um 15:11 Uhr schrieb Ifezue Obiako <vincentobiako@xxxxxxxxx>:
Harald

The data output in the image is based on the FCD output from SUMO correct? Was this FCD output generated from the python snippet that you showed me from yesterday? Would it be too much trouble if you could share that code with me or is the code considered sensitive information? It seems like you utilized Matplotlib in order to plot that data.

On Fri, Oct 8, 2021 at 4:31 PM Harald Schaefer <fechsaer@xxxxxxxxx> wrote:

Hi,

for my simulation I have written a small script, which plots the number of passenges per car over the time base on the fcd data supplied by SUMO.

Attached is a sample output

Greatings, Harald

Am 08.10.21 um 18:51 schrieb vincentobiako:

@ Harald: Thanks for providing this information. I will try to implement this within my code.

 

@ Jakob: I tried out what you suggested, but this output gives me a lump sum. This is informative, but I was trying to see if I could get output from SUMO that contains the number of persons riding a bus over a continuous time period, similar to what you see in a time series plot where you can see the number of passengers relative to a timescale (e.g. second, minute, or hour).

 

Sent from Mail for Windows

 

From: Jakob Erdmann
Sent: Friday, October 8, 2021 1:47 AM
To: Sumo project User discussions
Subject: Re: [sumo-user] Issues with Traci Python Script

 

The statistical summary from the command line output can also be obtained in xml with option --statistic-output.

xml can either be loaded directly in Excel or convertd with sumo/tools/xml/xml2csv.py

 

 

Am Fr., 8. Okt. 2021 um 08:23 Uhr schrieb Harald Schaefer <fechsaer@xxxxxxxxx>:

Hi Ifezue,

this is more a python than a SUMO question, you can use in python3 something like

f = open('test.csv,'w')
...
print('%d,%d' % (step, count), file=f)
...
f.close()

Regards, Harald

 

Am 08.10.21 um 01:58 schrieb Ifezue Obiako:

Also, how exactly can you get the data printed on the command line into a csv file or a format that can allow for data analysis to be performed?

 

On Thu, Oct 7, 2021 at 4:19 PM Ifezue Obiako <vincentobiako@xxxxxxxxx> wrote:

Thank you Harald. That seemed to have fixed the problem. 

 

I did have another question. Is it possible to print the traci.vehicle.getPersonNumber() output into a plot through the matplotlib module in Python?

 

On Thu, Oct 7, 2021 at 3:57 PM Harald Schaefer <fechsaer@xxxxxxxxx> wrote:

Hi Vincent,

thanks for providing the test data.

Your simulation does as told by the python script.

You should start the second loop with

  while step >= 3600

(instead of while step > 3600)

At the end of the first loop step has exactly the value 3600.

In your testdata are two errors:

1) the additional files osm.poly.xml  and osm.view.xml are missing

2) when I omit these files from test.sumocfg, the command "sumo -c test.sumocfg"

gives these errors at the end

Error: The lane -gneE253.50_1 to use within the busStop 'O5' is not known.
Error: Could not end a stopping place that is not opened.
Quitting (on error).

and about 20 warnings

Greetings, Harald

Am 07.10.21 um 21:51 schrieb vincentobiako:

Hello Everyone

 

I just started using Traci so the nuances of using it are new and a little weird to me. Right know I am trying to have python run my simulation and also collect or print information out about the number persons that use a bus vehicle within my simulation. However, for some reason when I run my Python code, the simulation runs but closes at a certain specified time which is what I don’t want Traci to do.

 

For example right now, I have my Python code setup so that it from simulation step of 0 to 3600 it is allowed to advance the simulation step as normal, but after 3600, I want the simulation to begin collecting person ids or number of persons on buses within my simulation. It is after the 3600 simulation step that the simulation decides to quit rather than just continuing on and counting the number of persons entering the buses.

 

For reference, I have attached all pertinent file information to this email provide some insight into what I am referring to.

 

Thank you in advance

Ifezue

 

Sent from Mail for Windows

 

 

_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user

_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user

 

_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user

_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user

 


_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user

Back to the top