Skip to content

faq 70123545

Billy Charlton edited this page Sep 5, 2018 · 2 revisions

new vehicle type as main mode MATSim 0.7.0

by Amit Agarwal on 2016-06-27 18:15:21


Hello all,

I am trying to register a new vehicle type similar to the car type with different passenger count and different speeds etc. It is not a pt type.
I am trying to find the right method to do this in MATSIM. I am using MATSIM 0.7.0 stable.
I try the following.
In config.xml, I have set mobsim to use data from vehicle data file.
I have added the location of the vehicles file in the "vehicles" module
I have also created a vehicles.xml file using the DTD from the website.
I have checked the network.xml and created a simple demand with 1 person who uses the new mode.
I get an exception in the TripRouter:


2016-06-27 16:48:42,353 ERROR ParallelPersonAlgorithmRunner$ExceptionHandler:163 Thread PersonPrepareForSim.0 died with exception while handling events.
 org.matsim.core.router.TripRouter$UnknownModeException: unregistered main mode mtw: does not pertain to [pt, car, ride, walk, bike, undefined]
  at org.matsim.core.router.TripRouter.calcRoute(TripRouter.java:161)
  at org.matsim.core.router.PlanRouter.run(PlanRouter.java:84)
  at org.matsim.population.algorithms.PersonPrepareForSim.run(PersonPrepareForSim.java:114)
  at org.matsim.population.algorithms.ParallelPersonAlgorithmRunner$PersonAlgoThread.run(ParallelPersonAlgorithmRunner.java:144)
  at java.lang.Thread.run(Thread.java:745)


I am guessing I need a way to register it with the router but I am unable to find where.
I even tried to create a new VehicleFactory but did not know how to invoke it from the controller.
Any help would be appreciated.

Thank you,

Regards,

Harsha K
Researcher
Fields of View

Comments: 2


Re: new vehicle type as main mode MATSim 0.7.0

by Amit Agarwal on 2016-06-27 18:27:33

Dear Harsha K,

 

Your steps looks fine, however, see the additional steps. 

 

  • Qsim and router both need to be informed about the multiple modes.

config.qsim().setMainModes(Arrays.asList("car","bike"));
 config.plansCalcRoute().setNetworkModes(Arrays.asList("car","bike"));
  • By default, car is congested (main) mode and pt, bike, walk, others are teleported. Thus, as long as these settings are not overridden, following error may show up. 

Error in custom provider, java.lang.RuntimeException: there was already a module set when trying to set network routing module for mode bike: [LegRouterWrapper: mode=bike; delegate=org.matsim.core.router.old.TeleportationLegRouter@2e6a8155]

   while locating org.matsim.core.router.TripRouterModule$RealTripRouterProvider

   while locating org.matsim.core.router.TripRouter

       To avoid it, just set any teleportation parameter as follows.

config.plansCalcRoute().setTeleportedModeSpeed("pt", 20);

 

Hopefully, this will fix your problems. 


Re: new vehicle type as main mode MATSim 0.7.0

by Harsha on 2016-06-28 15:22:16

Hi Amit,

 

Thank you very much! This had definitely solved the problem.

 

Just to clarify, I am also guessing that I can use only one mode at a time in the Network by default and will have to use the "multimode" module in contrib if I am to use multiple modes for my simulation on the same network, i.e. car, bike, pt, customCar, etc.

Clone this wiki locally