faq 82346008 - matsim-org/matsim-code-examples GitHub Wiki
by GregoryM on 2016-09-03 13:34:23
I am trying to implement tolls on some links in my network. I have pointed maven to the `roadpricing` plugin, and have successfully built my package; I know that I have the dependency because another Java program that depends on `roadpricing` works.
I have added the tolls to my config as recommended in the MATSim book,
```xml
<module name="roadpricing" >
<param name="tollLinksFile" value="matsim/link_tolls.xml.gz" />
</module>
```
But when I run the scenario, it crashes with the following error:
```sh
2016-09-03 09:24:27,727 ERROR MatsimRuntimeModifications:54 Getting uncaught Exception in Thread main
java.lang.RuntimeException: Unmaterialized config group: roadpricing
at org.matsim.core.config.consistency.UnmaterializedConfigGroupChecker.checkConsistency(UnmaterializedConfigGroupChecker.java:11)
at org.matsim.core.config.Config.checkConsistency(Config.java:195)
at org.matsim.core.controler.ControlerUtils.checkConfigConsistencyAndWriteToLog(ControlerUtils.java:64)
at org.matsim.core.controler.AbstractController$1.run(AbstractController.java:93)
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:103)
at org.matsim.core.controler.NewControler.run(NewControler.java:79)
at org.matsim.core.controler.Controler.run(Controler.java:190)
at tfjava.RunScenario.main(RunScenario.java:37)
```
The `tfjava.RunScenario` class is just a bare call to a `controler`. I see that `roadpricing` is currently unmaintained; is there something else I need to add?
by Kai Nagel on 2016-09-03 18:03:40
Dear Greg,
Depends a bit how you are calling this. The class RunRoadPricingExample
has an example. (You should be able to see this even if you have only a dependency via pom.xml; otherwise matsim.org/javadoc → roadpricing) There are several ways to do this; the way it is done in the example is
Config config = ConfigUtils.loadConfig( filename, new RoadPricingConfigGroup() ) ;
Scenario scenario = ScenarioUtils.loadScenario( config ) ;
Controler controler = new Controler( scenario ) ;
The important line obviously is the first, which forces the config loader to materialize the config group.
Does this work?
Best wishes
Kai