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

java.lang.Object
org.djutils.event.LocalEventProducer
nl.tudelft.simulation.dsol.formalisms.flow.FlowObject<T>
nl.tudelft.simulation.dsol.formalisms.flow.Create<T>
Type Parameters:
T - the time type
All Implemented Interfaces:
Serializable, Remote, org.djutils.base.Identifiable, org.djutils.event.EventProducer

public abstract class Create<T extends Number & Comparable<T>> extends FlowObject<T>
The Create flow object generates entities with a certain inter-arrival time. The class is abstract because the modeller has to provide the generateEntity method that generates an entity with the correct id and attributes.

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

    • serialVersionUID

      public static final long serialVersionUID
      See Also:
    • CREATE_EVENT

      public static final org.djutils.event.EventType CREATE_EVENT
      CREATE_EVENT is fired on creation.
  • Constructor Details

    • Create

      public Create(String id, DevsSimulatorInterface<T> simulator, DistContinuousSimulationTime<T> interval, DistContinuousSimulationTime<T> startTime, DistDiscrete batchSize)
      Construct a new generator for objects in a simulation. Constructed objects are sent to the 'destination' of the Create flow object when a destination has been indicated with the setDestination method.
      Parameters:
      id - String; the id of the FlowObject
      simulator - DevsSimulatorInterface<T>; is the on which the construction of the objects must be scheduled.
      interval - DistContinuousSimulationTime<T>; the start time distribution for the generator
      startTime - DistContinuousSimulationTime<T>; the inter-arrival time distribution
      batchSize - DistDiscrete; the distribution of the number of objects generated at each generation event
    • Create

      public Create(String id, DevsSimulatorInterface<T> simulator, DistContinuousSimulationTime<T> interval, DistContinuousSimulationTime<T> startTime, int batchSize)
      Construct a new generator for objects in a simulation. Constructed objects are sent to the 'destination' of the Create flow object when a destination has been indicated with the setDestination method.
      Parameters:
      id - String; the id of the FlowObject
      simulator - DevsSimulatorInterface<T>; is the on which the construction of the objects must be scheduled.
      interval - DistContinuousSimulationTime<T>; the start time distribution for the generator
      startTime - DistContinuousSimulationTime<T>; the inter-arrival time distribution
      batchSize - int; the number of objects generated at each generation event
    • Create

      public Create(String id, DevsSimulatorInterface<T> simulator, DistContinuousSimulationTime<T> interval, DistContinuousSimulationTime<T> startTime)
      Construct a new generator for objects in a simulation. Constructed objects are sent to the 'destination' of the Create flow object when a destination has been indicated with the setDestination method. This constructor has a maximum number of entities generated, which results in stopping the generator when the maximum number of entities has been reached.
      Parameters:
      id - String; the id of the FlowObject
      simulator - DevsSimulatorInterface<T>; is the on which the construction of the objects must be scheduled.
      interval - DistContinuousSimulationTime<T>; the start time distribution for the generator
      startTime - DistContinuousSimulationTime<T>; the inter-arrival time distribution
    • Create

      protected Create(String id, DevsSimulatorInterface<T> simulator, DistDiscrete batchSize)
      Construct a new generator for objects in a simulation, but without the interval (to be set later, e.g., by the generator classes with a schedule). Constructed objects are sent to the 'destination' of the Create flow object when a destination has been indicated with the setDestination method. This constructor has a maximum number of entities generated, which results in stopping the generator when the maximum number of entities has been reached.
      Parameters:
      id - String; the id of the FlowObject
      simulator - DevsSimulatorInterface<T>; is the on which the construction of the objects must be scheduled.
      batchSize - DistDiscrete; the number of objects generated at each generation event
    • Create

      protected Create(String id, DevsSimulatorInterface<T> simulator, int batchSize)
      Construct a new generator for objects in a simulation, but without the interval (to be set later, e.g., by the generator classes with a schedule). Constructed objects are sent to the 'destination' of the Create flow object when a destination has been indicated with the setDestination method. This constructor has a maximum number of entities generated, which results in stopping the generator when the maximum number of entities has been reached.
      Parameters:
      id - String; the id of the FlowObject
      simulator - DevsSimulatorInterface<T>; is the on which the construction of the objects must be scheduled.
      batchSize - int; the number of objects generated at each generation event
    • Create

      public Create(String id, DevsSimulatorInterface<T> simulator, DistContinuousSimulationTime<T> interval, int batchSize)
      Construct a new generator for objects in a simulation. Constructed objects are sent to the 'destination' of the Create flow object when a destination has been indicated with the setDestination method. This constructor has a maximum number of entities generated, which results in stopping the generator when the maximum number of entities has been reached.
      Parameters:
      id - String; the id of the FlowObject
      simulator - DevsSimulatorInterface<T>; is the on which the construction of the objects must be scheduled.
      interval - DistContinuousSimulationTime<T>; the start time distribution for the generator
      batchSize - int; the number of objects generated at each generation event
    • Create

      public Create(String id, DevsSimulatorInterface<T> simulator, DistContinuousSimulationTime<T> interval)
      Construct a new generator for objects in a simulation. Constructed objects are sent to the 'destination' of the Create flow object when a destination has been indicated with the setDestination method. This constructor has a maximum number of entities generated, which results in stopping the generator when the maximum number of entities has been reached.
      Parameters:
      id - String; the id of the FlowObject
      simulator - DevsSimulatorInterface<T>; is the on which the construction of the objects must be scheduled.
      interval - DistContinuousSimulationTime<T>; the start time distribution for the generator
  • Method Details

    • generate

      protected void generate()
      Generate a new entity.
    • generateEntity

      protected abstract Entity<T> generateEntity()
      Generate a new entity. To be specified for the specific Generator.
      Returns:
      Entity<T>; the generated entity
    • receiveEntity

      public void receiveEntity(Entity<T> entity)
      Arrival of a new entity into the flow object.
      Overrides:
      receiveEntity in class FlowObject<T extends Number & Comparable<T>>
      Parameters:
      entity - Entity; the arriving entity
    • getBatchSize

      public DistDiscrete getBatchSize()
      Return the batch size distribution.
      Returns:
      DistDiscrete; the batch size distribution
    • getInterval

      public DistContinuousSimulationTime<T> getInterval()
      Return the interarrival distribution.
      Returns:
      DistContinuousSimulationTime<T>; the interarrival distribution
    • setInterval

      public void setInterval(DistContinuousSimulationTime<T> interval)
      Set a new interarrival distribution. This is used by, e.g., the GenerateSchedule classes that changes the arrival rate at set intervals.
      Parameters:
      interval - DistContinuousSimulationTime<T>; the new interarrival distribution
    • getMaxNumber

      public long getMaxNumber()
      Return the maximum number of entities to be created.
      Returns:
      long the maxNumber
    • setMaxNumber

      public void setMaxNumber(long maxNumber)
      sets the maximum number of entities to be created.
      Parameters:
      maxNumber - long; is the maxNumber
    • getStartTime

      public DistContinuousSimulationTime<T> getStartTime()
      returns the startTime of the generator.
      Returns:
      DistContinuous
    • getMaxNumberCreationEvents

      public long getMaxNumberCreationEvents()
      Returns:
      maxNumberCreationEvents
    • setMaxNumberCreationEvents

      public void setMaxNumberCreationEvents(long maxNumberCreationEvents)
      Parameters:
      maxNumberCreationEvents - set maxNumberCreationEvents
    • getMaxNumberGeneratedEntities

      public long getMaxNumberGeneratedEntities()
      Returns:
      maxNumberGeneratedEntities
    • setMaxNumberGeneratedEntities

      public void setMaxNumberGeneratedEntities(long maxNumberGeneratedEntities)
      Parameters:
      maxNumberGeneratedEntities - set maxNumberGeneratedEntities
    • getEndTime

      public T getEndTime()
      Returns:
      endTime
    • setEndTime

      public void setEndTime(T endTime)
      Parameters:
      endTime - set endTime
    • getNumberCreationEvents

      public long getNumberCreationEvents()
      Returns:
      numberCreationEvents
    • getNumberGeneratedEntities

      public long getNumberGeneratedEntities()
      Returns:
      numberGeneratedEntities
    • getNextEvent

      public SimEventInterface<T> getNextEvent()
      Returns:
      nextEvent