matsim-libs
matsim-libs copied to clipboard
Meaningless `motorizedInteraction`s in bicycle contrib
Hello, I'm attempting to run simulations using the bicycle contrib and trying to understand the motorizedInteraction
events. So far I have only managed to see them appear when using the RunBicycleExample and changing considerMotorizedInteraction to true
. The resulting events seem meaningless, they appear every 3 seconds and don't carry any data:
<event time="32403.0" type="motorizedInteraction" />
Reading the code for MotorizedInteractionEngine explains the 3 seconds frequency, though I would still expect the events to look in the following way:
<event time="32403.0" type="motorizedInteraction" link="6" vehId="evilCar" />
The events of type motorizedInteraction
are used later in link scoring, so there must be a way to have them appear in a meaningful way, and I have a feeling it may have something to do with my not being able to switch them on with my own controller. I noted the comment in MotorizedInteractionEngine, in particular:
can only be used through injection
In my own controller I only rely on the config setting
<param name="motorizedInteraction" value="true"/>
which I think is equivalent to what I see in the example bicycle controller (running my controller in debug mode, I can see the same StringSetter
method setMotorizedInteraction
being used).
So there are a couple of things I'm confused about:
- I cannot see any injections in the example bicycle controller to do with
motorizedInteraction
, but the events appear. - hardcoding the link and vehicle IDs and when the events are fired in
MotorizedInteractionEngine
- do I need to set something up myself?
I would appreciate any pointers you can give me to be able to set up meaningful motorizedInteraction
s. Thanks in advance!
my setup notes
matsim and bicycle contrib version 14.0
my controller:
package com.arup.cm.activemodes.run;
import ch.sbb.matsim.mobsim.qsim.SBBTransitModule;
import ch.sbb.matsim.mobsim.qsim.pt.SBBTransitEngineQSimModule;
import ch.sbb.matsim.routing.pt.raptor.SwissRailRaptorModule;
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.contrib.bicycle.BicycleConfigGroup;
import org.matsim.contrib.bicycle.Bicycles;
public class RunBicycleMatsim {
public static void main(String[] args) {
//load config
Config config = ConfigUtils.loadConfig(args[0], new BicycleConfigGroup());
//load config into scenario
final Scenario scenario = ScenarioUtils.loadScenario(config);
Controler controler = new Controler(scenario);
// To use the fast pt router (Part 1 of 1)
controler.addOverridingModule(new SwissRailRaptorModule());
// To use the deterministic pt simulation (Part 1 of 2):
controler.addOverridingModule(new SBBTransitModule());
// To use the deterministic pt simulation (Part 2 of 2):
controler.configureQSimComponents(components -> {
new SBBTransitEngineQSimModule().configure(components);
});
Bicycles.addAsOverridingModule(controler);
controler.run();
}
}
bicycle module config
<module name="bicycle">
<param name="bicycleMode" value="bike"/>
<!-- marginalUtilityOfSurfacetype -->
<param name="marginalUtilityOfComfort_m" value="-2.0E-4"/>
<!-- marginalUtilityOfGradient -->
<param name="marginalUtilityOfGradient_m_100m" value="-0.02"/>
<!-- marginalUtilityOfStreettype -->
<param name="marginalUtilityOfInfrastructure_m" value="-2.0E-4"/>
<!-- maxBicycleSpeed -->
<param name="maxBicycleSpeedForRouting" value="4.16666666"/>
<param name="motorizedInteraction" value="true"/>
</module>
Mobsim: Hermes
I have never tested the Motorized interaction. Looking at the code now, it looks more like a test set up than anything which is usable already. I will reach out to @dziemke about the state of this feature.
I would still expect the events to look in the following way:
This is indeed expectable. The MotorizedInteractionEvent
doesn't provide a getAttributes()
method though, which is used by the base Event
class to fetch other properties than time
and type
from its subclasses.
Like @Janekdererste assumes the MotorizedInteractionEngine
was rather for testing/development purposes. It just generates the type of events needed for scoring the effect of an encounter between bicylces and cars every 3s. Taking this into account in scoring was the focus of the research from which this functionality comes from.
The next step of making this more fully applicable would be to throw the interaction events based on vehicle passings or similar instead of just creating them by the MotorizedInteractionEngine
. Let me know if you would like to work on that :)
Thanks @Janekdererste and @dziemke for the insight. It would be good to signpost/warn the potential user about this somewhere, I spent a non trivial amount of time convinced that if all of this stuff around motorizedInteraction
s exists then it has to be there and I'm just being a matsim noob. I might attempt to have a go at this in the future @dziemke, depending on how critical it will be for the project(s) we're working on, will let you know :)