Skip to main content

8.1) Execution Skeleton


The next thing we need to program is the model’s schedule, the go procedure. The ODD description tells us that this model’s schedule includes two actions, performed by the turtles: determine the idea to install PV (only those without an existing PV installation) and calculate the investment (only those with the idea to install PV). For both procedures we are going to use submodels. Since we haven’t defined the PV-building-decision yet we need to add it first as an additional state variable to the turtles-own statement, and to set it to false in the create-turtles statement in the setup. We then use the primitive ask and with again to get a subset of agents to do something. The first subset is all agents without PV and the second is all agents which had a think about PV.

Add the following procedure:

to go
   ask turtles with [PV = false] [determine-idea-to-install-PV]
   ask turtles with [PV-building-decision] [calculate-balance-and-decide]
end
to determine-idea-to-install-PV
end
to calculate-balance-and-decide
end