Companion components

Many Resource and Activity components either require additional components provided as children (relates to simulation tree structure) before they can proceed, or can have additional custom functionality added based on the components supplied. To achieve this functionality we supply a series of generic component types that can be used across CLEM. These companion components work alongside the parent and rely on some communication with the parent component. These include Filtering and sorting individuals, Relationships, Greenhouse gas emission, Activity fee and Labour requirement and are described in more detail below. An interface with common properties and features is implemented to allow this interaction which includes identifying the companions, passing resources quantities to companions to determine actions, sharing resources, and identifying implications when resources are limiting.

Identifying companion components

It is important that any parent component can identify a specific companion component. One approach to achieve this would be to identify the companion components using the name property provided in the simulation tree, but this is prone to mismatch errors and assumes the user knows all required naming conventions and parent requirements. The approach used is to determine whether a parent component supports companion components which will determine where you are able to add companion models in the tree structure. Each parent that supports companion will provide a list of identifiers labels for each companion type supported. The companion types in turn have a property that will allow the user to select which identifier the companion relates to. The validation section of CLEM is then responsible for reporting when required components are missing. Not all parents will require this identification and so when no identifiers are specified for a given companion type, the property will not display in the user interface to avoid confusion and empty lists.

The name of the property relating to the identifier may be different across the various companion components.

Linking companion components to parent actions

Most of the companion models will be required at the time the parent component is performing its tasks and will likely need to know the current state of the parent's action. For this reason the companion mode also specifies a unit type that it expects to work with. The parent component that supports companions will provide the list of available units it can supply and these will appear in a drop down property list as a property of each companion.

An example would be a crop task such as planting that needs labour at the rate of 1 day for each hectare planted. This would be achieved by adding a Labour requirement companion component below the Crop task activity and setting the style property to per ha and the amount property to 1. As this task is needed the parent will provide the current area of the crop and the labour requirement will specify the individuals that can be used, adding this resource to the activities resources to be considered.

Examples of companion components

The following section outlines some of the companion components and how they utilise the interface to influence the parent model (e.g. activity)

See next section - Restricting activities and resources