Class: URBANopt::Reporting::DefaultReports::Program
- Inherits:
-
Object
- Object
- URBANopt::Reporting::DefaultReports::Program
- Defined in:
- lib/urbanopt/reporting/default_reports/program.rb
Overview
Program includes all building program related information.
Instance Attribute Summary collapse
-
#area_sqft ⇒ Object
Returns the value of attribute area_sqft.
-
#aspect_ratio ⇒ Object
Returns the value of attribute aspect_ratio.
-
#available_roof_area_sqft ⇒ Object
Returns the value of attribute available_roof_area_sqft.
-
#building_type ⇒ Object
Returns the value of attribute building_type.
-
#building_types ⇒ Object
Returns the value of attribute building_types.
-
#conditioned_area_sqft ⇒ Object
Returns the value of attribute conditioned_area_sqft.
-
#east_window_area_sqft ⇒ Object
Returns the value of attribute east_window_area_sqft.
-
#equipment_roof_area_sqft ⇒ Object
Returns the value of attribute equipment_roof_area_sqft.
-
#floor_area_sqft ⇒ Object
Returns the value of attribute floor_area_sqft.
-
#footprint_area_sqft ⇒ Object
Returns the value of attribute footprint_area_sqft.
-
#maximum_number_of_parking_stories ⇒ Object
Returns the value of attribute maximum_number_of_parking_stories.
-
#maximum_number_of_parking_stories_above_ground ⇒ Object
Returns the value of attribute maximum_number_of_parking_stories_above_ground.
-
#maximum_number_of_stories ⇒ Object
Returns the value of attribute maximum_number_of_stories.
-
#maximum_number_of_stories_above_ground ⇒ Object
Returns the value of attribute maximum_number_of_stories_above_ground.
-
#maximum_occupancy ⇒ Object
Returns the value of attribute maximum_occupancy.
-
#maximum_parking_height_ft ⇒ Object
Returns the value of attribute maximum_parking_height_ft.
-
#maximum_roof_height_ft ⇒ Object
Returns the value of attribute maximum_roof_height_ft.
-
#north_window_area_sqft ⇒ Object
Returns the value of attribute north_window_area_sqft.
-
#number_of_parking_spaces ⇒ Object
Returns the value of attribute number_of_parking_spaces.
-
#number_of_parking_spaces_charging ⇒ Object
Returns the value of attribute number_of_parking_spaces_charging.
-
#number_of_residential_units ⇒ Object
Returns the value of attribute number_of_residential_units.
-
#orientation_deg ⇒ Object
Returns the value of attribute orientation_deg.
-
#parking_area_sqft ⇒ Object
Returns the value of attribute parking_area_sqft.
-
#parking_footprint_area_sqft ⇒ Object
Returns the value of attribute parking_footprint_area_sqft.
-
#photovoltaic_roof_area_sqft ⇒ Object
Returns the value of attribute photovoltaic_roof_area_sqft.
-
#roof_area_sqft ⇒ Object
Returns the value of attribute roof_area_sqft.
-
#site_area_sqft ⇒ Object
Returns the value of attribute site_area_sqft.
-
#south_window_area_sqft ⇒ Object
Returns the value of attribute south_window_area_sqft.
-
#total_construction_cost_dollar ⇒ Object
Returns the value of attribute total_construction_cost_dollar.
-
#total_roof_area_sqft ⇒ Object
Returns the value of attribute total_roof_area_sqft.
-
#unconditioned_area_sqft ⇒ Object
Returns the value of attribute unconditioned_area_sqft.
-
#wall_area_sqft ⇒ Object
Returns the value of attribute wall_area_sqft.
-
#west_window_area_sqft ⇒ Object
Returns the value of attribute west_window_area_sqft.
-
#window_area_sqft ⇒ Object
Returns the value of attribute window_area_sqft.
Instance Method Summary collapse
-
#add_program(other) ⇒ Object
Merges program objects to each other by summing up values or taking the maximum value of the attributes.
-
#add_values(existing_value, new_value) ⇒ Object
Adds up
existing_valueandnew_valuesif not nill. -
#defaults ⇒ Object
Assigns default values if values do not exist.
-
#initialize(hash = {}) ⇒ Program
constructor
Program class initialize building program attributes:
:site_area_sqft,:floor_area_sqft,:conditioned_area_sqft,:unconditioned_area_sqft,:footprint_area_sqft, +:maximum_roof_height_ft,:maximum_number_of_stories,:maximum_number_of_stories_above_ground,:parking_area_sqft,:number_of_parking_spaces,:number_of_parking_spaces_charging,:parking_footprint_area_sqft,:maximum_parking_height_ft,:maximum_number_of_parking_stories,:maximum_number_of_parking_stories_above_ground,:number_of_residential_units,:building_types,:building_type,:maximum_occupancy,:area_sqft,:window_area_sqft,:north_window_area_sqft,:south_window_area_sqft,:east_window_area_sqft,:west_window_area_sqft,:wall_area_sqft,:roof_area_sqft,:equipment_roof_area_sqft,:photovoltaic_roof_area_sqft,:available_roof_area_sqft,:total_roof_area_sqft,:orientation_deg,:aspect_ratio. -
#max_value(existing_value, new_value) ⇒ Object
Return the maximum value from
existing_valueandnew_value. -
#to_hash ⇒ Object
Convert to a Hash equivalent for JSON serialization.
Constructor Details
#initialize(hash = {}) ⇒ Program
Program class initialize building program attributes: :site_area_sqft , :floor_area_sqft , :conditioned_area_sqft , :unconditioned_area_sqft , :footprint_area_sqft , +:maximum_roof_height_ft, :maximum_number_of_stories , :maximum_number_of_stories_above_ground , :parking_area_sqft , :number_of_parking_spaces , :number_of_parking_spaces_charging , :parking_footprint_area_sqft , :maximum_parking_height_ft , :maximum_number_of_parking_stories , :maximum_number_of_parking_stories_above_ground , :number_of_residential_units , :building_types , :building_type , :maximum_occupancy , :area_sqft , :window_area_sqft , :north_window_area_sqft , :south_window_area_sqft , :east_window_area_sqft , :west_window_area_sqft , :wall_area_sqft , :roof_area_sqft , :equipment_roof_area_sqft , :photovoltaic_roof_area_sqft , :available_roof_area_sqft , :total_roof_area_sqft , :orientation_deg , :aspect_ratio
- parameters:
-
hash- Hash - A hash which may contain a deserialized program.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 59 def initialize(hash = {}) hash.delete_if { |k, v| v.nil? } hash = defaults.merge(hash) @site_area_sqft = hash[:site_area_sqft] @floor_area_sqft = hash[:floor_area_sqft] @conditioned_area_sqft = hash[:conditioned_area_sqft] @unconditioned_area_sqft = hash[:unconditioned_area_sqft] @footprint_area_sqft = hash[:footprint_area_sqft] @maximum_roof_height_ft = hash[:maximum_roof_height_ft] @maximum_number_of_stories = hash[:maximum_number_of_stories] @maximum_number_of_stories_above_ground = hash[:maximum_number_of_stories_above_ground] @parking_area_sqft = hash[:parking_area_sqft] @number_of_parking_spaces = hash[:number_of_parking_spaces] @number_of_parking_spaces_charging = hash[:number_of_parking_spaces_charging] @parking_footprint_area_sqft = hash[:parking_footprint_area_sqft] @maximum_parking_height_ft = hash[:maximum_parking_height_ft] @maximum_number_of_parking_stories = hash[:maximum_number_of_parking_stories] @maximum_number_of_parking_stories_above_ground = hash[:maximum_number_of_parking_stories_above_ground] @number_of_residential_units = hash[:number_of_residential_units] @building_types = hash[:building_types] @window_area_sqft = hash[:window_area_sqft] @wall_area_sqft = hash[:wall_area_sqft] @roof_area_sqft = hash[:roof_area_sqft] @orientation_deg = hash[:orientation_deg] @aspect_ratio = hash[:aspect_ratio] @total_construction_cost_dollar = hash[:total_construction_cost_dollar] # initialize class variables @@validator and @@schema @@validator ||= Validator.new @@schema ||= @@validator.schema end |
Instance Attribute Details
#area_sqft ⇒ Object
Returns the value of attribute area_sqft.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def area_sqft @area_sqft end |
#aspect_ratio ⇒ Object
Returns the value of attribute aspect_ratio.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def aspect_ratio @aspect_ratio end |
#available_roof_area_sqft ⇒ Object
Returns the value of attribute available_roof_area_sqft.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def available_roof_area_sqft @available_roof_area_sqft end |
#building_type ⇒ Object
Returns the value of attribute building_type.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def building_type @building_type end |
#building_types ⇒ Object
Returns the value of attribute building_types.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def building_types @building_types end |
#conditioned_area_sqft ⇒ Object
Returns the value of attribute conditioned_area_sqft.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def conditioned_area_sqft @conditioned_area_sqft end |
#east_window_area_sqft ⇒ Object
Returns the value of attribute east_window_area_sqft.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def east_window_area_sqft @east_window_area_sqft end |
#equipment_roof_area_sqft ⇒ Object
Returns the value of attribute equipment_roof_area_sqft.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def equipment_roof_area_sqft @equipment_roof_area_sqft end |
#floor_area_sqft ⇒ Object
Returns the value of attribute floor_area_sqft.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def floor_area_sqft @floor_area_sqft end |
#footprint_area_sqft ⇒ Object
Returns the value of attribute footprint_area_sqft.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def footprint_area_sqft @footprint_area_sqft end |
#maximum_number_of_parking_stories ⇒ Object
Returns the value of attribute maximum_number_of_parking_stories.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def maximum_number_of_parking_stories @maximum_number_of_parking_stories end |
#maximum_number_of_parking_stories_above_ground ⇒ Object
Returns the value of attribute maximum_number_of_parking_stories_above_ground.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def maximum_number_of_parking_stories_above_ground @maximum_number_of_parking_stories_above_ground end |
#maximum_number_of_stories ⇒ Object
Returns the value of attribute maximum_number_of_stories.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def maximum_number_of_stories @maximum_number_of_stories end |
#maximum_number_of_stories_above_ground ⇒ Object
Returns the value of attribute maximum_number_of_stories_above_ground.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def maximum_number_of_stories_above_ground @maximum_number_of_stories_above_ground end |
#maximum_occupancy ⇒ Object
Returns the value of attribute maximum_occupancy.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def maximum_occupancy @maximum_occupancy end |
#maximum_parking_height_ft ⇒ Object
Returns the value of attribute maximum_parking_height_ft.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def maximum_parking_height_ft @maximum_parking_height_ft end |
#maximum_roof_height_ft ⇒ Object
Returns the value of attribute maximum_roof_height_ft.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def maximum_roof_height_ft @maximum_roof_height_ft end |
#north_window_area_sqft ⇒ Object
Returns the value of attribute north_window_area_sqft.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def north_window_area_sqft @north_window_area_sqft end |
#number_of_parking_spaces ⇒ Object
Returns the value of attribute number_of_parking_spaces.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def number_of_parking_spaces @number_of_parking_spaces end |
#number_of_parking_spaces_charging ⇒ Object
Returns the value of attribute number_of_parking_spaces_charging.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def number_of_parking_spaces_charging @number_of_parking_spaces_charging end |
#number_of_residential_units ⇒ Object
Returns the value of attribute number_of_residential_units.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def number_of_residential_units @number_of_residential_units end |
#orientation_deg ⇒ Object
Returns the value of attribute orientation_deg.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def orientation_deg @orientation_deg end |
#parking_area_sqft ⇒ Object
Returns the value of attribute parking_area_sqft.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def parking_area_sqft @parking_area_sqft end |
#parking_footprint_area_sqft ⇒ Object
Returns the value of attribute parking_footprint_area_sqft.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def parking_footprint_area_sqft @parking_footprint_area_sqft end |
#photovoltaic_roof_area_sqft ⇒ Object
Returns the value of attribute photovoltaic_roof_area_sqft.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def photovoltaic_roof_area_sqft @photovoltaic_roof_area_sqft end |
#roof_area_sqft ⇒ Object
Returns the value of attribute roof_area_sqft.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def roof_area_sqft @roof_area_sqft end |
#site_area_sqft ⇒ Object
Returns the value of attribute site_area_sqft.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def site_area_sqft @site_area_sqft end |
#south_window_area_sqft ⇒ Object
Returns the value of attribute south_window_area_sqft.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def south_window_area_sqft @south_window_area_sqft end |
#total_construction_cost_dollar ⇒ Object
Returns the value of attribute total_construction_cost_dollar.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def total_construction_cost_dollar @total_construction_cost_dollar end |
#total_roof_area_sqft ⇒ Object
Returns the value of attribute total_roof_area_sqft.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def total_roof_area_sqft @total_roof_area_sqft end |
#unconditioned_area_sqft ⇒ Object
Returns the value of attribute unconditioned_area_sqft.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def unconditioned_area_sqft @unconditioned_area_sqft end |
#wall_area_sqft ⇒ Object
Returns the value of attribute wall_area_sqft.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def wall_area_sqft @wall_area_sqft end |
#west_window_area_sqft ⇒ Object
Returns the value of attribute west_window_area_sqft.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def west_window_area_sqft @west_window_area_sqft end |
#window_area_sqft ⇒ Object
Returns the value of attribute window_area_sqft.
43 44 45 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 43 def window_area_sqft @window_area_sqft end |
Instance Method Details
#add_program(other) ⇒ Object
Merges program objects to each other by summing up values or taking the maximum value of the attributes.
- parameters:
-
other- Program - An object of Program class.
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 223 def add_program(other) @site_area_sqft = add_values(@site_area_sqft, other.site_area_sqft) @floor_area_sqft = add_values(@floor_area_sqft, other.floor_area_sqft) @conditioned_area_sqft = add_values(@conditioned_area_sqft, other.conditioned_area_sqft) @unconditioned_area_sqft = add_values(@unconditioned_area_sqft, other.unconditioned_area_sqft) @footprint_area_sqft = add_values(@footprint_area_sqft, other.footprint_area_sqft) @maximum_roof_height_ft = max_value(@maximum_roof_height_ft, other.maximum_roof_height_ft) @maximum_number_of_stories = max_value(@maximum_number_of_stories, other.maximum_number_of_stories) @maximum_number_of_stories_above_ground = max_value(@maximum_number_of_stories_above_ground, other.maximum_number_of_stories_above_ground) @parking_area_sqft = add_values(@parking_area_sqft, other.parking_area_sqft) @number_of_parking_spaces = add_values(@number_of_parking_spaces, other.number_of_parking_spaces) @number_of_parking_spaces_charging = add_values(@number_of_parking_spaces_charging, other.number_of_parking_spaces_charging) @parking_footprint_area_sqft = add_values(@parkig_footprint_area_sqft, other.parking_footprint_area_sqft) @maximum_parking_height_ft = max_value(@maximum_parking_height_ft, other.maximum_parking_height_ft) @maximum_number_of_parking_stories = max_value(@maximum_number_of_parking_stories, other.maximum_number_of_parking_stories) @maximum_number_of_parking_stories_above_ground = max_value(maximum_number_of_parking_stories_above_ground, other.maximum_number_of_parking_stories_above_ground) @number_of_residential_units = add_values(@number_of_residential_units, other.number_of_residential_units) @total_construction_cost_dollar = add_values(@total_construction_cost_dollar, other.total_construction_cost_dollar) @building_types = other.building_types @window_area_sqft[:north_window_area_sqft] = add_values(@window_area_sqft[:north_window_area_sqft], other.window_area_sqft[:north_window_area_sqft]) @window_area_sqft[:south_window_area_sqft] = add_values(@window_area_sqft[:south_window_area_sqft], other.window_area_sqft[:south_window_area_sqft]) @window_area_sqft[:east_window_area_sqft] = add_values(@window_area_sqft[:east_window_area_sqft], other.window_area_sqft[:east_window_area_sqft]) @window_area_sqft[:west_window_area_sqft] = add_values(@window_area_sqft[:west_window_area_sqft], other.window_area_sqft[:west_window_area_sqft]) @window_area_sqft[:total_window_area_sqft] = add_values(@window_area_sqft[:total_window_area_sqft], other.window_area_sqft[:total_window_area_sqft]) @wall_area_sqft[:north_wall_area_sqft] = add_values(@wall_area_sqft[:north_wall_area_sqft], other.wall_area_sqft[:north_wall_area_sqft]) @wall_area_sqft[:south_wall_area_sqft] = add_values(@wall_area_sqft[:south_wall_area_sqft], other.wall_area_sqft[:south_wall_area_sqft]) @wall_area_sqft[:east_wall_area_sqft] = add_values(@wall_area_sqft[:east_wall_area_sqft], other.wall_area_sqft[:east_wall_area_sqft]) @wall_area_sqft[:west_wall_area_sqft] = add_values(@wall_area_sqft[:west_wall_area_sqft], other.wall_area_sqft[:west_wall_area_sqft]) @wall_area_sqft[:total_wall_area_sqft] = add_values(@wall_area_sqft[:total_wall_area_sqft], other.wall_area_sqft[:total_wall_area_sqft]) @roof_area_sqft[:equipment_roof_area_sqft] = add_values(@roof_area_sqft[:equipment_roof_area_sqft], other.roof_area_sqft[:equipment_roof_area_sqft]) @roof_area_sqft[:photovoltaic_roof_area_sqft] = add_values(@roof_area_sqft[:photovoltaic_roof_area_sqft], other.roof_area_sqft[:photovoltaic_roof_area_sqft]) @roof_area_sqft[:available_roof_area_sqft] = add_values(@roof_area_sqft[:available_roof_area_sqft], other.roof_area_sqft[:available_roof_area_sqft]) @roof_area_sqft[:total_roof_area_sqft] = add_values(@roof_area_sqft[:total_roof_area_sqft], other.roof_area_sqft[:total_roof_area_sqft]) 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 Program attribute.new_value- Float - A value corresponding to a Program attribute.
208 209 210 211 212 213 214 215 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 208 def add_values(existing_value, new_value) 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.
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 95 def defaults hash = {} hash[:site_area_sqft] = nil hash[:floor_area_sqft] = nil hash[:conditioned_area_sqft] = nil hash[:unconditioned_area_sqft] = nil hash[:footprint_area_sqft] = nil hash[:maximum_roof_height_ft] = nil hash[:maximum_number_of_stories] = nil hash[:maximum_number_of_stories_above_ground] = nil hash[:parking_area_sqft] = nil hash[:number_of_parking_spaces] = nil hash[:number_of_parking_spaces_charging] = nil hash[:parking_footprint_area_sqft] = nil hash[:maximum_parking_height_ft] = nil hash[:maximum_number_of_parking_stories] = nil hash[:maximum_number_of_parking_stories_above_ground] = nil hash[:number_of_residential_units] = nil hash[:building_types] = [{ building_type: nil, maximum_occupancy: nil, floor_area_sqft: nil }] hash[:window_area_sqft] = { north_window_area_sqft: nil, south_window_area_sqft: nil, east_window_area_sqft: nil, west_window_area_sqft: nil, total_window_area_sqft: nil } hash[:wall_area_sqft] = { north_wall_area_sqft: nil, south_wall_area_sqft: nil, east_wall_area_sqft: nil, west_wall_area_sqft: nil, total_wall_area_sqft: nil } hash[:roof_area_sqft] = { equipment_roof_area_sqft: nil, photovoltaic_roof_area_sqft: nil, available_roof_area_sqft: nil, total_roof_area_sqft: nil } hash[:orientation_deg] = nil hash[:aspect_ratio] = nil hash[:total_construction_cost_dollar] = nil return hash end |
#max_value(existing_value, new_value) ⇒ Object
Return the maximum value from existing_value and new_value.
- parameters:
-
existing_value- Float - A value corresponding to a Program attribute.new_value- Float - A value corresponding to a Program attribute.
191 192 193 194 195 196 197 198 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 191 def max_value(existing_value, new_value) if existing_value && new_value [existing_value, new_value].max elsif new_value existing_value = new_value end return existing_value end |
#to_hash ⇒ Object
Convert to a Hash equivalent for JSON serialization.
-
Exclude attributes with nil values.
-
Validate program hash properties against schema.
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/urbanopt/reporting/default_reports/program.rb', line 129 def to_hash result = {} result[:site_area_sqft] = @site_area_sqft if @site_area_sqft result[:floor_area_sqft] = @floor_area_sqft if @floor_area_sqft result[:conditioned_area_sqft] = @conditioned_area_sqft if @conditioned_area_sqft result[:unconditioned_area_sqft] = @unconditioned_area_sqft if @unconditioned_area_sqft result[:footprint_area_sqft] = @footprint_area_sqft if @footprint_area_sqft result[:maximum_roof_height_ft] = @maximum_roof_height_ft if @maximum_roof_height_ft result[:maximum_number_of_stories] = @maximum_number_of_stories if @maximum_number_of_stories result[:maximum_number_of_stories_above_ground] = @maximum_number_of_stories_above_ground if @maximum_number_of_parking_stories_above_ground result[:parking_area_sqft] = @parking_area_sqft if @parking_area_sqft result[:number_of_parking_spaces] = @number_of_parking_spaces if @number_of_parking_spaces result[:number_of_parking_spaces_charging] = @number_of_parking_spaces_charging if @number_of_parking_spaces_charging result[:parking_footprint_area_sqft] = @parking_footprint_area_sqft if @parking_footprint_area_sqft result[:maximum_parking_height_ft] = @maximum_parking_height_ft if @maximum_parking_height_ft result[:maximum_number_of_parking_stories] = @maximum_number_of_parking_stories if @maximum_number_of_parking_stories result[:maximum_number_of_parking_stories_above_ground] = @maximum_number_of_parking_stories_above_ground if @maximum_number_of_parking_stories_above_ground result[:number_of_residential_units] = @number_of_residential_units if @number_of_residential_units if @building_types.any? result[:building_types] = @building_types @building_types.each do |bt| bt&.delete_if { |k, v| v.nil? } end end # result[:window_area_sqft] = @window_area_sqft if @window_area_sqft window_area_sqft_hash = @window_area_sqft if @window_area_sqft window_area_sqft_hash.delete_if { |k, v| v.nil? } result[:window_area_sqft] = window_area_sqft_hash if @window_area_sqft # result[:wall_area_sqft] = @wall_area_sqft if @wall_area_sqft wall_area_sqft_hash = @wall_area_sqft if @wall_area_sqft wall_area_sqft_hash.delete_if { |k, v| v.nil? } result[:wall_area_sqft] = wall_area_sqft_hash if @wall_area_sqft # result[:roof_area_sqft] = @roof_area_sqft if @roof_area_sqft roof_area_sqft_hash = @roof_area_sqft if @roof_area_sqft roof_area_sqft_hash.delete_if { |k, v| v.nil? } result[:roof_area_sqft] = roof_area_sqft_hash if @roof_area_sqft result[:orientation_deg] = @orientation_deg if @orientation_deg result[:aspect_ratio] = @aspect_ratio if @aspect_ratio result[:total_construction_cost_dollar] = @total_construction_cost_dollar if @total_construction_cost_dollar # validate program properties against schema if @@validator.validate(@@schema[:definitions][:Program][:properties], result).any? raise "program properties does not match schema: #{@@validator.validate(@@schema[:definitions][:Program][:properties], result)}" end return result end |