GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 95.9% 71 / 0 / 74
Functions: 100.0% 1 / 0 / 1
Branches: 85.5% 130 / 0 / 152

src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACBaseboardRadiantConvectiveWater.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 "../ForwardTranslator.hpp"
7 #include "../../model/Model.hpp"
8 #include "../../model/Schedule.hpp"
9 #include "../../model/Schedule_Impl.hpp"
10 #include "../../model/ModelObject.hpp"
11 #include "../../model/ModelObject_Impl.hpp"
12 #include "../../model/ThermalZone.hpp"
13 #include "../../model/ThermalZone_Impl.hpp"
14 #include "../../model/Surface.hpp"
15 #include "../../model/Surface_Impl.hpp"
16 #include "../../model/Space.hpp"
17 #include "../../model/Space_Impl.hpp"
18 #include "../../model/ZoneHVACBaseboardRadiantConvectiveWater.hpp"
19 #include "../../model/ZoneHVACBaseboardRadiantConvectiveWater_Impl.hpp"
20 #include "../../model/ZoneHVACEquipmentList.hpp"
21 #include "../../model/ZoneHVACEquipmentList_Impl.hpp"
22 #include "../../model/ZoneHVACComponent.hpp"
23 #include "../../model/ZoneHVACComponent_Impl.hpp"
24 #include "../../model/CoilHeatingWaterBaseboardRadiant.hpp"
25 #include "../../model/CoilHeatingWaterBaseboardRadiant_Impl.hpp"
26 #include "../../utilities/idf/IdfExtensibleGroup.hpp"
27 #include <utilities/idd/ZoneHVAC_Baseboard_RadiantConvective_Water_FieldEnums.hxx>
28 #include <utilities/idd/ZoneHVAC_Baseboard_RadiantConvective_Water_Design_FieldEnums.hxx>
29
30 #include <utilities/idd/IddEnums.hxx>
31 #include "../../utilities/idd/IddEnums.hpp"
32 #include <utilities/idd/IddFactory.hxx>
33
34 using namespace openstudio::model;
35
36 namespace openstudio {
37
38 namespace energyplus {
39
40 boost::optional<IdfObject>
41 1 ForwardTranslator::translateZoneHVACBaseboardRadiantConvectiveWater(ZoneHVACBaseboardRadiantConvectiveWater& modelObject) {
42 1 boost::optional<std::string> s;
43 1 boost::optional<double> value;
44 1 boost::optional<ModelObject> temp;
45
46 // Name
47
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::ZoneHVAC_Baseboard_RadiantConvective_Water, modelObject);
48
49 // E+ 9.5.0: This object got broken into two: a zonehvac object, and a design object
50
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 IdfObject designObject(openstudio::IddObjectType::ZoneHVAC_Baseboard_RadiantConvective_Water_Design);
51
1/1
✓ Branch 1 taken 1 time.
1 m_idfObjects.push_back(designObject);
52
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 designObject.setName(idfObject.nameString() + " Design");
53
54
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setString(ZoneHVAC_Baseboard_RadiantConvective_WaterFields::DesignObject, designObject.nameString());
55
56 // AvailabilityScheduleName
57 {
58
1/1
✓ Branch 1 taken 1 time.
1 auto schedule = modelObject.availabilitySchedule();
59
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (auto _schedule = translateAndMapModelObject(schedule)) {
60
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 idfObject.setString(ZoneHVAC_Baseboard_RadiantConvective_WaterFields::AvailabilityScheduleName, _schedule->name().get());
61 1 }
62 1 }
63
64
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✗ Branch 9 not taken.
2 if (auto heatingCoil = modelObject.heatingCoil().optionalCast<CoilHeatingWaterBaseboardRadiant>()) {
65
66 // InletNodeName
67
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (auto node = heatingCoil->inletModelObject()) {
68
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 idfObject.setString(ZoneHVAC_Baseboard_RadiantConvective_WaterFields::InletNodeName, node->name().get());
69 1 }
70
71 // OutletNodeName
72
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (auto node = heatingCoil->outletModelObject()) {
73
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 idfObject.setString(ZoneHVAC_Baseboard_RadiantConvective_WaterFields::OutletNodeName, node->name().get());
74 1 }
75
76 // RatedAverageWaterTemperature
77
4/5
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✗ Branch 11 not taken.
2 if ((value = heatingCoil->ratedAverageWaterTemperature())) {
78
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(ZoneHVAC_Baseboard_RadiantConvective_WaterFields::RatedAverageWaterTemperature, value.get());
79 }
80
81 // RatedWaterMassFlowRate
82
4/5
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✗ Branch 11 not taken.
2 if ((value = heatingCoil->ratedWaterMassFlowRate())) {
83
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(ZoneHVAC_Baseboard_RadiantConvective_WaterFields::RatedWaterMassFlowRate, value.get());
84 }
85
86 // HeatingDesignCapacity
87
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
1 if (heatingCoil->isHeatingDesignCapacityAutosized()) {
88
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 idfObject.setString(ZoneHVAC_Baseboard_RadiantConvective_WaterFields::HeatingDesignCapacity, "AutoSize");
89 ✗ } else if ((value = heatingCoil->heatingDesignCapacity())) {
90 ✗ idfObject.setDouble(ZoneHVAC_Baseboard_RadiantConvective_WaterFields::HeatingDesignCapacity, value.get());
91 }
92
93 // MaximumWaterFlowRate
94
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 time.
1 if (heatingCoil->isMaximumWaterFlowRateAutosized()) {
95 ✗ idfObject.setString(ZoneHVAC_Baseboard_RadiantConvective_WaterFields::MaximumWaterFlowRate, "AutoSize");
96
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 } else if ((value = heatingCoil->maximumWaterFlowRate())) {
97
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(ZoneHVAC_Baseboard_RadiantConvective_WaterFields::MaximumWaterFlowRate, value.get());
98 }
99
100 // Starting Here: all these fields are now on the Design object
101
102 // HeatingDesignCapacityMethod
103
4/5
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 11 taken 1 time.
✗ Branch 12 not taken.
2 if ((s = heatingCoil->heatingDesignCapacityMethod())) {
104
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 designObject.setString(ZoneHVAC_Baseboard_RadiantConvective_Water_DesignFields::HeatingDesignCapacityMethod, s.get());
105 }
106
107 // HeatingDesignCapacityPerFloorArea
108
4/5
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✗ Branch 11 not taken.
2 if ((value = heatingCoil->heatingDesignCapacityPerFloorArea())) {
109
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 designObject.setDouble(ZoneHVAC_Baseboard_RadiantConvective_Water_DesignFields::HeatingDesignCapacityPerFloorArea, value.get());
110 }
111
112 // FractionofAutosizedHeatingDesignCapacity
113
4/5
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✗ Branch 11 not taken.
2 if ((value = heatingCoil->fractionofAutosizedHeatingDesignCapacity())) {
114
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 designObject.setDouble(ZoneHVAC_Baseboard_RadiantConvective_Water_DesignFields::FractionofAutosizedHeatingDesignCapacity, value.get());
115 }
116
117 // ConvergenceTolerance
118
4/5
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✗ Branch 11 not taken.
2 if ((value = heatingCoil->convergenceTolerance())) {
119
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 designObject.setDouble(ZoneHVAC_Baseboard_RadiantConvective_Water_DesignFields::ConvergenceTolerance, value.get());
120 }
121 1 }
122
123 // FractionRadiant: On Design object
124
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 8 not taken.
2 if ((value = modelObject.fractionRadiant())) {
125
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 designObject.setDouble(ZoneHVAC_Baseboard_RadiantConvective_Water_DesignFields::FractionRadiant, value.get());
126 }
127
128 // FractionofRadiantEnergyIncidentonPeople: On Design object
129
1/1
✓ Branch 1 taken 1 time.
1 double fractionofRadiantEnergyIncidentonPeople = modelObject.fractionofRadiantEnergyIncidentonPeople();
130 {
131
1/1
✓ Branch 1 taken 1 time.
1 designObject.setDouble(ZoneHVAC_Baseboard_RadiantConvective_Water_DesignFields::FractionofRadiantEnergyIncidentonPeople,
132 fractionofRadiantEnergyIncidentonPeople);
133 }
134
135 //get rid of any existing surface (just to be safe)
136
1/1
✓ Branch 1 taken 1 time.
1 idfObject.clearExtensibleGroups();
137
138 //aggregator for total area; will be used to create weighted area
139 1 double totalAreaOfWallSurfaces = 0;
140 1 double totalAreaOfCeilingSurfaces = 0;
141 1 double totalAreaOfFloorSurfaces = 0;
142
143 //loop through all surfaces, adding up their area
144
1/1
✓ Branch 3 taken 1 time.
1 auto const& surfaces = modelObject.getImpl<model::detail::ZoneHVACBaseboardRadiantConvectiveWater_Impl>()->surfaces();
145
146
2/2
✓ Branch 5 taken 6 times.
✓ Branch 6 taken 1 time.
7 for (auto const& surface : surfaces) {
147
5/5
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 11 taken 1 time.
✓ Branch 12 taken 5 times.
12 if (istringEqual(surface.surfaceType(), "Floor")) {
148
1/1
✓ Branch 1 taken 1 time.
1 totalAreaOfFloorSurfaces += surface.grossArea();
149
5/5
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 11 taken 1 time.
✓ Branch 12 taken 4 times.
10 } else if (istringEqual(surface.surfaceType(), "RoofCeiling")) {
150
1/1
✓ Branch 1 taken 1 time.
1 totalAreaOfCeilingSurfaces += surface.grossArea();
151 } else {
152
1/1
✓ Branch 1 taken 4 times.
4 totalAreaOfWallSurfaces += surface.grossArea();
153 }
154 }
155
156 // Assume that 5% of what is not on people is on the floor
157 1 double fractionOnFloor = (1.0 - fractionofRadiantEnergyIncidentonPeople) * 0.05;
158 // Assume that 55% of what is not on people is on the walls
159 1 double fractionOnWall = (1.0 - fractionofRadiantEnergyIncidentonPeople) * 0.55;
160 // Assume that 40% of what is not on people is on the ceiling
161 1 double fractionOnCeiling = (1.0 - fractionofRadiantEnergyIncidentonPeople) * 0.40;
162 //loop through all the surfaces, adding them and their flow fractions (weighted per-area)
163
2/2
✓ Branch 5 taken 6 times.
✓ Branch 6 taken 1 time.
7 for (auto const& surface : surfaces) {
164
1/1
✓ Branch 1 taken 6 times.
6 IdfExtensibleGroup group = idfObject.pushExtensibleGroup();
165
3/3
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
6 group.setString(ZoneHVAC_Baseboard_RadiantConvective_WaterExtensibleFields::SurfaceName, surface.name().get());
166
5/5
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 11 taken 1 time.
✓ Branch 12 taken 5 times.
12 if (istringEqual(surface.surfaceType(), "Floor")) {
167 1 group.setDouble(ZoneHVAC_Baseboard_RadiantConvective_WaterExtensibleFields::FractionofRadiantEnergytoSurface,
168
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 (surface.grossArea() / totalAreaOfFloorSurfaces * fractionOnFloor));
169
5/5
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 11 taken 1 time.
✓ Branch 12 taken 4 times.
10 } else if (istringEqual(surface.surfaceType(), "RoofCeiling")) {
170 1 group.setDouble(ZoneHVAC_Baseboard_RadiantConvective_WaterExtensibleFields::FractionofRadiantEnergytoSurface,
171
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 (surface.grossArea() / totalAreaOfCeilingSurfaces * fractionOnCeiling));
172 } else {
173 4 group.setDouble(ZoneHVAC_Baseboard_RadiantConvective_WaterExtensibleFields::FractionofRadiantEnergytoSurface,
174
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 (surface.grossArea() / totalAreaOfWallSurfaces * fractionOnWall));
175 }
176 6 }
177
178
1/1
✓ Branch 1 taken 1 time.
2 return idfObject;
179 1 }
180
181 } // namespace energyplus
182
183 } // namespace openstudio
184