Timing of activities
Advanced topic - requires coding skills
CLEM provides a suite of timers (see Using timers) designed to determine when an activity can be performed. A range of methods are included in CLEM to manage timers and calculate whether an activity can be performed in the current time-step. Timers are additive such that all timers present up the tree structure from a given activity component (as well as a direct children of an activity) must allow the activity to happen for it to be performed.

An activity timer component derives from CLEMModel so that it contains all component functionality and also inherits from the IActivityTimerInterface and IActivityPerformedNotifier.

The IActivityTimer interface ensures CLEM can communicate with any activity timer.
This interface includes three methods

This boolean property returns whether the activity is due in the current time-step

The boolean Check(DateTime dateToCheck) method will determine if the timer is due on the supplied date.

This method with EventArgs as parameter is used to trigger that the timer was due and performed for tracking activity and timer status (see XXXX).

The CLEMActivityBase, from which all Activities are derived, provides two properties and a method to determine the current timing status of the activity.

The TimingOK property (get only) returns the whether the current activity can be performed in the current time-step. This property also checks that the activity is enabled (IModel property set in UI tree) as this is a convenient place to ensure all disabled activities are not performed.

The TimingExists property (get only) returns the whether the current activity has any timers associated as some activity should not be included without a timer (e.g. controlled breeding)

The TimingCheck method returns the whether the current activity can be performed of the date passed as a parameter (DateTime date)
These properties are used during the GetResourcesNeededForActivity calls that handle much of the resource allocation and actions of activities.