Release


Releases a given number of resource units previously seized by Seize object. Moving resources can Return to home location (if they are not immediately seized by another agent) or Stay where they are after being released (this setting is configured with the Moving resources parameter).

The operation takes zero time. Note that all seized resources must be released before the agent is disposed by Sink object.

Optionally you can define the wrap-up task to be done by the resource unit when it completes the main task and is released by the agent. The wrap-up task can be defined with the wrap-up flowchart (starting from the lower wrapUp port and ending with the block ResourceTaskEnd). 

Parameters

Release
Defines what resources are being released. There are five alternative choices: All seized resources (of any pool), All resources seized by given Seize block(s), All seized resources from given pool(s), Specified resources (list of pools), Specified quantity of resources.
Get value: releaseMode
Valid values: Release.ALL
           
Release.ALL_FROM_SEIZES
           
Release.ALL_FROM_POOLS
           
Release.SPECIFIED_RESOURCES
           
Release.SPECIFIED_QUANTITY
Seize blocks
[Visible if Release is set to All resources seized by given Seize block(s)] Expression evaluated to obtain the resource pool where the units being released belong to. If left unspecified or returns null, he connected pool is assumed.
Get value: seizeBlocks
ResourcePool objects [dynamic]
[Visible if Release is set to All seized resources from given pool(s) or Specified resources (list of pools)] List of names of ResourcePool objects whose units are being released. One unit will be released per pool name, so if you wish to release two or more units of the same pool, you should list that pool twice, e.g. { doctor, nurse, nurse }.
Local variable: agent - the agent
Resource pool object [dynamic]
[Visible if Release is set to Specified quantity of resources] The name of ResourcePool object - resource pool where the units being released belong to.
Local variable: agent - the agent
Quantity released [dynamic]
[Visible if Release is set to Specified quantity of resources] The number of resource units being released. In case the Quantity released evaluates to 0, the resource pool is not checked, and the agent just flows through the object.
Value type: int
Local variable: agent - the agent 
Moving resources [dynamic]
Defines, whether moving resources should Return to home location (if they are not immediately seized by another agent) or Stay where they are after being released.
Value type: boolean
Default value: Return to home location (true)
Local variables: agent - the agent
                          Agent unit - the resource unit
Wrap-up tasks
Wrap-up (e.g. move home) [dynamic]
Here you select in what case resource units will return home, and optionally do the wrap-up task defined with the wrap-up flowchart (starting from wrapUp port and ending with the block ResourceTaskEnd). 
There are three alternative options:
each time - wrap-up and/or "return" tasks will be done each time the resource unit finishes its main task and is released by the agent. 
if no other tasks - wrap-up and/or "return" tasks are done only if there are no other tasks currently waiting for the resource unit.
custom - if you select this option, you can define the priority and preemption policy for wrap-up tasks using the parameters below. In this case the priority of the wrap-up task will be compared with priorities of other incoming tasks, and the specified preemption policy will be used to select the next task for this particular resource unit.
Local variables: agent - the agent
                          Agent unit - the resource unit 
'Wrap-up' priority [dynamic]
[Visible and applies if the option Wrap-up (e.g. move home) is set to custom] Sets the priority for wrap up task (see above). 
Value type: double
Default value: 0
Local variables: agent - the agent
                          Agent unit - the resource unit
'Wrap-up' preemption policy [dynamic]
[Visible and applies if the option Wrap-up (e.g. move home) is set to custom] Specifies the policy for wrap up task preemption by some other task:
No preemption - wrap-up task cannot be preempted.
Terminate - wrap-up task will be preempted by the incoming task and terminated.
Valid values: Release.PP_NO_PREEMPTION, Release.PP_TERMINATE
Local variables: agent - the agent
                          Agent unit - the resource unit
'Wrap up' usage statistics are [dynamic]
Choose how the statistics for the wrap-up task should be collected: counted as 'busy', counted as 'idle', or not collected at all.
Valid values: Release.USAGE_BUSY, Release.USAGE_IDLE, Release.USAGE_NOT_COUNTED
Local variables: agent - the agent
                          Agent unit - the resource unit
Actions 
On enter [code]
Code executed when the agent enters the object.
Local variable: agent - the agent
On release [code]
Code executed when the resource unit has been released. Note that a custom 'wrap up' task can be assigned to this resource unit (either 'move to home location' task, or a custom wrap-up task defined with a  flowchart starting with wrapUp port and ending with ResourceTaskEnd block).
Local variables: agent - the agent
                          Agent unit - the resource unit
On exit [code]
Code executed when the agent exits the object.
Local variable: agent - the agent
On 'Wrap-up' terminated [code]
Code executed when resource's wrap-up task is terminated (preempted by some other task with higher priority).
Local variables: agent - the agent who originally seized this resource unit
                          Agent unit - the resource unit

Ports

in
The input port.
wrapUp
The port where you can connect the block that starts the wrap-up process flowchart. This flowchart should end with ResourceTaskEnd block.
out
The output port.