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
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 Summary
Modifier and TypeFieldDescriptionstatic final org.djutils.event.EventType
CREATE_EVENT is fired on creation.static final long
Fields inherited from class nl.tudelft.simulation.dsol.formalisms.flow.FlowObject
RECEIVE_EVENT, RELEASE_EVENT
Fields inherited from interface org.djutils.event.EventProducer
FIRST_POSITION, LAST_POSITION
-
Constructor Summary
ModifierConstructorDescriptionprotected
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).Create
(String id, DevsSimulatorInterface<T> simulator, DistContinuousSimulationTime<T> interval) Construct a new generator for objects in a simulation.Create
(String id, DevsSimulatorInterface<T> simulator, DistContinuousSimulationTime<T> interval, int batchSize) Construct a new generator for objects in a simulation.Create
(String id, DevsSimulatorInterface<T> simulator, DistContinuousSimulationTime<T> interval, DistContinuousSimulationTime<T> startTime) Construct a new generator for objects in a simulation.Create
(String id, DevsSimulatorInterface<T> simulator, DistContinuousSimulationTime<T> interval, DistContinuousSimulationTime<T> startTime, int batchSize) Construct a new generator for objects in a simulation.Create
(String id, DevsSimulatorInterface<T> simulator, DistContinuousSimulationTime<T> interval, DistContinuousSimulationTime<T> startTime, DistDiscrete batchSize) Construct a new generator for objects in a simulation.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). -
Method Summary
Modifier and TypeMethodDescriptionprotected void
generate()
Generate a new entity.Generate a new entity.Return the batch size distribution.Return the interarrival distribution.long
Return the maximum number of entities to be created.long
long
long
long
returns the startTime of the generator.void
receiveEntity
(Entity<T> entity) Arrival of a new entity into the flow object.void
setEndTime
(T endTime) void
setInterval
(DistContinuousSimulationTime<T> interval) Set a new interarrival distribution.void
setMaxNumber
(long maxNumber) sets the maximum number of entities to be created.void
setMaxNumberCreationEvents
(long maxNumberCreationEvents) void
setMaxNumberGeneratedEntities
(long maxNumberGeneratedEntities) Methods inherited from class nl.tudelft.simulation.dsol.formalisms.flow.FlowObject
getDestination, getId, getSimulator, releaseEntity, setDestination, toString
Methods inherited from class org.djutils.event.LocalEventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, getEventListenerMap, getEventTypesWithListeners, getListenerReferences, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListener
-
Field Details
-
serialVersionUID
public static final long serialVersionUID- See Also:
-
CREATE_EVENT
public static final org.djutils.event.EventType CREATE_EVENTCREATE_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 FlowObjectsimulator
- DevsSimulatorInterface<T>; is the on which the construction of the objects must be scheduled.interval
- DistContinuousSimulationTime<T>; the start time distribution for the generatorstartTime
- DistContinuousSimulationTime<T>; the inter-arrival time distributionbatchSize
- 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 FlowObjectsimulator
- DevsSimulatorInterface<T>; is the on which the construction of the objects must be scheduled.interval
- DistContinuousSimulationTime<T>; the start time distribution for the generatorstartTime
- DistContinuousSimulationTime<T>; the inter-arrival time distributionbatchSize
- 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 FlowObjectsimulator
- DevsSimulatorInterface<T>; is the on which the construction of the objects must be scheduled.interval
- DistContinuousSimulationTime<T>; the start time distribution for the generatorstartTime
- DistContinuousSimulationTime<T>; the inter-arrival time distribution
-
Create
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 FlowObjectsimulator
- 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
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 FlowObjectsimulator
- 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 FlowObjectsimulator
- DevsSimulatorInterface<T>; is the on which the construction of the objects must be scheduled.interval
- DistContinuousSimulationTime<T>; the start time distribution for the generatorbatchSize
- 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 FlowObjectsimulator
- 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
Generate a new entity. To be specified for the specific Generator.- Returns:
- Entity<T>; the generated entity
-
receiveEntity
Arrival of a new entity into the flow object.- Overrides:
receiveEntity
in classFlowObject<T extends Number & Comparable<T>>
- Parameters:
entity
- Entity; the arriving entity
-
getBatchSize
Return the batch size distribution.- Returns:
- DistDiscrete; the batch size distribution
-
getInterval
Return the interarrival distribution.- Returns:
- DistContinuousSimulationTime<T>; the interarrival distribution
-
setInterval
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
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
- Returns:
- endTime
-
setEndTime
- Parameters:
endTime
- set endTime
-
getNumberCreationEvents
public long getNumberCreationEvents()- Returns:
- numberCreationEvents
-
getNumberGeneratedEntities
public long getNumberGeneratedEntities()- Returns:
- numberGeneratedEntities
-
getNextEvent
- Returns:
- nextEvent
-