Module: BTAP::Resources::SpaceLoads

Defined in:
lib/openstudio-standards/btap/spaceloads.rb

Overview

This module contains methods that relate to Materials, Constructions and Construction Sets

Defined Under Namespace

Modules: ScaleLoads Classes: SpaceLoadsTests

Class Method Summary collapse

Class Method Details

.create_electric_load(model, elec_name, elec_watts_per_floor_area = 0.0, multiplier = 1.0, schedule = "") ⇒ String

This method created people loads from the model.

Parameters:

  • model (OpenStudio::model::Model)

    A model object

  • elec_name (String)
  • elec_watts_per_floor_area (Float) (defaults to: 0.0)
  • multiplier (Float) (defaults to: 1.0)
  • schedule (Float) (defaults to: "")

Returns:

Author:



286
287
288
289
290
291
292
293
294
295
296
# File 'lib/openstudio-standards/btap/spaceloads.rb', line 286

def self.create_electric_load(model,elec_name,elec_watts_per_floor_area = 0.0, multiplier = 1.0 ,schedule ="")
  raise("ElectricEquipment #{name} already exists. Please use a different name") unless model.getElectricEquipmentByName(elec_name).empty?
  elecdef = OpenStudio::Model::ElectricEquipmentDefinition.new(model)
  elecdef.setWattsperSpaceFloorArea(elec_watts_per_floor_area)
  elecdef.setName(elec_name + "-def" )
  elec = OpenStudio::Model::ElectricEquipment.new(elecdef)
  elec.setName(elec_name )
  elec.setMultiplier(multiplier)
  elec.setSchedule( BTAP::Common::validate_array(model,people_schedule,"ScheduleRuleset").first ) unless schedule == ""
  return elec
end

.create_hotwater_load(model, hot_water_name, hot_water_watts_per_floor_area = 0.0, multiplier = 1.0, schedule = "") ⇒ String

This method creats hot water load.

Parameters:

  • model (OpenStudio::model::Model)

    A model object

  • hot_water_name (String)
  • hot_water_watts_per_floor_area (Float) (defaults to: 0.0)
  • multiplier (Float) (defaults to: 1.0)
  • schedule (Float) (defaults to: "")

Returns:

Author:



314
315
316
317
318
319
320
321
322
323
324
# File 'lib/openstudio-standards/btap/spaceloads.rb', line 314

def self.create_hotwater_load(model,hot_water_name,hot_water_watts_per_floor_area = 0.0,multiplier = 1.0 ,schedule ="")
  raise("HotWaterEquipment #{name} already exists. Please use a different name") unless model.getHotWaterEquipmentByName(hot_water_name).empty?
  hotwaterdef = OpenStudio::Model::HotWaterEquipmentDefinition.new(model)
  hotwaterdef.setWattsperSpaceFloorArea(hot_water_watts_per_floor_area)
  hotwaterdef.setName(hot_water_name + "-def")
  hotwater = OpenStudio::Model::HotWaterEquipment.new(hotwaterdef)
  hotwater.setName(hot_water_name )
  hotwater.setMultiplier(multiplier)
  hotwater.setSchedule( BTAP::Common::validate_array(model,schedule,"ScheduleRuleset").first ) unless schedule == ""
  return hotwater
end

.create_infiltration_load(model, infil_name, value = 0.00025, method = "Flow/ExteriorArea", schedule = BTAP::Resources::Schedules::StandardSchedules::Fraction::always_on(model), setConstantTermCoefficient = 1.0, setTemperatureTermCoefficient = 0.0, setVelocityTermCoefficient = 0.0, setVelocitySquaredTermCoefficient = 0.0) ⇒ String

This method creates infiltration load. NECB infiltration rate is 0.25L/s/m2 or 0.00025 m3/s/m2

Parameters:

  • model (OpenStudio::model::Model)

    A model object

Returns:

  • (String)

    infiltration_load

Author:



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/openstudio-standards/btap/spaceloads.rb', line 386

