Class AbstractDsolModel<T extends Number & Comparable<T>,S extends SimulatorInterface<T>>

java.lang.Object
org.djutils.event.LocalEventProducer
nl.tudelft.simulation.dsol.model.AbstractDsolModel<T,S>
Type Parameters:
T - the time type
S - the simulator type to use
All Implemented Interfaces:
Serializable, Remote, DsolModel<T,S>, EventProducer

public abstract class AbstractDsolModel<T extends Number & Comparable<T>,S extends SimulatorInterface<T>> extends LocalEventProducer implements DsolModel<T,S>
AbstractDsolModel, an abstract helper class to easily construct a DsolModel. The model automatically acts as an EventProducer, so events can be sent to statistics gathering classes.

Copyright (c) 2003-2024 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information www.simulation.tudelft.nl. The source code and binary code of this software is proprietary information of Delft University of Technology.
Author:
Alexander Verbraeck
See Also:
  • Field Details

  • Constructor Details

    • AbstractDsolModel

      public AbstractDsolModel(S simulator)
      Construct a DSOL model and set the simulator.
      Parameters:
      simulator - S; the simulator to use for this model
      Throws:
      NullPointerException - when simulator is null
    • AbstractDsolModel

      public AbstractDsolModel(S simulator, StreamInformation streamInformation)
      Construct a DSOL model and set the simulator as well as the initial streams, so they can be used in the constructor of the model.
      Parameters:
      simulator - S; the simulator to use for this model
      streamInformation - StreamInformation; the streams that have been prepared in a StreamInformation class
      Throws:
      NullPointerException - when simulator or streamInformation is null
  • Method Details

    • setStreamInformation

      public void setStreamInformation(StreamInformation streamInformation)
      Set the initial streams of the model based on a StreamInformation object. This method can be called right after the construction of the model object, or just before the model is constructed.
      Note 1: If a model is run as part of an Experiment, the seeds of the random streams will be reset just before the call to constructModel(), so do not call this method from constructModel(), as it will reset the seeds to their initial values, and undo the seed management of the Experiment.
      Note 2: The original streams are copied into the model, so they are not cloned (as the streams do not implement cloneable, and as they have inner state that needs to be preserved). So be careful with manipulating the streams in the streamInformation object afterward.
      Specified by:
      setStreamInformation in interface DsolModel<T extends Number & Comparable<T>,S extends SimulatorInterface<T>>
      Parameters:
      streamInformation - StreamInformation; the streams that have been prepared in a StreamInformation class
    • getStreamInformation

      public StreamInformation getStreamInformation()
      Return the available streams of the model stored in a StreamInformation object.
      Specified by:
      getStreamInformation in interface DsolModel<T extends Number & Comparable<T>,S extends SimulatorInterface<T>>
      Returns:
      streamInformation StreamInformation; the streams that have been prepared in a StreamInformation class
    • getSimulator

      public S getSimulator()
      Return the simulator for this model.
      Specified by:
      getSimulator in interface DsolModel<T extends Number & Comparable<T>,S extends SimulatorInterface<T>>
      Returns:
      the simulator for the model
    • getInputParameterMap

      public InputParameterMap getInputParameterMap()
      Get the input parameters for this model.
      Specified by:
      getInputParameterMap in interface DsolModel<T extends Number & Comparable<T>,S extends SimulatorInterface<T>>
      Returns:
      List<InputParameter> the input parameters for this model
    • addInputParameter

      public void addInputParameter(AbstractInputParameter<?,?> inputParameter) throws InputParameterException
      Add an input parameter to the list of input parameters.
      Parameters:
      inputParameter - AbstractInputParameter<?,?>; the input parameter to add
      Throws:
      InputParameterException - in case an input parameter with the same key already exists
    • getInputParameter

      public Object getInputParameter(String key) throws InputParameterException
      Retrieve the value of an input parameter from the map of input parameters, based on a key. The key can use the 'dot notation' to access values in sub-maps of input parameters.
      Parameters:
      key - String; the key of the input parameter to retrieve
      Returns:
      the value belonging to the key, or null if the key could not be found
      Throws:
      InputParameterException - in case the input parameter with this key does not exist
    • getOutputStatistics

      public List<SimulationStatistic<T>> getOutputStatistics()
      Get the output statistics for this model.
      Specified by:
      getOutputStatistics in interface DsolModel<T extends Number & Comparable<T>,S extends SimulatorInterface<T>>
      Returns:
      List<StatisticsInterface> the output statistics for this model