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 : // EnergyPlus Headers
52 : #include <EnergyPlus/Autosizing/Base.hh>
53 : #include <EnergyPlus/BranchNodeConnections.hh>
54 : #include <EnergyPlus/CurveManager.hh>
55 : #include <EnergyPlus/Data/EnergyPlusData.hh>
56 : #include <EnergyPlus/DataEnvironment.hh>
57 : #include <EnergyPlus/DataHVACGlobals.hh>
58 : #include <EnergyPlus/DataIPShortCuts.hh>
59 : #include <EnergyPlus/DataLoopNode.hh>
60 : #include <EnergyPlus/DataSizing.hh>
61 : #include <EnergyPlus/FluidProperties.hh>
62 : #include <EnergyPlus/General.hh>
63 : #include <EnergyPlus/GlobalNames.hh>
64 : #include <EnergyPlus/HeatPumpWaterToWaterSimple.hh>
65 : #include <EnergyPlus/InputProcessing/InputProcessor.hh>
66 : #include <EnergyPlus/NodeInputManager.hh>
67 : #include <EnergyPlus/OutputProcessor.hh>
68 : #include <EnergyPlus/OutputReportPredefined.hh>
69 : #include <EnergyPlus/Plant/DataPlant.hh>
70 : #include <EnergyPlus/Plant/PlantLocation.hh>
71 : #include <EnergyPlus/PlantComponent.hh>
72 : #include <EnergyPlus/PlantUtilities.hh>
73 : #include <EnergyPlus/UtilityRoutines.hh>
74 :
75 : namespace EnergyPlus::HeatPumpWaterToWaterSimple {
76 :
77 : // MODULE INFORMATION:
78 : // AUTHOR Kenneth Tang
79 : // DATE WRITTEN March 2005
80 : // MODIFIED Brent Griffith, plant upgrades, fluid properties
81 : // RE-ENGINEERED na
82 :
83 : // PURPOSE OF THIS MODULE:
84 : // This module simulates a Water-to-Water Heat Pump Simple (Equation-Fit Model)
85 :
86 : // METHODOLOGY EMPLOYED:
87 : // This simulation is based on a set of coefficients in quadlinear curves generated from
88 : // the manufacturer catalog data using the generalized least square method
89 :
90 : // REFERENCES:
91 : // (1) Tang,C.C.. 2005. Modeling Packaged Heat Pumps in a Quasi-Steady
92 : // State Energy Simulation Program. M.S. Thesis, Department of Mechanical and Aerospace Engineering,
93 : // Oklahoma State University. (downloadable from http://www.hvac.okstate.edu/)
94 : // (2) Murugappan, Arun. 2002. Implementing Ground Source Heat Pump and Ground
95 : // Loop Heat Exchanger Models in the EnergyPlus Simulation Environment,
96 : // M.S. Thesis, Department of Mechanical and Aerospace Engineering,
97 : // Oklahoma State University. (downloadable from http://www.hvac.okstate.edu/)
98 :
99 : // OTHER NOTES: none
100 :
101 : // USE STATEMENTS:
102 : // Use statements for data only modules
103 : // Using/Aliasing
104 : using namespace DataLoopNode;
105 :
106 : // MODULE PARAMETER DEFINITIONS
107 771 : std::string const HPEqFitHeating("HeatPump:WatertoWater:EquationFit:Heating");
108 771 : std::string const HPEqFitHeatingUC("HEATPUMP:WATERTOWATER:EQUATIONFIT:HEATING");
109 771 : std::string const HPEqFitCooling("HeatPump:WatertoWater:EquationFit:Cooling");
110 771 : std::string const HPEqFitCoolingUC("HEATPUMP:WATERTOWATER:EQUATIONFIT:COOLING");
111 :
112 8 : PlantComponent *GshpSpecs::factory(EnergyPlusData &state, DataPlant::PlantEquipmentType wwhp_type, std::string eir_wwhp_name)
113 : {
114 8 : if (state.dataHPWaterToWaterSimple->GetInputFlag) {
115 2 : GshpSpecs::GetWatertoWaterHPInput(state);
116 2 : state.dataHPWaterToWaterSimple->GetInputFlag = false;
117 : }
118 :
119 12 : for (auto &wwhp : state.dataHPWaterToWaterSimple->GSHP) {
120 12 : if (wwhp.Name == eir_wwhp_name && wwhp.WWHPType == wwhp_type) {
121 8 : return &wwhp;
122 : }
123 : }
124 :
125 0 : ShowFatalError(state, "EquationFit_WWHP factory: Error getting inputs for wwhp named: " + eir_wwhp_name);
126 0 : return nullptr;
127 : }
128 :
129 136234 : void GshpSpecs::simulate(EnergyPlusData &state,
130 : const PlantLocation &calledFromLocation,
131 : bool const FirstHVACIteration,
132 : Real64 &CurLoad,
133 : [[maybe_unused]] bool const RunFlag)
134 : {
135 136234 : if (this->WWHPType == DataPlant::PlantEquipmentType::HPWaterEFCooling) {
136 68117 : if (calledFromLocation.loopNum == this->LoadPlantLoc.loopNum) { // chilled water loop
137 34059 : this->InitWatertoWaterHP(state, this->WWHPType, this->Name, FirstHVACIteration, CurLoad);
138 34059 : this->CalcWatertoWaterHPCooling(state, CurLoad);
139 34059 : this->UpdateGSHPRecords(state);
140 34058 : } else if (calledFromLocation.loopNum == this->SourcePlantLoc.loopNum) { // condenser loop
141 34058 : PlantUtilities::UpdateChillerComponentCondenserSide(state,
142 : this->SourcePlantLoc.loopNum,
143 : this->SourcePlantLoc.loopSideNum,
144 : DataPlant::PlantEquipmentType::HPWaterEFCooling,
145 : this->SourceSideInletNodeNum,
146 : this->SourceSideOutletNodeNum,
147 : this->reportQSource,
148 : this->reportSourceSideInletTemp,
149 : this->reportSourceSideOutletTemp,
150 : this->reportSourceSideMassFlowRate,
151 : FirstHVACIteration);
152 : } else {
153 0 : ShowFatalError(state, "SimHPWatertoWaterSimple:: Invalid loop connection " + HPEqFitCooling + ", Requested Unit=" + this->Name);
154 : }
155 68117 : } else if (this->WWHPType == DataPlant::PlantEquipmentType::HPWaterEFHeating) {
156 68117 : if (calledFromLocation.loopNum == this->LoadPlantLoc.loopNum) { // chilled water loop
157 34059 : this->InitWatertoWaterHP(state, this->WWHPType, this->Name, FirstHVACIteration, CurLoad);
158 34059 : this->CalcWatertoWaterHPHeating(state, CurLoad);
159 34059 : this->UpdateGSHPRecords(state);
160 34058 : } else if (calledFromLocation.loopNum == this->SourcePlantLoc.loopNum) { // condenser loop
161 68116 : PlantUtilities::UpdateChillerComponentCondenserSide(state,
162 : this->SourcePlantLoc.loopNum,
163 : this->SourcePlantLoc.loopSideNum,
164 : DataPlant::PlantEquipmentType::HPWaterEFHeating,
165 : this->SourceSideInletNodeNum,
166 : this->SourceSideOutletNodeNum,
167 34058 : -this->reportQSource,
168 : this->reportSourceSideInletTemp,
169 : this->reportSourceSideOutletTemp,
170 : this->reportSourceSideMassFlowRate,
171 : FirstHVACIteration);
172 : } else {
173 0 : ShowFatalError(state, "SimHPWatertoWaterSimple:: Invalid loop connection " + HPEqFitCooling + ", Requested Unit=" + this->Name);
174 : }
175 : } else {
176 0 : ShowFatalError(state, "SimHPWatertoWaterSimple: Module called with incorrect GSHPType");
177 : } // TypeOfEquip
178 136234 : }
179 :
180 40 : void GshpSpecs::onInitLoopEquip(EnergyPlusData &state, [[maybe_unused]] const PlantLocation &calledFromLocation)
181 : {
182 40 : bool initFirstHVAC = true;
183 40 : Real64 initCurLoad = 0.0;
184 :
185 40 : this->InitWatertoWaterHP(state, this->WWHPType, this->Name, initFirstHVAC, initCurLoad);
186 40 : if (this->WWHPType == DataPlant::PlantEquipmentType::HPWaterEFCooling) {
187 20 : this->sizeCoolingWaterToWaterHP(state);
188 20 : } else if (this->WWHPType == DataPlant::PlantEquipmentType::HPWaterEFHeating) {
189 20 : this->sizeHeatingWaterToWaterHP(state);
190 : }
191 40 : }
192 :
193 40 : void GshpSpecs::getDesignCapacities(EnergyPlusData &state, const PlantLocation &calledFromLocation, Real64 &MaxLoad, Real64 &MinLoad, Real64 &OptLoad)
194 : {
195 40 : if (calledFromLocation.loopNum == this->LoadPlantLoc.loopNum) {
196 20 : if (this->WWHPType == DataPlant::PlantEquipmentType::HPWaterEFCooling) {
197 10 : MinLoad = 0.0;
198 10 : MaxLoad = this->RatedCapCool;
199 10 : OptLoad = this->RatedCapCool;
200 10 : } else if (this->WWHPType == DataPlant::PlantEquipmentType::HPWaterEFHeating) {
201 10 : MinLoad = 0.0;
202 10 : MaxLoad = this->RatedCapHeat;
203 10 : OptLoad = this->RatedCapHeat;
204 : } else {
205 0 : ShowFatalError(state, "SimHPWatertoWaterSimple: Module called with incorrect GSHPType");
206 : }
207 : } else {
208 20 : MinLoad = 0.0;
209 20 : MaxLoad = 0.0;
210 20 : OptLoad = 0.0;
211 : }
212 40 : }
213 :
214 8 : void GshpSpecs::getSizingFactor(Real64 &sizingFactor)
215 : {
216 8 : sizingFactor = this->sizFac;
217 8 : }
218 :
219 2 : void GshpSpecs::GetWatertoWaterHPInput(EnergyPlusData &state)
220 : {
221 :
222 : // SUBROUTINE INFORMATION:
223 : // AUTHOR Kenneth Tang
224 : // DATE WRITTEN March 2005
225 : // MODIFIED
226 : // RE-ENGINEERED na
227 :
228 : // PURPOSE OF THIS SUBROUTINE:
229 : // Obtain input from IDF and store them in data structures
230 :
231 : // Using/Aliasing
232 : using BranchNodeConnections::TestCompSet;
233 : using Curve::GetCurveIndex;
234 : using NodeInputManager::GetOnlySingleNode;
235 : using PlantUtilities::RegisterPlantCompDesignFlow;
236 :
237 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
238 : int GSHPNum; // GSHP number
239 : int HPNum; // Counter
240 : int NumCoolCoil; // Number of Cooling Coils
241 : int NumHeatCoil; // Number of Heating Coils
242 : int NumAlphas; // Number of elements in the alpha array
243 : int NumNums; // Number of elements in the numeric array
244 : int IOStat; // IO Status when calling get input subroutine
245 :
246 2 : bool ErrorsFound(false);
247 :
248 2 : NumCoolCoil = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, HPEqFitCoolingUC);
249 2 : NumHeatCoil = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, HPEqFitHeatingUC);
250 2 : state.dataHPWaterToWaterSimple->NumGSHPs = NumCoolCoil + NumHeatCoil;
251 :
252 2 : if (state.dataHPWaterToWaterSimple->NumGSHPs <= 0) {
253 0 : ShowSevereError(state, "GetEquationFitWaterToWater Input: No Equipment found");
254 0 : ErrorsFound = true;
255 : }
256 :
257 2 : if (state.dataHPWaterToWaterSimple->NumGSHPs > 0) {
258 2 : state.dataHPWaterToWaterSimple->GSHP.allocate(state.dataHPWaterToWaterSimple->NumGSHPs);
259 2 : state.dataHPWaterToWaterSimple->HeatPumpWaterUniqueNames.reserve(state.dataHPWaterToWaterSimple->NumGSHPs);
260 : }
261 :
262 : // Load data structure for cooling coil
263 4 : for (HPNum = 1; HPNum <= NumCoolCoil; ++HPNum) {
264 :
265 2 : GSHPNum = HPNum;
266 :
267 10 : state.dataInputProcessing->inputProcessor->getObjectItem(state,
268 : HPEqFitCoolingUC,
269 : HPNum,
270 2 : state.dataIPShortCut->cAlphaArgs,
271 : NumAlphas,
272 2 : state.dataIPShortCut->rNumericArgs,
273 : NumNums,
274 : IOStat,
275 2 : state.dataIPShortCut->lNumericFieldBlanks,
276 2 : state.dataIPShortCut->lAlphaFieldBlanks);
277 2 : GlobalNames::VerifyUniqueInterObjectName(
278 2 : state, state.dataHPWaterToWaterSimple->HeatPumpWaterUniqueNames, state.dataIPShortCut->cAlphaArgs(1), HPEqFitCoolingUC, ErrorsFound);
279 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).WWHPType = DataPlant::PlantEquipmentType::HPWaterEFCooling;
280 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name = state.dataIPShortCut->cAlphaArgs(1);
281 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedLoadVolFlowCool = state.dataIPShortCut->rNumericArgs(1);
282 2 : if (state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedLoadVolFlowCool == DataSizing::AutoSize) {
283 1 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).ratedLoadVolFlowCoolWasAutoSized = true;
284 : }
285 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedSourceVolFlowCool = state.dataIPShortCut->rNumericArgs(2);
286 2 : if (state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedSourceVolFlowCool == DataSizing::AutoSize) {
287 1 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).ratedSourceVolFlowCoolWasAutoSized = true;
288 : }
289 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedCapCool = state.dataIPShortCut->rNumericArgs(3);
290 2 : if (state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedCapCool == DataSizing::AutoSize) {
291 1 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).ratedCapCoolWasAutoSized = true;
292 : }
293 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedPowerCool = state.dataIPShortCut->rNumericArgs(4);
294 2 : if (state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedPowerCool == DataSizing::AutoSize) {
295 1 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).ratedPowerCoolWasAutoSized = true;
296 : }
297 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).CoolCapCurveIndex = GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(6));
298 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).CoolPowCurveIndex = GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(7));
299 2 : if (state.dataHPWaterToWaterSimple->GSHP(GSHPNum).CoolCapCurveIndex > 0) {
300 6 : ErrorsFound |= Curve::CheckCurveDims(state,
301 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).CoolCapCurveIndex,
302 : {4},
303 : "GetWatertoWaterHPInput",
304 : HPEqFitCoolingUC,
305 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name,
306 4 : "Cooling Capacity Curve Name");
307 : }
308 2 : if (state.dataHPWaterToWaterSimple->GSHP(GSHPNum).CoolPowCurveIndex > 0) {
309 6 : ErrorsFound |= Curve::CheckCurveDims(state,
310 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).CoolPowCurveIndex,
311 : {4},
312 : "GetWatertoWaterHPInput",
313 : HPEqFitCoolingUC,
314 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name,
315 4 : "Cooling Compressor Power Curve Name");
316 : }
317 :
318 2 : if (NumNums > 4) {
319 1 : if (!state.dataIPShortCut->lNumericFieldBlanks(5)) {
320 1 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).refCOP = state.dataIPShortCut->rNumericArgs(5);
321 : } else {
322 0 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).refCOP = 8.0;
323 : }
324 :
325 : } else {
326 1 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).refCOP = 8.0;
327 : }
328 :
329 : // calculate reference COP if hard sized
330 5 : if (!state.dataHPWaterToWaterSimple->GSHP(GSHPNum).ratedPowerCoolWasAutoSized &&
331 3 : !state.dataHPWaterToWaterSimple->GSHP(GSHPNum).ratedCapCoolWasAutoSized &&
332 1 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedPowerCool > 0.0) {
333 1 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).refCOP =
334 1 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedCapCool / state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedPowerCool;
335 : }
336 :
337 2 : if (NumNums > 5) {
338 1 : if (!state.dataIPShortCut->lNumericFieldBlanks(6)) {
339 1 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).sizFac = state.dataIPShortCut->rNumericArgs(6);
340 : } else {
341 0 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).sizFac = 1.0;
342 : }
343 : } else {
344 1 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).sizFac = 1.0;
345 : }
346 :
347 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).SourceSideInletNodeNum =
348 4 : GetOnlySingleNode(state,
349 2 : state.dataIPShortCut->cAlphaArgs(2),
350 : ErrorsFound,
351 : DataLoopNode::ConnectionObjectType::HeatPumpWaterToWaterEquationFitCooling,
352 2 : state.dataIPShortCut->cAlphaArgs(1),
353 : DataLoopNode::NodeFluidType::Water,
354 : DataLoopNode::ConnectionType::Inlet,
355 : NodeInputManager::CompFluidStream::Primary,
356 2 : ObjectIsNotParent);
357 :
358 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).SourceSideOutletNodeNum =
359 4 : GetOnlySingleNode(state,
360 2 : state.dataIPShortCut->cAlphaArgs(3),
361 : ErrorsFound,
362 : DataLoopNode::ConnectionObjectType::HeatPumpWaterToWaterEquationFitCooling,
363 2 : state.dataIPShortCut->cAlphaArgs(1),
364 : DataLoopNode::NodeFluidType::Water,
365 : DataLoopNode::ConnectionType::Outlet,
366 : NodeInputManager::CompFluidStream::Primary,
367 2 : ObjectIsNotParent);
368 :
369 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).LoadSideInletNodeNum =
370 4 : GetOnlySingleNode(state,
371 2 : state.dataIPShortCut->cAlphaArgs(4),
372 : ErrorsFound,
373 : DataLoopNode::ConnectionObjectType::HeatPumpWaterToWaterEquationFitCooling,
374 2 : state.dataIPShortCut->cAlphaArgs(1),
375 : DataLoopNode::NodeFluidType::Water,
376 : DataLoopNode::ConnectionType::Inlet,
377 : NodeInputManager::CompFluidStream::Secondary,
378 2 : ObjectIsNotParent);
379 :
380 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).LoadSideOutletNodeNum =
381 4 : GetOnlySingleNode(state,
382 2 : state.dataIPShortCut->cAlphaArgs(5),
383 : ErrorsFound,
384 : DataLoopNode::ConnectionObjectType::HeatPumpWaterToWaterEquationFitCooling,
385 2 : state.dataIPShortCut->cAlphaArgs(1),
386 : DataLoopNode::NodeFluidType::Water,
387 : DataLoopNode::ConnectionType::Outlet,
388 : NodeInputManager::CompFluidStream::Secondary,
389 2 : ObjectIsNotParent);
390 :
391 : // Test node sets
392 4 : TestCompSet(state,
393 : HPEqFitCoolingUC,
394 2 : state.dataIPShortCut->cAlphaArgs(1),
395 2 : state.dataIPShortCut->cAlphaArgs(2),
396 2 : state.dataIPShortCut->cAlphaArgs(3),
397 : "Condenser Water Nodes");
398 4 : TestCompSet(state,
399 : HPEqFitCoolingUC,
400 2 : state.dataIPShortCut->cAlphaArgs(1),
401 2 : state.dataIPShortCut->cAlphaArgs(4),
402 2 : state.dataIPShortCut->cAlphaArgs(5),
403 : "Chilled Water Nodes");
404 :
405 2 : if (NumAlphas > 7 && !state.dataIPShortCut->lAlphaFieldBlanks(8)) {
406 1 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).companionName = state.dataIPShortCut->cAlphaArgs(8);
407 : }
408 :
409 : // CurrentModuleObject='HeatPump:WatertoWater:EquationFit:Cooling'
410 8 : SetupOutputVariable(state,
411 : "Heat Pump Electricity Energy",
412 : OutputProcessor::Unit::J,
413 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).reportEnergy,
414 : OutputProcessor::SOVTimeStepType::System,
415 : OutputProcessor::SOVStoreType::Summed,
416 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name,
417 : _,
418 : "Electricity",
419 : "Cooling",
420 : _,
421 2 : "Plant");
422 8 : SetupOutputVariable(state,
423 : "Heat Pump Load Side Heat Transfer Energy",
424 : OutputProcessor::Unit::J,
425 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).reportQLoadEnergy,
426 : OutputProcessor::SOVTimeStepType::System,
427 : OutputProcessor::SOVStoreType::Summed,
428 4 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name);
429 8 : SetupOutputVariable(state,
430 : "Heat Pump Source Side Heat Transfer Energy",
431 : OutputProcessor::Unit::J,
432 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).reportQSourceEnergy,
433 : OutputProcessor::SOVTimeStepType::System,
434 : OutputProcessor::SOVStoreType::Summed,
435 4 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name);
436 : }
437 :
438 : // Load data structure for heating coil
439 4 : for (HPNum = 1; HPNum <= NumHeatCoil; ++HPNum) {
440 :
441 2 : GSHPNum = NumCoolCoil + HPNum;
442 :
443 10 : state.dataInputProcessing->inputProcessor->getObjectItem(state,
444 : HPEqFitHeatingUC,
445 : HPNum,
446 2 : state.dataIPShortCut->cAlphaArgs,
447 : NumAlphas,
448 2 : state.dataIPShortCut->rNumericArgs,
449 : NumNums,
450 : IOStat,
451 2 : state.dataIPShortCut->lNumericFieldBlanks,
452 2 : state.dataIPShortCut->lAlphaFieldBlanks);
453 2 : GlobalNames::VerifyUniqueInterObjectName(
454 2 : state, state.dataHPWaterToWaterSimple->HeatPumpWaterUniqueNames, state.dataIPShortCut->cAlphaArgs(1), HPEqFitHeatingUC, ErrorsFound);
455 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).WWHPType = DataPlant::PlantEquipmentType::HPWaterEFHeating;
456 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name = state.dataIPShortCut->cAlphaArgs(1);
457 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedLoadVolFlowHeat = state.dataIPShortCut->rNumericArgs(1);
458 2 : if (state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedLoadVolFlowHeat == DataSizing::AutoSize) {
459 1 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).ratedLoadVolFlowHeatWasAutoSized = true;
460 : }
461 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedSourceVolFlowHeat = state.dataIPShortCut->rNumericArgs(2);
462 2 : if (state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedSourceVolFlowHeat == DataSizing::AutoSize) {
463 1 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).ratedSourceVolFlowHeatWasAutoSized = true;
464 : }
465 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedCapHeat = state.dataIPShortCut->rNumericArgs(3);
466 2 : if (state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedCapHeat == DataSizing::AutoSize) {
467 1 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).ratedCapHeatWasAutoSized = true;
468 : }
469 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedPowerHeat = state.dataIPShortCut->rNumericArgs(4);
470 2 : if (state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedPowerHeat == DataSizing::AutoSize) {
471 1 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).ratedPowerHeatWasAutoSized = true;
472 : }
473 :
474 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).HeatCapCurveIndex = GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(6));
475 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).HeatPowCurveIndex = GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(7));
476 2 : if (state.dataHPWaterToWaterSimple->GSHP(GSHPNum).HeatCapCurveIndex > 0) {
477 6 : ErrorsFound |= Curve::CheckCurveDims(state,
478 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).HeatCapCurveIndex,
479 : {4},
480 : "GetWatertoWaterHPInput",
481 : HPEqFitHeatingUC,
482 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name,
483 4 : "Heating Capacity Curve Name");
484 : }
485 2 : if (state.dataHPWaterToWaterSimple->GSHP(GSHPNum).HeatPowCurveIndex > 0) {
486 6 : ErrorsFound |= Curve::CheckCurveDims(state,
487 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).HeatPowCurveIndex,
488 : {4},
489 : "GetWatertoWaterHPInput",
490 : HPEqFitHeatingUC,
491 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name,
492 4 : "Heating Compressor Power Curve Name");
493 : }
494 2 : if (NumNums > 4) {
495 1 : if (!state.dataIPShortCut->lNumericFieldBlanks(5)) {
496 1 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).refCOP = state.dataIPShortCut->rNumericArgs(5);
497 : } else {
498 0 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).refCOP = 7.5;
499 : }
500 :
501 : } else {
502 1 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).refCOP = 7.5;
503 : }
504 :
505 : // calculate reference COP if hard sized
506 5 : if (!state.dataHPWaterToWaterSimple->GSHP(GSHPNum).ratedPowerHeatWasAutoSized &&
507 3 : !state.dataHPWaterToWaterSimple->GSHP(GSHPNum).ratedCapHeatWasAutoSized &&
508 1 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedPowerHeat > 0.0) {
509 1 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).refCOP =
510 1 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedCapHeat / state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedPowerHeat;
511 : }
512 :
513 2 : if (NumNums > 5) {
514 1 : if (!state.dataIPShortCut->lNumericFieldBlanks(6)) {
515 1 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).sizFac = state.dataIPShortCut->rNumericArgs(6);
516 : } else {
517 0 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).sizFac = 1.0;
518 : }
519 : } else {
520 1 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).sizFac = 1.0;
521 : }
522 :
523 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).SourceSideInletNodeNum =
524 4 : GetOnlySingleNode(state,
525 2 : state.dataIPShortCut->cAlphaArgs(2),
526 : ErrorsFound,
527 : DataLoopNode::ConnectionObjectType::HeatPumpWaterToWaterEquationFitHeating,
528 2 : state.dataIPShortCut->cAlphaArgs(1),
529 : DataLoopNode::NodeFluidType::Water,
530 : DataLoopNode::ConnectionType::Inlet,
531 : NodeInputManager::CompFluidStream::Primary,
532 2 : ObjectIsNotParent);
533 :
534 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).SourceSideOutletNodeNum =
535 4 : GetOnlySingleNode(state,
536 2 : state.dataIPShortCut->cAlphaArgs(3),
537 : ErrorsFound,
538 : DataLoopNode::ConnectionObjectType::HeatPumpWaterToWaterEquationFitHeating,
539 2 : state.dataIPShortCut->cAlphaArgs(1),
540 : DataLoopNode::NodeFluidType::Water,
541 : DataLoopNode::ConnectionType::Outlet,
542 : NodeInputManager::CompFluidStream::Primary,
543 2 : ObjectIsNotParent);
544 :
545 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).LoadSideInletNodeNum =
546 4 : GetOnlySingleNode(state,
547 2 : state.dataIPShortCut->cAlphaArgs(4),
548 : ErrorsFound,
549 : DataLoopNode::ConnectionObjectType::HeatPumpWaterToWaterEquationFitHeating,
550 2 : state.dataIPShortCut->cAlphaArgs(1),
551 : DataLoopNode::NodeFluidType::Water,
552 : DataLoopNode::ConnectionType::Inlet,
553 : NodeInputManager::CompFluidStream::Secondary,
554 2 : ObjectIsNotParent);
555 :
556 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).LoadSideOutletNodeNum =
557 4 : GetOnlySingleNode(state,
558 2 : state.dataIPShortCut->cAlphaArgs(5),
559 : ErrorsFound,
560 : DataLoopNode::ConnectionObjectType::HeatPumpWaterToWaterEquationFitHeating,
561 2 : state.dataIPShortCut->cAlphaArgs(1),
562 : DataLoopNode::NodeFluidType::Water,
563 : DataLoopNode::ConnectionType::Outlet,
564 : NodeInputManager::CompFluidStream::Secondary,
565 2 : ObjectIsNotParent);
566 :
567 2 : if (NumAlphas > 7 && !state.dataIPShortCut->lAlphaFieldBlanks(8)) {
568 1 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).companionName = state.dataIPShortCut->cAlphaArgs(8);
569 : }
570 :
571 : // Test node sets
572 4 : TestCompSet(state,
573 : HPEqFitHeatingUC,
574 2 : state.dataIPShortCut->cAlphaArgs(1),
575 2 : state.dataIPShortCut->cAlphaArgs(2),
576 2 : state.dataIPShortCut->cAlphaArgs(3),
577 : "Condenser Water Nodes");
578 4 : TestCompSet(state,
579 : HPEqFitHeatingUC,
580 2 : state.dataIPShortCut->cAlphaArgs(1),
581 2 : state.dataIPShortCut->cAlphaArgs(4),
582 2 : state.dataIPShortCut->cAlphaArgs(5),
583 : "Hot Water Nodes");
584 :
585 : // CurrentModuleObject='HeatPump:WatertoWater:EquationFit:Heating'
586 8 : SetupOutputVariable(state,
587 : "Heat Pump Electricity Energy",
588 : OutputProcessor::Unit::J,
589 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).reportEnergy,
590 : OutputProcessor::SOVTimeStepType::System,
591 : OutputProcessor::SOVStoreType::Summed,
592 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name,
593 : _,
594 : "Electricity",
595 : "Heating",
596 : _,
597 2 : "Plant");
598 8 : SetupOutputVariable(state,
599 : "Heat Pump Load Side Heat Transfer Energy",
600 : OutputProcessor::Unit::J,
601 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).reportQLoadEnergy,
602 : OutputProcessor::SOVTimeStepType::System,
603 : OutputProcessor::SOVStoreType::Summed,
604 4 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name);
605 8 : SetupOutputVariable(state,
606 : "Heat Pump Source Side Heat Transfer Energy",
607 : OutputProcessor::Unit::J,
608 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).reportQSourceEnergy,
609 : OutputProcessor::SOVTimeStepType::System,
610 : OutputProcessor::SOVStoreType::Summed,
611 4 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name);
612 : }
613 :
614 : // now process companion coils, if any
615 6 : for (GSHPNum = 1; GSHPNum <= state.dataHPWaterToWaterSimple->NumGSHPs; ++GSHPNum) {
616 4 : if (!state.dataHPWaterToWaterSimple->GSHP(GSHPNum).companionName.empty()) {
617 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).companionIndex =
618 2 : UtilityRoutines::FindItemInList(state.dataHPWaterToWaterSimple->GSHP(GSHPNum).companionName, state.dataHPWaterToWaterSimple->GSHP);
619 2 : if (state.dataHPWaterToWaterSimple->GSHP(GSHPNum).companionIndex == 0) {
620 0 : ShowSevereError(state,
621 0 : "GetEquationFitWaterToWater Input: did not find companion heat pump named '" +
622 0 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).companionName + "' in heat pump called " +
623 0 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name);
624 0 : ErrorsFound = true;
625 : } else {
626 2 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).companionIdentified = true;
627 : }
628 : }
629 : }
630 :
631 2 : if (ErrorsFound) {
632 0 : ShowFatalError(state, "Errors found in processing input for Water to Water Heat Pumps");
633 : }
634 :
635 6 : for (GSHPNum = 1; GSHPNum <= state.dataHPWaterToWaterSimple->NumGSHPs; ++GSHPNum) {
636 : // setup output variables
637 16 : SetupOutputVariable(state,
638 : "Heat Pump Electricity Rate",
639 : OutputProcessor::Unit::W,
640 4 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).reportPower,
641 : OutputProcessor::SOVTimeStepType::System,
642 : OutputProcessor::SOVStoreType::Average,
643 8 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name);
644 16 : SetupOutputVariable(state,
645 : "Heat Pump Load Side Heat Transfer Rate",
646 : OutputProcessor::Unit::W,
647 4 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).reportQLoad,
648 : OutputProcessor::SOVTimeStepType::System,
649 : OutputProcessor::SOVStoreType::Average,
650 8 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name);
651 16 : SetupOutputVariable(state,
652 : "Heat Pump Source Side Heat Transfer Rate",
653 : OutputProcessor::Unit::W,
654 4 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).reportQSource,
655 : OutputProcessor::SOVTimeStepType::System,
656 : OutputProcessor::SOVStoreType::Average,
657 8 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name);
658 16 : SetupOutputVariable(state,
659 : "Heat Pump Load Side Outlet Temperature",
660 : OutputProcessor::Unit::C,
661 4 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).reportLoadSideOutletTemp,
662 : OutputProcessor::SOVTimeStepType::System,
663 : OutputProcessor::SOVStoreType::Average,
664 8 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name);
665 16 : SetupOutputVariable(state,
666 : "Heat Pump Load Side Inlet Temperature",
667 : OutputProcessor::Unit::C,
668 4 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).reportLoadSideInletTemp,
669 : OutputProcessor::SOVTimeStepType::System,
670 : OutputProcessor::SOVStoreType::Average,
671 8 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name);
672 16 : SetupOutputVariable(state,
673 : "Heat Pump Source Side Outlet Temperature",
674 : OutputProcessor::Unit::C,
675 4 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).reportSourceSideOutletTemp,
676 : OutputProcessor::SOVTimeStepType::System,
677 : OutputProcessor::SOVStoreType::Average,
678 8 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name);
679 16 : SetupOutputVariable(state,
680 : "Heat Pump Source Side Inlet Temperature",
681 : OutputProcessor::Unit::C,
682 4 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).reportSourceSideInletTemp,
683 : OutputProcessor::SOVTimeStepType::System,
684 : OutputProcessor::SOVStoreType::Average,
685 8 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name);
686 16 : SetupOutputVariable(state,
687 : "Heat Pump Load Side Mass Flow Rate",
688 : OutputProcessor::Unit::kg_s,
689 4 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).reportLoadSideMassFlowRate,
690 : OutputProcessor::SOVTimeStepType::System,
691 : OutputProcessor::SOVStoreType::Average,
692 8 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name);
693 16 : SetupOutputVariable(state,
694 : "Heat Pump Source Side Mass Flow Rate",
695 : OutputProcessor::Unit::kg_s,
696 4 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).reportSourceSideMassFlowRate,
697 : OutputProcessor::SOVTimeStepType::System,
698 : OutputProcessor::SOVStoreType::Average,
699 8 : state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name);
700 : }
701 2 : }
702 :
703 68158 : void GshpSpecs::InitWatertoWaterHP(EnergyPlusData &state,
704 : DataPlant::PlantEquipmentType const GSHPTypeNum, // Type of GSHP
705 : [[maybe_unused]] std::string const &GSHPName, // User Specified Name of GSHP
706 : [[maybe_unused]] bool const FirstHVACIteration,
707 : Real64 const MyLoad // Demand Load
708 : )
709 : {
710 :
711 : // SUBROUTINE INFORMATION:
712 : // AUTHOR Kenneth Tang
713 : // DATE WRITTEN March 2005
714 : // MODIFIED
715 : // RE-ENGINEERED
716 :
717 : // PURPOSE OF THIS SUBROUTINE:
718 : // This subroutine is for initializations of the Water-to-Water HP Simple
719 :
720 : // METHODOLOGY EMPLOYED:
721 : // Uses the status flags to trigger initializations.
722 :
723 : // REFERENCES:
724 : // (1) Tang,C.C.. 2005. Modeling Packaged Heat Pumps in a Quasi-Steady
725 : // State Energy Simulation Program. M.S. Thesis, Department of Mechanical and Aerospace Engineering,
726 : // Oklahoma State University. (downloadable from http://www.hvac.okstate.edu/)
727 : // (2) Murugappan, Arun. 2002. Implementing Ground Source Heat Pump and Ground
728 : // Loop Heat Exchanger Models in the EnergyPlus Simulation Environment,
729 : // M.S. Thesis, Department of Mechanical and Aerospace Engineering,
730 : // Oklahoma State University. (downloadable from http://www.hvac.okstate.edu/)
731 :
732 : // Using/Aliasing
733 68158 : auto &SysTimeElapsed = state.dataHVACGlobal->SysTimeElapsed;
734 : using FluidProperties::GetDensityGlycol;
735 : using PlantUtilities::InitComponentNodes;
736 : using PlantUtilities::SetComponentFlowRate;
737 :
738 : // SUBROUTINE PARAMETER DEFINITIONS:
739 : static constexpr std::string_view RoutineName("InitGshp");
740 :
741 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
742 : int LoadSideInletNode; // Load Side Inlet Node
743 : int LoadSideOutletNode; // Load Side Outlet Node
744 : int SourceSideInletNode; // Source Side Inlet Node
745 : int SourceSideOutletNode; // Source Side Outlet Node
746 68158 : auto &CurrentSimTime = state.dataHPWaterToWaterSimple->CurrentSimTime;
747 68158 : auto &PrevSimTime = state.dataHPWaterToWaterSimple->PrevSimTime;
748 :
749 : int LoopNum;
750 : DataPlant::LoopSideLocation LoopSideNum;
751 : Real64 rho; // local fluid density
752 :
753 68158 : this->MustRun = true; // Reset MustRun flag to TRUE
754 68158 : LoadSideInletNode = this->LoadSideInletNodeNum;
755 68158 : LoadSideOutletNode = this->LoadSideOutletNodeNum;
756 68158 : SourceSideInletNode = this->SourceSideInletNodeNum;
757 68158 : SourceSideOutletNode = this->SourceSideOutletNodeNum;
758 :
759 68158 : if (this->MyPlantScanFlag) {
760 4 : bool errFlag = false;
761 4 : PlantUtilities::ScanPlantLoopsForObject(
762 : state, this->Name, this->WWHPType, this->SourcePlantLoc, errFlag, _, _, _, this->SourceSideInletNodeNum, _);
763 4 : PlantUtilities::ScanPlantLoopsForObject(
764 : state, this->Name, this->WWHPType, this->LoadPlantLoc, errFlag, _, _, _, this->LoadSideInletNodeNum, _);
765 :
766 4 : if (!errFlag) {
767 4 : PlantUtilities::InterConnectTwoPlantLoopSides(state, this->LoadPlantLoc, this->SourcePlantLoc, this->WWHPType, true);
768 : }
769 :
770 4 : if (errFlag) {
771 0 : ShowFatalError(state, "GetWatertoWaterHPInput: Program terminated on scan for loop data");
772 : }
773 4 : this->MyPlantScanFlag = false;
774 : }
775 :
776 68158 : if (this->MyEnvrnFlag && state.dataGlobal->BeginEnvrnFlag) {
777 : // Initialize all report variables to a known state at beginning of simulation
778 :
779 24 : this->reportPower = 0.0;
780 24 : this->reportEnergy = 0.0;
781 24 : this->reportQLoad = 0.0;
782 24 : this->reportQLoadEnergy = 0.0;
783 24 : this->reportQSource = 0.0;
784 24 : this->reportQSourceEnergy = 0.0;
785 24 : this->reportLoadSideMassFlowRate = 0.0;
786 24 : this->reportLoadSideInletTemp = 0.0;
787 24 : this->reportLoadSideOutletTemp = 0.0;
788 24 : this->reportSourceSideMassFlowRate = 0.0;
789 24 : this->reportSourceSideInletTemp = 0.0;
790 24 : this->reportSourceSideOutletTemp = 0.0;
791 24 : this->IsOn = false;
792 24 : this->MustRun = true;
793 :
794 24 : if (this->WWHPType == DataPlant::PlantEquipmentType::HPWaterEFHeating) {
795 24 : rho = GetDensityGlycol(state,
796 12 : state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName,
797 : DataGlobalConstants::HWInitConvTemp,
798 12 : state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex,
799 : RoutineName);
800 12 : this->LoadSideDesignMassFlow = this->RatedLoadVolFlowHeat * rho;
801 24 : rho = GetDensityGlycol(state,
802 12 : state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidName,
803 : DataGlobalConstants::CWInitConvTemp,
804 12 : state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidIndex,
805 : RoutineName);
806 12 : this->SourceSideDesignMassFlow = this->RatedSourceVolFlowHeat * rho;
807 12 : } else if (this->WWHPType == DataPlant::PlantEquipmentType::HPWaterEFCooling) {
808 24 : rho = GetDensityGlycol(state,
809 12 : state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName,
810 : DataGlobalConstants::CWInitConvTemp,
811 12 : state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex,
812 : RoutineName);
813 12 : this->LoadSideDesignMassFlow = this->RatedLoadVolFlowCool * rho;
814 24 : rho = GetDensityGlycol(state,
815 12 : state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidName,
816 : DataGlobalConstants::HWInitConvTemp,
817 12 : state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidIndex,
818 : RoutineName);
819 12 : this->SourceSideDesignMassFlow = this->RatedSourceVolFlowCool * rho;
820 : }
821 :
822 24 : InitComponentNodes(state, 0.0, this->LoadSideDesignMassFlow, this->LoadSideInletNodeNum, this->LoadSideOutletNodeNum);
823 :
824 24 : InitComponentNodes(state, 0.0, this->SourceSideDesignMassFlow, this->SourceSideInletNodeNum, this->SourceSideOutletNodeNum);
825 :
826 24 : if (state.dataLoopNodes->Node(this->SourceSideOutletNodeNum).TempSetPoint == SensedNodeFlagValue)
827 16 : state.dataLoopNodes->Node(this->SourceSideOutletNodeNum).TempSetPoint = 0.0;
828 24 : state.dataLoopNodes->Node(this->SourceSideInletNodeNum).Temp = state.dataLoopNodes->Node(this->SourceSideOutletNodeNum).TempSetPoint + 30;
829 :
830 24 : this->MyEnvrnFlag = false;
831 : }
832 : // Reset the environment flag
833 68158 : if (!state.dataGlobal->BeginEnvrnFlag) this->MyEnvrnFlag = true;
834 :
835 68158 : if (PrevSimTime != CurrentSimTime) {
836 4202 : PrevSimTime = CurrentSimTime;
837 : }
838 :
839 : // Calculate the simulation time
840 204474 : CurrentSimTime = (state.dataGlobal->DayOfSim - 1) * 24 + (state.dataGlobal->HourOfDay - 1) +
841 136316 : (state.dataGlobal->TimeStep - 1) * state.dataGlobal->TimeStepZone + SysTimeElapsed;
842 :
843 68158 : LoopNum = this->LoadPlantLoc.loopNum;
844 68158 : LoopSideNum = this->LoadPlantLoc.loopSideNum;
845 :
846 68158 : if (MyLoad > 0.0 && GSHPTypeNum == DataPlant::PlantEquipmentType::HPWaterEFHeating) {
847 17232 : this->MustRun = true;
848 17232 : this->IsOn = true;
849 50926 : } else if (MyLoad < 0.0 && GSHPTypeNum == DataPlant::PlantEquipmentType::HPWaterEFCooling) {
850 16346 : this->MustRun = true;
851 16346 : this->IsOn = true;
852 : } else {
853 34580 : this->MustRun = false;
854 34580 : this->IsOn = false;
855 : }
856 :
857 : //*******Set flow based on "flowlock" and "run" flags**********
858 : // Set flows if the heat pump is not running
859 68158 : if (!this->MustRun) {
860 34580 : this->reportLoadSideMassFlowRate = 0.0;
861 34580 : this->reportSourceSideMassFlowRate = 0.0;
862 :
863 34580 : SetComponentFlowRate(state, this->reportLoadSideMassFlowRate, this->LoadSideInletNodeNum, this->LoadSideOutletNodeNum, this->LoadPlantLoc);
864 34580 : SetComponentFlowRate(
865 : state, this->reportSourceSideMassFlowRate, this->SourceSideInletNodeNum, this->SourceSideOutletNodeNum, this->SourcePlantLoc);
866 34580 : PlantUtilities::PullCompInterconnectTrigger(state,
867 : this->LoadPlantLoc,
868 : this->CondMassFlowIndex,
869 : this->SourcePlantLoc, // IS THIS RIGHT?
870 : DataPlant::CriteriaType::MassFlowRate,
871 : this->reportSourceSideMassFlowRate);
872 : // Set flows if the heat pump is running
873 : } else { // the heat pump must run
874 :
875 33578 : this->reportLoadSideMassFlowRate = this->LoadSideDesignMassFlow;
876 33578 : this->reportSourceSideMassFlowRate = this->SourceSideDesignMassFlow;
877 : // now check against and request in plant
878 33578 : SetComponentFlowRate(state, this->reportLoadSideMassFlowRate, this->LoadSideInletNodeNum, this->LoadSideOutletNodeNum, this->LoadPlantLoc);
879 33578 : SetComponentFlowRate(
880 : state, this->reportSourceSideMassFlowRate, this->SourceSideInletNodeNum, this->SourceSideOutletNodeNum, this->SourcePlantLoc);
881 : // if there's no flowin one, turn the entire "heat pump off"
882 33578 : if (this->reportLoadSideMassFlowRate <= 0.0 || this->reportSourceSideMassFlowRate <= 0.0) {
883 :
884 6 : this->reportLoadSideMassFlowRate = 0.0;
885 6 : this->reportSourceSideMassFlowRate = 0.0;
886 6 : this->MustRun = false;
887 :
888 6 : SetComponentFlowRate(
889 : state, this->reportLoadSideMassFlowRate, this->LoadSideInletNodeNum, this->LoadSideOutletNodeNum, this->LoadPlantLoc);
890 6 : SetComponentFlowRate(
891 : state, this->reportSourceSideMassFlowRate, this->SourceSideInletNodeNum, this->SourceSideOutletNodeNum, this->SourcePlantLoc);
892 6 : PlantUtilities::PullCompInterconnectTrigger(state,
893 : this->LoadPlantLoc,
894 : this->CondMassFlowIndex,
895 : this->SourcePlantLoc,
896 : DataPlant::CriteriaType::MassFlowRate,
897 : this->reportSourceSideMassFlowRate);
898 6 : return;
899 : }
900 33572 : PlantUtilities::PullCompInterconnectTrigger(state,
901 : this->LoadPlantLoc,
902 : this->CondMassFlowIndex,
903 : this->SourcePlantLoc,
904 : DataPlant::CriteriaType::MassFlowRate,
905 : this->reportSourceSideMassFlowRate);
906 : }
907 :
908 : // Get inlet temps
909 68152 : this->reportLoadSideInletTemp = state.dataLoopNodes->Node(LoadSideInletNode).Temp;
910 68152 : this->reportSourceSideInletTemp = state.dataLoopNodes->Node(SourceSideInletNode).Temp;
911 :
912 : // Outlet variables
913 68152 : this->reportPower = 0.0;
914 68152 : this->reportEnergy = 0.0;
915 68152 : this->reportQLoad = 0.0;
916 68152 : this->reportQLoadEnergy = 0.0;
917 68152 : this->reportQSource = 0.0;
918 68152 : this->reportQSourceEnergy = 0.0;
919 68152 : this->reportLoadSideOutletTemp = 0.0;
920 68152 : this->reportSourceSideOutletTemp = 0.0;
921 : }
922 :
923 20 : void GshpSpecs::sizeCoolingWaterToWaterHP(EnergyPlusData &state)
924 : {
925 :
926 : // do sizing related calculations and reporting for cooling heat pumps
927 20 : bool errorsFound(false);
928 : static constexpr std::string_view RoutineName("sizeCoolingWaterToWaterHP");
929 20 : Real64 tmpLoadSideVolFlowRate = this->RatedLoadVolFlowCool;
930 20 : Real64 tmpSourceSideVolFlowRate = this->RatedSourceVolFlowCool;
931 20 : Real64 tmpCoolingCap = this->RatedCapCool;
932 20 : Real64 tmpPowerDraw = this->RatedPowerCool;
933 :
934 : // if companion heating coil known, update info from that
935 20 : if (this->companionIdentified) {
936 10 : this->RatedLoadVolFlowHeat = state.dataHPWaterToWaterSimple->GSHP(this->companionIndex).RatedLoadVolFlowHeat;
937 10 : this->ratedLoadVolFlowHeatWasAutoSized = state.dataHPWaterToWaterSimple->GSHP(this->companionIndex).ratedLoadVolFlowHeatWasAutoSized;
938 10 : this->RatedSourceVolFlowHeat = state.dataHPWaterToWaterSimple->GSHP(this->companionIndex).RatedSourceVolFlowHeat;
939 10 : this->ratedSourceVolFlowHeatWasAutoSized = state.dataHPWaterToWaterSimple->GSHP(this->companionIndex).ratedSourceVolFlowHeatWasAutoSized;
940 10 : this->RatedCapHeat = state.dataHPWaterToWaterSimple->GSHP(this->companionIndex).RatedCapHeat;
941 10 : this->ratedCapHeatWasAutoSized = state.dataHPWaterToWaterSimple->GSHP(this->companionIndex).ratedCapHeatWasAutoSized;
942 10 : this->RatedPowerHeat = state.dataHPWaterToWaterSimple->GSHP(this->companionIndex).RatedPowerHeat;
943 10 : this->ratedPowerHeatWasAutoSized = state.dataHPWaterToWaterSimple->GSHP(this->companionIndex).ratedPowerHeatWasAutoSized;
944 : }
945 :
946 20 : int pltLoadSizNum = state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).PlantSizNum;
947 20 : if (pltLoadSizNum > 0) {
948 10 : if (state.dataSize->PlantSizData(pltLoadSizNum).DesVolFlowRate > DataHVACGlobals::SmallWaterVolFlow) {
949 8 : tmpLoadSideVolFlowRate = state.dataSize->PlantSizData(pltLoadSizNum).DesVolFlowRate * this->sizFac;
950 : // now compare to companion coil and take higher
951 8 : if (this->companionIdentified) {
952 8 : tmpLoadSideVolFlowRate = max(tmpLoadSideVolFlowRate, this->RatedLoadVolFlowHeat);
953 : // store flow rate right away regardless of PlantFirstSizesOkayToFinalize so that data are available
954 8 : this->RatedLoadVolFlowCool = tmpLoadSideVolFlowRate;
955 : }
956 16 : Real64 rho = FluidProperties::GetDensityGlycol(state,
957 8 : state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName,
958 : DataGlobalConstants::CWInitConvTemp,
959 8 : state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex,
960 8 : RoutineName);
961 16 : Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state,
962 8 : state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName,
963 : DataGlobalConstants::CWInitConvTemp,
964 8 : state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex,
965 8 : RoutineName);
966 8 : tmpCoolingCap = Cp * rho * state.dataSize->PlantSizData(pltLoadSizNum).DeltaT * tmpLoadSideVolFlowRate;
967 2 : } else if (this->companionIdentified && this->RatedLoadVolFlowHeat > 0.0) {
968 0 : tmpLoadSideVolFlowRate = this->RatedLoadVolFlowHeat;
969 0 : Real64 rho = FluidProperties::GetDensityGlycol(state,
970 0 : state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName,
971 : DataGlobalConstants::CWInitConvTemp,
972 0 : state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex,
973 0 : RoutineName);
974 0 : Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state,
975 0 : state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName,
976 : DataGlobalConstants::CWInitConvTemp,
977 0 : state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex,
978 0 : RoutineName);
979 0 : tmpCoolingCap = Cp * rho * state.dataSize->PlantSizData(pltLoadSizNum).DeltaT * tmpLoadSideVolFlowRate;
980 : } else {
981 2 : if (this->ratedCapCoolWasAutoSized) tmpCoolingCap = 0.0;
982 2 : if (this->ratedLoadVolFlowCoolWasAutoSized) tmpLoadSideVolFlowRate = 0.0;
983 : }
984 10 : if (state.dataPlnt->PlantFirstSizesOkayToFinalize) {
985 2 : if (this->ratedCapCoolWasAutoSized) {
986 2 : this->RatedCapCool = tmpCoolingCap;
987 2 : if (state.dataPlnt->PlantFinalSizesOkayToReport && !this->myCoolingSizesReported) {
988 3 : BaseSizer::reportSizerOutput(
989 2 : state, "HeatPump:WaterToWater:EquationFit:Cooling", this->Name, "Design Size Nominal Capacity [W]", tmpCoolingCap);
990 : }
991 2 : if (state.dataPlnt->PlantFirstSizesOkayToReport) {
992 0 : BaseSizer::reportSizerOutput(
993 0 : state, "HeatPump:WaterToWater:EquationFit:Cooling", this->Name, "Initial Design Size Nominal Capacity [W]", tmpCoolingCap);
994 : }
995 : } else {
996 0 : if (this->RatedCapCool > 0.0 && tmpCoolingCap > 0.0) {
997 0 : Real64 nomCoolingCapUser = this->RatedCapCool;
998 0 : if (state.dataPlnt->PlantFinalSizesOkayToReport && !this->myCoolingSizesReported) {
999 0 : if (state.dataGlobal->DoPlantSizing) {
1000 0 : BaseSizer::reportSizerOutput(state,
1001 : "HeatPump:WaterToWater:EquationFit:Cooling",
1002 : this->Name,
1003 : "Design Size Nominal Capacity [W]",
1004 : tmpCoolingCap,
1005 : "User-Specified Nominal Capacity [W]",
1006 0 : nomCoolingCapUser);
1007 : } else {
1008 0 : BaseSizer::reportSizerOutput(state,
1009 : "HeatPump:WaterToWater:EquationFit:Cooling",
1010 : this->Name,
1011 : "User-Specified Nominal Capacity [W]",
1012 0 : nomCoolingCapUser);
1013 : }
1014 :
1015 0 : if (state.dataGlobal->DisplayExtraWarnings) {
1016 0 : if ((std::abs(tmpCoolingCap - nomCoolingCapUser) / nomCoolingCapUser) > state.dataSize->AutoVsHardSizingThreshold) {
1017 0 : ShowMessage(state, "sizeCoolingWaterToWaterHP: Potential issue with equipment sizing for " + this->Name);
1018 0 : ShowContinueError(state, format("User-Specified Nominal Capacity of {:.2R} [W]", nomCoolingCapUser));
1019 0 : ShowContinueError(state, format("differs from Design Size Nominal Capacity of {:.2R} [W]", tmpCoolingCap));
1020 0 : ShowContinueError(state, "This may, or may not, indicate mismatched component sizes.");
1021 0 : ShowContinueError(state, "Verify that the value entered is intended and is consistent with other components.");
1022 : }
1023 : }
1024 : }
1025 0 : tmpCoolingCap = nomCoolingCapUser;
1026 : }
1027 : }
1028 2 : if (this->ratedLoadVolFlowCoolWasAutoSized) {
1029 2 : this->RatedLoadVolFlowCool = tmpLoadSideVolFlowRate;
1030 2 : if (state.dataPlnt->PlantFinalSizesOkayToReport && !this->myCoolingSizesReported) {
1031 3 : BaseSizer::reportSizerOutput(state,
1032 : "HeatPump:WaterToWater:EquationFit:Cooling",
1033 : this->Name,
1034 : "Design Size Load Side Volume Flow Rate [m3/s]",
1035 2 : tmpLoadSideVolFlowRate);
1036 : }
1037 2 : if (state.dataPlnt->PlantFirstSizesOkayToReport) {
1038 0 : BaseSizer::reportSizerOutput(state,
1039 : "HeatPump:WaterToWater:EquationFit:Cooling",
1040 : this->Name,
1041 : "Initial Design Size Load Side Volume Flow Rate [m3/s]",
1042 0 : tmpLoadSideVolFlowRate);
1043 : }
1044 : } else {
1045 0 : if (this->RatedLoadVolFlowCool > 0.0 && tmpLoadSideVolFlowRate > 0.0) {
1046 0 : Real64 nomLoadSideVolFlowUser = this->RatedLoadVolFlowCool;
1047 0 : if (state.dataPlnt->PlantFinalSizesOkayToReport && !this->myCoolingSizesReported) {
1048 0 : if (state.dataGlobal->DoPlantSizing) {
1049 0 : BaseSizer::reportSizerOutput(state,
1050 : "HeatPump:WaterToWater:EquationFit:Cooling",
1051 : this->Name,
1052 : "Design Size Load Side Volume Flow Rate [m3/s]",
1053 : tmpLoadSideVolFlowRate,
1054 : "User-Specified Load Side Volume Flow Rate [m3/s]",
1055 0 : nomLoadSideVolFlowUser);
1056 : } else {
1057 0 : BaseSizer::reportSizerOutput(state,
1058 : "HeatPump:WaterToWater:EquationFit:Cooling",
1059 : this->Name,
1060 : "User-Specified Load Side Volume Flow Rate [m3/s]",
1061 0 : nomLoadSideVolFlowUser);
1062 : }
1063 0 : if (state.dataGlobal->DisplayExtraWarnings) {
1064 0 : if ((std::abs(tmpLoadSideVolFlowRate - nomLoadSideVolFlowUser) / nomLoadSideVolFlowUser) >
1065 0 : state.dataSize->AutoVsHardSizingThreshold) {
1066 0 : ShowMessage(state, "sizeCoolingWaterToWaterHP: Potential issue with equipment sizing for " + this->Name);
1067 0 : ShowContinueError(state,
1068 0 : format("User-Specified Load Side Volume Flow Rate of {:.2R} [m3/s]", nomLoadSideVolFlowUser));
1069 0 : ShowContinueError(
1070 0 : state, format("differs from Design Size Load Side Volume Flow Rate of {:.2R} [m3/s]", tmpLoadSideVolFlowRate));
1071 0 : ShowContinueError(state, "This may, or may not, indicate mismatched component sizes.");
1072 0 : ShowContinueError(state, "Verify that the value entered is intended and is consistent with other components.");
1073 : }
1074 : }
1075 : }
1076 0 : tmpLoadSideVolFlowRate = nomLoadSideVolFlowUser;
1077 : }
1078 : }
1079 : }
1080 :
1081 : } else { // did not find load side loop plant sizing to go with this.
1082 10 : if (this->companionIdentified) {
1083 0 : if (this->ratedLoadVolFlowHeatWasAutoSized && this->RatedLoadVolFlowHeat > 0.0) {
1084 : // fill load side flow rate size from companion coil
1085 0 : tmpLoadSideVolFlowRate = this->RatedLoadVolFlowHeat;
1086 0 : if (state.dataPlnt->PlantFirstSizesOkayToFinalize) {
1087 0 : this->RatedLoadVolFlowCool = tmpLoadSideVolFlowRate;
1088 0 : if (state.dataPlnt->PlantFinalSizesOkayToReport && !this->myCoolingSizesReported) {
1089 0 : BaseSizer::reportSizerOutput(state,
1090 : "HeatPump:WaterToWater:EquationFit:Cooling",
1091 : this->Name,
1092 : "Design Size Load Side Volume Flow Rate [m3/s]",
1093 0 : tmpLoadSideVolFlowRate);
1094 : }
1095 0 : if (state.dataPlnt->PlantFirstSizesOkayToReport) {
1096 0 : BaseSizer::reportSizerOutput(state,
1097 : "HeatPump:WaterToWater:EquationFit:Cooling",
1098 : this->Name,
1099 : "Initial Design Size Load Side Volume Flow Rate [m3/s]",
1100 0 : tmpLoadSideVolFlowRate);
1101 : }
1102 : }
1103 : }
1104 0 : if (this->ratedCapHeatWasAutoSized && this->RatedCapHeat > 0.0) {
1105 0 : tmpCoolingCap = this->RatedCapHeat;
1106 0 : if (state.dataPlnt->PlantFirstSizesOkayToFinalize) {
1107 0 : this->RatedCapCool = tmpCoolingCap;
1108 0 : if (state.dataPlnt->PlantFinalSizesOkayToReport && !this->myCoolingSizesReported) {
1109 0 : BaseSizer::reportSizerOutput(
1110 0 : state, "HeatPump:WaterToWater:EquationFit:Cooling", this->Name, "Design Size Nominal Capacity [W]", tmpCoolingCap);
1111 : }
1112 0 : if (state.dataPlnt->PlantFirstSizesOkayToReport) {
1113 0 : BaseSizer::reportSizerOutput(state,
1114 : "HeatPump:WaterToWater:EquationFit:Cooling",
1115 : this->Name,
1116 : "Initial Design Size Nominal Capacity [W]",
1117 0 : tmpCoolingCap);
1118 : }
1119 : }
1120 : }
1121 : } else { // no companion heatpump, no plant sizing object
1122 10 : if ((this->ratedLoadVolFlowCoolWasAutoSized || this->ratedCapCoolWasAutoSized) && state.dataPlnt->PlantFirstSizesOkayToFinalize) {
1123 0 : ShowSevereError(state, "Autosizing of Water to Water Heat Pump requires a loop Sizing:Plant object.");
1124 0 : ShowContinueError(state, "Occurs in HeatPump:WaterToWater:EquationFit:Cooling object = " + this->Name);
1125 0 : errorsFound = true;
1126 : }
1127 : }
1128 :
1129 10 : if (!this->ratedLoadVolFlowCoolWasAutoSized && state.dataPlnt->PlantFinalSizesOkayToReport && !this->myCoolingSizesReported) {
1130 3 : BaseSizer::reportSizerOutput(state,
1131 : "HeatPump:WaterToWater:EquationFit:Cooling",
1132 : this->Name,
1133 : "User-Specified Load Side Flow Rate [m3/s]",
1134 2 : this->RatedLoadVolFlowCool);
1135 : }
1136 10 : if (!this->ratedCapCoolWasAutoSized && state.dataPlnt->PlantFinalSizesOkayToReport && !this->myCoolingSizesReported) {
1137 3 : BaseSizer::reportSizerOutput(
1138 2 : state, "HeatPump:WaterToWater:EquationFit:Cooling", this->Name, "User-Specified Nominal Capacity [W]", this->RatedCapCool);
1139 : }
1140 : }
1141 20 : if (!this->ratedLoadVolFlowCoolWasAutoSized) tmpLoadSideVolFlowRate = this->RatedLoadVolFlowCool;
1142 20 : int pltSourceSizNum = state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).PlantSizNum;
1143 20 : if (pltSourceSizNum > 0) {
1144 0 : Real64 rho = FluidProperties::GetDensityGlycol(state,
1145 0 : state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidName,
1146 : DataGlobalConstants::CWInitConvTemp,
1147 0 : state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidIndex,
1148 0 : RoutineName);
1149 0 : Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state,
1150 0 : state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidName,
1151 : DataGlobalConstants::CWInitConvTemp,
1152 0 : state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidIndex,
1153 0 : RoutineName);
1154 0 : tmpSourceSideVolFlowRate = tmpCoolingCap * (1.0 + (1.0 / this->refCOP)) / (state.dataSize->PlantSizData(pltSourceSizNum).DeltaT * Cp * rho);
1155 : } else {
1156 20 : tmpSourceSideVolFlowRate = tmpLoadSideVolFlowRate; // set source side flow equal to load side flow, assumption
1157 : }
1158 :
1159 20 : if (this->ratedSourceVolFlowCoolWasAutoSized) {
1160 10 : this->RatedSourceVolFlowCool = tmpSourceSideVolFlowRate;
1161 10 : if (state.dataPlnt->PlantFinalSizesOkayToReport && !this->myCoolingSizesReported) {
1162 3 : BaseSizer::reportSizerOutput(state,
1163 : "HeatPump:WaterToWater:EquationFit:Cooling",
1164 : this->Name,
1165 : "Design Size Source Side Volume Flow Rate [m3/s]",
1166 2 : tmpSourceSideVolFlowRate);
1167 : }
1168 10 : if (state.dataPlnt->PlantFirstSizesOkayToReport) {
1169 0 : BaseSizer::reportSizerOutput(state,
1170 : "HeatPump:WaterToWater:EquationFit:Cooling",
1171 : this->Name,
1172 : "Initial Design Size Source Side Volume Flow Rate [m3/s]",
1173 0 : tmpSourceSideVolFlowRate);
1174 : }
1175 : } else {
1176 10 : if (this->RatedSourceVolFlowCool > 0.0 && tmpSourceSideVolFlowRate > 0.0) {
1177 10 : Real64 nomSourceSideVolFlowUser = this->RatedSourceVolFlowCool;
1178 10 : if (state.dataPlnt->PlantFinalSizesOkayToReport && !this->myCoolingSizesReported) {
1179 1 : if (state.dataGlobal->DoPlantSizing) {
1180 0 : BaseSizer::reportSizerOutput(state,
1181 : "HeatPump:WaterToWater:EquationFit:Cooling",
1182 : this->Name,
1183 : "Design Size Source Side Volume Flow Rate [m3/s]",
1184 : tmpSourceSideVolFlowRate,
1185 : "User-Specified Source Side Volume Flow Rate [m3/s]",
1186 0 : nomSourceSideVolFlowUser);
1187 : } else {
1188 3 : BaseSizer::reportSizerOutput(state,
1189 : "HeatPump:WaterToWater:EquationFit:Cooling",
1190 : this->Name,
1191 : "User-Specified Source Side Volume Flow Rate [m3/s]",
1192 2 : nomSourceSideVolFlowUser);
1193 : }
1194 1 : if (state.dataGlobal->DisplayExtraWarnings) {
1195 0 : if ((std::abs(tmpSourceSideVolFlowRate - nomSourceSideVolFlowUser) / nomSourceSideVolFlowUser) >
1196 0 : state.dataSize->AutoVsHardSizingThreshold) {
1197 0 : ShowMessage(state, "sizeCoolingWaterToWaterHP: Potential issue with equipment sizing for " + this->Name);
1198 0 : ShowContinueError(state, format("User-Specified Source Side Volume Flow Rate of {:.2R} [m3/s]", nomSourceSideVolFlowUser));
1199 0 : ShowContinueError(state,
1200 0 : format("differs from Design Size Source Side Volume Flow Rate of {:.2R} [m3/s]", tmpSourceSideVolFlowRate));
1201 0 : ShowContinueError(state, "This may, or may not, indicate mismatched component sizes.");
1202 0 : ShowContinueError(state, "Verify that the value entered is intended and is consistent with other components.");
1203 : }
1204 : }
1205 : }
1206 10 : tmpSourceSideVolFlowRate = nomSourceSideVolFlowUser;
1207 : }
1208 : }
1209 20 : if (!this->ratedSourceVolFlowCoolWasAutoSized) tmpSourceSideVolFlowRate = this->RatedSourceVolFlowCool;
1210 20 : if (!this->ratedCapCoolWasAutoSized) tmpCoolingCap = this->RatedCapCool;
1211 20 : if (this->ratedPowerCoolWasAutoSized) {
1212 10 : tmpPowerDraw = tmpCoolingCap / this->refCOP;
1213 10 : this->RatedPowerCool = tmpPowerDraw;
1214 10 : if (state.dataPlnt->PlantFinalSizesOkayToReport && !this->myCoolingSizesReported) {
1215 3 : BaseSizer::reportSizerOutput(
1216 2 : state, "HeatPump:WaterToWater:EquationFit:Cooling", this->Name, "Design Size Cooling Power Consumption [W]", tmpPowerDraw);
1217 : }
1218 10 : if (state.dataPlnt->PlantFirstSizesOkayToReport) {
1219 0 : BaseSizer::reportSizerOutput(
1220 0 : state, "HeatPump:WaterToWater:EquationFit:Cooling", this->Name, "Initial Design Size Cooling Power Consumption [W]", tmpPowerDraw);
1221 : }
1222 : } else {
1223 10 : if (this->RatedPowerCool > 0.0 && tmpPowerDraw > 0.0) {
1224 10 : Real64 nomPowerDrawUser = this->RatedPowerCool;
1225 10 : if (state.dataPlnt->PlantFinalSizesOkayToReport && !this->myCoolingSizesReported) {
1226 1 : if (state.dataGlobal->DoPlantSizing) {
1227 0 : BaseSizer::reportSizerOutput(state,
1228 : "HeatPump:WaterToWater:EquationFit:Cooling",
1229 : this->Name,
1230 : "Design Size Cooling Power Consumption [W]",
1231 : tmpPowerDraw,
1232 : "User-Specified Cooling Power Consumption [W]",
1233 0 : nomPowerDrawUser);
1234 : } else {
1235 3 : BaseSizer::reportSizerOutput(state,
1236 : "HeatPump:WaterToWater:EquationFit:Cooling",
1237 : this->Name,
1238 : "User-Specified Cooling Power Consumption [W]",
1239 2 : nomPowerDrawUser);
1240 : }
1241 1 : if (state.dataGlobal->DisplayExtraWarnings) {
1242 0 : if ((std::abs(tmpPowerDraw - nomPowerDrawUser) / nomPowerDrawUser) > state.dataSize->AutoVsHardSizingThreshold) {
1243 0 : ShowMessage(state, "sizeCoolingWaterToWaterHP: Potential issue with equipment sizing for " + this->Name);
1244 0 : ShowContinueError(state, format("User-Specified Cooling Power Consumption of {:.2R} [W]", nomPowerDrawUser));
1245 0 : ShowContinueError(state, format("differs from Design Size Cooling Power Consumption of {:.2R} [W]", tmpPowerDraw));
1246 0 : ShowContinueError(state, "This may, or may not, indicate mismatched component sizes.");
1247 0 : ShowContinueError(state, "Verify that the value entered is intended and is consistent with other components.");
1248 : }
1249 : }
1250 : }
1251 10 : tmpPowerDraw = nomPowerDrawUser;
1252 10 : this->refCOP = tmpCoolingCap / tmpPowerDraw;
1253 : }
1254 : }
1255 :
1256 20 : PlantUtilities::RegisterPlantCompDesignFlow(state, this->LoadSideInletNodeNum, tmpLoadSideVolFlowRate);
1257 : // only register half of the source side flow because we expect a companion heat pump to also register a flow and we don't want to double
1258 : // count
1259 20 : PlantUtilities::RegisterPlantCompDesignFlow(state, this->SourceSideInletNodeNum, tmpSourceSideVolFlowRate * 0.5);
1260 :
1261 20 : if (state.dataPlnt->PlantFinalSizesOkayToReport && !this->myCoolingSizesReported) {
1262 : // create predefined report
1263 4 : OutputReportPredefined::PreDefTableEntry(
1264 4 : state, state.dataOutRptPredefined->pdchMechType, this->Name, "HeatPump:WaterToWater:EquationFit:Cooling");
1265 2 : OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchMechNomEff, this->Name, this->refCOP);
1266 2 : OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchMechNomCap, this->Name, this->RatedCapCool);
1267 : }
1268 :
1269 20 : if (state.dataPlnt->PlantFinalSizesOkayToReport) {
1270 4 : this->myCoolingSizesReported = true;
1271 : }
1272 :
1273 20 : if (errorsFound) {
1274 0 : ShowFatalError(state, "Preceding sizing errors cause program termination");
1275 : }
1276 20 : }
1277 :
1278 20 : void GshpSpecs::sizeHeatingWaterToWaterHP(EnergyPlusData &state)
1279 : {
1280 :
1281 : // do sizing related calculations and reporting for heating heat pumps
1282 20 : bool errorsFound(false);
1283 : static constexpr std::string_view RoutineName("sizeHeatingWaterToWaterHP");
1284 20 : Real64 tmpLoadSideVolFlowRate = this->RatedLoadVolFlowHeat;
1285 20 : Real64 tmpSourceSideVolFlowRate = this->RatedSourceVolFlowHeat;
1286 20 : Real64 tmpHeatingCap = this->RatedCapHeat;
1287 20 : Real64 tmpPowerDraw = this->RatedPowerHeat;
1288 :
1289 : // if companion cooling coil known, update info from that
1290 20 : if (this->companionIdentified) {
1291 10 : this->RatedLoadVolFlowCool = state.dataHPWaterToWaterSimple->GSHP(this->companionIndex).RatedLoadVolFlowCool;
1292 10 : this->ratedLoadVolFlowCoolWasAutoSized = state.dataHPWaterToWaterSimple->GSHP(this->companionIndex).ratedLoadVolFlowCoolWasAutoSized;
1293 10 : this->RatedSourceVolFlowCool = state.dataHPWaterToWaterSimple->GSHP(this->companionIndex).RatedSourceVolFlowCool;
1294 10 : this->ratedSourceVolFlowCoolWasAutoSized = state.dataHPWaterToWaterSimple->GSHP(this->companionIndex).ratedSourceVolFlowCoolWasAutoSized;
1295 10 : this->RatedCapCool = state.dataHPWaterToWaterSimple->GSHP(this->companionIndex).RatedCapCool;
1296 10 : this->ratedCapCoolWasAutoSized = state.dataHPWaterToWaterSimple->GSHP(this->companionIndex).ratedCapCoolWasAutoSized;
1297 10 : this->RatedPowerCool = state.dataHPWaterToWaterSimple->GSHP(this->companionIndex).RatedPowerCool;
1298 10 : this->ratedPowerCoolWasAutoSized = state.dataHPWaterToWaterSimple->GSHP(this->companionIndex).ratedPowerCoolWasAutoSized;
1299 : }
1300 :
1301 20 : int pltLoadSizNum = state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).PlantSizNum;
1302 20 : if (pltLoadSizNum > 0) {
1303 10 : if (state.dataSize->PlantSizData(pltLoadSizNum).DesVolFlowRate > DataHVACGlobals::SmallWaterVolFlow) {
1304 8 : tmpLoadSideVolFlowRate = state.dataSize->PlantSizData(pltLoadSizNum).DesVolFlowRate * this->sizFac;
1305 : // now compare to companion coil and take higher
1306 8 : if (this->companionIdentified) {
1307 8 : tmpLoadSideVolFlowRate = max(tmpLoadSideVolFlowRate, this->RatedLoadVolFlowCool);
1308 : // store flow rate right away regardless of PlantFirstSizesOkayToFinalize so that data are available for companion when
1309 : // PlantFirstSizesOkayToFinalize is true
1310 8 : this->RatedLoadVolFlowHeat = tmpLoadSideVolFlowRate;
1311 : }
1312 16 : Real64 rho = FluidProperties::GetDensityGlycol(state,
1313 8 : state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName,
1314 : DataGlobalConstants::HWInitConvTemp,
1315 8 : state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex,
1316 8 : RoutineName);
1317 16 : Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state,
1318 8 : state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName,
1319 : DataGlobalConstants::HWInitConvTemp,
1320 8 : state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex,
1321 8 : RoutineName);
1322 8 : tmpHeatingCap = Cp * rho * state.dataSize->PlantSizData(pltLoadSizNum).DeltaT * tmpLoadSideVolFlowRate;
1323 2 : } else if (this->companionIdentified && this->RatedLoadVolFlowCool > 0.0) {
1324 0 : tmpLoadSideVolFlowRate = this->RatedLoadVolFlowCool;
1325 0 : Real64 rho = FluidProperties::GetDensityGlycol(state,
1326 0 : state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName,
1327 : DataGlobalConstants::HWInitConvTemp,
1328 0 : state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex,
1329 0 : RoutineName);
1330 0 : Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state,
1331 0 : state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName,
1332 : DataGlobalConstants::HWInitConvTemp,
1333 0 : state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex,
1334 0 : RoutineName);
1335 0 : tmpHeatingCap = Cp * rho * state.dataSize->PlantSizData(pltLoadSizNum).DeltaT * tmpLoadSideVolFlowRate;
1336 : } else {
1337 2 : if (this->ratedCapHeatWasAutoSized) tmpHeatingCap = 0.0;
1338 2 : if (this->ratedLoadVolFlowHeatWasAutoSized) tmpLoadSideVolFlowRate = 0.0;
1339 : }
1340 10 : if (state.dataPlnt->PlantFirstSizesOkayToFinalize) {
1341 2 : if (this->ratedCapHeatWasAutoSized) {
1342 2 : this->RatedCapHeat = tmpHeatingCap;
1343 2 : if (state.dataPlnt->PlantFinalSizesOkayToReport && !this->myHeatingSizesReported) {
1344 3 : BaseSizer::reportSizerOutput(
1345 2 : state, "HeatPump:WaterToWater:EquationFit:Heating", this->Name, "Design Size Nominal Capacity [W]", tmpHeatingCap);
1346 : }
1347 2 : if (state.dataPlnt->PlantFirstSizesOkayToReport) {
1348 0 : BaseSizer::reportSizerOutput(
1349 0 : state, "HeatPump:WaterToWater:EquationFit:Heating", this->Name, "Initial Design Size Nominal Capacity [W]", tmpHeatingCap);
1350 : }
1351 : } else {
1352 0 : if (this->RatedCapHeat > 0.0 && tmpHeatingCap > 0.0) {
1353 0 : Real64 nomHeatingCapUser = this->RatedCapHeat;
1354 0 : if (state.dataPlnt->PlantFinalSizesOkayToReport && !this->myHeatingSizesReported) {
1355 0 : if (state.dataGlobal->DoPlantSizing) {
1356 0 : BaseSizer::reportSizerOutput(state,
1357 : "HeatPump:WaterToWater:EquationFit:Heating",
1358 : this->Name,
1359 : "Design Size Nominal Capacity [W]",
1360 : tmpHeatingCap,
1361 : "User-Specified Nominal Capacity [W]",
1362 0 : nomHeatingCapUser);
1363 : } else {
1364 0 : BaseSizer::reportSizerOutput(state,
1365 : "HeatPump:WaterToWater:EquationFit:Heating",
1366 : this->Name,
1367 : "User-Specified Nominal Capacity [W]",
1368 0 : nomHeatingCapUser);
1369 : }
1370 0 : if (state.dataGlobal->DisplayExtraWarnings) {
1371 0 : if ((std::abs(tmpHeatingCap - nomHeatingCapUser) / nomHeatingCapUser) > state.dataSize->AutoVsHardSizingThreshold) {
1372 0 : ShowMessage(state, "sizeHeatingWaterToWaterHP: Potential issue with equipment sizing for " + this->Name);
1373 0 : ShowContinueError(state, format("User-Specified Nominal Capacity of {:.2R} [W]", nomHeatingCapUser));
1374 0 : ShowContinueError(state, format("differs from Design Size Nominal Capacity of {:.2R} [W]", tmpHeatingCap));
1375 0 : ShowContinueError(state, "This may, or may not, indicate mismatched component sizes.");
1376 0 : ShowContinueError(state, "Verify that the value entered is intended and is consistent with other components.");
1377 : }
1378 : }
1379 : }
1380 0 : tmpHeatingCap = nomHeatingCapUser;
1381 : }
1382 : }
1383 2 : if (this->ratedLoadVolFlowHeatWasAutoSized) {
1384 2 : this->RatedLoadVolFlowHeat = tmpLoadSideVolFlowRate;
1385 2 : if (state.dataPlnt->PlantFinalSizesOkayToReport && !this->myHeatingSizesReported) {
1386 3 : BaseSizer::reportSizerOutput(state,
1387 : "HeatPump:WaterToWater:EquationFit:Heating",
1388 : this->Name,
1389 : "Design Size Load Side Volume Flow Rate [m3/s]",
1390 2 : tmpLoadSideVolFlowRate);
1391 : }
1392 2 : if (state.dataPlnt->PlantFirstSizesOkayToReport) {
1393 0 : BaseSizer::reportSizerOutput(state,
1394 : "HeatPump:WaterToWater:EquationFit:Heating",
1395 : this->Name,
1396 : "Initial Design Size Load Side Volume Flow Rate [m3/s]",
1397 0 : tmpLoadSideVolFlowRate);
1398 : }
1399 : } else {
1400 0 : if (this->RatedLoadVolFlowHeat > 0.0 && tmpLoadSideVolFlowRate > 0.0) {
1401 0 : Real64 nomLoadSideVolFlowUser = this->RatedLoadVolFlowHeat;
1402 0 : if (state.dataPlnt->PlantFinalSizesOkayToReport && !this->myHeatingSizesReported) {
1403 0 : if (state.dataGlobal->DoPlantSizing) {
1404 0 : BaseSizer::reportSizerOutput(state,
1405 : "HeatPump:WaterToWater:EquationFit:Heating",
1406 : this->Name,
1407 : "Design Size Load Side Volume Flow Rate [m3/s]",
1408 : tmpLoadSideVolFlowRate,
1409 : "User-Specified Load Side Volume Flow Rate [m3/s]",
1410 0 : nomLoadSideVolFlowUser);
1411 : } else {
1412 0 : BaseSizer::reportSizerOutput(state,
1413 : "HeatPump:WaterToWater:EquationFit:Heating",
1414 : this->Name,
1415 : "User-Specified Load Side Volume Flow Rate [m3/s]",
1416 0 : nomLoadSideVolFlowUser);
1417 : }
1418 0 : if (state.dataGlobal->DisplayExtraWarnings) {
1419 0 : if ((std::abs(tmpLoadSideVolFlowRate - nomLoadSideVolFlowUser) / nomLoadSideVolFlowUser) >
1420 0 : state.dataSize->AutoVsHardSizingThreshold) {
1421 0 : ShowMessage(state, "sizeHeatingWaterToWaterHP: Potential issue with equipment sizing for " + this->Name);
1422 0 : ShowContinueError(state,
1423 0 : format("User-Specified Load Side Volume Flow Rate of {:.2R} [m3/s]", nomLoadSideVolFlowUser));
1424 0 : ShowContinueError(
1425 0 : state, format("differs from Design Size Load Side Volume Flow Rate of {:.2R} [m3/s]", tmpLoadSideVolFlowRate));
1426 0 : ShowContinueError(state, "This may, or may not, indicate mismatched component sizes.");
1427 0 : ShowContinueError(state, "Verify that the value entered is intended and is consistent with other components.");
1428 : }
1429 : }
1430 : }
1431 0 : tmpLoadSideVolFlowRate = nomLoadSideVolFlowUser;
1432 : }
1433 : }
1434 : }
1435 : } else { // did not find plant sizing to go with this.
1436 10 : if (this->companionIdentified) {
1437 0 : if (this->ratedLoadVolFlowHeatWasAutoSized && this->RatedLoadVolFlowCool > 0.0) {
1438 : // fill load side flow rate size from companion coil
1439 0 : tmpLoadSideVolFlowRate = this->RatedLoadVolFlowCool;
1440 0 : if (state.dataPlnt->PlantFirstSizesOkayToFinalize) {
1441 0 : this->RatedLoadVolFlowHeat = tmpLoadSideVolFlowRate;
1442 0 : if (state.dataPlnt->PlantFinalSizesOkayToReport && !this->myHeatingSizesReported) {
1443 0 : BaseSizer::reportSizerOutput(state,
1444 : "HeatPump:WaterToWater:EquationFit:Heating",
1445 : this->Name,
1446 : "Design Size Load Side Volume Flow Rate [m3/s]",
1447 0 : tmpLoadSideVolFlowRate);
1448 : }
1449 0 : if (state.dataPlnt->PlantFirstSizesOkayToReport) {
1450 0 : BaseSizer::reportSizerOutput(state,
1451 : "HeatPump:WaterToWater:EquationFit:Heating",
1452 : this->Name,
1453 : "Initial Design Size Load Side Volume Flow Rate [m3/s]",
1454 0 : tmpLoadSideVolFlowRate);
1455 : }
1456 : }
1457 : }
1458 0 : if (this->ratedCapHeatWasAutoSized && this->RatedCapCool > 0.0) {
1459 0 : tmpHeatingCap = this->RatedCapCool;
1460 0 : if (state.dataPlnt->PlantFirstSizesOkayToFinalize) {
1461 0 : this->RatedCapHeat = tmpHeatingCap;
1462 0 : if (state.dataPlnt->PlantFinalSizesOkayToReport && !this->myHeatingSizesReported) {
1463 0 : BaseSizer::reportSizerOutput(
1464 0 : state, "HeatPump:WaterToWater:EquationFit:Heating", this->Name, "Design Size Nominal Capacity [W]", tmpHeatingCap);
1465 : }
1466 0 : if (state.dataPlnt->PlantFirstSizesOkayToReport) {
1467 0 : BaseSizer::reportSizerOutput(state,
1468 : "HeatPump:WaterToWater:EquationFit:Heating",
1469 : this->Name,
1470 : "Initial Design Size Nominal Capacity [W]",
1471 0 : tmpHeatingCap);
1472 : }
1473 : }
1474 : }
1475 :
1476 : } else { // no companion heatpump, no plant sizing object
1477 10 : if ((this->ratedLoadVolFlowHeatWasAutoSized || this->ratedCapHeatWasAutoSized) && state.dataPlnt->PlantFirstSizesOkayToFinalize) {
1478 0 : ShowSevereError(state, "Autosizing of Water to Water Heat Pump requires a loop Sizing:Plant object.");
1479 0 : ShowContinueError(state, "Occurs in HeatPump:WaterToWater:EquationFit:Heating object = " + this->Name);
1480 0 : errorsFound = true;
1481 : }
1482 : }
1483 :
1484 10 : if (!this->ratedLoadVolFlowHeatWasAutoSized && state.dataPlnt->PlantFinalSizesOkayToReport && !this->myHeatingSizesReported) {
1485 3 : BaseSizer::reportSizerOutput(state,
1486 : "HeatPump:WaterToWater:EquationFit:Heating",
1487 : this->Name,
1488 : "User-Specified Load Side Flow Rate [m3/s]",
1489 2 : this->RatedLoadVolFlowHeat);
1490 : }
1491 10 : if (!this->ratedCapHeatWasAutoSized && state.dataPlnt->PlantFinalSizesOkayToReport && !this->myHeatingSizesReported) {
1492 3 : BaseSizer::reportSizerOutput(
1493 2 : state, "HeatPump:WaterToWater:EquationFit:Heating", this->Name, "User-Specified Nominal Capacity [W]", this->RatedCapHeat);
1494 : }
1495 : }
1496 20 : if (!this->ratedLoadVolFlowHeatWasAutoSized) tmpLoadSideVolFlowRate = this->RatedLoadVolFlowHeat;
1497 20 : int pltSourceSizNum = state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).PlantSizNum;
1498 20 : if (pltSourceSizNum > 0) {
1499 0 : Real64 rho = FluidProperties::GetDensityGlycol(state,
1500 0 : state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidName,
1501 : DataGlobalConstants::HWInitConvTemp,
1502 0 : state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidIndex,
1503 0 : RoutineName);
1504 0 : Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state,
1505 0 : state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidName,
1506 : DataGlobalConstants::HWInitConvTemp,
1507 0 : state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidIndex,
1508 0 : RoutineName);
1509 0 : tmpSourceSideVolFlowRate = tmpHeatingCap * (1.0 - (1.0 / this->refCOP)) / (state.dataSize->PlantSizData(pltSourceSizNum).DeltaT * Cp * rho);
1510 : } else {
1511 20 : tmpSourceSideVolFlowRate = tmpLoadSideVolFlowRate; // set source side flow equal to load side flow, assumption
1512 : }
1513 20 : if (this->ratedSourceVolFlowHeatWasAutoSized) {
1514 10 : this->RatedSourceVolFlowHeat = tmpSourceSideVolFlowRate;
1515 10 : if (state.dataPlnt->PlantFinalSizesOkayToReport && !this->myHeatingSizesReported) {
1516 3 : BaseSizer::reportSizerOutput(state,
1517 : "HeatPump:WaterToWater:EquationFit:Heating",
1518 : this->Name,
1519 : "Design Size Source Side Volume Flow Rate [m3/s]",
1520 2 : tmpSourceSideVolFlowRate);
1521 : }
1522 10 : if (state.dataPlnt->PlantFirstSizesOkayToReport) {
1523 0 : BaseSizer::reportSizerOutput(state,
1524 : "HeatPump:WaterToWater:EquationFit:Heating",
1525 : this->Name,
1526 : "Initial Design Size Source Side Volume Flow Rate [m3/s]",
1527 0 : tmpSourceSideVolFlowRate);
1528 : }
1529 : } else {
1530 10 : if (this->RatedSourceVolFlowHeat > 0.0 && tmpSourceSideVolFlowRate > 0.0) {
1531 10 : Real64 nomSourceSideVolFlowUser = this->RatedSourceVolFlowHeat;
1532 10 : if (state.dataPlnt->PlantFinalSizesOkayToReport && !this->myHeatingSizesReported) {
1533 1 : if (state.dataGlobal->DoPlantSizing) {
1534 0 : BaseSizer::reportSizerOutput(state,
1535 : "HeatPump:WaterToWater:EquationFit:Heating",
1536 : this->Name,
1537 : "Design Size Source Side Volume Flow Rate [m3/s]",
1538 : tmpSourceSideVolFlowRate,
1539 : "User-Specified Source Side Volume Flow Rate [m3/s]",
1540 0 : nomSourceSideVolFlowUser);
1541 : } else {
1542 3 : BaseSizer::reportSizerOutput(state,
1543 : "HeatPump:WaterToWater:EquationFit:Heating",
1544 : this->Name,
1545 : "User-Specified Source Side Volume Flow Rate [m3/s]",
1546 2 : nomSourceSideVolFlowUser);
1547 : }
1548 1 : if (state.dataGlobal->DisplayExtraWarnings) {
1549 0 : if ((std::abs(tmpSourceSideVolFlowRate - nomSourceSideVolFlowUser) / nomSourceSideVolFlowUser) >
1550 0 : state.dataSize->AutoVsHardSizingThreshold) {
1551 0 : ShowMessage(state, "sizeHeatingWaterToWaterHP: Potential issue with equipment sizing for " + this->Name);
1552 0 : ShowContinueError(state, format("User-Specified Source Side Volume Flow Rate of {:.2R} [m3/s]", nomSourceSideVolFlowUser));
1553 0 : ShowContinueError(state,
1554 0 : format("differs from Design Size Source Side Volume Flow Rate of {:.2R} [m3/s]", tmpSourceSideVolFlowRate));
1555 0 : ShowContinueError(state, "This may, or may not, indicate mismatched component sizes.");
1556 0 : ShowContinueError(state, "Verify that the value entered is intended and is consistent with other components.");
1557 : }
1558 : }
1559 : }
1560 10 : tmpSourceSideVolFlowRate = nomSourceSideVolFlowUser;
1561 : }
1562 : }
1563 20 : if (!this->ratedSourceVolFlowHeatWasAutoSized) tmpSourceSideVolFlowRate = this->RatedSourceVolFlowHeat;
1564 20 : if (!this->ratedCapHeatWasAutoSized) tmpHeatingCap = this->RatedCapHeat;
1565 20 : if (this->ratedPowerHeatWasAutoSized) {
1566 10 : tmpPowerDraw = tmpHeatingCap / this->refCOP;
1567 10 : this->RatedPowerHeat = tmpPowerDraw;
1568 10 : if (state.dataPlnt->PlantFinalSizesOkayToReport && !this->myHeatingSizesReported) {
1569 3 : BaseSizer::reportSizerOutput(
1570 2 : state, "HeatPump:WaterToWater:EquationFit:Heating", this->Name, "Design Size Heating Power Consumption [W]", tmpPowerDraw);
1571 : }
1572 10 : if (state.dataPlnt->PlantFirstSizesOkayToReport) {
1573 0 : BaseSizer::reportSizerOutput(
1574 0 : state, "HeatPump:WaterToWater:EquationFit:Heating", this->Name, "Initial Design Size Heating Power Consumption [W]", tmpPowerDraw);
1575 : }
1576 : } else {
1577 10 : if (this->RatedPowerHeat > 0.0 && tmpPowerDraw > 0.0) {
1578 10 : Real64 nomPowerDrawUser = this->RatedPowerHeat;
1579 10 : if (state.dataPlnt->PlantFinalSizesOkayToReport && !this->myHeatingSizesReported) {
1580 1 : if (state.dataGlobal->DoPlantSizing) {
1581 0 : BaseSizer::reportSizerOutput(state,
1582 : "HeatPump:WaterToWater:EquationFit:Heating",
1583 : this->Name,
1584 : "Design Size Heating Power Consumption [W]",
1585 : tmpPowerDraw,
1586 : "User-Specified Heating Power Consumption [W]",
1587 0 : nomPowerDrawUser);
1588 : } else {
1589 3 : BaseSizer::reportSizerOutput(state,
1590 : "HeatPump:WaterToWater:EquationFit:Heating",
1591 : this->Name,
1592 : "User-Specified Heating Power Consumption [W]",
1593 2 : nomPowerDrawUser);
1594 : }
1595 1 : if (state.dataGlobal->DisplayExtraWarnings) {
1596 0 : if ((std::abs(tmpPowerDraw - nomPowerDrawUser) / nomPowerDrawUser) > state.dataSize->AutoVsHardSizingThreshold) {
1597 0 : ShowMessage(state, "sizeHeatingWaterToWaterHP: Potential issue with equipment sizing for " + this->Name);
1598 0 : ShowContinueError(state, format("User-Specified Heating Power Consumption of {:.2R} [W]", nomPowerDrawUser));
1599 0 : ShowContinueError(state, format("differs from Design Size Heating Power Consumption of {:.2R} [W]", tmpPowerDraw));
1600 0 : ShowContinueError(state, "This may, or may not, indicate mismatched component sizes.");
1601 0 : ShowContinueError(state, "Verify that the value entered is intended and is consistent with other components.");
1602 : }
1603 : }
1604 : }
1605 10 : tmpPowerDraw = nomPowerDrawUser;
1606 10 : this->refCOP = tmpHeatingCap / tmpPowerDraw;
1607 : }
1608 : }
1609 :
1610 20 : PlantUtilities::RegisterPlantCompDesignFlow(state, this->LoadSideInletNodeNum, tmpLoadSideVolFlowRate);
1611 : // register half of source side flow to avoid double counting
1612 20 : PlantUtilities::RegisterPlantCompDesignFlow(state, this->SourceSideInletNodeNum, tmpSourceSideVolFlowRate * 0.5);
1613 :
1614 20 : if (state.dataPlnt->PlantFinalSizesOkayToReport && !this->myHeatingSizesReported) {
1615 : // create predefined report
1616 4 : OutputReportPredefined::PreDefTableEntry(
1617 4 : state, state.dataOutRptPredefined->pdchMechType, this->Name, "HeatPump:WaterToWater:EquationFit:Heating");
1618 2 : OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchMechNomEff, this->Name, this->refCOP);
1619 2 : OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchMechNomCap, this->Name, this->RatedCapHeat);
1620 : }
1621 :
1622 20 : if (state.dataPlnt->PlantFinalSizesOkayToReport) {
1623 4 : this->myHeatingSizesReported = true;
1624 : }
1625 :
1626 20 : if (errorsFound) {
1627 0 : ShowFatalError(state, "Preceding sizing errors cause program termination");
1628 : }
1629 20 : }
1630 :
1631 34059 : void GshpSpecs::CalcWatertoWaterHPCooling(EnergyPlusData &state, Real64 const MyLoad)
1632 : {
1633 : // SUBROUTINE INFORMATION:
1634 : // AUTHOR Kenneth Tang
1635 : // DATE WRITTEN March 2005
1636 : // MODIFIED
1637 : // RE-ENGINEERED
1638 :
1639 : // PURPOSE OF THIS SUBROUTINE:
1640 : // This routine simulate the heat pump peformance in cooling mode
1641 :
1642 : // REFERENCES:
1643 : // (1) Tang,C.C.. 2005. Modeling Packaged Heat Pumps in a Quasi-Steady
1644 : // State Energy Simulation Program. M.S. Thesis, Department of Mechanical and Aerospace Engineering,
1645 : // Oklahoma State University. (downloadable from http://www.hvac.okstate.edu/)
1646 :
1647 : // Using/Aliasing
1648 34059 : auto &TimeStepSys = state.dataHVACGlobal->TimeStepSys;
1649 : using Curve::CurveValue;
1650 : using FluidProperties::GetDensityGlycol;
1651 : using FluidProperties::GetSpecificHeatGlycol;
1652 :
1653 : // SUBROUTINE PARAMETER DEFINITIONS:
1654 34059 : Real64 constexpr CelsiustoKelvin(DataGlobalConstants::KelvinConv); // Conversion from Celsius to Kelvin
1655 34059 : Real64 constexpr Tref(283.15); // Reference Temperature for performance curves,10C [K]
1656 : static constexpr std::string_view RoutineName("CalcWatertoWaterHPCooling");
1657 :
1658 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
1659 : Real64 CoolCapRated; // Rated Cooling Capacity [W]
1660 : Real64 CoolPowerRated; // Rated Cooling Power Consumption[W]
1661 : Real64 LoadSideVolFlowRateRated; // Rated Load Side Volumetric Flow Rate [m3/s]
1662 : Real64 SourceSideVolFlowRateRated; // Rated Source Side Volumetric Flow Rate [m3/s]
1663 :
1664 : Real64 LoadSideMassFlowRate; // Load Side Mass Flow Rate [kg/s]
1665 : Real64 LoadSideInletTemp; // Load Side Inlet Temperature [C]
1666 : Real64 LoadSideOutletTemp; // Load side Outlet Temperature [C]
1667 : Real64 SourceSideMassFlowRate; // Source Side Mass Flow Rate [kg/s]
1668 : Real64 SourceSideInletTemp; // Source Side Inlet Temperature [C]
1669 : Real64 SourceSideOutletTemp; // Source Side Outlet Temperature [C]
1670 :
1671 : Real64 func1; // Portion of the heat transfer and power equation
1672 : Real64 func2; // Portion of the heat transfer and power equation
1673 : Real64 func3; // Portion of the heat transfer and power equation
1674 : Real64 func4; // Portion of the heat transfer and power equation
1675 : Real64 Power; // Power Consumption [W]
1676 : Real64 QLoad; // Cooling Capacity [W]
1677 : Real64 QSource; // Source Side Heat Transfer Rate [W]
1678 : Real64 PartLoadRatio; // Part-Load Ratio
1679 : Real64 ReportingConstant;
1680 : Real64 rhoLoadSide;
1681 : Real64 rhoSourceSide;
1682 : Real64 CpLoadSide;
1683 : Real64 CpSourceSide;
1684 :
1685 : // LOAD LOCAL VARIABLES FROM DATA STRUCTURE
1686 34059 : LoadSideVolFlowRateRated = this->RatedLoadVolFlowCool;
1687 34059 : SourceSideVolFlowRateRated = this->RatedSourceVolFlowCool;
1688 34059 : CoolCapRated = this->RatedCapCool;
1689 34059 : CoolPowerRated = this->RatedPowerCool;
1690 :
1691 34059 : LoadSideMassFlowRate = this->reportLoadSideMassFlowRate;
1692 34059 : LoadSideInletTemp = this->reportLoadSideInletTemp;
1693 34059 : SourceSideMassFlowRate = this->reportSourceSideMassFlowRate;
1694 34059 : SourceSideInletTemp = this->reportSourceSideInletTemp;
1695 :
1696 : // If heat pump is not operating, THEN return
1697 34059 : if (!this->MustRun) {
1698 17719 : return;
1699 : }
1700 :
1701 32680 : rhoLoadSide = GetDensityGlycol(state,
1702 16340 : state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName,
1703 : LoadSideInletTemp,
1704 16340 : state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex,
1705 : RoutineName);
1706 :
1707 32680 : rhoSourceSide = GetDensityGlycol(state,
1708 16340 : state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidName,
1709 : SourceSideInletTemp,
1710 16340 : state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidIndex,
1711 : RoutineName);
1712 :
1713 16340 : func1 = ((LoadSideInletTemp + CelsiustoKelvin) / Tref);
1714 16340 : func2 = ((SourceSideInletTemp + CelsiustoKelvin) / Tref);
1715 16340 : func3 = (LoadSideMassFlowRate / (LoadSideVolFlowRateRated * rhoLoadSide));
1716 16340 : func4 = (SourceSideMassFlowRate / (SourceSideVolFlowRateRated * rhoSourceSide));
1717 :
1718 16340 : QLoad = CoolCapRated * CurveValue(state, this->CoolCapCurveIndex, func1, func2, func3, func4);
1719 :
1720 16340 : Power = CoolPowerRated * CurveValue(state, this->CoolPowCurveIndex, func1, func2, func3, func4);
1721 :
1722 16340 : if ((QLoad <= 0.0 || Power <= 0.0) && !state.dataGlobal->WarmupFlag) {
1723 0 : if (QLoad <= 0.0) {
1724 0 : if (this->CoolCapNegativeCounter < 1) {
1725 0 : ++this->CoolCapNegativeCounter;
1726 0 : ShowWarningError(state, HPEqFitCooling + " \"" + this->Name + "\":");
1727 0 : ShowContinueError(state, format(" Cooling capacity curve output is <= 0.0 ({:.4T}).", QLoad));
1728 0 : ShowContinueError(state, format(" Zero or negative value occurs with a load-side inlet temperature of {:.2T} C,", LoadSideInletTemp));
1729 0 : ShowContinueError(state, format(" a source-side inlet temperature of {:.2T} C,", SourceSideInletTemp));
1730 0 : ShowContinueError(state, format(" a load-side mass flow rate of {:.3T} kg/s,", LoadSideMassFlowRate));
1731 0 : ShowContinueError(state, format(" and a source-side mass flow rate of {:.3T} kg/s.", SourceSideMassFlowRate));
1732 0 : ShowContinueErrorTimeStamp(state, " The heat pump is turned off for this time step but simulation continues.");
1733 : } else {
1734 0 : ShowRecurringWarningErrorAtEnd(state,
1735 0 : HPEqFitCooling + " \"" + this->Name +
1736 : "\": Cooling capacity curve output is <= 0.0 warning continues...",
1737 : this->CoolCapNegativeIndex,
1738 : QLoad,
1739 : QLoad);
1740 : }
1741 : }
1742 0 : if (Power <= 0.0) {
1743 0 : if (this->CoolPowerNegativeCounter < 1) {
1744 0 : ++this->CoolPowerNegativeCounter;
1745 0 : ShowWarningError(state, HPEqFitCooling + " \"" + this->Name + "\":");
1746 0 : ShowContinueError(state, format(" Cooling compressor power curve output is <= 0.0 ({:.4T}).", Power));
1747 0 : ShowContinueError(state, format(" Zero or negative value occurs with a load-side inlet temperature of {:.2T} C,", LoadSideInletTemp));
1748 0 : ShowContinueError(state, format(" a source-side inlet temperature of {:.2T} C,", SourceSideInletTemp));
1749 0 : ShowContinueError(state, format(" a load-side mass flow rate of {:.3T} kg/s,", LoadSideMassFlowRate));
1750 0 : ShowContinueError(state, format(" and a source-side mass flow rate of {:.3T} kg/s.", SourceSideMassFlowRate));
1751 0 : ShowContinueErrorTimeStamp(state, " The heat pump is turned off for this time step but simulation continues.");
1752 : } else {
1753 0 : ShowRecurringWarningErrorAtEnd(state,
1754 0 : HPEqFitCooling + " \"" + this->Name +
1755 : "\": Cooling compressor power curve output is <= 0.0 warning continues...",
1756 : this->CoolPowerNegativeIndex,
1757 : Power,
1758 : Power);
1759 : }
1760 : }
1761 :
1762 0 : QLoad = 0.0;
1763 0 : Power = 0.0;
1764 : }
1765 :
1766 16340 : QSource = QLoad + Power; // assume no losses
1767 :
1768 : // Control Strategy
1769 16340 : if (std::abs(MyLoad) < QLoad && QLoad != 0.0) {
1770 16328 : PartLoadRatio = std::abs(MyLoad) / QLoad;
1771 16328 : QLoad = std::abs(MyLoad);
1772 16328 : Power *= PartLoadRatio;
1773 16328 : QSource *= PartLoadRatio;
1774 : }
1775 :
1776 32680 : CpLoadSide = GetSpecificHeatGlycol(state,
1777 16340 : state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName,
1778 : LoadSideInletTemp,
1779 16340 : state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex,
1780 : RoutineName);
1781 :
1782 32680 : CpSourceSide = GetSpecificHeatGlycol(state,
1783 16340 : state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidName,
1784 : SourceSideInletTemp,
1785 16340 : state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidIndex,
1786 : RoutineName);
1787 :
1788 16340 : LoadSideOutletTemp = LoadSideInletTemp - QLoad / (LoadSideMassFlowRate * CpLoadSide);
1789 16340 : SourceSideOutletTemp = SourceSideInletTemp + QSource / (SourceSideMassFlowRate * CpSourceSide);
1790 :
1791 16340 : ReportingConstant = TimeStepSys * DataGlobalConstants::SecInHour;
1792 :
1793 16340 : this->reportPower = Power;
1794 16340 : this->reportEnergy = Power * ReportingConstant;
1795 16340 : this->reportQSource = QSource;
1796 16340 : this->reportQLoad = QLoad;
1797 16340 : this->reportQSourceEnergy = QSource * ReportingConstant;
1798 16340 : this->reportQLoadEnergy = QLoad * ReportingConstant;
1799 16340 : this->reportLoadSideOutletTemp = LoadSideOutletTemp;
1800 16340 : this->reportSourceSideOutletTemp = SourceSideOutletTemp;
1801 : }
1802 :
1803 34059 : void GshpSpecs::CalcWatertoWaterHPHeating(EnergyPlusData &state, Real64 const MyLoad)
1804 : {
1805 : // SUBROUTINE INFORMATION:
1806 : // AUTHOR Kenneth Tang
1807 : // DATE WRITTEN March 2005
1808 : // MODIFIED
1809 : // RE-ENGINEERED
1810 :
1811 : // PURPOSE OF THIS SUBROUTINE:
1812 : // This routine simulate the heat pump peformance in heating mode
1813 :
1814 : // REFERENCES:
1815 : // (1) Tang,C.C.. 2005. Modeling Packaged Heat Pumps in a Quasi-Steady
1816 : // State Energy Simulation Program. M.S. Thesis, Department of Mechanical and Aerospace Engineering,
1817 : // Oklahoma State University. (downloadable from http://www.hvac.okstate.edu/)
1818 :
1819 : // Using/Aliasing
1820 34059 : auto &TimeStepSys = state.dataHVACGlobal->TimeStepSys;
1821 : using Curve::CurveValue;
1822 : using FluidProperties::GetDensityGlycol;
1823 : using FluidProperties::GetSpecificHeatGlycol;
1824 :
1825 : // SUBROUTINE PARAMETER DEFINITIONS:
1826 34059 : Real64 const CelsiustoKelvin(DataGlobalConstants::KelvinConv); // Conversion from Celsius to Kelvin
1827 34059 : Real64 constexpr Tref(283.15); // Reference Temperature for performance curves,10C [K]
1828 : static constexpr std::string_view RoutineName("CalcWatertoWaterHPHeating");
1829 :
1830 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
1831 :
1832 : Real64 HeatCapRated; // Rated Heating Capacity [W]
1833 : Real64 HeatPowerRated; // Rated Heating Compressor Power[W]
1834 : Real64 LoadSideVolFlowRateRated; // Rated Load Side Volumetric Flow Rate [m3/s]
1835 : Real64 SourceSideVolFlowRateRated; // Rated Source Side Volumetric Flow Rate [m3/s]
1836 : Real64 LoadSideMassFlowRate; // Load Side Mass Flow Rate [kg/s]
1837 : Real64 LoadSideInletTemp; // Load Side Inlet Temperature [C]
1838 : Real64 LoadSideOutletTemp; // Load side Outlet Temperature [C]
1839 : Real64 SourceSideMassFlowRate; // Source Side Mass Flow Rate [kg/s]
1840 : Real64 SourceSideInletTemp; // Source Side Inlet Temperature [C]
1841 : Real64 SourceSideOutletTemp; // Source Side Outlet Temperature [C]
1842 : Real64 func1; // Portion of the heat transfer and power equation
1843 : Real64 func2; // Portion of the heat transfer and power equation
1844 : Real64 func3; // Portion of the heat transfer and power equation
1845 : Real64 func4; // Portion of the heat transfer and power equation
1846 : Real64 Power; // Power Consumption [W]
1847 : Real64 QLoad; // Cooling Capacity [W]
1848 : Real64 QSource; // Source Side Heat Transfer Rate [W]
1849 : Real64 PartLoadRatio; // Part Load Ratio
1850 : Real64 ReportingConstant;
1851 : Real64 rhoLoadSide;
1852 : Real64 rhoSourceSide;
1853 : Real64 CpLoadSide;
1854 : Real64 CpSourceSide;
1855 :
1856 : // LOAD LOCAL VARIABLES FROM DATA STRUCTURE
1857 34059 : LoadSideVolFlowRateRated = this->RatedLoadVolFlowHeat;
1858 34059 : SourceSideVolFlowRateRated = this->RatedSourceVolFlowHeat;
1859 34059 : HeatCapRated = this->RatedCapHeat;
1860 34059 : HeatPowerRated = this->RatedPowerHeat;
1861 :
1862 34059 : LoadSideMassFlowRate = this->reportLoadSideMassFlowRate;
1863 34059 : LoadSideInletTemp = this->reportLoadSideInletTemp;
1864 34059 : SourceSideMassFlowRate = this->reportSourceSideMassFlowRate;
1865 34059 : SourceSideInletTemp = this->reportSourceSideInletTemp;
1866 :
1867 : // If heat pump is not operating, THEN return
1868 34059 : if (!this->MustRun) {
1869 16827 : return;
1870 : }
1871 34464 : rhoLoadSide = GetDensityGlycol(state,
1872 17232 : state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName,
1873 : LoadSideInletTemp,
1874 17232 : state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex,
1875 : RoutineName);
1876 :
1877 34464 : rhoSourceSide = GetDensityGlycol(state,
1878 17232 : state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidName,
1879 : SourceSideInletTemp,
1880 17232 : state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidIndex,
1881 : RoutineName);
1882 :
1883 17232 : func1 = ((LoadSideInletTemp + CelsiustoKelvin) / Tref);
1884 17232 : func2 = ((SourceSideInletTemp + CelsiustoKelvin) / Tref);
1885 17232 : func3 = (LoadSideMassFlowRate / (LoadSideVolFlowRateRated * rhoLoadSide));
1886 17232 : func4 = (SourceSideMassFlowRate / (SourceSideVolFlowRateRated * rhoSourceSide));
1887 :
1888 17232 : QLoad = HeatCapRated * CurveValue(state, this->HeatCapCurveIndex, func1, func2, func3, func4);
1889 17232 : Power = HeatPowerRated * CurveValue(state, this->HeatPowCurveIndex, func1, func2, func3, func4);
1890 :
1891 17232 : if ((QLoad <= 0.0 || Power <= 0.0) && !state.dataGlobal->WarmupFlag) {
1892 0 : if (QLoad <= 0.0) {
1893 0 : if (this->HeatCapNegativeCounter < 1) {
1894 0 : ++this->HeatCapNegativeCounter;
1895 0 : ShowWarningError(state, HPEqFitHeating + " \"" + this->Name + "\":");
1896 0 : ShowContinueError(state, format(" Heating capacity curve output is <= 0.0 ({:.4T}).", QLoad));
1897 0 : ShowContinueError(state, format(" Zero or negative value occurs with a load-side inlet temperature of {:.2T} C,", LoadSideInletTemp));
1898 0 : ShowContinueError(state, format(" a source-side inlet temperature of {:.2T} C,", SourceSideInletTemp));
1899 0 : ShowContinueError(state, format(" a load-side mass flow rate of {:.3T} kg/s,", LoadSideMassFlowRate));
1900 0 : ShowContinueError(state, format(" and a source-side mass flow rate of {:.3T} kg/s.", SourceSideMassFlowRate));
1901 0 : ShowContinueErrorTimeStamp(state, " The heat pump is turned off for this time step but simulation continues.");
1902 : } else {
1903 0 : ShowRecurringWarningErrorAtEnd(state,
1904 0 : HPEqFitHeating + " \"" + this->Name +
1905 : "\": Heating capacity curve output is <= 0.0 warning continues...",
1906 : this->HeatCapNegativeIndex,
1907 : QLoad,
1908 : QLoad);
1909 : }
1910 : }
1911 0 : if (Power <= 0.0) {
1912 0 : if (this->HeatPowerNegativeCounter < 1) {
1913 0 : ++this->HeatPowerNegativeCounter;
1914 0 : ShowWarningError(state, HPEqFitHeating + " \"" + this->Name + "\":");
1915 0 : ShowContinueError(state, format(" Heating compressor power curve output is <= 0.0 ({:.4T}).", Power));
1916 0 : ShowContinueError(state, format(" Zero or negative value occurs with a load-side inlet temperature of {:.2T} C,", LoadSideInletTemp));
1917 0 : ShowContinueError(state, format(" a source-side inlet temperature of {:.2T} C,", SourceSideInletTemp));
1918 0 : ShowContinueError(state, format(" a load-side mass flow rate of {:.3T} kg/s,", LoadSideMassFlowRate));
1919 0 : ShowContinueError(state, format(" and a source-side mass flow rate of {:.3T} kg/s.", SourceSideMassFlowRate));
1920 0 : ShowContinueErrorTimeStamp(state, " The heat pump is turned off for this time step but simulation continues.");
1921 : } else {
1922 0 : ShowRecurringWarningErrorAtEnd(state,
1923 0 : HPEqFitHeating + " \"" + this->Name +
1924 : "\": Heating compressor power curve output is <= 0.0 warning continues...",
1925 : this->HeatPowerNegativeIndex,
1926 : Power,
1927 : Power);
1928 : }
1929 : }
1930 :
1931 0 : QLoad = 0.0;
1932 0 : Power = 0.0;
1933 : }
1934 :
1935 17232 : QSource = QLoad - Power; // assume no losses
1936 :
1937 : // Control Strategy
1938 17232 : if (std::abs(MyLoad) < QLoad && QLoad != 0.0) {
1939 17232 : PartLoadRatio = std::abs(MyLoad) / QLoad;
1940 17232 : QLoad = std::abs(MyLoad);
1941 17232 : Power *= PartLoadRatio;
1942 17232 : QSource *= PartLoadRatio;
1943 : }
1944 :
1945 34464 : CpLoadSide = GetSpecificHeatGlycol(state,
1946 17232 : state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName,
1947 : LoadSideInletTemp,
1948 17232 : state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex,
1949 : RoutineName);
1950 :
1951 34464 : CpSourceSide = GetSpecificHeatGlycol(state,
1952 17232 : state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidName,
1953 : SourceSideInletTemp,
1954 17232 : state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidIndex,
1955 : RoutineName);
1956 :
1957 17232 : LoadSideOutletTemp = LoadSideInletTemp + QLoad / (LoadSideMassFlowRate * CpLoadSide);
1958 17232 : SourceSideOutletTemp = SourceSideInletTemp - QSource / (SourceSideMassFlowRate * CpSourceSide);
1959 :
1960 17232 : ReportingConstant = TimeStepSys * DataGlobalConstants::SecInHour;
1961 :
1962 17232 : this->reportPower = Power;
1963 17232 : this->reportEnergy = Power * ReportingConstant;
1964 17232 : this->reportQSource = QSource;
1965 17232 : this->reportQLoad = QLoad;
1966 17232 : this->reportQSourceEnergy = QSource * ReportingConstant;
1967 17232 : this->reportQLoadEnergy = QLoad * ReportingConstant;
1968 17232 : this->reportLoadSideOutletTemp = LoadSideOutletTemp;
1969 17232 : this->reportSourceSideOutletTemp = SourceSideOutletTemp;
1970 : }
1971 :
1972 68118 : void GshpSpecs::UpdateGSHPRecords(EnergyPlusData &state)
1973 : {
1974 : // SUBROUTINE INFORMATION:
1975 : // AUTHOR: Kenneth Tang
1976 : // DATE WRITTEN: March 2005
1977 :
1978 68118 : int LoadSideOutletNode = this->LoadSideOutletNodeNum;
1979 68118 : int SourceSideOutletNode = this->SourceSideOutletNodeNum;
1980 :
1981 68118 : if (!this->MustRun) {
1982 : // Heatpump is off; just pass through conditions
1983 34546 : this->reportPower = 0.0;
1984 34546 : this->reportEnergy = 0.0;
1985 34546 : this->reportQSource = 0.0;
1986 34546 : this->reportQSourceEnergy = 0.0;
1987 34546 : this->reportQLoad = 0.0;
1988 34546 : this->reportQLoadEnergy = 0.0;
1989 34546 : this->reportLoadSideOutletTemp = this->reportLoadSideInletTemp;
1990 34546 : this->reportSourceSideOutletTemp = this->reportSourceSideInletTemp;
1991 : }
1992 :
1993 68118 : state.dataLoopNodes->Node(SourceSideOutletNode).Temp = this->reportSourceSideOutletTemp;
1994 68118 : state.dataLoopNodes->Node(LoadSideOutletNode).Temp = this->reportLoadSideOutletTemp;
1995 68118 : }
1996 0 : void GshpSpecs::oneTimeInit([[maybe_unused]] EnergyPlusData &state)
1997 : {
1998 0 : }
1999 4 : void GshpSpecs::oneTimeInit_new([[maybe_unused]] EnergyPlusData &state)
2000 : {
2001 4 : }
2002 :
2003 2313 : } // namespace EnergyPlus::HeatPumpWaterToWaterSimple
|