Skip to main content

8.8) PV Installation Decision (cont'd)


rather define them as local variables. This seems to be a little cumbersome at first but will prove quite handy when extending the procedures.

In the calculate-balance-and-decide procedure insert the following lines before the if statement:

let total-cost PV-cost-per-m2 * roof-size
set PV-output insolation * patch-quality * PV-efficiency * roof-size
let generation-cost-per-kWh total-cost / (PV-output * PV-lifetime)
let avoided-cost-per-kwh grid-electricity-costs

The first line is a simple cost calculation (local variable total-cost) where we multiply the available roof size with the global parameter PV-cost-per-m2 which we have to define in the globals [ ] at the very beginning of the code, and set it to 300 £/m2 in the setup procedure. The second line calculates the annual electricity output from the panels by multiplying the patch variables insolation, patch-quality and roof-size, with a global PV-efficiency variable, which we have to define as well and set to 0.16 similar to the PV-cost-per-m2. With the local variable total-cost, the patch variable PV-output, and the global variable PV-lifetime we can calculate now the generation-cost-per-kWh in the third line. In the last line we simply set the local variable avoided-cost-per-kwh equal to the global variable grid-electricity-costs. Similar to the other two global variables we need to define grid-electricity-costs in globals [ ], and set it to 0.17 £/kWh in the setup procedure.

Hint: Use show, the agent monitor, or the command centre to test your code.