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

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

Back to the top