Class: URBANopt::Reporting::DefaultReports::SolarPV
- Inherits:
-
Object
- Object
- URBANopt::Reporting::DefaultReports::SolarPV
- Defined in:
- lib/urbanopt/reporting/default_reports/solar_pv.rb
Overview
Onsite solar PV system attributes
Instance Attribute Summary collapse
-
#size_kw ⇒ Object
Float - power capacity in kilowatts.
Class Method Summary collapse
-
.add_pv(existing_pv, new_pv) ⇒ Object
Merge PV systems.
Instance Method Summary collapse
-
#initialize(hash = {}) ⇒ SolarPV
constructor
Initialize SolarPV attributes from a hash.
-
#to_hash ⇒ Object
Convert to a Hash equivalent for JSON serialization.
Constructor Details
#initialize(hash = {}) ⇒ SolarPV
Initialize SolarPV attributes from a hash. Solar PV attributes currently are limited to power capacity.
- parameters:
-
hash- Hash - A hash containting a:size_kwkey/value pair which represents the nameplate capacity in kilowatts (kW)
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/urbanopt/reporting/default_reports/solar_pv.rb', line 53 def initialize(hash = {}) hash.delete_if { |k, v| v.nil? } @size_kw = hash[:size_kw] @id = hash[:id] # initialize class variables @@validator and @@schema @@validator ||= Validator.new @@schema ||= @@validator.schema # initialize @@logger @@logger ||= URBANopt::Reporting::DefaultReports.logger end |
Instance Attribute Details
#size_kw ⇒ Object
Float - power capacity in kilowatts
44 45 46 |
# File 'lib/urbanopt/reporting/default_reports/solar_pv.rb', line 44 def size_kw @size_kw end |
Class Method Details
.add_pv(existing_pv, new_pv) ⇒ Object
Merge PV systems
81 82 83 84 85 86 87 88 89 |
# File 'lib/urbanopt/reporting/default_reports/solar_pv.rb', line 81 def self.add_pv(existing_pv, new_pv) if existing_pv.size_kw.nil? && new_pv.size_kw.nil? existing_pv.size_kw = nil else existing_pv.size_kw = (existing_pv.size_kw || 0) + (new_pv.size_kw || 0) end return existing_pv end |
Instance Method Details
#to_hash ⇒ Object
Convert to a Hash equivalent for JSON serialization
70 71 72 73 74 75 76 |
# File 'lib/urbanopt/reporting/default_reports/solar_pv.rb', line 70 def to_hash result = {} result[:size_kw] = @size_kw if @size_kw return result end |