add task       

Task ID:  1052  create some better irrigation rules for users    
 
Created by ver078 on 2009-11-19 12:46 PM, 291 days ago
Project:  Module Code
Category:  Minor
Priority:  high
Assigned to:  ver078  
Status:  1. Submitted
Apsim Version:
Your Name:
Contact Details:
 
  Comment: Entering "bugid#999" in comment creates link to id 999
 

show inline images      show change history

 comment 31175 posted by ver078 on 2009-11-19 1:01 PM, 291 days ago    forward

For some reason I can't add attachments anymore. So I have entered the code from a Toolbox that contains irrigation rules that I created at the Apsim Training Course on 17-18 Nov 2009. Just add more features to these ones.
 comment 31174 posted by ver078 on 2009-11-19 12:59 PM, 291 days ago    forward
<folder version="17" name="Micheals Toolbox">
  <manager name="irrigate at sw deficit">
    <ui>
      <trigger type="text" description="Enter sw deficit to irrigate at (mm)">50</trigger>
    </ui>
    <script name="init">
      <text>
      </text>
      <event>init</event>
    </script>
    <script name="start_of_day">
      <text><![CDATA[

if sw_dep() > [trigger] then       
irrigation apply amount = [trigger]
endif]]></text>
      <event>start_of_day</event>
    </script>
    <script name="end_of_day">
      <text>
      </text>
      <event>end_of_day</event>
    </script>
  </manager>
  <manager name="Irrigate on fixed date1">
    <ui>
      <category description="When should irrigation be applied" />
      <numberofdays type="text" description="If rainfall over the past number of days">7</numberofdays>
      <x type="text" description="Is less than">100</x>
      <category description="This will happen" />
      <irrigate_module type="modulename" description="Module used to apply the irrigation : ">Irrigation</irrigate_module>
      <y type="text" description="The irrigation to apply will be this number minus rainfall over last number from above days">100</y>
      <irrigate_efficiency type="text" description="Irrigation efficiency (0-1) : ">1</irrigate_efficiency>
    </ui>
    <script name="start_of_day">
      <text><![CDATA[
            if (start_week = 1) then
            if (rain[[numberofdays]] < [x]) then
               '[irrigate_module]' set irrigation_efficiency = [irrigate_efficiency]
               tony = [x] - rain[[numberofdays]]
                '[irrigate_module]' apply amount = tony (mm)
            endif
            endif]]></text>
      <event>start_of_day</event>
    </script>
  </manager>
  <manager name="Irrigate on monday">
    <ui>
      <category description="When should irrigation be applied" />
      <pastdays type="text" description="If rainfall over the past number of days">7</pastdays>
      <EnoughRain type="text" description="Is less than (mm)">100</EnoughRain>
      <category description="This will happen" />
      <irrigate_module type="modulename" description="Module used to apply the irrigation : ">Irrigation</irrigate_module>
      <irrigate_efficiency type="text" description="Irrigation efficiency (0-1) : ">1</irrigate_efficiency>
    </ui>
    <script name="start_of_day">
      <text><![CDATA['Every monday check and if not enough rain has occured then irrigate. Irrigate with the amount that is missing
  if (start_week = 1) then
            if (rain[[pastdays]] < [EnoughRain]) then
               '[irrigate_module]' set irrigation_efficiency = [irrigate_efficiency]
               difference = [EnoughRain] - rain[[pastdays]]
                '[irrigate_module]' apply amount = difference (mm)
            endif
  endif]]></text>
      <event>start_of_day</event>
    </script>
  </manager>
  <manager name="Irrigate based on enough rain">
    <ui>
      <category description="When should irrigation be applied" />
      <pastdays type="text" description="If rainfall over the past number of days">7</pastdays>
      <EnoughRain type="text" description="Is less than (mm)">100</EnoughRain>
      <category description="This will happen" />
      <irrigate_module type="modulename" description="Module used to apply the irrigation : ">Irrigation</irrigate_module>
      <irrigate_efficiency type="text" description="Irrigation efficiency (0-1) : ">1</irrigate_efficiency>
      <irrigcycle type="text" description="number of days in irrigation cycle">7</irrigcycle>
    </ui>
    <script name="start_of_day">
      <text><![CDATA[!if not enough rain has occured then irrigate. Irrigate with the amount that is missing


if (dai > [irrigcycle]) then
            if (rain[[pastdays]] < [EnoughRain]) then
               '[irrigate_module]' set irrigation_efficiency = [irrigate_efficiency]
               difference = [EnoughRain] - rain[[pastdays]]
                '[irrigate_module]' apply amount = difference (mm)
                 dai = 0
            endif
endif

dai = dai + 1]]></text>
      <event>start_of_day</event>
    </script>
    <script name="init">
      <text>
dai = 0
</text>
      <event>init</event>
    </script>
  </manager>
</folder>
 comment 31172 posted by ver078 on 2009-11-19 12:46 PM, 291 days ago    forward
The irrigation rules in the GUI are not really good enough for users. Rather then having to build ones for every new user who asks, we should probably provide some good useful ones for them in the toolbox. Things they usually ask for are things like, allowing the user to enter an "irrigation cycle" (this is the time taken for farmer to move his irrigation equipment around each of his paddock. This should restrict how many days you can have between irrigation). Also triggering irrigation based on sw deficit, also setting the amount of irrigation to apply to be the sw deficit so that it will vary the amount of irrigation each time.