GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 62.2% 117 / 0 / 188
Functions: 66.7% 30 / 0 / 45
Branches: 39.3% 88 / 0 / 224

src/model/ZoneHVACCoolingPanelRadiantConvectiveWater.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 "ZoneHVACCoolingPanelRadiantConvectiveWater.hpp"
7 #include "ZoneHVACCoolingPanelRadiantConvectiveWater_Impl.hpp"
8
9 #include "Schedule.hpp"
10 #include "Schedule_Impl.hpp"
11 #include "Surface.hpp"
12 #include "Surface_Impl.hpp"
13 #include "ThermalZone.hpp"
14 #include "ThermalZone_Impl.hpp"
15 #include "HVACComponent.hpp"
16 #include "HVACComponent_Impl.hpp"
17 #include "CoilCoolingWaterPanelRadiant.hpp"
18 #include "CoilCoolingWaterPanelRadiant_Impl.hpp"
19 #include "Model.hpp"
20 #include "Space.hpp"
21 #include "ScheduleTypeLimits.hpp"
22 #include "ScheduleTypeRegistry.hpp"
23
24 #include <utilities/idd/IddFactory.hxx>
25 #include <utilities/idd/OS_ZoneHVAC_CoolingPanel_RadiantConvective_Water_FieldEnums.hxx>
26
27 #include "../utilities/core/Assert.hpp"
28 #include "../utilities/data/DataEnums.hpp"
29
30 namespace openstudio {
31 namespace model {
32
33 namespace detail {
34
35 4 ZoneHVACCoolingPanelRadiantConvectiveWater_Impl::ZoneHVACCoolingPanelRadiantConvectiveWater_Impl(const IdfObject& idfObject, Model_Impl* model,
36 4 bool keepHandle)
37 4 : ZoneHVACComponent_Impl(idfObject, model, keepHandle) {
38
4/6
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 4 times.
✗ Branch 13 not taken.
4 OS_ASSERT(idfObject.iddObject().type() == ZoneHVACCoolingPanelRadiantConvectiveWater::iddObjectType());
39 4 }
40
41 ✗ ZoneHVACCoolingPanelRadiantConvectiveWater_Impl::ZoneHVACCoolingPanelRadiantConvectiveWater_Impl(
42 ✗ const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle)
43 ✗ : ZoneHVACComponent_Impl(other, model, keepHandle) {
44 ✗ OS_ASSERT(other.iddObject().type() == ZoneHVACCoolingPanelRadiantConvectiveWater::iddObjectType());
45 ✗ }
46
47 ✗ ZoneHVACCoolingPanelRadiantConvectiveWater_Impl::ZoneHVACCoolingPanelRadiantConvectiveWater_Impl(
48 ✗ const ZoneHVACCoolingPanelRadiantConvectiveWater_Impl& other, Model_Impl* model, bool keepHandle)
49 ✗ : ZoneHVACComponent_Impl(other, model, keepHandle) {}
50
51 ✗ const std::vector<std::string>& ZoneHVACCoolingPanelRadiantConvectiveWater_Impl::outputVariableNames() const {
52 static const std::vector<std::string> result{"Cooling Panel Total Cooling Rate", "Cooling Panel Total System Cooling Rate",
53 "Cooling Panel Convective Cooling Rate", "Cooling Panel Radiant Cooling Rate",
54 "Cooling Panel Total Cooling Energy", "Cooling Panel Total System Cooling Energy",
55 ✗ "Cooling Panel Convective Cooling Energy", "Cooling Panel Radiant Cooling Energy"};
56 ✗ return result;
57 ✗ }
58
59 ✗ IddObjectType ZoneHVACCoolingPanelRadiantConvectiveWater_Impl::iddObjectType() const {
60 ✗ return ZoneHVACCoolingPanelRadiantConvectiveWater::iddObjectType();
61 }
62
63 ✗ std::vector<ScheduleTypeKey> ZoneHVACCoolingPanelRadiantConvectiveWater_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_ZoneHVAC_CoolingPanel_RadiantConvective_WaterFields::AvailabilityScheduleName) != e) {
69 ✗ result.push_back(ScheduleTypeKey("ZoneHVACCoolingPanelRadiantConvectiveWater", "Availability"));
70 }
71 ✗ return result;
72 ✗ }
73
74 2 unsigned ZoneHVACCoolingPanelRadiantConvectiveWater_Impl::inletPort() const {
75 2 return 0; // this object has no inlet or outlet node
76 }
77
78 ✗ unsigned ZoneHVACCoolingPanelRadiantConvectiveWater_Impl::outletPort() const {
79 ✗ return 0; // this object has no inlet or outlet node
80 }
81
82 6 boost::optional<ThermalZone> ZoneHVACCoolingPanelRadiantConvectiveWater_Impl::thermalZone() const {
83
1/1
✓ Branch 1 taken 6 times.
6 auto thisObject = this->getObject<ModelObject>();
84
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 auto const thermalZones = this->model().getConcreteModelObjects<ThermalZone>();
85
2/2
✓ Branch 5 taken 6 times.
✓ Branch 6 taken 2 times.
8 for (auto const& thermalZone : thermalZones) {
86
1/1
✓ Branch 1 taken 6 times.
6 std::vector<ModelObject> equipment = thermalZone.equipment();
87
88
3/3
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 4 times.
✓ Branch 8 taken 2 times.
6 if (std::find(equipment.begin(), equipment.end(), thisObject) != equipment.end()) {
89
1/1
✓ Branch 1 taken 4 times.
4 return thermalZone;
90 }
91 6 }
92 2 return boost::none;
93 6 }
94
95 2 bool ZoneHVACCoolingPanelRadiantConvectiveWater_Impl::addToThermalZone(ThermalZone& thermalZone) {
96
1/1
✓ Branch 1 taken 2 times.
2 Model m = this->model();
97
98
7/13
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 2 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 2 times.
✓ Branch 13 taken 2 times.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 2 times.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
2 if (thermalZone.model() != m || thermalZone.isPlenum()) {
99 ✗ return false;
100 }
101
102
1/1
✓ Branch 1 taken 2 times.
2 removeFromThermalZone();
103
104
1/1
✓ Branch 1 taken 2 times.
2 thermalZone.setUseIdealAirLoads(false);
105
106
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 thermalZone.addEquipment(this->getObject<ZoneHVACComponent>());
107
108 2 return true;
109 2 }
110
111 4 void ZoneHVACCoolingPanelRadiantConvectiveWater_Impl::removeFromThermalZone() {
112
3/3
✓ Branch 1 taken 4 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
8 if (auto thermalZone = this->thermalZone()) {
113
3/3
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
2 thermalZone->removeEquipment(this->getObject<ZoneHVACComponent>());
114 4 }
115 4 }
116
117 ✗ std::vector<Surface> ZoneHVACCoolingPanelRadiantConvectiveWater_Impl::surfaces() const {
118
119 //vector to hold all of the surfaces that this radiant system is attached to
120 ✗ std::vector<Surface> surfaces;
121
122 //get the thermal zone this equipment belongs to
123 ✗ if (auto const thermalZone = this->thermalZone()) {
124
125 //loop through all the spaces in this zone
126 ✗ for (auto const& space : thermalZone->spaces()) {
127
128 //loop through all the surfaces in this space
129 ✗ for (auto const& surface : space.surfaces()) {
130 ✗ surfaces.push_back(surface);
131 ✗ }
132 ✗ }
133 ✗ }
134
135 ✗ return surfaces;
136 ✗ }
137
138 1 std::vector<ModelObject> ZoneHVACCoolingPanelRadiantConvectiveWater_Impl::children() const {
139 1 std::vector<ModelObject> result;
140
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (OptionalHVACComponent intermediate = optionalCoolingCoil()) {
141
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 result.push_back(*intermediate);
142 1 }
143 1 return result;
144 ✗ }
145
146 ✗ ModelObject ZoneHVACCoolingPanelRadiantConvectiveWater_Impl::clone(Model model) const {
147 ✗ auto panelRadConvWaterClone = ZoneHVACComponent_Impl::clone(model).cast<ZoneHVACCoolingPanelRadiantConvectiveWater>();
148
149 ✗ auto t_coolingCoil = coolingCoil();
150 ✗ auto coolingCoilClone = t_coolingCoil.clone(model).cast<HVACComponent>();
151
152 ✗ panelRadConvWaterClone.setCoolingCoil(coolingCoilClone);
153
154 ✗ if (model == this->model()) {
155 ✗ if (auto plant = t_coolingCoil.plantLoop()) {
156 ✗ plant->addDemandBranchForComponent(coolingCoilClone);
157 ✗ }
158 }
159
160 ✗ return std::move(panelRadConvWaterClone);
161 ✗ }
162
163 1 std::vector<IdfObject> ZoneHVACCoolingPanelRadiantConvectiveWater_Impl::remove() {
164
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✗ Branch 9 not taken.
2 if (auto waterCoolingCoil = coolingCoil().optionalCast<CoilCoolingWaterPanelRadiant>()) {
165
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 time.
2 if (boost::optional<PlantLoop> plantLoop = waterCoolingCoil->plantLoop()) {
166 ✗ plantLoop->removeDemandBranchWithComponent(waterCoolingCoil.get());
167 1 }
168 1 }
169 1 return ZoneHVACComponent_Impl::remove();
170 }
171
172 2 Schedule ZoneHVACCoolingPanelRadiantConvectiveWater_Impl::availabilitySchedule() const {
173
1/1
✓ Branch 1 taken 2 times.
2 boost::optional<Schedule> value = optionalAvailabilitySchedule();
174
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
2 if (!value) {
175 ✗ LOG_AND_THROW(briefDescription() << " does not have an Availability Schedule attached.");
176 }
177
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
4 return value.get();
178 2 }
179
180 2 double ZoneHVACCoolingPanelRadiantConvectiveWater_Impl::fractionRadiant() const {
181
1/1
✓ Branch 1 taken 2 times.
2 boost::optional<double> value = getDouble(OS_ZoneHVAC_CoolingPanel_RadiantConvective_WaterFields::FractionRadiant, true);
182
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 4 not taken.
2 OS_ASSERT(value);
183
1/1
✓ Branch 1 taken 2 times.
4 return value.get();
184 }
185
186 2 double ZoneHVACCoolingPanelRadiantConvectiveWater_Impl::fractionofRadiantEnergyIncidentonPeople() const {
187 boost::optional<double> value =
188
1/1
✓ Branch 1 taken 2 times.
2 getDouble(OS_ZoneHVAC_CoolingPanel_RadiantConvective_WaterFields::FractionofRadiantEnergyIncidentonPeople, true);
189
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 4 not taken.
2 OS_ASSERT(value);
190
1/1
✓ Branch 1 taken 2 times.
4 return value.get();
191 }
192
193 3 HVACComponent ZoneHVACCoolingPanelRadiantConvectiveWater_Impl::coolingCoil() const {
194
1/1
✓ Branch 1 taken 3 times.
3 boost::optional<HVACComponent> value = optionalCoolingCoil();
195
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
3 if (!value) {
196 ✗ LOG_AND_THROW(briefDescription() << " does not have an Cooling Coil attached.");
197 }
198
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
6 return value.get();
199 3 }
200
201 5 bool ZoneHVACCoolingPanelRadiantConvectiveWater_Impl::setAvailabilitySchedule(Schedule& schedule) {
202
3/3
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
20 bool result = setSchedule(OS_ZoneHVAC_CoolingPanel_RadiantConvective_WaterFields::AvailabilityScheduleName,
203 "ZoneHVACCoolingPanelRadiantConvectiveWater", "Availability", schedule);
204 5 return result;
205 }
206
207 5 bool ZoneHVACCoolingPanelRadiantConvectiveWater_Impl::setFractionRadiant(double fractionRadiant) {
208 5 bool result = setDouble(OS_ZoneHVAC_CoolingPanel_RadiantConvective_WaterFields::FractionRadiant, fractionRadiant);
209 5 return result;
210 }
211
212 5 bool ZoneHVACCoolingPanelRadiantConvectiveWater_Impl::setFractionofRadiantEnergyIncidentonPeople(double fractionofRadiantEnergyIncidentonPeople) {
213 5 bool result = setDouble(OS_ZoneHVAC_CoolingPanel_RadiantConvective_WaterFields::FractionofRadiantEnergyIncidentonPeople,
214 fractionofRadiantEnergyIncidentonPeople);
215 5 return result;
216 }
217
218 5 bool ZoneHVACCoolingPanelRadiantConvectiveWater_Impl::setCoolingCoil(const HVACComponent& radPanelCoolingCoil) {
219
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 bool result = setPointer(OS_ZoneHVAC_CoolingPanel_RadiantConvective_WaterFields::CoolingCoilName, radPanelCoolingCoil.handle());
220 5 return result;
221 }
222
223 2 boost::optional<Schedule> ZoneHVACCoolingPanelRadiantConvectiveWater_Impl::optionalAvailabilitySchedule() const {
224
1/1
✓ Branch 1 taken 2 times.
4 return getObject<ModelObject>().getModelObjectTarget<Schedule>(
225
1/1
✓ Branch 1 taken 2 times.
4 OS_ZoneHVAC_CoolingPanel_RadiantConvective_WaterFields::AvailabilityScheduleName);
226 }
227
228 4 boost::optional<HVACComponent> ZoneHVACCoolingPanelRadiantConvectiveWater_Impl::optionalCoolingCoil() const {
229
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 return getObject<ModelObject>().getModelObjectTarget<HVACComponent>(OS_ZoneHVAC_CoolingPanel_RadiantConvective_WaterFields::CoolingCoilName);
230 }
231
232 ✗ std::vector<EMSActuatorNames> ZoneHVACCoolingPanelRadiantConvectiveWater_Impl::emsActuatorNames() const {
233 ✗ std::vector<EMSActuatorNames> actuators{{"ZoneCoolingPanel:OutdoorTemperatureControlled", "Power Level"}};
234 ✗ return actuators;
235 ✗ }
236
237 ✗ std::vector<std::string> ZoneHVACCoolingPanelRadiantConvectiveWater_Impl::emsInternalVariableNames() const {
238 ✗ std::vector<std::string> types{"Simple Zone CoolingPanel Capacity At Low Temperature", "Simple Zone CoolingPanel Capacity At High Temperature"};
239 ✗ return types;
240 ✗ }
241
242 ✗ ComponentType ZoneHVACCoolingPanelRadiantConvectiveWater_Impl::componentType() const {
243 ✗ return ComponentType::Cooling;
244 }
245
246 ✗ std::vector<FuelType> ZoneHVACCoolingPanelRadiantConvectiveWater_Impl::coolingFuelTypes() const {
247 ✗ return coolingCoil().coolingFuelTypes();
248 }
249
250 ✗ std::vector<FuelType> ZoneHVACCoolingPanelRadiantConvectiveWater_Impl::heatingFuelTypes() const {
251 ✗ return {};
252 }
253
254 ✗ std::vector<AppGFuelType> ZoneHVACCoolingPanelRadiantConvectiveWater_Impl::appGHeatingFuelTypes() const {
255 ✗ return {};
256 }
257
258 } // namespace detail
259
260 4 ZoneHVACCoolingPanelRadiantConvectiveWater::ZoneHVACCoolingPanelRadiantConvectiveWater(const Model& model)
261 4 : ZoneHVACComponent(ZoneHVACCoolingPanelRadiantConvectiveWater::iddObjectType(), model) {
262
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✗ Branch 5 not taken.
4 OS_ASSERT(getImpl<detail::ZoneHVACCoolingPanelRadiantConvectiveWater_Impl>());
263
264 4 bool ok = true;
265
1/1
✓ Branch 1 taken 4 times.
4 auto alwaysOn = model.alwaysOnDiscreteSchedule();
266
1/1
✓ Branch 1 taken 4 times.
4 ok = setAvailabilitySchedule(alwaysOn);
267
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✗ Branch 3 not taken.
4 OS_ASSERT(ok);
268
1/1
✓ Branch 1 taken 4 times.
4 ok = setFractionRadiant(0.65);
269
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✗ Branch 3 not taken.
4 OS_ASSERT(ok);
270
1/1
✓ Branch 1 taken 4 times.
4 ok = setFractionofRadiantEnergyIncidentonPeople(0.2);
271
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✗ Branch 3 not taken.
4 OS_ASSERT(ok);
272
1/1
✓ Branch 1 taken 4 times.
4 CoilCoolingWaterPanelRadiant coil(model);
273
1/1
✓ Branch 1 taken 4 times.
4 ok = setCoolingCoil(coil);
274
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✗ Branch 3 not taken.
4 OS_ASSERT(ok);
275 4 }
276
277 7736 IddObjectType ZoneHVACCoolingPanelRadiantConvectiveWater::iddObjectType() {
278
1/1
✓ Branch 1 taken 7736 times.
7736 return {IddObjectType::OS_ZoneHVAC_CoolingPanel_RadiantConvective_Water};
279 }
280
281 2 Schedule ZoneHVACCoolingPanelRadiantConvectiveWater::availabilitySchedule() const {
282
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::ZoneHVACCoolingPanelRadiantConvectiveWater_Impl>()->availabilitySchedule();
283 }
284
285 2 double ZoneHVACCoolingPanelRadiantConvectiveWater::fractionRadiant() const {
286
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::ZoneHVACCoolingPanelRadiantConvectiveWater_Impl>()->fractionRadiant();
287 }
288
289 2 double ZoneHVACCoolingPanelRadiantConvectiveWater::fractionofRadiantEnergyIncidentonPeople() const {
290
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::ZoneHVACCoolingPanelRadiantConvectiveWater_Impl>()->fractionofRadiantEnergyIncidentonPeople();
291 }
292
293 2 HVACComponent ZoneHVACCoolingPanelRadiantConvectiveWater::coolingCoil() const {
294
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::ZoneHVACCoolingPanelRadiantConvectiveWater_Impl>()->coolingCoil();
295 }
296
297 5 bool ZoneHVACCoolingPanelRadiantConvectiveWater::setAvailabilitySchedule(Schedule& schedule) {
298
1/1
✓ Branch 3 taken 5 times.
5 return getImpl<detail::ZoneHVACCoolingPanelRadiantConvectiveWater_Impl>()->setAvailabilitySchedule(schedule);
299 }
300
301 5 bool ZoneHVACCoolingPanelRadiantConvectiveWater::setFractionRadiant(double fractionRadiant) {
302
1/1
✓ Branch 3 taken 5 times.
5 return getImpl<detail::ZoneHVACCoolingPanelRadiantConvectiveWater_Impl>()->setFractionRadiant(fractionRadiant);
303 }
304
305 5 bool ZoneHVACCoolingPanelRadiantConvectiveWater::setFractionofRadiantEnergyIncidentonPeople(double fractionofRadiantEnergyIncidentonPeople) {
306
1/1
✓ Branch 3 taken 5 times.
10 return getImpl<detail::ZoneHVACCoolingPanelRadiantConvectiveWater_Impl>()->setFractionofRadiantEnergyIncidentonPeople(
307 10 fractionofRadiantEnergyIncidentonPeople);
308 }
309
310 5 bool ZoneHVACCoolingPanelRadiantConvectiveWater::setCoolingCoil(const HVACComponent& radPanelCoolingCoil) {
311
1/1
✓ Branch 3 taken 5 times.
5 return getImpl<detail::ZoneHVACCoolingPanelRadiantConvectiveWater_Impl>()->setCoolingCoil(radPanelCoolingCoil);
312 }
313
314 2 boost::optional<ThermalZone> ZoneHVACCoolingPanelRadiantConvectiveWater::thermalZone() const {
315
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::ZoneHVACCoolingPanelRadiantConvectiveWater_Impl>()->thermalZone();
316 }
317
318 2 bool ZoneHVACCoolingPanelRadiantConvectiveWater::addToThermalZone(ThermalZone& thermalZone) {
319
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::ZoneHVACCoolingPanelRadiantConvectiveWater_Impl>()->addToThermalZone(thermalZone);
320 }
321
322 1 void ZoneHVACCoolingPanelRadiantConvectiveWater::removeFromThermalZone() {
323
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::ZoneHVACCoolingPanelRadiantConvectiveWater_Impl>()->removeFromThermalZone();
324 }
325
326 /// @cond
327 ✗ ZoneHVACCoolingPanelRadiantConvectiveWater::ZoneHVACCoolingPanelRadiantConvectiveWater(
328 ✗ std::shared_ptr<detail::ZoneHVACCoolingPanelRadiantConvectiveWater_Impl> impl)
329 ✗ : ZoneHVACComponent(std::move(impl)) {}
330 /// @endcond
331
332 } // namespace model
333 } // namespace openstudio
334