Class: AddThermalComfortModelTypes

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

Overview

start the measure

Instance Method Summary collapse

Instance Method Details

#arguments(_model) ⇒ Object

define the arguments that the user will input



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

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

  arg = OpenStudio::Measure::OSArgument::makeBoolArgument('thermal_comfort_model_type_fanger', true)
  arg.setDisplayName('Thermal Comfort Model Type: Fanger')
  arg.setDescription('Whether to add the Fanger thermal comfort model type.')
  arg.setDefaultValue(false)
  args << arg

  arg = OpenStudio::Measure::OSArgument::makeBoolArgument('thermal_comfort_model_type_pierce', true)
  arg.setDisplayName('Thermal Comfort Model Type: Pierce')
  arg.setDescription('Whether to add the Pierce thermal comfort model type.')
  arg.setDefaultValue(false)
  args << arg

  arg = OpenStudio::Measure::OSArgument::makeBoolArgument('thermal_comfort_model_type_ksu', true)
  arg.setDisplayName('Thermal Comfort Model Type: KSU')
  arg.setDescription('Whether to add the KSU thermal comfort model type.')
  arg.setDefaultValue(false)
  args << arg

  arg = OpenStudio::Measure::OSArgument::makeBoolArgument('thermal_comfort_model_type_adaptiveash55', true)
  arg.setDisplayName('Thermal Comfort Model Type: AdaptiveASH55')
  arg.setDescription('Whether to add the AdaptiveASH55 thermal comfort model type.')
  arg.setDefaultValue(false)
  args << arg

  arg = OpenStudio::Measure::OSArgument::makeBoolArgument('thermal_comfort_model_type_adaptivecen15251', true)
  arg.setDisplayName('Thermal Comfort Model Type: AdaptiveCEN15251')
  arg.setDescription('Whether to add the AdaptiveCEN15251 thermal comfort model type.')
  arg.setDefaultValue(false)
  args << arg

  arg = OpenStudio::Measure::OSArgument::makeBoolArgument('thermal_comfort_model_type_coolingeffectash55', true)
  arg.setDisplayName('Thermal Comfort Model Type: CoolingEffectASH55')
  arg.setDescription('Whether to add the CoolingEffectASH55 thermal comfort model type.')
  arg.setDefaultValue(false)
  args << arg

  arg = OpenStudio::Measure::OSArgument::makeBoolArgument('thermal_comfort_model_type_ankledraftash55', true)
  arg.setDisplayName('Thermal Comfort Model Type: AnkleDraftASH55')
  arg.setDescription('Whether to add the AnkleDraftASH55 thermal comfort model type.')
  arg.setDefaultValue(false)
  args << arg

  arg = OpenStudio::Measure::OSArgument::makeDoubleArgument('work_efficiency_schedule_value', true)
  arg.setDisplayName('Work Efficiency Schedule Value')
  arg.setUnits('Frac')
  arg.setDescription('Specify the constant work efficiency schedule value.')
  arg.setDefaultValue(0.0)
  args << arg

  arg = OpenStudio::Measure::OSArgument::makeDoubleArgument('clothing_insulation_schedule_value', true)
  arg.setDisplayName('Clothing Insulation Schedule Value')
  arg.setUnits('Frac')
  arg.setDescription('Specify the constant clothing insulation schedule value.')
  arg.setDefaultValue(0.6)
  args << arg

  arg = OpenStudio::Measure::OSArgument::makeDoubleArgument('air_velocity_schedule_value', true)
  arg.setDisplayName('Air Velocity Schedule Value')
  arg.setUnits('Frac')
  arg.setDescription('Specify the constant air velocity schedule value.')
  arg.setDefaultValue(0.1)
  args << arg

  return args
end

#descriptionObject

human readable description



20
21
22
# File 'lib/measures/AddThermalComfortModelTypes/measure.rb', line 20

def description
  return 'Adds to the model (A) any of the available thermal comfort model types, and (B) work efficiency, clothing insulation, and air velocity constant schedules.'
end

#modeler_descriptionObject

human readable description of modeling approach



25
26
27
# File 'lib/measures/AddThermalComfortModelTypes/measure.rb', line 25

def modeler_description
  return 'Specify any of the thermal comfort model types to add to People:Definition objects in the model. Specify constant values corresponding to the work efficiency, clothing insulation, and air velocity schedules.'
