Netlogo中图形变量中的指数值

时间:2018-05-31 18:50:02

标签: variables netlogo exponential

我正在写一个水模型。对于每一种水的使用,盐度和测井都在更新。我已经为农民设定了不同的类型,因为他们的用水会影响采伐和盐度。伐木和盐度的变量从非常小的值跃升到指数大滴答的价值上涨。我只是希望他们在200蜱中保持在10以下。 以下是我提供的代码。我希望读者不要介意我详细说明。这是模型enter image description here的界面 感谢

globals [TW  well-depth ]
Breed [farmers farmer]
farmers-own [ WA SW FW WR WD dws Logging salinity benefit-out]
patches-own [GW wtd ] ;water table depth and Groundwater
to setup
   clear-all
    setup-farmers
    ask patches [ ifelse random 3 = 0 [
    set WTD depth-WT + random-float 1
    set GW Ground-water + random-float 5.005  +  (100 / wtd)
    set pcolor blue
     ]

     [ set WTD depth-WT + 5 + random-float 5
       set GW Ground-water + random-float 5.005  +  (100 / wtd)
       set pcolor red]
        ]

  reset-ticks
end
to setup-farmers

create-farmers num-farmers [move-to one-of patches
                             set shape "person"
                             set sw surface-water + random 100.0
                             set dws random 100 + distance-from-water-source
  SET WA  (sw / dws) + sum [gw] of patches in-radius 1 
  set logging  0.005 * dws +  0.5 * wtd
  set salinity   .05 * dws + 0.5 * wtd
  set wd minwater-req + random-float 6.5
  set benefit-out 0
  ask patches in-radius 1 [set pcolor green]
  set color Brown
  if WTD = 0 [stop]
]
end
to go

  ask farmers [
   watering-decisions
  update-water
  ]

  tick

end
to watering-decisions 
  if watering-decision = "zero-intelligence"
  [ ifelse SW > WD [use-sw
                           set-wtd 
                           set logging logging + logging / wtd 
                           Set salinity salinity + salinity + 0.5 * wtd
                           Set benefit-out benefit-out + 100 / (logging + salinity) ]


                           [ ifelse (sw > 0.6 * WD) and  (sw < 0.75 * WD) [ifelse random 3 = 1 [use-Gw
                                                                           set wtd wtd + .01 + random-float 0.005
                                                                           set logging logging + logging / wtd
                                                                           set salinity salinity + 5 * (salinity / wtd) ; scale up values 0.5*10, 0.005* 10 
                                                                           set benefit-out benefit-out + 100 / (logging + salinity) ]
                                                                           [Use-sw
                                                                            set wtd  wtd + ( 0.01 + random-float 0.0005)
                                                                            set logging logging + logging / wtd
                                                                            Set salinity salinity + salinity + 0.5 * wtd
                                                                            Set benefit-out benefit-out + 100 / (logging + salinity)]]     
                                                                                       [ifelse (SW >= 0.5 * WD) and (sw <= 0.6 * WD)
                                                                                                    [ifelse random 1 = 0 [use-Gw
                                                                                                      set wtd wtd - .01 + random-float 0.05 
                                                                                                      set logging logging + logging / wtd
                                                                                                       Set salinity salinity + 5 * (salinity / wtd)
                                                                                                       Set benefit-out benefit-out + 100  / 1.5 * (logging + salinity) ]                                                                                                         [use-sw
                                                                                                           set wtd wtd + .01 + random-float 0.005                                                                                                               set logging logging + logging / wtd
                                                                                                           set salinity salinity + 5 * (salinity / wtd)
                                                                                                           set benefit-out benefit-out + 100 / (logging + salinity)]]
                                                                                                              [ifelse (SW >= 0.25 * WD) and (sw <= 0.3 * WD)
                                                                                                                [ ifelse random 3 = 1[use-sw
                                                                                                                  set wtd wtd + .001 + random-float 0.005
                                                                                                                   set logging logging + logging / wtd
                                                                                                                   set salinity salinity + 5 * (salinity / wtd)
                                                                                                                   set benefit-out benefit-out + 100 / (logging + salinity)]
                                                                                                                    [use-Gw
                                                                                                                      set wtd wtd - .1 + random-float 0.005
                                                                                                                      set logging logging + logging / wtd
                                                                                                                      set salinity salinity + 5 * (salinity / wtd)
                                                                                                                      Set benefit-out benefit-out + 100 / (logging + salinity)]]
                                                                                                                      [ if sw = 0  [use-gw
                                                                                                                                      set wtd wtd - 0.5 + random-float 0.005
                                                                                                                                      set logging logging + logging / wtd
                                                                                                                                      set salinity salinity + 0.5 * (salinity / wtd)
                                                                                                                                      Set benefit-out benefit-out + 100 / (logging + salinity) ]]]]]]
to use-GW
  set gw gw - random-float 1
end
to use-SW
  set sw sw - random-float 1
end
to  Update-water

end

to set-wtd
  set wtd wtd  + ( 0.01 + random-float 0.005)
  ask patches  in-radius 1 [ set wtd [wtd] of myself]

 end

0 个答案:

没有答案