# Residential Solar PV Adoption 1.0

No preview image

Model was written in NetLogo 6.0
•
Viewed 774 times
•
Downloaded 46 times
•
Run 0 times

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)

Info tab cannot be displayed because of an encoding error

## Comments and Questions

Click to Run Model

globals [ percent-similar ;; on the average, what percent of a turtle's neighbors ;; are the same color as that turtle? percent-unhappy ;; what percent of the turtles are unhappy? current-cost ;; of solar, discounted in cents/kWH new-installations ;; the count of new installations occurring during a tick neighborhood-size ;; the radius that a residence examines for solar among its neighbors new-high-installations new-low-installations ;; See beginning of go for explanation. solar-low solar-high ;; Simply end points for plotting and reporting. ] turtles-own [ happy? ;; for each turtle, indicates whether at least %-similar-wanted percent of ;; that turtles' neighbors are the same color as the turtle similar-nearby ;; how many neighboring patches have a turtle with my color? other-nearby ;; how many have a turtle of another color? total-nearby ;; sum of previous two variables has-solar? getting-solar? solar-size ] breed [highs high-guy] breed [lows low-guy] breed [nones none-guy] to setup clear-all set solar-low -5 set solar-high 50 if number-of-residences > count patches [ user-message (word "This pond only has room for " count patches " turtles.") stop ] ;; create turtles on random patches. ask n-of number-of-residences patches [ let my-type random-float 1 ;; Here we are assuming three breeds of turtle residences. if my-type <= %-highs [sprout-highs 1 [ set color red ] ] if my-type > %-highs and my-type <= %-highs + %-lows [sprout-lows 1 [set color blue]] if my-type > %-highs + %-lows [sprout-nones 1 [set color yellow]] ] ask turtles [set shape "dot" set has-solar? false set getting-solar? false] ask patches [set pcolor 7] update-variables go-setup display-logistic set current-cost solar-PV-cost set neighborhood-size 3 ;; Note this is hard wired. Later, ;; consider adding a widget to explore different values. reset-ticks end to go-setup let mycount 0 while [not all? turtles [happy?] and mycount < 1000] [set mycount (mycount + 1) move-unhappy-turtles update-variables] end to move-unhappy-turtles ask turtles with [ not happy? ] [ find-new-spot ] end to find-new-spot rt random-float 360 fd random-float 10 if any? other turtles-here [ find-new-spot ] ;; keep going until we find an unoccupied patch move-to patch-here ;; move to center of patch end to update-variables update-turtles update-globals end to update-turtles ask turtles [ ;; in next two lines, we use "neighbors" to test the eight patches ;; surrounding the current patch set similar-nearby count (turtles-on neighbors) with [color = [color] of myself] set other-nearby count (turtles-on neighbors) with [color != [color] of myself] set total-nearby similar-nearby + other-nearby set happy? similar-nearby >= ( %-similar-wanted * total-nearby / 100 ) ] end to update-globals let similar-neighbors sum [similar-nearby] of turtles let total-neighbors sum [total-nearby] of turtles set percent-similar (similar-neighbors / total-neighbors) * 100 set percent-unhappy (count turtles with [not happy?]) / (count turtles) * 100 end to go set new-high-installations 0 ;; This will be our counter for the tick, to ;; record the number of new installations to the high (large) houses. set new-low-installations 0 ;; This will be our counter for the tick, to ;; record the number of new installations to the low (small) houses. set new-installations 0 ;; This will be our counter for the total number of ;; new installations during the tick/period. ;; Process first the highs, that is, the larger residences. ask highs [ ;; Does the residence already have solar? If so, then just skip ;; what follows and go on to the next one. if not has-solar? [ ;; OK, this residence does not have solar installed at this time. ;; Now, we will determine whether it will adopt solar during this period. ;; First, we need to determine if a neighborhood effect will happen. ;; From the Interface tab, neighborhood-effect is a positive floating ;; number, representing a cents per kWH effective cost reduction for solar ;; to the potential adopter. That is, we do this to model a positive effect ;; from having neighbors with solar already. ;; So, the value we want to use is either 0 if no one has solar or ;; neighborhood-effect if at least one residence nearby has solar. ;; Just to be a little clearer, the agent's probability of adopting solar ;; is a function of the solar cost - the utility price - the neighborhood effect. ;; Here, we either have 0 neighborhood effect, or the value neighborhood-effect (from the ;; Interface slider) depending upon whether there is at least one neighbor within 3 patches who ;; already has solar. let ne 0 if count turtles in-radius neighborhood-size with [has-solar? = true] > 0 [set ne neighborhood-effect] ;; Now determine whether this guy will in fact adopt solar this period. ;; Use the logistic (simple-mirrored-logistic) function/reporter to ;; determine its probability, draw the random number and if (and only if) ;; it is < the probabilty, install solar. ;; See below for the the-score reporter, but basically it calcuates ;; x = solar PV cost - current price from the utility - the neighborhood effect. ;; Then simple-mirrored-logistic, calculates the probability of adoption, given x and ;; k, the scaling parameter, and then L-scale compresses it overall. ;; We promise: more information in the Info tab. if random-float 1 < (simple-mirrored-logistic(the-score(solar-PV-cost)(current-price)(ne))(k) * L-scale) ;; So if indeed the guy installs PV this period, set its flag to say "I'm going to get solar" ;; (that is, getting-solar?) to true. Increment the number new high installations by 1. ;; And finally, call the get-solar-size reporter to determine what size solar the residence ;; is getting, and set its solar-size attribute to that value. [set getting-solar? true set new-high-installations (new-high-installations + 1) set solar-size get-solar-size(Prob_big_solar_given_high) ] ] ] ;; end of ask highs [ ;; OK, that completes the initial processing of the larger residences. ;; Now we repeat the same process for the smaller residences, the lows. ask lows [ if not has-solar? [ let ne 0 if count turtles in-radius neighborhood-size with [has-solar? = true] > 0 [set ne neighborhood-effect ] if random-float 1 < (simple-mirrored-logistic(the-score(solar-PV-cost)(current-price)(ne))(k) * L-scale) [set getting-solar? true set new-low-installations (new-low-installations + 1) set solar-size get-solar-size(Prob_big_solar_given_low) ] ] ] ;; Finally, we process all of the turtles, highs or lows, who ;; have adopted solar PV this period (if any). ask turtles with [getting-solar? = true] [ set new-installations (new-installations + 1) set has-solar? true set shape "sun" set size 1.1 set getting-solar? false] ;; Last of all, advance the tick counter, so we'll start a new period. tick end to-report get-solar-size [the-prob] let sol-sz 0 ifelse random-float 1 <= the-prob [set sol-sz 4] [set sol-sz 2] report sol-sz end ;;;;;;;; Below, from sok's Reporter Library NetLogo model. ;;;;;;;;;;;;;; to plotvectors [x y] ; Assumes a plot has been selected and ; made the current plot and been cleared. let dalength length x let dacount 1 while [dacount < dalength] [plotxy item dacount x item dacount y set dacount (dacount + 1)] end to-report linspace [dastart dastop numpoints] ;; Modeled after MATLAB's linspace. ;; Returns a list numpoints long consisting ;; of evenly spaced floating point numbers, ;; the first of which is start and the last ;; of which is stop. ;; Note that this reporter does no error checking. ;; However, it works properly with negative numbers ;; and going from both high to low and low to high. let toreport (list dastart) let increment ((dastop - dastart)) / (numpoints - 1) repeat numpoints - 1 [set toreport lput ((last toreport) + increment) toreport] report toreport end to-report simple-mirrored-logistic [x the-k] ;; Given the inputs, returns a probability value. ;; Fixing base and temperature, varying score yields ;; an "s"-shaped (sigmoid) curve, increasing in score. ;; See logistic curve. ;; See SOK's book Agents, Games, and Evolution, appendix B.4 ;; for explanation. See also: ;; http://mathworld.wolfram.com/LogisticEquation.html ;; Most directly, the logistic function: ;; http://en.wikipedia.org/wiki/Logistic_function ;; f(x) = 1 / (1 + e^(-k*x)) ;; where L is a proportionality constant. k is a constant ;; and x0 is a constant at which f(x) = 0.5 * L. report 1 - (1 / (1 + e ^ ( -1 * the-k * x))) ;; Notice we have 1 minus the normal function's value, because ;; as the cost of solar decreases, the probability of installation ;; increases. end to-report the-score [the-solarPVcost the-utilityPrice the-neighborhood-effect] report the-solarPVcost - the-utilityPrice - the-neighborhood-effect end to display-logistic ;; The general form of the logistic is ;; y = f(x) = L / (1 + e^(-k*x)) ;; where L is a scaling constant, which we set to 1 so we get a probability, ;; and k is a free parameter that affects the slope of the curve. ;; Notice that at x = 0, f(x) = 0.5 (assuming as we shall that L = 1). ;; And we want g(x), ;; g(x) = 1 - f(x). ;; We need to introduce more parameters here, as follows: ;; x = cs - pu - ne ;; With the following interpretations: ;; cs = cost of solar PV power in cents per kWH ;; pu = price of utility power in cents per kWH ;; Finally, ne is the neighborhood effect (a positive number), ;; which serves to reduce the value of x, and hence increase the probability ;; of adoption (as it increases). ;; So now we initialize the variables. ;; current-price taken from the Interface slider corresponds to pu, price from the utility ;; neighborhood-effect corresponds to ne and is taken from the Interface slider. set-current-plot "Probability of Adoption Function" clear-plot plot-simple-mirrored-logistic(L-scale) clear-output let solar-costs linspace(solar-low)(solar-high)(51) output-print (word "solar cost" " " "net score (x)" " " "p(x)") output-print (word "--------------------------------------") foreach solar-costs [ [?1] -> let x the-score(?1)(current-price)(0) ;; neighborhood-effect output-print (word precision ?1 2 "\t\t" precision x 2 "\t\t" precision (simple-mirrored-logistic(x)(k) * L-scale) 3) ] end to plot-simple-mirrored-logistic [da-scale] let the-solar-costs linspace(solar-low)(solar-high)(51) let davalues [] let a-score 0 foreach the-solar-costs [ [?1] -> set a-score the-score(?1)(current-price)(0) ;; neighborhood-effect set davalues lput (simple-mirrored-logistic(a-score)(k) * 10 * da-scale) davalues ] plotvectors(the-solar-costs)(davalues) end to scaled-display-logistic ;; The general form of the logistic is ;; y = f(x) = L / (1 + e^(-k*x)) ;; where L is a scaling constant, which we set to 1 so we get a probability, ;; and k is a free parameter that affects the slope of the curve. ;; Notice that at x = 0, f(x) = 0.5 (assuming as we shall that L = 1). ;; And we want g(x), ;; g(x) = 1 - f(x). ;; We need to introduce more parameters here, as follows: ;; x = cs - pu - ne ;; With the following interpretations: ;; cs = cost of solar PV power in cents per kWH ;; pu = price of utility power in cents per kWH ;; Finally, ne is the neighborhood effect (a positive number), ;; which serves to reduce the value of x, and hence increase the probability ;; of adoption (as it increases). ;; So now we initialize the variables. ;; current-price taken from the Interface slider corresponds to pu, price from the utility ;; neighborhood-effect corresponds to ne and is taken from the Interface slider. ;;plot-mirrored-logistic(-50)(50)(0)(temperature)(k-scale) set-current-plot "L-Scaled Probability of Adoption Function" clear-plot plot-simple-mirrored-logistic(L-scale) clear-output let solar-costs linspace(solar-low)(solar-high)(51) ;print percentages output-print (word "solar cost" " " "net score (x)" " " "p(x)") output-print (word "--------------------------------------") foreach solar-costs [ [?1] -> let x the-score(?1)(current-price)(0) ;; neighborhood-effect output-print (word precision ?1 2 "\t\t" precision x 2 "\t\t" precision (simple-mirrored-logistic(x)(k) * L-scale) 3) ] end

There are 2 versions of this model.

## Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.

Michiel van Dam

## Download the model

I would like to download the model, as part of my master thesis I'm making an Netlogo model concerning Solar PV and electricity storage. However, when I try to download the model, I get an error when I try to unzip it. I've tried it on multiple PCs. Can someone help me with this? Michiel

## Posted over 7 years ago

Steven Kimbrough

## Failed downloading

Hi, I just saw the previous message, just happened to be online. Well, I also just tested the download and it worked fine. I'd suggest downloading the zip file to your computer, then unzipping it, then run it. It just now worked fine for me. If you still have trouble, post a message with your email address and I'll send you the file directly.

## Posted over 7 years ago

Michiel van Dam

## unzip...

I tried this, during unzipping I still get an error, no clue why... Can you email it to me? michiel1234@hotmail.com Thanks a lot!

## Posted over 7 years ago

Hannah Sheldon

## Unzip Error (Question)

I'm also getting an error unzipping the model. Any chance you could email it to me? hsheldon@stevens.edu

## Posted over 2 years ago

Steven Kimbrough

## Just posted a version converted to NetLogo 6

From the comments I see that people are sometimes having trouble downloading the model. I don't know why. I use it in teaching regularly without a problem. Anyway I just posted a version that works with NetLogo 6. Cheers, Steve

## Posted over 2 years ago