Я пишу модель воды.Для каждого водопользования обновляются соленость и каротаж. Я установил различные типологии для фермеров, чтобы использовать поверхностные и подземные воды, поскольку в результате их водопользования они будут сталкиваться с каротажем и засолением.значения по мере роста тиков.Я просто хочу, чтобы они оставались до 10 на 200 тиков.Ниже приведены коды, которые я предоставил.Надеюсь, читатели не будут возражать, если я укажу детали.Вот интерфейс модели Спасибо
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