Class: ZEDGVRFWithDOAS
- Inherits:
-
OpenStudio::Measure::ModelMeasure
- Object
- OpenStudio::Measure::ModelMeasure
- ZEDGVRFWithDOAS
- Defined in:
- lib/measures/zedgk_12_hvac_vrf_with_doas/measure.rb
Overview
start the measure
Instance Method Summary collapse
-
#arguments(model) ⇒ Object
define the arguments that the user will input.
-
#name ⇒ Object
define the name that a user will see, this method may be deprecated as the display name in PAT comes from the name field in measure.xml.
-
#run(model, runner, user_arguments) ⇒ Object
define what happens when the measure is run.
Instance Method Details
#arguments(model) ⇒ Object
define the arguments that the user will input
25 26 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 |
# File 'lib/measures/zedgk_12_hvac_vrf_with_doas/measure.rb', line 25 def arguments(model) args = OpenStudio::Measure::OSArgumentVector.new # create an argument for a space type to be used in the model, to see if one should be mapped as ceiling return air plenum spaceTypes = model.getSpaceTypes usedSpaceTypes_handle = OpenStudio::StringVector.new usedSpaceTypes_displayName = OpenStudio::StringVector.new spaceTypes.each do |spaceType| # TODO: - I need to update this to use helper so GUI sorts by display name if !spaceType.spaces.empty? # only show space types used in the building usedSpaceTypes_handle << spaceType.handle.to_s usedSpaceTypes_displayName << spaceType.name.to_s end end # make an argument for space type ceilingReturnPlenumSpaceType = OpenStudio::Measure::OSArgument.makeChoiceArgument('ceilingReturnPlenumSpaceType', usedSpaceTypes_handle, usedSpaceTypes_displayName, false) ceilingReturnPlenumSpaceType.setDisplayName('This space type should be part of a ceiling return air plenum.') args << ceilingReturnPlenumSpaceType # make an argument for material and installation cost # todo - I would like to split the costing out to the air loops weighted by area of building served vs. just sticking it on the building costTotalHVACSystem = OpenStudio::Measure::OSArgument.makeDoubleArgument('costTotalHVACSystem', true) costTotalHVACSystem.setDisplayName('Total Cost for HVAC System ($).') costTotalHVACSystem.setDefaultValue(0.0) args << costTotalHVACSystem # make an argument to remove existing costs remake_schedules = OpenStudio::Measure::OSArgument.makeBoolArgument('remake_schedules', true) remake_schedules.setDisplayName('Apply recommended availability and ventilation schedules for air handlers?') remake_schedules.setDefaultValue(true) args << remake_schedules return args end |
#name ⇒ Object
define the name that a user will see, this method may be deprecated as the display name in PAT comes from the name field in measure.xml
20 21 22 |
# File 'lib/measures/zedgk_12_hvac_vrf_with_doas/measure.rb', line 20 def name return 'ZEDG VRF with DOAS' end |
#run(model, runner, user_arguments) ⇒ Object
define what happens when the measure is run
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 118 119 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 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 |
# File 'lib/measures/zedgk_12_hvac_vrf_with_doas/measure.rb', line 61 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 # hard coded default values from old measure arguments vrfCondenserType = 'AirCooled' vrfCoolCOP = 4.0 vrfHeatCOP = 4.0 vrfMinOATHPHeat = -4.0 vrfDefrost = 'Resistive' vrfHPHeatRecovery = 'Yes' vrfEquivPipingLength = 100.0 vrfPipingHeight = 35.0 doasFanType = 'Variable' doasERV = 'plate w/o economizer lockout - zedg' doasEvap = 'none' doasDXEER = 10.0 parameters = { 'vrfCondenserType' => vrfCondenserType, 'vrfCoolCOP' => vrfCoolCOP, 'vrfHeatCOP' => vrfHeatCOP, 'vrfMinOATHPHeat' => vrfMinOATHPHeat, 'vrfDefrost' => vrfDefrost, 'vrfHPHeatRecovery' => vrfHPHeatRecovery, 'vrfEquivPipingLength' => vrfEquivPipingLength, 'vrfPipingHeight' => vrfPipingHeight, 'doasFanType' => doasFanType, 'doasERV' => doasERV, 'doasEvap' => doasEvap, 'doasDXEER' => doasDXEER } ### START INPUTS # assign the user inputs to variables ceilingReturnPlenumSpaceType = runner.getOptionalWorkspaceObjectChoiceValue('ceilingReturnPlenumSpaceType', user_arguments, model) costTotalHVACSystem = runner.getDoubleArgumentValue('costTotalHVACSystem', user_arguments) remake_schedules = runner.getBoolArgumentValue('remake_schedules', user_arguments) # check that spaceType was chosen and exists in model ceilingReturnPlenumSpaceTypeCheck = OsLib_HelperMethods.checkOptionalChoiceArgFromModelObjects(ceilingReturnPlenumSpaceType, 'ceilingReturnPlenumSpaceType', 'to_SpaceType', runner, user_arguments) ceilingReturnPlenumSpaceTypeCheck == false ? (return false) : (ceilingReturnPlenumSpaceType = ceilingReturnPlenumSpaceTypeCheck['modelObject']) # default building/ secondary space types standardBuildingTypeTest = [] # ML Not used yet secondarySpaceTypeTest = ['Cafeteria', 'Kitchen', 'Gym', 'Auditorium'] primarySpaceType = 'Office' if doasFanType == 'Variable' primaryHVAC = { 'doas' => true, 'fan' => 'Variable', 'heat' => 'SingleDX', 'cool' => 'TwoSpeedDX' } else primaryHVAC = { 'doas' => true, 'fan' => 'Constant', 'heat' => 'Gas', 'cool' => 'SingleDX' } end secondaryHVAC = { 'fan' => 'None', 'heat' => 'None', 'cool' => 'None' } # ML not used for office; leave or empty? zoneHVAC = 'VRF' chillerType = 'None' # set to none if chiller not used radiantChillerType = 'None' # set to none if not radiant system allHVAC = { 'primary' => primaryHVAC, 'secondary' => secondaryHVAC, 'zone' => zoneHVAC } ### END INPUTS ### START SORT ZONES = { 'standardBuildingTypeTest' => standardBuildingTypeTest, # ML Not used yet 'secondarySpaceTypeTest' => secondarySpaceTypeTest, 'ceilingReturnPlenumSpaceType' => ceilingReturnPlenumSpaceType } zonesSorted = OsLib_HVAC_zedg_vrf.sortZones(model, runner, ) zonesPrimary = zonesSorted['zonesPrimary'] zonesSecondary = zonesSorted['zonesSecondary'] zonesPlenum = zonesSorted['zonesPlenum'] zonesUnconditioned = zonesSorted['zonesUnconditioned'] ### END SORT ZONES ### START REPORT INITIAL CONDITIONS OsLib_HVAC_zedg_vrf.reportConditions(model, runner, 'initial') ### END REPORT INITIAL CONDITIONS ### START ASSIGN HVAC SCHEDULES = { 'primarySpaceType' => primarySpaceType, 'allHVAC' => allHVAC, 'remake_schedules' => remake_schedules } schedulesHVAC = OsLib_HVAC_zedg_vrf.assignHVACSchedules(model, runner, ) # assign schedules primary_SAT_schedule = schedulesHVAC['primary_sat'] building_HVAC_schedule = schedulesHVAC['hvac'] building_ventilation_schedule = schedulesHVAC['ventilation'] make_hot_water_plant = false unless schedulesHVAC['hot_water'].nil? hot_water_setpoint_schedule = schedulesHVAC['hot_water'] make_hot_water_plant = true end make_chilled_water_plant = false unless schedulesHVAC['chilled_water'].nil? chilled_water_setpoint_schedule = schedulesHVAC['chilled_water'] make_chilled_water_plant = true end make_radiant_hot_water_plant = false unless schedulesHVAC['radiant_hot_water'].nil? radiant_hot_water_setpoint_schedule = schedulesHVAC['radiant_hot_water'] make_radiant_hot_water_plant = true end make_radiant_chilled_water_plant = false unless schedulesHVAC['radiant_chilled_water'].nil? radiant_chilled_water_setpoint_schedule = schedulesHVAC['radiant_chilled_water'] make_radiant_chilled_water_plant = true end unless schedulesHVAC['hp_loop'].nil? heat_pump_loop_setpoint_schedule = schedulesHVAC['hp_loop'] end unless schedulesHVAC['hp_loop_cooling'].nil? heat_pump_loop_cooling_setpoint_schedule = schedulesHVAC['hp_loop_cooling'] end unless schedulesHVAC['hp_loop_heating'].nil? heat_pump_loop_heating_setpoint_schedule = schedulesHVAC['hp_loop_heating'] end unless schedulesHVAC['mean_radiant_heating'].nil? mean_radiant_heating_setpoint_schedule = schedulesHVAC['mean_radiant_heating'] end unless schedulesHVAC['mean_radiant_cooling'].nil? mean_radiant_cooling_setpoint_schedule = schedulesHVAC['mean_radiant_cooling'] end ### END ASSIGN HVAC SCHEDULES # START REMOVE EQUIPMENT = {} ['zonesPrimary'] = zonesPrimary if ['zonesPrimary'].empty? runner.registerInfo('User did not pick any zones to be added to VRF system, no changes to the model were made.') else OsLib_HVAC_zedg_vrf.removeEquipment(model, runner, ) end ### END REMOVE EQUIPMENT ### START CREATE NEW PLANTS # create new plants # hot water plant if make_hot_water_plant hot_water_plant = OsLib_HVAC_zedg_vrf.createHotWaterPlant(model, runner, hot_water_setpoint_schedule, 'Hot Water', parameters) end # chilled water plant if make_chilled_water_plant chilled_water_plant = OsLib_HVAC_zedg_vrf.createChilledWaterPlant(model, runner, chilled_water_setpoint_schedule, 'Chilled Water', chillerType) end # radiant hot water plant if make_radiant_hot_water_plant radiant_hot_water_plant = OsLib_HVAC_zedg_vrf.createHotWaterPlant(model, runner, radiant_hot_water_setpoint_schedule, 'Radiant Hot Water', parameters) end # chilled water plant if make_radiant_chilled_water_plant radiant_chilled_water_plant = OsLib_HVAC_zedg_vrf.createChilledWaterPlant(model, runner, radiant_chilled_water_setpoint_schedule, 'Radiant Chilled Water', radiantChillerType) end # condenser loop # need condenser loop if there is a water-cooled chiller or if there is a water source heat pump loop or a water cooled VRF condenser = {} ['zonesPrimary'] = zonesPrimary ['zoneHVAC'] = zoneHVAC if zoneHVAC.include?('SHP') || (zoneHVAC == 'VRF') && (parameters['vrfCondenserType'] == 'WaterCooled') ['loop_setpoint_schedule'] = heat_pump_loop_setpoint_schedule ['cooling_setpoint_schedule'] = heat_pump_loop_cooling_setpoint_schedule ['heating_setpoint_schedule'] = heat_pump_loop_heating_setpoint_schedule runner.registerInfo('yes, loop schedule created') end if parameters['vrfCondenserType'] == 'WaterCooled' condenserLoops = OsLib_HVAC_zedg_vrf.createCondenserLoop(model, runner, , parameters) else condenserLoops = {} end unless condenserLoops['condenser_loop'].nil? condenser_loop = condenserLoops['condenser_loop'] end unless condenserLoops['heat_pump_loop'].nil? heat_pump_loop = condenserLoops['heat_pump_loop'] runner.registerInfo('vrf condenser loop is created') end ### END CREATE NEW PLANTS ### START CREATE PRIMARY AIRLOOPS # populate inputs hash for create primary airloops method = {} ['zonesPrimary'] = zonesPrimary ['primaryHVAC'] = primaryHVAC ['zoneHVAC'] = zoneHVAC if primaryHVAC['doas'] ['hvac_schedule'] = building_ventilation_schedule ['ventilation_schedule'] = building_ventilation_schedule else # primary HVAC is multizone VAV if zoneHVAC == 'DualDuct' # primary system is a multizone VAV that cools only (primary system ventilation schedule is set to always off; hvac set to always on) ['hvac_schedule'] = model.alwaysOnDiscreteSchedule else # primary system is multizone VAV that cools and ventilates ['hvac_schedule'] = building_HVAC_schedule ['ventilation_schedule'] = building_ventilation_schedule end end ['primary_sat_schedule'] = primary_SAT_schedule if make_hot_water_plant ['hot_water_plant'] = hot_water_plant end if make_chilled_water_plant ['chilled_water_plant'] = chilled_water_plant end primary_airloops = OsLib_HVAC_zedg_vrf.createPrimaryAirLoops(model, runner, , parameters) ### END CREATE PRIMARY AIRLOOPS if zoneHVAC.include? 'VRF' ['heat_pump_loop'] = heat_pump_loop end # string check for components used twice string_check = 'v350.osc' # change to `old.osc` to test using 1.x source OSC files # added in custom code to load components to be used by createVRFAirConditioners files = Dir.entries("#{File.dirname(__FILE__)}/resources/") files.each do |new_object| next if !new_object.include?(string_check) # load the osc file new_object_path = OpenStudio::Path.new("#{File.dirname(__FILE__)}/resources/#{new_object}") new_object_file = OpenStudio::IdfFile.load(new_object_path) if new_object_file.empty? runner.registerError("Unable to find the file #{new_object}.osc") return false else new_object_file = new_object_file.get end vt = OpenStudio::OSVersion::VersionTranslator.new new_objectComponent = vt.loadComponent(OpenStudio::Path.new(new_object_path)) if new_objectComponent.empty? runner.registerError("Cannot load new_object component '#{new_object_file}'") return false else object = new_objectComponent.get.primaryObject componentData = model.insertComponent(new_objectComponent.get) if componentData.empty? runner.registerError("Failed to insert new_object component '#{new_object_file}' into model") return false else new_new_object = componentData.get.primaryComponentObject runner.registerInfo("Added #{new_new_object.name} into model") # add to options hash if new_new_object.to_AirConditionerVariableRefrigerantFlow.is_initialized ['vrf_ac'] = new_new_object elsif new_new_object.to_ZoneHVACTerminalUnitVariableRefrigerantFlow.is_initialized ['vrf_terminal'] = new_new_object else runner.regsiterError('Unexpected object type') return false end end end end vrf_airconditioners = OsLib_HVAC_zedg_vrf.createVRFAirConditioners(model, runner, , parameters) ### START CREATE SECONDARY AIRLOOPS # populate inputs hash for create primary airloops method = {} ['zonesSecondary'] = zonesSecondary ['secondaryHVAC'] = secondaryHVAC ['hvac_schedule'] = building_HVAC_schedule ['ventilation_schedule'] = building_ventilation_schedule if make_hot_water_plant ['hot_water_plant'] = hot_water_plant end if make_chilled_water_plant ['chilled_water_plant'] = chilled_water_plant end # secondary_airloops = OsLib_HVAC_zedg_vrf.createSecondaryAirLoops(model, runner, options) ### END CREATE SECONDARY AIRLOOPS ### START ASSIGN PLENUMS = { 'zonesPrimary' => zonesPrimary, 'zonesPlenum' => zonesPlenum } zone_plenum_hash = OsLib_HVAC_zedg_vrf.validateAndAddPlenumZonesToSystem(model, runner, ) ### END ASSIGN PLENUMS ### START CREATE PRIMARY ZONE EQUIPMENT = {} ['zonesPrimary'] = zonesPrimary ['zoneHVAC'] = zoneHVAC if make_hot_water_plant ['hot_water_plant'] = hot_water_plant end if make_chilled_water_plant ['chilled_water_plant'] = chilled_water_plant end if zoneHVAC.include?('SHP') || (zoneHVAC == 'VRF') ['heat_pump_loop'] = heat_pump_loop end if zoneHVAC == 'DualDuct' ['ventilation_schedule'] = building_ventilation_schedule end if zoneHVAC == 'Radiant' ['radiant_hot_water_plant'] = radiant_hot_water_plant ['radiant_chilled_water_plant'] = radiant_chilled_water_plant ['mean_radiant_heating_setpoint_schedule'] = mean_radiant_heating_setpoint_schedule ['mean_radiant_cooling_setpoint_schedule'] = mean_radiant_cooling_setpoint_schedule end OsLib_HVAC_zedg_vrf.createPrimaryZoneEquipment(model, runner, , parameters) ### END CREATE PRIMARY ZONE EQUIPMENT # START ADD DCV = {} unless zoneHVAC == 'DualDuct' ['primary_airloops'] = primary_airloops end # options["secondary_airloops"] = secondary_airloops ['allHVAC'] = allHVAC OsLib_HVAC_zedg_vrf.addDCV(model, runner, ) # END ADD DCV # add in lifecycle costs expected_life = 25 years_until_costs_start = 0 costHVAC = costTotalHVACSystem lcc_mat = OpenStudio::Model::LifeCycleCost.createLifeCycleCost('HVAC System', model.getBuilding, costHVAC, 'CostPerEach', 'Construction', expected_life, years_until_costs_start).get # added in custom code to load components to be used by createVRFAirConditioners base_vrf_ac = nil base_vrf_terminalUnit = nil files = Dir.entries("#{File.dirname(__FILE__)}/resources/") files.each do |new_object| next if !new_object.include?(string_check) runner.registerInfo("Importing component from #{new_object}") # load the osc file new_object_path = OpenStudio::Path.new("#{File.dirname(__FILE__)}/resources/#{new_object}") new_object_file = OpenStudio::IdfFile.load(new_object_path) if new_object_file.empty? runner.registerError("Unable to find the file #{new_object}.osc") return false else new_object_file = new_object_file.get end vt = OpenStudio::OSVersion::VersionTranslator.new new_objectComponent = vt.loadComponent(OpenStudio::Path.new(new_object_path)) if new_objectComponent.empty? runner.registerError("Cannot load new_object component '#{new_object_file}'") return false else object = new_objectComponent.get.primaryObject componentData = model.insertComponent(new_objectComponent.get) if componentData.empty? runner.registerError("Failed to insert new_object component '#{new_object_file}' into model") return false else new_new_object = componentData.get.primaryComponentObject runner.registerInfo("Added #{new_new_object.name} into model") # add to options hash if new_new_object.to_AirConditionerVariableRefrigerantFlow.is_initialized base_vrf_ac = new_new_object elsif new_new_object.to_ZoneHVACTerminalUnitVariableRefrigerantFlow.is_initialized base_vrf_terminalUnit = new_new_object else runner.regsiterError('Unexpected object type') return false end end end end # add and alter base vrf acbase units in model base_vrf_ac = base_vrf_ac.to_AirConditionerVariableRefrigerantFlow.get base_vrf_ac.autosizeRatedTotalCoolingCapacity base_vrf_ac.autosizeRatedTotalHeatingCapacity base_vrf_ac.setHeatPumpWasteHeatRecovery(true) # add and alter base vrf terminal base_vrf_terminalUnit = base_vrf_terminalUnit.to_ZoneHVACTerminalUnitVariableRefrigerantFlow.get base_vrf_terminalUnit.autosizeSupplyAirFlowRateDuringCoolingOperation base_vrf_terminalUnit.autosizeSupplyAirFlowRateDuringHeatingOperation base_vrf_terminalUnit.(model.alwaysOffDiscreteSchedule) # don't set outdoor air flow rates to 0 since used in place of DOAS # get coils os_version = OpenStudio::VersionString.new(OpenStudio.openStudioVersion) min_version_feature1 = OpenStudio::VersionString.new('2.3.1') if os_version >= min_version_feature1 if base_vrf_terminalUnit.coolingCoil.is_initialized vrf_clg_coil = base_vrf_terminalUnit.coolingCoil.get.to_CoilCoolingDXVariableRefrigerantFlow.get else runner.registerWarning("Didn't find expected cooling coil for #{base_vrf_terminalUnit.name}") end if base_vrf_terminalUnit.heatingCoil.is_initialized vrf_htg_coil = base_vrf_terminalUnit.heatingCoil.get.to_CoilHeatingDXVariableRefrigerantFlow.get else runner.registerWarning("Didn't find expected heating coil for #{base_vrf_terminalUnit.name}") end else vrf_clg_coil = base_vrf_terminalUnit.coolingCoil vrf_htg_coil = base_vrf_terminalUnit.heatingCoil end # alter coils and fans vrf_clg_coil.autosizeRatedTotalCoolingCapacity vrf_clg_coil.autosizeRatedAirFlowRate vrf_clg_coil.autosizeRatedSensibleHeatRatio vrf_htg_coil.autosizeRatedTotalHeatingCapacity vrf_htg_coil.autosizeRatedAirFlowRate vrf_fan = base_vrf_terminalUnit.supplyAirFan.to_FanOnOff.get vrf_fan.autosizeMaximumFlowRate vrf_fan.setPressureRise(498) vrf_fan.setMotorEfficiency(0.85) # loop through zones assing HVAC zonesSecondary.each do |zone| runner.registerInfo("Adding VRF to #{zone.name}") # clone vrf_ac vrfAirConditioner = base_vrf_ac.clone(model).to_AirConditionerVariableRefrigerantFlow.get # construct Terminal VRF Unit vrf_terminalUnit = base_vrf_terminalUnit.clone(model).to_ZoneHVACTerminalUnitVariableRefrigerantFlow.get vrf_terminalUnit.addToThermalZone(zone) vrfAirConditioner.addTerminal(vrf_terminalUnit) end # remove base vrf units that were cloned into stories and spaces base_vrf_ac.remove base_vrf_terminalUnit.remove ### START REPORT FINAL CONDITIONS OsLib_HVAC_zedg_vrf.reportConditions(model, runner, 'final') ### END REPORT FINAL CONDITIONS return true end |