Skip to content

faq 159186945

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

Simulating Car, Bus, Bike with mixed traffic

by cui yi on 2018-01-25 08:50:58


Hi,all:

I am trying to simulate a variety of modes including car, walk, bike, bus and ride,in MATSim. I have make the confige file. But in erroe information is still there.

How can I change my work?i Or could you give me some suggestions?

Thank you!

2018-01-25 16:39:04,565 ERROR MatsimRuntimeModifications:54 Getting uncaught Exception in Thread main com.google.inject.ProvisionException: Unable to provision, see the following errors:

  1. Error in custom provider, java.lang.NullPointerException at org.matsim.core.router.TripRouterModule.install(TripRouterModule.java:66) (via modules: com.google.inject.util.Modules$CombinedModule -> com.google.inject.util.Modules$CombinedModule -> org.matsim.core.controler.AbstractModule$4 -> com.google.inject.util.Modules$OverrideModule -> org.matsim.core.controler.Controler$1 -> org.matsim.core.controler.ControlerDefaultsModule -> org.matsim.core.router.TripRouterModule) while locating org.matsim.core.router.RoutingModule annotated with @com.google.inject.name.Named(value=car) while locating org.matsim.core.router.RoutingModule annotated with @com.google.inject.multibindings.Element(setName=,uniqueId=66, type=MAPBINDER, keyType=java.lang.String) at org.matsim.core.router.TripRouter.<init>(TripRouter.java:75) while locating org.matsim.core.router.TripRouter

1 error at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1028) at org.matsim.analysis.ModeStatsControlerListener.notifyStartup(ModeStatsControlerListener.java:113) at org.matsim.core.controler.ControlerListenerManagerImpl.fireControlerStartupEvent(ControlerListenerManagerImpl.java:108) at org.matsim.core.controler.AbstractController$1.run(AbstractController.java:88) at org.matsim.core.controler.MatsimRuntimeModifications.run(MatsimRuntimeModifications.java:48) at org.matsim.core.controler.MatsimRuntimeModifications.run(MatsimRuntimeModifications.java:31) at org.matsim.core.controler.AbstractController.run(AbstractController.java:99) at org.matsim.core.controler.NewControler.run(NewControler.java:79) at org.matsim.core.controler.Controler.run(Controler.java:205) at org.matsim.run.Controler.run(Controler.java:56) at org.matsim.run.Controler.main(Controler.java:60) Caused by: java.lang.NullPointerException at org.matsim.core.router.costcalculators.RandomizingTimeDistanceTravelDisutilityFactory.logWarningsIfNecessary(RandomizingTimeDistanceTravelDisutilityFactory.java:81) at org.matsim.core.router.costcalculators.RandomizingTimeDistanceTravelDisutilityFactory.createTravelDisutility(RandomizingTimeDistanceTravelDisutilityFactory.java:49) at org.matsim.core.router.NetworkRouting.get(NetworkRouting.java:76) at org.matsim.core.router.NetworkRouting.get(NetworkRouting.java:19) at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81) at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:53) at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:61) at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:45) at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:56) at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1019) at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092) at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1015) at com.google.inject.spi.ProviderLookup$1.get(ProviderLookup.java:104) at com.google.inject.multibindings.MapBinder$RealMapBinder$ValueProvider.get(MapBinder.java:821) at org.matsim.core.router.TripRouter.<init>(TripRouter.java:77) at org.matsim.core.router.TripRouter$$FastClassByGuice$$40b051f1.newInstance(<generated>) at com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:89) at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:111) at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:90) at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:268) at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1019) at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1085) at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1015) ... 10 more

I am posting the config below:

