GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 57.6% 49 / 0 / 85
Functions: 59.3% 16 / 0 / 27
Branches: 38.9% 28 / 0 / 72

src/model/AirLoopHVACZoneMixer.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 "AirLoopHVACZoneMixer.hpp"
7 #include "AirLoopHVACZoneMixer_Impl.hpp"
8 #include "AirLoopHVAC.hpp"
9 #include "AirLoopHVAC_Impl.hpp"
10 #include "AirflowNetworkDistributionNode.hpp"
11 #include "AirflowNetworkDistributionNode_Impl.hpp"
12 #include "Node.hpp"
13 #include "Model.hpp"
14 #include "Model_Impl.hpp"
15 #include <utilities/idd/OS_AirLoopHVAC_ZoneMixer_FieldEnums.hxx>
16 #include <utilities/idd/IddEnums.hxx>
17 #include "../utilities/core/Compare.hpp"
18 #include "../utilities/core/Assert.hpp"
19 #include "../utilities/data/DataEnums.hpp"
20
21 namespace openstudio {
22 namespace model {
23
24 namespace detail {
25
26 758 AirLoopHVACZoneMixer_Impl::AirLoopHVACZoneMixer_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
27 758 : Mixer_Impl(idfObject, model, keepHandle) {
28
4/6
✓ Branch 1 taken 758 times.
✓ Branch 4 taken 758 times.
✓ Branch 7 taken 758 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 758 times.
✗ Branch 13 not taken.
758 OS_ASSERT(idfObject.iddObject().type() == AirLoopHVACZoneMixer::iddObjectType());
29 758 }
30
31 43 AirLoopHVACZoneMixer_Impl::AirLoopHVACZoneMixer_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle)
32 43 : Mixer_Impl(other, model, keepHandle) {
33
4/6
✓ Branch 1 taken 43 times.
✓ Branch 4 taken 43 times.
✓ Branch 7 taken 43 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 43 times.
✗ Branch 13 not taken.
43 OS_ASSERT(other.iddObject().type() == AirLoopHVACZoneMixer::iddObjectType());
34 43 }
35
36 263 AirLoopHVACZoneMixer_Impl::AirLoopHVACZoneMixer_Impl(const AirLoopHVACZoneMixer_Impl& other, Model_Impl* model, bool keepHandle)
37 263 : Mixer_Impl(other, model, keepHandle) {}
38
39 1 const std::vector<std::string>& AirLoopHVACZoneMixer_Impl::outputVariableNames() const {
40
2/4
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
1 static const std::vector<std::string> result;
41 // Not Appropriate: No variables available
42 1 return result;
43 }
44
45 2343 IddObjectType AirLoopHVACZoneMixer_Impl::iddObjectType() const {
46 2343 return AirLoopHVACZoneMixer::iddObjectType();
47 }
48
49 217 std::vector<ModelObject> AirLoopHVACZoneMixer_Impl::children() const {
50 217 std::vector<ModelObject> result;
51
52 std::vector<AirflowNetworkDistributionNode> myAFNItems =
53
3/3
✓ Branch 1 taken 217 times.
✓ Branch 4 taken 217 times.
✓ Branch 7 taken 217 times.
217 getObject<ModelObject>().getModelObjectSources<AirflowNetworkDistributionNode>(AirflowNetworkDistributionNode::iddObjectType());
54
1/1
✓ Branch 5 taken 217 times.
217 result.insert(result.end(), myAFNItems.begin(), myAFNItems.end());
55
56 434 return result;
57 217 }
58
59 17 std::vector<openstudio::IdfObject> AirLoopHVACZoneMixer_Impl::remove() {
60
2/3
✓ Branch 1 taken 17 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 17 times.
34 if (this->airLoopHVAC()) {
61 ✗ return {};
62 } else {
63 17 this->disconnect();
64
65 17 return HVACComponent_Impl::remove();
66 }
67 }
68
69 11664 unsigned AirLoopHVACZoneMixer_Impl::outletPort() const {
70 11664 return OS_AirLoopHVAC_ZoneMixerFields::OutletNodeName;
71 }
72
73 5397 unsigned AirLoopHVACZoneMixer_Impl::inletPort(unsigned branchIndex) const {
74 unsigned result;
75 5397 result = numNonextensibleFields();
76 5397 result = result + branchIndex;
77 5397 return result;
78 }
79
80 840 unsigned AirLoopHVACZoneMixer_Impl::nextInletPort() const {
81 840 return inletPort(this->nextBranchIndex());
82 }
83
84 ✗ bool AirLoopHVACZoneMixer_Impl::addToNode(Node& node) {
85 ✗ return HVACComponent_Impl::addToNode(node);
86 }
87
88 ✗ ModelObject AirLoopHVACZoneMixer_Impl::clone(Model model) const {
89 ✗ return HVACComponent_Impl::clone(model);
90 }
91
92 34 void AirLoopHVACZoneMixer_Impl::disconnect() {
93
1/1
✓ Branch 1 taken 34 times.
34 auto mo = this->getObject<ModelObject>();
94
4/4
✓ Branch 1 taken 34 times.
✓ Branch 4 taken 34 times.
✓ Branch 7 taken 34 times.
✓ Branch 10 taken 34 times.
34 model().disconnect(mo, outletPort());
95
2/3
✓ Branch 1 taken 34 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 34 times.
34 for (int i = 0; i < int(nextBranchIndex()); i++) {
96 ✗ model().disconnect(mo, inletPort(i));
97 }
98 34 }
99
100 ✗ AirflowNetworkDistributionNode AirLoopHVACZoneMixer_Impl::getAirflowNetworkDistributionNode() {
101 ✗ boost::optional<AirflowNetworkDistributionNode> opt = airflowNetworkDistributionNode();
102 ✗ if (opt) {
103 ✗ return opt.get();
104 }
105 ✗ return AirflowNetworkDistributionNode(model(), handle());
106 ✗ }
107
108 ✗ boost::optional<AirflowNetworkDistributionNode> AirLoopHVACZoneMixer_Impl::airflowNetworkDistributionNode() const {
109 std::vector<AirflowNetworkDistributionNode> myAFNItems =
110 ✗ getObject<ModelObject>().getModelObjectSources<AirflowNetworkDistributionNode>(AirflowNetworkDistributionNode::iddObjectType());
111 ✗ auto count = myAFNItems.size();
112 ✗ if (count == 1) {
113 ✗ return myAFNItems[0];
114 ✗ } else if (count > 1) {
115 ✗ LOG(Warn, briefDescription() << " has more than one AirflowNetwork DistributionNode attached, returning first.");
116 ✗ return myAFNItems[0];
117 }
118 ✗ return boost::none;
119 ✗ }
120
121 ✗ ComponentType AirLoopHVACZoneMixer_Impl::componentType() const {
122 ✗ return ComponentType::None;
123 }
124
125 ✗ std::vector<FuelType> AirLoopHVACZoneMixer_Impl::coolingFuelTypes() const {
126 ✗ return {};
127 }
128
129 ✗ std::vector<FuelType> AirLoopHVACZoneMixer_Impl::heatingFuelTypes() const {
130 ✗ return {};
131 }
132
133 ✗ std::vector<AppGFuelType> AirLoopHVACZoneMixer_Impl::appGHeatingFuelTypes() const {
134 ✗ return {};
135 }
136
137 } // namespace detail
138
139 // create a new AirLoopHVACZoneMixer object in the model's workspace
140 714 AirLoopHVACZoneMixer::AirLoopHVACZoneMixer(const Model& model) : Mixer(AirLoopHVACZoneMixer::iddObjectType(), model) {
141
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 714 times.
✗ Branch 5 not taken.
714 OS_ASSERT(getImpl<detail::AirLoopHVACZoneMixer_Impl>());
142 714 }
143
144
1/1
✓ Branch 3 taken 954 times.
954 AirLoopHVACZoneMixer::AirLoopHVACZoneMixer(std::shared_ptr<detail::AirLoopHVACZoneMixer_Impl> impl) : Mixer(std::move(impl)) {}
145
146 11598 IddObjectType AirLoopHVACZoneMixer::iddObjectType() {
147
1/1
✓ Branch 1 taken 11598 times.
11598 IddObjectType result(IddObjectType::OS_AirLoopHVAC_ZoneMixer);
148 11598 return result;
149 }
150
151 714 unsigned AirLoopHVACZoneMixer::outletPort() const {
152
1/1
✓ Branch 3 taken 714 times.
714 return getImpl<detail::AirLoopHVACZoneMixer_Impl>()->outletPort();
153 }
154
155 ✗ unsigned AirLoopHVACZoneMixer::inletPort(unsigned branchIndex) const {
156 ✗ return getImpl<detail::AirLoopHVACZoneMixer_Impl>()->inletPort(branchIndex);
157 }
158
159 824 unsigned AirLoopHVACZoneMixer::nextInletPort() const {
160
1/1
✓ Branch 3 taken 824 times.
824 return getImpl<detail::AirLoopHVACZoneMixer_Impl>()->nextInletPort();
161 }
162
163 ✗ AirflowNetworkDistributionNode AirLoopHVACZoneMixer::getAirflowNetworkDistributionNode() {
164 ✗ return getImpl<detail::AirLoopHVACZoneMixer_Impl>()->getAirflowNetworkDistributionNode();
165 }
166
167 ✗ boost::optional<AirflowNetworkDistributionNode> AirLoopHVACZoneMixer::airflowNetworkDistributionNode() const {
168 ✗ return getImpl<detail::AirLoopHVACZoneMixer_Impl>()->airflowNetworkDistributionNode();
169 }
170
171 } // namespace model
172 } // namespace openstudio
173