def self.create_infiltration_load(model,
    infil_name,
    value = 0.00025 ,
    method = "Flow/ExteriorArea" ,
    schedule = BTAP::Resources::Schedules::StandardSchedules::Fraction::always_on(model),
    setConstantTermCoefficient = 1.0,
    setTemperatureTermCoefficient = 0.0,
    setVelocityTermCoefficient = 0.0,
    setVelocitySquaredTermCoefficient = 0.0 )
  #units are in m3/s for flow and m2 for area.
  #The method must be either Flow/Person,Flow/Area,Flow/Zone,AirChanges/Hour,Sum,Maximum.
  #Defaults to the maximum calculated value
  #units are in m3/s for flow and m2 for area.
  #The method must be either Flow/Space, Flow/Area,Flow/ExteriorArea,AirChanges/Hour,Sum,Maximum.
  #Defaults to the maximum calculated value
  raise("SpaceInfiltrationDesignFlowRate #{name} already exists. Please use a different name") unless model.getSpaceInfiltrationDesignFlowRateByName( infil_name ).empty?
  raise("infiltration method #{method} is not a part of accepted values such as: #{OpenStudio::Model::SpaceInfiltrationDesignFlowRate::validDesignFlowRateCalculationMethodValues.join(",")}")  unless OpenStudio::Model::SpaceInfiltrationDesignFlowRate::validDesignFlowRateCalculationMethodValues.include?(method)

  infiltration_load = OpenStudio::Model::SpaceInfiltrationDesignFlowRate.new(model)
  infiltration_load.setName(infil_name )
  infiltration_load.setDesignFlowRate(value) if method == "Flow/Space"
  infiltration_load.setFlowperSpaceFloorArea(value) if method == "Flow/Area"
  infiltration_load.setFlowperExteriorWallArea(value) if method == "Flow/ExteriorWallArea"
  infiltration_load.setFlowperExteriorSurfaceArea(value) if method == "Flow/ExteriorArea"
  infiltration_load.setAirChangesperHour(value) if method == "AirChanges/Hour"
  infiltration_load.setConstantTermCoefficient(setConstantTermCoefficient)
  infiltration_load.setTemperatureTermCoefficient(setTemperatureTermCoefficient)
  infiltration_load.setVelocityTermCoefficient(setVelocityTermCoefficient)
  infiltration_load.setVelocitySquaredTermCoefficient(setVelocitySquaredTermCoefficient)
  infiltration_load.setSchedule( BTAP::Common::validate_array(model,schedule,"ScheduleRuleset").first )

  return infiltration_load
end

.create_lighting_load(model, light_name, light_watts_per_floor_area = 0.0, multiplier = 1.0, schedule = "") ⇒ String

This method created people loads from the model.

Parameters:

  • model (OpenStudio::model::Model)

    A model object

  • light_name (String)
  • light_watts_per_floor_area (Float) (defaults to: 0.0)
  • multiplier (Float) (defaults to: 1.0)
  • schedule (Float) (defaults to: "")

Returns:

Author:



256
257
258
259
260
261
262
263
264
265
266
# File 'lib/openstudio-standards/btap/spaceloads.rb', line 256

def self.create_lighting_load(model,light_name,light_watts_per_floor_area= 0.0, multiplier = 1.0 ,schedule ="" )
  raise("Light #{name} already exists. Please use a different name") unless model.getLightsByName(light_name).empty?
  lightsdef = OpenStudio::Model::LightsDefinition.new(model)
  lightsdef.setWattsperSpaceFloorArea(light_watts_per_floor_area)
  lightsdef.setName(light_name + "-def" )
  lights = OpenStudio::Model::Lights.new(lightsdef)
  lights.setName(light_name )
  lights.setMultiplier(multiplier)
  lights.setSchedule( BTAP::Common::validate_array(model,schedule,"ScheduleRuleset").first ) unless "" == schedule
  return lights
end

.create_oa_load(model, oa_name, oa_person = 0, oa_area = 0, oa_ach = 0, oa_flowrate = 0, method = "Maximum", schedule = nil) ⇒ OpenStudio::model::Model

