我找不到代码中缺少的我,因此地图更新了

问题描述

我正在基于5年,1o年和15年的预测创建一个netlogo模型来研究对现有城市扩张景观的影响...我尝试在将其编码为一个更简单的模型之前基于地图,并且效果很好,但是当尝试将其合并到使用地图的版本中时,不同的投影不会更新,而且我找不到我的错误命名...也许有人可以呢?

我在模型的简单版本中首先写的是:(cobertura-urbana是一个选择器)

wasapisrc

然后我在另一个包含实际地图的模型中写的是:

patches-own 
[tipoDeUso]

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SETUP ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to setup
  ca
  setup-patches
  reset-ticks

end

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SETUP PROCEDURES ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to setup-patches
  ask patches [set pcolor yellow]
  ask n-of 250 patches [set pcolor orange]
  ask n-of 350 patches [set pcolor lime]
  ask n-of 450 patches with [pycor > 1] [ set pcolor green ]
  ask n-of 150 patches with [pxcor >= round (max-pxcor / 2) and pycor < 0][set pcolor grey ]
  ask n-of 150 patches with [pycor < 1 and pxcor > 0] [set pcolor lime]
  ask n-of 25 patches with [ pxcor = 3] [set pcolor blue]

  ask patches [initTipoDeUso]
  initEscenarioCoberturaUrbana
  ask patches [actualizarColor]
end

to initTipoDeUso
  if pcolor = grey [ set tipoDeUso "Urbano"]
  if pcolor = yellow [ set tipoDeUso "AgriculturaTemporal"]
  if pcolor = lime [ set tipoDeUso "AgriculturaRiego"]
  if pcolor = orange [ set tipoDeUso "Pastizal"]
  if pcolor = green [ set tipoDeUso "Bosque" ]
  if pcolor = blue [ set tipoDeUso "CuerposDeAgua"]
end
 
to initEscenarioCoberturaUrbana
  if cobertura-urbana = "proyeccion-5" [
    ask patches with [tipoDeUso = "Urbano" and any? neighbors4 with [ tipoDeUso = "AgriculturaTemporal" or tipoDeUso = "AgriculturaRiego" or tipoDeUso = "Pastizal"]][
      ask patches in-radius 1 [
        if random-float 1.00 <= 0.044 [
          set tipoDeUso "Urbano"
  ]]]]
  
  if cobertura-urbana = "proyeccion-10" [
    ask patches with [tipoDeUso = "Urbano" and any? neighbors4 with [ tipoDeUso = "AgriculturaTemporal" or tipoDeUso = "AgriculturaRiego" or tipoDeUso = "Pastizal"]][
      ask patches in-radius 1 [
        if random-float 1.00 <= 0.088 [
          set tipoDeUso "Urbano"
  ]]]]
  
  if cobertura-urbana = "proyeccion-15" [
    ask patches with [tipoDeUso = "Urbano" and any? neighbors4 with [ tipoDeUso = "AgriculturaTemporal" or tipoDeUso = "AgriculturaRiego" or tipoDeUso = "Pastizal"]][
      ask patches in-radius 1 [
        if random-float 1.00 <= 0.132 [
          set tipoDeUso "Urbano"
  ]]]]
end

to actualizarColor
  if tipoDeUso = "Urbano"              [ set pcolor grey ]
  if tipoDeUso = "AgriculturaTemporal" [ set pcolor yellow ]
  if tipoDeUso = "AgriculturaRiego"    [ set pcolor lime  ]
  if tipoDeUso = "Pastizal"            [ set pcolor orange ]
  if tipoDeUso = "Bosque"              [ set pcolor green ]
  if tipoDeUso = "CuerposDeAgua"       [ set pcolor blue ]
end

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)