+1 (972) 883-2091
ECSS 4.220, 800 W Campbell Rd, Richardson, TX 75083–0688, US

The “EvacuationSimulation” class

The core of the simulation functionality which orchestrates the workflow of the simulation is fully implemented in DIVAs. The implementation of the “EvacuationSimulation” class creates an “EvacuationEnvironment” and binds it to the “EvacuationSimulation”.

Implementation Steps

  1. Inside the package “edu.utdallas.mavs.evacuation.simulation.sim” create a class named “EvacuationSimulation” that extends the abstract class “Simulation” defined in the package “edu.utdallas.mavs.divas.core.sim”.
  2. The “EvacuationSimulation” provides concrete implementations for the following abstract methods:
    1. “createEnvironment”: This method is responsible for creating the “EvacuationEnvironment” at the simulation initialization and associating it to the “EvacuationSimulation”.
    2. “tick”: This method is responsible for triggering the start of the simulation cycle. The full implementation of the class “EvacuationSimulation” is provided in the following code.
package edu.utdallas.mavs.evacuation.simulation.sim;

import java.io.Serializable;

import edu.utdallas.mavs.divas.core.msg.TickMsg;
import edu.utdallas.mavs.divas.core.sim.Simulation;
import edu.utdallas.mavs.divas.mts.MTSClient;
import edu.utdallas.mavs.evacuation.simulation.sim.env.EvacuationEnvironment;

 * This class describes a simulation for evacuation scenarios.
public class EvacuationSimulation extends Simulation<EvacuationEnvironment> implements Serializable
    private static final long serialVersionUID = 1L;

    /* Remove comments for performance profiling */

    // protected transient Slf4JStopWatch simWatch = new Slf4JStopWatch("Simulation");
    // protected transient Slf4JStopWatch phaseWatch = new Slf4JStopWatch("Phase");

     * Creates a new instance of the simulation for evacuation scenarios.
     * @param client
     *        the MTS client
    public EvacuationSimulation(MTSClient client)

    protected void createEnvironment(MTSClient client)
        environment = new EvacuationEnvironment(client);

    public void tick(TickMsg tick)
        /* Remove comments for performance profiling */

        // String phaseTag = String.format("%s-%s", environment.getStrategy(), tick.getPhase());
        // String simTag = String.format("%s", environment.getStrategy());

        // if(tick.getPhase().equals(Phase.ENVIRONMENT))
        // {
        // simWatch.stop(simTag);
        // simWatch.start(simTag);
        // }

        // phaseWatch.start(phaseTag);
        // phaseWatch.stop(phaseTag);