class URBANopt::Reporting::DefaultReports::Storage
Onsite storage system attributes
Attributes
          size_kw[RW]
        
        Float - power capacity in kilowatts
          size_kwh[RW]
        
        Float - storage capacity in kilowatt-hours
Public Class Methods
          add_storage(existing_storage, new_storage)
          
          click to toggle source
          
        
        
        Merge Storage systems
# File lib/urbanopt/reporting/default_reports/storage.rb, line 62 def self.add_storage(existing_storage, new_storage) if existing_storage.size_kw.nil? existing_storage.size_kw = new_storage.size_kw else existing_storage.size_kw = (existing_storage.size_kw || 0) + (new_storage.size_kw || 0) end if existing_storage.size_kw.nil? existing_storage.size_kwh = new_storage.size_kwh else existing_storage.size_kwh = (existing_storage.size_kwh || 0) + (new_storage.size_kwh || 0) end return existing_storage end
          new(hash = {})
          
          click to toggle source
          
        
        
        Initialize Storage attributes from a hash. Storage attributes currently are limited to power and storage capacity.
- parameters:
- 
hash- Hash - A hash containting:size_kwand:size_kwhkey/value pair which represents the power and storage capacity in kilowatts (kW) and kilowatt-hours respectively.
# File lib/urbanopt/reporting/default_reports/storage.rb, line 33 def initialize(hash = {}) hash.delete_if { |k, v| v.nil? } @size_kw = hash[:size_kw] @size_kwh = hash[:size_kwh] # initialize class variables @@validator and @@schema @@validator ||= Validator.new @@schema ||= @@validator.schema # initialize @@logger @@logger ||= URBANopt::Reporting::DefaultReports.logger end
Public Instance Methods
          to_hash()
          
          click to toggle source
          
        
        
        Convert to a Hash equivalent for JSON serialization
# File lib/urbanopt/reporting/default_reports/storage.rb, line 50 def to_hash result = {} result[:size_kw] = @size_kw if @size_kw result[:size_kwh] = @size_kwh if @size_kwh return result end