Class Component

    • 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,
                         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 parent
        name - 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 parent
        timeToFailureCDF - The time to failure CDF
        name - 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 parent
        timeToFailureCDF - The time to failure CDF
        operationTimeCDF - The operation time CDF
        name - 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 parent
        timeToFailureCDF - The time to failure CDF
        operationTimeCDF - The operation time CDF
        repairTimeCDF - 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 parent
        timeToFailureCDF - The time to failure CDF
        operationTimeCDF - The operation time CDF
        repairTimeCDF - The repair time CDF
        name - 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 class ModelElement
      • 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 class ModelElement
      • 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 -