MultiplyFunction
The MultiplyFunction is a utility function that returns the product of values from all of its child functions.
Overview
The MultiplyFunction is used to multiply multiple values for a mathematical equation. It calculates the product values of all children functions and returns the total product. This is useful when you need to combine multiple traits or parameters into a single value for further calculations in plant growth models.
A key performance feature of this function is that it returns zero as soon as any child function returns zero, which can improve computational efficiency. To maximize performance, child functions that are more likely to return zero should be placed at the top of the list of 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:
This function inherits from the following parent classes:
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 will be multiplied together. |
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. |
Events
This section describes the events associated with this component. Events are signals or notifications that indicate when a particular process occurs within the simulation, or when a component needs to respond to a change in another part of the system. Some events are listened for by this component to trigger its processes, while others are raised to inform other components about changes. For a general overview of how APSIM Next Generation uses events to coordinate processes between components, see the Events Overview.
Events Listened For
No events are listened by this function.
Events Raised to
No events are raised by this function.
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.
Multiplication Calculation
The function calculates the product of all child function values using the following algorithm:
\[ V = \prod_{i=1}^{n} F_i \]
where:
- \(V\) is the final value returned by the MultiplyFunction
- \(F_i\) is the value of the \(i\)-th child function
- \(n\) is the total number of child functions
Performance Optimization: The calculation short-circuits when any child function returns zero, immediately returning 0.0 without evaluating remaining child functions. This optimization means that ordering child functions strategically (with those most likely to be zero at the top) can significantly improve computational efficiency.
User Interface
MultiplyFunction can be added as a child of any node in the model tree. Right-click the parent node, select “Add Model…”, and search for MultiplyFunction in the Filter Box. A symbol for the MultiplyFunction is displayed in the user interface to represent the function.

Practical Example
The target thermal time from germination to emergence in the wheat model is determined by ShootLag (\(ShootLag\)), Sowing Depth (\(SowingDepth\)), and Shoot Rate (\(ShootRate\)).
\[ TT = ShootLag + (SowingDepth \times ShootRate) \]
The MultiplyFunction is used to multiply these two values to get the total target thermal time in the equation above.
See Also
- Source code: MultiplyFunction.cs on GitHub