ResourceTask

Defines some custom task for resources that cannot be defined using the provided standard patterns for failures, maintenance, breaks, etc in the ResourcePool parameters.

Parameters

In all dynamic parameters and code actions the resource unit is available as a local variable unit.
Unit type [dynamic]
The type of resource units performing the task. This resource type is referred to below as T.
Default value: Agent
Priority [dynamic]
Sets the priority for the task (the larger the higher). 
Value type: double
Default value: 0
Local variable: unit - the resource unit
May preempt other tasks [dynamic]
If the option is selected (or the specified here expression returns true), this task may preempt the task currently being executed. If false, then the unit will finish all its tasks with less priority.
Type: boolean
Default value: false
Local variable: unit - the resource unit
Preemption policy [dynamic]
Here you can choose what is done when some other task incomes for the resource unit(s) currently busy with this task.
No preemption - the current task continues executing.
Terminate - the task is interrupted and never continued.
Valid values: No preemption (ResourceTask.PP_NO_PREEMPTION)
                     Terminate (ResourceTask.PP_TERMINATE)
Local variable: unit - the resource unit
Trigger type [dynamic]
Here you can choose whether you want to schedule tasks by defining the initial occurrence time and Time between tasks, or you prefer to use AnyLogic Schedule instead.
Valid values: Time between tasks (ResourceTask.TRIGGER_TIME_BETWEEN)
                     Schedule (ResourceTask.TRIGGER_SCHEDULE)
Initial occurrence time [dynamic]
[Visible if Trigger type is Time between tasks] - The time of the first task occurrence.
Value type: double
Default value: uniform( 0, 1000 ) seconds
Local variable: unit - the resource unit
Time between tasks [dynamic]
[Visible if Trigger type is Time between tasks] - The time between tasks (you define how the time is counted with the Time starts when parameter below).
Value type: double
Default value: triangularAV( 1000, 0.1 ) seconds
Time starts when [dynamic]
[Visible if Trigger type is defined as Time between tasks] Here you define how the time between tasks is counted: the time before the next task may start elapsing either when the current Task finishes, or when the current Task starts.
Value type: boolean
Default value: Task finishes (true)
Schedule [dynamic]
[Visible if Trigger type is defined as Schedule] - The schedule defining the occurrence pattern for the task. The schedule should be set to the "on/off" mode.
Value type: Schedule<Boolean>
Local variable: unit - the resource unit
Task type [dynamic]
Here you can choose how you will model the task:
Delay (timeout/schedule) - you can just set the duration of the task as a delay, or using a schedule.
Go to flowchart
- Alternative to modeling a task just with a delay, you can model it with a flowchart describing the process. The flowchart start should start with the ResourceTaskStart block specified in the Task start block field below.

Valid values: Delay (timeout/schedule) (ResourceTask.TASK_DELAY)
                     Go to flowchart (ResourceTask.TASK_FLOWCHART)
Task duration [dynamic]
[Visible if Trigger type is defined as Time between tasks and Task type is defined as Delay (timeout/schedule)] The duration of the task.
Value type: double
Default value: triangular(10, 20, 30) seconds
Local variable: unit - the resource unit
Task start block [dynamic]
[Visible if Task type is defined as Go to flowchart] - ResourceTaskStart block starting the flowchart defining the task process.
Local variable: unit - the resource unit
Usage statistics are [dynamic]
Here you choose whether you consider this task in the collected usage statistics as 'busy' time, 'idle' time, or not take it into account at all.
Default value: Not collected
Actions
On start [code]
Code to be executed when the task starts.
Local variables: unit - the resource unit
                          ResourceUnitTask task - the task
On finish [code]
Code to be executed when the task finishes.
Local variables: unit - the resource unit
                          ResourceUnitTask task - the task
On terminate [code]
[Visible if Preemption policy is set to Terminate] Code to be executed when the task is terminated by some other task.
Local variables: unit - the resource unit
                          ResourceUnitTask task - the task