GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 66.9% 238 / 0 / 356
Functions: 76.9% 60 / 0 / 78
Branches: 44.9% 193 / 0 / 430

src/model/AirTerminalSingleDuctVAVHeatAndCoolReheat.cpp
Line Branch Exec Source
1 /***********************************************************************************************************************
2 * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC.
3 * See also https://openstudio.net/license
4 ***********************************************************************************************************************/
5
6 #include "AirTerminalSingleDuctVAVHeatAndCoolReheat.hpp"
7 #include "AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl.hpp"
8 #include "Model.hpp"
9 #include "Model_Impl.hpp"
10 #include "Node.hpp"
11 #include "Node_Impl.hpp"
12 #include "ThermalZone.hpp"
13 #include "ThermalZone_Impl.hpp"
14 #include "PortList.hpp"
15 #include "PortList_Impl.hpp"
16 #include "Mixer.hpp"
17 #include "Mixer_Impl.hpp"
18 #include "Splitter.hpp"
19 #include "Splitter_Impl.hpp"
20 #include "Schedule.hpp"
21 #include "Schedule_Impl.hpp"
22 #include "ScheduleTypeLimits.hpp"
23 #include "ScheduleTypeRegistry.hpp"
24 #include <utilities/idd/OS_AirTerminal_SingleDuct_VAV_HeatAndCool_Reheat_FieldEnums.hxx>
25 #include <utilities/idd/IddEnums.hxx>
26 #include "../utilities/core/Assert.hpp"
27 #include "../utilities/data/DataEnums.hpp"
28
29 namespace openstudio {
30 namespace model {
31
32 namespace detail {
33
34 5 AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl(const IdfObject& idfObject, Model_Impl* model,
35 5 bool keepHandle)
36 5 : StraightComponent_Impl(idfObject, model, keepHandle) {
37
4/6
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 5 times.
✗ Branch 13 not taken.
5 OS_ASSERT(idfObject.iddObject().type() == AirTerminalSingleDuctVAVHeatAndCoolReheat::iddObjectType());
38 5 }
39
40 ✗ AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl(
41 ✗ const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle)
42 ✗ : StraightComponent_Impl(other, model, keepHandle) {
43 ✗ OS_ASSERT(other.iddObject().type() == AirTerminalSingleDuctVAVHeatAndCoolReheat::iddObjectType());
44 ✗ }
45
46 7 AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl(
47 7 const AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl& other, Model_Impl* model, bool keepHandle)
48 7 : StraightComponent_Impl(other, model, keepHandle) {}
49
50 ✗ const std::vector<std::string>& AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::outputVariableNames() const {
51 static const std::vector<std::string> result{// These apply to all AirTerminals
52 "Zone Air Terminal Sensible Heating Energy", "Zone Air Terminal Sensible Heating Rate",
53 "Zone Air Terminal Sensible Cooling Energy", "Zone Air Terminal Sensible Cooling Rate",
54
55 ✗ "Zone Air Terminal VAV Damper Position"};
56 ✗ return result;
57 ✗ }
58
59 9 IddObjectType AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::iddObjectType() const {
60 9 return AirTerminalSingleDuctVAVHeatAndCoolReheat::iddObjectType();
61 }
62
63 ✗ std::vector<ScheduleTypeKey> AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::getScheduleTypeKeys(const Schedule& schedule) const {
64 ✗ std::vector<ScheduleTypeKey> result;
65 ✗ UnsignedVector fieldIndices = getSourceIndices(schedule.handle());
66 ✗ UnsignedVector::const_iterator b(fieldIndices.begin());
67 ✗ UnsignedVector::const_iterator e(fieldIndices.end());
68 ✗ if (std::find(b, e, OS_AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::AvailabilitySchedule) != e) {
69 ✗ result.push_back(ScheduleTypeKey("AirTerminalSingleDuctVAVHeatAndCoolReheat", "Availability Schedule"));
70 }
71 ✗ if (std::find(b, e, OS_AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::MinimumAirFlowTurndownScheduleName) != e) {
72 ✗ result.push_back(ScheduleTypeKey("AirTerminalSingleDuctVAVHeatAndCoolReheat", "Minimum Air Flow Turndown"));
73 }
74 ✗ return result;
75 ✗ }
76
77 1 boost::optional<Schedule> AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::availabilitySchedule() const {
78
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 return getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::AvailabilitySchedule);
79 }
80
81 1 boost::optional<double> AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::maximumAirFlowRate() const {
82 1 return getDouble(OS_AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::MaximumAirFlowRate, true);
83 }
84
85 1 bool AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::isMaximumAirFlowRateAutosized() const {
86 1 bool result = false;
87
1/1
✓ Branch 1 taken 1 time.
1 boost::optional<std::string> value = getString(OS_AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::MaximumAirFlowRate, true);
88
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (value) {
89
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
2 result = openstudio::istringEqual(value.get(), "autosize");
90 }
91 1 return result;
92 1 }
93
94 1 double AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::zoneMinimumAirFlowFraction() const {
95
1/1
✓ Branch 1 taken 1 time.
1 boost::optional<double> value = getDouble(OS_AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::ZoneMinimumAirFlowFraction, true);
96
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
1 OS_ASSERT(value);
97
1/1
✓ Branch 1 taken 1 time.
2 return value.get();
98 }
99
100 12 HVACComponent AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::reheatCoil() const {
101
1/1
✓ Branch 1 taken 12 times.
12 boost::optional<HVACComponent> value = optionalReheatCoil();
102
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
12 if (!value) {
103 ✗ LOG_AND_THROW(briefDescription() << " does not have an Reheat Coil attached.");
104 }
105
2/2
✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
24 return value.get();
106 12 }
107
108 1 boost::optional<double> AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::maximumHotWaterorSteamFlowRate() const {
109 1 return getDouble(OS_AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::MaximumHotWaterorSteamFlowRate, true);
110 }
111
112 1 bool AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::isMaximumHotWaterorSteamFlowRateAutosized() const {
113 1 bool result = false;
114
1/1
✓ Branch 1 taken 1 time.
1 boost::optional<std::string> value = getString(OS_AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::MaximumHotWaterorSteamFlowRate, true);
115
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (value) {
116
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
2 result = openstudio::istringEqual(value.get(), "autosize");
117 }
118 1 return result;
119 1 }
120
121 1 double AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::minimumHotWaterorSteamFlowRate() const {
122
1/1
✓ Branch 1 taken 1 time.
1 boost::optional<double> value = getDouble(OS_AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::MinimumHotWaterorSteamFlowRate, true);
123
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
1 OS_ASSERT(value);
124
1/1
✓ Branch 1 taken 1 time.
2 return value.get();
125 }
126
127 1 double AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::convergenceTolerance() const {
128
1/1
✓ Branch 1 taken 1 time.
1 boost::optional<double> value = getDouble(OS_AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::ConvergenceTolerance, true);
129
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
1 OS_ASSERT(value);
130
1/1
✓ Branch 1 taken 1 time.
2 return value.get();
131 }
132
133 1 double AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::maximumReheatAirTemperature() const {
134
1/1
✓ Branch 1 taken 1 time.
1 boost::optional<double> value = getDouble(OS_AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::MaximumReheatAirTemperature, true);
135
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
1 OS_ASSERT(value);
136
1/1
✓ Branch 1 taken 1 time.
2 return value.get();
137 }
138
139 5 boost::optional<Schedule> AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::minimumAirFlowTurndownSchedule() const {
140
1/1
✓ Branch 1 taken 5 times.
10 return this->getObject<AirTerminalSingleDuctVAVHeatAndCoolReheat>().getModelObjectTarget<Schedule>(
141
1/1
✓ Branch 1 taken 5 times.
10 OS_AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::MinimumAirFlowTurndownScheduleName);
142 }
143
144 ✗ boost::optional<ModelObject> AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::minimumAirFlowTurndownScheduleAsModelObject() const {
145 ✗ OptionalModelObject result;
146 ✗ OptionalSchedule intermediate = minimumAirFlowTurndownSchedule();
147 ✗ if (intermediate) {
148 ✗ result = *intermediate;
149 }
150 ✗ return result;
151 ✗ }
152
153 1 bool AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::setAvailabilitySchedule(Schedule& schedule) {
154
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
4 bool result = setSchedule(OS_AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::AvailabilitySchedule,
155 "AirTerminalSingleDuctVAVHeatAndCoolReheat", "Availability Schedule", schedule);
156 1 return result;
157 }
158
159 ✗ void AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::resetAvailabilitySchedule() {
160 ✗ bool result = setString(OS_AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::AvailabilitySchedule, "");
161 ✗ OS_ASSERT(result);
162 ✗ }
163
164 1 bool AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::setMaximumAirFlowRate(boost::optional<double> maximumAirFlowRate) {
165 1 bool result(false);
166
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (maximumAirFlowRate) {
167 1 result = setDouble(OS_AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::MaximumAirFlowRate, maximumAirFlowRate.get());
168 }
169 1 return result;
170 }
171
172 5 void AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::autosizeMaximumAirFlowRate() {
173
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
10 bool result = setString(OS_AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::MaximumAirFlowRate, "autosize");
174
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 OS_ASSERT(result);
175 5 }
176
177 6 bool AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::setZoneMinimumAirFlowFraction(double zoneMinimumAirFlowFraction) {
178 6 bool result = setDouble(OS_AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::ZoneMinimumAirFlowFraction, zoneMinimumAirFlowFraction);
179 6 return result;
180 }
181
182 8 bool AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::setReheatCoil(const HVACComponent& heatingCoil) {
183
2/2
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
8 bool result = setPointer(OS_AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::ReheatCoil, heatingCoil.handle());
184 8 return result;
185 }
186
187 1 bool AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::setMaximumHotWaterorSteamFlowRate(boost::optional<double> maximumHotWaterorSteamFlowRate) {
188 1 bool result(false);
189
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (maximumHotWaterorSteamFlowRate) {
190 result =
191 1 setDouble(OS_AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::MaximumHotWaterorSteamFlowRate, maximumHotWaterorSteamFlowRate.get());
192 }
193 1 return result;
194 }
195
196 5 void AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::autosizeMaximumHotWaterorSteamFlowRate() {
197
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
10 bool result = setString(OS_AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::MaximumHotWaterorSteamFlowRate, "autosize");
198
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 OS_ASSERT(result);
199 5 }
200
201 6 bool AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::setMinimumHotWaterorSteamFlowRate(double minimumHotWaterorSteamFlowRate) {
202 6 bool result = setDouble(OS_AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::MinimumHotWaterorSteamFlowRate, minimumHotWaterorSteamFlowRate);
203 6 return result;
204 }
205
206 ✗ bool AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::setAirOutlet(const std::string& airOutlet) {
207 ✗ bool result = setString(OS_AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::AirOutlet, airOutlet);
208 ✗ OS_ASSERT(result);
209 ✗ return result;
210 }
211
212 6 bool AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::setConvergenceTolerance(double convergenceTolerance) {
213 6 bool result = setDouble(OS_AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::ConvergenceTolerance, convergenceTolerance);
214 6 return result;
215 }
216
217 6 bool AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::setMaximumReheatAirTemperature(double maximumReheatAirTemperature) {
218 6 bool result = setDouble(OS_AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::MaximumReheatAirTemperature, maximumReheatAirTemperature);
219 6 return result;
220 }
221
222 2 bool AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::setMinimumAirFlowTurndownSchedule(Schedule& schedule) {
223
3/3
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
8 bool result = setSchedule(OS_AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::MinimumAirFlowTurndownScheduleName,
224 "AirTerminalSingleDuctVAVReheat", "Minimum Air Flow Turndown", schedule);
225 2 return result;
226 }
227
228 1 void AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::resetMinimumAirFlowTurndownSchedule() {
229
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::MinimumAirFlowTurndownScheduleName, "");
230
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
231 1 }
232
233 ✗ bool AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::setMinimumAirFlowTurndownScheduleAsModelObject(
234 const boost::optional<ModelObject>& modelObject) {
235 ✗ if (modelObject) {
236 ✗ OptionalSchedule intermediate = modelObject->optionalCast<Schedule>();
237 ✗ if (intermediate) {
238 ✗ Schedule schedule(*intermediate);
239 ✗ return setMinimumAirFlowTurndownSchedule(schedule);
240 ✗ } else {
241 ✗ return false;
242 }
243 ✗ } else {
244 ✗ resetMinimumAirFlowTurndownSchedule();
245 }
246 ✗ return true;
247 }
248
249 17 boost::optional<HVACComponent> AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::optionalReheatCoil() const {
250
2/2
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
17 return getObject<ModelObject>().getModelObjectTarget<HVACComponent>(OS_AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::ReheatCoil);
251 }
252
253 12 unsigned AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::inletPort() const {
254 12 return OS_AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::AirInlet;
255 }
256
257 29 unsigned AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::outletPort() const {
258 29 return OS_AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::AirOutlet;
259 }
260
261 4 bool AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::addToNode(Node& node) {
262
1/1
✓ Branch 1 taken 4 times.
4 Model _model = node.model();
263
264
2/3
✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
8 if (boost::optional<ModelObject> outlet = node.outletModelObject()) {
265 4 boost::optional<ThermalZone> thermalZone;
266
267
3/4
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
8 if (boost::optional<PortList> portList = outlet->optionalCast<PortList>()) {
268
3/3
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
4 thermalZone = portList->thermalZone();
269 4 }
270
271
4/19
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 4 not taken.
✗ Branch 7 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 4 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 4 times.
✓ Branch 24 taken 4 times.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
8 if (thermalZone || (outlet->optionalCast<Mixer>() && node.airLoopHVAC())) {
272
2/3
✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
8 if (boost::optional<ModelObject> inlet = node.inletModelObject()) {
273
3/4
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
8 if (boost::optional<Splitter> splitter = inlet->optionalCast<Splitter>()) {
274
1/1
✓ Branch 1 taken 4 times.
4 boost::optional<ModelObject> sourceModelObject = inlet;
275
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 boost::optional<unsigned> sourcePort = node.connectedObjectPort(node.inletPort());
276
277
3/6
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
8 if (sourcePort && sourceModelObject) {
278
1/1
✓ Branch 1 taken 4 times.
4 Node inletNode(_model);
279
280
6/6
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
✓ Branch 13 taken 4 times.
✓ Branch 16 taken 4 times.
4 _model.connect(sourceModelObject.get(), sourcePort.get(), inletNode, inletNode.inletPort());
281
282
5/5
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
✓ Branch 13 taken 4 times.
4 _model.connect(inletNode, inletNode.outletPort(), this->getObject<ModelObject>(), this->inletPort());
283
284
5/5
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
✓ Branch 13 taken 4 times.
4 _model.connect(this->getObject<ModelObject>(), outletPort(), node, node.inletPort());
285
286
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 if (thermalZone) {
287
1/1
✓ Branch 1 taken 4 times.
4 auto mo = this->getObject<AirTerminalSingleDuctVAVHeatAndCoolReheat>();
288
289
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 thermalZone->addEquipment(mo);
290 4 }
291
292 4 return true;
293 4 }
294 8 }
295 4 }
296 }
297 8 }
298
299 ✗ return false;
300 4 }
301
302 1 std::vector<IdfObject> AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::remove() {
303
1/1
✓ Branch 1 taken 1 time.
1 Model _model = this->model();
304
1/1
✓ Branch 1 taken 1 time.
1 auto thisObject = this->getObject<ModelObject>();
305
306
1/1
✓ Branch 1 taken 1 time.
1 HVACComponent _reheatCoil = reheatCoil();
307
308
1/1
✓ Branch 1 taken 1 time.
1 boost::optional<ModelObject> sourceModelObject = this->inletModelObject();
309
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 boost::optional<unsigned> sourcePort = this->connectedObjectPort(this->inletPort());
310
311
1/1
✓ Branch 1 taken 1 time.
1 boost::optional<ModelObject> targetModelObject = this->outletModelObject();
312
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 boost::optional<unsigned> targetPort = this->connectedObjectPort(this->outletPort());
313
314
1/1
✓ Branch 1 taken 1 time.
1 std::vector<ThermalZone> thermalZones = _model.getConcreteModelObjects<ThermalZone>();
315
1/2
✓ Branch 5 taken 1 time.
✗ Branch 6 not taken.
1 for (auto& thermalZone : thermalZones) {
316
1/1
✓ Branch 1 taken 1 time.
1 std::vector<ModelObject> equipment = thermalZone.equipment();
317
318
2/3
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 8 not taken.
1 if (std::find(equipment.begin(), equipment.end(), thisObject) != equipment.end()) {
319
1/1
✓ Branch 1 taken 1 time.
1 thermalZone.removeEquipment(thisObject);
320
321 1 break;
322 }
323 1 }
324
325
5/10
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 time.
✗ Branch 9 not taken.
4 if (sourcePort && sourceModelObject && targetPort && targetModelObject) {
326
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (boost::optional<Node> inletNode = sourceModelObject->optionalCast<Node>()) {
327
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (boost::optional<ModelObject> source2ModelObject = inletNode->inletModelObject()) {
328
5/6
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 12 taken 1 time.
✗ Branch 13 not taken.
2 if (boost::optional<unsigned> source2Port = inletNode->connectedObjectPort(inletNode->inletPort())) {
329
7/7
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
1 _model.connect(source2ModelObject.get(), source2Port.get(), targetModelObject.get(), targetPort.get());
330
331
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 inletNode->disconnect();
332
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 inletNode->remove();
333
334
2/3
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
2 if (boost::optional<PlantLoop> loop = _reheatCoil.plantLoop()) {
335 ✗ loop->removeDemandBranchWithComponent(_reheatCoil);
336 1 }
337
338
1/1
✓ Branch 1 taken 1 time.
2 return StraightComponent_Impl::remove();
339 }
340 1 }
341 1 }
342 }
343
344 ✗ model().disconnect(getObject<ModelObject>(), inletPort());
345 ✗ model().disconnect(getObject<ModelObject>(), outletPort());
346
347 ✗ if (boost::optional<PlantLoop> loop = _reheatCoil.plantLoop()) {
348 ✗ loop->removeDemandBranchWithComponent(_reheatCoil);
349 ✗ }
350
351 ✗ return StraightComponent_Impl::remove();
352 1 }
353
354 1 bool AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::isRemovable() const {
355 1 return true;
356 }
357
358 5 std::vector<ModelObject> AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::children() const {
359 5 std::vector<ModelObject> result;
360
2/3
✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
10 if (OptionalHVACComponent intermediate = optionalReheatCoil()) {
361
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 result.push_back(*intermediate);
362 5 }
363 5 return result;
364 ✗ }
365
366 3 ModelObject AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::clone(Model model) const {
367
3/3
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
3 auto modelObjectClone = StraightComponent_Impl::clone(model).cast<AirTerminalSingleDuctVAVHeatAndCoolReheat>();
368
369
1/1
✓ Branch 1 taken 3 times.
3 HVACComponent coil = this->reheatCoil();
370
371
3/3
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
3 auto coilClone = coil.clone(model).cast<HVACComponent>();
372
373
1/1
✓ Branch 1 taken 3 times.
3 modelObjectClone.setReheatCoil(coilClone);
374
375 6 return std::move(modelObjectClone);
376 3 }
377
378 ✗ boost::optional<double> AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::autosizedMaximumAirFlowRate() const {
379 ✗ return getAutosizedValue("Design Size Maximum Air Flow Rate", "m3/s");
380 }
381
382 ✗ boost::optional<double> AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::autosizedMaximumHotWaterorSteamFlowRate() const {
383 ✗ return getAutosizedValue("Design Size Maximum Reheat Water Flow Rate", "m3/s");
384 }
385
386 ✗ void AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::autosize() {
387 ✗ autosizeMaximumAirFlowRate();
388 ✗ autosizeMaximumHotWaterorSteamFlowRate();
389 ✗ }
390
391 ✗ void AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::applySizingValues() {
392 ✗ boost::optional<double> val;
393 ✗ val = autosizedMaximumAirFlowRate();
394 ✗ if (val) {
395 ✗ setMaximumAirFlowRate(val.get());
396 }
397
398 ✗ val = autosizedMaximumHotWaterorSteamFlowRate();
399 ✗ if (val) {
400 ✗ setMaximumHotWaterorSteamFlowRate(val.get());
401 }
402 ✗ }
403
404 ✗ ComponentType AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::componentType() const {
405 ✗ ComponentType loopType = ComponentType::None;
406 ✗ if (auto a_ = airLoopHVAC()) {
407 ✗ loopType = a_->componentType();
408 ✗ }
409 ✗ if ((loopType == ComponentType::Both) or (loopType == ComponentType::Cooling)) {
410 ✗ return ComponentType::Both;
411 }
412
413 ✗ return ComponentType::Heating;
414 }
415
416 ✗ std::vector<FuelType> AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::coolingFuelTypes() const {
417 ✗ if (auto a_ = airLoopHVAC()) {
418 ✗ return a_->coolingFuelTypes();
419 ✗ }
420 ✗ return {};
421 }
422
423 ✗ std::vector<FuelType> AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::heatingFuelTypes() const {
424 ✗ std::set<FuelType> result;
425 ✗ for (auto ft : reheatCoil().heatingFuelTypes()) {
426 ✗ result.insert(ft);
427 ✗ }
428 ✗ if (auto a_ = airLoopHVAC()) {
429 ✗ for (auto ft : a_->heatingFuelTypes()) {
430 ✗ result.insert(ft);
431 ✗ }
432 ✗ }
433 ✗ return {result.begin(), result.end()};
434 ✗ }
435
436 ✗ std::vector<AppGFuelType> AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl::appGHeatingFuelTypes() const {
437 ✗ std::set<AppGFuelType> result;
438 ✗ for (auto ft : reheatCoil().appGHeatingFuelTypes()) {
439 ✗ result.insert(ft);
440 ✗ }
441 ✗ if (auto a_ = airLoopHVAC()) {
442 ✗ for (auto ft : a_->appGHeatingFuelTypes()) {
443 ✗ result.insert(ft);
444 ✗ }
445 ✗ }
446 ✗ return {result.begin(), result.end()};
447 ✗ }
448
449 } // namespace detail
450
451 5 AirTerminalSingleDuctVAVHeatAndCoolReheat::AirTerminalSingleDuctVAVHeatAndCoolReheat(const Model& model, const HVACComponent& reheatCoil)
452 5 : StraightComponent(AirTerminalSingleDuctVAVHeatAndCoolReheat::iddObjectType(), model) {
453
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
✗ Branch 5 not taken.
5 OS_ASSERT(getImpl<detail::AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl>());
454
455
2/3
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5 times.
5 if (!setReheatCoil(reheatCoil)) {
456 ✗ LOG_AND_THROW(briefDescription() << " was consructed with invalid reheat coil: " << reheatCoil.briefDescription());
457 }
458
459
1/1
✓ Branch 1 taken 5 times.
5 autosizeMaximumAirFlowRate();
460
1/1
✓ Branch 1 taken 5 times.
5 setZoneMinimumAirFlowFraction(0.0);
461
1/1
✓ Branch 1 taken 5 times.
5 autosizeMaximumHotWaterorSteamFlowRate();
462
1/1
✓ Branch 1 taken 5 times.
5 setMinimumHotWaterorSteamFlowRate(0.0);
463
1/1
✓ Branch 1 taken 5 times.
5 setConvergenceTolerance(0.001);
464
1/1
✓ Branch 1 taken 5 times.
5 setMaximumReheatAirTemperature(1000.0);
465 5 }
466
467 7775 IddObjectType AirTerminalSingleDuctVAVHeatAndCoolReheat::iddObjectType() {
468
1/1
✓ Branch 1 taken 7775 times.
7775 return {IddObjectType::OS_AirTerminal_SingleDuct_VAV_HeatAndCool_Reheat};
469 }
470
471 1 boost::optional<Schedule> AirTerminalSingleDuctVAVHeatAndCoolReheat::availabilitySchedule() const {
472
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl>()->availabilitySchedule();
473 }
474
475 1 boost::optional<double> AirTerminalSingleDuctVAVHeatAndCoolReheat::maximumAirFlowRate() const {
476
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl>()->maximumAirFlowRate();
477 }
478
479 1 bool AirTerminalSingleDuctVAVHeatAndCoolReheat::isMaximumAirFlowRateAutosized() const {
480
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl>()->isMaximumAirFlowRateAutosized();
481 }
482
483 1 double AirTerminalSingleDuctVAVHeatAndCoolReheat::zoneMinimumAirFlowFraction() const {
484
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl>()->zoneMinimumAirFlowFraction();
485 }
486
487 8 HVACComponent AirTerminalSingleDuctVAVHeatAndCoolReheat::reheatCoil() const {
488
1/1
✓ Branch 3 taken 8 times.
8 return getImpl<detail::AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl>()->reheatCoil();
489 }
490
491 1 boost::optional<double> AirTerminalSingleDuctVAVHeatAndCoolReheat::maximumHotWaterorSteamFlowRate() const {
492
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl>()->maximumHotWaterorSteamFlowRate();
493 }
494
495 1 bool AirTerminalSingleDuctVAVHeatAndCoolReheat::isMaximumHotWaterorSteamFlowRateAutosized() const {
496
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl>()->isMaximumHotWaterorSteamFlowRateAutosized();
497 }
498
499 1 double AirTerminalSingleDuctVAVHeatAndCoolReheat::minimumHotWaterorSteamFlowRate() const {
500
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl>()->minimumHotWaterorSteamFlowRate();
501 }
502
503 1 double AirTerminalSingleDuctVAVHeatAndCoolReheat::convergenceTolerance() const {
504
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl>()->convergenceTolerance();
505 }
506
507 1 double AirTerminalSingleDuctVAVHeatAndCoolReheat::maximumReheatAirTemperature() const {
508
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl>()->maximumReheatAirTemperature();
509 }
510
511 5 boost::optional<Schedule> AirTerminalSingleDuctVAVHeatAndCoolReheat::minimumAirFlowTurndownSchedule() const {
512
1/1
✓ Branch 3 taken 5 times.
5 return getImpl<detail::AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl>()->minimumAirFlowTurndownSchedule();
513 }
514
515 1 bool AirTerminalSingleDuctVAVHeatAndCoolReheat::setAvailabilitySchedule(Schedule& schedule) {
516
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl>()->setAvailabilitySchedule(schedule);
517 }
518
519 ✗ void AirTerminalSingleDuctVAVHeatAndCoolReheat::resetAvailabilitySchedule() {
520 ✗ getImpl<detail::AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl>()->resetAvailabilitySchedule();
521 ✗ }
522
523 1 bool AirTerminalSingleDuctVAVHeatAndCoolReheat::setMaximumAirFlowRate(double maximumAirFlowRate) {
524
2/2
✓ Branch 3 taken 1 time.
✓ Branch 6 taken 1 time.
1 return getImpl<detail::AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl>()->setMaximumAirFlowRate(maximumAirFlowRate);
525 }
526
527 5 void AirTerminalSingleDuctVAVHeatAndCoolReheat::autosizeMaximumAirFlowRate() {
528
1/1
✓ Branch 3 taken 5 times.
5 getImpl<detail::AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl>()->autosizeMaximumAirFlowRate();
529 5 }
530
531 6 bool AirTerminalSingleDuctVAVHeatAndCoolReheat::setZoneMinimumAirFlowFraction(double zoneMinimumAirFlowFraction) {
532
1/1
✓ Branch 3 taken 6 times.
6 return getImpl<detail::AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl>()->setZoneMinimumAirFlowFraction(zoneMinimumAirFlowFraction);
533 }
534
535 8 bool AirTerminalSingleDuctVAVHeatAndCoolReheat::setReheatCoil(const HVACComponent& heatingCoil) {
536
1/1
✓ Branch 3 taken 8 times.
8 return getImpl<detail::AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl>()->setReheatCoil(heatingCoil);
537 }
538
539 1 bool AirTerminalSingleDuctVAVHeatAndCoolReheat::setMaximumHotWaterorSteamFlowRate(double maximumHotWaterorSteamFlowRate) {
540
2/2
✓ Branch 3 taken 1 time.
✓ Branch 6 taken 1 time.
1 return getImpl<detail::AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl>()->setMaximumHotWaterorSteamFlowRate(maximumHotWaterorSteamFlowRate);
541 }
542
543 5 void AirTerminalSingleDuctVAVHeatAndCoolReheat::autosizeMaximumHotWaterorSteamFlowRate() {
544
1/1
✓ Branch 3 taken 5 times.
5 getImpl<detail::AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl>()->autosizeMaximumHotWaterorSteamFlowRate();
545 5 }
546
547 6 bool AirTerminalSingleDuctVAVHeatAndCoolReheat::setMinimumHotWaterorSteamFlowRate(double minimumHotWaterorSteamFlowRate) {
548
1/1
✓ Branch 3 taken 6 times.
6 return getImpl<detail::AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl>()->setMinimumHotWaterorSteamFlowRate(minimumHotWaterorSteamFlowRate);
549 }
550
551 6 bool AirTerminalSingleDuctVAVHeatAndCoolReheat::setConvergenceTolerance(double convergenceTolerance) {
552
1/1
✓ Branch 3 taken 6 times.
6 return getImpl<detail::AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl>()->setConvergenceTolerance(convergenceTolerance);
553 }
554
555 6 bool AirTerminalSingleDuctVAVHeatAndCoolReheat::setMaximumReheatAirTemperature(double maximumReheatAirTemperature) {
556
1/1
✓ Branch 3 taken 6 times.
6 return getImpl<detail::AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl>()->setMaximumReheatAirTemperature(maximumReheatAirTemperature);
557 }
558
559 2 bool AirTerminalSingleDuctVAVHeatAndCoolReheat::setMinimumAirFlowTurndownSchedule(Schedule& schedule) {
560
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl>()->setMinimumAirFlowTurndownSchedule(schedule);
561 }
562
563 1 void AirTerminalSingleDuctVAVHeatAndCoolReheat::resetMinimumAirFlowTurndownSchedule() {
564
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl>()->resetMinimumAirFlowTurndownSchedule();
565 1 }
566
567 /// @cond
568 24 AirTerminalSingleDuctVAVHeatAndCoolReheat::AirTerminalSingleDuctVAVHeatAndCoolReheat(
569 24 std::shared_ptr<detail::AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl> impl)
570
1/1
✓ Branch 3 taken 24 times.
24 : StraightComponent(std::move(impl)) {}
571 /// @endcond
572
573 ✗ boost::optional<double> AirTerminalSingleDuctVAVHeatAndCoolReheat::autosizedMaximumAirFlowRate() const {
574 ✗ return getImpl<detail::AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl>()->autosizedMaximumAirFlowRate();
575 }
576
577 ✗ boost::optional<double> AirTerminalSingleDuctVAVHeatAndCoolReheat::autosizedMaximumHotWaterorSteamFlowRate() const {
578 ✗ return getImpl<detail::AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl>()->autosizedMaximumHotWaterorSteamFlowRate();
579 }
580
581 } // namespace model
582 } // namespace openstudio
583