Class DessSimulator<T extends Number & Comparable<T>>

Type Parameters:
T - the time type
All Implemented Interfaces:
Serializable, Runnable, Remote, DessSimulatorInterface<T>, SimulatorInterface<T>, EventProducer

public class DessSimulator<T extends Number & Comparable<T>> extends Simulator<T> implements DessSimulatorInterface<T>
The DESS defines the interface of the DESS simulator. DESS stands for the Differential Equation System Specification. More information on Modeling and Simulation can be found in "Theory of Modeling and Simulation" by Bernard Zeigler et.al.

Copyright (c) 2002-2024 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://simulation.tudelft.nl. The DSOL project is distributed under a three-clause BSD-style license, which can be found at https://https://simulation.tudelft.nl/dsol/docs/latest/license.html.

Author:
Peter Jacobs , Alexander Verbraeck
See Also:
  • Field Details

    • timeStep

      protected T extends Number & Comparable<T> timeStep
      timeStep represents the timestep of the DESS simulator.
  • Constructor Details

    • DessSimulator

      public DessSimulator(Serializable id, T initialTimeStep) throws SimRuntimeException
      Construct a DessSimulator with an initial time step for the integration process.
      Parameters:
      initialTimeStep - T; the initial time step to use in the integration.
      id - the id of the simulator, used in logging and firing of events.
      Throws:
      SimRuntimeException - when initialTimeStep <=0, NaN, or Infinity
  • Method Details

    • getTimeStep

      public T getTimeStep()
      returns the time step of the DESS simulator.
      Specified by:
      getTimeStep in interface DessSimulatorInterface<T extends Number & Comparable<T>>
      Returns:
      the timeStep
    • setTimeStep

      public void setTimeStep(T timeStep) throws SimRuntimeException
      Method setTimeStep sets the time step of the simulator.
      Specified by:
      setTimeStep in interface DessSimulatorInterface<T extends Number & Comparable<T>>
      Parameters:
      timeStep - T; the new timeStep. Its value should be > 0.0
      Throws:
      SimRuntimeException - when timestep <= 0, NaN, or Infinity
    • stepImpl

      protected void stepImpl()
      The implementation body of the step() method. The stepImpl() method should fire the TIME_CHANGED_EVENT before the execution of the simulation event, or before executing the integration of the differential equation for the next timestep. So the time is changed first to match the logic carried out for that time, and then the action for that time is carried out. This is INDEPENDENT of the fact whether the time changes or not. The TIME_CHANGED_EVENT is always fired.
      Specified by:
      stepImpl in class Simulator<T extends Number & Comparable<T>>
    • run

      public void run()
      The run method defines the actual time step mechanism of the simulator. The implementation of this method depends on the formalism. Where discrete event formalisms loop over an event list, continuous simulators take predefined time steps. Make sure that:
      - SimulatorInterface.TIME_CHANGED_EVENT is fired when the time of the simulator changes
      - the warmup() method is called when the warmup period has expired (through an event or based on simulation time)
      - the endReplication() method is called when the replication has ended
      - the simulator runs until the runUntil time, which is also set by the start() method.
      Specified by:
      run in interface Runnable
      Specified by:
      run in class Simulator<T extends Number & Comparable<T>>