Skip to main content

7.2) Variable Definition (cont'd)


For now turtles have no state variables. In Netlogo turtles know each variable of the patch their sitting on, so there is no need to define these. Patches store variables for their physical attributes like elevation, insolation, and patch quality, but as well for the house on the patch like roof-size, PV (to check if there is one), PV-age, and PV-output (which will allow us to calculate the solar power production of the region later on).

In the program, insert the following state variables of patches:

patches-own [
   elevation
   insolation
   patch-quality
   roof-size
   PV
   PV-age
   PV-output
]

If you are familiar with other programming languages, you might wonder where we tell NetLogo what type the variable “elevation” is. The answer is: NetLogo figures out the type from the first value assigned to the variable via the set primitive.