News About Us Support Bugs & Tasks Links
dklfgj dfgjmpsdklg dfgjdsklfg dfjglksdfjg sdfgjokdfjg dfgjoksdfjg sdfgjksdlfgjsdf gdgjopksdfgj

How to Build, Run and Graph a Simulation

RSS

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. Many sample weather files (e.g. Dalby) can be found in the apsim\met\sample directory under your apsim installation.

e.g. c:\program files\Apsim73 r1387\apsim\met\sample

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 Initial water.



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.

Initial water can also be specified directly on a layer by layer basis. See the SW column in the Initial Nitrogen node.

nb. by entering a date in the Initial Nitrogen component you are able to specify a measured soil water and/or nitrogen at any date during the simulation. APSIM will reset the soilwater and/or nitrogen to these values on that date and keep going with its simulation. If you leave the date blank, APSIM will assign it the initial start date of the simulation.

The starting nitrogen that a simulation initialises with can be found under the Initial Nitrogen 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)(by clicking in the respective "Total:" cells in the grid) 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 (Lower Limit/Wilting Point), KL and XF (Both KL and XF are root growth parameters) come under the soil. This is because they are soil properties even though they depend upon the specific crop.

Simulation management

The Manager folder component contains all the management rules for the simulation.

e.g.
  • sowing
  • fertilising
  • irrigation
  • tillage
  • resetting of water and nitrogen
  • rotations



These rules can be dragged from the Standard toolbox (under Management folder in the Standard toolbox) and dropped under a Manager folder within a paddock.





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

It is also possible to drag an Operations Schedule component from the Standard toolbox and drop it on a paddock. This component lets you exactly specify your own manager operations for 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.

Variables

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 bottom left 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 right pane gives you the variables that can be dragged onto the variable list in the left pane (adding them to the list; you can also double click them). 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? column 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 left pane. Other options include a (1-3) for the first 3 layers, or a (5) for the fifth layer. (click the ? button in the left pane for more information)

Reporting Frequency

The frequency of output is controlled by the Reporting Frequency sub component. The left pane contains a list of events. Whenever these specified events occur in the simulation, a line with the current values of the variables will be written to the output file.



In the example above, a line of output will be produced every time the simulation harvests a crop.

Just like with variables, use the "Component filter" drop down list on the right hand pane to see the events for each component that can be dragged to the left hand pane.

If you want Daily output this can be achieved by dragging end_day event to the left had pane. The end_day event can be found by selecting the clock component from the drop down list in the right 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 from the Standard toolbox (Or duplicate an existing outputfile). Each can then be configured 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

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 onto 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.



Running the Simulation(s)

Click the Run button on the toolbar at the top of your screen to run the simulation.

Something to note is, if you have multiple simulations, and you only wish to run one of them, just click on the simulation that you wish to run so that it is highlighted like Continuous Wheat1 is in the image above. Then click the Run button. This will cause only the Continuous Wheat1 simulation to run. If you wish to run both simulations, just click on the very top simulations component to highlight it and then click the run button. This will cause all the simulations in your tree 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.



Once the simulation has sucessfully run just click on the outputfile component to see your output file.

Note: The output file and summary files are just plain text files. As such the output files can be used as input for statistics software packages such as R, SYSTAT, MATLAB, GENSTAT etc. Also they can be opened in any text editor. After a run you will find the output files and summary files in the same folder that you have saved the simulation to. The user interface automatically names the output and summary file. It uses the simulation name in the tree (eg. Continuous Wheat Simulation) then adds the name of the output file (eg. outputfile)(nb. you are allowed to rename outputfile). The suffixes .out and .sum are used for the output and summary files respectively. This automatic naming ensures you can easily identify which output and summary files belong to which simulations.



Graphing the output and Exporting to Excel

If you do not already have a graph component in your simulation tree, then you can drag one there from the Graph toolbox.

There are different types of graph components availible allowing you to choose the type of graph you wish to use. In the image below we have choosen an XY graph component.



The graph component is able to find any output file on the same level or lower in the simulation tree. So dropping a graph component 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.

To graph the output file, first fully expand the graph component by clicking the + symbol next to the graph component then work your way up from the bottom configuring each sub component. You can usually ignore the very bottom component ApsimFileReader . Then to view the graph all you have to do is click the graph component. Depending up the type of graph component it was, you will see that type of graph in the properties pane.



APSIM has a button on the main application toolbar to send the output 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 button at the end of the main toolbar (at the top of the screen) gives quick access to the APSIM Documentation.

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 Module documentation.

NOTE: The documentation you get when you click on this button is a copy saved to your hard drive that came when you installed APSIM. It is provided for when you do not have an internet connection.

For a more up to date copy of the documentation please see the Documentation on our website (http://www.apsim.info/Wiki/APSIM-Documentation.ashx)
SiteSearch, Login/Logout, Account Settings, Create a new Page