Running a simulation

To run your simulation select Run from the pop-up menu when you right click the simulation in the simulation tree structure.

You can also run all simulations in your current APSIMx file by pressing F5 or select Run from the pop-up menu when you right click the simulations in the simulation tree structure.

Improving model performance

A full whole-farm simulation in CLEM involves millions of calculations and a large number of simulated management decisions and selecting of individuals to determine outcomes. The amount of time required for the simulation is a result of the complexity built into your simulation and is accepted when performing final simulations. We have optimised the CLEM code to produce the fastest simulation times with most simulations running under 10 seconds and even large herd simulations under 3 minutes, but this will depend of population sizes and other aspects of the simulation. During development you will often undertake an iterative process of running the model, summarising and checking output, modifying parameters and re-running the model. In this process the faster the model runs between checking, the more efficient your model exploration process. This section explains some of the factors that result in increasing processing time and memory requirements and how you can create a simpler model for checking and final full model performance. It is also important that you have the most efficient model setup if performing multiple runs on high performance computers where you are paying for processing time.

You may find that you are happy with the simulation speed and you do not need to consider improving the model performance, but it is worth understanding what can be done to improve performance. Most of these suggestions relate to users simulating large ruminant grazing herd. Small household farms will be very efficient to run.

Simulation length

As expected there is a direct correlation between simulation length and the processing time. Reducing the simulation length during model exploration is a very efficient step. You may need to ensure that you run the simulation for long enough to pick up important events such as a drought, management activities, breeding etc.

Herd size

The individual-based model used by CLEM means that the herd size will significantly influence simulation length as many activities and processes must be performed on each individual. This is not really a concern in for herds less than 1000 individuals, but herds of 5-10,000 plus individuals will start to require longer simulations (2 minutes for 7-14,000 across 10 years). You need to ask in the development of the model whether you really need to simulate very large herds, or whether the same findings can be found by scaling up the simulation of a smaller herd.

Selecting individuals in a large herd

Many herd-based activities require the selection of individuals from the herd. This task requires each individual to be checked against the specified criteria. Even if this check is a quick process, repeating this for a number of filters across a very large herd will increase processing time. You should consider how many filter groups are needed in an activity.

Some activities such as the Feed ruminants activity need to perform a number of steps across the herd a number of times in order to arbitrate the available resources. Reducing the filter groups needed in a feed activity is a good way to increase performance when working with large herds. Performing the activity on the whole herd (Ruminant group with no filters) can be faster than on filtered groups.

Reporting results

The operation of reading and writing data to files is a lot slower than computing calculations. Therefore, writing data to reports can be a significant component of the simulation. Reducing the number of properties reported, time intervals to report, and the number of reports when not needed is a good option. This will both improve simulation time and reduce memory and space needed to store the data and ease of data analysis. Reports can easily be disabled when not needed.

You can think about what the report is reporting. Reports that provide individual data on large herds will be the slowest. Most small farm systems will not need to consider this.

The Report pivot is currently slow as it summarised the data and writes it to the database in a table. We are working to create a view that will work directly with the database for creating fast pivot tables.

See next section - Reporting and graphing model output