Skip to content

Instantly share code, notes, and snippets.

@kevinchiu
Forked from anonymous/gist:3091
Created July 29, 2008 14:09
Show Gist options
  • Save kevinchiu/3092 to your computer and use it in GitHub Desktop.
Save kevinchiu/3092 to your computer and use it in GitHub Desktop.
def solar_rebates(state, electricity, PVcost, PVcapacity, PVtype)
#electricity is the total electricity produced in a year in kWh
#PVcapacity is the total power of the installation in kW
#PVtype is "residential" or "non-residential"
@tax_credit = 0.0
@rebate = 0.0
@production_credit = 0.0
@REC_sale = 0.0
@residential_rebate = 0.0
i = PVcost*0.3
if i <= 2000.0
fed_tax_credit = i
else
fed_tax_credit = 2000.0
end
case state
when "AL"
@production_credit = 0.15*electricity
if PVtype == "residential"
@residential_rebate = 500.0
end
when "AK"
if PVcapacity <= 25.0
@production_credit = 1.5*electricity
end
when "AZ"
if PVcost <= 1000.0
@tax_credit = 0.25*PVcost
end
when "AR"
when "CA"
@rebate = 2.5*PVcapacity*1000.0
when "CO"
when "CT"
if PVcapacity <= 5.0
@rebate = 5.0*PVcapacity*1000.0
else
@rebate = 25000.0 + (PVcapacity - 5.0)*4.3
end
if @rebate > 46500.0 and PVtype == "residential"
@rebate = 46500.0
end
@REC_sale = 0.03*electricity
when "DE"
if 0.4*PVcost <= 31500.0
@rebate = 0.4*PVcost
else
@rebate = 31500.0
end
when "FL"
if PVcapacity*4.0 <= 46500.0
@rebate = 4.0*PVcapacity
else
@rebate = 46500.0
end
when "GA"
@production_credit = 0.15*electricity
if PVtype == "residential"
@residential_rebate = 500.0
end
when "HI"
if PVcost*0.35 <= 5000.0
@tax_credit = 0.35*PVcost
else
@tax_credit = 5000.0
end
when "ID"
if 0.4*PVcost <= 5000.0
@tax_credit = 0.4*PVcost +3.0*0.2*PVcost
elsif 0.4*PVcost > 5000.0 and 0.2*PVcost <= 5000.0
@tax_credit = 5000.0 + 3*0.2*PVcost
else
@tax_credit = 20000.0
end
@REC_sale = 0.05*electricity
when "IL"
if PVcost*0.3 <= 10000.0 and PVcapacity > 0.8
@rebate = 0.3*PVcost
elsif PVcost*0.3 > 10000.0 and PVcapacity > 0.8
@rebate = 10000.0
end
when "IN"
when "IA"
@tax_credit = 0.015*electricity
when "KS"
when "KY"
@production_credit = 0.15*electricity
if PVtype == "residential"
@residential_rebate = 500.0
end
when "LA"
if PVcost*0.5 <= 25000.0
@tax_credit = PVcost*0.5
else
@tax_credit = 25000.0
end
when "ME"
if PVcapacity <= 2.0
@rebate = 3.0*PVcapacity*1000.0
elsif PVcapacity > 2.0 and PVcapacity <=3.0
@rebate = 6000.0 + (PVcapacity -2.0)*1000.0
else
@rebate = 7000.0
end
when "MD"
@tax_credit = 0.85*electricity
if PVcost*0.2 <= 3000.0
@rebate = 0.2*PVcost
else
@rebate = 3000.0
end
when "MA"
if PVcost*0.15 <=1000.0
@tax_credit = PVcost*0.15
else
@tax_credit = 1000.0
end
if PVcapacity*2000 <= 7200.0
@rebate = PVcapacity*2000.0
else
@rebate = 7200.0
end
@REC_sale = 0.03*electricity
when "MI"
when "MN"
if PVcapacity*2.25*1000.0 <= 20000.0
@rebate = PVcapacity*2.25*1000.0
else
@rebate = 20000.0
end
when "MS"
@production_credit = 0.15*electricity
if PVtype == "residential"
@residential_rebate = 500.0
end
when "MO"
when "MT"
if PVcost <= 500.0
@tax_credit = PVcost
else
@tax_credit = 500.0
end
@REC_sale = 0.05*electricity
when "NE"
when "NV"
when "NH"
when "NJ"
if PVcapacity <= 10.0
@rebate = 4.4*PVcapacity*1000.0
elsif PVcapacity > 10.0 and PVcapacity <= 30.0
@rebate = 44000.0 +3.45*(PVcapacity - 10.0)*1000.0
elsif PVcapacity > 30.0 and PVcapacity <= 60.0
@rebate = 113000.0 + 2.8*(PVcapacity - 30.0)*1000.0
else
@rebate = 197000.0 + 2.6*(PVcapacity - 60.0)*1000.0
end
@REC_sale = 0.2*electricity
when "NM"
if PVcost*0.3 - fed_tax_credit <= 9000.0
@tax_credit = PVcost*0.3 - fed_tax_credit
else
@tax_credit = 9000.0
end
when "NY"
if PVcost*0.25 <= 5000.0
@tax_credit = PVcost*0.25
else
@tax_credit = 5000.0
end
if PVcapacity <= 5.0
@rebate = PVcapacity*4.0*1000.0
elsif PVcapacity > 5.0 and PVcapacity <= 10.0
@rebate = 20000.0 + (PVcapacity - 5.0)*3.0*1000.0
else
@rebate = 35000.0
end
when "NC"
if PVcost*0.35 <= 10500.0
@tax_credit = PVcost*0.35
else
@tax_credit = 10500.0
end
@production_credit = 0.15*electricity
if PVtype == "residential"
@residential_rebate = 500.0
end
@REC_sale = 0.18*electricity
when "ND"
@tax_credit = PVcost*0.03*5.0
when "OH"
when "OK"
when "OR"
if PVcapacity*3.0*1000.0 <= 6000.0 and PVcapacity*3.0*1000.0 <= 0.5*PVcost
@tax_credit = PVcapacity*3.0*1000.0
elsif 6000.0 < 0.5*PVcost
@tax_credit = 6000.0
else
@tax_credit = 0.5*PVcost
end
if PVcapacity*2.0*1000.0 <= 10000.0
@rebate = PVcapacity*2.0*1000.0
else
@rebate = 10000.0
end
@REC_sale = 0.05*electricity
when "PA"
when "RI"
if PVcost*0.25 <= 15000.0
@tax_credit = PVcost*0.25
else
@tax_credit = 15000.0
end
@REC_sale = 0.06*electricity
when "SC"
if PVcost*0.25 <= 3500.0
@tax_credit = 0.25*PVcost
else
@tax_credit = 3500.0
end
when "SD"
when "TN"
@production_credit = 0.15*electricity
if PVtype == "residential"
@residential_rebate = 500.0
end
when "TX"
when "UT"
if PVcost*0.25 <= 2000.0
@tax_credit = PVcost*0.25
else
@tax_credit = 2000.0
end
when "VT"
if PVcapacity*1.75*1000.0 <= 8750.0
@rebate = PVcapacity*1.75*1000.0
else
@rebate = 8750.0
end
when "VA"
@production_credit = 0.15*electricity
if PVtype == "residential"
@residential_rebate = 500.0
end
when "WA"
if 0.12*electricity <= 2000.0
@rebate = 0.12*electricity
else
@rebate = 2000.0
end
@REC_sale = 0.05*electricity
when "WV"
when "WI"
if PVcost*0.25 <= 35000.0
@rebate = PVcost*0.25
else
@rebate = 35000.0
end
when "WY"
if PVcost*0.5 <= 3000.0
@rebate = PVcost*0.5
else
@rebate = 3000.0
end
end
@tax_credit = @tax_credit + fed_tax_credit
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment