Dear Sumo-developers,


Hello.
I'm one of students who is trying to use SUMO in my research, and got a
trouble.

I wanted to generate another type of the vehicle, according to the number
of generated vehicles.
For example, if the number of generated vehicle is under 5, I send a
command to make the vehicle with bus type, and if it is over 5, make a
vehicle with car type.

So the code is following, (I used Traas simulation example xml files.)




SumoTraciConnection conn = new SumoTraciConnection(sumo_bin, config);
conn.addOption("step-length", "1");
conn.runServer();

int numOfGenedCar=0;
for (int i=0; i<3600; i++){

int simtime;
numOfGenedCar = numOfGenedCar +
(int)conn.do_job_get(Simulation.getDepartedNumber());
System.out.println((i)+" sec(dep): "+ numOfGenedCar);
System.out.println((i)+" sec(now): "+(int)
conn.do_job_get(Vehicle.getIDCount())); /
simtime = (int) conn.do_job_get(Simulation.getCurrentTime());

if (numOfGenedCar > 5)
conn.do_job_set(Vehicle.add("car"+i, "car", "s1", simtime, 0, 13.8, (byte)
1));
else if (numOfGenedCar < 5 && numOfGenedCar >= 0)
conn.do_job_set(Vehicle.add("bus"+i, "bus", "s2", simtime, 0, 13.8, (byte)
1));

conn.do_timestep();

}
conn.close();





(I'm very sorry to show you in poor view, but have no idea how to show my
code.)




The problem is that 'car' type is not generated although the number of the
generated vehicle is over 5.

It goes to be made after generating 13 'buses'.

and worse, if I change the code to 'conn.addOption("step-length", *"0.1"*)',
'car' type is never generated during the simulation.

I think it is a kind of bug... I could not find anything wrong in this
simple code.

Thank you.


Best regards,
Yun
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
_______________________________________________
sumo-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sumo-user

Reply via email to