This method creats hot water load.

Parameters:

  • model (OpenStudio::model::Model)

    A model object

  • oa_name (String)
  • oa_person (Fixnum) (defaults to: 0)
  • oa_area (Fixnum) (defaults to: 0)
  • oa_ach (Fixnum) (defaults to: 0)
  • oa_flowrate (Fixnum) (defaults to: 0)
  • method (String) (defaults to: "Maximum")
  • schedule (Float) (defaults to: nil)

Returns:

  • (OpenStudio::model::Model)

    oa_def

Author:



354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
# File 'lib/openstudio-standards/btap/spaceloads.rb', line 354

def self.create_oa_load(model,oa_name,oa_person = 0 ,oa_area = 0, oa_ach = 0, oa_flowrate = 0, method = "Maximum",schedule = nil)
  raise("DesignSpecificationOutdoorAir #{name} already exists. Please use a different name") unless model.getDesignSpecificationOutdoorAirByName( oa_name ).empty?
  #units are in m3/s for flow and m2 for area.
  #The method must be either Flow/Person,Flow/Area,Flow/Zone,AirChanges/Hour,Sum,Maximum.
  #Defaults to the maximum calculated value
  raise ("outdoor air method argument #{method} is not valid") unless OpenStudio::Model::DesignSpecificationOutdoorAir::validOutdoorAirMethodValues.include?(method)
  #Find a DesignSpecificationOutdoorAir object if one of the same title is not found.  Then we will create it.
  oa_def = OpenStudio::Model::DesignSpecificationOutdoorAir.new(model)
  oa_def.setOutdoorAirMethod(method)
  oa_def.setOutdoorAirFlowperPerson(oa_person)
  oa_def.setOutdoorAirFlowperFloorArea(oa_area)
  oa_def.setOutdoorAirFlowRate(oa_flowrate)
  oa_def.setOutdoorAirFlowAirChangesperHour(oa_ach)
  oa_def.setName(oa_name )
  oa_def.setOutdoorAirFlowRateFractionSchedule( BTAP::Common::validate_array(model,schedule,"ScheduleRuleset").first ) unless schedule.nil?
  return oa_def
end

.create_people_load(model, people_name, floor_area_per_person = 0.0, multiplier = 1.0, schedule = "") ⇒ String

This method created people loads from the model.

Parameters:

  • model (OpenStudio::model::Model)

    A model object

  • people_name (String)
  • floor_area_per_person (Float) (defaults to: 0.0)
  • multiplier (Float) (defaults to: 1.0)
  • schedule (Float) (defaults to: "")

Returns:

Author:



220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# File 'lib/openstudio-standards/btap/spaceloads.rb', line 220

def self.create_people_load(model,people_name,floor_area_per_person = 0.0, multiplier = 1.0 , schedule ="")
  raise("People \"#{people_name}\" already exists. Please use a different name") unless model.getPeopleByName(people_name).empty?
  peopledef = OpenStudio::Model::PeopleDefinition.new(model)
  peopledef.setName(people_name + "-def" )
  peopledef.setSpaceFloorAreaperPerson(floor_area_per_person)
  peopledef.setFractionRadiant(0.3000)
  people = OpenStudio::Model::People.new(peopledef)
  people.setName(people_name  )
  people.setMultiplier(multiplier)
  activity_sched = model.getScheduleRulesetByName("activity 120W")
  if activity_sched.empty?
    people.setActivityLevelSchedule(Resources::Schedules::create_annual_constant_ruleset_schedule(model,"activity 120W","ACTIVITY",120.0))
  else
    people.setActivityLevelSchedule( activity_sched.get)
  end
  #this will override default schedule if given.
  people.setNumberofPeopleSchedule( BTAP::Common::validate_array(model,schedule,"ScheduleRuleset").first )unless schedule == ""
  return people
end

.remove_all_casual_loads(model) ⇒ Object

This method removes all loads from model.

Parameters:

  • model (OpenStudio::model::Model)

    A model object

Author:



