Class NHPPEventGenerator
- java.lang.Object
-
- jsl.simulation.ModelElement
-
- jsl.modeling.elements.variable.nhpp.NHPPEventGenerator
-
- All Implemented Interfaces:
EventGeneratorIfc
,ObservableIfc
,GetNameIfc
,IdentityIfc
public class NHPPEventGenerator extends ModelElement implements EventGeneratorIfc
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jsl.simulation.ModelElement
ModelElement.EventBuilderIfc<T>, ModelElement.EventScheduler<T>, ModelElement.ModelElementComparator, ModelElement.RequestBuilder, ModelElement.RequestDurationIfc, ModelElement.RequestTimeIfc, ModelElement.RequestUsingIfc, ModelElement.TimedUpdateEventAction, ModelElement.TimeUnitIfc<T>, ModelElement.WarmUpEventAction
-
-
Field Summary
Fields Modifier and Type Field Description protected EventGenerator
myEventGenerator
protected NHPPTimeBtwEventRV
myTBARV
-
Fields inherited from class jsl.simulation.ModelElement
AFTER_EXPERIMENT, AFTER_REPLICATION, BEFORE_EXPERIMENT, BEFORE_REPLICATION, CONDITIONAL_ACTION_REGISTRATION, DEFAULT_TIMED_EVENT_PRIORITY, INITIALIZED, MONTE_CARLO, myAfterExperimentOption, myAfterReplicationOption, myBeforeExperimentOption, myBeforeReplicationOption, myInitializationOption, myLengthOfWarmUp, myModelElements, myMonteCarloOption, myObservableComponent, myReplicationEndedOption, myTimedUpdateActionListener, myTimedUpdateEvent, myTimedUpdateInterval, myTimedUpdateOption, myTimedUpdatePriority, myWarmUpActionListener, myWarmUpEvent, myWarmUpIndicator, myWarmUpOption, myWarmUpPriority, NONE, REMOVED_FROM_MODEL, REPLICATION_ENDED, TIME_UNIT_DAY, TIME_UNIT_HOUR, TIME_UNIT_MILLISECOND, TIME_UNIT_MINUTE, TIME_UNIT_SECOND, TIME_UNIT_WEEK, TIMED_UPDATE, UPDATE, WARMUP
-
-
Constructor Summary
Constructors Constructor Description NHPPEventGenerator(ModelElement parent, InvertibleCumulativeRateFunctionIfc rateFunction, EventGeneratorActionIfc listener)
NHPPEventGenerator(ModelElement parent, InvertibleCumulativeRateFunctionIfc rateFunction, EventGeneratorActionIfc listener, double lastrate, java.lang.String name)
NHPPEventGenerator(ModelElement parent, InvertibleCumulativeRateFunctionIfc rateFunction, EventGeneratorActionIfc listener, java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getEndingTime()
Gets the currently planned ending time of the generator.double
getInitialEndingTime()
Returns the ending time that is to be used when the generator is initialized for each replication.long
getInitialMaximumNumberOfEvents()
Returns the maximum number of events that is used for initializing each replicationRandomIfc
getInitialTimeBetweenEvents()
Returns the time between events used to initialize each replicationRandomIfc
getInitialTimeUntilFirstEvent()
Gets the RandomIfc that will be used at the beginning of each replication to generate the time until the first eventlong
getMaximumNumberOfEvents()
Gets the maximum number of actions for the generator.long
getNumberOfEventsGenerated()
Gets the number of events that have been generated by the generatorboolean
getStartOnInitializeFlag()
This flag indicates whether or not the generator will automatically start at the beginning of a replication when initialized.RandomIfc
getTimeBetweenEvents()
Gets the random source controlling the time between eventsboolean
isEventPending()
boolean
isGeneratorDone()
This method checks to see if the generator is done.boolean
isGeneratorStarted()
boolean
isSuspended()
Indicates whether or not the generator has been suspendedvoid
resume()
Resume the generation of events according to the time between event distribution.void
setEndingTime(double endingTime)
Sets the ending time for generating events for the current replication.void
setInitialEndingTime(double endingTime)
This value is used to set the ending time for generating actions for each replication.void
setInitialMaximumNumberOfEvents(long maxNumEvents)
Sets the the maximum number of events to be used to initialize each replication.void
setInitialTimeBetweenEvents(RandomIfc timeBtwEvents)
Sets the time between events and the maximum number of events to be used to initialize each replication.void
setInitialTimeBetweenEventsAndMaxNumEvents(RandomIfc timeBtwEvents, long maxNumEvents)
Sets the time between events and the maximum number of events to be used to initialize each replication.void
setInitialTimeUntilFirstEvent(RandomIfc timeUntilFirst)
Sets the RandomIfc representing the time until the first event that is used at the beginning of each replication to generate the time until the first event.void
setMaximumNumberOfEvents(long maxNum)
Sets the maximum number of events for the generator.void
setStartOnInitializeFlag(boolean flag)
Sets the flag that indicates whether or not the generator will automatically start at the beginning of a replication when initializedvoid
setTimeBetweenEvents(RandomIfc timeUntilNext)
Sets the time between event random source.void
setTimeBetweenEvents(RandomIfc timeBtwEvents, long maxNumEvents)
Sets the time between events and the maximum number of events for the generator.void
suspend()
Suspends the generation of events and cancels the next scheduled event from the generatorvoid
turnOffGenerator()
This method turns the generator off, the next scheduled generation event will NOT occur, i.e.void
turnOnGenerator()
If the generator was not started upon initialization at the beginning of a replication, then this method can be used to start the generator The generator will be started 0.0 time units after the call If this method is used when the generator is already started it does nothing.void
turnOnGenerator(double t)
If the generator was not started upon initialization at the beginning of a replication, then this method can be used to start the generator The generator will be started t time units after the call If this method is used when the generator is already started it does nothing.void
turnOnGenerator(RandomIfc r)
If the generator was not started upon initialization at the beginning of a replication, then this method can be used to start the generator The generator will be started r.getValue() time units after the call If this method is used when the generator is already started it does nothing.-
Methods inherited from class jsl.simulation.ModelElement
addObserver, addObserverToModelElements, afterExperiment, afterExperiment_, afterReplication, afterReplication_, asString, beforeExperiment, beforeExperiment_, beforeReplication, beforeReplication_, buildEventGenerator, cancelTimedUpdateEvent, cancelWarmUpEvent, changeParentModelElement, checkForAfterExperiment, checkForAfterReplication, checkForBeforeExperiment, checkForBeforeReplication, checkForConditionalActionRegistration, checkForInitialize, checkForMonteCarlo, checkForRemoveFromModel, checkForReplicationEnded, checkForTimedUpdate, checkForUpdate, checkForWarmUp, checkObserverState, checkWarmUpOption, clearModelElementObservers, contains, countObservers, createEntity, createEntity, createQObject, day, deleteObserver, deleteObserverFromModelElements, deleteObservers, findModelElementWithWarmUpEvent, getAfterExperimentOption, getAfterReplicationOption, getAllCounters, getAllModelElements, getAllRandomElements, getAllResponseVariables, getAllVariables, getBeforeExperimentOption, getBeforeReplicationOption, getChildModelElementIterator, getCurrentReplicationNumber, getDefaultEntityType, getExecutive, getExperiment, getId, getInitializationOption, getInitializationOrderAsString, getLeftPreOrderTraversalCount, getLengthOfWarmUp, getModel, getModelElementCompartor, getModelElementsAsString, getModelElementsAsString, getModelElementsAsString, getMonteCarloOption, getName, getNumberOfModelElements, getObserverState, getParentModelElement, getPreviousObserverState, getReplicationEndedOption, getRightPreOrderTraversalCount, getSimulation, getSpatialModel, getStringLabel, getThisElementsCounters, getThisElementsModelElements, getThisElementsRandomVariables, getThisElementsResponseVariables, getThisElementsVariables, getTime, getTimedUpdateInterval, getTimedUpdateOption, getUpdateNotificationFlag, getVariable, getWarmUpEventTime, getWarmUpOption, hour, indent, initialize, initialize_, isTimedUpdateEventScheduled, isWarmedUp, isWarmUpEventScheduled, isWarmUpScheduled, millisecond, minute, montecarlo, montecarlo_, notifyAfterExperimentObservers, notifyAfterReplicationObservers, notifyBeforeExperimentObservers, notifyBeforeReplicationObservers, notifyConditionalActionRegistrationObservers, notifyInitializationObservers, notifyMonteCarloObservers, notifyObservers, notifyObservers, notifyRemovingFromModelObservers, notifyReplicationEndedObservers, notifyTimedUpdateObservers, notifyUpdateObservers, notifyWarmUpObservers, registerConditionalActions, registerConditionalActions_, removedFromModel, removeFromModel, replicationEnded, replicationEnded_, schedule, second, seize, setAfterExperimentOption, setAfterExperimentOptionForModelElements, setAfterReplicationOption, setAfterReplicationOptionForModelElements, setBeforeExperimentOption, setBeforeExperimentOptionForModelElements, setBeforeReplicationOption, setBeforeReplicationOptionForModelElements, setInitializationOption, setInitializationOptionForModelElements, setLengthOfWarmUp, setModel, setMonteCarloOption, setMonteCarloOptionForModelElements, setName, setObserverState, setParentModelElement, setReplicationEndedOption, setReplicationEndedOptionForModelElements, setSpatialModel, setStringLabel, setTimedUpdateInterval, setTimedUpdateOption, setTimedUpdateOptionForModelElements, setUpdateNotificationFlag, setWarmUpOption, setWarmUpOptionForModelElements, stopExecutive, stopExecutive, timedUpdate, timedUpdate_, toString, update, useControls, warmUp, warmUp_, week
-
-
-
-
Field Detail
-
myEventGenerator
protected EventGenerator myEventGenerator
-
myTBARV
protected NHPPTimeBtwEventRV myTBARV
-
-
Constructor Detail
-
NHPPEventGenerator
public NHPPEventGenerator(ModelElement parent, InvertibleCumulativeRateFunctionIfc rateFunction, EventGeneratorActionIfc listener)
- Parameters:
parent
- the parentrateFunction
- the rate functionlistener
- the listener for generation
-
NHPPEventGenerator
public NHPPEventGenerator(ModelElement parent, InvertibleCumulativeRateFunctionIfc rateFunction, EventGeneratorActionIfc listener, java.lang.String name)
- Parameters:
parent
- the parentrateFunction
- the rate functionlistener
- the listener for generationname
- the name to assign
-
NHPPEventGenerator
public NHPPEventGenerator(ModelElement parent, InvertibleCumulativeRateFunctionIfc rateFunction, EventGeneratorActionIfc listener, double lastrate, java.lang.String name)
- Parameters:
parent
- the parentrateFunction
- the rate functionlistener
- the listener for generationlastrate
- the last ratename
- the name to assign
-
-
Method Detail
-
isEventPending
public final boolean isEventPending()
- Specified by:
isEventPending
in interfaceEventGeneratorIfc
- Returns:
- true if an event is scheduled to occur for the generator
-
isGeneratorStarted
public final boolean isGeneratorStarted()
- Specified by:
isGeneratorStarted
in interfaceEventGeneratorIfc
- Returns:
- true if the generator has been started (turned on) either automatically or manually
-
getEndingTime
public double getEndingTime()
Description copied from interface:EventGeneratorIfc
Gets the currently planned ending time of the generator.- Specified by:
getEndingTime
in interfaceEventGeneratorIfc
- Returns:
- A double representing the ending time.
-
getInitialEndingTime
public double getInitialEndingTime()
Description copied from interface:EventGeneratorIfc
Returns the ending time that is to be used when the generator is initialized for each replication.- Specified by:
getInitialEndingTime
in interfaceEventGeneratorIfc
- Returns:
- Returns the initial ending time that is to be used when the generator
-
getMaximumNumberOfEvents
public long getMaximumNumberOfEvents()
Description copied from interface:EventGeneratorIfc
Gets the maximum number of actions for the generator. This is set by the supplied maxNum upon creation of the generator. This implies that it will be the same for every simulation replication.- Specified by:
getMaximumNumberOfEvents
in interfaceEventGeneratorIfc
- Returns:
- A long representing the maximum number of actions for the generator.
-
getInitialMaximumNumberOfEvents
public long getInitialMaximumNumberOfEvents()
Description copied from interface:EventGeneratorIfc
Returns the maximum number of events that is used for initializing each replication- Specified by:
getInitialMaximumNumberOfEvents
in interfaceEventGeneratorIfc
- Returns:
- the initial maximum number of events
-
getNumberOfEventsGenerated
public long getNumberOfEventsGenerated()
Description copied from interface:EventGeneratorIfc
Gets the number of events that have been generated by the generator- Specified by:
getNumberOfEventsGenerated
in interfaceEventGeneratorIfc
- Returns:
- the number of events that have been generated
-
getInitialTimeBetweenEvents
public RandomIfc getInitialTimeBetweenEvents()
Description copied from interface:EventGeneratorIfc
Returns the time between events used to initialize each replication- Specified by:
getInitialTimeBetweenEvents
in interfaceEventGeneratorIfc
- Returns:
- the initial time between events
-
getInitialTimeUntilFirstEvent
public RandomIfc getInitialTimeUntilFirstEvent()
Description copied from interface:EventGeneratorIfc
Gets the RandomIfc that will be used at the beginning of each replication to generate the time until the first event- Specified by:
getInitialTimeUntilFirstEvent
in interfaceEventGeneratorIfc
- Returns:
- RandomIfc that will be used at the beginning of each replication to generate the time until the first event
-
isGeneratorDone
public boolean isGeneratorDone()
Description copied from interface:EventGeneratorIfc
This method checks to see if the generator is done. In other words, if it has been turned off.- Specified by:
isGeneratorDone
in interfaceEventGeneratorIfc
- Returns:
- True means that it is done.
-
isSuspended
public boolean isSuspended()
Description copied from interface:EventGeneratorIfc
Indicates whether or not the generator has been suspended- Specified by:
isSuspended
in interfaceEventGeneratorIfc
- Returns:
- true if generator is suspended
-
resume
public void resume()
Description copied from interface:EventGeneratorIfc
Resume the generation of events according to the time between event distribution.- Specified by:
resume
in interfaceEventGeneratorIfc
-
setEndingTime
public void setEndingTime(double endingTime)
Description copied from interface:EventGeneratorIfc
Sets the ending time for generating events for the current replication. A new ending time will be applied to the generator. If this change results in an ending time that is less than the current time, the generator will be turned off- Specified by:
setEndingTime
in interfaceEventGeneratorIfc
- Parameters:
endingTime
- the ending time for generating events
-
setInitialEndingTime
public void setInitialEndingTime(double endingTime)
Description copied from interface:EventGeneratorIfc
This value is used to set the ending time for generating actions for each replication. Changing this variable during a replication cause the next replication to use this value for its ending time.- Specified by:
setInitialEndingTime
in interfaceEventGeneratorIfc
- Parameters:
endingTime
- value is used to set the initial ending time for generating actions
-
setMaximumNumberOfEvents
public void setMaximumNumberOfEvents(long maxNum)
Description copied from interface:EventGeneratorIfc
Sets the maximum number of events for the generator. Must not be infinite (Long.MAX_VALUE) if the current time between events is 0.0- Specified by:
setMaximumNumberOfEvents
in interfaceEventGeneratorIfc
- Parameters:
maxNum
- maximum number of events
-
setInitialMaximumNumberOfEvents
public void setInitialMaximumNumberOfEvents(long maxNumEvents)
Description copied from interface:EventGeneratorIfc
Sets the the maximum number of events to be used to initialize each replication. The time between events cannot evaluate to a constant value of 0.0 if the maximum number of events is infinite (Long.MAX_VALUE). Uses the current value for initial time between events- Specified by:
setInitialMaximumNumberOfEvents
in interfaceEventGeneratorIfc
- Parameters:
maxNumEvents
- the the maximum number of events
-
setTimeBetweenEvents
public void setTimeBetweenEvents(RandomIfc timeBtwEvents, long maxNumEvents)
Description copied from interface:EventGeneratorIfc
Sets the time between events and the maximum number of events for the generator. These two parameters are dependent. The time between events cannot always evaluate to 0.0 if the maximum number of events is infinite (Long.MAX_VALUE). This method only changes these parameters for the current replication. The changes take effect when the next event is generated. If current number of events that have been generated is greater than or equal to the supplied maximum number of events, the generator will be turned off.- Specified by:
setTimeBetweenEvents
in interfaceEventGeneratorIfc
- Parameters:
timeBtwEvents
- the time between eventsmaxNumEvents
- the maximum number of events
-
setTimeBetweenEvents
public void setTimeBetweenEvents(RandomIfc timeUntilNext)
Description copied from interface:EventGeneratorIfc
Sets the time between event random source. Must not always evaluate to 0.0, if the current setting of the maximum number of events is infinite (Long.MAX_VALUE)- Specified by:
setTimeBetweenEvents
in interfaceEventGeneratorIfc
- Parameters:
timeUntilNext
- time until the next event
-
getTimeBetweenEvents
public final RandomIfc getTimeBetweenEvents()
Description copied from interface:EventGeneratorIfc
Gets the random source controlling the time between events- Specified by:
getTimeBetweenEvents
in interfaceEventGeneratorIfc
- Returns:
- the random source controlling the time between events
-
setInitialTimeBetweenEventsAndMaxNumEvents
public void setInitialTimeBetweenEventsAndMaxNumEvents(RandomIfc timeBtwEvents, long maxNumEvents)
Description copied from interface:EventGeneratorIfc
Sets the time between events and the maximum number of events to be used to initialize each replication. These parameters are dependent. The time between events cannot evaluate to a constant value of 0.0 if the maximum number of events is infinite (Long.MAX_VALUE)- Specified by:
setInitialTimeBetweenEventsAndMaxNumEvents
in interfaceEventGeneratorIfc
- Parameters:
timeBtwEvents
- the initial time between eventsmaxNumEvents
- the initial maximum number of events
-
setInitialTimeBetweenEvents
public void setInitialTimeBetweenEvents(RandomIfc timeBtwEvents)
Description copied from interface:EventGeneratorIfc
Sets the time between events and the maximum number of events to be used to initialize each replication. The time between events cannot evaluate to a constant value of 0.0. The maximum number of events is kept at its current value, which by default is Long.Max_Value- Specified by:
setInitialTimeBetweenEvents
in interfaceEventGeneratorIfc
- Parameters:
timeBtwEvents
- the time between events
-
setInitialTimeUntilFirstEvent
public void setInitialTimeUntilFirstEvent(RandomIfc timeUntilFirst)
Description copied from interface:EventGeneratorIfc
Sets the RandomIfc representing the time until the first event that is used at the beginning of each replication to generate the time until the first event. This change becomes effective at the beginning of the next replication to execute- Specified by:
setInitialTimeUntilFirstEvent
in interfaceEventGeneratorIfc
- Parameters:
timeUntilFirst
- , The supplied RandomIfc, cannot be null
-
suspend
public void suspend()
Description copied from interface:EventGeneratorIfc
Suspends the generation of events and cancels the next scheduled event from the generator- Specified by:
suspend
in interfaceEventGeneratorIfc
-
getStartOnInitializeFlag
public final boolean getStartOnInitializeFlag()
Description copied from interface:EventGeneratorIfc
This flag indicates whether or not the generator will automatically start at the beginning of a replication when initialized. By default this option is true.- Specified by:
getStartOnInitializeFlag
in interfaceEventGeneratorIfc
- Returns:
- true if on
-
setStartOnInitializeFlag
public final void setStartOnInitializeFlag(boolean flag)
Description copied from interface:EventGeneratorIfc
Sets the flag that indicates whether or not the generator will automatically start at the beginning of a replication when initialized- Specified by:
setStartOnInitializeFlag
in interfaceEventGeneratorIfc
- Parameters:
flag
- true indicates automatic start
-
turnOnGenerator
public final void turnOnGenerator()
Description copied from interface:EventGeneratorIfc
If the generator was not started upon initialization at the beginning of a replication, then this method can be used to start the generator The generator will be started 0.0 time units after the call If this method is used when the generator is already started it does nothing. If this method is used after the generator is done it does nothing. If this method is used after the generator has been suspended it does nothing. Use suspend() and resume() to suspend and resume a generator that has already been started.- Specified by:
turnOnGenerator
in interfaceEventGeneratorIfc
-
turnOnGenerator
public final void turnOnGenerator(double t)
Description copied from interface:EventGeneratorIfc
If the generator was not started upon initialization at the beginning of a replication, then this method can be used to start the generator The generator will be started t time units after the call If this method is used when the generator is already started it does nothing. If this method is used after the generator is done it does nothing. If this method is used after the generator has been suspended it does nothing. Use suspend() and resume() to suspend and resume a generator that has already been started.- Specified by:
turnOnGenerator
in interfaceEventGeneratorIfc
- Parameters:
t
- The time until the generator should be turned on
-
turnOnGenerator
public void turnOnGenerator(RandomIfc r)
Description copied from interface:EventGeneratorIfc
If the generator was not started upon initialization at the beginning of a replication, then this method can be used to start the generator The generator will be started r.getValue() time units after the call If this method is used when the generator is already started it does nothing. If this method is used after the generator is done it does nothing. If this method is used after the generator has been suspended it does nothing. Use suspend() and resume() to suspend and resume a generator that has already been started.- Specified by:
turnOnGenerator
in interfaceEventGeneratorIfc
- Parameters:
r
- The time until the generator should be turned on
-
turnOffGenerator
public void turnOffGenerator()
Description copied from interface:EventGeneratorIfc
This method turns the generator off, the next scheduled generation event will NOT occur, i.e. this method will also cancel a previously scheduled generation event if one exists. No future events will be scheduled after turning off the generator- Specified by:
turnOffGenerator
in interfaceEventGeneratorIfc
-
-