AusFarm how to
Useful tips for AusFarm
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
- This will trigger the TextOut component to query the values and write to the output file.
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
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 = weather.rain
set totalrain = total + thirtydayrainfall