The "mobility simulation", or short "mobsim", is what executes all selected plans, and writes events.
You can do
Controler controler = new Controler() ; controler.setMobsimFactory( new MyMobsimFactory() ) ;
plus
public class MyMobsimFactory implements MobsimFactory {
public Simulation createMobsim( Scenario sc, EventsManager ev ) {
return new MyMobsim( sc, ev ) ;
}
}
plus
class MyMobsim extends Simulation {
Scenario sc ; EventsManager ev ;
MyMobsim( Scenario sc , EventsManger ev ) {
this.sc = sc ; this.ev = ev ;
}
public void run() {
Network net = sc.getNetwork() ;
Population pop = sc.getPopulation() ;
...
EventsFactory ef = ev.getFactory() ;
ev.processEvent( ef.createXXXEvent( ... ) ) ;
...
}
}
This is fully api-based (except that some material is still under core.api.experimental) .
You then need to make sure that
If you do this, your mobsim should work inside the MATSim iterative framework.