|
MATSim API | |||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | |||||||||
See:
Description
| Class Summary | |
|---|---|
| Controler | The Controler is responsible for complete simulation runs, including the initialization of all required data, running the iterations and the replanning, analyses, etc. |
| ControlerIO | |
| ControlerListenerManager | Class encapsulating all behavior concerning the ControlerEvents/Listeners |
| MobsimFactoryRegister | |
| MobsimRegistrar | |
| SnapshotWriterFactoryRegister | |
| SnapshotWriterRegistrar | |
The Controler is responsible for complete simulation runs, including the initialization of all required data, running the iterations and the replanning, analyses, etc.
The Controler has three main parts:
plans, but it could as well be done for facilities, traffic lights, etc.Listener Interfaces and can be registered
with the Controler with addControlerListener().
The Controler sends Controler Events at the corresponding points during the run
to the registered Listeners, at which point the Listeners can execute their own code.
[The iteration loop of the Controler]
+-----------+ +----------------+ +-----------+ +------------+
|Startup (1)|-->(2)--->(3)-->|Execution/MobSim|-->(4)-->|Scoring (5)|-->(6)--+-->|Shutdown (8)|
+-----------+ ^ +----------------+ +-----------+ | +------------+
| v
\ +--------------+ /
---------------<---|Replanning (7)|<----------(2)<---
+--------------+
Controler.run() is called.
When the Startup-Event is issued, the configuration as well as other data (plans, network, ...) are already
loaded and initialized.
import org.matsim.controler.Controler;
import org.matsim.myfunctionality.MyFunctionality;
class MyClass {
public static void main(final String[] args) {
Controler controler = new Controler(args);
controler.addControlerListener(new MyFunctionality());
controler.run();
}
}
Config-Group and load it in the constructor of your ControlerListener.
When the configuration file will be parsed later, your config-group gets loaded with the settings from the file,
and you can later on access the values.
class MyFunctionality implements StartupListener {
final MyConfigGroup settings = new MyConfigGroup();
public MyFunctionality(final Controler controler) {
controler.getConfig().addModule("my_functionality", this.settings);
}
public void notifyStartup(final StartupEvent event) {
int value = this.settings.getMyValue();
}
}
|
MATSim API | |||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | |||||||||