class URBANopt::Reporting::DefaultReports::DistributedGeneration
Onsite distributed generation system (i.e. SolarPV
, Wind
, Storage
, Generator
) design attributes and financial metrics.
Attributes
Float - Annual percentage of electricity supplied by renewable sources
Array - List of Generator systems
Float - Lifecycle costs for the complete distributed generation system in US Dollars
Float - Lifecycle costs for the complete distributed generation system in US Dollars
Float - Net present value of the complete distributed generation system in US Dollars
Float - Average probability the system can sustain critical load during a grid outage
Float - Average hourly probabiliies that the system can sustain critical load during a grid outage
Float - Average monthly probabiliies that the system can sustain critical load during a grid outage
String - Filepath of reopt assumptions file used, if known
Float - Average hour the system can support critical load during a grid outage
Float - Maximum hour the system can support critical load during a grid outage
Float - Minimum hour the system can support critical load during a grid outage
Array - List of SolarPV systems
Array - List of Storage systems
Float - Total lifetime demand costs in the business as usual scenario (i.e no new system) after tax, us dollars
Float - Total demand costs in US Dollars over the life of the system after tax
Float - Total lifetime energy costs in the business as usual scenario (i.e no new system) after tax, us dollars
Float - Total energy costs in US Dollars over the life of the system after tax
Float - Installed generator capacity
Float - Installed solar PV capacity
Float - Installed storage capacity
Float - Installed storage capacity
Float - Installed wind capacity
Array - List of Wind systems
Float - Year one demand energy bill in the business as usual scenario (i.e no new system), us dollars
Float - Total amount paid to the utility in US Dollars in the first year of operation
Float - Year one demand cost in the business as usual scenario (i.e no new system), us dollars
Float - Total amount paid in utility demand charges in US Dollars in the first year of operation
Float - Year one energy cost in the business as usual scenario (i.e no new system) after tax, us dollars
Float - Total amount paid for utility energy in US Dollars in the first year of operation
Public Class Methods
Merge a distributed generation system with a new system
# File lib/urbanopt/reporting/default_reports/distributed_generation.rb, line 417 def self.merge_distributed_generation(existing_dgen, new_dgen) existing_dgen.annual_renewable_electricity_pct = add_values(existing_dgen.annual_renewable_electricity_pct, new_dgen.annual_renewable_electricity_pct) existing_dgen.lcc_us_dollars = add_values(existing_dgen.lcc_us_dollars, new_dgen.lcc_us_dollars) existing_dgen.lcc_bau_us_dollars = add_values(existing_dgen.lcc_bau_us_dollars, new_dgen.lcc_bau_us_dollars) existing_dgen.npv_us_dollars = add_values(existing_dgen.npv_us_dollars, new_dgen.npv_us_dollars) existing_dgen.year_one_energy_cost_us_dollars = add_values(existing_dgen.year_one_energy_cost_us_dollars, new_dgen.year_one_energy_cost_us_dollars) existing_dgen.year_one_demand_cost_us_dollars = add_values(existing_dgen.year_one_demand_cost_us_dollars, new_dgen.year_one_demand_cost_us_dollars) existing_dgen.year_one_bill_us_dollars = add_values(existing_dgen.year_one_bill_us_dollars, new_dgen.year_one_bill_us_dollars) existing_dgen.total_energy_cost_us_dollars = add_values(existing_dgen.total_energy_cost_us_dollars, new_dgen.total_energy_cost_us_dollars) existing_dgen.total_demand_cost_us_dollars = add_values(existing_dgen.total_demand_cost_us_dollars, new_dgen.total_demand_cost_us_dollars) existing_dgen.year_one_energy_cost_bau_us_dollars = add_values(existing_dgen.year_one_energy_cost_bau_us_dollars, new_dgen.year_one_energy_cost_bau_us_dollars) existing_dgen.year_one_demand_cost_bau_us_dollars = add_values(existing_dgen.year_one_demand_cost_bau_us_dollars, new_dgen.year_one_demand_cost_bau_us_dollars) existing_dgen.year_one_bill_bau_us_dollars = add_values(existing_dgen.year_one_bill_bau_us_dollars, new_dgen.year_one_bill_bau_us_dollars) existing_dgen.total_energy_cost_bau_us_dollars = add_values(existing_dgen.total_energy_cost_bau_us_dollars, new_dgen.total_energy_cost_bau_us_dollars) existing_dgen.total_demand_cost_bau_us_dollars = add_values(existing_dgen.total_demand_cost_bau_us_dollars, new_dgen.total_demand_cost_bau_us_dollars) existing_dgen.resilience_hours_min = add_values(existing_dgen.resilience_hours_min, new_dgen.resilience_hours_min) existing_dgen.resilience_hours_max = add_values(existing_dgen.resilience_hours_max, new_dgen.resilience_hours_max) existing_dgen.resilience_hours_avg = add_values(existing_dgen.resilience_hours_avg, new_dgen.resilience_hours_avg) existing_dgen.probs_of_surviving = add_values(existing_dgen.probs_of_surviving, new_dgen.probs_of_surviving) existing_dgen.probs_of_surviving_by_month = add_values(existing_dgen.probs_of_surviving_by_month, new_dgen.probs_of_surviving_by_month) existing_dgen.probs_of_surviving_by_hour_of_the_day = add_values(existing_dgen.probs_of_surviving_by_hour_of_the_day, new_dgen.probs_of_surviving_by_hour_of_the_day) new_dgen.solar_pv.each do |pv| existing_dgen.solar_pv.push pv if existing_dgen.total_solar_pv_kw.nil? existing_dgen.total_solar_pv_kw = pv.size_kw else existing_dgen.total_solar_pv_kw += pv.size_kw end end new_dgen.wind.each do |wind| existing_dgen.wind.push wind if existing_dgen.total_wind_kw.nil? existing_dgen.total_wind_kw = wind.size_kw else existing_dgen.total_wind_kw += wind.size_kw end end new_dgen.storage.each do |storage| existing_dgen.storage.push storage if existing_dgen.total_storage_kw.nil? existing_dgen.total_storage_kw = storage.size_kw existing_dgen.total_storage_kwh = storage.size_kwh else existing_dgen.total_storage_kw += storage.size_kw existing_dgen.total_storage_kwh += storage.size_kwh end end new_dgen.generator.each do |generator| existing_dgen.generator.push generator if existing_dgen.total_wind_kw.nil? existing_dgen.total_generator_kw = generator.size_kw else existing_dgen.total_generator_kw += generator.size_kw end end return existing_dgen end
Initialize distributed generation system design and financial metrics.
-
Technologies include
:solar_pv
,:wind
,:generator
, and:storage
. -
Financial metrics include
:lcc_us_dollars
,:npv_us_dollars
,:year_one_energy_cost_us_dollars
,:year_one_demand_cost_us_dollars
,
:year_one_bill_us_dollars
, and :total_energy_cost_us_dollars
- parameters:
-
hash
- Hash - A hash containing key/value pairs for the distributed generation system attributes listed above.
# File lib/urbanopt/reporting/default_reports/distributed_generation.rb, line 180 def initialize(hash = {}) hash.delete_if { |k, v| v.nil? } @annual_renewable_electricity_pct = hash[:annual_renewable_electricity_pct] @lcc_us_dollars = hash[:lcc_us_dollars] @lcc_bau_us_dollars = hash[:lcc_bau_us_dollars] @npv_us_dollars = hash[:npv_us_dollars] @year_one_energy_cost_us_dollars = hash[:year_one_energy_cost_us_dollars] @year_one_energy_cost_bau_us_dollars = hash[:year_one_energy_cost_bau_us_dollars] @year_one_demand_cost_us_dollars = hash[:year_one_demand_cost_us_dollars] @year_one_demand_cost_bau_us_dollars = hash[:year_one_demand_cost_bau_us_dollars] @year_one_bill_us_dollars = hash[:year_one_bill_us_dollars] @year_one_bill_bau_us_dollars = hash[:year_one_bill_bau_us_dollars] @total_energy_cost_us_dollars = hash[:total_energy_cost_us_dollars] @total_energy_cost_bau_us_dollars = hash[:total_energy_cost_bau_us_dollars] @total_demand_cost_us_dollars = hash[:total_demand_cost_us_dollars] @total_demand_cost_bau_us_dollars = hash[:total_demand_cost_bau_us_dollars] @resilience_hours_min = hash[:resilience_hours_min] @resilience_hours_max = hash[:resilience_hours_max] @resilience_hours_avg = hash[:resilience_hours_avg] @probs_of_surviving = hash[:probs_of_surviving] @probs_of_surviving_by_month = hash[:probs_of_surviving_by_month] @probs_of_surviving_by_hour_of_the_day = hash[:probs_of_surviving_by_hour_of_the_day] # optional @reopt_assumptions_file_path = nil if hash[:reopt_assumptions_file_path] @reopt_assumptions_file_path = hash[:reopt_assumptions_file_path] end @total_solar_pv_kw = nil @total_wind_kw = nil @total_generator_kw = nil @total_storage_kw = nil @total_storage_kwh = nil @solar_pv = [] if hash[:solar_pv].instance_of?(Hash) hash[:solar_pv] = [hash[:solar_pv]] elsif hash[:solar_pv].nil? hash[:solar_pv] = [] end hash[:solar_pv].each do |s| if !s[:size_kw].nil? && (s[:size_kw] != 0) @solar_pv.push SolarPV.new(s) if @total_solar_pv_kw.nil? @total_solar_pv_kw = @solar_pv[-1].size_kw else @total_solar_pv_kw += @solar_pv[-1].size_kw end end end @wind = [] if hash[:wind].instance_of?(Hash) hash[:wind] = [hash[:wind]] elsif hash[:wind].nil? hash[:wind] = [] end hash[:wind].each do |s| if !s[:size_kw].nil? && (s[:size_kw] != 0) @wind.push Wind.new(s) if @total_wind_kw.nil? @total_wind_kw = @wind[-1].size_kw else @total_wind_kw += @wind[-1].size_kw end end end @generator = [] if hash[:generator].instance_of?(Hash) hash[:generator] = [hash[:generator]] elsif hash[:generator].nil? hash[:generator] = [] end hash[:generator].each do |s| if !s[:size_kw].nil? && (s[:size_kw] != 0) @generator.push Generator.new(s) if @total_generator_kw.nil? @total_generator_kw = @generator[-1].size_kw else @total_generator_kw += @generator[-1].size_kw end end end @storage = [] if hash[:storage].instance_of?(Hash) hash[:storage] = [hash[:storage]] elsif hash[:storage].nil? hash[:storage] = [] end hash[:storage].each do |s| if !s[:size_kw].nil? && (s[:size_kw] != 0) @storage.push Storage.new(s) if @total_storage_kw.nil? @total_storage_kw = @storage[-1].size_kw @total_storage_kwh = @storage[-1].size_kwh else @total_storage_kw += @storage[-1].size_kw @total_storage_kwh += @storage[-1].size_kwh end end end # initialize class variables @@validator and @@schema @@validator ||= Validator.new @@schema ||= @@validator.schema # initialize @@logger @@logger ||= URBANopt::Reporting::DefaultReports.logger end
Public Instance Methods
Add a tech
# File lib/urbanopt/reporting/default_reports/distributed_generation.rb, line 302 def add_tech(name, tech) if name == 'solar_pv' @solar_pv.push tech if @total_solar_pv_kw.nil? @total_solar_pv_kw = tech.size_kw else @total_solar_pv_kw += tech.size_kw end end if name == 'wind' @wind.push tech if @total_wind_kw.nil? @total_wind_kw = tech.size_kw else @total_wind_kw += tech.size_kw end end if name == 'storage' @storage.push tech if @total_storage_kw.nil? @total_storage_kw = tech.size_kw @total_storage_kwh = tech.size_kwh else @total_storage_kw += tech.size_kw @total_storage_kwh += tech.size_kwh end end if name == 'generator' @generator.push tech if @total_generator_kw.nil? @total_generator_kw = tech.size_kw else @total_generator_kw += tech.size_kw end end end
Convert to a Hash equivalent for JSON serialization
# File lib/urbanopt/reporting/default_reports/distributed_generation.rb, line 345 def to_hash result = {} result[:reopt_assumptions_file_path] = @reopt_assumptions_file_path if @reopt_assumptions_file_path result[:annual_renewable_electricity_pct] = @annual_renewable_electricity_pct if @annual_renewable_electricity_pct result[:lcc_us_dollars] = @lcc_us_dollars if @lcc_us_dollars result[:lcc_bau_us_dollars] = @lcc_bau_us_dollars if @lcc_bau_us_dollars result[:npv_us_dollars] = @npv_us_dollars if @npv_us_dollars result[:year_one_energy_cost_us_dollars] = @year_one_energy_cost_us_dollars if @year_one_energy_cost_us_dollars result[:year_one_demand_cost_us_dollars] = @year_one_demand_cost_us_dollars if @year_one_demand_cost_us_dollars result[:year_one_bill_us_dollars] = @year_one_bill_us_dollars if @year_one_bill_us_dollars result[:total_demand_cost_us_dollars] = @total_demand_cost_us_dollars if @total_demand_cost_us_dollars result[:total_energy_cost_us_dollars] = @total_energy_cost_us_dollars if @total_energy_cost_us_dollars result[:year_one_energy_cost_bau_us_dollars] = @year_one_energy_cost_bau_us_dollars if @year_one_energy_cost_bau_us_dollars result[:year_one_demand_cost_bau_us_dollars] = @year_one_demand_cost_bau_us_dollars if @year_one_demand_cost_bau_us_dollars result[:year_one_bill_bau_us_dollars] = @year_one_bill_bau_us_dollars if @year_one_bill_bau_us_dollars result[:total_energy_cost_bau_us_dollars] = @total_energy_cost_bau_us_dollars if @total_energy_cost_bau_us_dollars result[:total_demand_cost_bau_us_dollars] = @total_demand_cost_bau_us_dollars if @total_demand_cost_bau_us_dollars result[:total_solar_pv_kw] = @total_solar_pv_kw if @total_solar_pv_kw result[:total_wind_kw] = @total_wind_kw if @total_wind_kw result[:total_generator_kw] = @total_generator_kw if @total_generator_kw result[:total_storage_kw] = @total_storage_kw if @total_storage_kw result[:total_storage_kwh] = @total_storage_kwh if @total_storage_kwh result[:resilience_hours_min] = @resilience_hours_min if @resilience_hours_min result[:resilience_hours_max] = @resilience_hours_max if @resilience_hours_max result[:resilience_hours_avg] = @resilience_hours_avg if @resilience_hours_avg result[:probs_of_surviving] = @probs_of_surviving if @probs_of_surviving result[:probs_of_surviving_by_month] = @probs_of_surviving_by_month if @probs_of_surviving_by_month result[:probs_of_surviving_by_hour_of_the_day] = @probs_of_surviving_by_hour_of_the_day if @probs_of_surviving_by_hour_of_the_day result[:solar_pv] = [] @solar_pv.each do |pv| result[:solar_pv].push pv.to_hash end result[:wind] = [] @wind.each do |wind| result[:wind].push wind.to_hash end result[:generator] = [] @generator.each do |generator| result[:generator].push generator.to_hash end result[:storage] = [] @storage.each do |storage| result[:storage].push storage.to_hash end return result end