1

Hi folks I want my patch variable WTD to increase by the amount in turtle context in procedure watering-decisions . But if I write minus (-) random-float it get changed. Showed constant value otherwise. Pls, help.

    globals [TW  well-depth]
    Breed [farmers farmer]
    farmers-own [ WA sw FW WR  dws Logging salinity
    ] 
    patches-own [
    GW wtd ] ;water table depth and Groundwater
    to setup
       clear-all
        setup-farmers
        ask patches [
        set WTD depth-WT + 10
        set GW Ground-water + random-float 5.005  +  (100 / depth-wt)
        ]

      reset-ticks
      end
    to setup-farmers
    create-farmers num-farmers [move-to one-of patches
                                 set shape "person"
                                 set sw surface-water + random-float 5.0
                                 set dws random 100 + distance-from-water-source
                                set wr minwater-requirement + random 10
                                set logging  0
                                set salinity  0
                                ask patches in-radius 1 [set pcolor green]
                                set color Brown
                                       ]
 end
    to go      
      ask farmers [
                 check-wa
                 **watering-decisions**
                 update-water]
                 tick
    end
    to check-wa
    SET WA  (sw / distance-from-water-source) + sum [gw] of patches in-radius 
     end
      **to watering-decisions**
      if watering-decision = "zero-intelligence"
      [
        if wr > 0 [set wa wa - random-float 3
        set FW wa
        set logging  0.5 * dws + wtd / 0.5
        set salinity   1.5 * dws + wtd * 1.5
        set logging logging + 0.005
        set salinity salinity + 0.001
        ask patches in-radius 1 [set pcolor green
        **set wtd wtd -  random-float 0.9** ]
        set color red    
        ]]

      end

strong text

Sadaf
  • 163
  • 7
  • I don't understand what you mean by "But if I write minus (-) random-float it get changed". If you write `set wtd wtd - random-float 0.9` as you have in your ** code, NetLogo will generated a random number 0 to 0.9 and update the value of the wtd variable with the old value minus the random number. This changes the value of wtd (in the neighbouring patches). Is that not what you want? – JenB Mar 06 '18 at 10:10
  • Thanks for kind reply. Let me explain in detail. If I put a minus sign in primitive **set wtd wtd - random-float 0.9** then monitor for max WTD shows a changing value. but if I put a plus sign instead Monitor shows a constant value for max WTD. Why I am not getting a changing value every time? – Sadaf Mar 06 '18 at 10:17
  • 3
    You need a finer resolution debugging procedure than a monitor showing the maximum. Open an inspect window for one of the farmers with watering-decision of "zero-intelligence" and look at the values of wtd for that farmer's patch and the surrounding patches. Then run your go step once and look at the values again. Did they change the way you expected? If not, work your way backwards. This is not an error we can diagnose without access to the full model. – JenB Mar 06 '18 at 10:41

0 Answers0