Class: RemoveInternalLoadsDirectlyAssignedToSpaces

Inherits:
OpenStudio::Measure::ModelMeasure
  • Object
show all
Defined in:
lib/measures/RemoveInternalLoadsDirectlyAssignedToSpaces/measure.rb

Overview

start the measure

Instance Method Summary collapse

Instance Method Details

#arguments(model) ⇒ Object

define the arguments that the user will input



24
25
26
27
28
# File 'lib/measures/RemoveInternalLoadsDirectlyAssignedToSpaces/measure.rb', line 24

def arguments(model)
  args = OpenStudio::Measure::OSArgumentVector.new

  return args
end

#nameObject

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



19
20
21
# File 'lib/measures/RemoveInternalLoadsDirectlyAssignedToSpaces/measure.rb', line 19

def name
  return 'RemoveInternalLoadsDirectlyAssignedToSpaces'
end

#run(model, runner, user_arguments) ⇒ Object

define what happens when the measure is run



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
# File 'lib/measures/RemoveInternalLoadsDirectlyAssignedToSpaces/measure.rb', line 31

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

  # reporting initial condition of model
  spaceLoads = model.getSpaceLoadInstances
  runner.registerInitialCondition("The building started with #{spaceLoads.size} space load instances.")

  # loop through spaces remove space loads
  spaces = model.getSpaces
  spaces.each do |space|
    # removing or detaching loads directly assigned to space objects.
    space.internalMass.each(&:remove)
    space.people.each(&:remove)
    space.lights.each(&:remove)
    space.luminaires.each(&:remove)
    space.electricEquipment.each(&:remove)
    space.gasEquipment.each(&:remove)
    space.hotWaterEquipment.each(&:remove)
    space.steamEquipment.each(&:remove)
    space.otherEquipment.each(&:remove)
    space.spaceInfiltrationDesignFlowRates.each(&:remove)
    space.spaceInfiltrationEffectiveLeakageAreas.each(&:remove)

    space.resetDesignSpecificationOutdoorAir
  end

  # reporting final condition of model
  spaceLoads = model.getSpaceLoadInstances
  runner.registerFinalCondition("The building finished with #{spaceLoads.size} space load instances.")

  return true
end