AusFarm how to
Useful tips for AusFarm
1. Report to a text file at certain event times
Sometimes it is useful to output summary data at certain times in the simulation that may not be regular such as daily or monthly. This can be done by simply writing a few lines in a Manager script. Here are the steps involved in handling an event such as harvest.
- Add a Textout component to the simulation.
- Right click on it and choose sequence.
- Now uncheck the subscribed event update_outputs.
- Click OK and save the changes. The Textout component now has to be triggered by something other than the Sequencer component.
- Now write the Manager script fragment as below.
- each 30 Jun
{
TextOut.update_outputs
} - This will trigger the TextOut component to query the values and write to the output file.
2. Accumulate rainfall over a period in Manager script
define const integer RAIN_WINDOW = 30 ! days window for rain total
define real thirtydayrainfall[RAIN_WINDOW]
define real totalrain = 0.0 ! rainfall sum used to trigger irrigation
! subroutine to recalculate recent rain total
subroutine calcRainConditions()
{
define real total
define integer d
! —————————————————————-
! calculate the amount of rain that has fallen in the last 30 days
set total = 0
set d = RAIN_WINDOW
while d > 1
{
set thirtydayrainfall[d] = thirtydayrainfall[d-1]
set total = total + thirtydayrainfall[d]
set d = d – 1
}
set thirtydayrainfall[1] = weather.rain
set totalrain = total + thirtydayrainfall[1]
}
from start
{
call calcRainConditions
}