Adding extra tests to planting rules

Adding extra conditions and actions to a crop management component

The “standard” crop management component does not present many options for deciding when to sow a crop – it’s quite probable that an array of extra rules should be considered for planting (eg. is the soil dry enough to drive a tractor over?), and that extra actions (eg. add some fertiliser) should be undertaken at sowing.

Unfortunately, the logic that implements this decision is hidden away in the code of the management component, and is not simple to modify (though users are encouraged to learn how).

The monoculture sequencer exists solely to allow the addition of extra tests and actions to the standalone crop management component. Using it is trivial:

1.   Create a new continuous wheat simulation. Ensure the ‘Must Sow’ parameter is set (to ‘yes’) in the crop management component.

2.   Add the variables ‘year’ and ‘day’ to an empty outputfile

3.   Duplicate the simulation and rename the second as ‘Continuous Wheat delay sow’. Open the manager folder.

4.   Add a Monoculture Sequencer from the management toolbox, and move up so that it is the first item in the manager folder.

5.   Add a ‘Wait for dry surface’ from the management toolbox, set check that the threshold parameter is 35mm. This component simply calculates a variable ‘IsDry’ – whether the soil surface is less than 35mm – that the sequencer will use.

6.   In the Monoculture Sequencer UI, there’s a button at the top ‘Variables and Events’. This button opens a dialog that we can use to find the name of the variable we’ll be using for the extra tests. In the component filter at the top of the dialog, select the ‘Wait for dry surface’ component. Below should appear a single variable ‘IsDry’ – this is what needs to be added to the first ‘Extra Test’ line of the sequencer. Type the full ‘dotted’ notation into the Monoculture Sequencer as shown:

The background to the sequencing component is that it will ask the crop management component each day whether it can plant the crop. If so, then it gets the ‘Test 1’ value from the system (‘IsDry’). If that value is non-zero, it will then plant the crop. If there are any actions listed (ie events sent to the system) they will be sent out as well.

7.   Run both simulations and graph the sowing dates from both simulations on a bar chart called Sowday (X is year, Y is day).

8.   Is there a delayed planting in the second simulation? If you turn off the ‘Must sow’ flag on both simulations, do they plant in every year?

9.   We’ve implemented a logical ‘and’ operator – both conditions must be satisfied at the same time. To explore how an ‘or’ operator can be implemented, make a copy of the second (wait for dry surface) simulation, drag a ‘Rotation Management’ component from the management toolbox into the management folder. Also drag a ‘dayIs’ component into the folder. Remove the Monoculture sequencer.

10.  In the directed graph component, delete the summer_fallow node, and the chickpea node. Rename the summer_fallow2 node to simply ‘fallow’. Check the paddock box, and set the initial state to fallow.

11.  On the arc from wheat to fallow, remove all references to summer_fallow.  Make an new arc from this fallow node to the wheat node, and click in the ‘Rules’ box, then in the component filter, find the Crop Management module. Double click the ‘canEnter’ rule. Find the “Wait for dry surface” node, and bring across the ‘IsDry’ rule. Click in the Actions box, find the Crop Management module, bring across the ‘Enter’ rule.

12.  At this point, the behaviour should be the same as the first simulation.

13.  Make another arc from the fallow node to the wheat node. For its Rules, find the ‘dayIs.dayIs’ rule. For its actions, select ‘Crop Management.Enter’.

14.  In the ‘dayIs’ rule, change the date to 11-jul – the day after the sowing window closes.

15.  Run the simulation and compare all three.