Skip to main content

8.3) PV Installation Idea


Now we can step ahead again by implementing the two submodels (determine-idea-to-install-PV and calculate-balance-and-decide) of the go procedure. We will do one at a time. House owners without PV (we already specified that in the go procedure where we call the determine-idea-to-install-PV method) determine the idea to install PV based on how many neighbours have one, or in 0.1% percentage in general. The output of the method is setting the PV-building-decision to true so that turtles become available for the calculate-balance-and-decide submodel afterwards.

The percentage part is fairly simple to do with an if statement and a random-float reporter. The neighbour effect is a bit more difficult. We use an if statement as well with the conditional statement checking whether the fraction of neighbours in a certain radius with a PV is higher than a the global variable neighbor-threshold. To do that we count neighbour patches within the sensing radius which have houses on them with PV, using some helpful NetLogo primitives, such as in-radius, neighbors, any? and turtles-here. Look them up individually in the dictionary and try to understand the combined statements count neighbors with [PV and any? turtles-here] in-radius sensing-radius and count neighbors with [any? turtles-here] in-radius sensing-radius.

To implement this process, add this code to the determine-idea-to-install-PV procedure:

if random-float 1 < 0.001 [set PV-building-decision true]
if (count neighbors with [PV and any? turtles-here] in-radius sensing-radius /
     count neighbors with [any? turtles-here] in-radius sensing-radius) > neighbor-threshold
     [set PV-building-decision true]