GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 59.8% 213 / 0 / 356
Functions: 68.8% 53 / 0 / 77
Branches: 38.0% 181 / 0 / 476

src/model/CoilHeatingGas.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 "CoilHeatingGas.hpp"
7 #include "CoilHeatingGas_Impl.hpp"
8 #include "Model.hpp"
9 #include "AirTerminalSingleDuctConstantVolumeReheat.hpp"
10 #include "AirTerminalSingleDuctConstantVolumeReheat_Impl.hpp"
11 #include "AirTerminalSingleDuctParallelPIUReheat.hpp"
12 #include "AirTerminalSingleDuctParallelPIUReheat_Impl.hpp"
13 #include "AirTerminalSingleDuctVAVReheat.hpp"
14 #include "AirTerminalSingleDuctVAVReheat_Impl.hpp"
15 #include "AirTerminalSingleDuctVAVHeatAndCoolReheat.hpp"
16 #include "AirTerminalSingleDuctVAVHeatAndCoolReheat_Impl.hpp"
17 #include "AirLoopHVACUnitaryHeatPumpAirToAir.hpp"
18 #include "AirLoopHVACUnitaryHeatPumpAirToAir_Impl.hpp"
19 #include "ZoneHVACWaterToAirHeatPump.hpp"
20 #include "ZoneHVACWaterToAirHeatPump_Impl.hpp"
21 #include "ZoneHVACPackagedTerminalAirConditioner.hpp"
22 #include "ZoneHVACPackagedTerminalAirConditioner_Impl.hpp"
23 #include "ZoneHVACUnitHeater.hpp"
24 #include "ZoneHVACUnitHeater_Impl.hpp"
25 #include "ZoneHVACUnitVentilator.hpp"
26 #include "ZoneHVACUnitVentilator_Impl.hpp"
27 #include "AirLoopHVACOutdoorAirSystem.hpp"
28 #include "AirLoopHVACOutdoorAirSystem_Impl.hpp"
29 #include "AirLoopHVACUnitarySystem.hpp"
30 #include "AirLoopHVACUnitarySystem_Impl.hpp"
31 #include "AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass.hpp"
32 #include "AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass_Impl.hpp"
33 #include "AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed.hpp"
34 #include "AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed_Impl.hpp"
35 #include "Schedule.hpp"
36 #include "Schedule_Impl.hpp"
37 #include "CurveCubic.hpp"
38 #include "CurveCubic_Impl.hpp"
39 #include "CurveQuadratic.hpp"
40 #include "CurveQuadratic_Impl.hpp"
41 #include "Node.hpp"
42 #include "Node_Impl.hpp"
43 #include "AirLoopHVAC.hpp"
44 #include "AirLoopHVAC_Impl.hpp"
45 #include "AirflowNetworkEquivalentDuct.hpp"
46 #include "AirflowNetworkEquivalentDuct_Impl.hpp"
47 #include <utilities/idd/OS_Coil_Heating_Gas_FieldEnums.hxx>
48 #include <utilities/idd/IddEnums.hxx>
49 #include <utilities/idd/IddFactory.hxx>
50 #include "../utilities/core/Compare.hpp"
51 #include "../utilities/core/Assert.hpp"
52 #include "../utilities/data/DataEnums.hpp"
53
54 #include "../utilities/core/DeprecatedHelpers.hpp" // For deprecation
55
56 namespace openstudio {
57 namespace model {
58
59 namespace detail {
60
61 233 CoilHeatingGas_Impl::CoilHeatingGas_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
62 233 : StraightComponent_Impl(idfObject, model, keepHandle) {
63
4/6
✓ Branch 1 taken 233 times.
✓ Branch 4 taken 233 times.
✓ Branch 7 taken 233 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 233 times.
✗ Branch 13 not taken.
233 OS_ASSERT(idfObject.iddObject().type() == CoilHeatingGas::iddObjectType());
64 233 }
65
66 37 CoilHeatingGas_Impl::CoilHeatingGas_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle)
67 37 : StraightComponent_Impl(other, model, keepHandle) {
68
4/6
✓ Branch 1 taken 37 times.
✓ Branch 4 taken 37 times.
✓ Branch 7 taken 37 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 37 times.
✗ Branch 13 not taken.
37 OS_ASSERT(other.iddObject().type() == CoilHeatingGas::iddObjectType());
69 37 }
70
71 114 CoilHeatingGas_Impl::CoilHeatingGas_Impl(const CoilHeatingGas_Impl& other, Model_Impl* model, bool keepHandle)
72 114 : StraightComponent_Impl(other, model, keepHandle) {}
73
74 1047 IddObjectType CoilHeatingGas_Impl::iddObjectType() const {
75 1047 return CoilHeatingGas::iddObjectType();
76 }
77
78 // Get all output variable names that could be associated with this object.
79 1 const std::vector<std::string>& CoilHeatingGas_Impl::outputVariableNames() const {
80 // TODO: static until return of ModelObject is changed
81 static const std::vector<std::string> result{
82 // Common variables
83 "Heating Coil Air Heating Energy", "Heating Coil Air Heating Rate",
84
85 // This is the parasitic electric load associated with the coil operation, such as an inducer fan
86 "Heating Coil Electricity Energy", "Heating Coil Electricity Rate",
87
88 "Heating Coil Runtime Fraction",
89
90 // As of E+ 8;6, this maps to Coil:Heating:Fuel
91 // Fuel type specific
92 // TODO: DLM: the return type of this method needs to change to std::vector<std::string> in ModelObject
93 // until then, make this include all possible outputVariableNames for class regardless of fuelType
94 // std::string fuelType = this->fuelType();
95 // => ["NaturalGas", "Propane", "Diesel", "Gasoline", "Coal", "FuelOilNo1", "FuelOilNo2", "OtherFuel1", "OtherFuel2"]
96 // "Heating Coil <Fuel Type> Energy",
97 // if (fuelType == "NaturalGas") {
98 "Heating Coil NaturalGas Energy", "Heating Coil NaturalGas Rate", "Heating Coil Ancillary NaturalGas Energy",
99 "Heating Coil Ancillary NaturalGas Rate",
100 // } else if (fuelType == "Propane") {
101 "Heating Coil Propane Energy", "Heating Coil Propane Rate", "Heating Coil Ancillary Propane Energy", "Heating Coil Ancillary Propane Rate",
102 // } else if (fuelType == "FuelOilNo1") {
103 "Heating Coil FuelOilNo1 Energy", "Heating Coil FuelOilNo1 Rate", "Heating Coil Ancillary FuelOilNo1 Energy",
104 "Heating Coil Ancillary FuelOilNo1 Rate",
105 // } else if (fuelType == "FuelOilNo2") {
106 "Heating Coil FuelOilNo2 Energy", "Heating Coil FuelOilNo2 Rate", "Heating Coil Ancillary FuelOilNo2 Energy",
107 "Heating Coil Ancillary FuelOilNo2 Rate",
108 // } else if (fuelType == "Diesel") {
109 "Heating Coil Diesel Energy", "Heating Coil Diesel Rate", "Heating Coil Ancillary Diesel Energy", "Heating Coil Ancillary Diesel Rate",
110 // } else if (fuelType == "Gasoline") {
111 "Heating Coil Gasoline Energy", "Heating Coil Gasoline Rate", "Heating Coil Ancillary Gasoline Energy",
112 "Heating Coil Ancillary Gasoline Rate",
113 // } else if (fuelType == "Coal") {
114 "Heating Coil Coal Energy", "Heating Coil Coal Rate", "Heating Coil Ancillary Coal Energy", "Heating Coil Ancillary Coal Rate",
115 // } else if (fuelType == "OtherFuel1") {
116 "Heating Coil OtherFuel1 Energy", "Heating Coil OtherFuel1 Rate", "Heating Coil Ancillary OtherFuel1 Energy",
117 "Heating Coil Ancillary OtherFuel1 Rate",
118 // } else if (fuelType == "OtherFuel2") {
119 "Heating Coil OtherFuel2 Energy", "Heating Coil OtherFuel2 Rate", "Heating Coil Ancillary OtherFuel2 Energy",
120 "Heating Coil Ancillary OtherFuel2 Rate"
121 // }
122
5/11
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 time.
✓ Branch 10 taken 41 times.
✓ Branch 11 taken 1 time.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
44 };
123 1 return result;
124 3 }
125
126 ✗ std::vector<ScheduleTypeKey> CoilHeatingGas_Impl::getScheduleTypeKeys(const Schedule& schedule) const {
127 ✗ std::vector<ScheduleTypeKey> result;
128 ✗ UnsignedVector fieldIndices = getSourceIndices(schedule.handle());
129 ✗ UnsignedVector::const_iterator b(fieldIndices.begin());
130 ✗ UnsignedVector::const_iterator e(fieldIndices.end());
131 ✗ if (std::find(b, e, OS_Coil_Heating_GasFields::AvailabilityScheduleName) != e) {
132 ✗ result.push_back(ScheduleTypeKey("CoilHeatingGas", "Availability"));
133 }
134 ✗ return result;
135 ✗ }
136
137 339 unsigned CoilHeatingGas_Impl::inletPort() const {
138 339 return OS_Coil_Heating_GasFields::AirInletNodeName;
139 }
140
141 5714 unsigned CoilHeatingGas_Impl::outletPort() const {
142 5714 return OS_Coil_Heating_GasFields::AirOutletNodeName;
143 }
144
145 46 Schedule CoilHeatingGas_Impl::availabilitySchedule() const {
146
1/1
✓ Branch 1 taken 46 times.
46 boost::optional<Schedule> value = optionalAvailabilitySchedule();
147
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 46 times.
46 if (!value) {
148 // it is an error if we get here, however we don't want to crash
149 // so we hook up to global always on schedule
150 ✗ LOG(Error, "Required availability schedule not set, using 'Always On' schedule");
151 ✗ value = this->model().alwaysOnDiscreteSchedule();
152 ✗ OS_ASSERT(value);
153 ✗ const_cast<CoilHeatingGas_Impl*>(this)->setAvailabilitySchedule(*value);
154 ✗ value = optionalAvailabilitySchedule();
155 }
156
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 46 times.
✗ Branch 4 not taken.
46 OS_ASSERT(value);
157
2/2
✓ Branch 1 taken 46 times.
✓ Branch 4 taken 46 times.
92 return value.get();
158 46 }
159 196 bool CoilHeatingGas_Impl::setAvailabilitySchedule(Schedule& schedule) {
160
3/3
✓ Branch 1 taken 196 times.
✓ Branch 4 taken 196 times.
✓ Branch 7 taken 196 times.
784 bool result = setSchedule(OS_Coil_Heating_GasFields::AvailabilityScheduleName, "CoilHeatingGas", "Availability", schedule);
161 196 return result;
162 }
163
164 50 std::string CoilHeatingGas_Impl::fuelType() const {
165
3/3
✓ Branch 1 taken 50 times.
✓ Branch 4 taken 50 times.
✓ Branch 7 taken 50 times.
50 return this->getString(OS_Coil_Heating_GasFields::FuelType, true).get();
166 }
167
168 4 bool CoilHeatingGas_Impl::setFuelType(const std::string& fuelType) {
169 4 return this->setString(OS_Coil_Heating_GasFields::FuelType, fuelType);
170 }
171
172 1 void CoilHeatingGas_Impl::resetFuelType() {
173
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 this->setString(OS_Coil_Heating_GasFields::FuelType, "");
174 1 }
175
176 47 double CoilHeatingGas_Impl::gasBurnerEfficiency() const {
177
2/2
✓ Branch 1 taken 47 times.
✓ Branch 4 taken 47 times.
47 return this->getDouble(OS_Coil_Heating_GasFields::GasBurnerEfficiency).get();
178 }
179
180 197 bool CoilHeatingGas_Impl::setGasBurnerEfficiency(double val) {
181 197 return this->setDouble(OS_Coil_Heating_GasFields::GasBurnerEfficiency, val);
182 }
183
184 46 double CoilHeatingGas_Impl::onCycleParasiticElectricLoad() const {
185
2/2
✓ Branch 1 taken 46 times.
✓ Branch 4 taken 46 times.
46 return this->getDouble(OS_Coil_Heating_GasFields::OnCycleParasiticElectricLoad).get();
186 }
187
188 197 bool CoilHeatingGas_Impl::setOnCycleParasiticElectricLoad(double val) {
189 197 return this->setDouble(OS_Coil_Heating_GasFields::OnCycleParasiticElectricLoad, val);
190 }
191
192 46 double CoilHeatingGas_Impl::offCycleParasiticGasLoad() const {
193
2/2
✓ Branch 1 taken 46 times.
✓ Branch 4 taken 46 times.
46 return this->getDouble(OS_Coil_Heating_GasFields::OffCycleParasiticGasLoad).get();
194 }
195
196 197 bool CoilHeatingGas_Impl::setOffCycleParasiticGasLoad(double val) {
197 197 return this->setDouble(OS_Coil_Heating_GasFields::OffCycleParasiticGasLoad, val);
198 }
199
200 12 boost::optional<HVACComponent> CoilHeatingGas_Impl::containingHVACComponent() const {
201 // Process all types that might contain a CoilHeatingWater object.
202
203 // AirLoopHVACUnitarySystem
204
2/2
✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
12 std::vector<AirLoopHVACUnitarySystem> airLoopHVACUnitarySystems = this->model().getConcreteModelObjects<AirLoopHVACUnitarySystem>();
205
206
2/2
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 10 times.
12 for (const auto& airLoopHVACUnitarySystem : airLoopHVACUnitarySystems) {
207
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (boost::optional<HVACComponent> heatingCoil = airLoopHVACUnitarySystem.heatingCoil()) {
208
6/6
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 12 taken 1 time.
✓ Branch 13 taken 1 time.
2 if (heatingCoil->handle() == this->handle()) {
209
1/1
✓ Branch 1 taken 1 time.
1 return airLoopHVACUnitarySystem;
210 }
211 2 }
212
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (boost::optional<HVACComponent> suppHeatingCoil = airLoopHVACUnitarySystem.supplementalHeatingCoil()) {
213
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.
1 if (suppHeatingCoil->handle() == this->handle()) {
214
1/1
✓ Branch 1 taken 1 time.
1 return airLoopHVACUnitarySystem;
215 }
216 1 }
217 }
218
219 // AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass
220 std::vector<AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass> bypassSystems =
221
2/2
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
10 this->model().getConcreteModelObjects<AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass>();
222
223
1/2
✗ Branch 5 not taken.
✓ Branch 6 taken 10 times.
10 for (const auto& bypassSystem : bypassSystems) {
224 ✗ if (boost::optional<HVACComponent> heatingCoil = bypassSystem.heatingCoil()) {
225 ✗ if (heatingCoil->handle() == this->handle()) {
226 ✗ return bypassSystem;
227 }
228 ✗ }
229 }
230
231 // AirTerminalSingleDuctVAVReheat
232
233 10 std::vector<AirTerminalSingleDuctVAVReheat> airTerminalSingleDuctVAVReheatObjects;
234
235
2/2
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
10 airTerminalSingleDuctVAVReheatObjects = this->model().getConcreteModelObjects<AirTerminalSingleDuctVAVReheat>();
236
237
1/2
✗ Branch 5 not taken.
✓ Branch 6 taken 10 times.
10 for (const auto& airTerminalSingleDuctVAVReheatObject : airTerminalSingleDuctVAVReheatObjects) {
238 ✗ if (boost::optional<HVACComponent> coil = airTerminalSingleDuctVAVReheatObject.reheatCoil()) {
239 ✗ if (coil->handle() == this->handle()) {
240 ✗ return airTerminalSingleDuctVAVReheatObject;
241 }
242 ✗ }
243 }
244
245 // AirTerminalSingleDuctVAVHeatAndCoolReheat
246
247 10 std::vector<AirTerminalSingleDuctVAVHeatAndCoolReheat> airTerminalSingleDuctVAVHeatAndCoolReheatObjects;
248
249
2/2
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
10 airTerminalSingleDuctVAVHeatAndCoolReheatObjects = this->model().getConcreteModelObjects<AirTerminalSingleDuctVAVHeatAndCoolReheat>();
250
251
1/2
✗ Branch 5 not taken.
✓ Branch 6 taken 10 times.
10 for (const auto& airTerminalSingleDuctVAVHeatAndCoolReheatObject : airTerminalSingleDuctVAVHeatAndCoolReheatObjects) {
252 ✗ if (boost::optional<HVACComponent> coil = airTerminalSingleDuctVAVHeatAndCoolReheatObject.reheatCoil()) {
253 ✗ if (coil->handle() == this->handle()) {
254 ✗ return airTerminalSingleDuctVAVHeatAndCoolReheatObject;
255 }
256 ✗ }
257 }
258
259 // AirTerminalSingleDuctConstantVolumeReheat
260
261 10 std::vector<AirTerminalSingleDuctConstantVolumeReheat> airTerminalSingleDuctConstantVolumeReheatObjects;
262
263
2/2
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
10 airTerminalSingleDuctConstantVolumeReheatObjects = this->model().getConcreteModelObjects<AirTerminalSingleDuctConstantVolumeReheat>();
264
265
1/2
✗ Branch 5 not taken.
✓ Branch 6 taken 10 times.
10 for (const auto& airTerminalSingleDuctConstantVolumeReheatObject : airTerminalSingleDuctConstantVolumeReheatObjects) {
266 ✗ if (boost::optional<HVACComponent> coil = airTerminalSingleDuctConstantVolumeReheatObject.reheatCoil()) {
267 ✗ if (coil->handle() == this->handle()) {
268 ✗ return airTerminalSingleDuctConstantVolumeReheatObject;
269 }
270 ✗ }
271 }
272
273 // AirTerminalSingleDuctParallelPIUReheat
274
275 10 std::vector<AirTerminalSingleDuctParallelPIUReheat> airTerminalSingleDuctParallelPIUReheatObjects;
276
277
2/2
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
10 airTerminalSingleDuctParallelPIUReheatObjects = this->model().getConcreteModelObjects<AirTerminalSingleDuctParallelPIUReheat>();
278
279
1/2
✗ Branch 5 not taken.
✓ Branch 6 taken 10 times.
10 for (const auto& airTerminalSingleDuctParallelPIUReheatObject : airTerminalSingleDuctParallelPIUReheatObjects) {
280 ✗ if (boost::optional<HVACComponent> coil = airTerminalSingleDuctParallelPIUReheatObject.reheatCoil()) {
281 ✗ if (coil->handle() == this->handle()) {
282 ✗ return airTerminalSingleDuctParallelPIUReheatObject;
283 }
284 ✗ }
285 }
286
287 // AirLoopHVACUnitaryHeatPumpAirToAir
288
289 10 std::vector<AirLoopHVACUnitaryHeatPumpAirToAir> airLoopHVACUnitaryHeatPumpAirToAirs;
290
291
2/2
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
10 airLoopHVACUnitaryHeatPumpAirToAirs = this->model().getConcreteModelObjects<AirLoopHVACUnitaryHeatPumpAirToAir>();
292
293
1/2
✗ Branch 5 not taken.
✓ Branch 6 taken 10 times.
10 for (const auto& airLoopHVACUnitaryHeatPumpAirToAir : airLoopHVACUnitaryHeatPumpAirToAirs) {
294 ✗ if (boost::optional<HVACComponent> supplementalHeatingCoil = airLoopHVACUnitaryHeatPumpAirToAir.supplementalHeatingCoil()) {
295 ✗ if (supplementalHeatingCoil->handle() == this->handle()) {
296 ✗ return airLoopHVACUnitaryHeatPumpAirToAir;
297 }
298 ✗ }
299 }
300
301 // AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed
302 {
303
2/2
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
10 auto systems = this->model().getConcreteModelObjects<AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed>();
304
305
1/2
✗ Branch 5 not taken.
✓ Branch 6 taken 10 times.
10 for (const auto& system : systems) {
306 ✗ auto heatingCoil = system.heatingCoil();
307 ✗ if (heatingCoil.handle() == this->handle()) {
308 ✗ return system;
309 }
310 ✗ auto supHeatingCoil = system.supplementalHeatingCoil();
311 ✗ if (supHeatingCoil.handle() == this->handle()) {
312 ✗ return system;
313 }
314 ✗ }
315 10 }
316
317 10 return boost::none;
318 12 }
319
320 10 boost::optional<ZoneHVACComponent> CoilHeatingGas_Impl::containingZoneHVACComponent() const {
321 // ZoneHVACWaterToAirHeatPump
322
323 10 std::vector<ZoneHVACWaterToAirHeatPump> zoneHVACWaterToAirHeatPumps;
324
325
2/2
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
10 zoneHVACWaterToAirHeatPumps = this->model().getConcreteModelObjects<ZoneHVACWaterToAirHeatPump>();
326
327
1/2
✗ Branch 5 not taken.
✓ Branch 6 taken 10 times.
10 for (const auto& zoneHVACWaterToAirHeatPump : zoneHVACWaterToAirHeatPumps) {
328 ✗ if (boost::optional<HVACComponent> coil = zoneHVACWaterToAirHeatPump.supplementalHeatingCoil()) {
329 ✗ if (coil->handle() == this->handle()) {
330 ✗ return zoneHVACWaterToAirHeatPump;
331 }
332 ✗ }
333 }
334
335 // ZoneHVACPackagedTerminalAirConditioner
336
337 10 std::vector<ZoneHVACPackagedTerminalAirConditioner> zoneHVACPackagedTerminalAirConditioners;
338
339
2/2
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
10 zoneHVACPackagedTerminalAirConditioners = this->model().getConcreteModelObjects<ZoneHVACPackagedTerminalAirConditioner>();
340
341
1/2
✗ Branch 5 not taken.
✓ Branch 6 taken 10 times.
10 for (const auto& zoneHVACPackagedTerminalAirConditioner : zoneHVACPackagedTerminalAirConditioners) {
342 ✗ if (boost::optional<HVACComponent> coil = zoneHVACPackagedTerminalAirConditioner.heatingCoil()) {
343 ✗ if (coil->handle() == this->handle()) {
344 ✗ return zoneHVACPackagedTerminalAirConditioner;
345 }
346 ✗ }
347 }
348
349 // ZoneHVACUnitHeater
350
351 10 std::vector<ZoneHVACUnitHeater> zoneHVACUnitHeaters;
352
353
2/2
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
10 zoneHVACUnitHeaters = this->model().getConcreteModelObjects<ZoneHVACUnitHeater>();
354
355
1/2
✗ Branch 5 not taken.
✓ Branch 6 taken 10 times.
10 for (const auto& zoneHVACUnitHeater : zoneHVACUnitHeaters) {
356 ✗ if (boost::optional<HVACComponent> coil = zoneHVACUnitHeater.heatingCoil()) {
357 ✗ if (coil->handle() == this->handle()) {
358 ✗ return zoneHVACUnitHeater;
359 }
360 ✗ }
361 }
362
363 // ZoneHVACUnitHeater
364
365 10 std::vector<ZoneHVACUnitVentilator> zoneHVACUnitVentilators;
366
367
2/2
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
10 zoneHVACUnitVentilators = this->model().getConcreteModelObjects<ZoneHVACUnitVentilator>();
368
369
1/2
✗ Branch 5 not taken.
✓ Branch 6 taken 10 times.
10 for (const auto& zoneHVACUnitVentilator : zoneHVACUnitVentilators) {
370 ✗ if (boost::optional<HVACComponent> coil = zoneHVACUnitVentilator.heatingCoil()) {
371 ✗ if (coil->handle() == this->handle()) {
372 ✗ return zoneHVACUnitVentilator;
373 }
374 ✗ }
375 }
376
377 10 return boost::none;
378 10 }
379
380 46 boost::optional<Schedule> CoilHeatingGas_Impl::optionalAvailabilitySchedule() const {
381
2/2
✓ Branch 1 taken 46 times.
✓ Branch 4 taken 46 times.
46 return getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_Coil_Heating_GasFields::AvailabilityScheduleName);
382 }
383
384 ✗ boost::optional<ModelObject> CoilHeatingGas_Impl::availabilityScheduleAsModelObject() const {
385 ✗ OptionalModelObject result = availabilitySchedule();
386 ✗ return result;
387 }
388
389 ✗ bool CoilHeatingGas_Impl::setAvailabilityScheduleAsModelObject(const boost::optional<ModelObject>& modelObject) {
390 ✗ if (modelObject) {
391 ✗ OptionalSchedule intermediate = modelObject->optionalCast<Schedule>();
392 ✗ if (intermediate) {
393 ✗ Schedule schedule(*intermediate);
394 ✗ return setAvailabilitySchedule(schedule);
395 ✗ }
396 ✗ }
397 ✗ return false;
398 }
399
400 46 boost::optional<double> CoilHeatingGas_Impl::nominalCapacity() const {
401 46 return getDouble(OS_Coil_Heating_GasFields::NominalCapacity, true);
402 }
403
404 1 bool CoilHeatingGas_Impl::isNominalCapacityAutosized() const {
405 1 bool result = false;
406
1/1
✓ Branch 1 taken 1 time.
1 boost::optional<std::string> value = getString(OS_Coil_Heating_GasFields::NominalCapacity, true);
407
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (value) {
408
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
2 result = openstudio::istringEqual(value.get(), "autosize");
409 }
410 1 return result;
411 1 }
412
413 2 bool CoilHeatingGas_Impl::setNominalCapacity(boost::optional<double> nominalCapacity) {
414 2 bool result(false);
415
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (nominalCapacity) {
416 2 result = setDouble(OS_Coil_Heating_GasFields::NominalCapacity, nominalCapacity.get());
417 } else {
418 ✗ resetNominalCapacity();
419 ✗ result = true;
420 }
421
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 OS_ASSERT(result);
422 2 return result;
423 }
424
425 ✗ void CoilHeatingGas_Impl::resetNominalCapacity() {
426 ✗ bool result = setString(OS_Coil_Heating_GasFields::NominalCapacity, "");
427 ✗ OS_ASSERT(result);
428 ✗ }
429
430 ✗ void CoilHeatingGas_Impl::autosizeNominalCapacity() {
431 ✗ bool result = setString(OS_Coil_Heating_GasFields::NominalCapacity, "autosize");
432 ✗ OS_ASSERT(result);
433 ✗ }
434
435 101 boost::optional<Curve> CoilHeatingGas_Impl::partLoadFractionCorrelationCurve() const {
436 101 boost::optional<Curve> curve;
437
438
2/2
✓ Branch 1 taken 101 times.
✓ Branch 4 taken 101 times.
101 curve = getObject<ModelObject>().getModelObjectTarget<Curve>(OS_Coil_Heating_GasFields::PartLoadFractionCorrelationCurveName);
439
440 101 return curve;
441 ✗ }
442
443 ✗ bool CoilHeatingGas_Impl::setPartLoadFractionCorrelationCurve(const Curve& curve) {
444 ✗ return setPointer(OS_Coil_Heating_GasFields::PartLoadFractionCorrelationCurveName, curve.handle());
445 }
446
447 ✗ void CoilHeatingGas_Impl::resetPartLoadFractionCorrelationCurve() {
448 ✗ setString(OS_Coil_Heating_GasFields::PartLoadFractionCorrelationCurveName, "");
449 ✗ }
450
451 56 std::vector<ModelObject> CoilHeatingGas_Impl::children() const {
452 56 std::vector<ModelObject> result;
453
454
2/3
✓ Branch 1 taken 56 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 56 times.
112 if (boost::optional<Curve> curve = partLoadFractionCorrelationCurve()) {
455 ✗ result.push_back(curve.get());
456 56 }
457
458 std::vector<AirflowNetworkEquivalentDuct> myAFNItems =
459
3/3
✓ Branch 1 taken 56 times.
✓ Branch 4 taken 56 times.
✓ Branch 7 taken 56 times.
56 getObject<ModelObject>().getModelObjectSources<AirflowNetworkEquivalentDuct>(AirflowNetworkEquivalentDuct::iddObjectType());
460
1/1
✓ Branch 5 taken 56 times.
56 result.insert(result.end(), myAFNItems.begin(), myAFNItems.end());
461
462 112 return result;
463 56 }
464
465 3 ModelObject CoilHeatingGas_Impl::clone(Model model) const {
466
3/3
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
3 auto newCoil = StraightComponent_Impl::clone(model).cast<CoilHeatingGas>();
467
468 6 return std::move(newCoil);
469 3 }
470
471 185 bool CoilHeatingGas_Impl::addToNode(Node& node) {
472
3/3
✓ Branch 1 taken 185 times.
✓ Branch 3 taken 182 times.
✓ Branch 4 taken 3 times.
370 if (boost::optional<AirLoopHVAC> airLoop = node.airLoopHVAC()) {
473
5/5
✓ Branch 1 taken 182 times.
✓ Branch 4 taken 182 times.
✓ Branch 7 taken 182 times.
✓ Branch 11 taken 181 times.
✓ Branch 12 taken 1 time.
182 if (!airLoop->demandComponent(node.handle())) {
474
1/1
✓ Branch 1 taken 181 times.
181 return StraightComponent_Impl::addToNode(node);
475 }
476 185 }
477
478
3/3
✓ Branch 1 taken 4 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 3 times.
8 if (auto oa = node.airLoopHVACOutdoorAirSystem()) {
479
1/1
✓ Branch 1 taken 1 time.
1 return StraightComponent_Impl::addToNode(node);
480 4 }
481
482 3 return false;
483 }
484
485 1 AirflowNetworkEquivalentDuct CoilHeatingGas_Impl::getAirflowNetworkEquivalentDuct(double length, double diameter) {
486
1/1
✓ Branch 1 taken 1 time.
1 boost::optional<AirflowNetworkEquivalentDuct> opt = airflowNetworkEquivalentDuct();
487
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (opt) {
488 ✗ if (opt->airPathLength() != length) {
489 ✗ opt->setAirPathLength(length);
490 }
491 ✗ if (opt->airPathHydraulicDiameter() != diameter) {
492 ✗ opt->setAirPathHydraulicDiameter(diameter);
493 }
494 }
495
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
2 return AirflowNetworkEquivalentDuct(model(), length, diameter, handle());
496 1 }
497
498 1 boost::optional<AirflowNetworkEquivalentDuct> CoilHeatingGas_Impl::airflowNetworkEquivalentDuct() const {
499 std::vector<AirflowNetworkEquivalentDuct> myAFN =
500
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 getObject<ModelObject>().getModelObjectSources<AirflowNetworkEquivalentDuct>(AirflowNetworkEquivalentDuct::iddObjectType());
501 1 auto count = myAFN.size();
502
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (count == 1) {
503 ✗ return myAFN[0];
504
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 } else if (count > 1) {
505 ✗ LOG(Warn, briefDescription() << " has more than one AirflowNetwork EquivalentDuct attached, returning first.");
506 ✗ return myAFN[0];
507 }
508 1 return boost::none;
509 1 }
510
511 ✗ boost::optional<double> CoilHeatingGas_Impl::autosizedNominalCapacity() const {
512 ✗ return getAutosizedValue("Design Size Nominal Capacity", "W", "Coil:Heating:Fuel");
513 }
514
515 ✗ void CoilHeatingGas_Impl::autosize() {
516 ✗ autosizeNominalCapacity();
517 ✗ }
518
519 ✗ void CoilHeatingGas_Impl::applySizingValues() {
520 ✗ boost::optional<double> val;
521 ✗ val = autosizedNominalCapacity();
522 ✗ if (val) {
523 ✗ setNominalCapacity(val.get());
524 }
525 ✗ }
526
527 ✗ ComponentType CoilHeatingGas_Impl::componentType() const {
528 ✗ return ComponentType::Heating;
529 }
530
531 ✗ std::vector<FuelType> CoilHeatingGas_Impl::coolingFuelTypes() const {
532 ✗ return {};
533 }
534
535 ✗ std::vector<FuelType> CoilHeatingGas_Impl::heatingFuelTypes() const {
536 ✗ return {FuelType(fuelType())};
537 }
538
539 ✗ std::vector<AppGFuelType> CoilHeatingGas_Impl::appGHeatingFuelTypes() const {
540 ✗ return {convertFuelTypeToAppG(FuelType(fuelType()))};
541 }
542
543 } // namespace detail
544
545 // create a new CoilHeatingGas object in the model's workspace
546 190 CoilHeatingGas::CoilHeatingGas(const Model& model, Schedule& schedule) : StraightComponent(CoilHeatingGas::iddObjectType(), model) {
547
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 190 times.
✗ Branch 5 not taken.
190 OS_ASSERT(getImpl<detail::CoilHeatingGas_Impl>());
548
1/1
✓ Branch 1 taken 190 times.
190 bool ok = setAvailableSchedule(schedule);
549
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 190 times.
190 if (!ok) {
550 ✗ remove();
551 ✗ LOG_AND_THROW("Unable to set " << briefDescription() << "'s availability schedule to " << schedule.briefDescription() << ".");
552 }
553
1/1
✓ Branch 1 taken 190 times.
190 setGasBurnerEfficiency(0.8);
554
2/2
✓ Branch 1 taken 190 times.
✓ Branch 4 taken 190 times.
380 setString(openstudio::OS_Coil_Heating_GasFields::NominalCapacity, "AutoSize");
555
1/1
✓ Branch 1 taken 190 times.
190 setOnCycleParasiticElectricLoad(0);
556
1/1
✓ Branch 1 taken 190 times.
190 setOffCycleParasiticGasLoad(0);
557 190 }
558
559 5 CoilHeatingGas::CoilHeatingGas(const Model& model) : StraightComponent(CoilHeatingGas::iddObjectType(), model) {
560
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
✗ Branch 5 not taken.
5 OS_ASSERT(getImpl<detail::CoilHeatingGas_Impl>());
561
562
1/1
✓ Branch 1 taken 5 times.
5 auto schedule = model.alwaysOnDiscreteSchedule();
563
1/1
✓ Branch 1 taken 5 times.
5 setAvailableSchedule(schedule);
564
565
1/1
✓ Branch 1 taken 5 times.
5 setGasBurnerEfficiency(0.8);
566
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
10 setString(openstudio::OS_Coil_Heating_GasFields::NominalCapacity, "AutoSize");
567
1/1
✓ Branch 1 taken 5 times.
5 setOnCycleParasiticElectricLoad(0);
568
1/1
✓ Branch 1 taken 5 times.
5 setOffCycleParasiticGasLoad(0);
569 5 }
570
571
1/1
✓ Branch 3 taken 54 times.
54 CoilHeatingGas::CoilHeatingGas(std::shared_ptr<detail::CoilHeatingGas_Impl> p) : StraightComponent(std::move(p)) {}
572
573 ✗ Schedule CoilHeatingGas::availabilitySchedule() const {
574 ✗ return getImpl<detail::CoilHeatingGas_Impl>()->availabilitySchedule();
575 }
576 46 Schedule CoilHeatingGas::availableSchedule() const {
577
1/1
✓ Branch 3 taken 46 times.
46 return getImpl<detail::CoilHeatingGas_Impl>()->availabilitySchedule();
578 }
579 ✗ bool CoilHeatingGas::setAvailabilitySchedule(Schedule& schedule) {
580 ✗ return getImpl<detail::CoilHeatingGas_Impl>()->setAvailabilitySchedule(schedule);
581 }
582 196 bool CoilHeatingGas::setAvailableSchedule(Schedule& schedule) {
583
1/1
✓ Branch 3 taken 196 times.
196 return getImpl<detail::CoilHeatingGas_Impl>()->setAvailabilitySchedule(schedule);
584 }
585
586 1 std::vector<std::string> CoilHeatingGas::validFuelTypeValues() {
587
5/5
✓ 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.
1 return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_Coil_Heating_GasFields::FuelType);
588 }
589
590 50 std::string CoilHeatingGas::fuelType() const {
591
1/1
✓ Branch 3 taken 50 times.
50 return getImpl<detail::CoilHeatingGas_Impl>()->fuelType();
592 }
593
594 4 bool CoilHeatingGas::setFuelType(const std::string& fuelType) {
595
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::CoilHeatingGas_Impl>()->setFuelType(fuelType);
596 }
597
598 1 void CoilHeatingGas::resetFuelType() {
599
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::CoilHeatingGas_Impl>()->resetFuelType();
600 1 }
601
602 47 double CoilHeatingGas::gasBurnerEfficiency() const {
603
1/1
✓ Branch 3 taken 47 times.
47 return getImpl<detail::CoilHeatingGas_Impl>()->gasBurnerEfficiency();
604 }
605
606 197 bool CoilHeatingGas::setGasBurnerEfficiency(double val) {
607
1/1
✓ Branch 3 taken 197 times.
197 return getImpl<detail::CoilHeatingGas_Impl>()->setGasBurnerEfficiency(val);
608 }
609
610 // DEPRECATED
611 ✗ double CoilHeatingGas::parasiticElectricLoad() const {
612 ✗ DEPRECATED_AT_MSG(3, 7, 0, "Use onCycleParasiticElectricLoad instead.");
613 ✗ return getImpl<detail::CoilHeatingGas_Impl>()->onCycleParasiticElectricLoad();
614 }
615
616 46 double CoilHeatingGas::onCycleParasiticElectricLoad() const {
617
1/1
✓ Branch 3 taken 46 times.
46 return getImpl<detail::CoilHeatingGas_Impl>()->onCycleParasiticElectricLoad();
618 }
619
620 // DEPRECATED
621 1 bool CoilHeatingGas::setParasiticElectricLoad(double val) {
622
5/5
✓ 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.
4 DEPRECATED_AT_MSG(3, 7, 0, "Use setOnCycleParasiticElectricLoad instead.");
623
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::CoilHeatingGas_Impl>()->setOnCycleParasiticElectricLoad(val);
624 }
625
626 196 bool CoilHeatingGas::setOnCycleParasiticElectricLoad(double val) {
627
1/1
✓ Branch 3 taken 196 times.
196 return getImpl<detail::CoilHeatingGas_Impl>()->setOnCycleParasiticElectricLoad(val);
628 }
629
630 // DEPRECATED
631 ✗ double CoilHeatingGas::parasiticGasLoad() const {
632 ✗ DEPRECATED_AT_MSG(3, 7, 0, "Use offCycleParasiticGasLoad instead.");
633 ✗ return getImpl<detail::CoilHeatingGas_Impl>()->offCycleParasiticGasLoad();
634 }
635
636 46 double CoilHeatingGas::offCycleParasiticGasLoad() const {
637
1/1
✓ Branch 3 taken 46 times.
46 return getImpl<detail::CoilHeatingGas_Impl>()->offCycleParasiticGasLoad();
638 }
639
640 // DEPRECATED
641 1 bool CoilHeatingGas::setParasiticGasLoad(double val) {
642
5/5
✓ 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.
4 DEPRECATED_AT_MSG(3, 7, 0, "Use setOffCycleParasiticGasLoad instead.");
643
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::CoilHeatingGas_Impl>()->setOffCycleParasiticGasLoad(val);
644 }
645
646 196 bool CoilHeatingGas::setOffCycleParasiticGasLoad(double val) {
647
1/1
✓ Branch 3 taken 196 times.
196 return getImpl<detail::CoilHeatingGas_Impl>()->setOffCycleParasiticGasLoad(val);
648 }
649
650 46 boost::optional<double> CoilHeatingGas::nominalCapacity() const {
651
1/1
✓ Branch 3 taken 46 times.
46 return getImpl<detail::CoilHeatingGas_Impl>()->nominalCapacity();
652 }
653
654 1 bool CoilHeatingGas::isNominalCapacityAutosized() const {
655
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::CoilHeatingGas_Impl>()->isNominalCapacityAutosized();
656 }
657
658 2 bool CoilHeatingGas::setNominalCapacity(double nominalCapacity) {
659
2/2
✓ Branch 3 taken 2 times.
✓ Branch 6 taken 2 times.
2 return getImpl<detail::CoilHeatingGas_Impl>()->setNominalCapacity(nominalCapacity);
660 }
661
662 ✗ void CoilHeatingGas::resetNominalCapacity() {
663 ✗ getImpl<detail::CoilHeatingGas_Impl>()->resetNominalCapacity();
664 ✗ }
665
666 ✗ void CoilHeatingGas::autosizeNominalCapacity() {
667 ✗ getImpl<detail::CoilHeatingGas_Impl>()->autosizeNominalCapacity();
668 ✗ }
669
670 45 boost::optional<Curve> CoilHeatingGas::partLoadFractionCorrelationCurve() const {
671
1/1
✓ Branch 3 taken 45 times.
45 return getImpl<detail::CoilHeatingGas_Impl>()->partLoadFractionCorrelationCurve();
672 }
673
674 ✗ bool CoilHeatingGas::setPartLoadFractionCorrelationCurve(const Curve& curve) {
675 ✗ return getImpl<detail::CoilHeatingGas_Impl>()->setPartLoadFractionCorrelationCurve(curve);
676 }
677
678 ✗ void CoilHeatingGas::resetPartLoadFractionCorrelationCurve() {
679 ✗ getImpl<detail::CoilHeatingGas_Impl>()->resetPartLoadFractionCorrelationCurve();
680 ✗ }
681
682 9242 IddObjectType CoilHeatingGas::iddObjectType() {
683
1/1
✓ Branch 1 taken 9242 times.
9242 IddObjectType result(IddObjectType::OS_Coil_Heating_Gas);
684 9242 return result;
685 }
686
687 1 AirflowNetworkEquivalentDuct CoilHeatingGas::getAirflowNetworkEquivalentDuct(double length, double diameter) {
688
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::CoilHeatingGas_Impl>()->getAirflowNetworkEquivalentDuct(length, diameter);
689 }
690
691 ✗ boost::optional<AirflowNetworkEquivalentDuct> CoilHeatingGas::airflowNetworkEquivalentDuct() const {
692 ✗ return getImpl<detail::CoilHeatingGas_Impl>()->airflowNetworkEquivalentDuct();
693 }
694
695 ✗ boost::optional<double> CoilHeatingGas::autosizedNominalCapacity() const {
696 ✗ return getImpl<detail::CoilHeatingGas_Impl>()->autosizedNominalCapacity();
697 }
698
699 } // namespace model
700 } // namespace openstudio
701