GCC Code Coverage Report


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

src/energyplus/ForwardTranslator/ForwardTranslateRefrigerationSystem.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/RefrigerationSystem.hpp"
9 #include "../../model/ThermalZone.hpp"
10 //#include <model/RefrigerationCondenserAirCooled.hpp>
11 #include "../../model/RefrigerationAirChiller.hpp"
12 #include "../../model/RefrigerationCondenserCascade.hpp"
13 #include "../../model/RefrigerationCase.hpp"
14 #include "../../model/RefrigerationCompressor.hpp"
15 #include "../../model/RefrigerationSecondarySystem.hpp"
16 #include "../../model/RefrigerationWalkIn.hpp"
17 #include "../../model/RefrigerationSubcoolerLiquidSuction.hpp"
18 #include "../../model/RefrigerationSubcoolerMechanical.hpp"
19 #include "../../utilities/idf/IdfExtensibleGroup.hpp"
20
21 #include <utilities/idd/Refrigeration_System_FieldEnums.hxx>
22 #include <utilities/idd/Refrigeration_CaseAndWalkInList_FieldEnums.hxx>
23 #include <utilities/idd/Refrigeration_CompressorList_FieldEnums.hxx>
24 #include <utilities/idd/Refrigeration_TransferLoadList_FieldEnums.hxx>
25 #include <utilities/idd/FluidProperties_Name_FieldEnums.hxx>
26 #include "../../utilities/idd/IddEnums.hpp"
27 #include <utilities/idd/IddEnums.hxx>
28 #include <utilities/idd/IddFactory.hxx>
29
30 using namespace openstudio::model;
31
32 using namespace std;
33
34 namespace openstudio {
35
36 namespace energyplus {
37
38 ✗ boost::optional<IdfObject> ForwardTranslator::translateRefrigerationSystem(RefrigerationSystem& modelObject) {
39 ✗ OptionalModelObject temp;
40 ✗ OptionalString optS;
41 ✗ boost::optional<std::string> s;
42 ✗ boost::optional<double> d;
43 ✗ std::string name;
44
45 // Name
46 ✗ IdfObject refrigerationSystem = createRegisterAndNameIdfObject(openstudio::IddObjectType::Refrigeration_System, modelObject);
47
48 //Refrigerated Case or Walkin or CaseAndWalkInList Name
49 ✗ std::vector<RefrigerationCase> cases = modelObject.cases();
50 ✗ std::vector<RefrigerationWalkIn> walkins = modelObject.walkins();
51 ✗ std::vector<RefrigerationAirChiller> airChillers = modelObject.airChillers();
52
53 ✗ if (!cases.empty() || !walkins.empty() || !airChillers.empty()) {
54 // Name
55 ✗ name = " Case and Walkin List";
56 ✗ refrigerationSystem.setString(Refrigeration_SystemFields::RefrigeratedCaseorWalkinorCaseAndWalkInListName,
57 ✗ refrigerationSystem.name().get() + name);
58
59 ✗ IdfObject _caseAndWalkinList(IddObjectType::Refrigeration_CaseAndWalkInList);
60
61 ✗ m_idfObjects.push_back(_caseAndWalkinList);
62
63 ✗ _caseAndWalkinList.setName(refrigerationSystem.name().get() + name);
64
65 ✗ for (auto& elem : cases) {
66 ✗ boost::optional<IdfObject> _case = translateAndMapModelObject(elem);
67
68 ✗ if (_case) {
69 ✗ IdfExtensibleGroup eg = _caseAndWalkinList.pushExtensibleGroup();
70
71 ✗ eg.setString(Refrigeration_CaseAndWalkInListExtensibleFields::CaseorWalkInName, _case->name().get());
72 ✗ }
73 ✗ }
74
75 ✗ for (auto& elem : walkins) {
76 ✗ boost::optional<IdfObject> _walkin = translateAndMapModelObject(elem);
77
78 ✗ if (_walkin) {
79 ✗ IdfExtensibleGroup eg = _caseAndWalkinList.pushExtensibleGroup();
80
81 ✗ eg.setString(Refrigeration_CaseAndWalkInListExtensibleFields::CaseorWalkInName, _walkin->name().get());
82 ✗ }
83 ✗ }
84
85 ✗ for (auto& elem : airChillers) {
86 ✗ boost::optional<IdfObject> _airChiller = translateAndMapModelObject(elem);
87
88 ✗ if (_airChiller) {
89 ✗ IdfExtensibleGroup eg = _caseAndWalkinList.pushExtensibleGroup();
90
91 ✗ eg.setString(Refrigeration_CaseAndWalkInListExtensibleFields::CaseorWalkInName, _airChiller->name().get());
92 ✗ }
93 ✗ }
94 ✗ }
95
96 //Refrigeration Transfer Load or TransferLoad List Name
97 ✗ std::vector<RefrigerationSecondarySystem> secondarySystemLoads = modelObject.secondarySystemLoads();
98 ✗ std::vector<RefrigerationCondenserCascade> cascadeCondenserLoads = modelObject.cascadeCondenserLoads();
99
100 ✗ if (!secondarySystemLoads.empty() || !cascadeCondenserLoads.empty()) {
101 // Name
102 ✗ name = " Transfer Load List";
103 ✗ refrigerationSystem.setString(Refrigeration_SystemFields::RefrigerationTransferLoadorTransferLoadListName,
104 ✗ refrigerationSystem.name().get() + name);
105
106 ✗ IdfObject _transferLoadList(IddObjectType::Refrigeration_TransferLoadList);
107
108 ✗ m_idfObjects.push_back(_transferLoadList);
109
110 ✗ _transferLoadList.setName(refrigerationSystem.name().get() + name);
111
112 ✗ for (auto& elem : secondarySystemLoads) {
113 ✗ boost::optional<IdfObject> _secondarySystemLoad = translateAndMapModelObject(elem);
114
115 ✗ if (_secondarySystemLoad) {
116 ✗ IdfExtensibleGroup eg = _transferLoadList.pushExtensibleGroup();
117
118 ✗ eg.setString(Refrigeration_TransferLoadListExtensibleFields::CascadeCondenserNameorSecondarySystemName, _secondarySystemLoad->name().get());
119 ✗ }
120 ✗ }
121
122 ✗ for (auto& elem : cascadeCondenserLoads) {
123 ✗ boost::optional<IdfObject> _cascadeCondenserLoad = translateAndMapModelObject(elem);
124
125 ✗ if (_cascadeCondenserLoad) {
126 ✗ IdfExtensibleGroup eg = _transferLoadList.pushExtensibleGroup();
127
128 ✗ eg.setString(Refrigeration_TransferLoadListExtensibleFields::CascadeCondenserNameorSecondarySystemName,
129 ✗ _cascadeCondenserLoad->name().get());
130 ✗ }
131 ✗ }
132 ✗ }
133
134 //Refrigeration Condenser Name
135 ✗ boost::optional<ModelObject> refrigerationCondenser = modelObject.refrigerationCondenser();
136
137 ✗ if (refrigerationCondenser) {
138 ✗ boost::optional<IdfObject> _refrigerationCondenser = translateAndMapModelObject(refrigerationCondenser.get());
139
140 ✗ if (_refrigerationCondenser && _refrigerationCondenser->name()) {
141 ✗ refrigerationSystem.setString(Refrigeration_SystemFields::RefrigerationCondenserName, _refrigerationCondenser->name().get());
142 }
143 ✗ }
144
145 //Compressor or CompressorList Name
146 ✗ std::vector<RefrigerationCompressor> compressors = modelObject.compressors();
147
148 ✗ if (!compressors.empty()) {
149 // Name
150 ✗ name = " Compressor List";
151 ✗ refrigerationSystem.setString(Refrigeration_SystemFields::CompressororCompressorListName, refrigerationSystem.name().get() + name);
152
153 ✗ IdfObject _compressorList(IddObjectType::Refrigeration_CompressorList);
154
155 ✗ m_idfObjects.push_back(_compressorList);
156
157 ✗ _compressorList.setName(refrigerationSystem.name().get() + name);
158
159 ✗ for (auto& elem : compressors) {
160 ✗ boost::optional<IdfObject> _compressor = translateAndMapModelObject(elem);
161
162 ✗ if (_compressor) {
163 ✗ IdfExtensibleGroup eg = _compressorList.pushExtensibleGroup();
164
165 ✗ eg.setString(Refrigeration_CompressorListExtensibleFields::RefrigerationCompressorName, _compressor->name().get());
166 ✗ }
167 ✗ }
168 ✗ }
169
170 //Minimum Condensing Temperature
171 ✗ d = modelObject.minimumCondensingTemperature();
172 ✗ if (d) {
173 ✗ refrigerationSystem.setDouble(Refrigeration_SystemFields::MinimumCondensingTemperature, d.get());
174 }
175
176 //Refrigeration System Working Fluid Type
177 ✗ s = modelObject.refrigerationSystemWorkingFluidType();
178 ✗ if (s) {
179 ✗ boost::optional<IdfObject> fluidProperties = createFluidProperties(s.get());
180 ✗ if (fluidProperties) {
181 ✗ boost::optional<std::string> value = fluidProperties.get().getString(FluidProperties_NameFields::FluidName, true);
182 ✗ if (value) {
183 ✗ refrigerationSystem.setString(Refrigeration_SystemFields::RefrigerationSystemWorkingFluidType, value.get());
184 }
185 ✗ }
186 ✗ }
187
188 //Suction Temperature Control Type
189 ✗ s = modelObject.suctionTemperatureControlType();
190 ✗ if (s) {
191 ✗ refrigerationSystem.setString(Refrigeration_SystemFields::SuctionTemperatureControlType, s.get());
192 }
193
194 //Mechanical Subcooler Name
195 ✗ boost::optional<RefrigerationSubcoolerMechanical> mechanicalSubcooler = modelObject.mechanicalSubcooler();
196
197 ✗ if (mechanicalSubcooler) {
198 ✗ boost::optional<IdfObject> _mechanicalSubcooler = translateAndMapModelObject(mechanicalSubcooler.get());
199
200 ✗ if (_mechanicalSubcooler && _mechanicalSubcooler->name()) {
201 ✗ refrigerationSystem.setString(Refrigeration_SystemFields::MechanicalSubcoolerName, _mechanicalSubcooler->name().get());
202 }
203 ✗ }
204
205 //Liquid Suction Heat Exchanger Subcooler Name
206 ✗ boost::optional<RefrigerationSubcoolerLiquidSuction> liquidSuctionHeatExchangerSubcooler = modelObject.liquidSuctionHeatExchangerSubcooler();
207
208 ✗ if (liquidSuctionHeatExchangerSubcooler) {
209 ✗ boost::optional<IdfObject> _liquidSuctionHeatExchangerSubcooler = translateAndMapModelObject(liquidSuctionHeatExchangerSubcooler.get());
210
211 ✗ if (_liquidSuctionHeatExchangerSubcooler && _liquidSuctionHeatExchangerSubcooler->name()) {
212 ✗ refrigerationSystem.setString(Refrigeration_SystemFields::LiquidSuctionHeatExchangerSubcoolerName,
213 ✗ _liquidSuctionHeatExchangerSubcooler->name().get());
214 }
215 ✗ }
216
217 //Sum UA Suction Piping
218 ✗ d = modelObject.sumUASuctionPiping();
219 ✗ if (d) {
220 ✗ refrigerationSystem.setDouble(Refrigeration_SystemFields::SumUASuctionPiping, d.get());
221 }
222
223 //Suction Piping Zone Name
224 ✗ boost::optional<ThermalZone> suctionPipingZone = modelObject.suctionPipingZone();
225
226 ✗ if (suctionPipingZone) {
227 ✗ boost::optional<IdfObject> _suctionPipingZone = translateAndMapModelObject(suctionPipingZone.get());
228
229 ✗ if (_suctionPipingZone && _suctionPipingZone->name()) {
230 ✗ refrigerationSystem.setString(Refrigeration_SystemFields::SuctionPipingZoneName, _suctionPipingZone->name().get());
231 }
232 ✗ }
233
234 //End-Use Subcategory
235 ✗ s = modelObject.endUseSubcategory();
236 ✗ if (s) {
237 ✗ refrigerationSystem.setString(Refrigeration_SystemFields::EndUseSubcategory, s.get());
238 }
239
240 //Number of Compressor Stages
241 ✗ s = modelObject.numberofCompressorStages();
242 ✗ if (s) {
243 ✗ refrigerationSystem.setString(Refrigeration_SystemFields::NumberofCompressorStages, s.get());
244 }
245
246 //Intercooler Type
247 ✗ s = modelObject.intercoolerType();
248 ✗ if (s) {
249 ✗ refrigerationSystem.setString(Refrigeration_SystemFields::IntercoolerType, s.get());
250 }
251
252 //Shell-and-Coil Intercooler Effectiveness
253 ✗ d = modelObject.shellandCoilIntercoolerEffectiveness();
254 ✗ if (d) {
255 ✗ refrigerationSystem.setDouble(Refrigeration_SystemFields::ShellandCoilIntercoolerEffectiveness, d.get());
256 }
257
258 //High-Stage Compressor or CompressorList Name
259 ✗ std::vector<RefrigerationCompressor> highStageCompressors = modelObject.highStageCompressors();
260
261 ✗ if (!highStageCompressors.empty()) {
262 // Name
263 ✗ name = " High Stage Compressor List";
264 ✗ refrigerationSystem.setString(Refrigeration_SystemFields::HighStageCompressororCompressorListName, refrigerationSystem.name().get() + name);
265
266 ✗ IdfObject _highStageCompressorList(IddObjectType::Refrigeration_CompressorList);
267
268 ✗ m_idfObjects.push_back(_highStageCompressorList);
269
270 ✗ _highStageCompressorList.setName(refrigerationSystem.name().get() + name);
271
272 ✗ for (auto& elem : highStageCompressors) {
273 ✗ boost::optional<IdfObject> _highStageCompressor = translateAndMapModelObject(elem);
274
275 ✗ if (_highStageCompressor) {
276 ✗ IdfExtensibleGroup eg = _highStageCompressorList.pushExtensibleGroup();
277
278 ✗ eg.setString(Refrigeration_CompressorListExtensibleFields::RefrigerationCompressorName, _highStageCompressor->name().get());
279 ✗ }
280 ✗ }
281 ✗ }
282
283 ✗ return refrigerationSystem;
284 ✗ }
285 } // namespace energyplus
286 } // namespace openstudio
287