MaximumFunction
The MaximumFunction is a utility function that returns the maximum value from all of its child functions.
Overview
The MaximumFunction is used to determine the largest value among multiple child functions. It evaluates each child and returns the maximum result. This is useful when you need to select the most permissive factor or the highest value among several parameters in plant or soil models.
The function works by iterating through all child functions and using Math.Max() to track the largest value encountered. It initializes with a very small value (-999999999) and progressively updates to the maximum found among all children.
Model Structure
This section describes how this model is positioned within the APSIM framework. It outlines the broader structural and computational components that define its role and interactions in the simulation system.
This model inherits structural and functional behaviour from the following core APSIM components:
Connections to Other Components
This section describes how the model interacts with other components in the APSIM Next Generation framework.
These connections allow the model to exchange information—such as environmental conditions, developmental stage, or physiological responses—with other parts of the simulation system. For a general overview of how model components are connected in APSIM, see the Connections Overview.
| Component | Model | Connection Type | Description |
|---|---|---|---|
| Child Functions | IFunction | Children | Any number of child functions whose values are compared. |
Model Variables
This section lists the key variables that describe or control the behaviour of this component. Some variables can be adjusted by the user to modify how the model behaves (configurable), while others are calculated internally and can be viewed as model outputs (reportable). For a general explanation of variable types and how they are used within the APSIM Next Generation framework, see the Model Variables Overview.
Configurable and Reportable Properties
No configurable properties are available for this function.
Read-Only Reportable Properties
| Property | Type | Description |
|---|---|---|
| Value | double | The sum of values from all child functions. |
Processes and Algorithms
This section describes the scientific processes and algorithms represented by this component. Each process corresponds to a biological, physical, or chemical mechanism simulated during a model time step. Where appropriate, equations or conceptual summaries are provided to explain how the process operates within the APSIM Next Generation framework.
Maximum Value Calculation
The MaximumFunction evaluates all child functions and returns the maximum value. The algorithm is:
- Initialize return value to a very small number (-999999999)
- Iterate through all child functions
- For each child, compare its value with the current maximum
- Update the maximum if the child’s value is larger
- Return the final maximum value
Mathematically, this can be expressed as:
\[ Value_{max} = \max_{i=1}^{n}(f_i) \]
where \(f_i\) represents the value of the \(i\)-th child function, and \(n\) is the total number of child functions.
User Interface
MaximumFunction can be added as a child of any parent node in the model tree. Right-click the parent node, select “Add Model…”, and search for MaximumFunction in the Filter Box.

Practical Example
Suppose you want to determine the maximum soil water available from several soil layers, or the most permissive nutrient for plant growth. You can use the MaximumFunction to select the highest value among all relevant child functions.
For example, if you have three child functions representing different constraints:
\[ PermissiveFactor = \max(Value_1, Value_2, Value_3) \]
The MaximumFunction will return the largest of these values.
See Also
- Source code: MaximumFunction.cs on GitHub