GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 0.0% 0 / 0 / 81
Functions: 0.0% 0 / 0 / 1
Branches: 0.0% 0 / 0 / 180

src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACCoolingPanelRadiantConvectiveWater.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/ZoneHVACCoolingPanelRadiantConvectiveWater.hpp"
19 #include "../../model/ZoneHVACCoolingPanelRadiantConvectiveWater_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/CoilCoolingWaterPanelRadiant.hpp"
25 #include "../../model/CoilCoolingWaterPanelRadiant_Impl.hpp"
26 #include "../../utilities/idf/IdfExtensibleGroup.hpp"
27 #include <utilities/idd/ZoneHVAC_CoolingPanel_RadiantConvective_Water_FieldEnums.hxx>
28 #include <utilities/idd/IddEnums.hxx>
29 #include "../../utilities/idd/IddEnums.hpp"
30 #include <utilities/idd/IddFactory.hxx>
31
32 using namespace openstudio::model;
33
34 namespace openstudio {
35
36 namespace energyplus {
37
38 boost::optional<IdfObject>
39 ✗ ForwardTranslator::translateZoneHVACCoolingPanelRadiantConvectiveWater(ZoneHVACCoolingPanelRadiantConvectiveWater& modelObject) {
40 ✗ boost::optional<std::string> s;
41 ✗ boost::optional<double> value;
42 ✗ boost::optional<ModelObject> temp;
43
44 // Name
45 ✗ IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::ZoneHVAC_CoolingPanel_RadiantConvective_Water, modelObject);
46
47 // AvailabilityScheduleName
48 {
49 ✗ auto schedule = modelObject.availabilitySchedule();
50 ✗ if (auto _schedule = translateAndMapModelObject(schedule)) {
51 ✗ idfObject.setString(ZoneHVAC_CoolingPanel_RadiantConvective_WaterFields::AvailabilityScheduleName, _schedule->name().get());
52 ✗ }
53 ✗ }
54
55 ✗ if (auto coolingCoil = modelObject.coolingCoil().optionalCast<CoilCoolingWaterPanelRadiant>()) {
56
57 // InletNodeName
58 ✗ if (auto node = coolingCoil->inletModelObject()) {
59 ✗ idfObject.setString(ZoneHVAC_CoolingPanel_RadiantConvective_WaterFields::WaterInletNodeName, node->name().get());
60 ✗ }
61
62 // OutletNodeName
63 ✗ if (auto node = coolingCoil->outletModelObject()) {
64 ✗ idfObject.setString(ZoneHVAC_CoolingPanel_RadiantConvective_WaterFields::WaterOutletNodeName, node->name().get());
65 ✗ }
66
67 // RatedInletWaterTemperature
68 ✗ if ((value = coolingCoil->ratedInletWaterTemperature())) {
69 ✗ idfObject.setDouble(ZoneHVAC_CoolingPanel_RadiantConvective_WaterFields::RatedInletWaterTemperature, value.get());
70 }
71
72 // RatedInletSpaceTemperature
73 ✗ if ((value = coolingCoil->ratedInletSpaceTemperature())) {
74 ✗ idfObject.setDouble(ZoneHVAC_CoolingPanel_RadiantConvective_WaterFields::RatedInletSpaceTemperature, value.get());
75 }
76
77 // RatedWaterMassFlowRate
78 ✗ if ((value = coolingCoil->ratedWaterMassFlowRate())) {
79 ✗ idfObject.setDouble(ZoneHVAC_CoolingPanel_RadiantConvective_WaterFields::RatedWaterMassFlowRate, value.get());
80 }
81
82 // CoolingDesignCapacityMethod
83 ✗ if ((s = coolingCoil->coolingDesignCapacityMethod())) {
84 ✗ idfObject.setString(ZoneHVAC_CoolingPanel_RadiantConvective_WaterFields::CoolingDesignCapacityMethod, s.get());
85 }
86
87 // CoolingDesignCapacity
88 ✗ if (coolingCoil->isCoolingDesignCapacityAutosized()) {
89 ✗ idfObject.setString(ZoneHVAC_CoolingPanel_RadiantConvective_WaterFields::CoolingDesignCapacity, "AutoSize");
90 ✗ } else if ((value = coolingCoil->coolingDesignCapacity())) {
91 ✗ idfObject.setDouble(ZoneHVAC_CoolingPanel_RadiantConvective_WaterFields::CoolingDesignCapacity, value.get());
92 }
93
94 // CoolingDesignCapacityPerFloorArea
95 ✗ if ((value = coolingCoil->coolingDesignCapacityPerFloorArea())) {
96 ✗ idfObject.setDouble(ZoneHVAC_CoolingPanel_RadiantConvective_WaterFields::CoolingDesignCapacityPerFloorArea, value.get());
97 }
98
99 // FractionofAutosizedCoolingDesignCapacity
100 ✗ if ((value = coolingCoil->fractionofAutosizedCoolingDesignCapacity())) {
101 ✗ idfObject.setDouble(ZoneHVAC_CoolingPanel_RadiantConvective_WaterFields::FractionofAutosizedCoolingDesignCapacity, value.get());
102 }
103
104 // MaximumChilledWaterFlowRate
105 ✗ if (coolingCoil->isMaximumChilledWaterFlowRateAutosized()) {
106 ✗ idfObject.setString(ZoneHVAC_CoolingPanel_RadiantConvective_WaterFields::MaximumChilledWaterFlowRate, "AutoSize");
107 ✗ } else if ((value = coolingCoil->maximumChilledWaterFlowRate())) {
108 ✗ idfObject.setDouble(ZoneHVAC_CoolingPanel_RadiantConvective_WaterFields::MaximumChilledWaterFlowRate, value.get());
109 }
110
111 // ControlType
112 ✗ if ((s = coolingCoil->controlType())) {
113 ✗ idfObject.setString(ZoneHVAC_CoolingPanel_RadiantConvective_WaterFields::ControlType, s.get());
114 }
115
116 // CoolingControlThrottlingRange
117 ✗ if ((value = coolingCoil->coolingControlThrottlingRange())) {
118 ✗ idfObject.setDouble(ZoneHVAC_CoolingPanel_RadiantConvective_WaterFields::CoolingControlThrottlingRange, value.get());
119 }
120
121 // CoolingControlTemperatureScheduleName
122 ✗ if (auto schedule = coolingCoil->coolingControlTemperatureSchedule()) {
123 ✗ idfObject.setString(ZoneHVAC_CoolingPanel_RadiantConvective_WaterFields::CoolingControlTemperatureScheduleName, schedule->name().get());
124 ✗ }
125
126 // CondensationControlType
127 ✗ if ((s = coolingCoil->condensationControlType())) {
128 ✗ idfObject.setString(ZoneHVAC_CoolingPanel_RadiantConvective_WaterFields::CondensationControlType, s.get());
129 }
130
131 // CondensationControlDewpointOffset
132 ✗ if ((value = coolingCoil->condensationControlDewpointOffset())) {
133 ✗ idfObject.setDouble(ZoneHVAC_CoolingPanel_RadiantConvective_WaterFields::CondensationControlDewpointOffset, value.get());
134 }
135 ✗ }
136
137 // FractionRadiant
138 ✗ if ((value = modelObject.fractionRadiant())) {
139 ✗ idfObject.setDouble(ZoneHVAC_CoolingPanel_RadiantConvective_WaterFields::FractionRadiant, value.get());
140 }
141
142 // FractionofRadiantEnergyIncidentonPeople
143 ✗ double fractionofRadiantEnergyIncidentonPeople = modelObject.fractionofRadiantEnergyIncidentonPeople();
144 {
145 ✗ idfObject.setDouble(ZoneHVAC_CoolingPanel_RadiantConvective_WaterFields::FractionofRadiantEnergyIncidentonPeople,
146 fractionofRadiantEnergyIncidentonPeople);
147 }
148
149 //get rid of any existing surface (just to be safe)
150 ✗ idfObject.clearExtensibleGroups();
151
152 //aggregator for total area; will be used to create weighted area
153 ✗ double totalAreaOfWallSurfaces = 0;
154 ✗ double totalAreaOfCeilingSurfaces = 0;
155 ✗ double totalAreaOfFloorSurfaces = 0;
156
157 //loop through all surfaces, adding up their area
158 ✗ auto const& surfaces = modelObject.getImpl<model::detail::ZoneHVACCoolingPanelRadiantConvectiveWater_Impl>()->surfaces();
159
160 ✗ for (auto const& surface : surfaces) {
161 ✗ if (istringEqual(surface.surfaceType(), "Floor")) {
162 ✗ totalAreaOfFloorSurfaces += surface.grossArea();
163 ✗ } else if (istringEqual(surface.surfaceType(), "RoofCeiling")) {
164 ✗ totalAreaOfCeilingSurfaces += surface.grossArea();
165 } else {
166 ✗ totalAreaOfWallSurfaces += surface.grossArea();
167 }
168 }
169
170 // Assume that 5% of what is not on people is on the floor
171 ✗ double fractionOnFloor = (1.0 - fractionofRadiantEnergyIncidentonPeople) * 0.05;
172 // Assume that 55% of what is not on people is on the walls
173 ✗ double fractionOnWall = (1.0 - fractionofRadiantEnergyIncidentonPeople) * 0.55;
174 // Assume that 40% of what is not on people is on the ceiling
175 ✗ double fractionOnCeiling = (1.0 - fractionofRadiantEnergyIncidentonPeople) * 0.40;
176 //loop through all the surfaces, adding them and their flow fractions (weighted per-area)
177 ✗ for (auto const& surface : surfaces) {
178 ✗ IdfExtensibleGroup group = idfObject.pushExtensibleGroup();
179 ✗ group.setString(ZoneHVAC_CoolingPanel_RadiantConvective_WaterExtensibleFields::SurfaceName, surface.name().get());
180 ✗ if (istringEqual(surface.surfaceType(), "Floor")) {
181 ✗ group.setDouble(ZoneHVAC_CoolingPanel_RadiantConvective_WaterExtensibleFields::FractionofRadiantEnergytoSurface,
182 ✗ (surface.grossArea() / totalAreaOfFloorSurfaces * fractionOnFloor));
183 ✗ } else if (istringEqual(surface.surfaceType(), "RoofCeiling")) {
184 ✗ group.setDouble(ZoneHVAC_CoolingPanel_RadiantConvective_WaterExtensibleFields::FractionofRadiantEnergytoSurface,
185 ✗ (surface.grossArea() / totalAreaOfCeilingSurfaces * fractionOnCeiling));
186 } else {
187 ✗ group.setDouble(ZoneHVAC_CoolingPanel_RadiantConvective_WaterExtensibleFields::FractionofRadiantEnergytoSurface,
188 ✗ (surface.grossArea() / totalAreaOfWallSurfaces * fractionOnWall));
189 }
190 ✗ }
191
192 ✗ return idfObject;
193 ✗ }
194
195 } // namespace energyplus
196
197 } // namespace openstudio
198