Class: URBANopt::Reporting::DefaultReports::QAQC
- Inherits:
-
Object
- Object
- URBANopt::Reporting::DefaultReports::QAQC
- Defined in:
- lib/urbanopt/reporting/default_reports/qaqc_flags.rb
Overview
QAQC flags for each feature
Instance Attribute Summary collapse
-
#domestic_hot_water ⇒ Object
Hash - Hash of flags raised by QAQC measure for this feature during this reporting period.
-
#end_use_by_category ⇒ Object
Hash - Hash of flags raised by QAQC measure for this feature during this reporting period.
-
#envelope_r_value ⇒ Object
Hash - Hash of flags raised by QAQC measure for this feature during this reporting period.
-
#eui_reasonableness ⇒ Object
Hash - Hash of flags raised by QAQC measure for this feature during this reporting period.
-
#internal_loads ⇒ Object
Hash - Hash of flags raised by QAQC measure for this feature during this reporting period.
-
#mechanical_system_efficiency ⇒ Object
Hash - Hash of flags raised by QAQC measure for this feature during this reporting period.
-
#mechanical_system_part_load_efficiency ⇒ Object
Hash - Hash of flags raised by QAQC measure for this feature during this reporting period.
-
#schedules ⇒ Object
Hash - Hash of flags raised by QAQC measure for this feature during this reporting period.
-
#simultaneous_heating_and_cooling ⇒ Object
Hash - Hash of flags raised by QAQC measure for this feature during this reporting period.
-
#supply_and_zone_air_temperature ⇒ Object
Hash - Hash of flags raised by QAQC measure for this feature during this reporting period.
-
#total_qaqc_flags ⇒ Object
Hash - Hash of flags raised by QAQC measure for this feature during this reporting period.
Instance Method Summary collapse
-
#add_qaqc_flags(other) ⇒ Object
Merges qaqc_flags objects to each other by summing up values.
-
#add_values(existing_value, new_value) ⇒ Object
Adds up
existing_value
andnew_values
if not nill. -
#defaults ⇒ Object
Assigns default values if values do not exist.
-
#initialize(hash = {}) ⇒ QAQC
constructor
QAQC class initialize quaqc attributes:
:eui_reasonableness,
:end_use_by_category,+:mechanical_system_part_load_efficiency, :simultaneous_heating_and_cooling , :internal_loads , :schedules, :envelope_r_value, :domestic_hot_water , :mechanical_system_efficiency , :supply_and_zone_air_temperature, :total_qaqc_flags. -
#to_hash ⇒ Object
Convert to a Hash equivalent for JSON serialization.
Constructor Details
#initialize(hash = {}) ⇒ QAQC
QAQC class initialize quaqc attributes: :eui_reasonableness,
:end_use_by_category,+:mechanical_system_part_load_efficiency, :simultaneous_heating_and_cooling , :internal_loads , :schedules, :envelope_r_value, :domestic_hot_water , :mechanical_system_efficiency , :supply_and_zone_air_temperature, :total_qaqc_flags
- parameters:
-
hash
- Hash - A hash containing qaqc attributes listed above.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/urbanopt/reporting/default_reports/qaqc_flags.rb', line 33 def initialize(hash = {}) hash.delete_if { |k, v| v.nil? } hash = defaults.merge(hash) @eui_reasonableness = hash[:eui_reasonableness] @end_use_by_category = hash[:end_use_by_category] @mechanical_system_part_load_efficiency = hash[:mechanical_system_part_load_efficiency] @simultaneous_heating_and_cooling = hash[:simultaneous_heating_and_cooling] @supply_and_zone_air_temperature = hash[:supply_and_zone_air_temperature] @internal_loads = hash[:internal_loads] @schedules = hash[:schedules] @envelope_r_value = hash[:envelope_r_value] @domestic_hot_water = hash[:domestic_hot_water] @mechanical_system_efficiency = hash[:mechanical_system_efficiency] @total_qaqc_flags = hash[:total_qaqc_flags] # initialize class variables @@validator and @@schema @@validator ||= Validator.new @@schema ||= @@validator.schema end |
Instance Attribute Details
#domestic_hot_water ⇒ Object
Hash - Hash of flags raised by QAQC measure for this feature during this reporting period
19 20 21 |
# File 'lib/urbanopt/reporting/default_reports/qaqc_flags.rb', line 19 def domestic_hot_water @domestic_hot_water end |
#end_use_by_category ⇒ Object
Hash - Hash of flags raised by QAQC measure for this feature during this reporting period
19 20 21 |
# File 'lib/urbanopt/reporting/default_reports/qaqc_flags.rb', line 19 def end_use_by_category @end_use_by_category end |
#envelope_r_value ⇒ Object
Hash - Hash of flags raised by QAQC measure for this feature during this reporting period
19 20 21 |
# File 'lib/urbanopt/reporting/default_reports/qaqc_flags.rb', line 19 def envelope_r_value @envelope_r_value end |
#eui_reasonableness ⇒ Object
Hash - Hash of flags raised by QAQC measure for this feature during this reporting period
19 20 21 |
# File 'lib/urbanopt/reporting/default_reports/qaqc_flags.rb', line 19 def eui_reasonableness @eui_reasonableness end |
#internal_loads ⇒ Object
Hash - Hash of flags raised by QAQC measure for this feature during this reporting period
19 20 21 |
# File 'lib/urbanopt/reporting/default_reports/qaqc_flags.rb', line 19 def internal_loads @internal_loads end |
#mechanical_system_efficiency ⇒ Object
Hash - Hash of flags raised by QAQC measure for this feature during this reporting period
19 20 21 |
# File 'lib/urbanopt/reporting/default_reports/qaqc_flags.rb', line 19 def mechanical_system_efficiency @mechanical_system_efficiency end |
#mechanical_system_part_load_efficiency ⇒ Object
Hash - Hash of flags raised by QAQC measure for this feature during this reporting period
19 20 21 |
# File 'lib/urbanopt/reporting/default_reports/qaqc_flags.rb', line 19 def mechanical_system_part_load_efficiency @mechanical_system_part_load_efficiency end |
#schedules ⇒ Object
Hash - Hash of flags raised by QAQC measure for this feature during this reporting period
19 20 21 |
# File 'lib/urbanopt/reporting/default_reports/qaqc_flags.rb', line 19 def schedules @schedules end |
#simultaneous_heating_and_cooling ⇒ Object
Hash - Hash of flags raised by QAQC measure for this feature during this reporting period
19 20 21 |
# File 'lib/urbanopt/reporting/default_reports/qaqc_flags.rb', line 19 def simultaneous_heating_and_cooling @simultaneous_heating_and_cooling end |
#supply_and_zone_air_temperature ⇒ Object
Hash - Hash of flags raised by QAQC measure for this feature during this reporting period
19 20 21 |
# File 'lib/urbanopt/reporting/default_reports/qaqc_flags.rb', line 19 def supply_and_zone_air_temperature @supply_and_zone_air_temperature end |
#total_qaqc_flags ⇒ Object
Hash - Hash of flags raised by QAQC measure for this feature during this reporting period
19 20 21 |
# File 'lib/urbanopt/reporting/default_reports/qaqc_flags.rb', line 19 def total_qaqc_flags @total_qaqc_flags end |
Instance Method Details
#add_qaqc_flags(other) ⇒ Object
Merges qaqc_flags objects to each other by summing up values.
- parameters:
-
other
- QAQC - An object of Program class.
124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/urbanopt/reporting/default_reports/qaqc_flags.rb', line 124 def add_qaqc_flags(other) @eui_reasonableness = add_values(@eui_reasonableness, other.eui_reasonableness) @end_use_by_category = add_values(@end_use_by_category, other.end_use_by_category) @mechanical_system_part_load_efficiency = add_values(@mechanical_system_part_load_efficiency, other.mechanical_system_part_load_efficiency) @simultaneous_heating_and_cooling = add_values(@simultaneous_heating_and_cooling, other.simultaneous_heating_and_cooling) @supply_and_zone_air_temperature = add_values(@supply_and_zone_air_temperature, other.supply_and_zone_air_temperature) @internal_loads = add_values(@internal_loads, other.internal_loads) @schedules = add_values(@schedules, other.schedules) @envelope_r_value = add_values(@envelope_r_value, other.envelope_r_value) @domestic_hot_water = add_values(@domestic_hot_water, other.domestic_hot_water) @mechanical_system_efficiency = add_values(@mechanical_system_efficiency, other.mechanical_system_efficiency) @total_qaqc_flags = add_values(@total_qaqc_flags, other.total_qaqc_flags) end |
#add_values(existing_value, new_value) ⇒ Object
Adds up existing_value
and new_values
if not nill.
- parameters:
-
existing_value
- Float - A value corresponding to a qaqc_flags attribute.new_value
- Float - A value corresponding to a qaqc_flags attribute.
109 110 111 112 113 114 115 116 |
# File 'lib/urbanopt/reporting/default_reports/qaqc_flags.rb', line 109 def add_values(existing_value, new_value) #:nodoc: if existing_value && new_value existing_value += new_value elsif new_value existing_value = new_value end return existing_value end |
#defaults ⇒ Object
Assigns default values if values do not exist.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/urbanopt/reporting/default_reports/qaqc_flags.rb', line 57 def defaults hash = {} hash[:eui_reasonableness] = nil hash[:end_use_by_category] = nil hash[:mechanical_system_part_load_efficiency] = nil hash[:simultaneous_heating_and_cooling] = nil hash[:supply_and_zone_air_temperature] = nil hash[:internal_loads] = nil hash[:schedules] = nil hash[:envelope_r_value] = nil hash[:domestic_hot_water] = nil hash[:mechanical_system_efficiency] = nil hash[:total_qaqc_flags] = nil return hash end |
#to_hash ⇒ Object
Convert to a Hash equivalent for JSON serialization
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/urbanopt/reporting/default_reports/qaqc_flags.rb', line 78 def to_hash result = {} result[:eui_reasonableness] = @eui_reasonableness result[:end_use_by_category] = @end_use_by_category result[:mechanical_system_part_load_efficiency] = @mechanical_system_part_load_efficiency result[:simultaneous_heating_and_cooling] = @simultaneous_heating_and_cooling result[:supply_and_zone_air_temperature] = @supply_and_zone_air_temperature result[:internal_loads] = @internal_loads result[:schedules] = @schedules result[:envelope_r_value] = @envelope_r_value result[:domestic_hot_water] = @domestic_hot_water result[:mechanical_system_efficiency] = @mechanical_system_efficiency result[:total_qaqc_flags] = @total_qaqc_flags # validate program properties against schema if @@validator.validate(@@schema[:definitions][:qaqc_flags][:properties], result).any? raise "qaqc properties does not match schema: #{@@validator.validate(@@schema[:definitions][:qaqc_flags][:properties], result)}" end return result end |