Simulation tree

The simulation tree structure is at the core of modelling in the APSIM Next generation modelling environment. This tree structure is akin to the files and folders structure of Windows Explorer and other software packages you should be familiar with. The name "tree" comes from the branching appearance of this structured list of items. The terminology used to describe relationships between items (nodes) in a tree structure in computing is taken from the relationships in family trees with terms such as parent, child, children, descendant and ancestor used to describe the location and relationship between nodes or branches. Therefore any tree consists of parent nodes containing any number of child nodes, and each child node may itself be a parent of further child nodes. This structure allows for a clean and ordered presentation of related items.

In APSIM Next Generation models, including CLEM, each node in the simulation tree is a model (referred to as components in this documentation) with each providing some functionality towards the CLEM simulation. The types and arrangement of components added will determine the make-up of the system being simulated.

This example of a CLEM simulation shows the variety of components used to describe the system resources and all the activities to be performed. The resources are all found in the Resources Folder and displayed with brown icons while all the activities in the Activity Holder are teal. In this simulation, all the crop based activities have been placed in a folder named "Manage crops" which can be collapsed to simplify the view.

Allowing the user to build their own simulation tree provides the opportunity for the model to be flexible and customisable and the visual nature of this approach assists with this task. The rules regarding what children can be added to a parent also guides the correct placement of components. The CLEM modelling environment also provides a descriptive summary of the full simulation tree and how the simulation is parameterised when you have the main CLEM component selected.

Simulation file format

A JSON formatted text file stores the simulation tree details every time you save or run (save on run can be disabled in APSIM Next Generation) your simulation and is used to load your simulation tree structure whenever you open a simulation. This file is located in the directory you loaded the simulation from or first saved the simulation and has the *.apsimx file extension. The file can be opened and edited in a text file editor and you can easily identify the structure of the simulation and all properties stored in the simulation tree. This file can also be modified in code to produce batch simulations of CLEM.

Some upgrades of CLEM will require changes to your simulation file before you can open it in APSIM. These changes usually involve opening the file (SimulationName.apsimx) and changing details (usually a search and replace) before saving the corrected file and opening it in APSIM.

See next section - General tree structure