Line data Source code
1 : // EnergyPlus, Copyright (c) 1996-2023, The Board of Trustees of the University of Illinois,
2 : // The Regents of the University of California, through Lawrence Berkeley National Laboratory
3 : // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
4 : // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
5 : // contributors. All rights reserved.
6 : //
7 : // NOTICE: This Software was developed under funding from the U.S. Department of Energy and the
8 : // U.S. Government consequently retains certain rights. As such, the U.S. Government has been
9 : // granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable,
10 : // worldwide license in the Software to reproduce, distribute copies to the public, prepare
11 : // derivative works, and perform publicly and display publicly, and to permit others to do so.
12 : //
13 : // Redistribution and use in source and binary forms, with or without modification, are permitted
14 : // provided that the following conditions are met:
15 : //
16 : // (1) Redistributions of source code must retain the above copyright notice, this list of
17 : // conditions and the following disclaimer.
18 : //
19 : // (2) Redistributions in binary form must reproduce the above copyright notice, this list of
20 : // conditions and the following disclaimer in the documentation and/or other materials
21 : // provided with the distribution.
22 : //
23 : // (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory,
24 : // the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be
25 : // used to endorse or promote products derived from this software without specific prior
26 : // written permission.
27 : //
28 : // (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form
29 : // without changes from the version obtained under this License, or (ii) Licensee makes a
30 : // reference solely to the software portion of its product, Licensee must refer to the
31 : // software as "EnergyPlus version X" software, where "X" is the version number Licensee
32 : // obtained under this License and may not use a different name for the software. Except as
33 : // specifically required in this Section (4), Licensee shall not use in a company name, a
34 : // product name, in advertising, publicity, or other promotional activities any name, trade
35 : // name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly
36 : // similar designation, without the U.S. Department of Energy's prior written consent.
37 : //
38 : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
39 : // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
40 : // AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
41 : // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
42 : // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
43 : // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
44 : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
45 : // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
46 : // POSSIBILITY OF SUCH DAMAGE.
47 :
48 : // C++ Headers
49 : #include <cmath>
50 :
51 : // ObjexxFCL Headers
52 : #include <ObjexxFCL/string.functions.hh>
53 :
54 : // EnergyPlus Headers
55 : #include <EnergyPlus/BranchNodeConnections.hh>
56 : #include <EnergyPlus/Data/EnergyPlusData.hh>
57 : #include <EnergyPlus/DataBranchAirLoopPlant.hh>
58 : #include <EnergyPlus/DataHVACGlobals.hh>
59 : #include <EnergyPlus/DataLoopNode.hh>
60 : #include <EnergyPlus/FluidProperties.hh>
61 : #include <EnergyPlus/General.hh>
62 : #include <EnergyPlus/HeatPumpWaterToWaterCOOLING.hh>
63 : #include <EnergyPlus/InputProcessing/InputProcessor.hh>
64 : #include <EnergyPlus/NodeInputManager.hh>
65 : #include <EnergyPlus/OutputProcessor.hh>
66 : #include <EnergyPlus/Plant/DataPlant.hh>
67 : #include <EnergyPlus/Plant/PlantLocation.hh>
68 : #include <EnergyPlus/PlantUtilities.hh>
69 : #include <EnergyPlus/UtilityRoutines.hh>
70 :
71 : namespace EnergyPlus::HeatPumpWaterToWaterCOOLING {
72 : // Module containing the routines dealing with the Water to Water Heat Pump (Cooling)
73 :
74 : // MODULE INFORMATION:
75 : // AUTHOR ARUN
76 : // DATE WRITTEN 7/18/2000
77 : // MODIFIED ARUN: 6/27/2002: Cycle Time
78 : // L Lawrie: V1.1.1 (5/20/2003) add meters and energy to several reporting variables
79 : // L Lawrie: V1.1.1 (5/20/2003) restructure modules to comply with standard templates
80 : // B Griffith, Sept 2010, plant upgrades, general fluid properties
81 : // RE-ENGINEERED na
82 :
83 : // PURPOSE OF THIS MODULE:
84 : // This module simulates a water to Water Heat Pump (Cooling)
85 :
86 : // METHODOLOGY EMPLOYED:
87 : // This simulation is based on a set of selected parameters,
88 : // Which are obtained using Parameter Estimation technique.
89 :
90 : // Using/Aliasing
91 : using namespace DataLoopNode;
92 :
93 : // MODULE PARAMETER DEFINITIONS
94 771 : std::string const ModuleCompName("HeatPump:WaterToWater:ParameterEstimation:Cooling");
95 771 : std::string const ModuleCompNameUC("HEATPUMP:WATERTOWATER:PARAMETERESTIMATION:COOLING");
96 771 : std::string const GSHPRefrigerant("R22"); // refrigerant name and index
97 :
98 6 : PlantComponent *GshpPeCoolingSpecs::factory(EnergyPlusData &state, const std::string &objectName)
99 : {
100 6 : if (state.dataHPWaterToWaterClg->GetWWHPCoolingInput) {
101 3 : GetGshpInput(state);
102 3 : state.dataHPWaterToWaterClg->GetWWHPCoolingInput = false;
103 : }
104 6 : for (auto &wwhp : state.dataHPWaterToWaterClg->GSHP) {
105 6 : if (wwhp.Name == objectName) {
106 6 : return &wwhp;
107 : }
108 : }
109 : // If we didn't find it, fatal
110 0 : ShowFatalError(state,
111 : "WWHPCoolingFactory: Error getting inputs for heat pump named: " + objectName); // LCOV_EXCL_LINE
112 : // Shut up the compiler
113 : return nullptr; // LCOV_EXCL_LINE
114 : }
115 :
116 95166 : void GshpPeCoolingSpecs::simulate(
117 : EnergyPlusData &state, const PlantLocation &calledFromLocation, bool FirstHVACIteration, Real64 &CurLoad, [[maybe_unused]] bool RunFlag)
118 : {
119 : // Simulate the model for the Demand "MyLoad"
120 95166 : if (calledFromLocation.loopNum == this->LoadPlantLoc.loopNum) { // chilled water loop
121 47583 : this->initialize(state);
122 47583 : this->calculate(state, CurLoad);
123 47583 : this->update(state);
124 47583 : } else if (calledFromLocation.loopNum == this->SourcePlantLoc.loopNum) { // condenser loop
125 47583 : PlantUtilities::UpdateChillerComponentCondenserSide(state,
126 : this->SourcePlantLoc.loopNum,
127 : this->SourcePlantLoc.loopSideNum,
128 : DataPlant::PlantEquipmentType::HPWaterEFCooling,
129 : this->SourceSideInletNodeNum,
130 : this->SourceSideOutletNodeNum,
131 : this->QSource,
132 : this->SourceSideWaterInletTemp,
133 : this->SourceSideWaterOutletTemp,
134 : this->SourceSideWaterMassFlowRate,
135 : FirstHVACIteration);
136 : } else {
137 0 : ShowFatalError(state, "SimHPWatertoWaterCOOLING:: Invalid loop connection " + ModuleCompName + ", Requested Unit=" + this->Name);
138 : }
139 95166 : }
140 :
141 30 : void GshpPeCoolingSpecs::getDesignCapacities([[maybe_unused]] EnergyPlusData &state,
142 : [[maybe_unused]] const PlantLocation &calledFromLocation,
143 : Real64 &MaxLoad,
144 : Real64 &MinLoad,
145 : Real64 &OptLoad)
146 : {
147 30 : MinLoad = this->NomCap * this->MinPartLoadRat;
148 30 : MaxLoad = this->NomCap * this->MaxPartLoadRat;
149 30 : OptLoad = this->NomCap * this->OptPartLoadRat;
150 30 : }
151 :
152 30 : void GshpPeCoolingSpecs::onInitLoopEquip(EnergyPlusData &state, [[maybe_unused]] const PlantLocation &calledFromLocation)
153 : {
154 30 : if (this->plantScanFlag) {
155 : // Locate the heating on the plant loops for later usage
156 3 : bool errFlag = false;
157 3 : PlantUtilities::ScanPlantLoopsForObject(state,
158 : this->Name,
159 : DataPlant::PlantEquipmentType::HPWaterPECooling,
160 : this->SourcePlantLoc,
161 : errFlag,
162 : _,
163 : _,
164 : _,
165 : this->SourceSideInletNodeNum,
166 : _);
167 3 : PlantUtilities::ScanPlantLoopsForObject(
168 : state, this->Name, DataPlant::PlantEquipmentType::HPWaterPECooling, this->LoadPlantLoc, errFlag, _, _, _, this->LoadSideInletNodeNum, _);
169 3 : if (errFlag) {
170 0 : ShowFatalError(state, "InitGshp: Program terminated due to previous condition(s).");
171 : }
172 :
173 3 : PlantUtilities::InterConnectTwoPlantLoopSides(state, this->LoadPlantLoc, this->SourcePlantLoc, this->WWHPPlantTypeOfNum, true);
174 3 : this->plantScanFlag = false;
175 : }
176 30 : }
177 :
178 3 : void GetGshpInput(EnergyPlusData &state)
179 : {
180 : // SUBROUTINE INFORMATION:
181 : // AUTHOR:
182 : // DATE WRITTEN: April 1998
183 :
184 : // PURPOSE OF THIS SUBROUTINE:
185 : // This routine will get the input
186 : // required by the GSHP models. As such
187 : // it will interact with the Input Scanner to retrieve
188 : // information from the input file, count the number of
189 : // GSHPs and begin to fill the
190 : // arrays associated with the typeGSHP.
191 :
192 : // Using/Aliasing
193 : using BranchNodeConnections::TestCompSet;
194 : using FluidProperties::FindRefrigerant;
195 : using NodeInputManager::GetOnlySingleNode;
196 : using PlantUtilities::RegisterPlantCompDesignFlow;
197 : using PlantUtilities::ScanPlantLoopsForObject;
198 :
199 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
200 : int GSHPNum; // Gshp counter
201 : int NumAlphas; // Number of elements in the alpha array
202 : int NumNums; // Number of elements in the numeric array
203 : int IOStat; // IO Status when calling get input subroutine
204 6 : Array1D_string AlphArray(5); // character string data
205 6 : Array1D<Real64> NumArray(23); // numeric data
206 :
207 3 : bool ErrorsFound(false);
208 :
209 3 : state.dataHPWaterToWaterClg->NumGSHPs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, ModuleCompNameUC);
210 :
211 3 : if (state.dataHPWaterToWaterClg->NumGSHPs <= 0) {
212 0 : ShowSevereError(state, "No Equipment found in SimGshp");
213 0 : ErrorsFound = true;
214 : }
215 :
216 : // Allocate Arrays
217 3 : state.dataHPWaterToWaterClg->GSHP.allocate(state.dataHPWaterToWaterClg->NumGSHPs);
218 :
219 6 : for (GSHPNum = 1; GSHPNum <= state.dataHPWaterToWaterClg->NumGSHPs; ++GSHPNum) {
220 3 : state.dataInputProcessing->inputProcessor->getObjectItem(state, ModuleCompNameUC, GSHPNum, AlphArray, NumAlphas, NumArray, NumNums, IOStat);
221 3 : UtilityRoutines::IsNameEmpty(state, AlphArray(1), ModuleCompNameUC, ErrorsFound);
222 :
223 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).Name = AlphArray(1);
224 :
225 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).WWHPPlantTypeOfNum = DataPlant::PlantEquipmentType::HPWaterPECooling;
226 :
227 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).COP = NumArray(1);
228 3 : if (NumArray(1) == 0.0) {
229 0 : ShowSevereError(state, ModuleCompName + ":COP = 0.0, Heatpump=" + AlphArray(1));
230 0 : ErrorsFound = true;
231 : }
232 :
233 : // zero values for NumArray 3 - 6 checked in input - idd
234 :
235 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).NomCap = NumArray(2);
236 :
237 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).MinPartLoadRat = NumArray(3);
238 :
239 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).MaxPartLoadRat = NumArray(4);
240 :
241 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).OptPartLoadRat = NumArray(5);
242 :
243 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).LoadSideVolFlowRate = NumArray(6);
244 3 : if (NumArray(6) == 0.0) {
245 0 : ShowSevereError(state, ModuleCompName + ":Load Side Vol Flow Rate = 0.0, Heatpump=" + AlphArray(1));
246 0 : ErrorsFound = true;
247 : }
248 :
249 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).SourceSideVolFlowRate = NumArray(7);
250 3 : if (NumArray(7) == 0.0) {
251 0 : ShowSevereError(state, ModuleCompName + ":Source Side Vol Flow Rate = 0.0, Heatpump=" + AlphArray(1));
252 0 : ErrorsFound = true;
253 : }
254 :
255 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).LoadSideUACoeff = NumArray(8);
256 3 : if (NumArray(9) == 0.0) {
257 0 : ShowSevereError(state, ModuleCompName + ":Load Side Heat Transfer Coefficient = 0.0, Heatpump=" + AlphArray(1));
258 0 : ErrorsFound = true;
259 : }
260 :
261 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).SourceSideUACoeff = NumArray(9);
262 3 : if (NumArray(8) == 0.0) {
263 0 : ShowSevereError(state, ModuleCompName + ":Source Side Heat Transfer Coefficient = 0.0, Heatpump=" + AlphArray(1));
264 0 : ErrorsFound = true;
265 : }
266 :
267 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).CompPistonDisp = NumArray(10);
268 3 : if (NumArray(10) == 0.0) {
269 0 : ShowSevereError(state, ModuleCompName + ":Compressor Piston displacement/Stroke = 0.0, Heatpump=" + AlphArray(1));
270 0 : ErrorsFound = true;
271 : }
272 :
273 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).CompClearanceFactor = NumArray(11);
274 3 : if (NumArray(11) == 0.0) {
275 0 : ShowSevereError(state, ModuleCompName + ":Compressor Clearance Factor = 0.0, Heatpump=" + AlphArray(1));
276 0 : ErrorsFound = true;
277 : }
278 :
279 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).CompSucPressDrop = NumArray(12);
280 3 : if (NumArray(12) == 0.0) {
281 0 : ShowSevereError(state, ModuleCompName + ": Pressure Drop = 0.0, Heatpump=" + AlphArray(1));
282 0 : ErrorsFound = true;
283 : }
284 :
285 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).SuperheatTemp = NumArray(13);
286 3 : if (NumArray(13) == 0.0) {
287 0 : ShowSevereError(state, ModuleCompName + ":Source Side SuperHeat = 0.0, Heatpump=" + AlphArray(1));
288 0 : ErrorsFound = true;
289 : }
290 :
291 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).PowerLosses = NumArray(14);
292 3 : if (NumArray(14) == 0.0) {
293 0 : ShowSevereError(state, ModuleCompName + ":Compressor Power Loss = 0.0, Heatpump=" + AlphArray(1));
294 0 : ErrorsFound = true;
295 : }
296 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).LossFactor = NumArray(15);
297 3 : if (NumArray(15) == 0.0) {
298 0 : ShowSevereError(state, ModuleCompName + ":Efficiency = 0.0, Heatpump=" + AlphArray(1));
299 0 : ErrorsFound = true;
300 : }
301 :
302 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).HighPressCutoff = NumArray(16);
303 3 : if (NumArray(16) == 0.0) {
304 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).HighPressCutoff = 500000000.0;
305 : }
306 :
307 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).LowPressCutoff = NumArray(17);
308 3 : if (NumArray(17) == 0.0) {
309 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).LowPressCutoff = 0.0;
310 : }
311 :
312 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).SourceSideInletNodeNum =
313 6 : GetOnlySingleNode(state,
314 3 : AlphArray(2),
315 : ErrorsFound,
316 : DataLoopNode::ConnectionObjectType::HeatPumpWaterToWaterParameterEstimationCooling,
317 3 : AlphArray(1),
318 : DataLoopNode::NodeFluidType::Water,
319 : DataLoopNode::ConnectionType::Inlet,
320 : NodeInputManager::CompFluidStream::Primary,
321 3 : ObjectIsNotParent);
322 :
323 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).SourceSideOutletNodeNum =
324 6 : GetOnlySingleNode(state,
325 3 : AlphArray(3),
326 : ErrorsFound,
327 : DataLoopNode::ConnectionObjectType::HeatPumpWaterToWaterParameterEstimationCooling,
328 3 : AlphArray(1),
329 : DataLoopNode::NodeFluidType::Water,
330 : DataLoopNode::ConnectionType::Outlet,
331 : NodeInputManager::CompFluidStream::Primary,
332 3 : ObjectIsNotParent);
333 :
334 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).LoadSideInletNodeNum =
335 6 : GetOnlySingleNode(state,
336 3 : AlphArray(4),
337 : ErrorsFound,
338 : DataLoopNode::ConnectionObjectType::HeatPumpWaterToWaterParameterEstimationCooling,
339 3 : AlphArray(1),
340 : DataLoopNode::NodeFluidType::Water,
341 : DataLoopNode::ConnectionType::Inlet,
342 : NodeInputManager::CompFluidStream::Secondary,
343 3 : ObjectIsNotParent);
344 :
345 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).LoadSideOutletNodeNum =
346 6 : GetOnlySingleNode(state,
347 3 : AlphArray(5),
348 : ErrorsFound,
349 : DataLoopNode::ConnectionObjectType::HeatPumpWaterToWaterParameterEstimationCooling,
350 3 : AlphArray(1),
351 : DataLoopNode::NodeFluidType::Water,
352 : DataLoopNode::ConnectionType::Outlet,
353 : NodeInputManager::CompFluidStream::Secondary,
354 3 : ObjectIsNotParent);
355 :
356 : // Test node sets
357 3 : TestCompSet(state, ModuleCompNameUC, AlphArray(1), AlphArray(2), AlphArray(3), "Condenser Water Nodes");
358 3 : TestCompSet(state, ModuleCompNameUC, AlphArray(1), AlphArray(4), AlphArray(5), "Chilled Water Nodes");
359 :
360 : // save the design source side flow rate for use by plant loop sizing algorithms
361 6 : RegisterPlantCompDesignFlow(state,
362 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).SourceSideInletNodeNum,
363 3 : 0.5 * state.dataHPWaterToWaterClg->GSHP(GSHPNum).SourceSideVolFlowRate);
364 :
365 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).QLoad = 0.0;
366 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).QSource = 0.0;
367 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).Power = 0.0;
368 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).LoadSideWaterInletTemp = 0.0;
369 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).SourceSideWaterInletTemp = 0.0;
370 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).LoadSideWaterOutletTemp = 0.0;
371 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).SourceSideWaterOutletTemp = 0.0;
372 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).SourceSideWaterMassFlowRate = 0.0;
373 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).LoadSideWaterMassFlowRate = 0.0;
374 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).IsOn = false;
375 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).MustRun = true;
376 : }
377 :
378 3 : if (ErrorsFound) {
379 0 : ShowFatalError(state, "Errors Found in getting Gshp input");
380 : }
381 :
382 3 : state.dataHPWaterToWaterClg->GSHPRefrigIndex = FindRefrigerant(state, GSHPRefrigerant);
383 3 : if (state.dataHPWaterToWaterClg->GSHPRefrigIndex == 0) {
384 0 : ShowFatalError(state, "Refrigerant for " + ModuleCompName + " not found, should have been=" + GSHPRefrigerant);
385 0 : ShowFatalError(state, "FluidProperties:* objects for " + GSHPRefrigerant + " must be included in the idf file.");
386 : }
387 :
388 : // CurrentModuleObject='HeatPump:WaterToWater:ParameterEstimation:Cooling'
389 6 : for (GSHPNum = 1; GSHPNum <= state.dataHPWaterToWaterClg->NumGSHPs; ++GSHPNum) {
390 12 : SetupOutputVariable(state,
391 : "Heat Pump Electricity Rate",
392 : OutputProcessor::Unit::W,
393 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).Power,
394 : OutputProcessor::SOVTimeStepType::System,
395 : OutputProcessor::SOVStoreType::Average,
396 6 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).Name);
397 12 : SetupOutputVariable(state,
398 : "Heat Pump Electricity Energy",
399 : OutputProcessor::Unit::J,
400 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).Energy,
401 : OutputProcessor::SOVTimeStepType::System,
402 : OutputProcessor::SOVStoreType::Summed,
403 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).Name,
404 : _,
405 : "Electricity",
406 : "Cooling",
407 : _,
408 3 : "Plant");
409 :
410 12 : SetupOutputVariable(state,
411 : "Heat Pump Load Side Heat Transfer Rate",
412 : OutputProcessor::Unit::W,
413 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).QLoad,
414 : OutputProcessor::SOVTimeStepType::System,
415 : OutputProcessor::SOVStoreType::Average,
416 6 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).Name);
417 12 : SetupOutputVariable(state,
418 : "Heat Pump Load Side Heat Transfer Energy",
419 : OutputProcessor::Unit::J,
420 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).QLoadEnergy,
421 : OutputProcessor::SOVTimeStepType::System,
422 : OutputProcessor::SOVStoreType::Summed,
423 6 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).Name);
424 :
425 12 : SetupOutputVariable(state,
426 : "Heat Pump Source Side Heat Transfer Rate",
427 : OutputProcessor::Unit::W,
428 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).QSource,
429 : OutputProcessor::SOVTimeStepType::System,
430 : OutputProcessor::SOVStoreType::Average,
431 6 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).Name);
432 12 : SetupOutputVariable(state,
433 : "Heat Pump Source Side Heat Transfer Energy",
434 : OutputProcessor::Unit::J,
435 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).QSourceEnergy,
436 : OutputProcessor::SOVTimeStepType::System,
437 : OutputProcessor::SOVStoreType::Summed,
438 6 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).Name);
439 :
440 12 : SetupOutputVariable(state,
441 : "Heat Pump Load Side Outlet Temperature",
442 : OutputProcessor::Unit::C,
443 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).LoadSideWaterOutletTemp,
444 : OutputProcessor::SOVTimeStepType::System,
445 : OutputProcessor::SOVStoreType::Average,
446 6 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).Name);
447 12 : SetupOutputVariable(state,
448 : "Heat Pump Load Side Inlet Temperature",
449 : OutputProcessor::Unit::C,
450 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).LoadSideWaterInletTemp,
451 : OutputProcessor::SOVTimeStepType::System,
452 : OutputProcessor::SOVStoreType::Average,
453 6 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).Name);
454 12 : SetupOutputVariable(state,
455 : "Heat Pump Source Side Outlet Temperature",
456 : OutputProcessor::Unit::C,
457 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).SourceSideWaterOutletTemp,
458 : OutputProcessor::SOVTimeStepType::System,
459 : OutputProcessor::SOVStoreType::Average,
460 6 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).Name);
461 12 : SetupOutputVariable(state,
462 : "Heat Pump Source Side Inlet Temperature",
463 : OutputProcessor::Unit::C,
464 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).SourceSideWaterInletTemp,
465 : OutputProcessor::SOVTimeStepType::System,
466 : OutputProcessor::SOVStoreType::Average,
467 6 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).Name);
468 12 : SetupOutputVariable(state,
469 : "Heat Pump Load Side Mass Flow Rate",
470 : OutputProcessor::Unit::kg_s,
471 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).LoadSideWaterMassFlowRate,
472 : OutputProcessor::SOVTimeStepType::System,
473 : OutputProcessor::SOVStoreType::Average,
474 6 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).Name);
475 12 : SetupOutputVariable(state,
476 : "Heat Pump Source Side Mass Flow Rate",
477 : OutputProcessor::Unit::kg_s,
478 3 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).SourceSideWaterMassFlowRate,
479 : OutputProcessor::SOVTimeStepType::System,
480 : OutputProcessor::SOVStoreType::Average,
481 6 : state.dataHPWaterToWaterClg->GSHP(GSHPNum).Name);
482 : }
483 3 : }
484 :
485 47583 : void GshpPeCoolingSpecs::initialize(EnergyPlusData &state)
486 : {
487 :
488 : // SUBROUTINE INFORMATION:
489 : // AUTHOR: Dan Fisher
490 : // DATE WRITTEN: July 2007
491 :
492 : // PURPOSE OF THIS SUBROUTINE:
493 : // initialization
494 :
495 : // SUBROUTINE PARAMETER DEFINITIONS:
496 : static constexpr std::string_view RoutineName("InitGshp");
497 :
498 : // For each new environment
499 47583 : if (state.dataGlobal->BeginEnvrnFlag && this->beginEnvironFlag) {
500 18 : this->QLoad = 0.0;
501 18 : this->QSource = 0.0;
502 18 : this->Power = 0.0;
503 18 : this->QLoadEnergy = 0.0;
504 18 : this->QSourceEnergy = 0.0;
505 18 : this->Energy = 0.0;
506 18 : this->LoadSideWaterInletTemp = 0.0;
507 18 : this->SourceSideWaterInletTemp = 0.0;
508 18 : this->LoadSideWaterOutletTemp = 0.0;
509 18 : this->SourceSideWaterOutletTemp = 0.0;
510 18 : this->SourceSideWaterMassFlowRate = 0.0;
511 18 : this->LoadSideWaterMassFlowRate = 0.0;
512 18 : this->IsOn = false;
513 18 : this->MustRun = true;
514 :
515 18 : this->beginEnvironFlag = false;
516 36 : Real64 rho = FluidProperties::GetDensityGlycol(state,
517 18 : state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName,
518 : DataGlobalConstants::CWInitConvTemp,
519 18 : state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex,
520 18 : RoutineName);
521 18 : this->LoadSideDesignMassFlow = this->LoadSideVolFlowRate * rho;
522 :
523 18 : PlantUtilities::InitComponentNodes(state, 0.0, this->LoadSideDesignMassFlow, this->LoadSideInletNodeNum, this->LoadSideOutletNodeNum);
524 :
525 36 : rho = FluidProperties::GetDensityGlycol(state,
526 18 : state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidName,
527 : DataGlobalConstants::CWInitConvTemp,
528 18 : state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidIndex,
529 : RoutineName);
530 18 : this->SourceSideDesignMassFlow = this->SourceSideVolFlowRate * rho;
531 :
532 18 : PlantUtilities::InitComponentNodes(state, 0.0, this->SourceSideDesignMassFlow, this->SourceSideInletNodeNum, this->SourceSideOutletNodeNum);
533 :
534 18 : state.dataLoopNodes->Node(this->SourceSideInletNodeNum).Temp = 35.0;
535 : }
536 :
537 47583 : if (!state.dataGlobal->BeginEnvrnFlag) this->beginEnvironFlag = true;
538 :
539 : // Init more variables
540 :
541 : // On every call
542 47583 : this->Running = 0;
543 :
544 47583 : this->MustRun = true; // Reset MustRun Flag to TRUE
545 :
546 47583 : this->LoadSideWaterMassFlowRate = 0.0; // Load Side mass flow rate, water side
547 47583 : this->SourceSideWaterMassFlowRate = 0.0; // Source Side mass flow rate, water side
548 47583 : this->Power = 0.0; // power consumption
549 47583 : this->QLoad = 0.0; // heat rejection from Load Side coil
550 47583 : this->QSource = 0.0;
551 47583 : }
552 :
553 47583 : void GshpPeCoolingSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad)
554 : {
555 : // SUBROUTINE INFORMATION:
556 : // AUTHOR
557 : // DATE WRITTEN Sept. 1998
558 : // MODIFIED April 1999
559 : // September 2002, SJR
560 : // RE-ENGINEERED Mar2000
561 :
562 : // SUBROUTINE PARAMETER DEFINITIONS:
563 47583 : Real64 constexpr gamma(1.114); // Expnasion Coefficient
564 47583 : Real64 constexpr HeatBalTol(0.0005);
565 47583 : Real64 constexpr RelaxParam(0.6);
566 47583 : Real64 constexpr SmallNum(1.0e-20);
567 47583 : int constexpr IterationLimit(500);
568 : static constexpr std::string_view RoutineName("CalcGshpModel");
569 : static constexpr std::string_view RoutineNameLoadSideRefridgTemp("CalcGSHPModel:LoadSideRefridgTemp");
570 : static constexpr std::string_view RoutineNameSourceSideRefridgTemp("CalcGSHPModel:SourceSideRefridgTemp");
571 : static constexpr std::string_view RoutineNameCompressInletTemp("CalcGSHPModel:CompressInletTemp");
572 : static constexpr std::string_view RoutineNameSuctionPr("CalcGSHPModel:SuctionPr");
573 : static constexpr std::string_view RoutineNameCompSuctionTemp("CalcGSHPModel:CompSuctionTemp");
574 :
575 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
576 : Real64 SourceSideEffect; // Source Side effectiveness
577 : Real64 LoadSideEffect; // Load Side effectiveness
578 : Real64 SourceSideRefridgTemp; // Source Side temperature
579 : Real64 LoadSideRefridgTemp; // Load Side temperature
580 : Real64 SourceSidePressure; // Source Side pressure
581 : Real64 LoadSidePressure; // Load Side pressure
582 : Real64 SuctionPr; // Suction Pressure
583 : Real64 DischargePr; // Discharge Pressure
584 : Real64 CompressInletTemp; // Compressor inlet temperature
585 : Real64 MassRef; // mass flow rate of refrigerant
586 : Real64 SourceSideOutletEnth; // Enthalpy at Source Side pressure
587 : Real64 LoadSideOutletEnth; // Enthalpy at Condenser Pressure
588 : Real64 initialQSource; // Guess Source Side Heat rate
589 : Real64 initialQLoad; // Guess Load Side Heat rate
590 : Real64 qual; // quality
591 : Real64 SuperHeatEnth;
592 : Real64 T110;
593 : Real64 T111;
594 : Real64 CompSuctionTemp;
595 : Real64 CompSuctionEnth;
596 : Real64 CompSuctionDensity;
597 : Real64 CompSuctionSatTemp;
598 47583 : std::string ErrString;
599 : Real64 DutyFactor;
600 : int IterationCount;
601 :
602 47583 : auto &CurrentSimTime = state.dataHPWaterToWaterClg->CurrentSimTime;
603 47583 : auto &PrevSimTime = state.dataHPWaterToWaterClg->PrevSimTime;
604 :
605 : Real64 CpSourceSide; // local temporary for fluid specific heat
606 : Real64 CpLoadSide; // local temporary for fluid specific heat
607 :
608 47583 : if (PrevSimTime != CurrentSimTime) {
609 5276 : PrevSimTime = CurrentSimTime;
610 : }
611 :
612 : // CALCULATE THE SIMULATION TIME
613 142749 : CurrentSimTime = (state.dataGlobal->DayOfSim - 1) * 24 + state.dataGlobal->HourOfDay - 1 +
614 95166 : (state.dataGlobal->TimeStep - 1) * state.dataGlobal->TimeStepZone + state.dataHVACGlobal->SysTimeElapsed;
615 :
616 47583 : if (MyLoad < 0.0) {
617 36314 : this->MustRun = true;
618 36314 : this->IsOn = true;
619 : } else {
620 11269 : this->MustRun = false;
621 11269 : this->IsOn = false;
622 : }
623 :
624 : //*******Set flow based on "flowlock" and "run" flags**********
625 : // Set flows if the heat pump is not running
626 47583 : if (!this->MustRun) {
627 11269 : this->LoadSideWaterMassFlowRate = 0.0;
628 11269 : PlantUtilities::SetComponentFlowRate(
629 : state, this->LoadSideWaterMassFlowRate, this->LoadSideInletNodeNum, this->LoadSideOutletNodeNum, this->LoadPlantLoc);
630 11269 : this->SourceSideWaterMassFlowRate = 0.0;
631 11269 : PlantUtilities::SetComponentFlowRate(
632 : state, this->SourceSideWaterMassFlowRate, this->SourceSideInletNodeNum, this->SourceSideOutletNodeNum, this->SourcePlantLoc);
633 11269 : PlantUtilities::PullCompInterconnectTrigger(state,
634 : this->LoadPlantLoc,
635 : this->CondMassFlowIndex,
636 : this->SourcePlantLoc,
637 : DataPlant::CriteriaType::MassFlowRate,
638 : this->SourceSideWaterMassFlowRate);
639 : // now initialize simulation variables for "heat pump off"
640 11269 : this->QLoad = 0.0;
641 11269 : this->QSource = 0.0;
642 11269 : this->Power = 0.0;
643 11269 : this->LoadSideWaterInletTemp = state.dataLoopNodes->Node(this->LoadSideInletNodeNum).Temp;
644 11269 : this->LoadSideWaterOutletTemp = LoadSideWaterInletTemp;
645 11269 : this->SourceSideWaterInletTemp = state.dataLoopNodes->Node(this->SourceSideInletNodeNum).Temp;
646 11269 : this->SourceSideWaterOutletTemp = SourceSideWaterInletTemp;
647 11269 : return; // if heat pump is not running return without simulation
648 :
649 : // Set flows if the heat pump is running
650 : } else { // the heat pump must run
651 36314 : this->LoadSideWaterMassFlowRate = this->LoadSideDesignMassFlow;
652 36314 : PlantUtilities::SetComponentFlowRate(
653 : state, this->LoadSideWaterMassFlowRate, this->LoadSideInletNodeNum, this->LoadSideOutletNodeNum, this->LoadPlantLoc);
654 :
655 36314 : this->SourceSideWaterMassFlowRate = this->SourceSideDesignMassFlow;
656 36314 : PlantUtilities::SetComponentFlowRate(
657 : state, this->SourceSideWaterMassFlowRate, this->SourceSideInletNodeNum, this->SourceSideOutletNodeNum, this->SourcePlantLoc);
658 : // get inlet temps
659 36314 : this->LoadSideWaterInletTemp = state.dataLoopNodes->Node(this->LoadSideInletNodeNum).Temp;
660 36314 : this->SourceSideWaterInletTemp = state.dataLoopNodes->Node(this->SourceSideInletNodeNum).Temp;
661 : // if there's no flow, turn the "heat pump off"
662 72621 : if (this->LoadSideWaterMassFlowRate < DataBranchAirLoopPlant::MassFlowTolerance ||
663 36307 : this->SourceSideWaterMassFlowRate < DataBranchAirLoopPlant::MassFlowTolerance) {
664 14 : this->LoadSideWaterMassFlowRate = 0.0;
665 14 : PlantUtilities::SetComponentFlowRate(
666 : state, this->LoadSideWaterMassFlowRate, this->LoadSideInletNodeNum, this->LoadSideOutletNodeNum, this->LoadPlantLoc);
667 14 : this->SourceSideWaterMassFlowRate = 0.0;
668 14 : PlantUtilities::SetComponentFlowRate(
669 : state, this->SourceSideWaterMassFlowRate, this->SourceSideInletNodeNum, this->SourceSideOutletNodeNum, this->SourcePlantLoc);
670 14 : PlantUtilities::PullCompInterconnectTrigger(state,
671 : this->LoadPlantLoc,
672 : this->CondMassFlowIndex,
673 : this->SourcePlantLoc,
674 : DataPlant::CriteriaType::MassFlowRate,
675 : this->SourceSideWaterMassFlowRate);
676 14 : this->QLoad = 0.0;
677 14 : this->QSource = 0.0;
678 14 : this->Power = 0.0;
679 14 : this->LoadSideWaterInletTemp = state.dataLoopNodes->Node(this->LoadSideInletNodeNum).Temp;
680 14 : this->LoadSideWaterOutletTemp = LoadSideWaterInletTemp;
681 14 : this->SourceSideWaterInletTemp = state.dataLoopNodes->Node(this->SourceSideInletNodeNum).Temp;
682 14 : this->SourceSideWaterOutletTemp = SourceSideWaterInletTemp;
683 14 : return;
684 : }
685 36300 : PlantUtilities::PullCompInterconnectTrigger(state,
686 : this->LoadPlantLoc,
687 : this->CondMassFlowIndex,
688 : this->SourcePlantLoc,
689 : DataPlant::CriteriaType::MassFlowRate,
690 : this->SourceSideWaterMassFlowRate);
691 : }
692 :
693 : //**********BEGIN THE CALCULATION**************
694 :
695 : // initialize the source and load side heat transfer rates for the simulation
696 36300 : initialQSource = 0.0;
697 36300 : initialQLoad = 0.0;
698 36300 : IterationCount = 0;
699 :
700 72600 : CpSourceSide = FluidProperties::GetSpecificHeatGlycol(state,
701 36300 : state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidName,
702 : this->SourceSideWaterInletTemp,
703 36300 : state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidIndex,
704 : RoutineName);
705 :
706 72600 : CpLoadSide = FluidProperties::GetSpecificHeatGlycol(state,
707 36300 : state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName,
708 : this->LoadSideWaterInletTemp,
709 36300 : state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex,
710 : RoutineName);
711 :
712 : // Determine effectiveness of Load Side
713 36300 : LoadSideEffect = 1.0 - std::exp(-this->LoadSideUACoeff / (CpLoadSide * this->LoadSideWaterMassFlowRate));
714 : // Determine effectiveness of Source Side
715 36300 : SourceSideEffect = 1.0 - std::exp(-this->SourceSideUACoeff / (CpSourceSide * this->SourceSideWaterMassFlowRate));
716 :
717 : // main iteration loop to solve model equations
718 : while (true) {
719 617172 : ++IterationCount;
720 :
721 : // To determine Load Side temperature
722 326736 : LoadSideRefridgTemp = this->LoadSideWaterInletTemp - initialQLoad / (LoadSideEffect * CpLoadSide * this->LoadSideWaterMassFlowRate);
723 :
724 : // Determine Source Side tempertaure
725 326736 : SourceSideRefridgTemp =
726 326736 : this->SourceSideWaterInletTemp + initialQSource / (SourceSideEffect * CpSourceSide * this->SourceSideWaterMassFlowRate);
727 :
728 : // Determine the evaporating and condensing pressures
729 326736 : SourceSidePressure = FluidProperties::GetSatPressureRefrig(
730 326736 : state, GSHPRefrigerant, SourceSideRefridgTemp, state.dataHPWaterToWaterClg->GSHPRefrigIndex, RoutineName);
731 326736 : LoadSidePressure = FluidProperties::GetSatPressureRefrig(
732 326736 : state, GSHPRefrigerant, LoadSideRefridgTemp, state.dataHPWaterToWaterClg->GSHPRefrigIndex, RoutineName);
733 :
734 326736 : if (SourceSidePressure < this->LowPressCutoff) {
735 0 : ShowSevereError(state, ModuleCompName + "=\"" + this->Name + "\" Cooling Source Side Pressure Less than the Design Minimum");
736 0 : ShowContinueError(state,
737 0 : format("Cooling Source Side Pressure={:.2T} and user specified Design Minimum Pressure={:.2T}",
738 : SourceSidePressure,
739 0 : this->LowPressCutoff));
740 0 : ShowContinueErrorTimeStamp(state, "");
741 0 : ShowFatalError(state, "Preceding Conditions cause termination.");
742 : }
743 :
744 326736 : if (LoadSidePressure > this->HighPressCutoff) {
745 0 : ShowSevereError(state, ModuleCompName + "=\"" + this->Name + "\" Cooling Load Side Pressure greater than the Design Maximum");
746 0 : ShowContinueError(state,
747 0 : format("Cooling Load Side Pressure={:.2T} and user specified Design Maximum Pressure={:.2T}",
748 : LoadSidePressure,
749 0 : this->HighPressCutoff));
750 0 : ShowContinueErrorTimeStamp(state, "");
751 0 : ShowFatalError(state, "Preceding Conditions cause termination.");
752 : }
753 : // Determine Suction Pressure at compressor inlet
754 326736 : SuctionPr = LoadSidePressure - this->CompSucPressDrop;
755 : // Determine Discharge Pressure at compressor exit
756 326736 : DischargePr = SourceSidePressure + this->CompSucPressDrop;
757 :
758 326736 : if (SuctionPr < this->LowPressCutoff) {
759 0 : ShowSevereError(state, ModuleCompName + "=\"" + this->Name + "\" Cooling Suction Pressure Less than the Design Minimum");
760 0 : ShowContinueError(
761 0 : state, format("Cooling Suction Pressure={:.2T} and user specified Design Minimum Pressure={:.2T}", SuctionPr, this->LowPressCutoff));
762 0 : ShowContinueErrorTimeStamp(state, "");
763 0 : ShowFatalError(state, "Preceding Conditions cause termination.");
764 : }
765 :
766 326736 : if (DischargePr > this->HighPressCutoff) {
767 0 : ShowSevereError(state, ModuleCompName + "=\"" + this->Name + "\" Cooling Discharge Pressure greater than the Design Maximum");
768 0 : ShowContinueError(
769 : state,
770 0 : format("Cooling Discharge Pressure={:.2T} and user specified Design Maximum Pressure={:.2T}", DischargePr, this->HighPressCutoff));
771 0 : ShowContinueErrorTimeStamp(state, "");
772 0 : ShowFatalError(state, "Preceding Conditions cause termination.");
773 : }
774 :
775 : // Determine the Source Side Outlet Enthalpy
776 :
777 326736 : qual = 1.0;
778 326736 : LoadSideOutletEnth = FluidProperties::GetSatEnthalpyRefrig(
779 326736 : state, GSHPRefrigerant, LoadSideRefridgTemp, qual, state.dataHPWaterToWaterClg->GSHPRefrigIndex, RoutineNameLoadSideRefridgTemp);
780 :
781 326736 : qual = 0.0;
782 326736 : SourceSideOutletEnth = FluidProperties::GetSatEnthalpyRefrig(
783 326736 : state, GSHPRefrigerant, SourceSideRefridgTemp, qual, state.dataHPWaterToWaterClg->GSHPRefrigIndex, RoutineNameSourceSideRefridgTemp);
784 :
785 : // Determine Load Side Outlet Enthalpy
786 : // Determine superheated temperature of the LoadSide outlet/compressor inlet
787 326736 : CompressInletTemp = LoadSideRefridgTemp + this->SuperheatTemp;
788 :
789 : // Determine the enathalpy of the super heated fluid at Source Side outlet
790 326736 : SuperHeatEnth = FluidProperties::GetSupHeatEnthalpyRefrig(
791 326736 : state, GSHPRefrigerant, CompressInletTemp, LoadSidePressure, state.dataHPWaterToWaterClg->GSHPRefrigIndex, RoutineNameCompressInletTemp);
792 :
793 : // Determining the suction state of the fluid from inlet state involves interation
794 : // Method employed...
795 : // Determine the saturated temp at suction pressure, shoot out into the superheated region find the enthalpy
796 : // check that with the inlet enthalpy ( as suction loss is isenthalpic). Iterate till desired accuracy is reached
797 :
798 : // this routine was reenginerred from HVACsim + takes pressure in Pascals, tolrance, refrgerant # R22 =6
799 326736 : CompSuctionSatTemp = FluidProperties::GetSatTemperatureRefrig(
800 326736 : state, GSHPRefrigerant, SuctionPr, state.dataHPWaterToWaterClg->GSHPRefrigIndex, RoutineNameSuctionPr);
801 :
802 326736 : T110 = CompSuctionSatTemp;
803 : // Shoot into the super heated region
804 326736 : T111 = CompSuctionSatTemp + 100.0;
805 : // Iterate to find the Suction State
806 : while (true) {
807 5414856 : CompSuctionTemp = 0.5 * (T110 + T111);
808 :
809 2870796 : CompSuctionEnth = FluidProperties::GetSupHeatEnthalpyRefrig(
810 2870796 : state, GSHPRefrigerant, CompSuctionTemp, SuctionPr, state.dataHPWaterToWaterClg->GSHPRefrigIndex, RoutineNameCompSuctionTemp);
811 :
812 2870796 : if (std::abs(CompSuctionEnth - SuperHeatEnth) / SuperHeatEnth < 0.0001) {
813 326736 : goto LOOP_exit;
814 : }
815 :
816 2544060 : if (CompSuctionEnth < SuperHeatEnth) {
817 751076 : T110 = CompSuctionTemp;
818 : } else {
819 1792984 : T111 = CompSuctionTemp;
820 : }
821 : }
822 326736 : LOOP_exit:;
823 :
824 : // Determine the Mass flow rate of refrigerant
825 326736 : CompSuctionDensity = FluidProperties::GetSupHeatDensityRefrig(
826 326736 : state, GSHPRefrigerant, CompSuctionTemp, SuctionPr, state.dataHPWaterToWaterClg->GSHPRefrigIndex, RoutineNameCompSuctionTemp);
827 653472 : MassRef = this->CompPistonDisp * CompSuctionDensity *
828 326736 : (1 + this->CompClearanceFactor - this->CompClearanceFactor * std::pow(DischargePr / SuctionPr, 1 / gamma));
829 :
830 : // Find the Source Side Heat Transfer
831 :
832 326736 : this->QLoad = MassRef * (LoadSideOutletEnth - SourceSideOutletEnth);
833 :
834 : // Determine the theoretical power
835 653472 : this->Power = this->PowerLosses + (MassRef * gamma / (gamma - 1) * SuctionPr / CompSuctionDensity / this->LossFactor *
836 326736 : (std::pow(DischargePr / SuctionPr, (gamma - 1) / gamma) - 1));
837 :
838 : // Determine the Loadside HeatRate (this->QLoad)
839 326736 : this->QSource = this->Power + this->QLoad;
840 : // convergence and iteration limit check
841 326736 : if (std::abs((this->QSource - initialQSource) / (initialQSource + SmallNum)) < HeatBalTol || IterationCount > IterationLimit) {
842 36300 : if (IterationCount > IterationLimit) {
843 0 : ShowWarningError(state, "HeatPump:WaterToWater:ParameterEstimation, Cooling did not converge");
844 0 : ShowContinueErrorTimeStamp(state, "");
845 0 : ShowContinueError(state, "Heatpump Name = " + this->Name);
846 0 : ShowContinueError(
847 : state,
848 0 : format("Heat Inbalance (%) = {}", std::abs(100.0 * (this->QSource - initialQSource) / (initialQSource + SmallNum))));
849 0 : ShowContinueError(state, format("Load-side heat transfer rate = {}", this->QLoad));
850 0 : ShowContinueError(state, format("Source-side heat transfer rate = {}", this->QSource));
851 0 : ShowContinueError(state, format("Source-side mass flow rate = {}", this->SourceSideWaterMassFlowRate));
852 0 : ShowContinueError(state, format("Load-side mass flow rate = {}", this->LoadSideWaterMassFlowRate));
853 0 : ShowContinueError(state, format("Source-side inlet temperature = {}", this->SourceSideWaterInletTemp));
854 0 : ShowContinueError(state, format("Load-side inlet temperature = {}", this->LoadSideWaterInletTemp));
855 : }
856 36300 : goto LOOPSourceEnth_exit;
857 :
858 : } else { // update load
859 290436 : initialQSource += RelaxParam * (this->QSource - initialQSource);
860 290436 : initialQLoad += RelaxParam * (this->QLoad - initialQLoad);
861 : }
862 : }
863 36300 : LOOPSourceEnth_exit:;
864 :
865 : // Control Strategy
866 36300 : if (std::abs(MyLoad) < this->QLoad) {
867 36300 : DutyFactor = std::abs(MyLoad) / this->QLoad;
868 36300 : this->QLoad = std::abs(MyLoad);
869 36300 : this->Power *= DutyFactor;
870 36300 : this->QSource *= DutyFactor;
871 : // Determine the Exterior fluid temperature at the Load Side oulet and evaporator outlet...
872 36300 : this->LoadSideWaterOutletTemp = this->LoadSideWaterInletTemp - this->QLoad / (this->LoadSideWaterMassFlowRate * CpLoadSide); // Chilled water
873 36300 : this->SourceSideWaterOutletTemp =
874 36300 : this->SourceSideWaterInletTemp + this->QSource / (this->SourceSideWaterMassFlowRate * CpSourceSide); // cooling water
875 36300 : return;
876 : }
877 :
878 0 : this->LoadSideWaterOutletTemp = this->LoadSideWaterInletTemp - this->QLoad / (this->LoadSideWaterMassFlowRate * CpLoadSide); // Chilled water
879 0 : this->SourceSideWaterOutletTemp = this->SourceSideWaterInletTemp + this->QSource / (this->SourceSideWaterMassFlowRate * CpSourceSide);
880 0 : this->Running = 1;
881 : }
882 :
883 47583 : void GshpPeCoolingSpecs::update(EnergyPlusData &state)
884 : {
885 : // SUBROUTINE INFORMATION:
886 : // AUTHOR: Dan Fisher
887 : // DATE WRITTEN: October 1998
888 :
889 47583 : if (!this->MustRun) {
890 : // set node temperatures
891 11269 : state.dataLoopNodes->Node(this->SourceSideOutletNodeNum).Temp = state.dataLoopNodes->Node(this->SourceSideInletNodeNum).Temp;
892 11269 : state.dataLoopNodes->Node(this->LoadSideOutletNodeNum).Temp = state.dataLoopNodes->Node(this->LoadSideInletNodeNum).Temp;
893 11269 : this->Power = 0.0;
894 11269 : this->Energy = 0.0;
895 11269 : this->QSource = 0.0;
896 11269 : this->QLoad = 0.0;
897 11269 : this->QSourceEnergy = 0.0;
898 11269 : this->QLoadEnergy = 0.0;
899 11269 : this->SourceSideWaterInletTemp = state.dataLoopNodes->Node(this->SourceSideInletNodeNum).Temp;
900 11269 : this->SourceSideWaterOutletTemp = state.dataLoopNodes->Node(this->SourceSideOutletNodeNum).Temp;
901 11269 : this->LoadSideWaterInletTemp = state.dataLoopNodes->Node(this->LoadSideInletNodeNum).Temp;
902 11269 : this->LoadSideWaterOutletTemp = state.dataLoopNodes->Node(this->LoadSideOutletNodeNum).Temp;
903 :
904 : } else {
905 : // set node temperatures
906 36314 : state.dataLoopNodes->Node(this->LoadSideOutletNodeNum).Temp = this->LoadSideWaterOutletTemp;
907 36314 : state.dataLoopNodes->Node(this->SourceSideOutletNodeNum).Temp = this->SourceSideWaterOutletTemp;
908 :
909 : // set node flow rates; for these load based models
910 : // assume that the sufficient Source Side flow rate available
911 :
912 36314 : Real64 const ReportingConstant = state.dataHVACGlobal->TimeStepSys * DataGlobalConstants::SecInHour;
913 :
914 36314 : this->Energy = this->Power * ReportingConstant;
915 36314 : this->QSourceEnergy = QSource * ReportingConstant;
916 36314 : this->QLoadEnergy = QLoad * ReportingConstant;
917 36314 : this->SourceSideWaterInletTemp = state.dataLoopNodes->Node(this->SourceSideInletNodeNum).Temp;
918 36314 : this->LoadSideWaterInletTemp = state.dataLoopNodes->Node(this->LoadSideInletNodeNum).Temp;
919 : }
920 47583 : }
921 0 : void GshpPeCoolingSpecs::oneTimeInit([[maybe_unused]] EnergyPlusData &state)
922 : {
923 0 : }
924 3 : void GshpPeCoolingSpecs::oneTimeInit_new([[maybe_unused]] EnergyPlusData &state)
925 : {
926 3 : }
927 :
928 2313 : } // namespace EnergyPlus::HeatPumpWaterToWaterCOOLING
|