-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathhumidity_control_2.rb
106 lines (89 loc) · 3.81 KB
/
humidity_control_2.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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
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
# frozen_string_literal: true
require 'openstudio'
require 'lib/baseline_model'
model = BaselineModel.new
# make a 1 story, 100m X 50m, 10 zone core/perimeter building
model.add_geometry({ 'length' => 100,
'width' => 50,
'num_floors' => 1,
'floor_to_floor_height' => 4,
'plenum_height' => 1,
'perimeter_zone_depth' => 3 })
# add windows at a 40% window-to-wall ratio
model.add_windows({ 'wwr' => 0.4,
'offset' => 1,
'application_type' => 'Above Floor' })
# assign constructions from a local library to the walls/windows/etc. in the model
model.set_constructions
# set whole building space type; simplified 90.1-2004 Large Office Whole Building
model.set_space_type
# add design days to the model (Chicago)
model.add_design_days
# add ASHRAE System type 03, PSZ-AC
model.add_hvac({ 'ashrae_sys_num' => '03' })
# add thermostats
model.add_thermostats({ 'heating_setpoint' => 24,
'cooling_setpoint' => 28 })
# pick out on of the zone/system pairs and add a humidifier
# In order to produce more consistent results between different runs,
# we sort the zones by names
zones = model.getThermalZones.sort_by { |z| z.name.to_s }
# Try out all 3 different types of humidity setpoint managers
# on three different airloops in the same model.
3.times do |i|
zone = zones[i]
# Add a humidistat at 50% RH to the zone
dehumidify_sch = OpenStudio::Model::ScheduleConstant.new(model)
dehumidify_sch.setValue(50)
humidistat = OpenStudio::Model::ZoneControlHumidistat.new(model)
humidistat.setHumidifyingRelativeHumiditySetpointSchedule(dehumidify_sch)
zone.setZoneControlHumidistat(humidistat)
air_system = zone.airLoopHVAC.get
humidifier_outlet_node = nil
if i == 0
# Add a humidifier after the gas heating coil and before the fan
htg_coil = air_system.supplyComponents(OpenStudio::Model::CoilHeatingGas.iddObjectType).first.to_CoilHeatingGas.get
htg_coil_outlet_node = htg_coil.outletModelObject.get.to_Node.get
humidifier = OpenStudio::Model::HumidifierSteamGas.new(model)
humidifier.addToNode(htg_coil_outlet_node)
humidifier_outlet_node = humidifier.outletModelObject.get.to_Node.get
else
# Add a humidifier after all other components
humidifier = OpenStudio::Model::HumidifierSteamGas.new(model)
humidifier.addToNode(air_system.supplyOutletNode)
humidifier_outlet_node = humidifier.outletModelObject.get.to_Node.get
end
# Try out all 3 different types of humidity setpoint managers
# by adding them to the humidifier outlet node.
case i
when 0
spm = OpenStudio::Model::SetpointManagerSingleZoneHumidityMinimum.new(model)
spm.addToNode(humidifier_outlet_node)
when 1
spm = OpenStudio::Model::SetpointManagerMultiZoneHumidityMinimum.new(model)
spm.addToNode(humidifier_outlet_node)
when 2
spm = OpenStudio::Model::SetpointManagerMultiZoneMinimumHumidityAverage.new(model)
spm.addToNode(humidifier_outlet_node)
end
end
# add output reports
add_out_vars = false
if add_out_vars
# Request timeseries data for debugging
reporting_frequency = 'hourly'
var_names << 'System Node Setpoint Temperature'
var_names << 'System Node Setpoint Minimum Humidity Ratio'
var_names << 'System Node Setpoint Humidity Ratio'
var_names << 'Zone Mean Air Humidity Ratio'
var_names << 'Zone Mean Air Temperature'
var_names << 'Zone Air Relative Humidity'
var_names << 'Humidifier Water Volume Flow Rate'
var_names.each do |var_name|
outputVariable = OpenStudio::Model::OutputVariable.new(var_name, model)
outputVariable.setReportingFrequency(reporting_frequency)
end
end
# save the OpenStudio model (.osm)
model.save_openstudio_osm({ 'osm_save_directory' => Dir.pwd,
'osm_name' => 'in.osm' })