<?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE config SYSTEM "http://www.matsim.org/files/dtd/config_v2.dtd">
 <!-- Fairly minimalistic config file.  See config dump in console or in log file for more options, and some explanations. -->
 <config>
     <module name="global">
 		 <param name="randomSeed" value="3467"/>
          <param name="coordinateSystem" value="EPSG:32649"/>
 		 <param name="numberOfThreads" value= "4"/>
     </module>
 <!-- ====================================================================== -->
 	<module name="network">
 		<param name="inputNetworkFile" value="E:/nanning4/network4.xml"/>
 	</module>
 <!-- ====================================================================== -->
 	<module name="plans">
 		<param name="inputPersonAttributesFile" value="null"/>
 		<param name="inputPlansFile" value="E:/nanning4/population00.xml"/>
 	</module>
 <!-- ====================================================================== -->
 	<module name="plansCalcRoute">
 			<param name="networkModes" value="car,bus,bike,pedestrian,ride"/>
 	</module>
 <!-- ====================================================================== -->
 	<module name="controler">
 		<param name="outputDirectory" value="./output"/>
 		<param name="firstIteration" value="0"/>
 		<param name="lastIteration" value="10"/>
 		<param name="mobsim" value="qsim"/>
 		<param name="eventsFileFormat" value="xml"/>
 		<param name="snapshotFormat" value=""/>
 		<param name="writeSnapshotsInterval" value="10"/>
 	</module>
 <!-- ====================================================================== -->
 	<module name="qsim">
 		<param name="vehiclesSource" value="modeVehicleTypesFromVehiclesData"/>
 		<param name="mainMode" value="car,bus,bike,pedestrian,ride"/>
 		<param name="flowCapacityFactor" value="0.10"/>
 		<param name="storageCapacityFactor" value="0.09"/>
 		<param name="linkDynamics" value="PassingQ"/>
 		<param name="trafficDynamics" value="queue"/>
 		<param name="startTime" value="00:00:00"/>
 		<param name="endTime" value="23:59:59"/>
 		<param name="snapshotperiod"	value = "00:01:00"/>
 	</module>
 <!-- ====================================================================== -->
 	<module name="vehicles" >
 		<param name="vehiclesFile" value="E:/nanning4/vehicles.xml"/> 
 	</module>
 <!-- ====================================================================== -->
 	<module name="planCalcScore" >
 		<param name="learningRate" value="1.0"/>
 		<param name="BrainExpBeta" value="2.0"/>
 	    <param name="traveling" value="-6"/>
 	  <parameterset type="scoringParameters" >
           <param name="marginalUtilityOfMoney" value="1.0"/>
           <param name="utilityOfLineSwitch" value="-1.0"/>
 		  <param name="lateArrival" value="-18"/>
 		  <param name="performing" value="+6"/>
 		  <param name="waiting" value="-0"/>
           <param name="earlyDeparture" value="-0.0"/>
 		  <param name="waitingPt" value= "-0.0002"/>
 		 <parameterset type="modeParams">
              <param name="mode" value="car"/>
              <param name="constant" value= "0.0"/>
              <param name="marginalUtilityOfDistance_util_m" value= "0.0"/>
              <param name="marginalUtilityOfTraveling_util_hr" value= "-6.0"/>
              <param name="monetaryDistanceRate" value= "-0.0002"/>
              <param name="mode" value="bus"/>
              <param name="constant" value= "0.0"/>
              <param name="marginalUtilityOfDistance_util_m" value= "0.0"/>
              <param name="marginalUtilityOfTraveling_util_hr" value= "-6.0"/>
              <param name="monetaryDistanceRate" value= "-0.0002"/>
              <param name="mode" value="bike"/>
              <param name="constant" value= "0.0"/>
              <param name="marginalUtilityOfDistance_util_m" value= "0.0"/>
              <param name="marginalUtilityOfTraveling_util_hr" value= "-6.0"/>
              <param name="monetaryDistanceRate" value= "-0.0002"/>
 			 <param name="mode" value="pedestrian"/>
              <param name="constant" value= "0.0"/>
              <param name="marginalUtilityOfDistance_util_m" value= "0.0"/>
              <param name="marginalUtilityOfTraveling_util_hr" value= "-6.0"/>
              <param name="monetaryDistanceRate" value= "-0.0002"/>
 			 <param name="mode" value="ride"/>
              <param name="constant" value= "0.0"/>
              <param name="marginalUtilityOfDistance_util_m" value= "0.0"/>
              <param name="marginalUtilityOfTraveling_util_hr" value= "-6.0"/>
              <param name="monetaryDistanceRate" value= "-0.0002"/>
          </parameterset>
         <parameterset type="activityParams">
 		     <param name="activityType"    value="h"/> <!-- home -->
 		     <param name="priority"        value="1"/>
 		     <param name="typicalDuration" value="8:00:00"/>
 		     <param name="minimalDuration" value="undefined"/>
 			 <param name="openingTime"     value=""/>
 		     <param name="latestStartTime" value=""/>
 		     <param name="closingTime"     value=""/>
 			 <param name="earliestEndTime" value=""/>
 		     <param name="scoringThisActivityAtAll"     value=""/>
			
 		     <param name="activityType"    value="w"/> <!-- work -->
 		     <param name="priority"        value="1"/>
 		     <param name="typicalDuration" value="8:00:00"/>
 		     <param name="minimalDuration" value="undefined"/>
 			 <param name="openingTime"     value="07:00:00"/>
 		     <param name="latestStartTime" value="09:00:00"/>
 		     <param name="closingTime"     value="18:00:00"/>
 			 <param name="earliestEndTime" value=""/>
 		     <param name="scoringThisActivityAtAll"     value=""/>
	
 		     <param name="activityType"    value="school"/> <!-- school -->
 		     <param name="priority"        value="1"/>
 		     <param name="typicalDuration" value="6:00:00"/>
 		     <param name="minimalDuration" value="4:00:00"/>
 			 <param name="openingTime"     value="08:00:00"/>
 		     <param name="latestStartTime" value="08:30:00"/>
 		     <param name="closingTime"     value="16:30:00"/>
 			 <param name="earliestEndTime" value="16:00:00"/>
 		     <param name="scoringThisActivityAtAll"     value=""/>

 		     <param name="activityType"    value="hospital"/> <!-- hospital -->
 		     <param name="priority"        value="1"/>
 		     <param name="typicalDuration" value=""/>
 		     <param name="minimalDuration" value=""/>
 			 <param name="openingTime"     value=""/>
 		     <param name="latestStartTime" value=""/>
 		     <param name="closingTime"     value=""/>
 			 <param name="earliestEndTime" value=""/>
 		     <param name="scoringThisActivityAtAll"     value=""/>

 		     <param name="activityType"    value="escort"/> <!-- escort -->
 		     <param name="priority"        value="1"/>
 		     <param name="typicalDuration" value=""/>
 		     <param name="minimalDuration" value="undefined"/>
 			 <param name="openingTime"     value=""/>
 		     <param name="latestStartTime" value=""/>
 		     <param name="closingTime"     value=""/>
 			 <param name="earliestEndTime" value=""/>
 		     <param name="scoringThisActivityAtAll"     value=""/>

 		     <param name="activityType"    value="leisure"/> <!-- leisure -->
 		     <param name="priority"        value="1"/>
 		     <param name="typicalDuration" value=""/>
 		     <param name="minimalDuration" value="undefined"/>
 			 <param name="openingTime"     value=""/>
 		     <param name="latestStartTime" value=""/>
 		     <param name="closingTime"     value=""/>
 			 <param name="earliestEndTime" value=""/>
 		     <param name="scoringThisActivityAtAll"     value=""/>

 		     <param name="activityType"    value="visit"/> <!-- visit -->
 		     <param name="priority"        value="1"/>
 		     <param name="typicalDuration" value=""/>
 		     <param name="minimalDuration" value="undefined"/>
 			 <param name="openingTime"     value=""/>
 		     <param name="latestStartTime" value=""/>
 		     <param name="closingTime"     value=""/>
 			 <param name="earliestEndTime" value=""/>
 		     <param name="scoringThisActivityAtAll"     value=""/>

 		     <param name="activityType"    value="shopping"/> <!-- shopping -->
 		     <param name="priority"        value="1"/>
 		     <param name="typicalDuration" value="1:00:00"/>
 		     <param name="minimalDuration" value="00:30:00"/>
 			 <param name="openingTime"     value=""/>
 		     <param name="latestStartTime" value=""/>
 		     <param name="closingTime"     value=""/>
 			 <param name="earliestEndTime" value=""/>
 		     <param name="scoringThisActivityAtAll"     value=""/>

 		     <param name="activityType"    value="farming"/> <!-- farming -->
 		     <param name="priority"        value="1"/>
 		     <param name="typicalDuration" value=""/>
 		     <param name="minimalDuration" value="undefined"/>
 			 <param name="openingTime"     value=""/>
 		     <param name="latestStartTime" value=""/>
 		     <param name="closingTime"     value=""/>
 			 <param name="earliestEndTime" value=""/>
 		     <param name="scoringThisActivityAtAll"     value=""/>

 		     <param name="activityType"    value="business"/> <!-- business -->
 		     <param name="priority"        value="1"/>
 		     <param name="typicalDuration" value=""/>
 		     <param name="minimalDuration" value="00:30:00"/>
 			 <param name="openingTime"     value="8:00:00"/>
 		     <param name="latestStartTime" value=""/>
 		     <param name="closingTime"     value="18:00:00"/>
 			 <param name="earliestEndTime" value=""/>
 		     <param name="scoringThisActivityAtAll"     value=""/>

 		     <param name="activityType"    value="other"/> <!-- other -->
 		     <param name="priority"        value="1"/>
 		     <param name="typicalDuration" value=""/>
 		     <param name="minimalDuration" value="undefined"/>
 			 <param name="openingTime"     value=""/>
 		     <param name="latestStartTime" value=""/>
 		     <param name="closingTime"     value=""/>
 			 <param name="earliestEndTime" value=""/>
 		     <param name="scoringThisActivityAtAll"     value=""/>
 	    </parameterset>
	
 	  </parameterset>
 	</module>
 <!-- ====================================================================== -->
 	<module name="strategy">
 		<param name="maxAgentPlanMemorySize" value="5"/> <!-- 0 means unlimited -->
 		<param name="ModuleProbability_1" value="0.8"/>
 		<param name="Module_1" value="BestScore"/>
 		<param name="ModuleProbability_2" value="0.1"/>
 		<param name="Module_2" value="ReRoute"/>
 		<param name="ModuleProbability_3" value="0.1"/>
 		<param name="Module_3" value="TimeAllocationMutator"/>
 	</module>
 <!-- ====================================================================== -->
    <module name="travelTimeCalculator" >
      <param name="analyzedModes" value="car,bus,bike,pedestrian,ride"/>
      <param name="separateModes" value="true"/>
    </module>
 <!-- ====================================================================== -->
 	<module name="changeMode">
 		<param name="modes" value="car,bus,bike,pedestrian,ride"/>
 	</module>
 <!-- ====================================================================== -->
 	<module name="TimeAllocationMutator">
 		<param name="mutationRange" value="900.0"/>
 	</module>
 <!-- ====================================================================== -->
 	<module name="subtourModeChoice" >

 		<!-- Defines the chain-based modes, seperated by commas -->
 		<param name="chainBasedModes" value="car"/>

 		<!-- Defines whether car availability must be considered or not. A agent has no car only if it has no license, or never access to a car -->
 		<param name="considerCarAvailability" value="true"/>

 		<!-- Defines all the modes available, including chain-based modes, seperated by commas -->
 		<param name="modes" value="car,bus,bike,pedestrian,ride"/>
 	</module>
   
 </config>

Comments: 1


Re: Simulating Car, Bus, Bike with mixed traffic

by Amit Agarwal on 2018-01-25 09:48:14

Dear Cui Yi,

Could you please try to look on https://matsim.atlassian.net/wiki/spaces/MATPUB/pages/84246576/Mixed+traffic ? It provides detailed steps to simulated different vehicle types.

Best regards,

Amit

Clone this wiki locally