Class: ReduceElectricEquipmentLoadsByPercentage
- Inherits:
-
OpenStudio::Measure::ModelMeasure
- Object
- OpenStudio::Measure::ModelMeasure
- ReduceElectricEquipmentLoadsByPercentage
- Defined in:
- lib/measures/ReduceElectricEquipmentLoadsByPercentage/measure.rb
Overview
start the measure
Instance Method Summary collapse
-
#add_to_baseline_demo_cost_counter(baseline_object, demo_cost_initial_const) ⇒ Object
helper def to add to demo cost related to baseline objects.
-
#alter_performance_and_lcc(object, elecequip_power_reduction_percent, material_and_installation_cost, demolition_cost, om_cost, years_until_costs_start, expected_life, om_frequency, runner) ⇒ Object
def to alter performance and life cycle costs of objects.
-
#arguments(model) ⇒ Object
define the arguments that the user will input.
-
#description ⇒ Object
human readable description.
-
#get_total_costs_for_objects(objects) ⇒ Object
helper that loops through lifecycle costs getting total costs under “Construction” or “Salvage” category and add to counter if occurs during year 0.
-
#modeler_description ⇒ Object
human readable description of modeling approach.
-
#name ⇒ Object
define the name that a user will see.
-
#neat_numbers(number, roundto = 2) ⇒ Object
helper to make numbers pretty (converts 4125001.25641 to 4,125,001.26 or 4,125,001).
-
#run(model, runner, user_arguments) ⇒ Object
define what happens when the measure is run.
-
#unit_helper(number, from_unit_string, to_unit_string) ⇒ Object
helper to make it easier to do unit conversions on the fly.
Instance Method Details
#add_to_baseline_demo_cost_counter(baseline_object, demo_cost_initial_const) ⇒ Object
helper def to add to demo cost related to baseline objects
262 263 264 265 266 267 268 269 270 271 272 273 |
# File 'lib/measures/ReduceElectricEquipmentLoadsByPercentage/measure.rb', line 262 def add_to_baseline_demo_cost_counter(baseline_object, demo_cost_initial_const) counter = 0 if demo_cost_initial_const == true baseline_object_LCCs = baseline_object.lifeCycleCosts baseline_object_LCCs.each do |baseline_object_LCC| if baseline_object_LCC.category == 'Salvage' counter += baseline_object_LCC.totalCost end end end return counter end |
#alter_performance_and_lcc(object, elecequip_power_reduction_percent, material_and_installation_cost, demolition_cost, om_cost, years_until_costs_start, expected_life, om_frequency, runner) ⇒ Object
def to alter performance and life cycle costs of objects
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
# File 'lib/measures/ReduceElectricEquipmentLoadsByPercentage/measure.rb', line 276 def alter_performance_and_lcc(object, elecequip_power_reduction_percent, material_and_installation_cost, demolition_cost, om_cost, years_until_costs_start, expected_life, om_frequency, runner) # edit clone based on percentage reduction new_def = object if !new_def.designLevel.empty? new_electric_equipment_level = new_def.setDesignLevel(new_def.designLevel.get - new_def.designLevel.get * elecequip_power_reduction_percent * 0.01) elsif !new_def.wattsperSpaceFloorArea.empty? new_electric_equipment_per_area = new_def.setWattsperSpaceFloorArea(new_def.wattsperSpaceFloorArea.get - new_def.wattsperSpaceFloorArea.get * elecequip_power_reduction_percent * 0.01) elsif !new_def.wattsperPerson.empty? new_electric_equipment_per_person = new_def.setWattsperPerson(new_def.wattsperPerson.get - new_def.wattsperPerson.get * elecequip_power_reduction_percent * 0.01) else runner.registerWarning("'#{new_def.name}' is used by one or more instances and has no load values. Its performance was not altered.") end new_def_LCCs = new_def.lifeCycleCosts if new_def_LCCs.empty? if material_and_installation_cost.abs + demolition_cost.abs + om_cost.abs != 0 runner.registerWarning("'#{new_def.name}' had no life cycle cost objects. No cost was added for it.") end else new_def_LCCs.each do |new_def_LCC| if new_def_LCC.category == 'Construction' new_def_LCC.setCost(new_def_LCC.cost * (1 + material_and_installation_cost / 100)) new_def_LCC.setYearsFromStart(years_until_costs_start) # just uses argument value, does not need existing value new_def_LCC.setRepeatPeriodYears(expected_life) # just uses argument value, does not need existing value elsif new_def_LCC.category == 'Salvage' new_def_LCC.setCost(new_def_LCC.cost * (1 + demolition_cost / 100)) new_def_LCC.setYearsFromStart(years_until_costs_start + expected_life) # just uses argument value, does not need existing value new_def_LCC.setRepeatPeriodYears(expected_life) # just uses argument value, does not need existing value elsif new_def_LCC.category == 'Maintenance' new_def_LCC.setCost(new_def_LCC.cost * (1 + om_cost / 100)) new_def_LCC.setRepeatPeriodYears(om_frequency) # just uses argument value, does not need existing value end # reset any month durations new_def_LCC.resetRepeatPeriodMonths new_def_LCC.resetMonthsFromStart end end end |
#arguments(model) ⇒ Object
define the arguments that the user will input
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/measures/ReduceElectricEquipmentLoadsByPercentage/measure.rb', line 27 def arguments(model) args = OpenStudio::Measure::OSArgumentVector.new # make a choice argument for model objects space_type_handles = OpenStudio::StringVector.new space_type_display_names = OpenStudio::StringVector.new # putting model object and names into hash space_type_args = model.getSpaceTypes space_type_args_hash = {} space_type_args.each do |space_type_arg| space_type_args_hash[space_type_arg.name.to_s] = space_type_arg end # looping through sorted hash of model objects space_type_args_hash.sort.map do |key, value| # only include if space type is used in the model if !value.spaces.empty? space_type_handles << value.handle.to_s space_type_display_names << key end end # add building to string vector with space type building = model.getBuilding space_type_handles << building.handle.to_s space_type_display_names << '*Entire Building*' # make a choice argument for space type space_type = OpenStudio::Measure::OSArgument.makeChoiceArgument('space_type', space_type_handles, space_type_display_names) space_type.setDisplayName('Apply the Measure to a Specific Space Type or to the Entire Model') space_type.setDefaultValue('*Entire Building*') # if no space type is chosen this will run on the entire building args << space_type # make an argument for reduction percentage elecequip_power_reduction_percent = OpenStudio::Measure::OSArgument.makeDoubleArgument('elecequip_power_reduction_percent', true) elecequip_power_reduction_percent.setDisplayName('Electric Equipment Power Reduction') elecequip_power_reduction_percent.setDefaultValue(30.0) elecequip_power_reduction_percent.setUnits('%') args << elecequip_power_reduction_percent # make an argument for material and installation cost material_and_installation_cost = OpenStudio::Measure::OSArgument.makeDoubleArgument('material_and_installation_cost', true) material_and_installation_cost.setDisplayName('Increase in Material and Installation Cost for Electric Equipment per Floor Area') material_and_installation_cost.setDefaultValue(0.0) material_and_installation_cost.setUnits('%') args << material_and_installation_cost # make an argument for demolition cost demolition_cost = OpenStudio::Measure::OSArgument.makeDoubleArgument('demolition_cost', true) demolition_cost.setDisplayName('Increase in Demolition Costs for Electric Equipment per Floor Area') demolition_cost.setDefaultValue(0.0) demolition_cost.setUnits('%') args << demolition_cost # make an argument for years until costs start years_until_costs_start = OpenStudio::Measure::OSArgument.makeIntegerArgument('years_until_costs_start', true) years_until_costs_start.setDisplayName('Years Until Costs Start') years_until_costs_start.setDefaultValue(0) years_until_costs_start.setUnits('whole years') args << years_until_costs_start # make a choice argument for when demo costs occur demo_cost_initial_const = OpenStudio::Measure::OSArgument.makeBoolArgument('demo_cost_initial_const', true) demo_cost_initial_const.setDisplayName('Demolition Costs Occur During Initial Construction') demo_cost_initial_const.setDefaultValue(false) args << demo_cost_initial_const # make an argument for expected life expected_life = OpenStudio::Measure::OSArgument.makeIntegerArgument('expected_life', true) expected_life.setDisplayName('Expected Life') expected_life.setDefaultValue(15) expected_life.setUnits('whole years') args << expected_life # make an argument for O & M cost om_cost = OpenStudio::Measure::OSArgument.makeDoubleArgument('om_cost', true) om_cost.setDisplayName('Increase O & M Costs for Electric Equipment per Floor Area') om_cost.setDefaultValue(0.0) om_cost.setUnits('%') args << om_cost # make an argument for O & M frequency om_frequency = OpenStudio::Measure::OSArgument.makeIntegerArgument('om_frequency', true) om_frequency.setDisplayName('O & M Frequency') om_frequency.setDefaultValue(1) om_frequency.setUnits('whole years') args << om_frequency return args end |
#description ⇒ Object
human readable description
16 17 18 19 |
# File 'lib/measures/ReduceElectricEquipmentLoadsByPercentage/measure.rb', line 16 def description return 'Reduce Electric Equipment Loads by Percentage</display_name> <description>Reduce electric equipment loads. This will affect equipment that have a, power, power per area (LPD), or power per person value. This can be applied to the entire building or a specific space type. A positive percentage represents an increase electric equipment power, while a negative percentage can be used for an increase in electric equipment power.' end |
#get_total_costs_for_objects(objects) ⇒ Object
helper that loops through lifecycle costs getting total costs under “Construction” or “Salvage” category and add to counter if occurs during year 0
222 223 224 225 226 227 228 229 230 231 232 233 234 235 |
# File 'lib/measures/ReduceElectricEquipmentLoadsByPercentage/measure.rb', line 222 def get_total_costs_for_objects(objects) counter = 0 objects.each do |object| object_LCCs = object.lifeCycleCosts object_LCCs.each do |object_LCC| if (object_LCC.category == 'Construction') || (object_LCC.category == 'Salvage') if object_LCC.yearsFromStart == 0 counter += object_LCC.totalCost end end end end return counter end |
#modeler_description ⇒ Object
human readable description of modeling approach
22 23 24 |
# File 'lib/measures/ReduceElectricEquipmentLoadsByPercentage/measure.rb', line 22 def modeler_description return 'Loop through all electric equipment objects in the specified space type or the entire building. Clone the definition if it has not already been cloned, rename and adjust the power based on the specified percentage. Link the new definition to the existing electric equipment instance. Loop through objects first in space types and then in spaces, but only for spaces that are in the specified space type, unless entire building has been chosen.' end |
#name ⇒ Object
define the name that a user will see
11 12 13 |
# File 'lib/measures/ReduceElectricEquipmentLoadsByPercentage/measure.rb', line 11 def name return 'Reduce Electric Equipment Loads by Percentage' end |
#neat_numbers(number, roundto = 2) ⇒ Object
helper to make numbers pretty (converts 4125001.25641 to 4,125,001.26 or 4,125,001). The definition be called through this measure.
206 207 208 209 210 211 212 213 214 |
# File 'lib/measures/ReduceElectricEquipmentLoadsByPercentage/measure.rb', line 206 def neat_numbers(number, roundto = 2) # round to 0 or 2) if roundto == 2 number = format '%.2f', number else number = number.round end # regex to add commas number.to_s.reverse.gsub(/([0-9]{3}(?=([0-9])))/, '\\1,').reverse end |
#run(model, runner, user_arguments) ⇒ Object
define what happens when the measure is run
120 121 122 123 124 125 126 127 128 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 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 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 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 |
# File 'lib/measures/ReduceElectricEquipmentLoadsByPercentage/measure.rb', line 120 def run(model, runner, user_arguments) super(model, runner, user_arguments) # use the built-in error checking if !runner.validateUserArguments(arguments(model), user_arguments) return false end # assign the user inputs to variables object = runner.getOptionalWorkspaceObjectChoiceValue('space_type', user_arguments, model) elecequip_power_reduction_percent = runner.getDoubleArgumentValue('elecequip_power_reduction_percent', user_arguments) material_and_installation_cost = runner.getDoubleArgumentValue('material_and_installation_cost', user_arguments) demolition_cost = runner.getDoubleArgumentValue('demolition_cost', user_arguments) years_until_costs_start = runner.getIntegerArgumentValue('years_until_costs_start', user_arguments) demo_cost_initial_const = runner.getBoolArgumentValue('demo_cost_initial_const', user_arguments) expected_life = runner.getIntegerArgumentValue('expected_life', user_arguments) om_cost = runner.getDoubleArgumentValue('om_cost', user_arguments) om_frequency = runner.getIntegerArgumentValue('om_frequency', user_arguments) # check the space_type for reasonableness and see if measure should run on space type or on the entire building apply_to_building = false space_type = nil if object.empty? handle = runner.getStringArgumentValue('space_type', user_arguments) if handle.empty? runner.registerError('No space type was chosen.') else runner.registerError("The selected space type with handle '#{handle}' was not found in the model. It may have been removed by another measure.") end return false else if !object.get.to_SpaceType.empty? space_type = object.get.to_SpaceType.get elsif !object.get.to_Building.empty? apply_to_building = true else runner.registerError('Script Error - argument not showing up as space type or building.') return false end end # check the elecequip_power_reduction_percent and for reasonableness if elecequip_power_reduction_percent > 100 runner.registerError('Please Enter a Value less than or equal to 100 for the Electric Equipment Power Reduction Percentage.') return false elsif elecequip_power_reduction_percent == 0 runner.registerInfo('No electric electric equipment power adjustment requested, but some life cycle costs may still be affected.') elsif (elecequip_power_reduction_percent < 1) && (elecequip_power_reduction_percent > -1) runner.registerWarning("A Electric Equipment Power Reduction Percentage of #{elecequip_power_reduction_percent} percent is abnormally low.") elsif elecequip_power_reduction_percent > 90 runner.registerWarning("A Electric Equipment Power Reduction Percentage of #{elecequip_power_reduction_percent} percent is abnormally high.") elsif elecequip_power_reduction_percent < 0 runner.registerInfo('The requested value for electric equipment power reduction percentage was negative. This will result in an increase in electric eqipment power.') end # check lifecycle cost arguments for reasonableness if material_and_installation_cost < -100 runner.registerError("Material and Installation Cost percentage increase can't be less than -100.") return false end if demolition_cost < -100 runner.registerError("Demolition Cost percentage increase can't be less than -100.") return false end if years_until_costs_start < 0 runner.registerError('Enter an integer greater than or equal to 0 for Years Until Costs Start.') return false end if expected_life < 1 runner.registerError('Enter an integer greater than or equal to 1 for Expected Life.') return false end if om_cost < -100 runner.registerError("O & M Cost percentage increase can't be less than -100.") return false end if om_frequency < 1 runner.registerError('Choose an integer greater than 0 for O & M Frequency.') end # helper to make numbers pretty (converts 4125001.25641 to 4,125,001.26 or 4,125,001). The definition be called through this measure. def neat_numbers(number, roundto = 2) # round to 0 or 2) if roundto == 2 number = format '%.2f', number else number = number.round end # regex to add commas number.to_s.reverse.gsub(/([0-9]{3}(?=([0-9])))/, '\\1,').reverse end # helper to make it easier to do unit conversions on the fly. The definition be called through this measure. def unit_helper(number, from_unit_string, to_unit_string) converted_number = OpenStudio.convert(OpenStudio::Quantity.new(number, OpenStudio.createUnit(from_unit_string).get), OpenStudio.createUnit(to_unit_string).get).get.value end # helper that loops through lifecycle costs getting total costs under "Construction" or "Salvage" category and add to counter if occurs during year 0 def get_total_costs_for_objects(objects) counter = 0 objects.each do |object| object_LCCs = object.lifeCycleCosts object_LCCs.each do |object_LCC| if (object_LCC.category == 'Construction') || (object_LCC.category == 'Salvage') if object_LCC.yearsFromStart == 0 counter += object_LCC.totalCost end end end end return counter end # counter for demo cost of baseline objects demo_costs_of_baseline_objects = 0 # counter for year 0 capital costs yr0_capital_totalCosts = 0 # get initial electric equipment costs and multiply by -1 yr0_capital_totalCosts += get_total_costs_for_objects(model.getElectricEquipmentDefinitions) * -1 # report initial condition building = model.getBuilding building_equip_power = building.electricEquipmentPower building_EPD = unit_helper(building.electricEquipmentPowerPerFloorArea, 'W/m^2', 'W/ft^2') runner.registerInitialCondition("The model's initial building electric equipment power was #{neat_numbers(building_equip_power, 0)} watts, an electric equipment power density of #{neat_numbers(building_EPD)} w/ft^2.") # get space types in model if apply_to_building space_types = model.getSpaceTypes else space_types = [] space_types << space_type # only run on a single space type end # helper def to add to demo cost related to baseline objects def add_to_baseline_demo_cost_counter(baseline_object, demo_cost_initial_const) counter = 0 if demo_cost_initial_const == true baseline_object_LCCs = baseline_object.lifeCycleCosts baseline_object_LCCs.each do |baseline_object_LCC| if baseline_object_LCC.category == 'Salvage' counter += baseline_object_LCC.totalCost end end end return counter end # def to alter performance and life cycle costs of objects def alter_performance_and_lcc(object, elecequip_power_reduction_percent, material_and_installation_cost, demolition_cost, om_cost, years_until_costs_start, expected_life, om_frequency, runner) # edit clone based on percentage reduction new_def = object if !new_def.designLevel.empty? new_electric_equipment_level = new_def.setDesignLevel(new_def.designLevel.get - new_def.designLevel.get * elecequip_power_reduction_percent * 0.01) elsif !new_def.wattsperSpaceFloorArea.empty? new_electric_equipment_per_area = new_def.setWattsperSpaceFloorArea(new_def.wattsperSpaceFloorArea.get - new_def.wattsperSpaceFloorArea.get * elecequip_power_reduction_percent * 0.01) elsif !new_def.wattsperPerson.empty? new_electric_equipment_per_person = new_def.setWattsperPerson(new_def.wattsperPerson.get - new_def.wattsperPerson.get * elecequip_power_reduction_percent * 0.01) else runner.registerWarning("'#{new_def.name}' is used by one or more instances and has no load values. Its performance was not altered.") end new_def_LCCs = new_def.lifeCycleCosts if new_def_LCCs.empty? if material_and_installation_cost.abs + demolition_cost.abs + om_cost.abs != 0 runner.registerWarning("'#{new_def.name}' had no life cycle cost objects. No cost was added for it.") end else new_def_LCCs.each do |new_def_LCC| if new_def_LCC.category == 'Construction' new_def_LCC.setCost(new_def_LCC.cost * (1 + material_and_installation_cost / 100)) new_def_LCC.setYearsFromStart(years_until_costs_start) # just uses argument value, does not need existing value new_def_LCC.setRepeatPeriodYears(expected_life) # just uses argument value, does not need existing value elsif new_def_LCC.category == 'Salvage' new_def_LCC.setCost(new_def_LCC.cost * (1 + demolition_cost / 100)) new_def_LCC.setYearsFromStart(years_until_costs_start + expected_life) # just uses argument value, does not need existing value new_def_LCC.setRepeatPeriodYears(expected_life) # just uses argument value, does not need existing value elsif new_def_LCC.category == 'Maintenance' new_def_LCC.setCost(new_def_LCC.cost * (1 + om_cost / 100)) new_def_LCC.setRepeatPeriodYears(om_frequency) # just uses argument value, does not need existing value end # reset any month durations new_def_LCC.resetRepeatPeriodMonths new_def_LCC.resetMonthsFromStart end end end # make a hash of old defs and new electric equipment defs cloned_elecequip_defs = {} # loop through space types space_types.each do |space_type| next if space_type.spaces.size <= 0 space_type_equipments = space_type.electricEquipment space_type_equipments.each do |space_type_equipment| new_def = nil # clone def if it has not already been cloned exist_def = space_type_equipment.electricEquipmentDefinition if !cloned_elecequip_defs[exist_def.name.get.to_s].nil? new_def = cloned_elecequip_defs[exist_def.name.get.to_s] else # clone rename and add to hash new_def = exist_def.clone(model) new_def_name = new_def.setName("#{exist_def.name.get} - #{elecequip_power_reduction_percent} percent reduction") new_def = new_def.to_ElectricEquipmentDefinition.get cloned_elecequip_defs[exist_def.name.get.to_s] = new_def # add demo cost of object being removed to one counter for one time demo cost for baseline objects demo_costs_of_baseline_objects += add_to_baseline_demo_cost_counter(exist_def, demo_cost_initial_const) # call def to alter performance and life cycle costs alter_performance_and_lcc(new_def, elecequip_power_reduction_percent, material_and_installation_cost, demolition_cost, om_cost, years_until_costs_start, expected_life, om_frequency, runner) end # link instance with clone and rename updated_instance = space_type_equipment.setElectricEquipmentDefinition(new_def.to_ElectricEquipmentDefinition.get) updated_instance_name = space_type_equipment.setName("#{space_type_equipment.name} #{elecequip_power_reduction_percent} percent reduction") end end # getting spaces in the model spaces = model.getSpaces # get space types in model if apply_to_building spaces = model.getSpaces else if !space_type.spaces.empty? spaces = space_type.spaces # only run on a single space type end end spaces.each do |space| space_equipments = space.electricEquipment space_equipments.each do |space_equipment| # clone def if it has not already been cloned exist_def = space_equipment.electricEquipmentDefinition if cloned_elecequip_defs.any? { |k, v| k.to_s == exist_def.name.get.to_s } new_def = cloned_elecequip_defs[exist_def.name.get.to_s] else # clone rename and add to hash new_def = exist_def.clone(model) new_def_name = new_def.setName("#{new_def.name} - #{elecequip_power_reduction_percent} percent reduction") cloned_elecequip_defs[exist_def.name.get] = new_def new_def = new_def.to_ElectricEquipmentDefinition.get # add demo cost of object being removed to one counter for one time demo cost for baseline objects demo_costs_of_baseline_objects += add_to_baseline_demo_cost_counter(exist_def, demo_cost_initial_const) # call def to alter performance and life cycle costs alter_performance_and_lcc(new_def, elecequip_power_reduction_percent, material_and_installation_cost, demolition_cost, om_cost, years_until_costs_start, expected_life, om_frequency, runner) end # link instance with clone and rename updated_instance = space_equipment.setElectricEquipmentDefinition(new_def.to_ElectricEquipmentDefinition.get) updated_instance_name = space_equipment.setName("#{space_equipment.name} #{elecequip_power_reduction_percent} percent reduction") end end if cloned_elecequip_defs.empty? runner.registerAsNotApplicable('No electric equipment objects were found in the specified space type(s).') end # get final electric equipment costs to use in final condition yr0_capital_totalCosts += get_total_costs_for_objects(model.getElectricEquipmentDefinitions) # add one time demo cost of removed electric equipment if appropriate if demo_cost_initial_const == true building = model.getBuilding lcc_baseline_demo = OpenStudio::Model::LifeCycleCost.createLifeCycleCost('LCC_baseline_demo', building, demo_costs_of_baseline_objects, 'CostPerEach', 'Salvage', 0, years_until_costs_start).get # using 0 for repeat period since one time cost. runner.registerInfo("Adding one time cost of $#{neat_numbers(lcc_baseline_demo.totalCost, 0)} related to demolition of baseline objects.") # if demo occurs on year 0 then add to initial capital cost counter if lcc_baseline_demo.yearsFromStart == 0 yr0_capital_totalCosts += lcc_baseline_demo.totalCost end end # report final condition final_building = model.getBuilding final_building_equip_power = final_building.electricEquipmentPower final_building_EPD = unit_helper(final_building.electricEquipmentPowerPerFloorArea, 'W/m^2', 'W/ft^2') runner.registerFinalCondition("The model's final building electric equipment power was #{neat_numbers(final_building_equip_power, 0)} watts, an electric equipment power density of #{neat_numbers(final_building_EPD)} w/ft^2. Initial capital costs associated with the improvements are $#{neat_numbers(yr0_capital_totalCosts, 0)}.") return true end |
#unit_helper(number, from_unit_string, to_unit_string) ⇒ Object
helper to make it easier to do unit conversions on the fly. The definition be called through this measure.
217 218 219 |
# File 'lib/measures/ReduceElectricEquipmentLoadsByPercentage/measure.rb', line 217 def unit_helper(number, from_unit_string, to_unit_string) converted_number = OpenStudio.convert(OpenStudio::Quantity.new(number, OpenStudio.createUnit(from_unit_string).get), OpenStudio.createUnit(to_unit_string).get).get.value end |