end

#nameObject

human readable name



14
15
16
17
# File 'lib/measures/AddThermalComfortModelTypes/measure.rb', line 14

def name
  # Measure name should be the title case of the class name.
  return 'AddThermalComfortModelTypes'
end

#run(model, runner, user_arguments) ⇒ Object

define what happens when the measure is run



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

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
  thermal_comfort_model_type_fanger = runner.getBoolArgumentValue('thermal_comfort_model_type_fanger', user_arguments)
  thermal_comfort_model_type_pierce = runner.getBoolArgumentValue('thermal_comfort_model_type_pierce', user_arguments)
  thermal_comfort_model_type_ksu = runner.getBoolArgumentValue('thermal_comfort_model_type_ksu', user_arguments)
  thermal_comfort_model_type_adaptiveash55 = runner.getBoolArgumentValue('thermal_comfort_model_type_adaptiveash55', user_arguments)
  thermal_comfort_model_type_adaptivecen15251 = runner.getBoolArgumentValue('thermal_comfort_model_type_adaptivecen15251', user_arguments)
  thermal_comfort_model_type_coolingeffectash55 = runner.getBoolArgumentValue('thermal_comfort_model_type_coolingeffectash55', user_arguments)
  thermal_comfort_model_type_ankledraftash55 = runner.getBoolArgumentValue('thermal_comfort_model_type_ankledraftash55', user_arguments)
  work_efficiency_schedule_value = runner.getDoubleArgumentValue('work_efficiency_schedule_value', user_arguments)
  clothing_insulation_schedule_value = runner.getDoubleArgumentValue('clothing_insulation_schedule_value', user_arguments)
  air_velocity_schedule_value = runner.getDoubleArgumentValue('air_velocity_schedule_value', user_arguments)

  if !thermal_comfort_model_type_fanger && !thermal_comfort_model_type_pierce && !thermal_comfort_model_type_ksu && !thermal_comfort_model_type_adaptiveash55 && !thermal_comfort_model_type_adaptivecen15251 && !thermal_comfort_model_type_coolingeffectash55 && !thermal_comfort_model_type_ankledraftash55
    runner.registerAsNotApplicable('No thermal comfort model types selected.')
    return true
  end

  people_definitions = model.getPeopleDefinitions
  peoples = model.getPeoples

  if people_definitions.size == 0 || peoples.size == 0
    runner.registerAsNotApplicable('No PeopleDefinition or People objects found in the model.')
    return true
  end

  people_definitions.each do |people_def|
    people_def.pushThermalComfortModelType('Fanger') if thermal_comfort_model_type_fanger
    people_def.pushThermalComfortModelType('Pierce') if thermal_comfort_model_type_pierce
    people_def.pushThermalComfortModelType('KSU') if thermal_comfort_model_type_ksu
    people_def.pushThermalComfortModelType('AdaptiveASH55') if thermal_comfort_model_type_adaptiveash55
    people_def.pushThermalComfortModelType('AdaptiveCEN15251') if thermal_comfort_model_type_adaptivecen15251
    people_def.pushThermalComfortModelType('CoolingEffectASH55') if thermal_comfort_model_type_coolingeffectash55
    people_def.pushThermalComfortModelType('AnkleDraftASH55') if thermal_comfort_model_type_ankledraftash55
  end

  peoples.each do |people|
    work_efficiency_schedule = OpenStudio::Model::ScheduleConstant.new(model)
    work_efficiency_schedule.setValue(work_efficiency_schedule_value)
    work_efficiency_schedule.setName('Work Efficiency Schedule')
    people.setWorkEfficiencySchedule(work_efficiency_schedule)

    clothing_insulation_schedule = OpenStudio::Model::ScheduleConstant.new(model)
    clothing_insulation_schedule.setValue(clothing_insulation_schedule_value)
    clothing_insulation_schedule.setName('Clothing Insulation Schedule')
    people.setClothingInsulationSchedule(clothing_insulation_schedule)

    air_velocity_schedule = OpenStudio::Model::ScheduleConstant.new(model)
    air_velocity_schedule.setValue(air_velocity_schedule_value)
    air_velocity_schedule.setName('Air Velocity Schedule')
    people.setAirVelocitySchedule(air_velocity_schedule)
  end

  return true
end