11. Default Management

Top  Previous  Next

There's a special case of SimComponent in SIMPLACE named "DefaultManagement". It's dedicated to evaluate user-defined rules or expressions that are used to trigger some management interventions like sowing, harvesting, application of fertilizer or irrigation, etc. These rules can be specified using syntax from JEXL Rule Engine.

 

In contrast to regular SimComponents, the DefaultManagement has an action rule attribute and a management variable:

 

   <simcomponent id="Management" class="net.simplace.sim.components.DefaultManagement">

    <action rule="${CURRENT.DOY}==${parameter.DOYEM}">

      <description title="Determine sowing day of year">Sowing occurs when the actual model day equals the variable DOYEM.</description>

      <mgm id="DoSow" datatype="BOOLEAN" default="false" rule="true" />

    </action>

  </simcomponent>

 

The above SimComponent will set the value of variable Management.DoSow to true when the day of the year is equal to the parameter parameter.DOYEM via the expression:

 rule="${CURRENT.DOY}==${parameter.DOYEM}"

 

For every other day, the Management.DoSow will be set to its default value (default="false"). The variable Management.DoSow can be later used by other SimComponents.

 


 

Let's work on some DefaultManagement rules!

 

Task 11. You have a variable vFINISHTSUM = 2080, which determines when crop is harvested in the solution 11_DefaultManagement.sol.xml.

 

Make a rule that harvests on Lintul2.sTSUM >= vFINISHTSUM in the same solution. And output the result of the rule in the output file.

 

 Hints

  - Read the article linked above about rules.

  - See the training Adding outputs

 

 Solution

    Open the simplace_modules/test/training/solution/11_DefaultManagement_Answer.sol.xml to see how it should be done.

 

 

*ModelSolutions are found in simplace_modules\test\training\solution\1_WorkingWithSolutions