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 EventGeneratormyEventGeneratorprotected NHPPTimeBtwEventRVmyTBARV-
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 doublegetEndingTime()Gets the currently planned ending time of the generator.doublegetInitialEndingTime()Returns the ending time that is to be used when the generator is initialized for each replication.longgetInitialMaximumNumberOfEvents()Returns the maximum number of events that is used for initializing each replicationRandomIfcgetInitialTimeBetweenEvents()Returns the time between events used to initialize each replicationRandomIfcgetInitialTimeUntilFirstEvent()Gets the RandomIfc that will be used at the beginning of each replication to generate the time until the first eventlonggetMaximumNumberOfEvents()Gets the maximum number of actions for the generator.longgetNumberOfEventsGenerated()Gets the number of events that have been generated by the generatorbooleangetStartOnInitializeFlag()This flag indicates whether or not the generator will automatically start at the beginning of a replication when initialized.RandomIfcgetTimeBetweenEvents()Gets the random source controlling the time between eventsbooleanisEventPending()booleanisGeneratorDone()This method checks to see if the generator is done.booleanisGeneratorStarted()booleanisSuspended()Indicates whether or not the generator has been suspendedvoidresume()Resume the generation of events according to the time between event distribution.voidsetEndingTime(double endingTime)Sets the ending time for generating events for the current replication.voidsetInitialEndingTime(double endingTime)This value is used to set the ending time for generating actions for each replication.voidsetInitialMaximumNumberOfEvents(long maxNumEvents)Sets the the maximum number of events to be used to initialize each replication.voidsetInitialTimeBetweenEvents(RandomIfc timeBtwEvents)Sets the time between events and the maximum number of events to be used to initialize each replication.voidsetInitialTimeBetweenEventsAndMaxNumEvents(RandomIfc timeBtwEvents, long maxNumEvents)Sets the time between events and the maximum number of events to be used to initialize each replication.voidsetInitialTimeUntilFirstEvent(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.voidsetMaximumNumberOfEvents(long maxNum)Sets the maximum number of events for the generator.voidsetStartOnInitializeFlag(boolean flag)Sets the flag that indicates whether or not the generator will automatically start at the beginning of a replication when initializedvoidsetTimeBetweenEvents(RandomIfc timeUntilNext)Sets the time between event random source.voidsetTimeBetweenEvents(RandomIfc timeBtwEvents, long maxNumEvents)Sets the time between events and the maximum number of events for the generator.voidsuspend()Suspends the generation of events and cancels the next scheduled event from the generatorvoidturnOffGenerator()This method turns the generator off, the next scheduled generation event will NOT occur, i.e.voidturnOnGenerator()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.voidturnOnGenerator(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.voidturnOnGenerator(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:
isEventPendingin interfaceEventGeneratorIfc- Returns:
- true if an event is scheduled to occur for the generator
-
isGeneratorStarted
public final boolean isGeneratorStarted()
- Specified by:
isGeneratorStartedin interfaceEventGeneratorIfc- Returns:
- true if the generator has been started (turned on) either automatically or manually
-
getEndingTime
public double getEndingTime()
Description copied from interface:EventGeneratorIfcGets the currently planned ending time of the generator.- Specified by:
getEndingTimein interfaceEventGeneratorIfc- Returns:
- A double representing the ending time.
-
getInitialEndingTime
public double getInitialEndingTime()
Description copied from interface:EventGeneratorIfcReturns the ending time that is to be used when the generator is initialized for each replication.- Specified by:
getInitialEndingTimein interfaceEventGeneratorIfc- Returns:
- Returns the initial ending time that is to be used when the generator
-
getMaximumNumberOfEvents
public long getMaximumNumberOfEvents()
Description copied from interface:EventGeneratorIfcGets 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:
getMaximumNumberOfEventsin interfaceEventGeneratorIfc- Returns:
- A long representing the maximum number of actions for the generator.
-
getInitialMaximumNumberOfEvents
public long getInitialMaximumNumberOfEvents()
Description copied from interface:EventGeneratorIfcReturns the maximum number of events that is used for initializing each replication- Specified by:
getInitialMaximumNumberOfEventsin interfaceEventGeneratorIfc- Returns:
- the initial maximum number of events
-
getNumberOfEventsGenerated
public long getNumberOfEventsGenerated()
Description copied from interface:EventGeneratorIfcGets the number of events that have been generated by the generator- Specified by:
getNumberOfEventsGeneratedin interfaceEventGeneratorIfc- Returns:
- the number of events that have been generated
-
getInitialTimeBetweenEvents
public RandomIfc getInitialTimeBetweenEvents()
Description copied from interface:EventGeneratorIfcReturns the time between events used to initialize each replication- Specified by:
getInitialTimeBetweenEventsin interfaceEventGeneratorIfc- Returns:
- the initial time between events
-
getInitialTimeUntilFirstEvent
public RandomIfc getInitialTimeUntilFirstEvent()
Description copied from interface:EventGeneratorIfcGets the RandomIfc that will be used at the beginning of each replication to generate the time until the first event- Specified by:
getInitialTimeUntilFirstEventin 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:EventGeneratorIfcThis method checks to see if the generator is done. In other words, if it has been turned off.- Specified by:
isGeneratorDonein interfaceEventGeneratorIfc- Returns:
- True means that it is done.
-
isSuspended
public boolean isSuspended()
Description copied from interface:EventGeneratorIfcIndicates whether or not the generator has been suspended- Specified by:
isSuspendedin interfaceEventGeneratorIfc- Returns:
- true if generator is suspended
-
resume
public void resume()
Description copied from interface:EventGeneratorIfcResume the generation of events according to the time between event distribution.- Specified by:
resumein interfaceEventGeneratorIfc
-
setEndingTime
public void setEndingTime(double endingTime)
Description copied from interface:EventGeneratorIfcSets 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:
setEndingTimein interfaceEventGeneratorIfc- Parameters:
endingTime- the ending time for generating events
-
setInitialEndingTime
public void setInitialEndingTime(double endingTime)
Description copied from interface:EventGeneratorIfcThis 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:
setInitialEndingTimein 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:EventGeneratorIfcSets 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:
setMaximumNumberOfEventsin interfaceEventGeneratorIfc- Parameters:
maxNum- maximum number of events
-
setInitialMaximumNumberOfEvents
public void setInitialMaximumNumberOfEvents(long maxNumEvents)
Description copied from interface:EventGeneratorIfcSets 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:
setInitialMaximumNumberOfEventsin interfaceEventGeneratorIfc- Parameters:
maxNumEvents- the the maximum number of events
-
setTimeBetweenEvents
public void setTimeBetweenEvents(RandomIfc timeBtwEvents, long maxNumEvents)
Description copied from interface:EventGeneratorIfcSets 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:
setTimeBetweenEventsin interfaceEventGeneratorIfc- Parameters:
timeBtwEvents- the time between eventsmaxNumEvents- the maximum number of events
-
setTimeBetweenEvents
public void setTimeBetweenEvents(RandomIfc timeUntilNext)
Description copied from interface:EventGeneratorIfcSets 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:
setTimeBetweenEventsin interfaceEventGeneratorIfc- Parameters:
timeUntilNext- time until the next event
-
getTimeBetweenEvents
public final RandomIfc getTimeBetweenEvents()
Description copied from interface:EventGeneratorIfcGets the random source controlling the time between events- Specified by:
getTimeBetweenEventsin interfaceEventGeneratorIfc- Returns:
- the random source controlling the time between events
-
setInitialTimeBetweenEventsAndMaxNumEvents
public void setInitialTimeBetweenEventsAndMaxNumEvents(RandomIfc timeBtwEvents, long maxNumEvents)
Description copied from interface:EventGeneratorIfcSets 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:
setInitialTimeBetweenEventsAndMaxNumEventsin interfaceEventGeneratorIfc- Parameters:
timeBtwEvents- the initial time between eventsmaxNumEvents- the initial maximum number of events
-
setInitialTimeBetweenEvents
public void setInitialTimeBetweenEvents(RandomIfc timeBtwEvents)
Description copied from interface:EventGeneratorIfcSets 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:
setInitialTimeBetweenEventsin interfaceEventGeneratorIfc- Parameters:
timeBtwEvents- the time between events
-
setInitialTimeUntilFirstEvent
public void setInitialTimeUntilFirstEvent(RandomIfc timeUntilFirst)
Description copied from interface:EventGeneratorIfcSets 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:
setInitialTimeUntilFirstEventin interfaceEventGeneratorIfc- Parameters:
timeUntilFirst- , The supplied RandomIfc, cannot be null
-
suspend
public void suspend()
Description copied from interface:EventGeneratorIfcSuspends the generation of events and cancels the next scheduled event from the generator- Specified by:
suspendin interfaceEventGeneratorIfc
-
getStartOnInitializeFlag
public final boolean getStartOnInitializeFlag()
Description copied from interface:EventGeneratorIfcThis 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:
getStartOnInitializeFlagin interfaceEventGeneratorIfc- Returns:
- true if on
-
setStartOnInitializeFlag
public final void setStartOnInitializeFlag(boolean flag)
Description copied from interface:EventGeneratorIfcSets the flag that indicates whether or not the generator will automatically start at the beginning of a replication when initialized- Specified by:
setStartOnInitializeFlagin interfaceEventGeneratorIfc- Parameters:
flag- true indicates automatic start
-
turnOnGenerator
public final void turnOnGenerator()
Description copied from interface:EventGeneratorIfcIf 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:
turnOnGeneratorin interfaceEventGeneratorIfc
-
turnOnGenerator
public final void turnOnGenerator(double t)
Description copied from interface:EventGeneratorIfcIf 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:
turnOnGeneratorin interfaceEventGeneratorIfc- Parameters:
t- The time until the generator should be turned on
-
turnOnGenerator
public void turnOnGenerator(RandomIfc r)
Description copied from interface:EventGeneratorIfcIf 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:
turnOnGeneratorin interfaceEventGeneratorIfc- Parameters:
r- The time until the generator should be turned on
-
turnOffGenerator
public void turnOffGenerator()
Description copied from interface:EventGeneratorIfcThis 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:
turnOffGeneratorin interfaceEventGeneratorIfc
-
-