-
Notifications
You must be signed in to change notification settings - Fork 179
faq 37683202
by allan on 2015-10-26 14:06:57
I am using MATSim 0.5, I need to add electric vehicles as type of modes, I have added this to my config file
<module name="changeLegMode" >
<param name="modes" value="ICV,EV,bike" />
<param name="ignoreCarAvailability" value="false" />
</module>
but still give me an error? can anyone help me with that, as well as all my links will allow electric vehicles and conventional vehicles to pass through.
This is my original code
import org.matsim.api.core.v01.Scenario;
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.controler.Controler;
import org.matsim.core.scenario.ScenarioUtils;
import org.matsim.core.network.algorithms.NetworkCleaner;
public class NetworkClean {
public static void main(String[] args) {
Config config = ConfigUtils.loadConfig("input/config.xml");
Scenario scenario = ScenarioUtils.loadScenario( config ) ;
NetworkCleaner cleaner = new NetworkCleaner() ;
cleaner.run( scenario.getNetwork() ) ;
Controler controler = new Controler( scenario ) ;
controler.run() ;
}
Thanks
by Johan W. Joubert on 2015-10-27 08:35:54
Hi Deema, can I ask that you just edit and clean up the question a bit, please? Not very nice with all the white space. Put the code in a code block and, alternatively, attach the logfile. If you want to add a mode (that is routed in the network, as opposed to teleported mode) I suggest you add it to the config here:
<module name="planscalcroute" >
<!-- All the modes for which the router is supposed to generate network routes (like car) -->
<param name="networkModes" value="car,ride,electric" />
</module>
This has since changed in the newer versions of MATSim, but this may just do the trick for you. Also, you need to tell the mobility simulator, typically 'qsim', what the main modes are... also in the config:
<module name="qsim" >
<!-- Defines which mode should be the qsim `main' (=congested) mode. Technically, this is the mode that the departure handler of the netsimengine handles. Effective cell size, effective lane width, flow capacity factor, and storage capacity factor need to be set with diligence. Needs to be a vehicular mode to make sense. -->
<param name="mainMode" value="car,ride,electric" />
</module>
If I'm wrong, I hope others will pitch in and correct me.
by allan on 2015-10-27 10:11:08
hello, it acually didnt work
I got this error, and it didnt even generate a log file
2015-10-27 14:08:31,053 INFO MatsimConfigReader:101 using config_v1-reader.
2015-10-27 14:08:31,055 INFO MatsimXmlParser:215 Trying to load http://www.matsim.org/files/dtd/config_v1.dtd. In some cases (e.g. network interface up but no connection), this may take a bit.
Exception in thread "main" java.lang.IllegalArgumentException: networkModes
at org.matsim.core.config.groups.PlanCalcScoreConfigGroup.addParam(PlanCalcScoreConfigGroup.java:258)
at org.matsim.core.config.ConfigReaderMatsimV1.startParam(ConfigReaderMatsimV1.java:99)
at org.matsim.core.config.ConfigReaderMatsimV1.startTag(ConfigReaderMatsimV1.java:60)
at org.matsim.core.config.MatsimConfigReader.startTag(MatsimConfigReader.java:62)
at org.matsim.core.utils.io.MatsimXmlParser.startElement(MatsimXmlParser.java:276)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
You are viewing an archive of the previous MATSim Q&A site. The real site is now at https://matsim.org/faq