Skip to content

Launching a Simulation

Samy Sadi edited this page Apr 7, 2018 · 1 revision

Home > Core layer > Launching a Simulation

Once the simulator object is created, it can be accessed through the static method Simulator.getSimulator()). You can create one simulator object per execution thread. Thus, to launch the simulation, you need to use the following code after creating the simulator object:

Simulator.getSimulator().start();

You can also specify a maximum simulation time after which the simulation stops:

// Start the simulation and let it run for at most 10 simulation hours
Simulator.getSimulator().start(10 * Simulator.HOUR);

Do not confuse simulation time with the execution time (i.e. the time that you actually wait for when the simulation runs). If you wish to stop the simulation manually, you can use the following code:

// Start the simulation and let it run for at most 10 simulation hours
Simulator.getSimulator().start(10 * Simulator.HOUR);
Clone this wiki locally