423
424
425
426
427
428
# File 'lib/openstudio-standards/btap/spaceloads.rb', line 423

def self.remove_all_casual_loads(model)
  self.remove_all_people_loads(model)
  self.remove_all_light_loads(model)
  self.remove_all_electric_loads(model)
  self.remove_all_hot_water_loads(model)
end

.remove_all_DesignSpecificationOutdoorAir(model) ⇒ Object

This method removes all design specification OA from model.

Parameters:

  • model (OpenStudio::model::Model)

    A model object

Author:



330
331
332
# File 'lib/openstudio-standards/btap/spaceloads.rb', line 330

def self.remove_all_DesignSpecificationOutdoorAir(model)
  model.getDesignSpecificationOutdoorAirs.sort.each { |item| item.remove }
end

.remove_all_electric_loads(model) ⇒ Object

This method removes elec loads from model.

Parameters:

  • model (OpenStudio::model::Model)

    A model object

Author:



272
273
274
275
# File 'lib/openstudio-standards/btap/spaceloads.rb', line 272

def self.remove_all_electric_loads(model)
  model.getElectricEquipments.sort.each {|item| item.remove}
  model.getElectricEquipmentDefinitions.sort.each {|item| item.remove}
end

.remove_all_hot_water_loads(model) ⇒ Object

This method removes hot water loads from model.

Parameters:

  • model (OpenStudio::model::Model)

    A model object

Author:



301
302
303
304
# File 'lib/openstudio-standards/btap/spaceloads.rb', line 301

def self.remove_all_hot_water_loads(model)
  model.getHotWaterEquipments.sort.each {|item| item.remove}
  model.getHotWaterEquipmentDefinitions.sort.each {|item| item.remove}
end

.remove_all_light_loads(model) ⇒ Object

This method removes light loads from model.

Parameters:

  • model (OpenStudio::model::Model)

    A model object

Author:



243
244
245
246
# File 'lib/openstudio-standards/btap/spaceloads.rb', line 243

def self.remove_all_light_loads(model)
  model.getLightss.sort.each {|item| item.remove}
  model.getLightsDefinitions.sort.each {|item| item.remove}
end

.remove_all_people_loads(model) ⇒ Object

This method removes people loads from the model.

Parameters:

  • model (OpenStudio::model::Model)

    A model object

Author:



206
207
208
209
# File 'lib/openstudio-standards/btap/spaceloads.rb', line 206

def self.remove_all_people_loads(model)
  model.getPeoples.sort.each {|people| people.remove}
  model.getPeopleDefinitions.sort.each {|people| people.remove}
end

.remove_all_SpaceInfiltrationDesignFlowRate(model) ⇒ Object

This method removes all space infiltration design flow rate OA from model.

Parameters:

  • model (OpenStudio::model::Model)

    A model object

Author:



338
339
340
341
# File 'lib/openstudio-standards/btap/spaceloads.rb', line 338

def self.remove_all_SpaceInfiltrationDesignFlowRate(model)
  OpenStudio::Model::SpaceInfiltrationDesignFlowRate
  model.getSpaceInfiltrationDesignFlowRates.sort.each { |item| item.remove }
end

.remove_all_SpaceInfiltrationDesignFlowRates(model) ⇒ Object

This method removes infiltration from model..

Parameters:

  • model (OpenStudio::model::Model)

    A model object

Author:



377
378
379
# File 'lib/openstudio-standards/btap/spaceloads.rb', line 377

def self.remove_all_SpaceInfiltrationDesignFlowRates(model)
  model.getSpaceInfiltrationDesignFlowRates.sort.each { |item| item.remove }
end

.remove_all_SpaceLoads(model) ⇒ Object

This method removes all space loads from model.

Parameters:

  • model (OpenStudio::model::Model)

    A model object

Author:



433
434
435
436
# File 'lib/openstudio-standards/btap/spaceloads.rb', line 433

def self.remove_all_SpaceLoads(model)
  model.getSpaceLoads.sort.each { |item| item.remove }
  model.getSpaceLoadDefinitions.sort.each { |item| item.remove }
end