8.9) PV Installation Decision (cont'd)
The complete calculate-balance-and-decide procedure should now looks like:
to calculate-balance-and-decide 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 if generation-cost-per-kWh < avoided-cost-per-kwh [ set PV true set color red set PV-age 0 ] end