Once a Container is activated, it can be deactivated via the Deactivation… button on the Conditionality tab, which provides access to a standard Trigger dialog.
You can explicitly control when a conditional Container deactivates by defining one or more triggers.
By default, the Deactivation is set to Auto Deactivate. This means that the Container will deactivate when its parent Container deactivates. Note that if a conditional Container is not within a conditional Container, it deactivates when the Model (root) Container deactivates (i.e., at the end of the realization).
Note: You can tell if a deactivation trigger has been defined from the appearance of the Trigger… button. If a trigger is defined, the rectangle next to the lightning bolt is bright green; otherwise it is dark green. And like all Trigger… buttons, it displays a tool-tip. If there is no trigger defined, the tool-tip will display “Automatically deactivates when parent deactivates”, where parent is the name of the parent Container.
One special trigger type is provided within the Deactivation trigger dialog:
The At Duration trigger deactivates the Container when the Duration output exceeds the specified Trigger Definition (which must represent a length of time). The Duration output represents the amount of time that the Container has been active. Hence, this provides a convenient mechanism to deactivate a Container once it has been active for a specified amount of time. The Trigger Definition input in this case would typically be defined by an element inside the Container.
Note: You can record all activation and deactivation times in the model’s Run Log. This logging can be activated via the General tab of the Options dialog (accessed via Model|Options from the main menu).
Several points should be noted regarding deactivation of Containers:
• A Container can be deactivated multiple times during a realization. Of course, in order for a Container to be deactivated a second time, it must first be reactivated. Deactivation triggers which occur while the Container is inactive are ignored (they are not “stored” or saved).
• All conditional Containers have an Auto Deactivate trigger (that cannot be deleted). Hence, it will always immediately deactivate if its parent Container deactivates.
• A conditional Container can be activated and immediately deactivated by assigning the same trigger for Activation and Deactivation.
• When a Container is triggered to deactivate, all elements inside the Container are updated before the Container deactivates.
When a conditional Container is deactivated, one of two possible events are released, depending on the condition specified in the Treat as completion if this condition is true field (which defaults to True):
Completion_Event: This event is output when the Container has deactivated and the Container is considered to have been completed. A conditional Container is considered to have completed if, at the time it deactivates, the expression in the field named On deactivation, output Completion event if this condition is true evaluates to True.
Termination_Event: This event is output when the Container has deactivated and the Container is considered not to have been completed. A conditional Container is considered to have not completed if, at the time it deactivates, the expression in the field named On deactivation, output Completion event if this condition is true evaluates to False.
Note: If a Container is deactivated due to deactivation of a parent Container or due to an operating Resource Requirement not being met, neither a Completion_Event nor a Termination_Event is fired.
Deactivating a Container and differentiating whether it has terminated or completed is particularly useful for simulating projects (i.e., when you are using the conditional Container to simulate a project or a task). In this case, you often need to track whether or not various tasks (or collections of tasks) have been successfully completed, as this may impact how subsequent tasks are carried out.
Learn more about:
Understanding Event Triggering
Specifying Resources for a Conditional Container
Outputs of a Conditional Container
Logging Container Activations and Deactivations to the Run Log