Skip to content

Instantly share code, notes, and snippets.

Created July 29, 2008 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/3091 to your computer and use it in GitHub Desktop.
Save anonymous/3091 to your computer and use it in GitHub Desktop.
def solar_rebates(state, pv_electricity, pv_cost, pv_capacity, pv_type)
#pv_electricity is the total pv_electricity produced in a year in kWh
#pv_capacity is the total power of the installation in kW
#pv_type 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 = pv_cost*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*pv_electricity
if pv_type == "residential"
@residential_rebate = 500.0
end
when "AK"
if pv_capacity <= 25.0
@production_credit = 1.5*pv_electricity
end
when "AZ"
if pv_cost <= 1000.0
@tax_credit = 0.25*pv_cost
end
when "AR"
when "CA"
@rebate = 2.5*pv_capacity*1000.0
when "CO"
when "CT"
if pv_capacity <= 5.0
@rebate = 5.0*pv_capacity*1000.0
else
@rebate = 25000.0 + (pv_capacity - 5.0)*4.3
end
if @rebate > 46500.0 and pv_type == "residential"
@rebate = 46500.0
end
@REC_sale = 0.03*pv_electricity
when "DE"
if 0.4*pv_cost <= 31500.0
@rebate = 0.4*pv_cost
else
@rebate = 31500.0
end
when "FL"
if pv_capacity*4.0 <= 46500.0
@rebate = 4.0*pv_capacity
else
@rebate = 46500.0
end
when "GA"
@production_credit = 0.15*pv_electricity
if pv_type == "residential"
@residential_rebate = 500.0
end
when "HI"
if pv_cost*0.35 <= 5000.0
@tax_credit = 0.35*pv_cost
else
@tax_credit = 5000.0
end
when "ID"
if 0.4*pv_cost <= 5000.0
@tax_credit = 0.4*pv_cost +3.0*0.2*pv_cost
elsif 0.4*pv_cost > 5000.0 and 0.2*pv_cost <= 5000.0
@tax_credit = 5000.0 + 3*0.2*pv_cost
else
@tax_credit = 20000.0
end
@REC_sale = 0.05*pv_electricity
when "IL"
if pv_cost*0.3 <= 10000.0 and pv_capacity > 0.8
@rebate = 0.3*pv_cost
elsif pv_cost*0.3 > 10000.0 and pv_capacity > 0.8
@rebate = 10000.0
end
when "IN"
when "IA"
@tax_credit = 0.015*pv_electricity
when "KS"
when "KY"
@production_credit = 0.15*pv_electricity
if pv_type == "residential"
@residential_rebate = 500.0
end
when "LA"
if pv_cost*0.5 <= 25000.0
@tax_credit = pv_cost*0.5
else
@tax_credit = 25000.0
end
when "ME"
if pv_capacity <= 2.0
@rebate = 3.0*pv_capacity*1000.0
elsif pv_capacity > 2.0 and pv_capacity <=3.0
@rebate = 6000.0 + (pv_capacity -2.0)*1000.0
else
@rebate = 7000.0
end
when "MD"
@tax_credit = 0.85*pv_electricity
if pv_cost*0.2 <= 3000.0
@rebate = 0.2*pv_cost
else
@rebate = 3000.0
end
when "MA"
if pv_cost*0.15 <=1000.0
@tax_credit = pv_cost*0.15
else
@tax_credit = 1000.0
end
if pv_capacity*2000 <= 7200.0
@rebate = pv_capacity*2000.0
else
@rebate = 7200.0
end
@REC_sale = 0.03*pv_electricity
when "MI"
when "MN"
if pv_capacity*2.25*1000.0 <= 20000.0
@rebate = pv_capacity*2.25*1000.0
else
@rebate = 20000.0
end
when "MS"
@production_credit = 0.15*pv_electricity
if pv_type == "residential"
@residential_rebate = 500.0
end
when "MO"
when "MT"
if pv_cost <= 500.0
@tax_credit = pv_cost
else
@tax_credit = 500.0
end
@REC_sale = 0.05*pv_electricity
when "NE"
when "NV"
when "NH"
when "NJ"
if pv_capacity <= 10.0
@rebate = 4.4*pv_capacity*1000.0
elsif pv_capacity > 10.0 and pv_capacity <= 30.0
@rebate = 44000.0 +3.45*(pv_capacity - 10.0)*1000.0
elsif pv_capacity > 30.0 and pv_capacity <= 60.0
@rebate = 113000.0 + 2.8*(pv_capacity - 30.0)*1000.0
else
@rebate = 197000.0 + 2.6*(pv_capacity - 60.0)*1000.0
end
@REC_sale = 0.2*pv_electricity
when "NM"
if pv_cost*0.3 - fed_tax_credit <= 9000.0
@tax_credit = pv_cost*0.3 - fed_tax_credit
else
@tax_credit = 9000.0
end
when "NY"
if pv_cost*0.25 <= 5000.0
@tax_credit = pv_cost*0.25
else
@tax_credit = 5000.0
end
if pv_capacity <= 5.0
@rebate = pv_capacity*4.0*1000.0
elsif pv_capacity > 5.0 and pv_capacity <= 10.0
@rebate = 20000.0 + (pv_capacity - 5.0)*3.0*1000.0
else
@rebate = 35000.0
end
when "NC"
if pv_cost*0.35 <= 10500.0
@tax_credit = pv_cost*0.35
else
@tax_credit = 10500.0
end
@production_credit = 0.15*pv_electricity
if pv_type == "residential"
@residential_rebate = 500.0
end
@REC_sale = 0.18*pv_electricity
when "ND"
@tax_credit = pv_cost*0.03*5.0
when "OH"
when "OK"
when "OR"
if pv_capacity*3.0*1000.0 <= 6000.0 and pv_capacity*3.0*1000.0 <= 0.5*pv_cost
@tax_credit = pv_capacity*3.0*1000.0
elsif 6000.0 < 0.5*pv_cost
@tax_credit = 6000.0
else
@tax_credit = 0.5*pv_cost
end
if pv_capacity*2.0*1000.0 <= 10000.0
@rebate = pv_capacity*2.0*1000.0
else
@rebate = 10000.0
end
@REC_sale = 0.05*pv_electricity
when "PA"
when "RI"
if pv_cost*0.25 <= 15000.0
@tax_credit = pv_cost*0.25
else
@tax_credit = 15000.0
end
@REC_sale = 0.06*pv_electricity
when "SC"
if pv_cost*0.25 <= 3500.0
@tax_credit = 0.25*pv_cost
else
@tax_credit = 3500.0
end
when "SD"
when "TN"
@production_credit = 0.15*pv_electricity
if pv_type == "residential"
@residential_rebate = 500.0
end
when "TX"
when "UT"
if pv_cost*0.25 <= 2000.0
@tax_credit = pv_cost*0.25
else
@tax_credit = 2000.0
end
when "VT"
if pv_capacity*1.75*1000.0 <= 8750.0
@rebate = pv_capacity*1.75*1000.0
else
@rebate = 8750.0
end
when "VA"
@production_credit = 0.15*pv_electricity
if pv_type == "residential"
@residential_rebate = 500.0
end
when "WA"
if 0.12*pv_electricity <= 2000.0
@rebate = 0.12*pv_electricity
else
@rebate = 2000.0
end
@REC_sale = 0.05*pv_electricity
when "WV"
when "WI"
if pv_cost*0.25 <= 35000.0
@rebate = pv_cost*0.25
else
@rebate = 35000.0
end
when "WY"
if pv_cost*0.5 <= 3000.0
@rebate = pv_cost*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