How to Build, Run and Graph a Simulation

Building, running and graphing simulations

Click on the New button and select a simulation that closest matches the simulation you're trying to create. For this example, choose Continuous Wheat Simulation.

Weather

The weather properties are located under the Met component in the simulation tree. There you will have the ability to browse to a weather file. Weather files need to be in APSIM format and should have a .met extension. A few sample weather files (e.g. Dalby) can be found in the \Examples\MetFiles directory under your apsim installation

e.g. C:\Program Files\Apsim70\Examples\MetFiles

Closely related to the weather file are the start and end date of simulation. These two properties can be found under the Clock component. They need to be within the range of the weather file. At this stage, to set the clock properties to include the entire climate record involves looking at the met file, taking note of the first and last date and entering those dates in the clock properties screen.

Soil

Picking a soil file involves finding a suitable soil from the Soils toolbox. To open the toolbox just click on the Soils button on the toolbar at the bottom of the window. The Soils toolbox has many soils to choose from.

Drag your chosen soil from the toolbox and drop into the paddock on the simulation tree. You can then delete the existing soil in the paddock as it is no longer needed. Once the soil has been dropped it can be modified by clicking on it and then modifying the parameters to the right.

Important:

  1. Once you have dragged your soil onto your simulation tree, you should rename it to something with a shorter name. Some soil names in the toolbox are too long and will cause your run to crash if it is not renamed to something shorter.

  2. It is important to remember that the soil must be parameterised for the crops that you're going to sow. If your simulation is going to sow wheat, then the soil must have LL, KL and XF values for wheat. These soil/crop values can be added to the soil but it is probably better to choose a soil that is already parameterised for the crops that you want.

The starting water that a simulation initialises with can be found by expanding the soil component in the simulation tree and then clicking InitWater.

The initial water can be specified in multiple ways by selecting one of the radio buttons and then entering a percent water or mm water. All changes made are automatically reflected in the graph on the right. By selecting Specify water as layered values, you are able to directly enter the values in the soil water grid.

The starting nitrogen that a simulation initialises with can be found under the InitNitrogen node under the soil in the Simulation tree.

A single value for amount of nitrate or ammonia can be entered for the whole profile (in kg/ha) or amounts for individual layers can be entered in the grid.

Surface Residues / Organic Matter

The parameters for the initial surface residues can be found under the surface organic matter component in the simulation tree.

The "Organic Matter pool name" is simply an alphabetic description of the residue pool. The more important parameters are the "Organic matter type" and "Initial surface residue", "C:N ratio of initial residue" and the "Fraction of residue standing".

Fertiliser

This component does not have any editable parameters. This component only needs to be present if you are going to be doing fertiliser applications in your simulation.

Crops

Crops can be dragged from the Standard Toolbox and dropped onto a paddock. A crop can be deleted by selecting it and pressing Delete. Crops typically don't have any editable parameters. It is important to remember that the crop parameters LL, KL and XF come under the soil.

Simulation management

The Manager component contains all the management options for the simulation e.g.

These options can be dragged from the Standard toolbox (under Manager) and dropped under a Manager component within a paddock.

The properties of the management option can then be edited on the right. The management options in the toolbox cover the same sort of functionality as the older APSFront software.

It is also possible to drag a Logic component from the Standard toolbox and drop it on a paddock. This component lets you exactly specify your own manager logic for a sowing, harvesting etc. This will be familar to you if you have used control / parameter files in the past.

Reporting

APSIM is capable of producing an ASCII space separated output file containing whatever APSIM variables you want. In fact you need to exactly specify which variables you want output to the file. This is all configured from the Outputfile component. Expand the outputfile component and click Variables

The top pane allows you to enter some text to put at the top of the output file. This is usually used to put some constant values that you have used in your simulation.

The middle pane lists which variables are to go into the output file (date, biomass yield etc) as columns. These variables can be deleted and reordered up and down in the same way as the components in the simulation.

The bottom pane gives you the variables that can be dragged onto the variable list in the middle pane (adding them to the list)(nb. you can also just double click on the variable name to add it to the list). The variables are grouped according to the components currently plugged into the simulation. To see the variables belonging to each component, simply choose the component from the "Component filter" drop down list.

Some variables are layer variables or profile variables e.g. extractable soil water. Look for "Yes" or "No" in the Array? to see if a variable is or not. These variables that are, when dropped onto the variable list will produce a number for each layer in the output file. If you want the sum of all layers, put a () in alongside the variable name in the Variable name column of the middle pane. Other options include a (1-3) for the first 3 layers, or a (5) for the fifth layer. (click the ? button in the middle pane for more information)

The frequency of output is controlled by the "Reporting Frequency" sub component. The top pane contains a list of events and whenever one of these events occur in the simulation a line with the current values of the variables will be written to the output file.

In this example, a line of output will be produced every time APSIM harvests a crop. Daily output can be achieved by dragging Daily from the Global component list of events in the bottom pane. Just like with variables, use the "Component filter" drop down list to see the events for each component that can be dragged to the top pane.

APSIM is also capable of producing multiple output files. The user simply needs to drag and drop multiple outputfile components onto the simulation tree. Each can then be configuring independently.

Precisely specifying outputs can quickly become tedious. If you frequently use common outputs, why not create a toolbox and drag your configured outputfile component and drop it onto your toolbox. You can then easily reuse this configured outputfile in your next simulation. To see how to do this, read the overview on toolboxes.

Multiple simulations; creating / saving and running them

Simulations can be saved to any folder by clicking the Save button. Likewise, running a simulation is as simple as clicking Run on the button bar. The user interface is capable of hosting multiple simulations within the single simulation tree. The example we've been working through here has a single simulation called Continuous Wheat. You can add another simulation by simply dragging this simulation and dropping it back on the top level node Simulations, a copy will be made and there will be two simulations in the simulation tree.

Notice the second simulation called Continuous Wheat1 at the bottom. This simulation will be identical to the first simulation. Usually you would change a parameter in the second simulation to see what effect this parameter has on the result compared with the first simulation. Before you run the simulations the second simulation should be renamed to a more suitable name. Clicking Run in this situation will cause both simulations to be run.

Often APSIM will produce a fatal error as a result of an invalid configuration or parameterisation. In this instance, it is important to consult the summary file that APSIM produces. Clicking on the summaryfile component will give quick access to the contents of this file. When looking for errors, always scroll down to the first error and fix that first.

NOTE: The user interface keeps track of output and summary file names automatically. It uses the simulation name in the tree (eg. Continuous Wheat) for the output / summary file name. This ensures names of output and summary files are always kept in sync with the name of the simulation. The suffixes .out and .sum are used for the output and summary files respectively. After a run you will find them in the same folder that you have saved the simulation to.

Graphing the output and Exporting to Excel

To graph the output file, you can drag a graph component in to your simulation tree from the Graph toolbox. There are different types of graph components availible allowing you to choose the type of graph you wish to use.

By default the graph component is able to find any output file on the same level or lower in the simulation tree as itself. So dropping a graph control on the top Simulations node will allow it to find all the output files in all the simulations. Dropping on a specific simulation will allow it to find all the output files in the simulation and dropping it on a paddock will allow it to find all of them in that paddock. If you just drop it on a specific output file it will only be able to find that outputfile.

Once you have added the graph component to your simulation tree, you can expand the nodes of this component to see the child components. To configure the graph component the general rule is to start at the bottom most child component and work your way back up towards the graph component. Each different type of graph component is slightly different in what child components it has, however generally at the bottom you will select which .out files you want to graph, and then as you go up you will choose what columns and data from the .out files you want to plot.

To find out how to modify a graph see How To: Modify a Graph component

You can also create a graph by using the Insert a new graph button on the main application toolbar. This will allow you to create a graph using the Graph Wizard.

There is also a button on the main toolbar to send an .out file to Microsoft Excel. To send an output file or multiple output files to Excel, just select them in the simulation tree and click the Excel button

The help system

The Help button on the main toolbar provides access to help information and tools.

A lot of documentation, including the science documentation and how some of the modules perform at different locations (i.e. sensibility tests), can be found under Documentation.

There is a link to the Apsim Google Search Engine which allows for the searching of our apsim.info website using a customised google search engine.

There is a link to the Apsim Google Group for asking questions of the Software Engineering Group, Apsim Module Developers or just other Apsim users.