GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 46.5% 128 / 0 / 275
Functions: 46.7% 28 / 0 / 60
Branches: 36.3% 121 / 0 / 333

src/model/CoilHeatingElectric.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 "Model.hpp"
7 #include "CoilHeatingElectric.hpp"
8 #include "CoilHeatingElectric_Impl.hpp"
9 #include "Schedule.hpp"
10 #include "Schedule_Impl.hpp"
11 #include "AirTerminalSingleDuctParallelPIUReheat.hpp"
12 #include "AirTerminalSingleDuctParallelPIUReheat_Impl.hpp"
13 #include "AirTerminalSingleDuctVAVReheat.hpp"
14 #include "AirTerminalSingleDuctVAVReheat_Impl.hpp"
15 #include "AirLoopHVACOutdoorAirSystem.hpp"
16 #include "AirLoopHVACOutdoorAirSystem_Impl.hpp"
17 #include "AirLoopHVACUnitaryHeatPumpAirToAir.hpp"
18 #include "AirLoopHVACUnitaryHeatPumpAirToAir_Impl.hpp"
19 #include "AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass.hpp"
20 #include "AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass_Impl.hpp"
21 #include "AirLoopHVACUnitarySystem.hpp"
22 #include "AirLoopHVACUnitarySystem_Impl.hpp"
23 #include "AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed.hpp"
24 #include "AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed_Impl.hpp"
25 #include "ZoneHVACComponent.hpp"
26 #include "ZoneHVACComponent_Impl.hpp"
27 #include "ZoneHVACPackagedTerminalHeatPump.hpp"
28 #include "ZoneHVACPackagedTerminalHeatPump_Impl.hpp"
29 #include "ZoneHVACWaterToAirHeatPump.hpp"
30 #include "ZoneHVACWaterToAirHeatPump_Impl.hpp"
31 #include "Node.hpp"
32 #include "Node_Impl.hpp"
33 #include "AirflowNetworkEquivalentDuct.hpp"
34 #include "AirflowNetworkEquivalentDuct_Impl.hpp"
35 #include <utilities/idd/OS_Coil_Heating_Electric_FieldEnums.hxx>
36 #include <utilities/idd/IddEnums.hxx>
37 #include "../utilities/core/Assert.hpp"
38 #include "../utilities/data/DataEnums.hpp"
39
40 namespace openstudio {
41 namespace model {
42
43 namespace detail {
44
45 164 CoilHeatingElectric_Impl::CoilHeatingElectric_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
46 164 : StraightComponent_Impl(idfObject, model, keepHandle) {
47
4/6
✓ Branch 1 taken 164 times.
✓ Branch 4 taken 164 times.
✓ Branch 7 taken 164 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 164 times.
✗ Branch 13 not taken.
164 OS_ASSERT(idfObject.iddObject().type() == CoilHeatingElectric::iddObjectType());
48 164 }
49
50 16 CoilHeatingElectric_Impl::CoilHeatingElectric_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle)
51 16 : StraightComponent_Impl(other, model, keepHandle) {
52
4/6
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 16 times.
✗ Branch 13 not taken.
16 OS_ASSERT(other.iddObject().type() == CoilHeatingElectric::iddObjectType());
53 16 }
54
55 123 CoilHeatingElectric_Impl::CoilHeatingElectric_Impl(const CoilHeatingElectric_Impl& other, Model_Impl* model, bool keepHandle)
56 123 : StraightComponent_Impl(other, model, keepHandle) {}
57
58 ✗ const std::vector<std::string>& CoilHeatingElectric_Impl::outputVariableNames() const {
59 static const std::vector<std::string> result{"Heating Coil Air Heating Energy", "Heating Coil Air Heating Rate",
60 ✗ "Heating Coil Electricity Energy", "Heating Coil Electricity Rate"};
61 ✗ return result;
62 ✗ }
63
64 78 IddObjectType CoilHeatingElectric_Impl::iddObjectType() const {
65 78 return CoilHeatingElectric::iddObjectType();
66 }
67
68 48 std::vector<ModelObject> CoilHeatingElectric_Impl::children() const {
69 48 std::vector<ModelObject> result;
70 std::vector<AirflowNetworkEquivalentDuct> myAFNItems =
71
3/3
✓ Branch 1 taken 48 times.
✓ Branch 4 taken 48 times.
✓ Branch 7 taken 48 times.
48 getObject<ModelObject>().getModelObjectSources<AirflowNetworkEquivalentDuct>(AirflowNetworkEquivalentDuct::iddObjectType());
72
1/1
✓ Branch 5 taken 48 times.
48 result.insert(result.end(), myAFNItems.begin(), myAFNItems.end());
73 96 return result;
74 48 }
75
76 ✗ std::vector<ScheduleTypeKey> CoilHeatingElectric_Impl::getScheduleTypeKeys(const Schedule& schedule) const {
77 ✗ std::vector<ScheduleTypeKey> result;
78 ✗ UnsignedVector fieldIndices = getSourceIndices(schedule.handle());
79 ✗ UnsignedVector::const_iterator b(fieldIndices.begin());
80 ✗ UnsignedVector::const_iterator e(fieldIndices.end());
81 ✗ if (std::find(b, e, OS_Coil_Heating_ElectricFields::AvailabilityScheduleName) != e) {
82 ✗ result.push_back(ScheduleTypeKey("CoilHeatingElectric", "Availability"));
83 }
84 ✗ return result;
85 ✗ }
86
87 36 double CoilHeatingElectric_Impl::efficiency() const {
88
1/1
✓ Branch 1 taken 36 times.
36 boost::optional<double> value = getDouble(OS_Coil_Heating_ElectricFields::Efficiency, true);
89
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
✗ Branch 4 not taken.
36 OS_ASSERT(value);
90
1/1
✓ Branch 1 taken 36 times.
72 return value.get();
91 }
92
93 ✗ bool CoilHeatingElectric_Impl::isEfficiencyDefaulted() const {
94 ✗ return isEmpty(OS_Coil_Heating_ElectricFields::Efficiency);
95 }
96
97 ✗ boost::optional<double> CoilHeatingElectric_Impl::nominalCapacity() const {
98 ✗ return getDouble(OS_Coil_Heating_ElectricFields::NominalCapacity, true);
99 }
100
101 ✗ bool CoilHeatingElectric_Impl::isNominalCapacityDefaulted() const {
102 ✗ return isEmpty(OS_Coil_Heating_ElectricFields::NominalCapacity);
103 }
104
105 36 bool CoilHeatingElectric_Impl::isNominalCapacityAutosized() const {
106 36 bool result = false;
107
1/1
✓ Branch 1 taken 36 times.
36 boost::optional<std::string> value = getString(OS_Coil_Heating_ElectricFields::NominalCapacity, true);
108
1/2
✓ Branch 0 taken 36 times.
✗ Branch 1 not taken.
36 if (value) {
109
3/3
✓ Branch 1 taken 36 times.
✓ Branch 4 taken 36 times.
✓ Branch 7 taken 36 times.
72 result = openstudio::istringEqual(value.get(), "Autosize");
110 }
111 36 return result;
112 36 }
113
114 36 boost::optional<Node> CoilHeatingElectric_Impl::temperatureSetpointNode() const {
115
2/2
✓ Branch 1 taken 36 times.
✓ Branch 4 taken 36 times.
36 return getObject<ModelObject>().getModelObjectTarget<Node>(OS_Coil_Heating_ElectricFields::TemperatureSetpointNodeName);
116 }
117
118 ✗ bool CoilHeatingElectric_Impl::setEfficiency(double efficiency) {
119 ✗ bool result = setDouble(OS_Coil_Heating_ElectricFields::Efficiency, efficiency);
120 ✗ return result;
121 }
122
123 ✗ void CoilHeatingElectric_Impl::resetEfficiency() {
124 ✗ bool result = setString(OS_Coil_Heating_ElectricFields::Efficiency, "");
125 ✗ OS_ASSERT(result);
126 ✗ }
127
128 ✗ bool CoilHeatingElectric_Impl::setNominalCapacity(boost::optional<double> nominalCapacity) {
129 ✗ bool result = false;
130 ✗ if (nominalCapacity) {
131 ✗ result = setDouble(OS_Coil_Heating_ElectricFields::NominalCapacity, nominalCapacity.get());
132 } else {
133 ✗ result = setString(OS_Coil_Heating_ElectricFields::NominalCapacity, "");
134 }
135 ✗ OS_ASSERT(result);
136 ✗ return result;
137 }
138
139 ✗ void CoilHeatingElectric_Impl::resetNominalCapacity() {
140 ✗ bool result = setString(OS_Coil_Heating_ElectricFields::NominalCapacity, "");
141 ✗ OS_ASSERT(result);
142 ✗ }
143
144 ✗ void CoilHeatingElectric_Impl::autosizeNominalCapacity() {
145 ✗ bool result = setString(OS_Coil_Heating_ElectricFields::NominalCapacity, "Autosize");
146 ✗ OS_ASSERT(result);
147 ✗ }
148
149 ✗ bool CoilHeatingElectric_Impl::setTemperatureSetpointNode(Node& temperatureSetpointNode) {
150 ✗ return setPointer(OS_Coil_Heating_ElectricFields::TemperatureSetpointNodeName, temperatureSetpointNode.handle());
151 ;
152 }
153
154 ✗ void CoilHeatingElectric_Impl::resetTemperatureSetpointNode() {
155 ✗ bool result = setString(OS_Coil_Heating_ElectricFields::TemperatureSetpointNodeName, "");
156 ✗ OS_ASSERT(result);
157 ✗ }
158
159 444 unsigned CoilHeatingElectric_Impl::inletPort() const {
160 444 return OS_Coil_Heating_ElectricFields::AirInletNodeName;
161 }
162
163 421 unsigned CoilHeatingElectric_Impl::outletPort() const {
164 421 return OS_Coil_Heating_ElectricFields::AirOutletNodeName;
165 }
166
167 36 Schedule CoilHeatingElectric_Impl::availabilitySchedule() const {
168 boost::optional<Schedule> value =
169
2/2
✓ Branch 1 taken 36 times.
✓ Branch 4 taken 36 times.
36 getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_Coil_Heating_ElectricFields::AvailabilityScheduleName);
170
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
36 if (!value) {
171 // it is an error if we get here, however we don't want to crash
172 // so we hook up to global always on schedule
173 ✗ LOG(Error, "Required availability schedule not set, using 'Always On' schedule");
174 ✗ value = this->model().alwaysOnDiscreteSchedule();
175 ✗ OS_ASSERT(value);
176 ✗ const_cast<CoilHeatingElectric_Impl*>(this)->setAvailabilitySchedule(*value);
177 ✗ value = getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_Coil_Heating_ElectricFields::AvailabilityScheduleName);
178 }
179
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
✗ Branch 4 not taken.
36 OS_ASSERT(value);
180
2/2
✓ Branch 1 taken 36 times.
✓ Branch 4 taken 36 times.
72 return value.get();
181 36 }
182
183 148 bool CoilHeatingElectric_Impl::setAvailabilitySchedule(Schedule& schedule) {
184
3/3
✓ Branch 1 taken 148 times.
✓ Branch 4 taken 148 times.
✓ Branch 7 taken 148 times.
592 bool result = setSchedule(OS_Coil_Heating_ElectricFields::AvailabilityScheduleName, "CoilHeatingElectric", "Availability", schedule);
185 148 return result;
186 }
187
188 47 bool CoilHeatingElectric_Impl::addToNode(Node& node) {
189
3/3
✓ Branch 1 taken 47 times.
✓ Branch 3 taken 16 times.
✓ Branch 4 taken 31 times.
94 if (boost::optional<AirLoopHVAC> airLoop = node.airLoopHVAC()) {
190
5/5
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
✓ Branch 11 taken 15 times.
✓ Branch 12 taken 1 time.
16 if (!airLoop->demandComponent(node.handle())) {
191
1/1
✓ Branch 1 taken 15 times.
15 return StraightComponent_Impl::addToNode(node);
192 }
193 47 }
194
195
3/3
✓ Branch 1 taken 32 times.
✓ Branch 3 taken 29 times.
✓ Branch 4 taken 3 times.
64 if (auto oa = node.airLoopHVACOutdoorAirSystem()) {
196
1/1
✓ Branch 1 taken 29 times.
29 return StraightComponent_Impl::addToNode(node);
197 32 }
198
199 3 return false;
200 }
201
202 8 boost::optional<HVACComponent> CoilHeatingElectric_Impl::containingHVACComponent() const {
203 // Process all types that might contain a CoilHeatingWater object.
204
205 // AirLoopHVACUnitarySystem
206
2/2
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
8 std::vector<AirLoopHVACUnitarySystem> airLoopHVACUnitarySystems = this->model().getConcreteModelObjects<AirLoopHVACUnitarySystem>();
207
208
2/2
✓ Branch 5 taken 4 times.
✓ Branch 6 taken 4 times.
8 for (const auto& airLoopHVACUnitarySystem : airLoopHVACUnitarySystems) {
209
2/3
✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
8 if (boost::optional<HVACComponent> heatingCoil = airLoopHVACUnitarySystem.heatingCoil()) {
210
6/6
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
✓ Branch 12 taken 2 times.
✓ Branch 13 taken 2 times.
4 if (heatingCoil->handle() == this->handle()) {
211
1/1
✓ Branch 1 taken 2 times.
2 return airLoopHVACUnitarySystem;
212 }
213 4 }
214
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (boost::optional<HVACComponent> suppHeatingCoil = airLoopHVACUnitarySystem.supplementalHeatingCoil()) {
215
5/6
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 12 taken 2 times.
✗ Branch 13 not taken.
2 if (suppHeatingCoil->handle() == this->handle()) {
216
1/1
✓ Branch 1 taken 2 times.
2 return airLoopHVACUnitarySystem;
217 }
218 2 }
219 }
220
221 // AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass
222 std::vector<AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass> bypassSystems =
223
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 this->model().getConcreteModelObjects<AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass>();
224
225
2/2
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 2 times.
4 for (const auto& bypassSystem : bypassSystems) {
226
3/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
4 if (boost::optional<HVACComponent> heatingCoil = bypassSystem.heatingCoil()) {
227
5/6
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 12 taken 2 times.
✗ Branch 13 not taken.
2 if (heatingCoil->handle() == this->handle()) {
228
1/1
✓ Branch 1 taken 2 times.
2 return bypassSystem;
229 }
230 2 }
231 }
232
233 // AirTerminalSingleDuctVAVReheat
234
235 2 std::vector<AirTerminalSingleDuctVAVReheat> airTerminalSingleDuctVAVReheatObjects;
236
237
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 airTerminalSingleDuctVAVReheatObjects = this->model().getConcreteModelObjects<AirTerminalSingleDuctVAVReheat>();
238
239
1/2
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
2 for (const auto& airTerminalSingleDuctVAVReheatObject : airTerminalSingleDuctVAVReheatObjects) {
240 ✗ if (boost::optional<HVACComponent> coil = airTerminalSingleDuctVAVReheatObject.reheatCoil()) {
241 ✗ if (coil->handle() == this->handle()) {
242 ✗ return airTerminalSingleDuctVAVReheatObject;
243 }
244 ✗ }
245 }
246
247 // AirTerminalSingleDuctParallelPIUReheat
248
249 2 std::vector<AirTerminalSingleDuctParallelPIUReheat> airTerminalSingleDuctParallelPIUReheatObjects;
250
251
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 airTerminalSingleDuctParallelPIUReheatObjects = this->model().getConcreteModelObjects<AirTerminalSingleDuctParallelPIUReheat>();
252
253
1/2
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
2 for (const auto& airTerminalSingleDuctParallelPIUReheatObject : airTerminalSingleDuctParallelPIUReheatObjects) {
254 ✗ if (boost::optional<HVACComponent> coil = airTerminalSingleDuctParallelPIUReheatObject.reheatCoil()) {
255 ✗ if (coil->handle() == this->handle()) {
256 ✗ return airTerminalSingleDuctParallelPIUReheatObject;
257 }
258 ✗ }
259 }
260
261 // AirLoopHVACUnitaryHeatPumpAirToAir
262
263 2 std::vector<AirLoopHVACUnitaryHeatPumpAirToAir> airLoopHVACUnitaryHeatPumpAirToAirs;
264
265
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 airLoopHVACUnitaryHeatPumpAirToAirs = this->model().getConcreteModelObjects<AirLoopHVACUnitaryHeatPumpAirToAir>();
266
267
1/2
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
2 for (const auto& airLoopHVACUnitaryHeatPumpAirToAir : airLoopHVACUnitaryHeatPumpAirToAirs) {
268 ✗ if (boost::optional<HVACComponent> supplementalHeatingCoil = airLoopHVACUnitaryHeatPumpAirToAir.supplementalHeatingCoil()) {
269 ✗ if (supplementalHeatingCoil->handle() == this->handle()) {
270 ✗ return airLoopHVACUnitaryHeatPumpAirToAir;
271 }
272 ✗ }
273 }
274
275 // AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed
276 {
277
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 auto systems = this->model().getConcreteModelObjects<AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed>();
278
279
1/2
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
2 for (const auto& system : systems) {
280 ✗ auto heatingCoil = system.heatingCoil();
281 ✗ if (heatingCoil.handle() == this->handle()) {
282 ✗ return system;
283 }
284 ✗ auto supHeatingCoil = system.supplementalHeatingCoil();
285 ✗ if (supHeatingCoil.handle() == this->handle()) {
286 ✗ return system;
287 }
288 ✗ }
289 2 }
290
291 2 return boost::none;
292 8 }
293
294 3 boost::optional<ZoneHVACComponent> CoilHeatingElectric_Impl::containingZoneHVACComponent() const {
295 // ZoneHVACPackagedTerminalHeatPump
296
297 3 std::vector<ZoneHVACPackagedTerminalHeatPump> zoneHVACPackagedTerminalHeatPumps;
298
299
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 zoneHVACPackagedTerminalHeatPumps = this->model().getConcreteModelObjects<ZoneHVACPackagedTerminalHeatPump>();
300
301
1/2
✗ Branch 5 not taken.
✓ Branch 6 taken 3 times.
3 for (const auto& zoneHVACPackagedTerminalHeatPump : zoneHVACPackagedTerminalHeatPumps) {
302 ✗ if (boost::optional<HVACComponent> coil = zoneHVACPackagedTerminalHeatPump.supplementalHeatingCoil()) {
303 ✗ if (coil->handle() == this->handle()) {
304 ✗ return zoneHVACPackagedTerminalHeatPump;
305 }
306 ✗ }
307 }
308
309 // ZoneHVACWaterToAirHeatPump
310 3 std::vector<ZoneHVACWaterToAirHeatPump> zoneHVACWaterToAirHeatPumps;
311
312
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 zoneHVACWaterToAirHeatPumps = this->model().getConcreteModelObjects<ZoneHVACWaterToAirHeatPump>();
313
314
2/2
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 2 times.
3 for (const auto& zoneHVACWaterToAirHeatPump : zoneHVACWaterToAirHeatPumps) {
315
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✗ Branch 9 not taken.
2 if (boost::optional<HVACComponent> coil = zoneHVACWaterToAirHeatPump.supplementalHeatingCoil()) {
316
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 (coil->handle() == this->handle()) {
317
1/1
✓ Branch 1 taken 1 time.
1 return zoneHVACWaterToAirHeatPump;
318 }
319 1 }
320 }
321
322 2 return boost::none;
323 3 }
324
325 ✗ boost::optional<ModelObject> CoilHeatingElectric_Impl::availabilityScheduleAsModelObject() const {
326 ✗ OptionalModelObject result = availabilitySchedule();
327 ✗ return result;
328 }
329
330 ✗ bool CoilHeatingElectric_Impl::setAvailabilityScheduleAsModelObject(const boost::optional<ModelObject>& modelObject) {
331 ✗ if (modelObject) {
332 ✗ OptionalSchedule intermediate = modelObject->optionalCast<Schedule>();
333 ✗ if (intermediate) {
334 ✗ Schedule schedule(*intermediate);
335 ✗ return setAvailabilitySchedule(schedule);
336 ✗ }
337 ✗ }
338 ✗ return false;
339 }
340
341 ✗ AirflowNetworkEquivalentDuct CoilHeatingElectric_Impl::getAirflowNetworkEquivalentDuct(double length, double diameter) {
342 ✗ boost::optional<AirflowNetworkEquivalentDuct> opt = airflowNetworkEquivalentDuct();
343 ✗ if (opt) {
344 ✗ if (opt->airPathLength() != length) {
345 ✗ opt->setAirPathLength(length);
346 }
347 ✗ if (opt->airPathHydraulicDiameter() != diameter) {
348 ✗ opt->setAirPathHydraulicDiameter(diameter);
349 }
350 }
351 ✗ return AirflowNetworkEquivalentDuct(model(), length, diameter, handle());
352 ✗ }
353
354 ✗ boost::optional<AirflowNetworkEquivalentDuct> CoilHeatingElectric_Impl::airflowNetworkEquivalentDuct() const {
355 std::vector<AirflowNetworkEquivalentDuct> myAFN =
356 ✗ getObject<ModelObject>().getModelObjectSources<AirflowNetworkEquivalentDuct>(AirflowNetworkEquivalentDuct::iddObjectType());
357 ✗ auto count = myAFN.size();
358 ✗ if (count == 1) {
359 ✗ return myAFN[0];
360 ✗ } else if (count > 1) {
361 ✗ LOG(Warn, briefDescription() << " has more than one AirflowNetwork EquivalentDuct attached, returning first.");
362 ✗ return myAFN[0];
363 }
364 ✗ return boost::none;
365 ✗ }
366
367 ✗ boost::optional<double> CoilHeatingElectric_Impl::autosizedNominalCapacity() const {
368 ✗ return getAutosizedValue("Design Size Nominal Capacity", "W");
369 }
370
371 ✗ void CoilHeatingElectric_Impl::autosize() {
372 ✗ autosizeNominalCapacity();
373 ✗ }
374
375 ✗ void CoilHeatingElectric_Impl::applySizingValues() {
376 ✗ boost::optional<double> val;
377 ✗ val = autosizedNominalCapacity();
378 ✗ if (val) {
379 ✗ setNominalCapacity(val.get());
380 }
381 ✗ }
382
383 2 ComponentType CoilHeatingElectric_Impl::componentType() const {
384
1/1
✓ Branch 1 taken 2 times.
2 return ComponentType::Heating;
385 }
386
387 2 std::vector<FuelType> CoilHeatingElectric_Impl::coolingFuelTypes() const {
388 2 return {};
389 }
390
391 2 std::vector<FuelType> CoilHeatingElectric_Impl::heatingFuelTypes() const {
392
1/1
✓ Branch 1 taken 2 times.
6 return {FuelType::Electricity};
393 }
394
395 2 std::vector<AppGFuelType> CoilHeatingElectric_Impl::appGHeatingFuelTypes() const {
396
1/1
✓ Branch 1 taken 2 times.
6 return {AppGFuelType::Electric};
397 }
398
399 } // namespace detail
400
401 84 CoilHeatingElectric::CoilHeatingElectric(const Model& model, Schedule& schedule) : StraightComponent(CoilHeatingElectric::iddObjectType(), model) {
402
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 84 times.
✗ Branch 5 not taken.
84 OS_ASSERT(getImpl<detail::CoilHeatingElectric_Impl>());
403
404
1/1
✓ Branch 1 taken 84 times.
84 setAvailabilitySchedule(schedule);
405 84 }
406
407 64 CoilHeatingElectric::CoilHeatingElectric(const Model& model) : StraightComponent(CoilHeatingElectric::iddObjectType(), model) {
408
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 64 times.
✗ Branch 5 not taken.
64 OS_ASSERT(getImpl<detail::CoilHeatingElectric_Impl>());
409
410
1/1
✓ Branch 1 taken 64 times.
64 auto schedule = model.alwaysOnDiscreteSchedule();
411
1/1
✓ Branch 1 taken 64 times.
64 setAvailabilitySchedule(schedule);
412 64 }
413
414 8149 IddObjectType CoilHeatingElectric::iddObjectType() {
415
1/1
✓ Branch 1 taken 8149 times.
8149 IddObjectType result(IddObjectType::OS_Coil_Heating_Electric);
416 8149 return result;
417 }
418
419 36 double CoilHeatingElectric::efficiency() const {
420
1/1
✓ Branch 3 taken 36 times.
36 return getImpl<detail::CoilHeatingElectric_Impl>()->efficiency();
421 }
422
423 ✗ bool CoilHeatingElectric::isEfficiencyDefaulted() const {
424 ✗ return getImpl<detail::CoilHeatingElectric_Impl>()->isEfficiencyDefaulted();
425 }
426
427 ✗ boost::optional<double> CoilHeatingElectric::nominalCapacity() const {
428 ✗ return getImpl<detail::CoilHeatingElectric_Impl>()->nominalCapacity();
429 }
430
431 ✗ bool CoilHeatingElectric::isNominalCapacityDefaulted() const {
432 ✗ return getImpl<detail::CoilHeatingElectric_Impl>()->isNominalCapacityDefaulted();
433 }
434
435 36 bool CoilHeatingElectric::isNominalCapacityAutosized() const {
436
1/1
✓ Branch 3 taken 36 times.
36 return getImpl<detail::CoilHeatingElectric_Impl>()->isNominalCapacityAutosized();
437 }
438
439 36 boost::optional<Node> CoilHeatingElectric::temperatureSetpointNode() const {
440
1/1
✓ Branch 3 taken 36 times.
36 return getImpl<detail::CoilHeatingElectric_Impl>()->temperatureSetpointNode();
441 }
442
443 ✗ bool CoilHeatingElectric::setEfficiency(double efficiency) {
444 ✗ return getImpl<detail::CoilHeatingElectric_Impl>()->setEfficiency(efficiency);
445 }
446
447 ✗ void CoilHeatingElectric::resetEfficiency() {
448 ✗ getImpl<detail::CoilHeatingElectric_Impl>()->resetEfficiency();
449 ✗ }
450
451 ✗ bool CoilHeatingElectric::setNominalCapacity(double nominalCapacity) {
452 ✗ return getImpl<detail::CoilHeatingElectric_Impl>()->setNominalCapacity(nominalCapacity);
453 }
454
455 ✗ void CoilHeatingElectric::resetNominalCapacity() {
456 ✗ getImpl<detail::CoilHeatingElectric_Impl>()->resetNominalCapacity();
457 ✗ }
458
459 ✗ void CoilHeatingElectric::autosizeNominalCapacity() {
460 ✗ getImpl<detail::CoilHeatingElectric_Impl>()->autosizeNominalCapacity();
461 ✗ }
462
463 ✗ bool CoilHeatingElectric::setTemperatureSetpointNode(Node& temperatureSetpointNode) {
464 ✗ return getImpl<detail::CoilHeatingElectric_Impl>()->setTemperatureSetpointNode(temperatureSetpointNode);
465 }
466
467 ✗ void CoilHeatingElectric::resetTemperatureSetpointNode() {
468 ✗ getImpl<detail::CoilHeatingElectric_Impl>()->resetTemperatureSetpointNode();
469 ✗ }
470
471 36 Schedule CoilHeatingElectric::availabilitySchedule() const {
472
1/1
✓ Branch 3 taken 36 times.
36 return getImpl<detail::CoilHeatingElectric_Impl>()->availabilitySchedule();
473 }
474
475 148 bool CoilHeatingElectric::setAvailabilitySchedule(Schedule& schedule) {
476
1/1
✓ Branch 3 taken 148 times.
148 return getImpl<detail::CoilHeatingElectric_Impl>()->setAvailabilitySchedule(schedule);
477 }
478
479 ✗ AirflowNetworkEquivalentDuct CoilHeatingElectric::getAirflowNetworkEquivalentDuct(double length, double diameter) {
480 ✗ return getImpl<detail::CoilHeatingElectric_Impl>()->getAirflowNetworkEquivalentDuct(length, diameter);
481 }
482
483 ✗ boost::optional<AirflowNetworkEquivalentDuct> CoilHeatingElectric::airflowNetworkEquivalentDuct() const {
484 ✗ return getImpl<detail::CoilHeatingElectric_Impl>()->airflowNetworkEquivalentDuct();
485 }
486
487 /// @cond
488
1/1
✓ Branch 3 taken 103 times.
103 CoilHeatingElectric::CoilHeatingElectric(std::shared_ptr<detail::CoilHeatingElectric_Impl> impl) : StraightComponent(std::move(impl)) {}
489 /// @endcond
490
491 ✗ boost::optional<double> CoilHeatingElectric::autosizedNominalCapacity() const {
492 ✗ return getImpl<detail::CoilHeatingElectric_Impl>()->autosizedNominalCapacity();
493 }
494
495 } // namespace model
496
497 } // namespace openstudio
498