Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Edge.setEffort() Returning Error

Hi Jonathan,

you've found a bug in the traas code. The method setEffort is incompatible with the arguments of the traci server.
In the source file Edge.java you can add the following snippet:

public static SumoCommand setEffort(String edgeID, double effort, int begin, int end){
        Object[] array = new Object[]{begin, end, effort};
return new SumoCommand(Constants.CMD_SET_EDGE_VARIABLE, Constants.VAR_EDGE_EFFORT, edgeID, array);
 }

It has also been fixed in the latest GIT version of traas (https://github.com/DLR-TS/sumo/blob/master/tools/contributed/traas/src/de/tudresden/sumo/cmd/Edge.java).

Best regards,
Mario

Am 21.03.2018 um 20:23 schrieb Jonathan Harper via sumo-user:
Hello Jakob,

Below is a reproducible example using TraaS.

     public static void main(String[] args) {
         SumoTraciConnection conn = new SumoTraciConnection(sumo-gui, config_file);
         conn.addOption("step-length", "0.1"); //timestep 100 ms

         try{
             conn.runServer();
             conn.do_timestep();

             conn.do_job_set(Vehicle.add("vehicle", "vehicleType", "route", 0, 1, 1, (byte) 0));
	conn.do_job_set(Vehicle.changeTarget("vehicle", "edgeToTarget"));

	//This is where the error occurs
             conn.do_job_set(Edge.setEffort("edgeToSetEffort", 1));

             for(int counter=0; counter<5000; counter++){
                 conn.do_timestep();
             }

             conn.close();

         } catch(Exception exception){
             exception.printStackTrace();}
     }

The simulation runs fine without ‘conn.do_job_set(Edge.setEffort("edgeToSetEffort", 1));’

Also, ‘conn.do_job_set(Vehicle.setEffort("vehicle", 0, 5000, "edge", 1))’ works fine, however, I’d like to set the effort for the edges globally.

Thanks,
Jonathan

From: Jakob Erdmann
Sent: 21 March 2018 18:51
To: Jonathan Harper
Cc: sumo-user@xxxxxxxxxxxxxxxxxxxxx; sumo-user@xxxxxxxxxxx
Subject: Re: [sumo-user] Edge.setEffort() Returning Error

Hello
1) this is quite strange. The last time i saw something like this it came from multiple traci threads that were trying to talk to sumo at the same time. Can you reproduce this with a single traci thread? If so, please send me a minimal scenario.
2) yes.
regards,
Jakob

2018-03-20 22:03 GMT+01:00 Jonathan Harper via sumo-user <sumo-user@xxxxxxxxxxxxxxxxxxxxx>:
Hello,

I’m currently using TraaS to interface with SUMO. I am attempting to reroute a vehicle and hope to make it change path by setting an effort to an edge (I believe this is the equivalent of setting a ‘weight’ to that edge), this effort is calculated from the congestion + other metrics.

1. When setting an edge using  ‘conn.do_job_set(Edge.setEffort("edge1", 1.5))’ I receive the errors “Unexpected command and status IDs match: expected 202, got 196” given by Traci (TraaS), and “Error: Answered with error to command 0xc4: Setting effort requires a compound object.” given by the SUMO client.

Is there anything more to this? Is the syntax wrong?

2. When setting an effort for a vehicle Vehicle.setEffort(), is this simply an effort given to an edge for a period of time exclusive to this vehicle?

Many thanks,
Jonathan


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
------------------------------------------------------------------------------
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-user@xxxxxxxxxxxxxxxxxxxxx
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-user@xxxxxxxxxxxxxxxxxxxxx
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-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/sumo-user

Back to the top