Package jsl.modeling.elements.component
Class Component
- java.lang.Object
-
- jsl.simulation.ModelElement
-
- jsl.simulation.SchedulingElement
-
- jsl.modeling.elements.component.Component
-
- All Implemented Interfaces:
ObservableIfc
,GetNameIfc
,IdentityIfc
public class Component extends SchedulingElement
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
Component.Available
protected class
Component.ComponentState
protected class
Component.Created
protected class
Component.Failed
protected class
Component.Operating
protected class
Component.Repairing
protected class
Component.Unavailable
-
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 Component.ComponentState
myAvailableState
Before being operated, the component must be placed in the activated stateprotected Component.ComponentState
myCreatedState
The component is in the created state right after it has been constructedprotected JSLEvent
myEndOperationEvent
If the component has been scheduled to operate this event represents the end of the operation timeprotected JSLEvent
myEndRepairEvent
Represents the amount of time to repair the componentprotected Component.ComponentState
myFailedState
The component can be placed in the failed state after it has been placed in the operating stateprotected JSLEvent
myFailureEvent
If the component has been scheduled to fail this event represents the end of the time to failureprotected Component.ComponentState
myOperatingState
The component can be placed in the operating state after it has been activatedprotected double
myOperationTime
A variable representing the time associated with operating the component for the current operationprotected RVariableIfc
myOperationTimeCDF
A distribution governing the time associated with operating the componentprotected RandomVariable
myOperationTimeRV
A random variable representing the time associated with operating the component.protected boolean
myRepairedSinceLastOperatedFlag
Indicates that the component has been repaired since it was last operatedprotected Component.ComponentState
myRepairingState
The component can be placed in the repairing state after it has failed.protected double
myRepairTime
A variable representing the amount of time to repair the component for the current repairprotected RVariableIfc
myRepairTimeCDF
Governs the RV representing the amount of time to repair the componentprotected RandomVariable
myRepairTimeRV
A random variable representing the amount of time to repair the componentprotected double
myTimeToFailure
Represents the amount of time to failure when a failure event has been scheduledprotected RVariableIfc
myTimeToFailureCDF
A CDF governing the amount of time to failure when a failure event has been scheduledprotected RandomVariable
myTimeToFailureRV
A random variable representing the amount of time to failure when a failure event has been scheduledprotected Component.ComponentState
myUnavailableState
The component can be deactivated, it can do nothing but be activatedstatic int
STATE_CHANGE
Indicates that the transporter has changed state to its observers-
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 Component(ModelElement parent)
Component(ModelElement parent, java.lang.String name)
Creates a component.Component(ModelElement parent, RVariableIfc timeToFailureCDF, java.lang.String name)
Creates a component.Component(ModelElement parent, RVariableIfc timeToFailureCDF, RVariableIfc operationTimeCDF, java.lang.String name)
Creates a component.Component(ModelElement parent, RVariableIfc timeToFailureCDF, RVariableIfc operationTimeCDF, RVariableIfc repairTimeCDF)
Creates a component.Component(ModelElement parent, RVariableIfc timeToFailureCDF, RVariableIfc operationTimeCDF, RVariableIfc repairTimeCDF, java.lang.String name)
Creates a component.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activate()
Tells the component to activatevoid
attachStateChangeListener(ComponentStateChangeListener listener)
Attaches a component state change listener to the componentprotected void
beforeReplication()
Required initialization actions occur in this method.boolean
containsStateChangeListener(ComponentStateChangeListenerIfc listener)
Checks if the listener has already been attached to the componentvoid
deactivate()
Tells the component to deactivate.void
endOperation()
Can be used to directly end an on-going operation.protected void
endOperationAction()
This method is called right after the component enters the activated state, i.e.void
endRepair()
Can be used to directly end an on-going repair.protected void
endRepairAction()
This method is called right after the component enters the activated state after being repaired, i.e.void
fail()
Tells the component to immediately fail.protected void
failureAction()
This method is called right after the component enters the failed state, i.e.StateAccessorIfc
getActivatedState()
ComponentAssembly
getAssembly()
If the component belongs to a composite (assembly) then this method will return the assembly.StateAccessorIfc
getComponentState()
Returns the current state of the componentStateAccessorIfc
getCreatedState()
StateAccessorIfc
getDeactivatedState()
StateAccessorIfc
getFailedState()
protected double
getNextOperationTime()
Gets the next operation time for the component.protected double
getNextRepairTime()
Gets the next time to complete repair for the component.protected double
getNextTimeToFailure()
Gets the next time to failure for the component.StateAccessorIfc
getOperatingState()
double
getOperationTime()
Gets the current operation time for the component.StateAccessorIfc
getPreviousComponentState()
Returns the previous state of the componentStateAccessorIfc
getRepairingState()
protected double
getTimeRemainingUntilNextFailure()
Returns the time remaining until the next failure.protected void
initialize()
Can be used to initialize the component after beforeReplication() is called.boolean
isAutomaticRestartAfterOperatingFlagOn()
Indicates whether or not the component will automatically restart operating after completing an operationboolean
isAutomaticRestartAfterRepairFlagOn()
Indicates whether or not the component will automatically start operating after completing repair.boolean
isAutomaticStartRepairAfterFailureFlagOn()
Indicates whether or not the component will automatically start repair after failing.boolean
isAvailable()
Returns true if the component is in the activated stateboolean
isCreated()
Returns true if the component is in the created stateboolean
isEndOfOperationPending()
Returns true if the component has an end of operation event scheduledboolean
isEndOfRepairPending()
Returns true if the component has an end of repair event scheduledboolean
isFailed()
Returns true if the component is in the failed stateboolean
isFailurePending()
Returns true if the component has a failure event scheduledboolean
isInRepair()
Returns true if the component is in the being repaired stateboolean
isOperateAtInitializationFlagOn()
True indicates that the component will automatically be scheduled to start operating when it is initializedboolean
isOperating()
Returns true if the component is in the operating stateboolean
isPreviousState(StateAccessorIfc state)
Returns true if the component is in the supplied stateboolean
isState(StateAccessorIfc state)
Returns true if the component is in the supplied stateboolean
isUnavailable()
Returns true if the component is in the deactivated stateboolean
removeStateChangeListener(ComponentStateChangeListenerIfc listener)
Removes an attached component state change listener from the componentvoid
scheduleOperation()
Schedules the component to operate using the operating time distributionvoid
scheduleOperation(double operationTime)
Schedules the component to operate for the supplied time periodvoid
scheduleRepair()
Schedules the component to undergo repair for the time specified by its repair time distributionvoid
scheduleRepair(double repairTime)
Schedules the component to undergo repair for the supplied time periodprotected void
setAssembly(ComponentAssembly assembly)
This method is used by ComponentAssembly to set the component's assembly.void
setAutomaticRestartAfterOperatingFlag(boolean flag)
Indicates whether or not the component will automatically restart operating after completing an operation.void
setAutomaticRestartAfterRepairFlag(boolean flag)
Indicates whether or not the component will automatically start operating after completing repair.void
setAutomaticStartRepairAfterFailureFlag(boolean flag)
Indicates whether or not the component will automatically start repair after failing.void
setOperateAtInitializationFlag(boolean flag)
True indicates that the component will automatically be scheduled to start operating when it is initialized.void
setOperationTimeCDFInitialRandomSource(RVariableIfc distribution)
Sets the operation time distribution for the componentvoid
setRepairTimeCDFInitialRandomSource(RVariableIfc distribution)
Sets the repair time distribution for the componentprotected void
setState(Component.ComponentState state)
Sets the state of the component, updates previous and current states, notifies state change listeners of the state change, and notifies any observers of the state change.void
setTimeToFailureCDFInitialRandomSource(RVariableIfc distribution)
Sets the time to failure distribution for the componentvoid
startOperation()
Tells the component to immediately start operating.void
startOperation(double operationTime)
Tells the component to immediately start operating.void
startRepair()
Tells the component to immediately start repair.protected void
updateTimeRemainingUntilNextFailure(double operationTime)
After an operation ends this method is called to allow the time to failure to be updated.-
Methods inherited from class jsl.simulation.SchedulingElement
cancelEvent, rescheduleEvent, rescheduleEvent, rescheduleEvent, rescheduleEvent, scheduleEvent, scheduleEvent, scheduleEvent, scheduleEvent, scheduleEvent, scheduleEvent, scheduleEvent, scheduleEvent, scheduleEvent, scheduleEvent
-
Methods inherited from class jsl.simulation.ModelElement
addObserver, addObserverToModelElements, afterExperiment, afterExperiment_, afterReplication, afterReplication_, asString, beforeExperiment, beforeExperiment_, 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_, 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
-
STATE_CHANGE
public static final int STATE_CHANGE
Indicates that the transporter has changed state to its observers
-
myOperationTime
protected double myOperationTime
A variable representing the time associated with operating the component for the current operation
-
myOperationTimeRV
protected RandomVariable myOperationTimeRV
A random variable representing the time associated with operating the component.
-
myOperationTimeCDF
protected RVariableIfc myOperationTimeCDF
A distribution governing the time associated with operating the component
-
myEndOperationEvent
protected JSLEvent myEndOperationEvent
If the component has been scheduled to operate this event represents the end of the operation time
-
myTimeToFailure
protected double myTimeToFailure
Represents the amount of time to failure when a failure event has been scheduled
-
myTimeToFailureRV
protected RandomVariable myTimeToFailureRV
A random variable representing the amount of time to failure when a failure event has been scheduled
-
myTimeToFailureCDF
protected RVariableIfc myTimeToFailureCDF
A CDF governing the amount of time to failure when a failure event has been scheduled
-
myFailureEvent
protected JSLEvent myFailureEvent
If the component has been scheduled to fail this event represents the end of the time to failure
-
myRepairTime
protected double myRepairTime
A variable representing the amount of time to repair the component for the current repair
-
myRepairTimeRV
protected RandomVariable myRepairTimeRV
A random variable representing the amount of time to repair the component
-
myRepairTimeCDF
protected RVariableIfc myRepairTimeCDF
Governs the RV representing the amount of time to repair the component
-
myEndRepairEvent
protected JSLEvent myEndRepairEvent
Represents the amount of time to repair the component
-
myRepairedSinceLastOperatedFlag
protected boolean myRepairedSinceLastOperatedFlag
Indicates that the component has been repaired since it was last operated
-
myCreatedState
protected Component.ComponentState myCreatedState
The component is in the created state right after it has been constructed
-
myAvailableState
protected Component.ComponentState myAvailableState
Before being operated, the component must be placed in the activated state
-
myUnavailableState
protected Component.ComponentState myUnavailableState
The component can be deactivated, it can do nothing but be activated
-
myFailedState
protected Component.ComponentState myFailedState
The component can be placed in the failed state after it has been placed in the operating state
-
myOperatingState
protected Component.ComponentState myOperatingState
The component can be placed in the operating state after it has been activated
-
myRepairingState
protected Component.ComponentState myRepairingState
The component can be placed in the repairing state after it has failed.
-
-
Constructor Detail
-
Component
public Component(ModelElement parent)
-
Component
public Component(ModelElement parent, java.lang.String name)
Creates a component. The following defaults are used: timeToFailureCDF = new Constant(Double.POSITIVE_INFINITY) operationTimeCDF = new Constant(0.0) repairTimeCDF = new Constant(0.0)- Parameters:
parent
- The model element serving as the parentname
- The name of the component
-
Component
public Component(ModelElement parent, RVariableIfc timeToFailureCDF, java.lang.String name)
Creates a component. The following defaults are used: operationTimeCDF = new Constant(0.0) repairTimeCDF = new Constant(0.0)- Parameters:
parent
- The model element serving as the parenttimeToFailureCDF
- The time to failure CDFname
- The name of the component
-
Component
public Component(ModelElement parent, RVariableIfc timeToFailureCDF, RVariableIfc operationTimeCDF, java.lang.String name)
Creates a component. The following defaults are used: repairTimeCDF = new Constant(0.0)- Parameters:
parent
- The model element serving as the parenttimeToFailureCDF
- The time to failure CDFoperationTimeCDF
- The operation time CDFname
- The name of the component
-
Component
public Component(ModelElement parent, RVariableIfc timeToFailureCDF, RVariableIfc operationTimeCDF, RVariableIfc repairTimeCDF)
Creates a component. If the time to failure CDF, operation time CDF, or repair time CDF are null then the following defaults are used: timeToFailureCDF = new Constant(Double.POSITIVE_INFINITY) operationTimeCDF = new Constant(0.0) repairTimeCDF = new Constant(0.0)- Parameters:
parent
- The model element serving as the parenttimeToFailureCDF
- The time to failure CDFoperationTimeCDF
- The operation time CDFrepairTimeCDF
- The repair time CDF
-
Component
public Component(ModelElement parent, RVariableIfc timeToFailureCDF, RVariableIfc operationTimeCDF, RVariableIfc repairTimeCDF, java.lang.String name)
Creates a component. If the time to failure CDF, operation time CDF, or repair time CDF are null then the following defaults are used: timeToFailureCDF = new Constant(Double.POSITIVE_INFINITY) operationTimeCDF = new Constant(0.0) repairTimeCDF = new Constant(0.0)- Parameters:
parent
- The model element serving as the parenttimeToFailureCDF
- The time to failure CDFoperationTimeCDF
- The operation time CDFrepairTimeCDF
- The repair time CDFname
- The name of the component
-
-
Method Detail
-
attachStateChangeListener
public final void attachStateChangeListener(ComponentStateChangeListener listener)
Attaches a component state change listener to the component- Parameters:
listener
- The listener to be attached, must be non-null and not already attached
-
removeStateChangeListener
public final boolean removeStateChangeListener(ComponentStateChangeListenerIfc listener)
Removes an attached component state change listener from the component- Parameters:
listener
- , Must not be null- Returns:
- True if the remove was successful
-
containsStateChangeListener
public final boolean containsStateChangeListener(ComponentStateChangeListenerIfc listener)
Checks if the listener has already been attached to the component- Parameters:
listener
- , must not be null- Returns:
- True if it has already been attached
-
isCreated
public final boolean isCreated()
Returns true if the component is in the created state- Returns:
-
isAvailable
public final boolean isAvailable()
Returns true if the component is in the activated state- Returns:
-
isUnavailable
public final boolean isUnavailable()
Returns true if the component is in the deactivated state- Returns:
-
isFailed
public final boolean isFailed()
Returns true if the component is in the failed state- Returns:
-
isOperating
public final boolean isOperating()
Returns true if the component is in the operating state- Returns:
-
isInRepair
public final boolean isInRepair()
Returns true if the component is in the being repaired state- Returns:
-
isFailurePending
public final boolean isFailurePending()
Returns true if the component has a failure event scheduled- Returns:
-
isEndOfOperationPending
public final boolean isEndOfOperationPending()
Returns true if the component has an end of operation event scheduled- Returns:
-
isEndOfRepairPending
public final boolean isEndOfRepairPending()
Returns true if the component has an end of repair event scheduled- Returns:
-
getComponentState
public final StateAccessorIfc getComponentState()
Returns the current state of the component- Returns:
-
getPreviousComponentState
public final StateAccessorIfc getPreviousComponentState()
Returns the previous state of the component- Returns:
-
isState
public final boolean isState(StateAccessorIfc state)
Returns true if the component is in the supplied state- Parameters:
state
-- Returns:
-
isPreviousState
public final boolean isPreviousState(StateAccessorIfc state)
Returns true if the component is in the supplied state- Parameters:
state
-- Returns:
-
getActivatedState
public final StateAccessorIfc getActivatedState()
- Returns:
- Returns the activatedState.
-
getCreatedState
public final StateAccessorIfc getCreatedState()
- Returns:
- Returns the createdState.
-
getDeactivatedState
public final StateAccessorIfc getDeactivatedState()
- Returns:
- Returns the deactivatedState.
-
getFailedState
public final StateAccessorIfc getFailedState()
- Returns:
- Returns the failedState.
-
getOperatingState
public final StateAccessorIfc getOperatingState()
- Returns:
- Returns the operatingState.
-
getRepairingState
public final StateAccessorIfc getRepairingState()
- Returns:
- Returns the repairingState.
-
setTimeToFailureCDFInitialRandomSource
public final void setTimeToFailureCDFInitialRandomSource(RVariableIfc distribution)
Sets the time to failure distribution for the component- Parameters:
distribution
- , must not be null
-
setOperationTimeCDFInitialRandomSource
public final void setOperationTimeCDFInitialRandomSource(RVariableIfc distribution)
Sets the operation time distribution for the component- Parameters:
distribution
- , must not be null
-
setRepairTimeCDFInitialRandomSource
public final void setRepairTimeCDFInitialRandomSource(RVariableIfc distribution)
Sets the repair time distribution for the component- Parameters:
distribution
- , must not be null
-
isOperateAtInitializationFlagOn
public final boolean isOperateAtInitializationFlagOn()
True indicates that the component will automatically be scheduled to start operating when it is initialized- Returns:
- Returns the operateAtInitializationFlag.
-
setOperateAtInitializationFlag
public final void setOperateAtInitializationFlag(boolean flag)
True indicates that the component will automatically be scheduled to start operating when it is initialized. Changing the flag, only has an effect at initialization.- Parameters:
flag
- The operateAtInitializationFlag to set.
-
isAutomaticRestartAfterOperatingFlagOn
public final boolean isAutomaticRestartAfterOperatingFlagOn()
Indicates whether or not the component will automatically restart operating after completing an operation- Returns:
- Returns the automaticRestartAfterOperatingFlag.
-
setAutomaticRestartAfterOperatingFlag
public final void setAutomaticRestartAfterOperatingFlag(boolean flag)
Indicates whether or not the component will automatically restart operating after completing an operation. The default is false. This behavior can also be overridden by overriding endOperationAction()- Parameters:
flag
- The automaticRestartAfterOperatingFlag to set.
-
isAutomaticRestartAfterRepairFlagOn
public final boolean isAutomaticRestartAfterRepairFlagOn()
Indicates whether or not the component will automatically start operating after completing repair. The default is false- Returns:
- Returns the automaticRestartAfterRepairFlag.
-
setAutomaticRestartAfterRepairFlag
public final void setAutomaticRestartAfterRepairFlag(boolean flag)
Indicates whether or not the component will automatically start operating after completing repair. The default is false. This behavior can also be overridden by overriding endRepairAction()- Parameters:
flag
- The automaticRestartAfterRepairFlag to set.
-
isAutomaticStartRepairAfterFailureFlagOn
public final boolean isAutomaticStartRepairAfterFailureFlagOn()
Indicates whether or not the component will automatically start repair after failing. The default is false- Returns:
- Returns the automaticStartRepairAfterFailureFlag.
-
setAutomaticStartRepairAfterFailureFlag
public final void setAutomaticStartRepairAfterFailureFlag(boolean flag)
Indicates whether or not the component will automatically start repair after failing. The default is false. This behavior can also be overridden by overriding failureAction()- Parameters:
flag
- The automaticStartRepairAfterFailureFlag to set.
-
getAssembly
public final ComponentAssembly getAssembly()
If the component belongs to a composite (assembly) then this method will return the assembly. This may be null.- Returns:
- Returns the assembly, may be null
-
setAssembly
protected final void setAssembly(ComponentAssembly assembly)
This method is used by ComponentAssembly to set the component's assembly. The assembly may be null if the component is removed from a ComponentAssembly as is thus not part of an assembly.- Parameters:
assembly
- The assembly to set.
-
startOperation
public final void startOperation()
Tells the component to immediately start operating. The component cannot operate unless it has been activated.
-
startOperation
public final void startOperation(double operationTime)
Tells the component to immediately start operating. The component cannot operate unless it has been activated. The supplied operation time is used to determine whether or not a failure will occur during the operation time. No end operation is scheduled. The client is still responsible for ending the operation; however, the component may experience a failure before the specified operation time is completed.- Parameters:
operationTime
-
-
scheduleOperation
public final void scheduleOperation()
Schedules the component to operate using the operating time distribution
-
scheduleOperation
public final void scheduleOperation(double operationTime)
Schedules the component to operate for the supplied time period- Parameters:
operationTime
- , must be > 0.0
-
getOperationTime
public final double getOperationTime()
Gets the current operation time for the component. If the component is in the operating state and an operation has been scheduled, this method gets the time interval length of the operation. If no operation has been scheduled or if the component is not in the operating state this method returns Double.NaN- Returns:
- Returns the operationTime.
-
endOperation
public final void endOperation()
Can be used to directly end an on-going operation. This method is only valid when the component is in the operating state
-
startRepair
public final void startRepair()
Tells the component to immediately start repair. The component must be in the failed state.
-
scheduleRepair
public final void scheduleRepair()
Schedules the component to undergo repair for the time specified by its repair time distribution
-
scheduleRepair
public final void scheduleRepair(double repairTime)
Schedules the component to undergo repair for the supplied time period- Parameters:
repairTime
- , must be > 0.0
-
endRepair
public final void endRepair()
Can be used to directly end an on-going repair. This method is only valid when the component is in the repairing state
-
activate
public final void activate()
Tells the component to activate
-
deactivate
public final void deactivate()
Tells the component to deactivate. It cannot deactivate unless it is in the activate state.
-
fail
public final void fail()
Tells the component to immediately fail. The component must be in the operating state for it to fail.
-
getTimeRemainingUntilNextFailure
protected double getTimeRemainingUntilNextFailure()
Returns the time remaining until the next failure. This method is called whenever an operation is scheduled to determine if a failure should be scheduled- Returns:
-
updateTimeRemainingUntilNextFailure
protected void updateTimeRemainingUntilNextFailure(double operationTime)
After an operation ends this method is called to allow the time to failure to be updated. The default is to decrement the time to failure by the amount of time that the component just operated.- Parameters:
operationTime
-
-
getNextOperationTime
protected double getNextOperationTime()
Gets the next operation time for the component. By default this is determined by the operation time random variable, but can be overridden- Returns:
- the next operation time
-
getNextTimeToFailure
protected double getNextTimeToFailure()
Gets the next time to failure for the component. By default this is determined by the time to failure random variable, but can be overridden- Returns:
- the next time to failure
-
getNextRepairTime
protected double getNextRepairTime()
Gets the next time to complete repair for the component. By default this is determined by the repair time random variable, but can be overridden- Returns:
- the next repair time
-
endOperationAction
protected void endOperationAction()
This method is called right after the component enters the activated state, i.e. transitioning from operating to activated. The component should be in the activated state within this method. If the automatic restart after operating flag is true, the component will be scheduled to operate again automatically. Overriders of this method are responsible for automatic restart after operating if that behavior is still required
-
failureAction
protected void failureAction()
This method is called right after the component enters the failed state, i.e. transitioning from operating to failed. The component will be in the failed state within this method. If the automatic start start repair after failure flag is true, the component will be scheduled into repair automatically. Overriders of this method are responsible for handling automatic start of repair if that behavior is needed.
-
endRepairAction
protected void endRepairAction()
This method is called right after the component enters the activated state after being repaired, i.e. transitioning from repairing to activated The component will be in the activated state within this method. If the automatic restart after repair flag is true, the component will be scheduled to operate again automatically. Overriders of this method are responsible for handling automatic restart after repair if that behavior is needed.
-
beforeReplication
protected void beforeReplication()
Required initialization actions occur in this method. The state of the component is automatically set to the available state and the component is considered repaired since last operated.- Overrides:
beforeReplication
in classModelElement
-
initialize
protected void initialize()
Can be used to initialize the component after beforeReplication() is called. If the operate at initialization flag is true then the component is scheduled to operate according to the operation time model- Overrides:
initialize
in classModelElement
-
setState
protected final void setState(Component.ComponentState state)
Sets the state of the component, updates previous and current states, notifies state change listeners of the state change, and notifies any observers of the state change.- Parameters:
state
-
-
-