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 <cassert>
50 : #include <cmath>
51 :
52 : // ObjexxFCL Headers
53 : #include <ObjexxFCL/Fmath.hh>
54 :
55 : // EnergyPlus Headers
56 : #include <EnergyPlus/Autosizing/Base.hh>
57 : #include <EnergyPlus/BranchNodeConnections.hh>
58 : #include <EnergyPlus/CurveManager.hh>
59 : #include <EnergyPlus/Data/EnergyPlusData.hh>
60 : #include <EnergyPlus/DataBranchAirLoopPlant.hh>
61 : #include <EnergyPlus/DataEnvironment.hh>
62 : #include <EnergyPlus/DataHeatBalance.hh>
63 : #include <EnergyPlus/DataIPShortCuts.hh>
64 : #include <EnergyPlus/DataLoopNode.hh>
65 : #include <EnergyPlus/DataSizing.hh>
66 : #include <EnergyPlus/DataWater.hh>
67 : #include <EnergyPlus/DataZoneEquipment.hh>
68 : #include <EnergyPlus/EMSManager.hh>
69 : #include <EnergyPlus/FluidProperties.hh>
70 : #include <EnergyPlus/General.hh>
71 : #include <EnergyPlus/GeneralRoutines.hh>
72 : #include <EnergyPlus/GlobalNames.hh>
73 : #include <EnergyPlus/HeatBalanceInternalHeatGains.hh>
74 : #include <EnergyPlus/InputProcessing/InputProcessor.hh>
75 : #include <EnergyPlus/NodeInputManager.hh>
76 : #include <EnergyPlus/OutputProcessor.hh>
77 : #include <EnergyPlus/OutputReportPredefined.hh>
78 : #include <EnergyPlus/PackagedThermalStorageCoil.hh>
79 : #include <EnergyPlus/Plant/DataPlant.hh>
80 : #include <EnergyPlus/PlantUtilities.hh>
81 : #include <EnergyPlus/Psychrometrics.hh>
82 : #include <EnergyPlus/ScheduleManager.hh>
83 : #include <EnergyPlus/UtilityRoutines.hh>
84 : #include <EnergyPlus/WaterManager.hh>
85 : #include <EnergyPlus/WaterThermalTanks.hh>
86 :
87 : namespace EnergyPlus::PackagedThermalStorageCoil {
88 :
89 : // Module containing the routines dealing with the packaged thermal storage cooling
90 :
91 : // MODULE INFORMATION:
92 : // AUTHOR Brent Griffith
93 : // DATE WRITTEN April 2013
94 : // MODIFIED na
95 : // RE-ENGINEERED na
96 :
97 : // PURPOSE OF THIS MODULE:
98 : // encapsulate the data and algorithms for modeling packaged thermals storage cooling coils
99 :
100 : // Using/Aliasing
101 : using namespace DataLoopNode;
102 : using namespace Psychrometrics;
103 : using namespace Curve;
104 :
105 : constexpr std::array<std::string_view, static_cast<int>(PTSCCtrlType::Num)> modeControlStrings = {"SCHEDULEDMODES", "EMSCONTROLLED"};
106 : constexpr std::array<std::string_view, static_cast<int>(MediaType::Num)> mediaStrings = {"WATER", "USERDEFINEDFLUIDTYPE", "ICE"};
107 : constexpr std::array<std::string_view, static_cast<int>(TESCondenserType::Num)> condenserTypesUC = {"AIRCOOLED", "EVAPORATIVELYCOOLED"};
108 : constexpr Real64 gigaJoulesToJoules = 1.e+09;
109 :
110 64047 : void SimTESCoil(EnergyPlusData &state,
111 : std::string_view CompName, // name of the fan coil unit
112 : int &CompIndex,
113 : int const FanOpMode, // allows parent object to control fan mode
114 : PTSCOperatingMode &TESOpMode,
115 : Optional<Real64 const> PartLoadRatio // part load ratio (for single speed cycling unit)
116 : )
117 : {
118 :
119 : // SUBROUTINE INFORMATION:
120 : // AUTHOR <author>
121 : // DATE WRITTEN <date_written>
122 : // MODIFIED na
123 : // RE-ENGINEERED na
124 :
125 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
126 : int TESCoilNum;
127 :
128 64047 : if (state.dataPackagedThermalStorageCoil->GetTESInputFlag) {
129 0 : GetTESCoilInput(state);
130 0 : state.dataPackagedThermalStorageCoil->GetTESInputFlag = false;
131 : }
132 :
133 64047 : if (CompIndex == 0) {
134 0 : TESCoilNum = UtilityRoutines::FindItemInList(CompName, state.dataPackagedThermalStorageCoil->TESCoil);
135 0 : if (TESCoilNum == 0) {
136 0 : ShowFatalError(state, "Thermal Energy Storage Cooling Coil not found=" + std::string{CompName});
137 : }
138 0 : CompIndex = TESCoilNum;
139 : } else {
140 64047 : TESCoilNum = CompIndex;
141 64047 : if (TESCoilNum > state.dataPackagedThermalStorageCoil->NumTESCoils || TESCoilNum < 1) {
142 0 : ShowFatalError(state,
143 0 : format("SimTESCoil: Invalid CompIndex passed={}, Number of Thermal Energy Storage Cooling Coil Coils={}, Coil name={}",
144 : TESCoilNum,
145 0 : state.dataPackagedThermalStorageCoil->NumTESCoils,
146 0 : CompName));
147 : }
148 64047 : if (state.dataPackagedThermalStorageCoil->CheckEquipName(TESCoilNum)) {
149 4 : if (!CompName.empty() && CompName != state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name) {
150 0 : ShowFatalError(state,
151 0 : format("SimTESCoil: Invalid CompIndex passed={}, Coil name={}, stored Coil Name for that index={}",
152 : TESCoilNum,
153 : CompName,
154 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name));
155 : }
156 4 : state.dataPackagedThermalStorageCoil->CheckEquipName(TESCoilNum) = false;
157 : }
158 : }
159 :
160 64047 : TESOpMode = PTSCOperatingMode::CoolingOnly;
161 :
162 64047 : InitTESCoil(state, TESCoilNum);
163 :
164 64047 : TESOpMode = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CurControlMode;
165 64047 : switch (TESOpMode) {
166 12 : case PTSCOperatingMode::Off:
167 12 : CalcTESCoilOffMode(state, TESCoilNum);
168 12 : break;
169 30944 : case PTSCOperatingMode::CoolingOnly:
170 30944 : CalcTESCoilCoolingOnlyMode(state, TESCoilNum, FanOpMode, PartLoadRatio);
171 30944 : break;
172 14096 : case PTSCOperatingMode::CoolingAndCharge:
173 14096 : CalcTESCoilCoolingAndChargeMode(state, TESCoilNum, FanOpMode, PartLoadRatio);
174 14096 : break;
175 2394 : case PTSCOperatingMode::CoolingAndDischarge:
176 2394 : CalcTESCoilCoolingAndDischargeMode(state, TESCoilNum, FanOpMode, PartLoadRatio);
177 2394 : break;
178 1344 : case PTSCOperatingMode::ChargeOnly:
179 1344 : CalcTESCoilChargeOnlyMode(state, TESCoilNum);
180 1344 : break;
181 15257 : case PTSCOperatingMode::DischargeOnly:
182 15257 : CalcTESCoilDischargeOnlyMode(state, TESCoilNum, PartLoadRatio);
183 15257 : break;
184 0 : default:
185 0 : assert(false);
186 : }
187 64047 : }
188 :
189 1 : void GetTESCoilInput(EnergyPlusData &state)
190 : {
191 :
192 : // SUBROUTINE INFORMATION:
193 : // AUTHOR <author>
194 : // DATE WRITTEN <date_written>
195 : // MODIFIED na
196 : // RE-ENGINEERED na
197 :
198 : // Using/Aliasing
199 : using BranchNodeConnections::TestCompSet;
200 : using DataZoneEquipment::FindControlledZoneIndexFromSystemNodeNumberForZone;
201 : using FluidProperties::CheckFluidPropertyName;
202 : using FluidProperties::FindGlycol;
203 : using FluidProperties::GetFluidDensityTemperatureLimits;
204 : using FluidProperties::GetFluidSpecificHeatTemperatureLimits;
205 : using GlobalNames::VerifyUniqueCoilName;
206 : using NodeInputManager::GetOnlySingleNode;
207 : using ScheduleManager::GetScheduleIndex;
208 : using WaterManager::SetupTankDemandComponent;
209 : using WaterManager::SetupTankSupplyComponent;
210 :
211 : // SUBROUTINE PARAMETER DEFINITIONS:
212 : static constexpr std::string_view RoutineName("GetTESCoilInput: "); // include trailing blank space
213 :
214 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
215 : int item; // do loop counter
216 : int NumAlphas; // Number of alphas in input
217 : int NumNumbers; // Number of numeric items in input
218 : int IOStatus; // Input status returned from GetObjectItem
219 1 : bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine
220 : Real64 TminRho;
221 : Real64 TmaxRho;
222 : Real64 TminCp;
223 : Real64 TmaxCp;
224 : int ZoneIndexTrial;
225 1 : auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject;
226 1 : cCurrentModuleObject = "Coil:Cooling:DX:SingleSpeed:ThermalStorage";
227 1 : state.dataPackagedThermalStorageCoil->NumTESCoils = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject);
228 :
229 1 : state.dataPackagedThermalStorageCoil->TESCoil.allocate(state.dataPackagedThermalStorageCoil->NumTESCoils);
230 1 : state.dataPackagedThermalStorageCoil->CheckEquipName.dimension(state.dataPackagedThermalStorageCoil->NumTESCoils, true);
231 :
232 5 : for (item = 1; item <= state.dataPackagedThermalStorageCoil->NumTESCoils; ++item) {
233 28 : state.dataInputProcessing->inputProcessor->getObjectItem(state,
234 : cCurrentModuleObject,
235 : item,
236 4 : state.dataIPShortCut->cAlphaArgs,
237 : NumAlphas,
238 4 : state.dataIPShortCut->rNumericArgs,
239 : NumNumbers,
240 : IOStatus,
241 4 : state.dataIPShortCut->lNumericFieldBlanks,
242 4 : state.dataIPShortCut->lAlphaFieldBlanks,
243 4 : state.dataIPShortCut->cAlphaFieldNames,
244 4 : state.dataIPShortCut->cNumericFieldNames);
245 4 : UtilityRoutines::IsNameEmpty(state, state.dataIPShortCut->cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
246 :
247 : // ErrorsFound will be set to True if problem was found, left untouched otherwise
248 4 : VerifyUniqueCoilName(state, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1), ErrorsFound, cCurrentModuleObject + " Name");
249 :
250 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name = state.dataIPShortCut->cAlphaArgs(1);
251 4 : if (state.dataIPShortCut->lAlphaFieldBlanks(2)) {
252 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).AvailSchedNum = DataGlobalConstants::ScheduleAlwaysOn;
253 : } else {
254 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).AvailSchedNum = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2));
255 4 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).AvailSchedNum == 0) {
256 0 : ShowSevereError(state,
257 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" + state.dataPackagedThermalStorageCoil->TESCoil(item).Name +
258 : "\", invalid");
259 0 : ShowContinueError(state, "..." + state.dataIPShortCut->cAlphaFieldNames(2) + "=\"" + state.dataIPShortCut->cAlphaArgs(2) + "\".");
260 0 : ErrorsFound = true;
261 : }
262 : }
263 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).ModeControlType =
264 8 : static_cast<PTSCCtrlType>(getEnumerationValue(modeControlStrings, state.dataIPShortCut->cAlphaArgs(3)));
265 4 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).ModeControlType == PTSCCtrlType::Invalid) {
266 0 : ShowSevereError(state,
267 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" + state.dataPackagedThermalStorageCoil->TESCoil(item).Name +
268 : "\", invalid");
269 0 : ShowContinueError(state, "..." + state.dataIPShortCut->cAlphaFieldNames(3) + "=\"" + state.dataIPShortCut->cAlphaArgs(3) + "\".");
270 0 : ShowContinueError(state, "Available choices are ScheduledModes or EMSControlled");
271 0 : ErrorsFound = true;
272 : }
273 4 : if (state.dataIPShortCut->lAlphaFieldBlanks(4)) {
274 3 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).ModeControlType == PTSCCtrlType::ScheduledOpModes) {
275 0 : ShowSevereError(state,
276 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" + state.dataPackagedThermalStorageCoil->TESCoil(item).Name +
277 : "\", invalid");
278 0 : ShowContinueError(state, state.dataIPShortCut->cAlphaFieldNames(4) + " is blank but a schedule is needed");
279 0 : ErrorsFound = true;
280 : }
281 : } else {
282 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).ControlModeSchedNum = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(4));
283 1 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).ControlModeSchedNum == 0 &&
284 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).ModeControlType == PTSCCtrlType::ScheduledOpModes) {
285 0 : ShowSevereError(state,
286 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" + state.dataPackagedThermalStorageCoil->TESCoil(item).Name +
287 : "\", invalid");
288 0 : ShowContinueError(state, "..." + state.dataIPShortCut->cAlphaFieldNames(4) + "=\"" + state.dataIPShortCut->cAlphaArgs(4) + "\".");
289 0 : ErrorsFound = true;
290 : }
291 : }
292 :
293 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).StorageMedia =
294 8 : static_cast<MediaType>(getEnumerationValue(mediaStrings, state.dataIPShortCut->cAlphaArgs(5)));
295 4 : switch (state.dataPackagedThermalStorageCoil->TESCoil(item).StorageMedia) {
296 3 : case MediaType::Ice:
297 : case MediaType::UserDefindFluid:
298 : // nothing else to do for now
299 3 : break;
300 1 : case MediaType::Water:
301 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).StorageFluidName = "WATER";
302 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).StorageFluidIndex = FindGlycol(state, "WATER");
303 1 : break;
304 0 : default:
305 0 : ShowSevereError(state,
306 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" + state.dataPackagedThermalStorageCoil->TESCoil(item).Name +
307 : "\", invalid");
308 0 : ShowContinueError(state, "..." + state.dataIPShortCut->cAlphaFieldNames(5) + "=\"" + state.dataIPShortCut->cAlphaArgs(5) + "\".");
309 0 : ShowContinueError(state, "Available choices are Ice, Water, or UserDefindedFluidType");
310 0 : ErrorsFound = true;
311 : }
312 :
313 4 : if (UtilityRoutines::SameString(state.dataIPShortCut->cAlphaArgs(5), "USERDEFINEDFLUIDTYPE")) {
314 0 : if (!(state.dataIPShortCut->lAlphaFieldBlanks(6))) {
315 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).StorageFluidName = state.dataIPShortCut->cAlphaArgs(6);
316 0 : if (CheckFluidPropertyName(state, state.dataIPShortCut->cAlphaArgs(6)) == 0) {
317 0 : ShowSevereError(state,
318 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
319 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", missing fluid data");
320 0 : ShowContinueError(state,
321 0 : "Check that fluid property data have been input for fluid name = " + state.dataIPShortCut->cAlphaArgs(6));
322 0 : ErrorsFound = true;
323 : } else {
324 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).StorageFluidIndex = FindGlycol(state, state.dataIPShortCut->cAlphaArgs(6));
325 0 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).StorageFluidIndex == 0) {
326 0 : ShowSevereError(state,
327 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
328 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid fluid data");
329 0 : ShowContinueError(
330 0 : state, "Check that correct fluid property data have been input for fluid name = " + state.dataIPShortCut->cAlphaArgs(6));
331 0 : ErrorsFound = true;
332 : }
333 : }
334 :
335 : } else {
336 0 : ShowSevereError(state,
337 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" + state.dataPackagedThermalStorageCoil->TESCoil(item).Name +
338 : "\", invalid");
339 0 : ShowContinueError(state, "Storage Type is set to UserDefinedFluidType but no name of fluid was entered.");
340 0 : ErrorsFound = true;
341 : }
342 : }
343 :
344 4 : switch (state.dataPackagedThermalStorageCoil->TESCoil(item).StorageMedia) {
345 1 : case MediaType::Water:
346 : case MediaType::UserDefindFluid:
347 1 : if (!state.dataIPShortCut->lNumericFieldBlanks(1)) {
348 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).FluidStorageVolume = state.dataIPShortCut->rNumericArgs(1);
349 : } else {
350 0 : ShowSevereError(state,
351 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" + state.dataPackagedThermalStorageCoil->TESCoil(item).Name +
352 : "\", invalid");
353 0 : ShowContinueError(state, state.dataIPShortCut->cNumericFieldNames(1) + " cannot be blank for Water storage type");
354 0 : ShowContinueError(state, "Enter fluid storage tank volume in m3/s.");
355 0 : ErrorsFound = true;
356 : }
357 1 : break;
358 3 : case MediaType::Ice:
359 3 : if (!state.dataIPShortCut->lNumericFieldBlanks(2)) {
360 3 : if (state.dataIPShortCut->rNumericArgs(2) == DataGlobalConstants::AutoCalculate) {
361 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).IceStorageCapacity = state.dataIPShortCut->rNumericArgs(2);
362 : } else {
363 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).IceStorageCapacity =
364 0 : state.dataIPShortCut->rNumericArgs(2) * gigaJoulesToJoules; // input in giga joules, used as joules internally
365 : }
366 0 : } else if (state.dataIPShortCut->lNumericFieldBlanks(2)) {
367 0 : ShowSevereError(state,
368 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" + state.dataPackagedThermalStorageCoil->TESCoil(item).Name +
369 : "\", invalid");
370 0 : ShowContinueError(state, state.dataIPShortCut->cNumericFieldNames(2) + " cannot be blank for Ice storage type");
371 0 : ShowContinueError(state, "Enter ice storage tank capacity in GJ.");
372 0 : ErrorsFound = true;
373 : }
374 3 : break;
375 0 : default:
376 : // nothing
377 0 : break;
378 : }
379 :
380 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).StorageCapacitySizingFactor = state.dataIPShortCut->rNumericArgs(3);
381 :
382 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).StorageAmbientNodeNum =
383 8 : GetOnlySingleNode(state,
384 4 : state.dataIPShortCut->cAlphaArgs(7),
385 : ErrorsFound,
386 : DataLoopNode::ConnectionObjectType::CoilCoolingDXSingleSpeedThermalStorage,
387 4 : state.dataIPShortCut->cAlphaArgs(1),
388 : DataLoopNode::NodeFluidType::Air,
389 : DataLoopNode::ConnectionType::Sensor,
390 : NodeInputManager::CompFluidStream::Primary,
391 4 : ObjectIsNotParent);
392 :
393 4 : ZoneIndexTrial =
394 4 : FindControlledZoneIndexFromSystemNodeNumberForZone(state, state.dataPackagedThermalStorageCoil->TESCoil(item).StorageAmbientNodeNum);
395 4 : if (ZoneIndexTrial > 0) { // tank is inside a zone so setup internal gains
396 2 : SetupZoneInternalGain(state,
397 : ZoneIndexTrial,
398 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name,
399 : DataHeatBalance::IntGainType::PackagedTESCoilTank,
400 1 : &state.dataPackagedThermalStorageCoil->TESCoil(item).QdotAmbient);
401 : }
402 :
403 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).StorageUA = state.dataIPShortCut->rNumericArgs(4);
404 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).RatedFluidTankTemp = state.dataIPShortCut->rNumericArgs(5);
405 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).RatedEvapAirVolFlowRate = state.dataIPShortCut->rNumericArgs(6);
406 :
407 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).EvapAirInletNodeNum =
408 8 : GetOnlySingleNode(state,
409 4 : state.dataIPShortCut->cAlphaArgs(8),
410 : ErrorsFound,
411 : DataLoopNode::ConnectionObjectType::CoilCoolingDXSingleSpeedThermalStorage,
412 4 : state.dataIPShortCut->cAlphaArgs(1),
413 : DataLoopNode::NodeFluidType::Air,
414 : DataLoopNode::ConnectionType::Inlet,
415 : NodeInputManager::CompFluidStream::Primary,
416 4 : ObjectIsNotParent);
417 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).EvapAirOutletNodeNum =
418 8 : GetOnlySingleNode(state,
419 4 : state.dataIPShortCut->cAlphaArgs(9),
420 : ErrorsFound,
421 : DataLoopNode::ConnectionObjectType::CoilCoolingDXSingleSpeedThermalStorage,
422 4 : state.dataIPShortCut->cAlphaArgs(1),
423 : DataLoopNode::NodeFluidType::Air,
424 : DataLoopNode::ConnectionType::Outlet,
425 : NodeInputManager::CompFluidStream::Primary,
426 4 : ObjectIsNotParent);
427 8 : TestCompSet(state,
428 : cCurrentModuleObject,
429 4 : state.dataIPShortCut->cAlphaArgs(1),
430 4 : state.dataIPShortCut->cAlphaArgs(8),
431 4 : state.dataIPShortCut->cAlphaArgs(9),
432 : "Air Nodes");
433 :
434 4 : BooleanSwitch answer = getYesNoValue(state.dataIPShortCut->cAlphaArgs(10));
435 4 : switch (answer) {
436 4 : case BooleanSwitch::Yes:
437 : case BooleanSwitch::No:
438 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingOnlyModeIsAvailable = static_cast<bool>(answer);
439 4 : break;
440 0 : default:
441 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingOnlyModeIsAvailable = false;
442 0 : ShowSevereError(state,
443 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" + state.dataPackagedThermalStorageCoil->TESCoil(item).Name +
444 : "\", invalid");
445 0 : ShowContinueError(state, "..." + state.dataIPShortCut->cAlphaFieldNames(10) + "=\"" + state.dataIPShortCut->cAlphaArgs(10) + "\".");
446 0 : ShowContinueError(state, "Available choices are Yes or No.");
447 0 : ErrorsFound = true;
448 : }
449 :
450 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingOnlyRatedTotCap = state.dataIPShortCut->rNumericArgs(7);
451 4 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingOnlyModeIsAvailable) { // get input data for this mode
452 :
453 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingOnlyRatedSHR = state.dataIPShortCut->rNumericArgs(8);
454 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingOnlyRatedCOP = state.dataIPShortCut->rNumericArgs(9);
455 :
456 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingOnlyCapFTempCurve = GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(11));
457 4 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingOnlyCapFTempCurve == 0) {
458 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(11)) {
459 0 : ShowSevereError(state,
460 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
461 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
462 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(11) + "is blank.");
463 : } else {
464 0 : ShowSevereError(state,
465 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
466 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
467 0 : ShowContinueError(
468 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(11) + "=\"" + state.dataIPShortCut->cAlphaArgs(11) + "\".");
469 : }
470 0 : ErrorsFound = true;
471 : } else {
472 : // Verify Curve Object
473 12 : ErrorsFound |= Curve::CheckCurveDims(state,
474 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingOnlyCapFTempCurve, // Curve index
475 : {2}, // Valid dimensions
476 : RoutineName, // Routine name
477 : cCurrentModuleObject, // Object Type
478 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
479 4 : state.dataIPShortCut->cAlphaFieldNames(11)); // Field Name
480 : }
481 :
482 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingOnlyCapFFlowCurve = GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(12));
483 4 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingOnlyCapFFlowCurve == 0) {
484 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(12)) {
485 0 : ShowSevereError(state,
486 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
487 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
488 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(12) + "is blank.");
489 : } else {
490 0 : ShowSevereError(state,
491 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
492 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
493 0 : ShowContinueError(
494 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(12) + "=\"" + state.dataIPShortCut->cAlphaArgs(12) + "\".");
495 : }
496 0 : ErrorsFound = true;
497 : } else {
498 : // Verify Curve Object, any curve with just x as single independent variable
499 12 : ErrorsFound |= Curve::CheckCurveDims(state,
500 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingOnlyCapFFlowCurve, // Curve index
501 : {1}, // Valid dimensions
502 : RoutineName, // Routine name
503 : cCurrentModuleObject, // Object Type
504 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
505 4 : state.dataIPShortCut->cAlphaFieldNames(12)); // Field Name
506 : }
507 :
508 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingOnlyEIRFTempCurve = GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(13));
509 4 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingOnlyEIRFTempCurve == 0) {
510 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(13)) {
511 0 : ShowSevereError(state,
512 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
513 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
514 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(13) + "is blank.");
515 : } else {
516 0 : ShowSevereError(state,
517 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
518 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
519 0 : ShowContinueError(
520 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(13) + "=\"" + state.dataIPShortCut->cAlphaArgs(13) + "\".");
521 : }
522 0 : ErrorsFound = true;
523 : } else {
524 : // Verify Curve Object
525 12 : ErrorsFound |= Curve::CheckCurveDims(state,
526 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingOnlyEIRFTempCurve, // Curve index
527 : {2}, // Valid dimensions
528 : RoutineName, // Routine name
529 : cCurrentModuleObject, // Object Type
530 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
531 4 : state.dataIPShortCut->cAlphaFieldNames(13)); // Field Name
532 : }
533 :
534 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingOnlyEIRFFlowCurve = GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(14));
535 4 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingOnlyEIRFFlowCurve == 0) {
536 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(14)) {
537 0 : ShowSevereError(state,
538 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
539 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
540 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(14) + "is blank.");
541 : } else {
542 0 : ShowSevereError(state,
543 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
544 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
545 0 : ShowContinueError(
546 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(14) + "=\"" + state.dataIPShortCut->cAlphaArgs(14) + "\".");
547 : }
548 0 : ErrorsFound = true;
549 : } else {
550 : // Verify Curve Object, any curve with just x as single independent variable
551 12 : ErrorsFound |= Curve::CheckCurveDims(state,
552 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingOnlyEIRFFlowCurve, // Curve index
553 : {1}, // Valid dimensions
554 : RoutineName, // Routine name
555 : cCurrentModuleObject, // Object Type
556 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
557 4 : state.dataIPShortCut->cAlphaFieldNames(14)); // Field Name
558 : }
559 :
560 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingOnlyPLFFPLRCurve = GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(15));
561 4 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingOnlyPLFFPLRCurve == 0) {
562 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(15)) {
563 0 : ShowSevereError(state,
564 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
565 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
566 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(15) + "is blank.");
567 : } else {
568 0 : ShowSevereError(state,
569 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
570 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
571 0 : ShowContinueError(
572 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(15) + "=\"" + state.dataIPShortCut->cAlphaArgs(15) + "\".");
573 : }
574 0 : ErrorsFound = true;
575 : } else {
576 : // Verify Curve Object, any curve with just x as single independent variable
577 12 : ErrorsFound |= Curve::CheckCurveDims(state,
578 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingOnlyPLFFPLRCurve, // Curve index
579 : {1}, // Valid dimensions
580 : RoutineName, // Routine name
581 : cCurrentModuleObject, // Object Type
582 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
583 4 : state.dataIPShortCut->cAlphaFieldNames(15)); // Field Name
584 : }
585 :
586 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingOnlySHRFTempCurve = GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(16));
587 4 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingOnlySHRFTempCurve == 0) {
588 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(16)) {
589 0 : ShowSevereError(state,
590 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
591 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
592 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(16) + "is blank.");
593 : } else {
594 0 : ShowSevereError(state,
595 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
596 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
597 0 : ShowContinueError(
598 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(16) + "=\"" + state.dataIPShortCut->cAlphaArgs(16) + "\".");
599 : }
600 0 : ErrorsFound = true;
601 : } else {
602 : // Verify Curve Object
603 12 : ErrorsFound |= Curve::CheckCurveDims(state,
604 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingOnlySHRFTempCurve, // Curve index
605 : {2}, // Valid dimensions
606 : RoutineName, // Routine name
607 : cCurrentModuleObject, // Object Type
608 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
609 4 : state.dataIPShortCut->cAlphaFieldNames(16)); // Field Name
610 : }
611 :
612 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingOnlySHRFFlowCurve = GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(17));
613 4 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingOnlySHRFFlowCurve == 0) {
614 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(17)) {
615 0 : ShowSevereError(state,
616 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
617 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
618 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(17) + "is blank.");
619 : } else {
620 0 : ShowSevereError(state,
621 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
622 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
623 0 : ShowContinueError(
624 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(17) + "=\"" + state.dataIPShortCut->cAlphaArgs(17) + "\".");
625 : }
626 0 : ErrorsFound = true;
627 : } else {
628 : // Verify Curve Object, any curve with just x as single independent variable
629 12 : ErrorsFound |= Curve::CheckCurveDims(state,
630 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingOnlySHRFFlowCurve, // Curve index
631 : {1}, // Valid dimensions
632 : RoutineName, // Routine name
633 : cCurrentModuleObject, // Object Type
634 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
635 4 : state.dataIPShortCut->cAlphaFieldNames(17)); // Field Name
636 : }
637 : }
638 :
639 4 : BooleanSwitch answer2 = getYesNoValue(state.dataIPShortCut->cAlphaArgs(18));
640 4 : switch (answer2) {
641 4 : case BooleanSwitch::Yes:
642 : case BooleanSwitch::No:
643 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeModeAvailable = static_cast<bool>(answer2);
644 4 : break;
645 0 : default:
646 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeModeAvailable = false;
647 0 : ShowSevereError(state,
648 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" + state.dataPackagedThermalStorageCoil->TESCoil(item).Name +
649 : "\", invalid");
650 0 : ShowContinueError(state, "..." + state.dataIPShortCut->cAlphaFieldNames(18) + "=\"" + state.dataIPShortCut->cAlphaArgs(18) + "\".");
651 0 : ShowContinueError(state, "Available choices are Yes or No.");
652 0 : ErrorsFound = true;
653 : }
654 :
655 4 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeModeAvailable) {
656 :
657 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeRatedTotCap =
658 3 : state.dataIPShortCut->rNumericArgs(10); // gross total evaporator cooling capacity [W]
659 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeRatedTotCapSizingFactor =
660 3 : state.dataIPShortCut->rNumericArgs(11); // sizing factor for gross total evaporator [ ]
661 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeRatedChargeCap =
662 3 : state.dataIPShortCut->rNumericArgs(12); // net storage charging capacity at rating conditions [W]
663 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeRatedChargeCapSizingFactor =
664 3 : state.dataIPShortCut->rNumericArgs(13); // sizing factor for charging capacity [ ]
665 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeRatedSHR =
666 3 : state.dataIPShortCut->rNumericArgs(14); // Sensible heat ratio (sens cap/total cap) [W/W]
667 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeCoolingRatedCOP =
668 3 : state.dataIPShortCut->rNumericArgs(15); // Coefficient of performance , for cooling [W/W]
669 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeChargingRatedCOP =
670 3 : state.dataIPShortCut->rNumericArgs(16); // Coefficient of performance , for charging [W/W]
671 :
672 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeCoolingCapFTempCurve =
673 3 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(19));
674 3 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeCoolingCapFTempCurve == 0) {
675 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(19)) {
676 0 : ShowSevereError(state,
677 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
678 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
679 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(19) + "is blank.");
680 : } else {
681 0 : ShowSevereError(state,
682 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
683 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
684 0 : ShowContinueError(
685 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(19) + "=\"" + state.dataIPShortCut->cAlphaArgs(19) + "\".");
686 : }
687 0 : ErrorsFound = true;
688 : } else {
689 : // Verify Curve Object
690 3 : ErrorsFound |=
691 12 : Curve::CheckCurveDims(state,
692 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeCoolingCapFTempCurve, // Curve index
693 : {3}, // Valid dimensions
694 : RoutineName, // Routine name
695 : cCurrentModuleObject, // Object Type
696 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
697 3 : state.dataIPShortCut->cAlphaFieldNames(19)); // Field Name
698 : }
699 :
700 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeCoolingCapFFlowCurve =
701 3 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(20));
702 3 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeCoolingCapFFlowCurve == 0) {
703 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(20)) {
704 0 : ShowSevereError(state,
705 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
706 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
707 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(20) + "is blank.");
708 : } else {
709 0 : ShowSevereError(state,
710 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
711 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
712 0 : ShowContinueError(
713 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(20) + "=\"" + state.dataIPShortCut->cAlphaArgs(20) + "\".");
714 : }
715 0 : ErrorsFound = true;
716 : } else {
717 : // Verify Curve Object, any curve with just x as single independent variable
718 3 : ErrorsFound |=
719 12 : Curve::CheckCurveDims(state,
720 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeCoolingCapFFlowCurve, // Curve index
721 : {1}, // Valid dimensions
722 : RoutineName, // Routine name
723 : cCurrentModuleObject, // Object Type
724 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
725 3 : state.dataIPShortCut->cAlphaFieldNames(20)); // Field Name
726 : }
727 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeCoolingEIRFTempCurve =
728 3 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(21));
729 3 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeCoolingEIRFTempCurve == 0) {
730 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(21)) {
731 0 : ShowSevereError(state,
732 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
733 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
734 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(21) + "is blank.");
735 : } else {
736 0 : ShowSevereError(state,
737 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
738 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
739 0 : ShowContinueError(
740 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(21) + "=\"" + state.dataIPShortCut->cAlphaArgs(21) + "\".");
741 : }
742 0 : ErrorsFound = true;
743 : } else {
744 : // Verify Curve Object
745 3 : ErrorsFound |=
746 12 : Curve::CheckCurveDims(state,
747 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeCoolingEIRFTempCurve, // Curve index
748 : {3}, // Valid dimensions
749 : RoutineName, // Routine name
750 : cCurrentModuleObject, // Object Type
751 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
752 3 : state.dataIPShortCut->cAlphaFieldNames(21)); // Field Name
753 : }
754 :
755 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeCoolingEIRFFlowCurve =
756 3 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(22));
757 3 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeCoolingEIRFFlowCurve == 0) {
758 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(22)) {
759 0 : ShowSevereError(state,
760 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
761 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
762 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(22) + "is blank.");
763 : } else {
764 0 : ShowSevereError(state,
765 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
766 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
767 0 : ShowContinueError(
768 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(22) + "=\"" + state.dataIPShortCut->cAlphaArgs(22) + "\".");
769 : }
770 0 : ErrorsFound = true;
771 : } else {
772 : // Verify Curve Object, any curve with just x as single independent variable
773 3 : ErrorsFound |=
774 12 : Curve::CheckCurveDims(state,
775 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeCoolingEIRFFlowCurve, // Curve index
776 : {1}, // Valid dimensions
777 : RoutineName, // Routine name
778 : cCurrentModuleObject, // Object Type
779 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
780 3 : state.dataIPShortCut->cAlphaFieldNames(22)); // Field Name
781 : }
782 :
783 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeCoolingPLFFPLRCurve =
784 3 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(23));
785 3 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeCoolingPLFFPLRCurve == 0) {
786 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(23)) {
787 0 : ShowSevereError(state,
788 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
789 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
790 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(23) + "is blank.");
791 : } else {
792 0 : ShowSevereError(state,
793 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
794 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
795 0 : ShowContinueError(
796 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(23) + "=\"" + state.dataIPShortCut->cAlphaArgs(23) + "\".");
797 : }
798 0 : ErrorsFound = true;
799 : } else {
800 : // Verify Curve Object, any curve with just x as single independent variable
801 3 : ErrorsFound |=
802 12 : Curve::CheckCurveDims(state,
803 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeCoolingPLFFPLRCurve, // Curve index
804 : {1}, // Valid dimensions
805 : RoutineName, // Routine name
806 : cCurrentModuleObject, // Object Type
807 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
808 3 : state.dataIPShortCut->cAlphaFieldNames(23)); // Field Name
809 : }
810 :
811 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeChargingCapFTempCurve =
812 3 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(24));
813 3 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeChargingCapFTempCurve == 0) {
814 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(24)) {
815 0 : ShowSevereError(state,
816 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
817 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
818 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(24) + "is blank.");
819 : } else {
820 0 : ShowSevereError(state,
821 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
822 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
823 0 : ShowContinueError(
824 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(24) + "=\"" + state.dataIPShortCut->cAlphaArgs(24) + "\".");
825 : }
826 0 : ErrorsFound = true;
827 : } else {
828 : // Verify Curve Object
829 3 : ErrorsFound |=
830 12 : Curve::CheckCurveDims(state,
831 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeChargingCapFTempCurve, // Curve index
832 : {3}, // Valid dimensions
833 : RoutineName, // Routine name
834 : cCurrentModuleObject, // Object Type
835 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
836 3 : state.dataIPShortCut->cAlphaFieldNames(24)); // Field Name
837 : }
838 :
839 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeChargingCapFEvapPLRCurve =
840 3 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(25));
841 3 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeChargingCapFEvapPLRCurve == 0) {
842 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(25)) {
843 0 : ShowSevereError(state,
844 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
845 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
846 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(25) + "is blank.");
847 : } else {
848 0 : ShowSevereError(state,
849 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
850 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
851 0 : ShowContinueError(
852 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(25) + "=\"" + state.dataIPShortCut->cAlphaArgs(25) + "\".");
853 : }
854 0 : ErrorsFound = true;
855 : } else {
856 : // Verify Curve Object, any curve with just x as single independent variable
857 3 : ErrorsFound |=
858 12 : Curve::CheckCurveDims(state,
859 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeChargingCapFEvapPLRCurve, // Curve index
860 : {1}, // Valid dimensions
861 : RoutineName, // Routine name
862 : cCurrentModuleObject, // Object Type
863 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
864 3 : state.dataIPShortCut->cAlphaFieldNames(25)); // Field Name
865 : }
866 :
867 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeChargingEIRFTempCurve =
868 3 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(26));
869 3 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeChargingEIRFTempCurve == 0) {
870 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(26)) {
871 0 : ShowSevereError(state,
872 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
873 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
874 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(26) + "is blank.");
875 : } else {
876 0 : ShowSevereError(state,
877 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
878 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
879 0 : ShowContinueError(
880 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(26) + "=\"" + state.dataIPShortCut->cAlphaArgs(26) + "\".");
881 : }
882 0 : ErrorsFound = true;
883 : } else {
884 : // Verify Curve Object
885 3 : ErrorsFound |=
886 12 : Curve::CheckCurveDims(state,
887 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeChargingEIRFTempCurve, // Curve index
888 : {3}, // Valid dimensions
889 : RoutineName, // Routine name
890 : cCurrentModuleObject, // Object Type
891 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
892 3 : state.dataIPShortCut->cAlphaFieldNames(26)); // Field Name
893 : }
894 :
895 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeChargingEIRFFLowCurve =
896 3 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(27));
897 3 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeChargingEIRFFLowCurve == 0) {
898 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(27)) {
899 0 : ShowSevereError(state,
900 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
901 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
902 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(27) + "is blank.");
903 : } else {
904 0 : ShowSevereError(state,
905 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
906 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
907 0 : ShowContinueError(
908 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(27) + "=\"" + state.dataIPShortCut->cAlphaArgs(27) + "\".");
909 : }
910 0 : ErrorsFound = true;
911 : } else {
912 : // Verify Curve Object, any curve with just x as single independent variable
913 3 : ErrorsFound |=
914 12 : Curve::CheckCurveDims(state,
915 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeChargingEIRFFLowCurve, // Curve index
916 : {1}, // Valid dimensions
917 : RoutineName, // Routine name
918 : cCurrentModuleObject, // Object Type
919 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
920 3 : state.dataIPShortCut->cAlphaFieldNames(27)); // Field Name
921 : }
922 :
923 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeChargingPLFFPLRCurve =
924 3 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(28));
925 3 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeChargingPLFFPLRCurve == 0) {
926 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(28)) {
927 0 : ShowSevereError(state,
928 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
929 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
930 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(28) + "is blank.");
931 : } else {
932 0 : ShowSevereError(state,
933 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
934 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
935 0 : ShowContinueError(
936 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(28) + "=\"" + state.dataIPShortCut->cAlphaArgs(28) + "\".");
937 : }
938 0 : ErrorsFound = true;
939 : } else {
940 : // Verify Curve Object, any curve with just x as single independent variable
941 3 : ErrorsFound |=
942 12 : Curve::CheckCurveDims(state,
943 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeChargingPLFFPLRCurve, // Curve index
944 : {1}, // Valid dimensions
945 : RoutineName, // Routine name
946 : cCurrentModuleObject, // Object Type
947 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
948 3 : state.dataIPShortCut->cAlphaFieldNames(28)); // Field Name
949 : }
950 :
951 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeSHRFTempCurve =
952 3 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(29));
953 3 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeSHRFTempCurve == 0) {
954 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(29)) {
955 0 : ShowSevereError(state,
956 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
957 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
958 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(29) + "is blank.");
959 : } else {
960 0 : ShowSevereError(state,
961 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
962 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
963 0 : ShowContinueError(
964 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(29) + "=\"" + state.dataIPShortCut->cAlphaArgs(29) + "\".");
965 : }
966 0 : ErrorsFound = true;
967 : } else {
968 : // Verify Curve Object
969 9 : ErrorsFound |= Curve::CheckCurveDims(state,
970 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeSHRFTempCurve, // Curve index
971 : {2, 3}, // Valid dimensions
972 : RoutineName, // Routine name
973 : cCurrentModuleObject, // Object Type
974 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
975 3 : state.dataIPShortCut->cAlphaFieldNames(29)); // Field Name
976 : }
977 :
978 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeSHRFFlowCurve =
979 3 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(30));
980 3 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeSHRFFlowCurve == 0) {
981 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(30)) {
982 0 : ShowSevereError(state,
983 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
984 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
985 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(30) + "is blank.");
986 : } else {
987 0 : ShowSevereError(state,
988 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
989 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
990 0 : ShowContinueError(
991 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(30) + "=\"" + state.dataIPShortCut->cAlphaArgs(30) + "\".");
992 : }
993 0 : ErrorsFound = true;
994 : } else {
995 : // Verify Curve Object, any curve with just x as single independent variable
996 9 : ErrorsFound |= Curve::CheckCurveDims(state,
997 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndChargeSHRFFlowCurve, // Curve index
998 : {1}, // Valid dimensions
999 : RoutineName, // Routine name
1000 : cCurrentModuleObject, // Object Type
1001 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
1002 3 : state.dataIPShortCut->cAlphaFieldNames(30)); // Field Name
1003 : }
1004 :
1005 : } // Cooling and Charge Mode available
1006 :
1007 4 : BooleanSwitch answer3 = getYesNoValue(state.dataIPShortCut->cAlphaArgs(31));
1008 4 : switch (answer3) {
1009 4 : case BooleanSwitch::Yes:
1010 : case BooleanSwitch::No:
1011 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeModeAvailable = static_cast<bool>(answer3);
1012 4 : break;
1013 0 : default:
1014 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeModeAvailable = false;
1015 0 : ShowSevereError(state,
1016 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" + state.dataPackagedThermalStorageCoil->TESCoil(item).Name +
1017 : "\", invalid");
1018 0 : ShowContinueError(state, "..." + state.dataIPShortCut->cAlphaFieldNames(31) + "=\"" + state.dataIPShortCut->cAlphaArgs(31) + "\".");
1019 0 : ShowContinueError(state, "Available choices are Yes or No.");
1020 0 : ErrorsFound = true;
1021 : }
1022 :
1023 4 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeModeAvailable) {
1024 :
1025 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeRatedTotCap =
1026 1 : state.dataIPShortCut->rNumericArgs(17); // gross total evaporator cooling capacity [W]
1027 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeRatedTotCapSizingFactor =
1028 1 : state.dataIPShortCut->rNumericArgs(18); // sizing factor gross total cooling capacity []
1029 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeRatedDischargeCap =
1030 1 : state.dataIPShortCut->rNumericArgs(19); // net storage discharging capacity [W]
1031 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeRatedDischargeCapSizingFactor =
1032 1 : state.dataIPShortCut->rNumericArgs(20); // sizing factor discharging capacity []
1033 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeRatedSHR =
1034 1 : state.dataIPShortCut->rNumericArgs(21); // Sensible heat ratio (sens cap/total cap) [W/W]
1035 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeCoolingRatedCOP =
1036 1 : state.dataIPShortCut->rNumericArgs(22); // Coefficient of performance , for cooling [W/W]
1037 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeDischargingRatedCOP =
1038 1 : state.dataIPShortCut->rNumericArgs(23); // Coefficient of performance , for charging [W/W]
1039 :
1040 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeCoolingCapFTempCurve =
1041 1 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(32));
1042 1 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeCoolingCapFTempCurve == 0) {
1043 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(32)) {
1044 0 : ShowSevereError(state,
1045 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1046 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1047 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(32) + "is blank.");
1048 : } else {
1049 0 : ShowSevereError(state,
1050 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1051 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1052 0 : ShowContinueError(
1053 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(32) + "=\"" + state.dataIPShortCut->cAlphaArgs(32) + "\".");
1054 : }
1055 0 : ErrorsFound = true;
1056 : } else {
1057 : // Verify Curve Object
1058 1 : ErrorsFound |=
1059 4 : Curve::CheckCurveDims(state,
1060 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeCoolingCapFTempCurve, // Curve index
1061 : {3}, // Valid dimensions
1062 : RoutineName, // Routine name
1063 : cCurrentModuleObject, // Object Type
1064 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
1065 1 : state.dataIPShortCut->cAlphaFieldNames(32)); // Field Name
1066 : }
1067 :
1068 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeCoolingCapFFlowCurve =
1069 1 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(33));
1070 1 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeCoolingCapFFlowCurve == 0) {
1071 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(33)) {
1072 0 : ShowSevereError(state,
1073 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1074 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1075 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(33) + "is blank.");
1076 : } else {
1077 0 : ShowSevereError(state,
1078 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1079 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1080 0 : ShowContinueError(
1081 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(33) + "=\"" + state.dataIPShortCut->cAlphaArgs(33) + "\".");
1082 : }
1083 0 : ErrorsFound = true;
1084 : } else {
1085 : // Verify Curve Object, any curve with just x as single independent variable
1086 1 : ErrorsFound |=
1087 4 : Curve::CheckCurveDims(state,
1088 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeCoolingCapFFlowCurve, // Curve index
1089 : {1}, // Valid dimensions
1090 : RoutineName, // Routine name
1091 : cCurrentModuleObject, // Object Type
1092 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
1093 1 : state.dataIPShortCut->cAlphaFieldNames(33)); // Field Name
1094 : }
1095 :
1096 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeCoolingEIRFTempCurve =
1097 1 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(34));
1098 1 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeCoolingEIRFTempCurve == 0) {
1099 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(34)) {
1100 0 : ShowSevereError(state,
1101 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1102 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1103 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(34) + "is blank.");
1104 : } else {
1105 0 : ShowSevereError(state,
1106 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1107 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1108 0 : ShowContinueError(
1109 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(34) + "=\"" + state.dataIPShortCut->cAlphaArgs(34) + "\".");
1110 : }
1111 0 : ErrorsFound = true;
1112 : } else {
1113 : // Verify Curve Object
1114 1 : ErrorsFound |=
1115 4 : Curve::CheckCurveDims(state,
1116 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeCoolingEIRFTempCurve, // Curve index
1117 : {3}, // Valid dimensions
1118 : RoutineName, // Routine name
1119 : cCurrentModuleObject, // Object Type
1120 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
1121 1 : state.dataIPShortCut->cAlphaFieldNames(34)); // Field Name
1122 : }
1123 :
1124 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeCoolingEIRFFlowCurve =
1125 1 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(35));
1126 1 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeCoolingEIRFFlowCurve == 0) {
1127 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(35)) {
1128 0 : ShowSevereError(state,
1129 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1130 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1131 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(35) + "is blank.");
1132 : } else {
1133 0 : ShowSevereError(state,
1134 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1135 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1136 0 : ShowContinueError(
1137 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(35) + "=\"" + state.dataIPShortCut->cAlphaArgs(35) + "\".");
1138 : }
1139 0 : ErrorsFound = true;
1140 : } else {
1141 : // Verify Curve Object, any curve with just x as single independent variable
1142 1 : ErrorsFound |=
1143 4 : Curve::CheckCurveDims(state,
1144 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeCoolingEIRFFlowCurve, // Curve index
1145 : {1}, // Valid dimensions
1146 : RoutineName, // Routine name
1147 : cCurrentModuleObject, // Object Type
1148 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
1149 1 : state.dataIPShortCut->cAlphaFieldNames(35)); // Field Name
1150 : }
1151 :
1152 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeCoolingPLFFPLRCurve =
1153 1 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(36));
1154 1 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeCoolingPLFFPLRCurve == 0) {
1155 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(36)) {
1156 0 : ShowSevereError(state,
1157 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1158 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1159 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(36) + "is blank.");
1160 : } else {
1161 0 : ShowSevereError(state,
1162 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1163 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1164 0 : ShowContinueError(
1165 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(36) + "=\"" + state.dataIPShortCut->cAlphaArgs(36) + "\".");
1166 : }
1167 0 : ErrorsFound = true;
1168 : } else {
1169 : // Verify Curve Object, any curve with just x as single independent variable
1170 1 : ErrorsFound |=
1171 4 : Curve::CheckCurveDims(state,
1172 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeCoolingPLFFPLRCurve, // Curve index
1173 : {1}, // Valid dimensions
1174 : RoutineName, // Routine name
1175 : cCurrentModuleObject, // Object Type
1176 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
1177 1 : state.dataIPShortCut->cAlphaFieldNames(36)); // Field Name
1178 : }
1179 :
1180 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeDischargingCapFTempCurve =
1181 1 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(37));
1182 1 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeDischargingCapFTempCurve == 0) {
1183 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(37)) {
1184 0 : ShowSevereError(state,
1185 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1186 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1187 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(37) + "is blank.");
1188 : } else {
1189 0 : ShowSevereError(state,
1190 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1191 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1192 0 : ShowContinueError(
1193 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(37) + "=\"" + state.dataIPShortCut->cAlphaArgs(37) + "\".");
1194 : }
1195 0 : ErrorsFound = true;
1196 : } else {
1197 : // Verify Curve Object
1198 3 : ErrorsFound |= Curve::CheckCurveDims(
1199 : state,
1200 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeDischargingCapFTempCurve, // Curve index
1201 : {3}, // Valid dimensions
1202 : RoutineName, // Routine name
1203 : cCurrentModuleObject, // Object Type
1204 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
1205 1 : state.dataIPShortCut->cAlphaFieldNames(37)); // Field Name
1206 : }
1207 :
1208 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeDischargingCapFFlowCurve =
1209 1 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(38));
1210 1 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeDischargingCapFFlowCurve == 0) {
1211 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(38)) {
1212 0 : ShowSevereError(state,
1213 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1214 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1215 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(38) + "is blank.");
1216 : } else {
1217 0 : ShowSevereError(state,
1218 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1219 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1220 0 : ShowContinueError(
1221 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(38) + "=\"" + state.dataIPShortCut->cAlphaArgs(38) + "\".");
1222 : }
1223 0 : ErrorsFound = true;
1224 : } else {
1225 : // Verify Curve Object, any curve with just x as single independent variable
1226 3 : ErrorsFound |= Curve::CheckCurveDims(
1227 : state,
1228 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeDischargingCapFFlowCurve, // Curve index
1229 : {1}, // Valid dimensions
1230 : RoutineName, // Routine name
1231 : cCurrentModuleObject, // Object Type
1232 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
1233 1 : state.dataIPShortCut->cAlphaFieldNames(38)); // Field Name
1234 : }
1235 :
1236 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeDischargingCapFEvapPLRCurve =
1237 1 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(39));
1238 1 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeDischargingCapFEvapPLRCurve == 0) {
1239 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(39)) {
1240 0 : ShowSevereError(state,
1241 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1242 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1243 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(39) + "is blank.");
1244 : } else {
1245 0 : ShowSevereError(state,
1246 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1247 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1248 0 : ShowContinueError(
1249 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(39) + "=\"" + state.dataIPShortCut->cAlphaArgs(39) + "\".");
1250 : }
1251 0 : ErrorsFound = true;
1252 : } else {
1253 : // Verify Curve Object, any curve with just x as single independent variable
1254 3 : ErrorsFound |= Curve::CheckCurveDims(
1255 : state,
1256 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeDischargingCapFEvapPLRCurve, // Curve index
1257 : {1}, // Valid dimensions
1258 : RoutineName, // Routine name
1259 : cCurrentModuleObject, // Object Type
1260 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
1261 1 : state.dataIPShortCut->cAlphaFieldNames(39)); // Field Name
1262 : }
1263 :
1264 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeDischargingEIRFTempCurve =
1265 1 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(40));
1266 1 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeDischargingEIRFTempCurve == 0) {
1267 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(40)) {
1268 0 : ShowSevereError(state,
1269 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1270 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1271 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(40) + "is blank.");
1272 : } else {
1273 0 : ShowSevereError(state,
1274 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1275 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1276 0 : ShowContinueError(
1277 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(40) + "=\"" + state.dataIPShortCut->cAlphaArgs(40) + "\".");
1278 : }
1279 0 : ErrorsFound = true;
1280 : } else {
1281 : // Verify Curve Object
1282 3 : ErrorsFound |= Curve::CheckCurveDims(
1283 : state,
1284 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeDischargingEIRFTempCurve, // Curve index
1285 : {3}, // Valid dimensions
1286 : RoutineName, // Routine name
1287 : cCurrentModuleObject, // Object Type
1288 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
1289 1 : state.dataIPShortCut->cAlphaFieldNames(40)); // Field Name
1290 : }
1291 :
1292 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeDischargingEIRFFLowCurve =
1293 1 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(41));
1294 1 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeDischargingEIRFFLowCurve == 0) {
1295 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(41)) {
1296 0 : ShowSevereError(state,
1297 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1298 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1299 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(41) + "is blank.");
1300 : } else {
1301 0 : ShowSevereError(state,
1302 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1303 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1304 0 : ShowContinueError(
1305 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(41) + "=\"" + state.dataIPShortCut->cAlphaArgs(41) + "\".");
1306 : }
1307 0 : ErrorsFound = true;
1308 : } else {
1309 : // Verify Curve Object, any curve with just x as single independent variable
1310 3 : ErrorsFound |= Curve::CheckCurveDims(
1311 : state,
1312 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeDischargingEIRFFLowCurve, // Curve index
1313 : {1}, // Valid dimensions
1314 : RoutineName, // Routine name
1315 : cCurrentModuleObject, // Object Type
1316 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
1317 1 : state.dataIPShortCut->cAlphaFieldNames(41)); // Field Name
1318 : }
1319 :
1320 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeDischargingPLFFPLRCurve =
1321 1 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(42));
1322 1 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeDischargingPLFFPLRCurve == 0) {
1323 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(42)) {
1324 0 : ShowSevereError(state,
1325 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1326 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1327 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(42) + "is blank.");
1328 : } else {
1329 0 : ShowSevereError(state,
1330 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1331 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1332 0 : ShowContinueError(
1333 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(42) + "=\"" + state.dataIPShortCut->cAlphaArgs(42) + "\".");
1334 : }
1335 0 : ErrorsFound = true;
1336 : } else {
1337 : // Verify Curve Object, any curve with just x as single independent variable
1338 3 : ErrorsFound |= Curve::CheckCurveDims(
1339 : state,
1340 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeDischargingPLFFPLRCurve, // Curve index
1341 : {1}, // Valid dimensions
1342 : RoutineName, // Routine name
1343 : cCurrentModuleObject, // Object Type
1344 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
1345 1 : state.dataIPShortCut->cAlphaFieldNames(42)); // Field Name
1346 : }
1347 :
1348 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeSHRFTempCurve =
1349 1 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(43));
1350 1 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeSHRFTempCurve == 0) {
1351 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(43)) {
1352 0 : ShowSevereError(state,
1353 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1354 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1355 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(43) + "is blank.");
1356 : } else {
1357 0 : ShowSevereError(state,
1358 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1359 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1360 0 : ShowContinueError(
1361 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(43) + "=\"" + state.dataIPShortCut->cAlphaArgs(43) + "\".");
1362 : }
1363 0 : ErrorsFound = true;
1364 : } else {
1365 : // Verify Curve Object
1366 1 : ErrorsFound |=
1367 4 : Curve::CheckCurveDims(state,
1368 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeSHRFTempCurve, // Curve index
1369 : {2, 3}, // Valid dimensions
1370 : RoutineName, // Routine name
1371 : cCurrentModuleObject, // Object Type
1372 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
1373 1 : state.dataIPShortCut->cAlphaFieldNames(43)); // Field Name
1374 : }
1375 :
1376 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeSHRFFlowCurve =
1377 1 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(44));
1378 1 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeSHRFFlowCurve == 0) {
1379 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(44)) {
1380 0 : ShowSevereError(state,
1381 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1382 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1383 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(44) + "is blank.");
1384 : } else {
1385 0 : ShowSevereError(state,
1386 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1387 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1388 0 : ShowContinueError(
1389 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(44) + "=\"" + state.dataIPShortCut->cAlphaArgs(44) + "\".");
1390 : }
1391 0 : ErrorsFound = true;
1392 : } else {
1393 : // Verify Curve Object, any curve with just x as single independent variable
1394 1 : ErrorsFound |=
1395 4 : Curve::CheckCurveDims(state,
1396 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CoolingAndDischargeSHRFFlowCurve, // Curve index
1397 : {1}, // Valid dimensions
1398 : RoutineName, // Routine name
1399 : cCurrentModuleObject, // Object Type
1400 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
1401 1 : state.dataIPShortCut->cAlphaFieldNames(44)); // Field Name
1402 : }
1403 :
1404 : } // cooling and discharge mode available
1405 :
1406 4 : BooleanSwitch answer4 = getYesNoValue(state.dataIPShortCut->cAlphaArgs(45));
1407 4 : switch (answer4) {
1408 4 : case BooleanSwitch::Yes:
1409 : case BooleanSwitch::No:
1410 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).ChargeOnlyModeAvailable = static_cast<bool>(answer4);
1411 4 : break;
1412 0 : default:
1413 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).ChargeOnlyModeAvailable = false;
1414 0 : ShowSevereError(state,
1415 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" + state.dataPackagedThermalStorageCoil->TESCoil(item).Name +
1416 : "\", invalid");
1417 0 : ShowContinueError(state, "..." + state.dataIPShortCut->cAlphaFieldNames(45) + "=\"" + state.dataIPShortCut->cAlphaArgs(45) + "\".");
1418 0 : ShowContinueError(state, "Available choices are Yes or No.");
1419 0 : ErrorsFound = true;
1420 : }
1421 :
1422 4 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).ChargeOnlyModeAvailable) {
1423 :
1424 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).ChargeOnlyRatedCapacity =
1425 1 : state.dataIPShortCut->rNumericArgs(24); // net storage charging capacity at rating conditions [W]
1426 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).ChargeOnlyRatedCapacitySizingFactor =
1427 1 : state.dataIPShortCut->rNumericArgs(25); // sizing factor for charging capacity []
1428 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).ChargeOnlyRatedCOP =
1429 1 : state.dataIPShortCut->rNumericArgs(26); // coefficient of performance at rating conditions [W/W]
1430 :
1431 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).ChargeOnlyChargingCapFTempCurve =
1432 1 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(46));
1433 1 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).ChargeOnlyChargingCapFTempCurve == 0) {
1434 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(46)) {
1435 0 : ShowSevereError(state,
1436 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1437 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1438 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(46) + "is blank.");
1439 : } else {
1440 0 : ShowSevereError(state,
1441 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1442 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1443 0 : ShowContinueError(
1444 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(46) + "=\"" + state.dataIPShortCut->cAlphaArgs(46) + "\".");
1445 : }
1446 0 : ErrorsFound = true;
1447 : } else {
1448 : // Verify Curve Object
1449 1 : ErrorsFound |=
1450 4 : Curve::CheckCurveDims(state,
1451 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).ChargeOnlyChargingCapFTempCurve, // Curve index
1452 : {2}, // Valid dimensions
1453 : RoutineName, // Routine name
1454 : cCurrentModuleObject, // Object Type
1455 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
1456 1 : state.dataIPShortCut->cAlphaFieldNames(46)); // Field Name
1457 : }
1458 :
1459 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).ChargeOnlyChargingEIRFTempCurve =
1460 1 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(47));
1461 1 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).ChargeOnlyChargingEIRFTempCurve == 0) {
1462 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(47)) {
1463 0 : ShowSevereError(state,
1464 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1465 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1466 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(47) + "is blank.");
1467 : } else {
1468 0 : ShowSevereError(state,
1469 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1470 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1471 0 : ShowContinueError(
1472 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(47) + "=\"" + state.dataIPShortCut->cAlphaArgs(47) + "\".");
1473 : }
1474 0 : ErrorsFound = true;
1475 : } else {
1476 : // Verify Curve Object
1477 1 : ErrorsFound |=
1478 4 : Curve::CheckCurveDims(state,
1479 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).ChargeOnlyChargingEIRFTempCurve, // Curve index
1480 : {2}, // Valid dimensions
1481 : RoutineName, // Routine name
1482 : cCurrentModuleObject, // Object Type
1483 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
1484 1 : state.dataIPShortCut->cAlphaFieldNames(47)); // Field Name
1485 : }
1486 :
1487 : } // Charge only mode available
1488 :
1489 4 : BooleanSwitch answer5 = getYesNoValue(state.dataIPShortCut->cAlphaArgs(48));
1490 4 : switch (answer5) {
1491 4 : case BooleanSwitch::Yes:
1492 : case BooleanSwitch::No:
1493 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).DischargeOnlyModeAvailable = static_cast<bool>(answer5);
1494 4 : break;
1495 0 : default:
1496 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).DischargeOnlyModeAvailable = false;
1497 0 : ShowSevereError(state,
1498 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" + state.dataPackagedThermalStorageCoil->TESCoil(item).Name +
1499 : "\", invalid");
1500 0 : ShowContinueError(state, "..." + state.dataIPShortCut->cAlphaFieldNames(48) + "=\"" + state.dataIPShortCut->cAlphaArgs(48) + "\".");
1501 0 : ShowContinueError(state, "Available choices are Yes or No.");
1502 0 : ErrorsFound = true;
1503 : }
1504 :
1505 4 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).DischargeOnlyModeAvailable) {
1506 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).DischargeOnlyRatedDischargeCap =
1507 3 : state.dataIPShortCut->rNumericArgs(27); // gross total evaporator cooling capacity [W]
1508 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).DischargeOnlyRatedDischargeCapSizingFactor =
1509 3 : state.dataIPShortCut->rNumericArgs(28); // sizing factor for cooling capacity []
1510 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).DischargeOnlyRatedSHR =
1511 3 : state.dataIPShortCut->rNumericArgs(29); // sensible heat ratio (sens cap/total cap)
1512 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).DischargeOnlyRatedCOP =
1513 3 : state.dataIPShortCut->rNumericArgs(30); // coefficient of performance for discharging [W/W]
1514 :
1515 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).DischargeOnlyCapFTempCurve =
1516 3 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(49));
1517 3 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).DischargeOnlyCapFTempCurve == 0) {
1518 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(49)) {
1519 0 : ShowSevereError(state,
1520 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1521 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1522 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(49) + "is blank.");
1523 : } else {
1524 0 : ShowSevereError(state,
1525 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1526 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1527 0 : ShowContinueError(
1528 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(49) + "=\"" + state.dataIPShortCut->cAlphaArgs(49) + "\".");
1529 : }
1530 0 : ErrorsFound = true;
1531 : } else {
1532 : // Verify Curve Object
1533 9 : ErrorsFound |= Curve::CheckCurveDims(state,
1534 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).DischargeOnlyCapFTempCurve, // Curve index
1535 : {2}, // Valid dimensions
1536 : RoutineName, // Routine name
1537 : cCurrentModuleObject, // Object Type
1538 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
1539 3 : state.dataIPShortCut->cAlphaFieldNames(49)); // Field Name
1540 : }
1541 :
1542 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).DischargeOnlyCapFFlowCurve =
1543 3 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(50));
1544 3 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).DischargeOnlyCapFFlowCurve == 0) {
1545 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(50)) {
1546 0 : ShowSevereError(state,
1547 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1548 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1549 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(50) + "is blank.");
1550 : } else {
1551 0 : ShowSevereError(state,
1552 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1553 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1554 0 : ShowContinueError(
1555 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(50) + "=\"" + state.dataIPShortCut->cAlphaArgs(50) + "\".");
1556 : }
1557 0 : ErrorsFound = true;
1558 : } else {
1559 : // Verify Curve Object, any curve with just x as single independent variable
1560 9 : ErrorsFound |= Curve::CheckCurveDims(state,
1561 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).DischargeOnlyCapFFlowCurve, // Curve index
1562 : {1}, // Valid dimensions
1563 : RoutineName, // Routine name
1564 : cCurrentModuleObject, // Object Type
1565 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
1566 3 : state.dataIPShortCut->cAlphaFieldNames(50)); // Field Name
1567 : }
1568 :
1569 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).DischargeOnlyEIRFTempCurve =
1570 3 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(51));
1571 3 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).DischargeOnlyEIRFTempCurve == 0) {
1572 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(51)) {
1573 0 : ShowSevereError(state,
1574 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1575 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1576 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(51) + "is blank.");
1577 : } else {
1578 0 : ShowSevereError(state,
1579 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1580 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1581 0 : ShowContinueError(
1582 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(51) + "=\"" + state.dataIPShortCut->cAlphaArgs(51) + "\".");
1583 : }
1584 0 : ErrorsFound = true;
1585 : } else {
1586 : // Verify Curve Object
1587 9 : ErrorsFound |= Curve::CheckCurveDims(state,
1588 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).DischargeOnlyEIRFTempCurve, // Curve index
1589 : {2}, // Valid dimensions
1590 : RoutineName, // Routine name
1591 : cCurrentModuleObject, // Object Type
1592 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
1593 3 : state.dataIPShortCut->cAlphaFieldNames(51)); // Field Name
1594 : }
1595 :
1596 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).DischargeOnlyEIRFFlowCurve =
1597 3 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(52));
1598 3 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).DischargeOnlyEIRFFlowCurve == 0) {
1599 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(52)) {
1600 0 : ShowSevereError(state,
1601 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1602 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1603 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(52) + "is blank.");
1604 : } else {
1605 0 : ShowSevereError(state,
1606 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1607 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1608 0 : ShowContinueError(
1609 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(52) + "=\"" + state.dataIPShortCut->cAlphaArgs(52) + "\".");
1610 : }
1611 0 : ErrorsFound = true;
1612 : } else {
1613 : // Verify Curve Object, any curve with just x as single independent variable
1614 9 : ErrorsFound |= Curve::CheckCurveDims(state,
1615 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).DischargeOnlyEIRFFlowCurve, // Curve index
1616 : {1}, // Valid dimensions
1617 : RoutineName, // Routine name
1618 : cCurrentModuleObject, // Object Type
1619 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
1620 3 : state.dataIPShortCut->cAlphaFieldNames(52)); // Field Name
1621 : }
1622 :
1623 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).DischargeOnlyPLFFPLRCurve =
1624 3 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(53));
1625 3 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).DischargeOnlyPLFFPLRCurve == 0) {
1626 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(53)) {
1627 0 : ShowSevereError(state,
1628 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1629 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1630 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(53) + "is blank.");
1631 : } else {
1632 0 : ShowSevereError(state,
1633 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1634 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1635 0 : ShowContinueError(
1636 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(53) + "=\"" + state.dataIPShortCut->cAlphaArgs(53) + "\".");
1637 : }
1638 0 : ErrorsFound = true;
1639 : } else {
1640 : // Verify Curve Object, any curve with just x as single independent variable
1641 9 : ErrorsFound |= Curve::CheckCurveDims(state,
1642 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).DischargeOnlyPLFFPLRCurve, // Curve index
1643 : {1}, // Valid dimensions
1644 : RoutineName, // Routine name
1645 : cCurrentModuleObject, // Object Type
1646 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
1647 3 : state.dataIPShortCut->cAlphaFieldNames(53)); // Field Name
1648 : }
1649 :
1650 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).DischargeOnlySHRFTempCurve =
1651 3 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(54));
1652 3 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).DischargeOnlySHRFTempCurve == 0) {
1653 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(54)) {
1654 0 : ShowSevereError(state,
1655 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1656 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1657 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(54) + "is blank.");
1658 : } else {
1659 0 : ShowSevereError(state,
1660 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1661 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1662 0 : ShowContinueError(
1663 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(54) + "=\"" + state.dataIPShortCut->cAlphaArgs(54) + "\".");
1664 : }
1665 0 : ErrorsFound = true;
1666 : } else {
1667 : // Verify Curve Object
1668 9 : ErrorsFound |= Curve::CheckCurveDims(state,
1669 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).DischargeOnlySHRFTempCurve, // Curve index
1670 : {2, 3}, // Valid dimensions
1671 : RoutineName, // Routine name
1672 : cCurrentModuleObject, // Object Type
1673 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
1674 3 : state.dataIPShortCut->cAlphaFieldNames(54)); // Field Name
1675 : }
1676 :
1677 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).DischargeOnlySHRFFLowCurve =
1678 3 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(55));
1679 3 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).DischargeOnlySHRFFLowCurve == 0) {
1680 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(55)) {
1681 0 : ShowSevereError(state,
1682 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1683 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1684 0 : ShowContinueError(state, "Required " + state.dataIPShortCut->cAlphaFieldNames(55) + "is blank.");
1685 : } else {
1686 0 : ShowSevereError(state,
1687 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" +
1688 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name + "\", invalid");
1689 0 : ShowContinueError(
1690 0 : state, "Not found " + state.dataIPShortCut->cAlphaFieldNames(55) + "=\"" + state.dataIPShortCut->cAlphaArgs(55) + "\".");
1691 : }
1692 0 : ErrorsFound = true;
1693 : } else {
1694 : // Verify Curve Object, any curve with just x as single independent variable
1695 9 : ErrorsFound |= Curve::CheckCurveDims(state,
1696 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).DischargeOnlySHRFFLowCurve, // Curve index
1697 : {1}, // Valid dimensions
1698 : RoutineName, // Routine name
1699 : cCurrentModuleObject, // Object Type
1700 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name, // Object Name
1701 3 : state.dataIPShortCut->cAlphaFieldNames(55)); // Field Name
1702 : }
1703 :
1704 : } // Discharge Only mode available
1705 :
1706 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).AncillaryControlsPower = state.dataIPShortCut->rNumericArgs(31);
1707 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).ColdWeatherMinimumTempLimit = state.dataIPShortCut->rNumericArgs(32);
1708 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).ColdWeatherAncillaryPower = state.dataIPShortCut->rNumericArgs(33);
1709 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).CondAirInletNodeNum =
1710 12 : GetOnlySingleNode(state,
1711 4 : state.dataIPShortCut->cAlphaArgs(56),
1712 : ErrorsFound,
1713 : DataLoopNode::ConnectionObjectType::CoilCoolingDXSingleSpeedThermalStorage,
1714 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name,
1715 : DataLoopNode::NodeFluidType::Air,
1716 : DataLoopNode::ConnectionType::OutsideAirReference,
1717 : NodeInputManager::CompFluidStream::Primary,
1718 4 : ObjectIsNotParent);
1719 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).CondAirOutletNodeNum =
1720 12 : GetOnlySingleNode(state,
1721 4 : state.dataIPShortCut->cAlphaArgs(57),
1722 : ErrorsFound,
1723 : DataLoopNode::ConnectionObjectType::CoilCoolingDXSingleSpeedThermalStorage,
1724 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name,
1725 : DataLoopNode::NodeFluidType::Air,
1726 : DataLoopNode::ConnectionType::ReliefAir,
1727 : NodeInputManager::CompFluidStream::Primary,
1728 4 : ObjectIsNotParent);
1729 :
1730 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).CondenserAirVolumeFlow = state.dataIPShortCut->rNumericArgs(34);
1731 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).CondenserAirFlowSizingFactor = state.dataIPShortCut->rNumericArgs(35);
1732 :
1733 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).CondenserType =
1734 8 : static_cast<TESCondenserType>(getEnumerationValue(condenserTypesUC, state.dataIPShortCut->cAlphaArgs(58)));
1735 4 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CondenserType == TESCondenserType::Invalid) {
1736 0 : ShowSevereError(state,
1737 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" + state.dataPackagedThermalStorageCoil->TESCoil(item).Name +
1738 : "\", invalid");
1739 0 : ShowContinueError(state, state.dataIPShortCut->cAlphaFieldNames(58) + "=\"" + state.dataIPShortCut->cAlphaArgs(58) + "\".");
1740 0 : ShowContinueError(state, "Available choices are AirCooled or EvaporativelyCooled.");
1741 0 : ErrorsFound = true;
1742 : }
1743 :
1744 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).EvapCondEffect = state.dataIPShortCut->rNumericArgs(36);
1745 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).EvapCondPumpElecNomPower = state.dataIPShortCut->rNumericArgs(37);
1746 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).BasinHeaterPowerFTempDiff = state.dataIPShortCut->rNumericArgs(38);
1747 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).BasinHeaterSetpointTemp = state.dataIPShortCut->rNumericArgs(39);
1748 :
1749 4 : if (state.dataIPShortCut->lAlphaFieldBlanks(59)) {
1750 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).BasinHeaterAvailSchedNum = DataGlobalConstants::ScheduleAlwaysOn;
1751 : } else {
1752 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).BasinHeaterAvailSchedNum =
1753 0 : GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(59));
1754 0 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).BasinHeaterAvailSchedNum == 0) {
1755 0 : ShowSevereError(state,
1756 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" + state.dataPackagedThermalStorageCoil->TESCoil(item).Name +
1757 : "\", invalid");
1758 0 : ShowContinueError(state, "..." + state.dataIPShortCut->cAlphaFieldNames(59) + "=\"" + state.dataIPShortCut->cAlphaArgs(59) + "\".");
1759 0 : ErrorsFound = true;
1760 : }
1761 : }
1762 :
1763 4 : if (state.dataIPShortCut->lAlphaFieldBlanks(60)) {
1764 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).EvapWaterSupplyMode = EvapWaterSupply::WaterSupplyFromMains;
1765 : } else {
1766 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).EvapWaterSupplyName = state.dataIPShortCut->cAlphaArgs(60);
1767 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).EvapWaterSupplyMode = EvapWaterSupply::WaterSupplyFromTank;
1768 0 : SetupTankDemandComponent(state,
1769 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name,
1770 : cCurrentModuleObject,
1771 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).EvapWaterSupplyName,
1772 : ErrorsFound,
1773 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).EvapWaterSupTankID,
1774 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).EvapWaterTankDemandARRID);
1775 : }
1776 :
1777 4 : if (state.dataIPShortCut->lAlphaFieldBlanks(61)) {
1778 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).CondensateCollectMode = CondensateAction::Discard;
1779 : } else {
1780 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).CondensateCollectName = state.dataIPShortCut->cAlphaArgs(61);
1781 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).CondensateCollectMode = CondensateAction::ToTank;
1782 0 : SetupTankSupplyComponent(state,
1783 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name,
1784 : cCurrentModuleObject,
1785 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).CondensateCollectName,
1786 : ErrorsFound,
1787 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).CondensateTankID,
1788 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).CondensateTankSupplyARRID);
1789 : }
1790 :
1791 4 : if (!state.dataIPShortCut->lAlphaFieldBlanks(62)) {
1792 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).TESPlantInletNodeNum =
1793 2 : GetOnlySingleNode(state,
1794 1 : state.dataIPShortCut->cAlphaArgs(62),
1795 : ErrorsFound,
1796 : DataLoopNode::ConnectionObjectType::CoilCoolingDXSingleSpeedThermalStorage,
1797 1 : state.dataIPShortCut->cAlphaArgs(1),
1798 : DataLoopNode::NodeFluidType::Water,
1799 : DataLoopNode::ConnectionType::Inlet,
1800 : NodeInputManager::CompFluidStream::Secondary,
1801 1 : ObjectIsNotParent);
1802 :
1803 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).TESPlantConnectionAvailable = true;
1804 : } else {
1805 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).TESPlantConnectionAvailable = false;
1806 : }
1807 4 : if (!state.dataIPShortCut->lAlphaFieldBlanks(63)) {
1808 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).TESPlantOutletNodeNum =
1809 2 : GetOnlySingleNode(state,
1810 1 : state.dataIPShortCut->cAlphaArgs(63),
1811 : ErrorsFound,
1812 : DataLoopNode::ConnectionObjectType::CoilCoolingDXSingleSpeedThermalStorage,
1813 1 : state.dataIPShortCut->cAlphaArgs(1),
1814 : DataLoopNode::NodeFluidType::Water,
1815 : DataLoopNode::ConnectionType::Outlet,
1816 : NodeInputManager::CompFluidStream::Secondary,
1817 1 : ObjectIsNotParent);
1818 : } else {
1819 3 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).TESPlantConnectionAvailable) {
1820 0 : ShowSevereError(state,
1821 0 : std::string{RoutineName} + cCurrentModuleObject + "=\"" + state.dataPackagedThermalStorageCoil->TESCoil(item).Name +
1822 : "\", invalid");
1823 0 : ShowContinueError(state, "..." + state.dataIPShortCut->cAlphaFieldNames(63) + " cannot be blank.");
1824 0 : ErrorsFound = true;
1825 : }
1826 : }
1827 4 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).TESPlantConnectionAvailable) {
1828 2 : TestCompSet(state,
1829 : cCurrentModuleObject,
1830 1 : state.dataIPShortCut->cAlphaArgs(1),
1831 1 : state.dataIPShortCut->cAlphaArgs(62),
1832 1 : state.dataIPShortCut->cAlphaArgs(63),
1833 : "Water Nodes");
1834 : }
1835 :
1836 4 : if (!state.dataIPShortCut->lNumericFieldBlanks(40)) {
1837 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).TESPlantDesignVolumeFlowRate = state.dataIPShortCut->rNumericArgs(40);
1838 : }
1839 4 : if (!state.dataIPShortCut->lNumericFieldBlanks(41)) {
1840 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).TESPlantEffectiveness = state.dataIPShortCut->rNumericArgs(41);
1841 : }
1842 4 : switch (state.dataPackagedThermalStorageCoil->TESCoil(item).StorageMedia) {
1843 1 : case MediaType::UserDefindFluid:
1844 : case MediaType::Water:
1845 1 : if (!state.dataIPShortCut->lNumericFieldBlanks(42)) {
1846 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).MinimumFluidTankTempLimit = state.dataIPShortCut->rNumericArgs(42);
1847 : } else {
1848 :
1849 0 : GetFluidDensityTemperatureLimits(state, state.dataPackagedThermalStorageCoil->TESCoil(item).StorageFluidIndex, TminRho, TmaxRho);
1850 0 : GetFluidSpecificHeatTemperatureLimits(state, state.dataPackagedThermalStorageCoil->TESCoil(item).StorageFluidIndex, TminCp, TmaxCp);
1851 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).MinimumFluidTankTempLimit = max(TminRho, TminCp);
1852 : }
1853 1 : if (!state.dataIPShortCut->lNumericFieldBlanks(43)) {
1854 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).MaximumFluidTankTempLimit = state.dataIPShortCut->rNumericArgs(43);
1855 : } else {
1856 0 : GetFluidDensityTemperatureLimits(state, state.dataPackagedThermalStorageCoil->TESCoil(item).StorageFluidIndex, TminRho, TmaxRho);
1857 0 : GetFluidSpecificHeatTemperatureLimits(state, state.dataPackagedThermalStorageCoil->TESCoil(item).StorageFluidIndex, TminCp, TmaxCp);
1858 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).MaximumFluidTankTempLimit = min(TmaxRho, TmaxCp);
1859 : }
1860 : default:
1861 : // nothing
1862 4 : break;
1863 : }
1864 : }
1865 :
1866 1 : if (ErrorsFound) {
1867 0 : ShowFatalError(state,
1868 0 : std::string{RoutineName} + "Errors found in getting " + cCurrentModuleObject +
1869 : " input. Preceding condition(s) causes termination.");
1870 : }
1871 :
1872 : // setup reporting
1873 5 : for (item = 1; item <= state.dataPackagedThermalStorageCoil->NumTESCoils; ++item) {
1874 16 : SetupOutputVariable(state,
1875 : "Cooling Coil Operating Mode Index",
1876 : OutputProcessor::Unit::None,
1877 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).curControlModeReport,
1878 : OutputProcessor::SOVTimeStepType::System,
1879 : OutputProcessor::SOVStoreType::Average,
1880 8 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name);
1881 :
1882 : // cCurrentModuleObject = "Coil:Cooling:DX:SingleSpeed:ThermalStorage"
1883 16 : SetupOutputVariable(state,
1884 : "Cooling Coil Total Cooling Rate",
1885 : OutputProcessor::Unit::W,
1886 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).EvapTotCoolingRate,
1887 : OutputProcessor::SOVTimeStepType::System,
1888 : OutputProcessor::SOVStoreType::Average,
1889 8 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name);
1890 16 : SetupOutputVariable(state,
1891 : "Cooling Coil Total Cooling Energy",
1892 : OutputProcessor::Unit::J,
1893 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).EvapTotCoolingEnergy,
1894 : OutputProcessor::SOVTimeStepType::System,
1895 : OutputProcessor::SOVStoreType::Summed,
1896 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name,
1897 : _,
1898 : "ENERGYTRANSFER",
1899 : "COOLINGCOILS",
1900 : _,
1901 4 : "System");
1902 16 : SetupOutputVariable(state,
1903 : "Cooling Coil Sensible Cooling Rate",
1904 : OutputProcessor::Unit::W,
1905 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).EvapSensCoolingRate,
1906 : OutputProcessor::SOVTimeStepType::System,
1907 : OutputProcessor::SOVStoreType::Average,
1908 8 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name);
1909 16 : SetupOutputVariable(state,
1910 : "Cooling Coil Sensible Cooling Energy",
1911 : OutputProcessor::Unit::J,
1912 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).EvapSensCoolingEnergy,
1913 : OutputProcessor::SOVTimeStepType::System,
1914 : OutputProcessor::SOVStoreType::Summed,
1915 8 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name);
1916 16 : SetupOutputVariable(state,
1917 : "Cooling Coil Latent Cooling Rate",
1918 : OutputProcessor::Unit::W,
1919 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).EvapLatCoolingRate,
1920 : OutputProcessor::SOVTimeStepType::System,
1921 : OutputProcessor::SOVStoreType::Average,
1922 8 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name);
1923 16 : SetupOutputVariable(state,
1924 : "Cooling Coil Latent Cooling Energy",
1925 : OutputProcessor::Unit::J,
1926 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).EvapLatCoolingEnergy,
1927 : OutputProcessor::SOVTimeStepType::System,
1928 : OutputProcessor::SOVStoreType::Summed,
1929 8 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name);
1930 16 : SetupOutputVariable(state,
1931 : "Cooling Coil Electricity Rate",
1932 : OutputProcessor::Unit::W,
1933 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).ElecCoolingPower,
1934 : OutputProcessor::SOVTimeStepType::System,
1935 : OutputProcessor::SOVStoreType::Average,
1936 8 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name);
1937 16 : SetupOutputVariable(state,
1938 : "Cooling Coil Electricity Energy",
1939 : OutputProcessor::Unit::J,
1940 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).ElecCoolingEnergy,
1941 : OutputProcessor::SOVTimeStepType::System,
1942 : OutputProcessor::SOVStoreType::Summed,
1943 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name,
1944 : _,
1945 : "Electricity",
1946 : "COOLING",
1947 : _,
1948 4 : "System");
1949 :
1950 16 : SetupOutputVariable(state,
1951 : "Cooling Coil Runtime Fraction",
1952 : OutputProcessor::Unit::None,
1953 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).RuntimeFraction,
1954 : OutputProcessor::SOVTimeStepType::System,
1955 : OutputProcessor::SOVStoreType::Average,
1956 8 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name);
1957 16 : SetupOutputVariable(state,
1958 : "Cooling Coil Cold Weather Protection Electricity Energy",
1959 : OutputProcessor::Unit::J,
1960 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).ElectColdWeatherEnergy,
1961 : OutputProcessor::SOVTimeStepType::System,
1962 : OutputProcessor::SOVStoreType::Summed,
1963 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name,
1964 : _,
1965 : "Electricity",
1966 : "COOLING",
1967 : "Thermal Protection",
1968 4 : "System");
1969 16 : SetupOutputVariable(state,
1970 : "Cooling Coil Cold Weather Protection Electricity Rate",
1971 : OutputProcessor::Unit::W,
1972 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).ElectColdWeatherPower,
1973 : OutputProcessor::SOVTimeStepType::System,
1974 : OutputProcessor::SOVStoreType::Average,
1975 8 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name);
1976 :
1977 16 : SetupOutputVariable(state,
1978 : "Cooling Coil Thermal Storage Mechanical Heat Transfer Rate",
1979 : OutputProcessor::Unit::W,
1980 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).QdotTES,
1981 : OutputProcessor::SOVTimeStepType::System,
1982 : OutputProcessor::SOVStoreType::Average,
1983 8 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name);
1984 :
1985 16 : SetupOutputVariable(state,
1986 : "Cooling Coil Thermal Storage Mechanical Heat Transfer Energy",
1987 : OutputProcessor::Unit::J,
1988 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).Q_TES,
1989 : OutputProcessor::SOVTimeStepType::System,
1990 : OutputProcessor::SOVStoreType::Summed,
1991 8 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name);
1992 :
1993 16 : SetupOutputVariable(state,
1994 : "Cooling Coil Thermal Storage Ambient Heat Transfer Rate",
1995 : OutputProcessor::Unit::W,
1996 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).QdotAmbient,
1997 : OutputProcessor::SOVTimeStepType::System,
1998 : OutputProcessor::SOVStoreType::Average,
1999 8 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name);
2000 :
2001 16 : SetupOutputVariable(state,
2002 : "Cooling Coil Thermal Storage Ambient Heat Transfer Energy",
2003 : OutputProcessor::Unit::J,
2004 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).Q_Ambient,
2005 : OutputProcessor::SOVTimeStepType::System,
2006 : OutputProcessor::SOVStoreType::Summed,
2007 8 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name);
2008 :
2009 4 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).TESPlantConnectionAvailable) {
2010 4 : SetupOutputVariable(state,
2011 : "Cooling Coil Thermal Storage Plant Heat Transfer Rate",
2012 : OutputProcessor::Unit::W,
2013 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).QdotPlant,
2014 : OutputProcessor::SOVTimeStepType::System,
2015 : OutputProcessor::SOVStoreType::Average,
2016 2 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name);
2017 4 : SetupOutputVariable(state,
2018 : "Cooling Coil Thermal Storage Plant Heat Transfer Energy",
2019 : OutputProcessor::Unit::J,
2020 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).Q_Plant,
2021 : OutputProcessor::SOVTimeStepType::System,
2022 : OutputProcessor::SOVStoreType::Summed,
2023 2 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name);
2024 : }
2025 :
2026 4 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).CondenserType == TESCondenserType::Evap) {
2027 4 : SetupOutputVariable(state,
2028 : "Cooling Coil Condenser Inlet Temperature",
2029 : OutputProcessor::Unit::C,
2030 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).CondInletTemp,
2031 : OutputProcessor::SOVTimeStepType::System,
2032 : OutputProcessor::SOVStoreType::Average,
2033 2 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name);
2034 :
2035 1 : if (state.dataPackagedThermalStorageCoil->TESCoil(item).EvapWaterSupplyMode == EvapWaterSupply::WaterSupplyFromMains) {
2036 4 : SetupOutputVariable(state,
2037 : "Cooling Coil Evaporative Condenser Water Volume",
2038 : OutputProcessor::Unit::m3,
2039 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).EvapWaterConsump,
2040 : OutputProcessor::SOVTimeStepType::System,
2041 : OutputProcessor::SOVStoreType::Summed,
2042 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name,
2043 : _,
2044 : "Water",
2045 : "Cooling",
2046 : _,
2047 1 : "System");
2048 4 : SetupOutputVariable(state,
2049 : "Cooling Coil Evaporative Condenser Mains Supply Water Volume",
2050 : OutputProcessor::Unit::m3,
2051 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).EvapWaterConsump,
2052 : OutputProcessor::SOVTimeStepType::System,
2053 : OutputProcessor::SOVStoreType::Summed,
2054 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name,
2055 : _,
2056 : "MainsWater",
2057 : "Cooling",
2058 : _,
2059 1 : "System");
2060 0 : } else if (state.dataPackagedThermalStorageCoil->TESCoil(item).EvapWaterSupplyMode == EvapWaterSupply::WaterSupplyFromTank) {
2061 0 : SetupOutputVariable(state,
2062 : "Cooling Coil Evaporative Condenser Storage Tank Water Volume",
2063 : OutputProcessor::Unit::m3,
2064 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).EvapWaterConsump,
2065 : OutputProcessor::SOVTimeStepType::System,
2066 : OutputProcessor::SOVStoreType::Summed,
2067 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name,
2068 : _,
2069 : "Water",
2070 : "Cooling",
2071 : _,
2072 0 : "System");
2073 0 : SetupOutputVariable(state,
2074 : "Cooling Coil Evaporative Condenser Starved Water Volume",
2075 : OutputProcessor::Unit::m3,
2076 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).EvapWaterStarvMakup,
2077 : OutputProcessor::SOVTimeStepType::System,
2078 : OutputProcessor::SOVStoreType::Summed,
2079 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name,
2080 : _,
2081 : "Water",
2082 : "Cooling",
2083 : _,
2084 0 : "System");
2085 0 : SetupOutputVariable(state,
2086 : "Cooling Coil Evaporative Condenser Starved Mains Water Volume",
2087 : OutputProcessor::Unit::m3,
2088 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).EvapWaterStarvMakup,
2089 : OutputProcessor::SOVTimeStepType::System,
2090 : OutputProcessor::SOVStoreType::Summed,
2091 0 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name,
2092 : _,
2093 : "MainsWater",
2094 : "Cooling",
2095 : _,
2096 0 : "System");
2097 : }
2098 :
2099 4 : SetupOutputVariable(state,
2100 : "Cooling Coil Evaporative Condenser Pump Electricity Rate",
2101 : OutputProcessor::Unit::W,
2102 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).EvapCondPumpElecPower,
2103 : OutputProcessor::SOVTimeStepType::System,
2104 : OutputProcessor::SOVStoreType::Average,
2105 2 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name);
2106 4 : SetupOutputVariable(state,
2107 : "Cooling Coil Evaporative Condenser Pump Electricity Energy",
2108 : OutputProcessor::Unit::J,
2109 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).EvapCondPumpElecConsumption,
2110 : OutputProcessor::SOVTimeStepType::System,
2111 : OutputProcessor::SOVStoreType::Summed,
2112 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name,
2113 : _,
2114 : "Electricity",
2115 : "COOLING",
2116 : _,
2117 1 : "System");
2118 :
2119 4 : SetupOutputVariable(state,
2120 : "Cooling Coil Basin Heater Electricity Rate",
2121 : OutputProcessor::Unit::W,
2122 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).ElectEvapCondBasinHeaterPower,
2123 : OutputProcessor::SOVTimeStepType::System,
2124 : OutputProcessor::SOVStoreType::Average,
2125 2 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name);
2126 4 : SetupOutputVariable(state,
2127 : "Cooling Coil Basin Heater Electricity Energy",
2128 : OutputProcessor::Unit::J,
2129 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).ElectEvapCondBasinHeaterEnergy,
2130 : OutputProcessor::SOVTimeStepType::System,
2131 : OutputProcessor::SOVStoreType::Summed,
2132 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name,
2133 : _,
2134 : "Electricity",
2135 : "COOLING",
2136 : "Thermal Protection",
2137 1 : "System");
2138 : }
2139 :
2140 4 : switch (state.dataPackagedThermalStorageCoil->TESCoil(item).StorageMedia) {
2141 1 : case MediaType::Water:
2142 : case MediaType::UserDefindFluid:
2143 4 : SetupOutputVariable(state,
2144 : "Cooling Coil Fluid Thermal Storage End Temperature",
2145 : OutputProcessor::Unit::C,
2146 1 : state.dataPackagedThermalStorageCoil->TESCoil(item).FluidTankTempFinal,
2147 : OutputProcessor::SOVTimeStepType::System,
2148 : OutputProcessor::SOVStoreType::Average,
2149 2 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name);
2150 1 : break;
2151 3 : case MediaType::Ice:
2152 12 : SetupOutputVariable(state,
2153 : "Cooling Coil Ice Thermal Storage End Fraction",
2154 : OutputProcessor::Unit::None,
2155 3 : state.dataPackagedThermalStorageCoil->TESCoil(item).IceFracRemain,
2156 : OutputProcessor::SOVTimeStepType::System,
2157 : OutputProcessor::SOVStoreType::Average,
2158 6 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name);
2159 3 : break;
2160 0 : default:
2161 : // nothing
2162 0 : break;
2163 : }
2164 : }
2165 :
2166 1 : if (state.dataGlobal->AnyEnergyManagementSystemInModel) {
2167 5 : for (item = 1; item <= state.dataPackagedThermalStorageCoil->NumTESCoils; ++item) {
2168 : // setup EMS actuator for control mode
2169 16 : SetupEMSActuator(state,
2170 : "Coil:Cooling:DX:SingleSpeed:ThermalStorage",
2171 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).Name,
2172 : "Operating Mode",
2173 : "[ ]",
2174 4 : state.dataPackagedThermalStorageCoil->TESCoil(item).EMSControlModeOn,
2175 12 : state.dataPackagedThermalStorageCoil->TESCoil(item).EMSControlModeValue);
2176 : }
2177 : }
2178 1 : }
2179 :
2180 64047 : void InitTESCoil(EnergyPlusData &state, int &TESCoilNum)
2181 : {
2182 :
2183 : // SUBROUTINE INFORMATION:
2184 : // AUTHOR B. Griffith
2185 : // DATE WRITTEN <date_written>
2186 : // MODIFIED na
2187 : // RE-ENGINEERED na
2188 :
2189 : // Using/Aliasing
2190 :
2191 : using PlantUtilities::ScanPlantLoopsForObject;
2192 : using ScheduleManager::GetCurrentScheduleValue;
2193 :
2194 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
2195 64047 : auto &MyFlag = state.dataPackagedThermalStorageCoil->MyFlag;
2196 64047 : auto &MySizeFlag = state.dataPackagedThermalStorageCoil->MySizeFlag;
2197 64047 : auto &MyEnvrnFlag = state.dataPackagedThermalStorageCoil->MyEnvrnFlag;
2198 64047 : auto &MyWarmupFlag = state.dataPackagedThermalStorageCoil->MyWarmupFlag;
2199 : bool errFlag;
2200 64047 : PlantLocation plantLoc{};
2201 : Real64 tmpSchedValue;
2202 :
2203 64047 : if (state.dataPackagedThermalStorageCoil->MyOneTimeFlag) {
2204 : // initialize the environment and sizing flags
2205 1 : MyFlag.allocate(state.dataPackagedThermalStorageCoil->NumTESCoils);
2206 1 : MySizeFlag.allocate(state.dataPackagedThermalStorageCoil->NumTESCoils);
2207 1 : MyEnvrnFlag.allocate(state.dataPackagedThermalStorageCoil->NumTESCoils);
2208 1 : MyWarmupFlag.allocate(state.dataPackagedThermalStorageCoil->NumTESCoils);
2209 1 : MyFlag = true;
2210 1 : MySizeFlag = true;
2211 1 : MyEnvrnFlag = true;
2212 1 : state.dataPackagedThermalStorageCoil->MyOneTimeFlag = false;
2213 1 : MyWarmupFlag = false;
2214 : }
2215 :
2216 64047 : if (MyFlag(TESCoilNum)) {
2217 :
2218 4 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantConnectionAvailable) {
2219 1 : errFlag = false;
2220 2 : ScanPlantLoopsForObject(state,
2221 1 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name,
2222 : DataPlant::PlantEquipmentType::PackagedTESCoolingCoil,
2223 : plantLoc,
2224 : errFlag);
2225 :
2226 : // double check node names match
2227 1 : if (errFlag) {
2228 0 : ShowFatalError(state, "InitTESCoil: Program terminated due to previous condition(s).");
2229 : }
2230 1 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantLoopNum = plantLoc.loopNum;
2231 1 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantLoopSideNum = plantLoc.loopSideNum;
2232 1 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantBranchNum = plantLoc.branchNum;
2233 1 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantCompNum = plantLoc.compNum;
2234 :
2235 2 : if ((DataPlant::CompData::getPlantComponent(state, plantLoc).NodeNumIn !=
2236 2 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantInletNodeNum) ||
2237 1 : (DataPlant::CompData::getPlantComponent(state, plantLoc).NodeNumOut !=
2238 1 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantOutletNodeNum)) {
2239 0 : ShowSevereError(state,
2240 0 : "InitTESCoil: Coil:Cooling:DX:SingleSpeed:ThermalStorage =\"" +
2241 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name + "\", non-matching plant nodes.");
2242 0 : ShowContinueError(state,
2243 0 : "...in Branch=\"" +
2244 0 : state.dataPlnt->PlantLoop(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantLoopNum)
2245 0 : .LoopSide(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantLoopSideNum)
2246 0 : .Branch(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantBranchNum)
2247 0 : .Name +
2248 : "\", Component referenced with:");
2249 0 : ShowContinueError(
2250 0 : state, "...Inlet Node=\"" + state.dataLoopNodes->NodeID(DataPlant::CompData::getPlantComponent(state, plantLoc).NodeNumIn));
2251 0 : ShowContinueError(
2252 0 : state, "...Outlet Node=\"" + state.dataLoopNodes->NodeID(DataPlant::CompData::getPlantComponent(state, plantLoc).NodeNumOut));
2253 0 : ShowContinueError(state,
2254 0 : "...TES Inlet Node=\"" +
2255 0 : state.dataLoopNodes->NodeID(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantInletNodeNum));
2256 0 : ShowContinueError(state,
2257 0 : "...TES Outlet Node=\"" +
2258 0 : state.dataLoopNodes->NodeID(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantOutletNodeNum));
2259 0 : errFlag = true;
2260 : }
2261 1 : if (errFlag) {
2262 0 : ShowFatalError(state, "InitTESCoil: Program terminated due to previous condition(s).");
2263 : }
2264 :
2265 : } // any plant connection to TES
2266 4 : MyFlag(TESCoilNum) = false;
2267 : }
2268 :
2269 64047 : if (MySizeFlag(TESCoilNum)) {
2270 :
2271 4 : SizeTESCoil(state, TESCoilNum);
2272 :
2273 4 : MySizeFlag(TESCoilNum) = false;
2274 : }
2275 :
2276 64047 : if (state.dataGlobal->BeginEnvrnFlag && MyEnvrnFlag(TESCoilNum)) {
2277 20 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CurControlMode = PTSCOperatingMode::Off;
2278 20 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotPlant = 0.0;
2279 20 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Q_Plant = 0.0;
2280 20 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotAmbient = 0.0;
2281 20 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Q_Ambient = 0.0;
2282 20 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotTES = 0.0;
2283 20 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Q_TES = 0.0;
2284 20 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TimeElapsed = 0.0;
2285 20 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).IceFracRemain = 0.0;
2286 20 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).IceFracRemainLastTimestep = 0.0;
2287 20 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).FluidTankTempFinal =
2288 20 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RatedFluidTankTemp;
2289 20 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).FluidTankTempFinalLastTimestep =
2290 20 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RatedFluidTankTemp;
2291 20 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingPower = 0.0; // electric power for cooling [W]
2292 20 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingEnergy = 0.0; // electric energy for cooling [J], metered
2293 20 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingRate = 0.0; // evaporator coil total cooling rate [W]
2294 20 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingEnergy = 0.0; // evaporatory coil total cooling energy [J], metered
2295 20 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingRate = 0.0;
2296 20 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingEnergy = 0.0;
2297 20 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapLatCoolingRate = 0.0;
2298 20 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapLatCoolingEnergy = 0.0;
2299 20 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RuntimeFraction = 0.0;
2300 20 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElectColdWeatherPower = 0.0; // electric power for cold weather protection [W]
2301 20 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElectColdWeatherEnergy =
2302 : 0.0; // electric energy for cold weather protection [J], metered
2303 20 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElectEvapCondBasinHeaterPower = 0.0;
2304 20 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElectEvapCondBasinHeaterEnergy = 0.0;
2305 :
2306 20 : MyEnvrnFlag(TESCoilNum) = false;
2307 : }
2308 :
2309 64047 : if (!state.dataGlobal->BeginEnvrnFlag) MyEnvrnFlag(TESCoilNum) = true;
2310 :
2311 64047 : if (MyWarmupFlag(TESCoilNum) && (!state.dataGlobal->WarmupFlag)) {
2312 : // reset to initial condition once warm up is over.
2313 8 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).IceFracRemain = 0.0;
2314 8 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).IceFracRemainLastTimestep = 0.0;
2315 8 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).FluidTankTempFinal =
2316 8 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RatedFluidTankTemp;
2317 8 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).FluidTankTempFinalLastTimestep =
2318 8 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RatedFluidTankTemp;
2319 8 : MyWarmupFlag(TESCoilNum) = false;
2320 : }
2321 :
2322 64047 : if (state.dataGlobal->WarmupFlag) MyWarmupFlag(TESCoilNum) = true;
2323 :
2324 : // determine control mode
2325 64047 : if (GetCurrentScheduleValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).AvailSchedNum) != 0.0) {
2326 64047 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ModeControlType == PTSCCtrlType::ScheduledOpModes) {
2327 16945 : tmpSchedValue = GetCurrentScheduleValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ControlModeSchedNum);
2328 : // check if value is valid
2329 16945 : if (tmpSchedValue > static_cast<int>(PTSCOperatingMode::Invalid) && tmpSchedValue < static_cast<int>(PTSCOperatingMode::Num)) {
2330 16945 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CurControlMode = static_cast<PTSCOperatingMode>(tmpSchedValue);
2331 : } else {
2332 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CurControlMode = PTSCOperatingMode::Off;
2333 0 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ControlModeErrorIndex == 0) {
2334 0 : ShowSevereMessage(state, "InitTESCoil: Invalid control schedule value for operating mode");
2335 0 : ShowContinueError(state,
2336 0 : "Occurs for Coil:Cooling:DX:SingleSpeed:ThermalStorage name = " +
2337 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name);
2338 0 : ShowContinueError(state, format("Value returned from schedule ={:.8R}", tmpSchedValue));
2339 0 : ShowContinueError(state, "Operating mode will be set to Off, and the simulation continues");
2340 : }
2341 0 : ShowRecurringSevereErrorAtEnd(state,
2342 : "InitTESCoil: Invalid control schedule value for TES operating mode, set to Off",
2343 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ControlModeErrorIndex,
2344 : tmpSchedValue,
2345 : tmpSchedValue);
2346 : }
2347 :
2348 47102 : } else if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ModeControlType == PTSCCtrlType::EMSActuatedOpModes) {
2349 47102 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EMSControlModeOn) {
2350 47090 : int tmpEMSValue = std::floor(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EMSControlModeValue);
2351 :
2352 : // check for invalid value first
2353 47090 : if (tmpEMSValue <= static_cast<int>(PTSCOperatingMode::Invalid) || tmpEMSValue >= static_cast<int>(PTSCOperatingMode::Num)) {
2354 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CurControlMode = PTSCOperatingMode::Off;
2355 0 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ControlModeErrorIndex == 0) {
2356 0 : ShowSevereMessage(state, "InitTESCoil: Invalid control value for operating mode");
2357 0 : ShowContinueError(state,
2358 0 : "Occurs for Coil:Cooling:DX:SingleSpeed:ThermalStorage name = " +
2359 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name);
2360 0 : ShowContinueError(
2361 : state,
2362 0 : format("Value returned from EMS ={:.8R}", state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EMSControlModeValue));
2363 0 : ShowContinueError(state, "Operating mode will be set to Off, and the simulation continues");
2364 : }
2365 0 : ShowRecurringSevereErrorAtEnd(state,
2366 : "InitTESCoil: Invalid control schedule value for TES operating mode, set to Off",
2367 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ControlModeErrorIndex,
2368 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EMSControlModeValue,
2369 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EMSControlModeValue);
2370 : } else {
2371 : // at this point we have a valid value, we can cast it and assign it
2372 47090 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CurControlMode = static_cast<PTSCOperatingMode>(tmpEMSValue);
2373 : // but then we need to do some error handling for certain cases
2374 47090 : switch (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CurControlMode) {
2375 0 : case PTSCOperatingMode::Off:
2376 0 : break; // nothing to check
2377 :
2378 26491 : case PTSCOperatingMode::CoolingOnly:
2379 26491 : if (!(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyModeIsAvailable)) {
2380 0 : ShowSevereMessage(state, "InitTESCoil: Invalid control value for operating mode");
2381 0 : ShowContinueError(state,
2382 0 : "Occurs for Coil:Cooling:DX:SingleSpeed:ThermalStorage name = " +
2383 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name);
2384 0 : ShowContinueError(state, "Value returned from EMS indicates Cooling Only Mode but that mode is not available.");
2385 0 : ShowContinueError(state, "Operating mode will be set to Off, and the simulation continues");
2386 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CurControlMode = PTSCOperatingMode::Off;
2387 : }
2388 26491 : break;
2389 3998 : case PTSCOperatingMode::CoolingAndCharge:
2390 3998 : if (!(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeModeAvailable)) {
2391 0 : ShowSevereMessage(state, "InitTESCoil: Invalid control value for operating mode");
2392 0 : ShowContinueError(state,
2393 0 : "Occurs for Coil:Cooling:DX:SingleSpeed:ThermalStorage name = " +
2394 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name);
2395 0 : ShowContinueError(state, "Value returned from EMS indicates Cooling And Charge Mode but that mode is not available.");
2396 0 : ShowContinueError(state, "Operating mode will be set to Off, and the simulation continues");
2397 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CurControlMode = PTSCOperatingMode::Off;
2398 : }
2399 3998 : break;
2400 0 : case PTSCOperatingMode::CoolingAndDischarge:
2401 0 : if (!(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeModeAvailable)) {
2402 0 : ShowSevereMessage(state, "InitTESCoil: Invalid control value for operating mode");
2403 0 : ShowContinueError(state,
2404 0 : "Occurs for Coil:Cooling:DX:SingleSpeed:ThermalStorage name = " +
2405 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name);
2406 0 : ShowContinueError(state, "Value returned from EMS indicates Cooling And Discharge Mode but that mode is not available.");
2407 0 : ShowContinueError(state, "Operating mode will be set to Off, and the simulation continues");
2408 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CurControlMode = PTSCOperatingMode::Off;
2409 : }
2410 0 : break;
2411 1344 : case PTSCOperatingMode::ChargeOnly:
2412 1344 : if (!(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ChargeOnlyModeAvailable)) {
2413 0 : ShowSevereMessage(state, "InitTESCoil: Invalid control value for operating mode");
2414 0 : ShowContinueError(state,
2415 0 : "Occurs for Coil:Cooling:DX:SingleSpeed:ThermalStorage name = " +
2416 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name);
2417 0 : ShowContinueError(state, "Value returned from EMS indicates Charge Only Mode but that mode is not available.");
2418 0 : ShowContinueError(state, "Operating mode will be set to Off, and the simulation continues");
2419 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CurControlMode = PTSCOperatingMode::Off;
2420 : }
2421 1344 : break;
2422 15257 : case PTSCOperatingMode::DischargeOnly:
2423 15257 : if (!(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).DischargeOnlyModeAvailable)) {
2424 0 : ShowSevereMessage(state, "InitTESCoil: Invalid control value for operating mode");
2425 0 : ShowContinueError(state,
2426 0 : "Occurs for Coil:Cooling:DX:SingleSpeed:ThermalStorage name = " +
2427 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name);
2428 0 : ShowContinueError(state, "Value returned from EMS indicates Discharge Only Mode but that mode is not available.");
2429 0 : ShowContinueError(state, "Operating mode will be set to Off, and the simulation continues");
2430 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CurControlMode = PTSCOperatingMode::Off;
2431 : }
2432 15257 : break;
2433 0 : default:
2434 : // no need to handle other cases
2435 0 : break;
2436 : }
2437 : }
2438 :
2439 : } else {
2440 12 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CurControlMode = PTSCOperatingMode::Off;
2441 : }
2442 : }
2443 : } else {
2444 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CurControlMode = PTSCOperatingMode::Off;
2445 : }
2446 :
2447 : // update the integer report variable
2448 64047 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).curControlModeReport =
2449 64047 : static_cast<int>(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CurControlMode);
2450 :
2451 64047 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotPlant = 0.0; // heat exchange rate for plant connection to TES tank [W]
2452 64047 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Q_Plant = 0.0; // heat exchange energy for plant connection to TES tank [J]
2453 64047 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotAmbient =
2454 : 0.0; // heat exchange rate for skin losses/gains for TES tank to surroundings [W]
2455 64047 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Q_Ambient =
2456 : 0.0; // heat exchange enegy for skin losses/gains for TES tank to surroundings [J]
2457 64047 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotTES =
2458 : 0.0; // heat exchange rate by mechanical systems to charge or discharge TES [W]
2459 64047 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Q_TES =
2460 : 0.0; // heat exchange energy by mechanical systems to charge or discharge TES [J]
2461 :
2462 : // dynamic calculated data
2463 64047 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingPower = 0.0; // electric power for cooling [W]
2464 64047 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingEnergy = 0.0; // electric energy for cooling [J], metered
2465 64047 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingRate = 0.0; // evaporator coil total cooling rate [W]
2466 64047 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingEnergy = 0.0; // evaporatory coil total cooling energy [J], metered
2467 64047 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingRate = 0.0;
2468 64047 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingEnergy = 0.0;
2469 64047 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapLatCoolingRate = 0.0;
2470 64047 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapLatCoolingEnergy = 0.0;
2471 64047 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RuntimeFraction = 0.0;
2472 64047 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserRuntimeFraction = 0.0;
2473 64047 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElectColdWeatherPower = 0.0; // electric power for cold weather protection [W]
2474 64047 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElectColdWeatherEnergy =
2475 : 0.0; // electric energy for cold weather protection [J], metered
2476 64047 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElectEvapCondBasinHeaterPower = 0.0;
2477 64047 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElectEvapCondBasinHeaterEnergy = 0.0;
2478 64047 : }
2479 :
2480 4 : void SizeTESCoil(EnergyPlusData &state, int &TESCoilNum)
2481 : {
2482 :
2483 : // SUBROUTINE INFORMATION:
2484 : // AUTHOR B. Griffith
2485 : // DATE WRITTEN April 2013
2486 : // MODIFIED na
2487 : // RE-ENGINEERED na
2488 :
2489 : // Using/Aliasing
2490 : using namespace DataSizing;
2491 : using namespace OutputReportPredefined;
2492 : using Curve::CurveValue;
2493 : using FluidProperties::GetDensityGlycol;
2494 : using FluidProperties::GetSpecificHeatGlycol;
2495 :
2496 : // SUBROUTINE PARAMETER DEFINITIONS:
2497 : static constexpr std::string_view RoutineName("SizeTESCoil ");
2498 : static constexpr std::string_view calcTESWaterStorageTank("CalcTESWaterStorageTank");
2499 4 : Real64 constexpr FluidTankSizingDeltaT(10.0);
2500 :
2501 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
2502 : Real64 MixTemp;
2503 : Real64 MixHumRat;
2504 : Real64 MixEnth;
2505 : Real64 MixWetBulb;
2506 : Real64 SupTemp;
2507 : Real64 SupHumRat;
2508 : Real64 SupEnth;
2509 : Real64 OutTemp;
2510 : Real64 OutAirFrac;
2511 : Real64 VolFlowRate;
2512 : Real64 CoolCapAtPeak;
2513 : Real64 TotCapTempModFac;
2514 : int TimeStepNumAtMax;
2515 : int DDNum;
2516 : Real64 rhoair;
2517 : Real64 rho;
2518 : Real64 deltaT;
2519 : Real64 Cp;
2520 :
2521 4 : auto &ZoneEqSizing(state.dataSize->ZoneEqSizing);
2522 :
2523 4 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RatedEvapAirVolFlowRate == AutoSize) {
2524 :
2525 4 : if (state.dataSize->CurSysNum > 0) {
2526 4 : CheckSysSizing(state, "Coil:Cooling:DX:SingleSpeed:ThermalStorage", state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name);
2527 4 : if (state.dataSize->CurOASysNum > 0) {
2528 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RatedEvapAirVolFlowRate =
2529 0 : state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).DesOutAirVolFlow;
2530 : } else {
2531 4 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RatedEvapAirVolFlowRate =
2532 4 : state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).DesMainVolFlow;
2533 : }
2534 0 : } else if (state.dataSize->CurZoneEqNum > 0) {
2535 0 : CheckZoneSizing(state, "Coil:Cooling:DX:SingleSpeed:ThermalStorage", state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name);
2536 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RatedEvapAirVolFlowRate =
2537 0 : max(state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesCoolVolFlow,
2538 0 : state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesHeatVolFlow);
2539 : }
2540 :
2541 4 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RatedEvapAirVolFlowRate < SmallAirVolFlow) {
2542 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RatedEvapAirVolFlowRate = 0.0;
2543 : }
2544 16 : BaseSizer::reportSizerOutput(state,
2545 : "Coil:Cooling:DX:SingleSpeed:ThermalStorage",
2546 4 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name,
2547 : "Rated Evaporator Air Flow Rate [m3/s]",
2548 12 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RatedEvapAirVolFlowRate);
2549 : }
2550 :
2551 4 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RatedEvapAirMassFlowRate =
2552 4 : state.dataEnvrn->StdRhoAir * state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RatedEvapAirVolFlowRate;
2553 :
2554 4 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserAirVolumeFlow == DataGlobalConstants::AutoCalculate) {
2555 4 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserAirVolumeFlow =
2556 8 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RatedEvapAirVolFlowRate *
2557 4 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserAirFlowSizingFactor;
2558 16 : BaseSizer::reportSizerOutput(state,
2559 : "Coil:Cooling:DX:SingleSpeed:ThermalStorage",
2560 4 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name,
2561 : "Condenser Air Flow Rate [m3/s]",
2562 12 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserAirVolumeFlow);
2563 : }
2564 :
2565 4 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserAirMassFlow =
2566 4 : state.dataEnvrn->StdRhoAir * state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserAirVolumeFlow;
2567 :
2568 4 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyRatedTotCap == AutoSize) {
2569 4 : if (state.dataSize->CurSysNum > 0) {
2570 4 : CheckSysSizing(state, "Coil:Cooling:DX:SingleSpeed:ThermalStorage", state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name);
2571 4 : VolFlowRate = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RatedEvapAirVolFlowRate;
2572 4 : if (VolFlowRate >= SmallAirVolFlow) {
2573 4 : if (state.dataSize->CurOASysNum > 0) { // coil is in the OA stream
2574 0 : MixTemp = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).OutTempAtCoolPeak;
2575 0 : MixHumRat = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).OutHumRatAtCoolPeak;
2576 0 : SupTemp = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).PrecoolTemp;
2577 0 : SupHumRat = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).PrecoolHumRat;
2578 : } else { // coil is on the main air loop
2579 : // MixTemp = FinalSysSizing(CurSysNum)%MixTempAtCoolPeak
2580 : // MixHumRat = FinalSysSizing(CurSysNum)%MixHumRatAtCoolPeak
2581 4 : SupTemp = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).CoolSupTemp;
2582 4 : SupHumRat = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).CoolSupHumRat;
2583 4 : if (state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).NumOACoolCoils ==
2584 : 0) { // there is no precooling of the OA stream
2585 4 : MixTemp = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).MixTempAtCoolPeak;
2586 4 : MixHumRat = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).MixHumRatAtCoolPeak;
2587 : } else { // there is precooling of OA stream
2588 0 : if (VolFlowRate > 0.0) {
2589 0 : OutAirFrac = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).DesOutAirVolFlow / VolFlowRate;
2590 : } else {
2591 0 : OutAirFrac = 1.0;
2592 : }
2593 0 : OutAirFrac = min(1.0, max(0.0, OutAirFrac));
2594 0 : MixTemp = OutAirFrac * state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).PrecoolTemp +
2595 0 : (1.0 - OutAirFrac) * state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).RetTempAtCoolPeak;
2596 0 : MixHumRat = OutAirFrac * state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).PrecoolHumRat +
2597 0 : (1.0 - OutAirFrac) * state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).RetHumRatAtCoolPeak;
2598 : }
2599 : }
2600 4 : OutTemp = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).OutTempAtCoolPeak;
2601 4 : rhoair = PsyRhoAirFnPbTdbW(state, state.dataEnvrn->StdBaroPress, MixTemp, MixHumRat, RoutineName);
2602 4 : MixEnth = PsyHFnTdbW(MixTemp, MixHumRat);
2603 4 : MixWetBulb = PsyTwbFnTdbWPb(state, MixTemp, MixHumRat, state.dataEnvrn->StdBaroPress, RoutineName);
2604 4 : SupEnth = PsyHFnTdbW(SupTemp, SupHumRat);
2605 4 : TotCapTempModFac =
2606 8 : CurveValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyCapFTempCurve, MixWetBulb, OutTemp);
2607 4 : CoolCapAtPeak = max(0.0, (rhoair * VolFlowRate * (MixEnth - SupEnth)));
2608 4 : if (TotCapTempModFac > 0.0) {
2609 4 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyRatedTotCap = CoolCapAtPeak / TotCapTempModFac;
2610 : } else {
2611 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyRatedTotCap = CoolCapAtPeak;
2612 : }
2613 :
2614 : } else {
2615 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyRatedTotCap = 0.0;
2616 : }
2617 0 : } else if (state.dataSize->CurZoneEqNum > 0) {
2618 0 : CheckZoneSizing(state, "Coil:Cooling:DX:SingleSpeed:ThermalStorage", state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name);
2619 0 : VolFlowRate = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RatedEvapAirVolFlowRate;
2620 0 : if (VolFlowRate >= SmallAirVolFlow) {
2621 0 : if (state.dataSize->ZoneEqDXCoil) {
2622 0 : if (ZoneEqSizing(state.dataSize->CurZoneEqNum).OAVolFlow > 0.0) {
2623 0 : MixTemp = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesCoolCoilInTemp;
2624 0 : MixHumRat = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesCoolCoilInHumRat;
2625 : } else {
2626 0 : MixTemp = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).ZoneRetTempAtCoolPeak;
2627 0 : MixHumRat = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).ZoneHumRatAtCoolPeak;
2628 : }
2629 : } else {
2630 0 : MixTemp = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesCoolCoilInTemp;
2631 0 : MixHumRat = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesCoolCoilInHumRat;
2632 : }
2633 0 : SupTemp = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).CoolDesTemp;
2634 0 : SupHumRat = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).CoolDesHumRat;
2635 0 : TimeStepNumAtMax = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).TimeStepNumAtCoolMax;
2636 0 : DDNum = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).CoolDDNum;
2637 0 : if (DDNum > 0 && TimeStepNumAtMax > 0) {
2638 0 : OutTemp = state.dataSize->DesDayWeath(DDNum).Temp(TimeStepNumAtMax);
2639 : } else {
2640 0 : OutTemp = 0.0;
2641 : }
2642 0 : rhoair = PsyRhoAirFnPbTdbW(state, state.dataEnvrn->StdBaroPress, MixTemp, MixHumRat, RoutineName);
2643 0 : MixEnth = PsyHFnTdbW(MixTemp, MixHumRat);
2644 0 : MixWetBulb = PsyTwbFnTdbWPb(state, MixTemp, MixHumRat, state.dataEnvrn->StdBaroPress, RoutineName);
2645 0 : SupEnth = PsyHFnTdbW(SupTemp, SupHumRat);
2646 0 : TotCapTempModFac =
2647 0 : CurveValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyCapFTempCurve, MixWetBulb, OutTemp);
2648 0 : CoolCapAtPeak = max(0.0, (rhoair * VolFlowRate * (MixEnth - SupEnth)));
2649 0 : if (TotCapTempModFac > 0.0) {
2650 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyRatedTotCap = CoolCapAtPeak / TotCapTempModFac;
2651 : } else {
2652 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyRatedTotCap = CoolCapAtPeak;
2653 : }
2654 :
2655 : } else {
2656 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyRatedTotCap = 0.0;
2657 : }
2658 : }
2659 :
2660 16 : BaseSizer::reportSizerOutput(state,
2661 : "Coil:Cooling:DX:SingleSpeed:ThermalStorage",
2662 4 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name,
2663 : "Cooling Only Mode Rated Total Evaporator Cooling Capacity [W]",
2664 12 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyRatedTotCap);
2665 : }
2666 :
2667 7 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeModeAvailable &&
2668 3 : (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeRatedTotCap == DataGlobalConstants::AutoCalculate)) {
2669 3 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeRatedTotCap =
2670 6 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyRatedTotCap *
2671 3 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeRatedTotCapSizingFactor;
2672 12 : BaseSizer::reportSizerOutput(state,
2673 : "Coil:Cooling:DX:SingleSpeed:ThermalStorage",
2674 3 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name,
2675 : "Cooling And Charge Mode Rated Total Evaporator Cooling Capacity [W]",
2676 9 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeRatedTotCap);
2677 : }
2678 :
2679 7 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeModeAvailable &&
2680 3 : (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeRatedChargeCap == DataGlobalConstants::AutoCalculate)) {
2681 3 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeRatedChargeCap =
2682 6 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyRatedTotCap *
2683 3 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeRatedChargeCapSizingFactor;
2684 12 : BaseSizer::reportSizerOutput(state,
2685 : "Coil:Cooling:DX:SingleSpeed:ThermalStorage",
2686 3 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name,
2687 : "Cooling And Charge Mode Rated Storage Charging Capacity [W]",
2688 9 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeRatedChargeCap);
2689 : }
2690 :
2691 5 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeModeAvailable &&
2692 1 : (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeRatedTotCap == DataGlobalConstants::AutoCalculate)) {
2693 1 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeRatedTotCap =
2694 2 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyRatedTotCap *
2695 1 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeRatedTotCapSizingFactor;
2696 4 : BaseSizer::reportSizerOutput(state,
2697 : "Coil:Cooling:DX:SingleSpeed:ThermalStorage",
2698 1 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name,
2699 : "Cooling And Discharge Mode Rated Total Evaporator Cooling Capacity [W]",
2700 3 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeRatedTotCap);
2701 : }
2702 :
2703 5 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeModeAvailable &&
2704 1 : (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeRatedDischargeCap == DataGlobalConstants::AutoCalculate)) {
2705 1 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeRatedDischargeCap =
2706 2 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyRatedTotCap *
2707 1 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeRatedDischargeCapSizingFactor;
2708 4 : BaseSizer::reportSizerOutput(state,
2709 : "Coil:Cooling:DX:SingleSpeed:ThermalStorage",
2710 1 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name,
2711 : "Cooling And Discharge Mode Rated Storage Discharging Capacity [W]",
2712 3 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeRatedDischargeCap);
2713 : }
2714 :
2715 5 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ChargeOnlyModeAvailable &&
2716 1 : (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ChargeOnlyRatedCapacity == DataGlobalConstants::AutoCalculate)) {
2717 1 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ChargeOnlyRatedCapacity =
2718 2 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyRatedTotCap *
2719 1 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ChargeOnlyRatedCapacitySizingFactor;
2720 4 : BaseSizer::reportSizerOutput(state,
2721 : "Coil:Cooling:DX:SingleSpeed:ThermalStorage",
2722 1 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name,
2723 : "Charge Only Mode Rated Storage Charging Capacity [W]",
2724 3 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ChargeOnlyRatedCapacity);
2725 : }
2726 :
2727 7 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).DischargeOnlyModeAvailable &&
2728 3 : (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).DischargeOnlyRatedDischargeCap == DataGlobalConstants::AutoCalculate)) {
2729 3 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).DischargeOnlyRatedDischargeCap =
2730 6 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyRatedTotCap *
2731 3 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).DischargeOnlyRatedDischargeCapSizingFactor;
2732 12 : BaseSizer::reportSizerOutput(state,
2733 : "Coil:Cooling:DX:SingleSpeed:ThermalStorage",
2734 3 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name,
2735 : "Discharge Only Mode Rated Storage Discharging Capacity [W]",
2736 9 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).DischargeOnlyRatedDischargeCap);
2737 : }
2738 :
2739 4 : switch (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageMedia) {
2740 1 : case MediaType::UserDefindFluid:
2741 : case MediaType::Water:
2742 1 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).FluidStorageVolume == DataGlobalConstants::AutoCalculate) {
2743 :
2744 : // for fluid tanks, assume a 10C deltaT or diff between max and min, whichever is smaller
2745 1 : deltaT = min(FluidTankSizingDeltaT,
2746 1 : (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).MaximumFluidTankTempLimit -
2747 1 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).MinimumFluidTankTempLimit));
2748 :
2749 2 : rho = GetDensityGlycol(state,
2750 1 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageFluidName,
2751 : DataGlobalConstants::CWInitConvTemp,
2752 1 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageFluidIndex,
2753 : calcTESWaterStorageTank);
2754 2 : Cp = GetSpecificHeatGlycol(state,
2755 1 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageFluidName,
2756 : DataGlobalConstants::CWInitConvTemp,
2757 1 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageFluidIndex,
2758 : calcTESWaterStorageTank);
2759 1 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).DischargeOnlyRatedDischargeCap > 0.0 &&
2760 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).DischargeOnlyModeAvailable) {
2761 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).FluidStorageVolume =
2762 0 : (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).DischargeOnlyRatedDischargeCap *
2763 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageCapacitySizingFactor * DataGlobalConstants::SecInHour) /
2764 0 : (rho * Cp * deltaT);
2765 : } else {
2766 1 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).FluidStorageVolume =
2767 2 : (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyRatedTotCap *
2768 3 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageCapacitySizingFactor * DataGlobalConstants::SecInHour) /
2769 1 : (rho * Cp * deltaT);
2770 : }
2771 4 : BaseSizer::reportSizerOutput(state,
2772 : "Coil:Cooling:DX:SingleSpeed:ThermalStorage",
2773 1 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name,
2774 : "Fluid Storage Volume [m3]",
2775 3 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).FluidStorageVolume);
2776 : }
2777 1 : break;
2778 3 : case MediaType::Ice:
2779 3 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).IceStorageCapacity == DataGlobalConstants::AutoCalculate) {
2780 6 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).DischargeOnlyRatedDischargeCap > 0.0 &&
2781 3 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).DischargeOnlyModeAvailable) {
2782 3 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).IceStorageCapacity =
2783 6 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).DischargeOnlyRatedDischargeCap *
2784 6 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageCapacitySizingFactor * DataGlobalConstants::SecInHour;
2785 : } else {
2786 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).IceStorageCapacity =
2787 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyRatedTotCap *
2788 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageCapacitySizingFactor * DataGlobalConstants::SecInHour;
2789 : }
2790 12 : BaseSizer::reportSizerOutput(state,
2791 : "Coil:Cooling:DX:SingleSpeed:ThermalStorage",
2792 3 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name,
2793 : "Ice Storage Capacity [GJ]",
2794 9 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).IceStorageCapacity / gigaJoulesToJoules);
2795 : }
2796 : default:
2797 3 : break;
2798 : }
2799 :
2800 5 : if ((state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserType == TESCondenserType::Evap) &&
2801 1 : (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapCondPumpElecNomPower == AutoSize)) {
2802 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapCondPumpElecNomPower =
2803 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyRatedTotCap * 0.004266; // w/w (15 w/ton)
2804 0 : BaseSizer::reportSizerOutput(state,
2805 : "Coil:Cooling:DX:SingleSpeed:ThermalStorage",
2806 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name,
2807 : "Evaporative Condenser Pump Rated Power Consumption [W]",
2808 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapCondPumpElecNomPower);
2809 : }
2810 :
2811 8 : PreDefTableEntry(state,
2812 4 : state.dataOutRptPredefined->pdchCoolCoilType,
2813 4 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name,
2814 4 : "Coil:Cooling:DX:SingleSpeed:ThermalStorage");
2815 :
2816 16 : PreDefTableEntry(state,
2817 4 : state.dataOutRptPredefined->pdchCoolCoilTotCap,
2818 4 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name,
2819 4 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyRatedTotCap);
2820 16 : PreDefTableEntry(state,
2821 4 : state.dataOutRptPredefined->pdchCoolCoilSensCap,
2822 4 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name,
2823 4 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyRatedTotCap *
2824 4 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyRatedSHR);
2825 16 : PreDefTableEntry(state,
2826 4 : state.dataOutRptPredefined->pdchCoolCoilLatCap,
2827 4 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name,
2828 4 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyRatedTotCap -
2829 8 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyRatedTotCap *
2830 4 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyRatedSHR);
2831 16 : PreDefTableEntry(state,
2832 4 : state.dataOutRptPredefined->pdchCoolCoilSHR,
2833 4 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name,
2834 4 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyRatedSHR);
2835 16 : PreDefTableEntry(state,
2836 4 : state.dataOutRptPredefined->pdchCoolCoilNomEff,
2837 4 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Name,
2838 4 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyRatedCOP);
2839 4 : }
2840 :
2841 12 : void CalcTESCoilOffMode(EnergyPlusData &state, int const TESCoilNum)
2842 : {
2843 :
2844 : // SUBROUTINE INFORMATION:
2845 : // AUTHOR Brent Griffith
2846 : // DATE WRITTEN April 2013
2847 : // MODIFIED na
2848 : // RE-ENGINEERED na
2849 :
2850 : // Using/Aliasing
2851 : using ScheduleManager::GetCurrentScheduleValue;
2852 :
2853 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
2854 : Real64 StandbyAncillaryPower;
2855 :
2856 : // coil is off; just pass through conditions
2857 12 : if (GetCurrentScheduleValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).AvailSchedNum) != 0.0) {
2858 12 : StandbyAncillaryPower = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).AncillaryControlsPower;
2859 : } else {
2860 0 : StandbyAncillaryPower = 0.0;
2861 : }
2862 :
2863 12 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingPower = StandbyAncillaryPower;
2864 12 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingEnergy =
2865 12 : StandbyAncillaryPower * state.dataHVACGlobal->TimeStepSys * DataGlobalConstants::SecInHour;
2866 :
2867 12 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).Temp =
2868 12 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).Temp;
2869 12 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).HumRat =
2870 12 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).HumRat;
2871 12 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).MassFlowRate =
2872 12 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).MassFlowRate;
2873 12 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).MassFlowRateMinAvail =
2874 12 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).MassFlowRateMinAvail;
2875 12 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).MassFlowRateMaxAvail =
2876 12 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).MassFlowRateMaxAvail;
2877 12 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).Enthalpy =
2878 12 : PsyHFnTdbW(state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).Temp,
2879 12 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).HumRat);
2880 :
2881 12 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).Temp =
2882 12 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).Temp;
2883 12 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).HumRat =
2884 12 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).HumRat;
2885 12 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).MassFlowRate = 0.0;
2886 12 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).MassFlowRate =
2887 12 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).MassFlowRate;
2888 12 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).Enthalpy =
2889 12 : PsyHFnTdbW(state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).Temp,
2890 12 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).HumRat);
2891 12 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RuntimeFraction = 0.0;
2892 12 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingRate = 0.0;
2893 12 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingEnergy = 0.0;
2894 12 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingRate = 0.0;
2895 12 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingEnergy = 0.0;
2896 12 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapLatCoolingRate = 0.0;
2897 12 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapLatCoolingEnergy = 0.0;
2898 :
2899 12 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotTES = 0.0;
2900 12 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Q_TES = 0.0;
2901 :
2902 12 : UpdateTEStorage(state, TESCoilNum);
2903 :
2904 12 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondInletTemp =
2905 12 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).Temp;
2906 :
2907 12 : UpdateColdWeatherProtection(state, TESCoilNum);
2908 :
2909 12 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserType == TESCondenserType::Evap) {
2910 4 : UpdateEvaporativeCondenserBasinHeater(state, TESCoilNum);
2911 : }
2912 12 : }
2913 :
2914 30944 : void CalcTESCoilCoolingOnlyMode(EnergyPlusData &state, int const TESCoilNum, [[maybe_unused]] int const FanOpMode, Real64 const PartLoadRatio)
2915 : {
2916 :
2917 : // SUBROUTINE INFORMATION:
2918 : // AUTHOR Brent Griffith
2919 : // DATE WRITTEN April 2013
2920 : // MODIFIED na
2921 : // RE-ENGINEERED na
2922 :
2923 : // Using/Aliasing
2924 : using Curve::CurveValue;
2925 30944 : auto &TimeStepSys = state.dataHVACGlobal->TimeStepSys;
2926 :
2927 : // SUBROUTINE PARAMETER DEFINITIONS:
2928 30944 : int constexpr MaxIter(30);
2929 30944 : Real64 constexpr RelaxationFactor(0.4);
2930 30944 : Real64 constexpr Tolerance(0.1);
2931 : static constexpr std::string_view RoutineName("CalcTESCoilCoolingOnlyMode");
2932 :
2933 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
2934 : Real64 CondInletTemp; // Condenser inlet temperature (C). Outdoor dry-bulb temp for air-cooled condenser.
2935 : // Outdoor Wetbulb +(1 - effectiveness)*(outdoor drybulb - outdoor wetbulb) for evap condenser.
2936 : Real64 CondInletHumRat; // Condenser inlet humidity ratio (kg/kg). Zero for air-cooled condenser.
2937 : // For evap condenser, its the humidity ratio of the air leaving the evap cooling pads.
2938 : Real64 CondAirMassFlow; // Condenser air mass flow rate [kg/s]
2939 : Real64 CondInletEnthalpy; // condenser inlet enthalpy [J/kg]
2940 : Real64 CondAirSidePressure; // Outdoor barometric pressure at condenser (Pa)
2941 : Real64 QdotCond; // condenser total heat rejection rate [W]
2942 : Real64 CondOutletEnthalpy; // condesner outlet enthalpy [J/kg]
2943 : Real64 OutdoorDryBulb; // outdoor air dry bulb local variable [C]
2944 : Real64 OutdoorHumRat; // outdoor air humidity ratio local [kg/kg]
2945 : Real64 OutdoorWetBulb; // outdoor air wetbulb local [C]
2946 : Real64 EvapAirMassFlow; // local for evaporator air mass flow [kg/s]
2947 : Real64 EvapInletDryBulb; // evaporator inlet air drybulb [C]
2948 : Real64 EvapInletHumRat; // evaporator inlet air humidity ratio [kg/kg]
2949 : Real64 EvapInletWetBulb; // evaporator inlet air wetbulb [C]
2950 : Real64 EvapInletEnthalpy; // evaporator inlet air enthalpy [J/kg]
2951 : Real64 AirMassFlowRatio; // evaporator inlet air mass flow divided by design mass flow [ ]
2952 : Real64 TotCapTempModFac; // total coolin capacity modification factor due to temps []
2953 : Real64 TotCapFlowModFac; // Total cooling capacity modification factor due to flow []
2954 : Real64 TotCap; // total cooling capacity
2955 : Real64 SHRTempFac; // sensible heat ratio modification factor due to temps []
2956 : Real64 SHRFlowFac; // sensible heat ratio modification factor due to flow []
2957 : Real64 SHR; // sensible heat ratio
2958 : Real64 PLF; // part load factor
2959 : Real64 RuntimeFraction; // compressor running time divided by full time of timestep.
2960 : Real64 FullLoadOutAirEnth; // evaporator outlet full load enthalpy [J/kg]
2961 : Real64 hTinwout; // Enthalpy at inlet dry-bulb and outlet humidity ratio [J/kg]
2962 : Real64 FullLoadOutAirHumRat; // evaporator outlet humidity ratio at full load
2963 : Real64 FullLoadOutAirTemp; // evaporator outlet air temperature at full load [C]
2964 : Real64 EvapOutletAirEnthalpy; // evaporator outlet air enthalpy [J/kg]
2965 : Real64 EvapOutletAirHumRat; // evaporator outlet air humidity ratio [kg/kg]
2966 : Real64 EvapOutletAirTemp; // evaporator outlet drybulb [C]
2967 : Real64 EIRTempModFac; // energy input ratio modification factor due to temperatures []
2968 : Real64 EIRFlowModFac; // energy input ratio modification factor due to flow []
2969 : Real64 EIR; // energy input ratio
2970 : Real64 ElecCoolingPower; // compressor electric power
2971 : Real64 MinAirHumRat; // minimum air humidity ratio
2972 : Real64 PartLoadOutAirEnth; // local leaving enthalpy at part load
2973 : Real64 PartLoadDryCoilOutAirTemp; // local leaving drybulb if coil were dry
2974 : bool CoilMightBeDry;
2975 : int Counter;
2976 : bool Converged;
2977 : Real64 DryCoilTestEvapInletHumRat;
2978 : Real64 DryCoilTestEvapInletWetBulb;
2979 : Real64 hADP;
2980 : Real64 tADP;
2981 : Real64 wADP;
2982 : Real64 hTinwADP;
2983 : Real64 SHRadp;
2984 : Real64 werror;
2985 :
2986 : // first deal with condenser
2987 30944 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserType == TESCondenserType::Air) {
2988 23235 : CondAirSidePressure = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).Press;
2989 23235 : if (CondAirSidePressure == state.dataLoopNodes->DefaultNodeValues.Press) {
2990 0 : CondInletTemp = state.dataEnvrn->OutDryBulbTemp;
2991 0 : CondInletHumRat = state.dataEnvrn->OutHumRat;
2992 0 : CondAirSidePressure = state.dataEnvrn->OutBaroPress;
2993 : } else {
2994 23235 : CondInletTemp = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).Temp;
2995 23235 : CondInletHumRat = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).HumRat;
2996 : }
2997 23235 : CondAirMassFlow = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserAirMassFlow;
2998 7709 : } else if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserType == TESCondenserType::Evap) {
2999 7709 : CondAirSidePressure = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).Press;
3000 7709 : if (CondAirSidePressure == state.dataLoopNodes->DefaultNodeValues.Press) {
3001 0 : OutdoorDryBulb = state.dataEnvrn->OutDryBulbTemp;
3002 0 : OutdoorHumRat = state.dataEnvrn->OutHumRat;
3003 0 : CondAirSidePressure = state.dataEnvrn->OutBaroPress;
3004 0 : OutdoorWetBulb = state.dataEnvrn->OutWetBulbTemp;
3005 : } else {
3006 7709 : OutdoorDryBulb = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).Temp;
3007 7709 : OutdoorHumRat = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).HumRat;
3008 7709 : OutdoorWetBulb = PsyTwbFnTdbWPb(state, OutdoorDryBulb, OutdoorHumRat, CondAirSidePressure, RoutineName);
3009 : }
3010 7709 : CondAirMassFlow = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserAirMassFlow;
3011 : // direct evap cool model
3012 7709 : CondInletTemp =
3013 7709 : OutdoorWetBulb + (OutdoorDryBulb - OutdoorWetBulb) * (1.0 - state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapCondEffect);
3014 7709 : CondInletHumRat = PsyWFnTdbTwbPb(state, CondInletTemp, OutdoorWetBulb, CondAirSidePressure, RoutineName);
3015 : }
3016 :
3017 30944 : EvapAirMassFlow = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).MassFlowRate;
3018 30944 : EvapInletDryBulb = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).Temp;
3019 30944 : EvapInletHumRat = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).HumRat;
3020 30944 : EvapInletWetBulb = PsyTwbFnTdbWPb(state, EvapInletDryBulb, EvapInletHumRat, state.dataEnvrn->OutBaroPress, RoutineName);
3021 30944 : EvapInletEnthalpy = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).Enthalpy;
3022 30944 : CoilMightBeDry = false;
3023 :
3024 30944 : if ((EvapAirMassFlow > SmallMassFlow) && (PartLoadRatio > 0.0)) { // coil is running
3025 :
3026 12555 : AirMassFlowRatio = EvapAirMassFlow / state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RatedEvapAirMassFlowRate;
3027 12555 : TotCapTempModFac =
3028 25110 : CurveValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyCapFTempCurve, EvapInletWetBulb, CondInletTemp);
3029 12555 : TotCapTempModFac = max(0.0, TotCapTempModFac); // could warn if negative, DXcoil does
3030 12555 : TotCapFlowModFac = CurveValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyCapFFlowCurve, AirMassFlowRatio);
3031 12555 : TotCapFlowModFac = max(0.0, TotCapFlowModFac); // could warn if negative, DXcoil does
3032 12555 : TotCap = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyRatedTotCap * TotCapTempModFac * TotCapFlowModFac;
3033 : // now see if coil might be running dry
3034 12555 : PartLoadOutAirEnth = EvapInletEnthalpy - (TotCap * PartLoadRatio) / EvapAirMassFlow;
3035 12555 : PartLoadDryCoilOutAirTemp = PsyTdbFnHW(PartLoadOutAirEnth, EvapInletHumRat);
3036 12555 : if (PartLoadDryCoilOutAirTemp > PsyTsatFnHPb(state, PartLoadOutAirEnth, state.dataEnvrn->OutBaroPress, RoutineName)) {
3037 165 : CoilMightBeDry = true;
3038 : // find wADP, humidity ratio at apparatus dewpoint and inlet hum rat that would have dry coil
3039 165 : DryCoilTestEvapInletHumRat = EvapInletHumRat;
3040 165 : DryCoilTestEvapInletWetBulb = EvapInletWetBulb;
3041 165 : Counter = 0;
3042 165 : Converged = false;
3043 495 : while (!Converged) {
3044 330 : TotCapTempModFac = CurveValue(state,
3045 165 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyCapFTempCurve,
3046 : DryCoilTestEvapInletWetBulb,
3047 : CondInletTemp);
3048 165 : TotCapTempModFac = max(0.0, TotCapTempModFac); // could warn if negative, DXcoil does
3049 165 : TotCapFlowModFac =
3050 330 : CurveValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyCapFFlowCurve, AirMassFlowRatio);
3051 165 : TotCapFlowModFac = max(0.0, TotCapFlowModFac); // could warn if negative, DXcoil does
3052 165 : TotCap = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyRatedTotCap * TotCapTempModFac * TotCapFlowModFac;
3053 :
3054 : // coil bypass factor = 0.0
3055 165 : hADP = EvapInletEnthalpy - (TotCap / EvapAirMassFlow);
3056 165 : tADP = PsyTsatFnHPb(state, hADP, state.dataEnvrn->OutBaroPress, RoutineName);
3057 165 : wADP = min(EvapInletHumRat, PsyWFnTdbH(state, tADP, hADP, RoutineName));
3058 165 : hTinwADP = PsyHFnTdbW(EvapInletDryBulb, wADP);
3059 165 : if ((EvapInletEnthalpy - hADP) > 1.e-10) {
3060 165 : SHRadp = min((hTinwADP - hADP) / (EvapInletEnthalpy - hADP), 1.0);
3061 : } else {
3062 0 : SHRadp = 1.0;
3063 : }
3064 :
3065 165 : if ((wADP > DryCoilTestEvapInletHumRat) || (Counter >= 1 && Counter < MaxIter)) {
3066 0 : if (DryCoilTestEvapInletHumRat <= 0.0) DryCoilTestEvapInletHumRat = 0.00001;
3067 0 : werror = (DryCoilTestEvapInletHumRat - wADP) / DryCoilTestEvapInletHumRat;
3068 :
3069 0 : DryCoilTestEvapInletHumRat = RelaxationFactor * wADP + (1.0 - RelaxationFactor) * DryCoilTestEvapInletHumRat;
3070 0 : DryCoilTestEvapInletWetBulb =
3071 0 : PsyTwbFnTdbWPb(state, EvapInletDryBulb, DryCoilTestEvapInletHumRat, state.dataEnvrn->OutBaroPress, RoutineName);
3072 :
3073 0 : ++Counter;
3074 0 : if (std::abs(werror) <= Tolerance) {
3075 0 : Converged = true;
3076 : } else {
3077 0 : Converged = false;
3078 : }
3079 : } else {
3080 165 : Converged = true;
3081 : }
3082 : }
3083 : }
3084 :
3085 12555 : SHRTempFac =
3086 25110 : CurveValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlySHRFTempCurve, EvapInletWetBulb, EvapInletDryBulb);
3087 12555 : SHRFlowFac = CurveValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlySHRFFlowCurve, AirMassFlowRatio);
3088 12555 : SHR = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyRatedSHR * SHRTempFac * SHRFlowFac;
3089 12555 : SHR = min(SHR, 1.0); // warn maybe
3090 12555 : SHR = max(SHR, 0.0); // warn maybe
3091 12555 : if (CoilMightBeDry) {
3092 165 : if ((EvapInletHumRat < DryCoilTestEvapInletHumRat) && (SHRadp > SHR)) { // coil is dry for sure
3093 0 : SHR = 1.0;
3094 165 : } else if (SHRadp > SHR) {
3095 165 : SHR = SHRadp;
3096 : }
3097 : }
3098 12555 : PLF = CurveValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyPLFFPLRCurve, PartLoadRatio);
3099 12555 : if (PLF >= PartLoadRatio && PLF > 0.0) {
3100 7159 : RuntimeFraction = PartLoadRatio / PLF;
3101 : } else {
3102 5396 : RuntimeFraction = 1.0; // warn maybe
3103 : }
3104 : // Calculate full load output conditions
3105 12555 : FullLoadOutAirEnth = EvapInletEnthalpy - TotCap / EvapAirMassFlow;
3106 :
3107 12555 : hTinwout = EvapInletEnthalpy - (1.0 - SHR) * (TotCap / EvapAirMassFlow);
3108 : // The following will often throw psych warnings for neg w, suppress warnings because error condition is handled in next IF
3109 12555 : FullLoadOutAirHumRat = PsyWFnTdbH(state, EvapInletDryBulb, hTinwout, RoutineName, true);
3110 12555 : FullLoadOutAirTemp = PsyTdbFnHW(FullLoadOutAirEnth, FullLoadOutAirHumRat);
3111 : // Check for saturation error and modify temperature at constant enthalpy
3112 12555 : if (FullLoadOutAirTemp < PsyTsatFnHPb(state, FullLoadOutAirEnth, state.dataEnvrn->OutBaroPress, RoutineName)) {
3113 10863 : FullLoadOutAirTemp = PsyTsatFnHPb(state, FullLoadOutAirEnth, state.dataEnvrn->OutBaroPress, RoutineName);
3114 10863 : FullLoadOutAirHumRat = PsyWFnTdbH(state, FullLoadOutAirTemp, FullLoadOutAirEnth, RoutineName);
3115 : }
3116 :
3117 : // Continuous fan, cycling compressor
3118 12555 : EvapOutletAirEnthalpy = ((PartLoadRatio)*FullLoadOutAirEnth + (1.0 - (PartLoadRatio)) * EvapInletEnthalpy);
3119 12555 : EvapOutletAirHumRat = ((PartLoadRatio)*FullLoadOutAirHumRat + (1.0 - (PartLoadRatio)) * EvapInletHumRat);
3120 12555 : EvapOutletAirTemp = PsyTdbFnHW(EvapOutletAirEnthalpy, EvapOutletAirHumRat);
3121 12555 : if (EvapOutletAirTemp < PsyTsatFnHPb(state, EvapOutletAirEnthalpy, state.dataEnvrn->OutBaroPress, RoutineName)) {
3122 2028 : EvapOutletAirTemp = PsyTsatFnHPb(state, EvapOutletAirEnthalpy, state.dataEnvrn->OutBaroPress, RoutineName);
3123 2028 : EvapOutletAirHumRat = PsyWFnTdbH(state, EvapOutletAirTemp, EvapOutletAirEnthalpy, RoutineName);
3124 : }
3125 : // Calculate electricity consumed. First, get EIR modifying factors for off-rated conditions
3126 12555 : EIRTempModFac =
3127 25110 : CurveValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyEIRFTempCurve, EvapInletWetBulb, CondInletTemp);
3128 12555 : EIRTempModFac = max(EIRTempModFac, 0.0);
3129 12555 : EIRFlowModFac = CurveValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyEIRFFlowCurve, AirMassFlowRatio);
3130 12555 : EIRFlowModFac = max(EIRFlowModFac, 0.0);
3131 12555 : EIR = EIRTempModFac * EIRFlowModFac / state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingOnlyRatedCOP;
3132 :
3133 12555 : ElecCoolingPower = TotCap * EIR * RuntimeFraction;
3134 :
3135 12555 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).Temp = EvapOutletAirTemp;
3136 12555 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).HumRat = EvapOutletAirHumRat;
3137 12555 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).Enthalpy = EvapOutletAirEnthalpy;
3138 12555 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).MassFlowRate = EvapAirMassFlow;
3139 12555 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).MassFlowRateMinAvail =
3140 12555 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).MassFlowRateMinAvail;
3141 12555 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).MassFlowRateMaxAvail =
3142 12555 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).MassFlowRateMaxAvail;
3143 :
3144 : // determine condenser leaving conditions
3145 12555 : QdotCond = TotCap * RuntimeFraction + ElecCoolingPower;
3146 12555 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).MassFlowRate =
3147 12555 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserAirMassFlow;
3148 12555 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).MassFlowRate =
3149 12555 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserAirMassFlow;
3150 12555 : CondInletEnthalpy = PsyHFnTdbW(CondInletTemp, CondInletHumRat);
3151 12555 : CondOutletEnthalpy = CondInletEnthalpy + QdotCond / state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserAirMassFlow;
3152 12555 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).Temp =
3153 12555 : PsyTdbFnHW(CondOutletEnthalpy, CondInletHumRat);
3154 12555 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).HumRat = CondInletHumRat;
3155 12555 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).Enthalpy = CondOutletEnthalpy;
3156 :
3157 12555 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingPower =
3158 12555 : ElecCoolingPower + state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).AncillaryControlsPower;
3159 12555 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingEnergy =
3160 12555 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingPower * TimeStepSys * DataGlobalConstants::SecInHour;
3161 :
3162 12555 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RuntimeFraction = RuntimeFraction;
3163 12555 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserRuntimeFraction = RuntimeFraction;
3164 12555 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingRate = TotCap * RuntimeFraction; // double check this
3165 12555 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingEnergy =
3166 12555 : TotCap * RuntimeFraction * TimeStepSys * DataGlobalConstants::SecInHour;
3167 12555 : MinAirHumRat = min(state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).HumRat,
3168 12555 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).HumRat);
3169 12555 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingRate =
3170 12555 : EvapAirMassFlow * (PsyHFnTdbW(EvapInletDryBulb, MinAirHumRat) - PsyHFnTdbW(EvapOutletAirTemp, MinAirHumRat));
3171 25110 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingRate >
3172 12555 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingRate) {
3173 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingRate =
3174 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingRate;
3175 : }
3176 12555 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingEnergy =
3177 12555 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingRate * TimeStepSys * DataGlobalConstants::SecInHour;
3178 12555 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapLatCoolingRate =
3179 25110 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingRate -
3180 12555 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingRate;
3181 12555 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapLatCoolingEnergy =
3182 12555 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapLatCoolingRate * TimeStepSys * DataGlobalConstants::SecInHour;
3183 :
3184 : } else { // coil is off; just pass through conditions
3185 18389 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingPower =
3186 18389 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).AncillaryControlsPower;
3187 18389 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingEnergy =
3188 18389 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingPower * TimeStepSys * DataGlobalConstants::SecInHour;
3189 18389 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RuntimeFraction = 0.0;
3190 18389 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserRuntimeFraction = 0.0;
3191 18389 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).Temp =
3192 18389 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).Temp;
3193 18389 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).HumRat =
3194 18389 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).HumRat;
3195 18389 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).MassFlowRate =
3196 18389 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).MassFlowRate;
3197 18389 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).MassFlowRateMinAvail =
3198 18389 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).MassFlowRateMinAvail;
3199 18389 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).MassFlowRateMaxAvail =
3200 18389 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).MassFlowRateMaxAvail;
3201 18389 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).Enthalpy =
3202 18389 : PsyHFnTdbW(state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).Temp,
3203 18389 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).HumRat);
3204 :
3205 18389 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).Temp =
3206 18389 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).Temp;
3207 18389 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).HumRat =
3208 18389 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).HumRat;
3209 18389 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).MassFlowRate = 0.0;
3210 18389 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).MassFlowRate =
3211 18389 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).MassFlowRate;
3212 18389 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).Enthalpy =
3213 18389 : PsyHFnTdbW(state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).Temp,
3214 18389 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).HumRat);
3215 18389 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingRate = 0.0;
3216 18389 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingEnergy = 0.0;
3217 18389 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingRate = 0.0;
3218 18389 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingEnergy = 0.0;
3219 18389 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapLatCoolingRate = 0.0;
3220 18389 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapLatCoolingEnergy = 0.0;
3221 : }
3222 :
3223 30944 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotTES = 0.0;
3224 30944 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Q_TES = 0.0;
3225 :
3226 30944 : UpdateTEStorage(state, TESCoilNum);
3227 :
3228 30944 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondInletTemp = CondInletTemp;
3229 :
3230 30944 : UpdateColdWeatherProtection(state, TESCoilNum);
3231 :
3232 30944 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserType == TESCondenserType::Evap) {
3233 7709 : UpdateEvaporativeCondenserBasinHeater(state, TESCoilNum);
3234 7709 : UpdateEvaporativeCondenserWaterUse(
3235 7709 : state, TESCoilNum, CondInletHumRat, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum);
3236 : }
3237 30944 : }
3238 :
3239 14096 : void CalcTESCoilCoolingAndChargeMode(EnergyPlusData &state, int const TESCoilNum, [[maybe_unused]] int const FanOpMode, Real64 const PartLoadRatio)
3240 : {
3241 :
3242 : // SUBROUTINE INFORMATION:
3243 : // AUTHOR Brent Griffith
3244 : // DATE WRITTEN April 2013
3245 : // MODIFIED na
3246 : // RE-ENGINEERED na
3247 :
3248 : // Using/Aliasing
3249 : using Curve::CurveValue;
3250 14096 : auto &TimeStepSys = state.dataHVACGlobal->TimeStepSys;
3251 : using FluidProperties::GetDensityGlycol;
3252 : using FluidProperties::GetSpecificHeatGlycol;
3253 :
3254 : // SUBROUTINE PARAMETER DEFINITIONS:
3255 14096 : int constexpr MaxIter(30);
3256 14096 : Real64 constexpr RelaxationFactor(0.4);
3257 14096 : Real64 constexpr Tolerance(0.1);
3258 : static constexpr std::string_view RoutineName("CalcTESCoilCoolingAndChargeMode");
3259 :
3260 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
3261 : Real64 CondInletTemp; // Condenser inlet temperature (C). Outdoor dry-bulb temp for air-cooled condenser.
3262 : // Outdoor Wetbulb +(1 - effectiveness)*(outdoor drybulb - outdoor wetbulb) for evap condenser.
3263 : Real64 CondInletHumRat; // Condenser inlet humidity ratio (kg/kg). Zero for air-cooled condenser.
3264 : // For evap condenser, its the humidity ratio of the air leaving the evap cooling pads.
3265 : Real64 CondAirMassFlow; // Condenser air mass flow rate [kg/s]
3266 : Real64 CondInletEnthalpy; // condenser inlet enthalpy [J/kg]
3267 : Real64 CondAirSidePressure; // Outdoor barometric pressure at condenser (Pa)
3268 : Real64 QdotCond; // condenser total heat rejection rate [W]
3269 : Real64 CondOutletEnthalpy; // condesner outlet enthalpy [J/kg]
3270 : Real64 OutdoorDryBulb; // outdoor air dry bulb local variable [C]
3271 : Real64 OutdoorHumRat; // outdoor air humidity ratio local [kg/kg]
3272 : Real64 OutdoorWetBulb; // outdoor air wetbulb local [C]
3273 : Real64 EvapAirMassFlow; // local for evaporator air mass flow [kg/s]
3274 : Real64 EvapInletDryBulb; // evaporator inlet air drybulb [C]
3275 : Real64 EvapInletHumRat; // evaporator inlet air humidity ratio [kg/kg]
3276 : Real64 EvapInletWetBulb; // evaporator inlet air wetbulb [C]
3277 : Real64 EvapInletEnthalpy; // evaporator inlet air enthalpy [J/kg]
3278 : Real64 AirMassFlowRatio; // evaporator inlet air mass flow divided by design mass flow [ ]
3279 : Real64 EvapTotCapTempModFac; // total coolin capacity modification factor due to temps []
3280 : Real64 EvapTotCapFlowModFac; // Total cooling capacity modification factor due to flow []
3281 : Real64 EvapTotCap; // total cooling capacity
3282 14096 : Real64 SHRTempFac(0.0); // sensible heat ratio modification factor due to temps []
3283 : Real64 SHRFlowFac; // sensible heat ratio modification factor due to flow []
3284 : Real64 SHR; // sensible heat ratio
3285 : Real64 PLF; // part load factor
3286 : Real64 EvapRuntimeFraction; // compressor running time divided by full time of timestep.
3287 : Real64 FullLoadOutAirEnth; // evaporator outlet full load enthalpy [J/kg]
3288 : Real64 hTinwout; // Enthalpy at inlet dry-bulb and outlet humidity ratio [J/kg]
3289 : Real64 FullLoadOutAirHumRat; // evaporator outlet humidity ratio at full load
3290 : Real64 FullLoadOutAirTemp; // evaporator outlet air temperature at full load [C]
3291 : Real64 EvapOutletAirEnthalpy; // evaporator outlet air enthalpy [J/kg]
3292 : Real64 EvapOutletAirHumRat; // evaporator outlet air humidity ratio [kg/kg]
3293 : Real64 EvapOutletAirTemp; // evaporator outlet drybulb [C]
3294 : Real64 EIRTempModFac; // energy input ratio modification factor due to temperatures []
3295 : Real64 EIRFlowModFac; // energy input ratio modification factor due to flow []
3296 : Real64 EIR; // energy input ratio
3297 : Real64 EvapElecCoolingPower; // compressor electric power
3298 : Real64 MinAirHumRat; // minimum air humidity ratio
3299 : Real64 sTES; // stat of Thermal energy storage [C or fraction of ice]
3300 : bool TESCanBeCharged;
3301 : Real64 rho;
3302 : Real64 TankMass; // Mass of fluid in tank (kg)
3303 : Real64 CpTank; // Specific heat of water in tank (J/kg K)
3304 : Real64 QdotChargeLimit; // limit for charge cooling power to hit limit of storage.
3305 : Real64 ChargeCapModFac;
3306 : Real64 ChargeCapPLRModFac;
3307 : Real64 TotChargeCap;
3308 : Real64 ChargeEIRTempModFac;
3309 : Real64 ChargeEIRFlowModFac;
3310 : Real64 ChargeEIR;
3311 : Real64 ChargeElectricCoolingPower;
3312 : Real64 ChargeRuntimeFraction;
3313 : Real64 PartLoadOutAirEnth; // local leaving enthalpy at part load
3314 : Real64 PartLoadDryCoilOutAirTemp; // local leaving drybulb if coil were dry
3315 : bool CoilMightBeDry;
3316 : int Counter;
3317 : bool Converged;
3318 : Real64 DryCoilTestEvapInletHumRat;
3319 : Real64 DryCoilTestEvapInletWetBulb;
3320 : Real64 hADP;
3321 : Real64 tADP;
3322 : Real64 wADP;
3323 : Real64 hTinwADP;
3324 : Real64 SHRadp;
3325 : Real64 werror;
3326 :
3327 : // first deal with condenser
3328 14096 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserType == TESCondenserType::Air) {
3329 11807 : CondAirSidePressure = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).Press;
3330 11807 : if (CondAirSidePressure == state.dataLoopNodes->DefaultNodeValues.Press) {
3331 0 : CondInletTemp = state.dataEnvrn->OutDryBulbTemp;
3332 0 : CondInletHumRat = state.dataEnvrn->OutHumRat;
3333 0 : CondAirSidePressure = state.dataEnvrn->OutBaroPress;
3334 : } else {
3335 11807 : CondInletTemp = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).Temp;
3336 11807 : CondInletHumRat = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).HumRat;
3337 : }
3338 11807 : CondAirMassFlow = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserAirMassFlow;
3339 2289 : } else if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserType == TESCondenserType::Evap) {
3340 2289 : CondAirSidePressure = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).Press;
3341 2289 : if (CondAirSidePressure == state.dataLoopNodes->DefaultNodeValues.Press) {
3342 0 : OutdoorDryBulb = state.dataEnvrn->OutDryBulbTemp;
3343 0 : OutdoorHumRat = state.dataEnvrn->OutHumRat;
3344 0 : CondAirSidePressure = state.dataEnvrn->OutBaroPress;
3345 0 : OutdoorWetBulb = state.dataEnvrn->OutWetBulbTemp;
3346 : } else {
3347 2289 : OutdoorDryBulb = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).Temp;
3348 2289 : OutdoorHumRat = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).HumRat;
3349 2289 : OutdoorWetBulb = PsyTwbFnTdbWPb(state, OutdoorDryBulb, OutdoorHumRat, CondAirSidePressure, RoutineName);
3350 : }
3351 2289 : CondAirMassFlow = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserAirMassFlow;
3352 : // direct evap cool model
3353 2289 : CondInletTemp =
3354 2289 : OutdoorWetBulb + (OutdoorDryBulb - OutdoorWetBulb) * (1.0 - state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapCondEffect);
3355 2289 : CondInletHumRat = PsyWFnTdbTwbPb(state, CondInletTemp, OutdoorWetBulb, CondAirSidePressure, RoutineName);
3356 : }
3357 :
3358 14096 : EvapAirMassFlow = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).MassFlowRate;
3359 14096 : EvapInletDryBulb = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).Temp;
3360 14096 : EvapInletHumRat = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).HumRat;
3361 14096 : EvapInletWetBulb = PsyTwbFnTdbWPb(state, EvapInletDryBulb, EvapInletHumRat, state.dataEnvrn->OutBaroPress, RoutineName);
3362 14096 : EvapInletEnthalpy = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).Enthalpy;
3363 14096 : CoilMightBeDry = false;
3364 :
3365 14096 : switch (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageMedia) {
3366 10098 : case MediaType::Water:
3367 : case MediaType::UserDefindFluid:
3368 10098 : sTES = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).FluidTankTempFinalLastTimestep;
3369 20196 : if ((sTES > state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).MinimumFluidTankTempLimit) &&
3370 10098 : (sTES < state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).MaximumFluidTankTempLimit)) {
3371 10098 : TESCanBeCharged = true;
3372 : // find charge limit to reach limits
3373 20196 : rho = GetDensityGlycol(state,
3374 10098 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageFluidName,
3375 : sTES,
3376 10098 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageFluidIndex,
3377 : RoutineName);
3378 10098 : TankMass = rho * state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).FluidStorageVolume;
3379 20196 : CpTank = GetSpecificHeatGlycol(state,
3380 10098 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageFluidName,
3381 : sTES,
3382 10098 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageFluidIndex,
3383 : RoutineName);
3384 : // simple linear approximation of DT/Dt term in McpDT/Dt
3385 20196 : QdotChargeLimit = TankMass * CpTank * (sTES - state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).MinimumFluidTankTempLimit) /
3386 10098 : (TimeStepSys * DataGlobalConstants::SecInHour);
3387 : } else {
3388 0 : TESCanBeCharged = false;
3389 : }
3390 10098 : break;
3391 3998 : case MediaType::Ice:
3392 3998 : sTES = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).IceFracRemainLastTimestep;
3393 3998 : if (sTES < 1.0) {
3394 3998 : TESCanBeCharged = true;
3395 : // find charge limit to reach limit
3396 7996 : QdotChargeLimit = (1.0 - sTES) * state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).IceStorageCapacity /
3397 3998 : (TimeStepSys * DataGlobalConstants::SecInHour);
3398 : } else {
3399 0 : TESCanBeCharged = false;
3400 : }
3401 3998 : break;
3402 0 : default:
3403 0 : break;
3404 : }
3405 :
3406 14096 : if ((EvapAirMassFlow > SmallMassFlow) && (PartLoadRatio > 0.0)) { // coil is running
3407 :
3408 5178 : AirMassFlowRatio = EvapAirMassFlow / state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RatedEvapAirMassFlowRate;
3409 10356 : EvapTotCapTempModFac = CurveValue(state,
3410 5178 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeCoolingCapFTempCurve,
3411 : EvapInletWetBulb,
3412 : CondInletTemp,
3413 : sTES);
3414 5178 : EvapTotCapTempModFac = max(0.0, EvapTotCapTempModFac); // could warn if negative, DXcoil does
3415 5178 : EvapTotCapFlowModFac =
3416 10356 : CurveValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeCoolingCapFFlowCurve, AirMassFlowRatio);
3417 5178 : EvapTotCapFlowModFac = max(0.0, EvapTotCapFlowModFac); // could warn if negative, DXcoil does
3418 5178 : EvapTotCap =
3419 5178 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeRatedTotCap * EvapTotCapTempModFac * EvapTotCapFlowModFac;
3420 : // now see if coil is running dry
3421 5178 : PartLoadOutAirEnth = EvapInletEnthalpy - (EvapTotCap * PartLoadRatio) / EvapAirMassFlow;
3422 5178 : PartLoadDryCoilOutAirTemp = PsyTdbFnHW(PartLoadOutAirEnth, EvapInletHumRat);
3423 5178 : if (PartLoadDryCoilOutAirTemp > PsyTsatFnHPb(state, PartLoadOutAirEnth, state.dataEnvrn->OutBaroPress, RoutineName)) {
3424 4 : CoilMightBeDry = true;
3425 : // find wADP, humidity ratio at apparatus dewpoint and inlet hum rat that would have dry coil
3426 4 : DryCoilTestEvapInletHumRat = EvapInletHumRat;
3427 4 : DryCoilTestEvapInletWetBulb = EvapInletWetBulb;
3428 4 : Counter = 0;
3429 4 : Converged = false;
3430 12 : while (!Converged) {
3431 8 : EvapTotCapTempModFac = CurveValue(state,
3432 4 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeCoolingCapFTempCurve,
3433 : DryCoilTestEvapInletWetBulb,
3434 : CondInletTemp,
3435 : sTES);
3436 4 : EvapTotCapTempModFac = max(0.0, EvapTotCapTempModFac); // could warn if negative, DXcoil does
3437 8 : EvapTotCapFlowModFac = CurveValue(
3438 4 : state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeCoolingCapFFlowCurve, AirMassFlowRatio);
3439 4 : EvapTotCapFlowModFac = max(0.0, EvapTotCapFlowModFac); // could warn if negative, DXcoil does
3440 4 : EvapTotCap = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeRatedTotCap * EvapTotCapTempModFac *
3441 : EvapTotCapFlowModFac;
3442 : // coil bypass factor = 0.0
3443 4 : hADP = EvapInletEnthalpy - (EvapTotCap / EvapAirMassFlow);
3444 4 : tADP = PsyTsatFnHPb(state, hADP, state.dataEnvrn->OutBaroPress, RoutineName);
3445 4 : wADP = min(EvapInletHumRat, PsyWFnTdbH(state, tADP, hADP, RoutineName));
3446 4 : hTinwADP = PsyHFnTdbW(EvapInletDryBulb, wADP);
3447 4 : if ((EvapInletEnthalpy - hADP) > 1.e-10) {
3448 4 : SHRadp = min((hTinwADP - hADP) / (EvapInletEnthalpy - hADP), 1.0);
3449 : } else {
3450 0 : SHRadp = 1.0;
3451 : }
3452 :
3453 4 : if ((wADP > DryCoilTestEvapInletHumRat) || (Counter >= 1 && Counter < MaxIter)) {
3454 0 : if (DryCoilTestEvapInletHumRat <= 0.0) DryCoilTestEvapInletHumRat = 0.00001;
3455 0 : werror = (DryCoilTestEvapInletHumRat - wADP) / DryCoilTestEvapInletHumRat;
3456 :
3457 0 : DryCoilTestEvapInletHumRat = RelaxationFactor * wADP + (1.0 - RelaxationFactor) * DryCoilTestEvapInletHumRat;
3458 0 : DryCoilTestEvapInletWetBulb =
3459 0 : PsyTwbFnTdbWPb(state, EvapInletDryBulb, DryCoilTestEvapInletHumRat, state.dataEnvrn->OutBaroPress, RoutineName);
3460 :
3461 0 : ++Counter;
3462 0 : if (std::abs(werror) <= Tolerance) {
3463 0 : Converged = true;
3464 : } else {
3465 0 : Converged = false;
3466 : }
3467 : } else {
3468 4 : Converged = true;
3469 : }
3470 : }
3471 : }
3472 : {
3473 5178 : if (state.dataCurveManager->PerfCurve(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeSHRFTempCurve).numDims ==
3474 : 2) {
3475 1766 : SHRTempFac = CurveValue(state,
3476 883 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeSHRFTempCurve,
3477 : EvapInletWetBulb,
3478 : EvapInletDryBulb);
3479 : } else {
3480 8590 : SHRTempFac = CurveValue(state,
3481 4295 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeSHRFTempCurve,
3482 : EvapInletWetBulb,
3483 : EvapInletDryBulb,
3484 : sTES);
3485 : }
3486 : }
3487 5178 : SHRFlowFac = CurveValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeSHRFFlowCurve, AirMassFlowRatio);
3488 5178 : SHR = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeRatedSHR * SHRTempFac * SHRFlowFac;
3489 5178 : SHR = min(SHR, 1.0); // warn maybe
3490 5178 : SHR = max(SHR, 0.0); // warn maybe
3491 5178 : if (CoilMightBeDry) {
3492 4 : if ((EvapInletHumRat < DryCoilTestEvapInletHumRat) && (SHRadp > SHR)) { // coil is dry for sure
3493 0 : SHR = 1.0;
3494 4 : } else if (SHRadp > SHR) {
3495 4 : SHR = SHRadp;
3496 : }
3497 : }
3498 5178 : PLF = CurveValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeCoolingPLFFPLRCurve, PartLoadRatio);
3499 5178 : if (PLF >= PartLoadRatio && PLF > 0.0) {
3500 2996 : EvapRuntimeFraction = PartLoadRatio / PLF;
3501 : } else {
3502 2182 : EvapRuntimeFraction = 1.0; // warn maybe
3503 : }
3504 :
3505 : // Calculate electricity consumed. First, get EIR modifying factors for off-rated conditions
3506 10356 : EIRTempModFac = CurveValue(state,
3507 5178 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeCoolingEIRFTempCurve,
3508 : EvapInletWetBulb,
3509 : CondInletTemp,
3510 : sTES);
3511 5178 : EIRTempModFac = max(EIRTempModFac, 0.0);
3512 5178 : EIRFlowModFac =
3513 10356 : CurveValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeCoolingEIRFFlowCurve, AirMassFlowRatio);
3514 5178 : EIRFlowModFac = max(EIRFlowModFac, 0.0);
3515 5178 : EIR = EIRTempModFac * EIRFlowModFac / state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeCoolingRatedCOP;
3516 :
3517 5178 : EvapElecCoolingPower = EvapTotCap * EIR * EvapRuntimeFraction;
3518 :
3519 5178 : if (TESCanBeCharged) {
3520 10356 : ChargeCapModFac = CurveValue(state,
3521 5178 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeChargingCapFTempCurve,
3522 : EvapInletWetBulb,
3523 : CondInletTemp,
3524 : sTES);
3525 5178 : ChargeCapModFac = max(0.0, ChargeCapModFac);
3526 :
3527 5178 : ChargeCapPLRModFac =
3528 10356 : CurveValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeChargingCapFEvapPLRCurve, PartLoadRatio);
3529 5178 : ChargeCapPLRModFac = max(0.0, ChargeCapPLRModFac);
3530 :
3531 5178 : TotChargeCap =
3532 5178 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeRatedChargeCap * ChargeCapModFac * ChargeCapPLRModFac;
3533 5178 : if (TotChargeCap > QdotChargeLimit) {
3534 0 : ChargeRuntimeFraction = QdotChargeLimit / TotChargeCap;
3535 0 : TotChargeCap = min(TotChargeCap, QdotChargeLimit);
3536 : } else {
3537 5178 : ChargeRuntimeFraction = 1.0;
3538 : }
3539 10356 : ChargeEIRTempModFac = CurveValue(state,
3540 5178 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeChargingEIRFTempCurve,
3541 : EvapInletWetBulb,
3542 : CondInletTemp,
3543 : sTES);
3544 5178 : ChargeEIRTempModFac = max(0.0, ChargeEIRTempModFac);
3545 5178 : ChargeEIRFlowModFac =
3546 10356 : CurveValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeChargingEIRFFLowCurve, AirMassFlowRatio);
3547 5178 : ChargeEIRFlowModFac = max(0.0, ChargeEIRFlowModFac);
3548 10356 : ChargeEIR = (ChargeEIRTempModFac * ChargeEIRFlowModFac) /
3549 5178 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeChargingRatedCOP;
3550 5178 : ChargeElectricCoolingPower = TotChargeCap * ChargeEIR;
3551 5178 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotTES = -TotChargeCap;
3552 : } else {
3553 0 : TotChargeCap = 0.0;
3554 0 : ChargeElectricCoolingPower = 0.0;
3555 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotTES = 0.0;
3556 0 : ChargeRuntimeFraction = 0.0;
3557 : }
3558 :
3559 : // Calculate full load output conditions
3560 5178 : FullLoadOutAirEnth = EvapInletEnthalpy - EvapTotCap / EvapAirMassFlow;
3561 :
3562 5178 : hTinwout = EvapInletEnthalpy - (1.0 - SHR) * (EvapTotCap / EvapAirMassFlow);
3563 : // The following will often throw psych warnings for neg w, suppress warnings because error condition is handled in next IF
3564 5178 : FullLoadOutAirHumRat = PsyWFnTdbH(state, EvapInletDryBulb, hTinwout, RoutineName, true);
3565 5178 : FullLoadOutAirTemp = PsyTdbFnHW(FullLoadOutAirEnth, FullLoadOutAirHumRat);
3566 : // Check for saturation error and modify temperature at constant enthalpy
3567 5178 : if (FullLoadOutAirTemp < PsyTsatFnHPb(state, FullLoadOutAirEnth, state.dataEnvrn->OutBaroPress, RoutineName)) {
3568 5174 : FullLoadOutAirTemp = PsyTsatFnHPb(state, FullLoadOutAirEnth, state.dataEnvrn->OutBaroPress, RoutineName);
3569 5174 : FullLoadOutAirHumRat = PsyWFnTdbH(state, FullLoadOutAirTemp, FullLoadOutAirEnth, RoutineName);
3570 : }
3571 :
3572 : // Continuous fan, cycling compressor
3573 5178 : EvapOutletAirEnthalpy = ((PartLoadRatio)*FullLoadOutAirEnth + (1.0 - (PartLoadRatio)) * EvapInletEnthalpy);
3574 5178 : EvapOutletAirHumRat = ((PartLoadRatio)*FullLoadOutAirHumRat + (1.0 - (PartLoadRatio)) * EvapInletHumRat);
3575 5178 : EvapOutletAirTemp = PsyTdbFnHW(EvapOutletAirEnthalpy, EvapOutletAirHumRat);
3576 5178 : if (EvapOutletAirTemp < PsyTsatFnHPb(state, EvapOutletAirEnthalpy, state.dataEnvrn->OutBaroPress, RoutineName)) {
3577 901 : EvapOutletAirTemp = PsyTsatFnHPb(state, EvapOutletAirEnthalpy, state.dataEnvrn->OutBaroPress, RoutineName);
3578 901 : EvapOutletAirHumRat = PsyWFnTdbH(state, EvapOutletAirTemp, EvapOutletAirEnthalpy, RoutineName);
3579 : }
3580 :
3581 5178 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).Temp = EvapOutletAirTemp;
3582 5178 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).HumRat = EvapOutletAirHumRat;
3583 5178 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).Enthalpy = EvapOutletAirEnthalpy;
3584 5178 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).MassFlowRate = EvapAirMassFlow;
3585 5178 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).MassFlowRateMinAvail =
3586 5178 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).MassFlowRateMinAvail;
3587 5178 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).MassFlowRateMaxAvail =
3588 5178 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).MassFlowRateMaxAvail;
3589 :
3590 : // determine condenser leaving conditions
3591 5178 : QdotCond = EvapTotCap * EvapRuntimeFraction + EvapElecCoolingPower + TotChargeCap + ChargeElectricCoolingPower;
3592 5178 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).MassFlowRate =
3593 5178 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserAirMassFlow;
3594 5178 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).MassFlowRate =
3595 5178 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserAirMassFlow;
3596 5178 : CondInletEnthalpy = PsyHFnTdbW(CondInletTemp, CondInletHumRat);
3597 5178 : CondOutletEnthalpy = CondInletEnthalpy + QdotCond / state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserAirMassFlow;
3598 5178 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).Temp =
3599 5178 : PsyTdbFnHW(CondOutletEnthalpy, CondInletHumRat);
3600 5178 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).HumRat = CondInletHumRat;
3601 5178 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).Enthalpy = CondOutletEnthalpy;
3602 :
3603 5178 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingPower =
3604 5178 : EvapElecCoolingPower + ChargeElectricCoolingPower + state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).AncillaryControlsPower;
3605 5178 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingEnergy =
3606 5178 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingPower * TimeStepSys * DataGlobalConstants::SecInHour;
3607 :
3608 5178 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RuntimeFraction = EvapRuntimeFraction;
3609 5178 : if (ChargeRuntimeFraction > 0.0) {
3610 5178 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserRuntimeFraction = max(ChargeRuntimeFraction, EvapRuntimeFraction);
3611 : } else {
3612 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserRuntimeFraction = EvapRuntimeFraction;
3613 : }
3614 :
3615 5178 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingRate = EvapTotCap * EvapRuntimeFraction; // double check this
3616 5178 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingEnergy =
3617 5178 : EvapTotCap * EvapRuntimeFraction * TimeStepSys * DataGlobalConstants::SecInHour;
3618 5178 : MinAirHumRat = min(state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).HumRat,
3619 5178 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).HumRat);
3620 5178 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingRate =
3621 5178 : EvapAirMassFlow * (PsyHFnTdbW(EvapInletDryBulb, MinAirHumRat) - PsyHFnTdbW(EvapOutletAirTemp, MinAirHumRat));
3622 10356 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingRate >
3623 5178 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingRate) {
3624 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingRate =
3625 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingRate;
3626 : }
3627 5178 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingEnergy =
3628 5178 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingRate * TimeStepSys * DataGlobalConstants::SecInHour;
3629 5178 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapLatCoolingRate =
3630 10356 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingRate -
3631 5178 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingRate;
3632 5178 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapLatCoolingEnergy =
3633 5178 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapLatCoolingRate * TimeStepSys * DataGlobalConstants::SecInHour;
3634 :
3635 : } else { // Evap off, but may still charge
3636 8918 : if (TESCanBeCharged) { // coil is running to charge but not to cool at evaporator
3637 8918 : AirMassFlowRatio = EvapAirMassFlow / state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RatedEvapAirMassFlowRate;
3638 17836 : ChargeCapModFac = CurveValue(state,
3639 8918 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeChargingCapFTempCurve,
3640 : EvapInletWetBulb,
3641 : CondInletTemp,
3642 : sTES);
3643 8918 : ChargeCapModFac = max(0.0, ChargeCapModFac);
3644 :
3645 8918 : ChargeCapPLRModFac =
3646 17836 : CurveValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeChargingCapFEvapPLRCurve, PartLoadRatio);
3647 8918 : ChargeCapPLRModFac = max(0.0, ChargeCapPLRModFac);
3648 :
3649 8918 : TotChargeCap =
3650 8918 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeRatedChargeCap * ChargeCapModFac * ChargeCapPLRModFac;
3651 8918 : if (TotChargeCap > QdotChargeLimit) {
3652 4 : ChargeRuntimeFraction = QdotChargeLimit / TotChargeCap;
3653 4 : TotChargeCap = min(TotChargeCap, QdotChargeLimit);
3654 : } else {
3655 8914 : ChargeRuntimeFraction = 1.0;
3656 : }
3657 17836 : ChargeEIRTempModFac = CurveValue(state,
3658 8918 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeChargingEIRFTempCurve,
3659 : EvapInletWetBulb,
3660 : CondInletTemp,
3661 : sTES);
3662 8918 : ChargeEIRTempModFac = max(0.0, ChargeEIRTempModFac);
3663 8918 : ChargeEIRFlowModFac =
3664 17836 : CurveValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeChargingEIRFFLowCurve, AirMassFlowRatio);
3665 8918 : ChargeEIRFlowModFac = max(0.0, ChargeEIRFlowModFac);
3666 17836 : ChargeEIR = (ChargeEIRTempModFac * ChargeEIRFlowModFac) /
3667 8918 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndChargeChargingRatedCOP;
3668 8918 : ChargeElectricCoolingPower = TotChargeCap * ChargeEIR;
3669 8918 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotTES = -TotChargeCap;
3670 : } else {
3671 0 : TotChargeCap = 0.0;
3672 0 : ChargeElectricCoolingPower = 0.0;
3673 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotTES = 0.0;
3674 0 : ChargeRuntimeFraction = 0.0;
3675 : }
3676 :
3677 8918 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingPower =
3678 8918 : ChargeElectricCoolingPower + state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).AncillaryControlsPower;
3679 8918 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingEnergy =
3680 8918 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingPower * TimeStepSys * DataGlobalConstants::SecInHour;
3681 :
3682 8918 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RuntimeFraction = 0.0;
3683 8918 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).Temp =
3684 8918 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).Temp;
3685 8918 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).HumRat =
3686 8918 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).HumRat;
3687 8918 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).MassFlowRate =
3688 8918 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).MassFlowRate;
3689 8918 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).MassFlowRateMinAvail =
3690 8918 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).MassFlowRateMinAvail;
3691 8918 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).MassFlowRateMaxAvail =
3692 8918 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).MassFlowRateMaxAvail;
3693 8918 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).Enthalpy =
3694 8918 : PsyHFnTdbW(state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).Temp,
3695 8918 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).HumRat);
3696 :
3697 8918 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingRate = 0.0;
3698 8918 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingEnergy = 0.0;
3699 8918 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingRate = 0.0;
3700 8918 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingEnergy = 0.0;
3701 8918 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapLatCoolingRate = 0.0;
3702 8918 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapLatCoolingEnergy = 0.0;
3703 :
3704 8918 : if (TotChargeCap == 0.0) {
3705 0 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).Temp =
3706 0 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).Temp;
3707 0 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).HumRat =
3708 0 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).HumRat;
3709 0 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).MassFlowRate = 0.0;
3710 0 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).MassFlowRate =
3711 0 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).MassFlowRate;
3712 0 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).Enthalpy =
3713 0 : PsyHFnTdbW(state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).Temp,
3714 0 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).HumRat);
3715 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserRuntimeFraction = 0.0;
3716 : } else {
3717 :
3718 : // determine condenser leaving conditions
3719 8918 : QdotCond = TotChargeCap + ChargeElectricCoolingPower;
3720 8918 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).MassFlowRate =
3721 8918 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserAirMassFlow;
3722 8918 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).MassFlowRate =
3723 8918 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserAirMassFlow;
3724 8918 : CondInletEnthalpy = PsyHFnTdbW(CondInletTemp, CondInletHumRat);
3725 8918 : CondOutletEnthalpy = CondInletEnthalpy + QdotCond / state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserAirMassFlow;
3726 8918 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).Temp =
3727 8918 : PsyTdbFnHW(CondOutletEnthalpy, CondInletHumRat);
3728 8918 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).HumRat = CondInletHumRat;
3729 8918 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).Enthalpy = CondOutletEnthalpy;
3730 8918 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserRuntimeFraction = 1.0;
3731 : }
3732 : }
3733 :
3734 14096 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotTES = -TotChargeCap;
3735 14096 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Q_TES =
3736 14096 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotTES * TimeStepSys * DataGlobalConstants::SecInHour;
3737 :
3738 14096 : UpdateTEStorage(state, TESCoilNum);
3739 :
3740 14096 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondInletTemp = CondInletTemp;
3741 :
3742 14096 : UpdateColdWeatherProtection(state, TESCoilNum);
3743 :
3744 14096 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserType == TESCondenserType::Evap) {
3745 2289 : UpdateEvaporativeCondenserBasinHeater(state, TESCoilNum);
3746 2289 : UpdateEvaporativeCondenserWaterUse(
3747 2289 : state, TESCoilNum, CondInletHumRat, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum);
3748 : }
3749 14096 : }
3750 :
3751 2394 : void CalcTESCoilCoolingAndDischargeMode(EnergyPlusData &state, int const TESCoilNum, [[maybe_unused]] int const FanOpMode, Real64 const PartLoadRatio)
3752 : {
3753 :
3754 : // SUBROUTINE INFORMATION:
3755 : // AUTHOR Brent Griffith
3756 : // DATE WRITTEN April 2013
3757 : // MODIFIED na
3758 : // RE-ENGINEERED na
3759 :
3760 : // Using/Aliasing
3761 : using Curve::CurveValue;
3762 2394 : auto &TimeStepSys = state.dataHVACGlobal->TimeStepSys;
3763 : using FluidProperties::GetDensityGlycol;
3764 : using FluidProperties::GetSpecificHeatGlycol;
3765 :
3766 : // SUBROUTINE PARAMETER DEFINITIONS:
3767 2394 : int constexpr MaxIter(30);
3768 2394 : Real64 constexpr RelaxationFactor(0.4);
3769 2394 : Real64 constexpr Tolerance(0.1);
3770 : static constexpr std::string_view RoutineName("CalcTESCoilCoolingAndDischargeMode");
3771 :
3772 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
3773 : Real64 CondInletTemp; // Condenser inlet temperature (C). Outdoor dry-bulb temp for air-cooled condenser.
3774 : // Outdoor Wetbulb +(1 - effectiveness)*(outdoor drybulb - outdoor wetbulb) for evap condenser.
3775 : Real64 CondInletHumRat; // Condenser inlet humidity ratio (kg/kg). Zero for air-cooled condenser.
3776 : // For evap condenser, its the humidity ratio of the air leaving the evap cooling pads.
3777 : Real64 CondAirMassFlow; // Condenser air mass flow rate [kg/s]
3778 : Real64 CondInletEnthalpy; // condenser inlet enthalpy [J/kg]
3779 : Real64 CondAirSidePressure; // Outdoor barometric pressure at condenser (Pa)
3780 : Real64 CondOutletEnthalpy; // condesner outlet enthalpy [J/kg]
3781 : Real64 OutdoorDryBulb; // outdoor air dry bulb local variable [C]
3782 : Real64 OutdoorHumRat; // outdoor air humidity ratio local [kg/kg]
3783 : Real64 OutdoorWetBulb; // outdoor air wetbulb local [C]
3784 : Real64 EvapAirMassFlow; // local for evaporator air mass flow [kg/s]
3785 : Real64 EvapInletDryBulb; // evaporator inlet air drybulb [C]
3786 : Real64 EvapInletHumRat; // evaporator inlet air humidity ratio [kg/kg]
3787 : Real64 EvapInletWetBulb; // evaporator inlet air wetbulb [C]
3788 : Real64 EvapInletEnthalpy; // evaporator inlet air enthalpy [J/kg]
3789 : Real64 sTES; // stat of Thermal energy storage [C or fraction of ice]
3790 : bool TESHasSomeCharge; // some charge available for discharge
3791 : Real64 rho;
3792 : Real64 TankMass; // Mass of fluid in tank (kg)
3793 : Real64 CpTank; // Specific heat of water in tank (J/kg K)
3794 : Real64 QdotDischargeLimit; // limit for charge cooling power to hit limit of storage.
3795 : Real64 AirMassFlowRatio; // evaporator inlet air mass flow divided by design mass flow [ ]
3796 : Real64 EvapTotCapTempModFac; // total coolin capacity modification factor due to temps []
3797 : Real64 EvapTotCapFlowModFac; // Total cooling capacity modification factor due to flow []
3798 : Real64 EvapTotCap; // total cooling capacity
3799 2394 : Real64 SHRTempFac(0.0); // sensible heat ratio modification factor due to temps []
3800 : Real64 SHRFlowFac; // sensible heat ratio modification factor due to flow []
3801 : Real64 SHR; // sensible heat ratio
3802 : Real64 PLF; // part load factor
3803 : Real64 EvapRuntimeFraction; // compressor running time divided by full time of timestep.
3804 : Real64 EIRTempModFac; // energy input ratio modification factor due to temperatures []
3805 : Real64 EIRFlowModFac; // energy input ratio modification factor due to flow []
3806 : Real64 EIR; // energy input ratio
3807 : Real64 DischargePLF;
3808 : Real64 DischargeRuntimeFraction;
3809 : Real64 TotDischargeCap;
3810 : Real64 DischargeCapTempModFac;
3811 : Real64 DischargeCapFlowModFac;
3812 : Real64 DischargeEIRTempModFac;
3813 : Real64 DischargeEIRFlowModFac;
3814 : Real64 DischargeEIR;
3815 : Real64 EvapElecCoolingPower; // compressor electric power
3816 : Real64 DischargeElectricCoolingPower;
3817 : Real64 TotCap;
3818 : Real64 FullLoadOutAirEnth; // evaporator outlet full load enthalpy [J/kg]
3819 : Real64 hTinwout; // Enthalpy at inlet dry-bulb and outlet humidity ratio [J/kg]
3820 : Real64 FullLoadOutAirHumRat; // evaporator outlet humidity ratio at full load
3821 : Real64 FullLoadOutAirTemp; // evaporator outlet air temperature at full load [C]
3822 : Real64 EvapOutletAirEnthalpy; // evaporator outlet air enthalpy [J/kg]
3823 : Real64 EvapOutletAirHumRat; // evaporator outlet air humidity ratio [kg/kg]
3824 : Real64 EvapOutletAirTemp; // evaporator outlet drybulb [C]
3825 : Real64 QdotCond; // heat rejection rate at condenser [W]
3826 : Real64 MinAirHumRat; // minimum air humidity ratio
3827 : Real64 PartLoadOutAirEnth; // local leaving enthalpy at part load
3828 : Real64 PartLoadDryCoilOutAirTemp; // local leaving drybulb if coil were dry
3829 : bool CoilMightBeDry;
3830 : int Counter;
3831 : bool Converged;
3832 : Real64 DryCoilTestEvapInletHumRat;
3833 : Real64 DryCoilTestEvapInletWetBulb;
3834 : Real64 hADP;
3835 : Real64 tADP;
3836 : Real64 wADP;
3837 : Real64 hTinwADP;
3838 : Real64 SHRadp;
3839 : Real64 werror;
3840 :
3841 : // first deal with condenser
3842 2394 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserType == TESCondenserType::Air) {
3843 2394 : CondAirSidePressure = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).Press;
3844 2394 : if (CondAirSidePressure == state.dataLoopNodes->DefaultNodeValues.Press) {
3845 0 : CondInletTemp = state.dataEnvrn->OutDryBulbTemp;
3846 0 : CondInletHumRat = state.dataEnvrn->OutHumRat;
3847 0 : CondAirSidePressure = state.dataEnvrn->OutBaroPress;
3848 : } else {
3849 2394 : CondInletTemp = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).Temp;
3850 2394 : CondInletHumRat = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).HumRat;
3851 : }
3852 2394 : CondAirMassFlow = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserAirMassFlow;
3853 0 : } else if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserType == TESCondenserType::Evap) {
3854 0 : CondAirSidePressure = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).Press;
3855 0 : if (CondAirSidePressure == state.dataLoopNodes->DefaultNodeValues.Press) {
3856 0 : OutdoorDryBulb = state.dataEnvrn->OutDryBulbTemp;
3857 0 : OutdoorHumRat = state.dataEnvrn->OutHumRat;
3858 0 : CondAirSidePressure = state.dataEnvrn->OutBaroPress;
3859 0 : OutdoorWetBulb = state.dataEnvrn->OutWetBulbTemp;
3860 : } else {
3861 0 : OutdoorDryBulb = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).Temp;
3862 0 : OutdoorHumRat = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).HumRat;
3863 0 : OutdoorWetBulb = PsyTwbFnTdbWPb(state, OutdoorDryBulb, OutdoorHumRat, CondAirSidePressure, RoutineName);
3864 : }
3865 0 : CondAirMassFlow = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserAirMassFlow;
3866 : // direct evap cool model
3867 0 : CondInletTemp =
3868 0 : OutdoorWetBulb + (OutdoorDryBulb - OutdoorWetBulb) * (1.0 - state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapCondEffect);
3869 0 : CondInletHumRat = PsyWFnTdbTwbPb(state, CondInletTemp, OutdoorWetBulb, CondAirSidePressure, RoutineName);
3870 : }
3871 2394 : EvapAirMassFlow = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).MassFlowRate;
3872 2394 : EvapInletDryBulb = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).Temp;
3873 2394 : EvapInletHumRat = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).HumRat;
3874 2394 : EvapInletWetBulb = PsyTwbFnTdbWPb(state, EvapInletDryBulb, EvapInletHumRat, state.dataEnvrn->OutBaroPress, RoutineName);
3875 2394 : EvapInletEnthalpy = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).Enthalpy;
3876 2394 : CoilMightBeDry = false;
3877 :
3878 2394 : switch (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageMedia) {
3879 2394 : case MediaType::Water:
3880 : case MediaType::UserDefindFluid:
3881 2394 : sTES = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).FluidTankTempFinalLastTimestep;
3882 4788 : if ((sTES >= state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).MinimumFluidTankTempLimit) &&
3883 2394 : (sTES < state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).MaximumFluidTankTempLimit)) {
3884 2394 : TESHasSomeCharge = true;
3885 4788 : rho = GetDensityGlycol(state,
3886 2394 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageFluidName,
3887 : sTES,
3888 2394 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageFluidIndex,
3889 : RoutineName);
3890 2394 : TankMass = rho * state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).FluidStorageVolume;
3891 4788 : CpTank = GetSpecificHeatGlycol(state,
3892 2394 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageFluidName,
3893 : sTES,
3894 2394 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageFluidIndex,
3895 : RoutineName);
3896 : // simple linear approximation of DT/Dt term in McpDT/Dt
3897 4788 : QdotDischargeLimit = TankMass * CpTank * (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).MaximumFluidTankTempLimit - sTES) /
3898 2394 : (TimeStepSys * DataGlobalConstants::SecInHour);
3899 : } else {
3900 0 : TESHasSomeCharge = false;
3901 : }
3902 2394 : break;
3903 0 : case MediaType::Ice:
3904 0 : sTES = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).IceFracRemainLastTimestep;
3905 0 : if (sTES > 0.0) {
3906 0 : TESHasSomeCharge = true;
3907 : // discharge limit
3908 0 : QdotDischargeLimit =
3909 0 : (sTES)*state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).IceStorageCapacity / (TimeStepSys * DataGlobalConstants::SecInHour);
3910 : } else {
3911 0 : TESHasSomeCharge = false;
3912 : }
3913 0 : break;
3914 0 : default:
3915 0 : break;
3916 : }
3917 :
3918 2394 : if ((EvapAirMassFlow > SmallMassFlow) && (PartLoadRatio > 0.0)) { // coil is running
3919 :
3920 1590 : AirMassFlowRatio = EvapAirMassFlow / state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RatedEvapAirMassFlowRate;
3921 3180 : EvapTotCapTempModFac = CurveValue(state,
3922 1590 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeCoolingCapFTempCurve,
3923 : EvapInletWetBulb,
3924 : CondInletTemp,
3925 : sTES);
3926 1590 : EvapTotCapTempModFac = max(0.0, EvapTotCapTempModFac); // could warn if negative, DXcoil does
3927 1590 : EvapTotCapFlowModFac =
3928 3180 : CurveValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeCoolingCapFFlowCurve, AirMassFlowRatio);
3929 1590 : EvapTotCapFlowModFac = max(0.0, EvapTotCapFlowModFac); // could warn if negative, DXcoil does
3930 1590 : EvapTotCap =
3931 1590 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeRatedTotCap * EvapTotCapTempModFac * EvapTotCapFlowModFac;
3932 : // now see if coil is running dry
3933 1590 : PartLoadOutAirEnth = EvapInletEnthalpy - (EvapTotCap * PartLoadRatio) / EvapAirMassFlow;
3934 1590 : PartLoadDryCoilOutAirTemp = PsyTdbFnHW(PartLoadOutAirEnth, EvapInletHumRat);
3935 1590 : if (PartLoadDryCoilOutAirTemp > PsyTsatFnHPb(state, PartLoadOutAirEnth, state.dataEnvrn->OutBaroPress, RoutineName)) {
3936 0 : CoilMightBeDry = true;
3937 : // find wADP, humidity ratio at apparatus dewpoint and inlet hum rat that would have dry coil
3938 0 : DryCoilTestEvapInletHumRat = EvapInletHumRat;
3939 0 : DryCoilTestEvapInletWetBulb = EvapInletWetBulb;
3940 0 : Counter = 0;
3941 0 : Converged = false;
3942 0 : while (!Converged) {
3943 0 : EvapTotCapTempModFac = CurveValue(state,
3944 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeCoolingCapFTempCurve,
3945 : DryCoilTestEvapInletWetBulb,
3946 : CondInletTemp,
3947 : sTES);
3948 0 : EvapTotCapTempModFac = max(0.0, EvapTotCapTempModFac); // could warn if negative, DXcoil does
3949 0 : EvapTotCapFlowModFac = CurveValue(
3950 0 : state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeCoolingCapFFlowCurve, AirMassFlowRatio);
3951 0 : EvapTotCapFlowModFac = max(0.0, EvapTotCapFlowModFac); // could warn if negative, DXcoil does
3952 0 : EvapTotCap = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeRatedTotCap * EvapTotCapTempModFac *
3953 : EvapTotCapFlowModFac;
3954 : // coil bypass factor = 0.0
3955 0 : hADP = EvapInletEnthalpy - (EvapTotCap / EvapAirMassFlow);
3956 0 : tADP = PsyTsatFnHPb(state, hADP, state.dataEnvrn->OutBaroPress, RoutineName);
3957 0 : wADP = min(EvapInletHumRat, PsyWFnTdbH(state, tADP, hADP, RoutineName));
3958 0 : hTinwADP = PsyHFnTdbW(EvapInletDryBulb, wADP);
3959 0 : if ((EvapInletEnthalpy - hADP) > 1.e-10) {
3960 0 : SHRadp = min((hTinwADP - hADP) / (EvapInletEnthalpy - hADP), 1.0);
3961 : } else {
3962 0 : SHRadp = 1.0;
3963 : }
3964 :
3965 0 : if ((wADP > DryCoilTestEvapInletHumRat) || (Counter >= 1 && Counter < MaxIter)) {
3966 0 : if (DryCoilTestEvapInletHumRat <= 0.0) DryCoilTestEvapInletHumRat = 0.00001;
3967 0 : werror = (DryCoilTestEvapInletHumRat - wADP) / DryCoilTestEvapInletHumRat;
3968 :
3969 0 : DryCoilTestEvapInletHumRat = RelaxationFactor * wADP + (1.0 - RelaxationFactor) * DryCoilTestEvapInletHumRat;
3970 0 : DryCoilTestEvapInletWetBulb =
3971 0 : PsyTwbFnTdbWPb(state, EvapInletDryBulb, DryCoilTestEvapInletHumRat, state.dataEnvrn->OutBaroPress, RoutineName);
3972 :
3973 0 : ++Counter;
3974 0 : if (std::abs(werror) <= Tolerance) {
3975 0 : Converged = true;
3976 : } else {
3977 0 : Converged = false;
3978 : }
3979 : } else {
3980 0 : Converged = true;
3981 : }
3982 : }
3983 : }
3984 : {
3985 3180 : if (state.dataCurveManager->PerfCurve(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeSHRFTempCurve)
3986 1590 : .numDims == 2) {
3987 0 : SHRTempFac = CurveValue(state,
3988 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeSHRFTempCurve,
3989 : EvapInletWetBulb,
3990 : EvapInletDryBulb);
3991 : } else {
3992 3180 : SHRTempFac = CurveValue(state,
3993 1590 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeSHRFTempCurve,
3994 : EvapInletWetBulb,
3995 : EvapInletDryBulb,
3996 : sTES);
3997 : }
3998 : }
3999 1590 : SHRFlowFac = CurveValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeSHRFFlowCurve, AirMassFlowRatio);
4000 1590 : SHR = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeRatedSHR * SHRTempFac * SHRFlowFac;
4001 1590 : SHR = min(SHR, 1.0); // warn maybe
4002 1590 : SHR = max(SHR, 0.0); // warn maybe
4003 1590 : if (CoilMightBeDry) {
4004 0 : if ((EvapInletHumRat < DryCoilTestEvapInletHumRat) && (SHRadp > SHR)) { // coil is dry for sure
4005 0 : SHR = 1.0;
4006 0 : } else if (SHRadp > SHR) {
4007 0 : SHR = SHRadp;
4008 : }
4009 : }
4010 1590 : PLF = CurveValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeCoolingPLFFPLRCurve, PartLoadRatio);
4011 1590 : if (PLF >= PartLoadRatio && PLF > 0.0) {
4012 1590 : EvapRuntimeFraction = PartLoadRatio / PLF;
4013 : } else {
4014 0 : EvapRuntimeFraction = 1.0; // warn maybe
4015 : }
4016 : // Calculate electricity consumed. First, get EIR modifying factors for off-rated conditions
4017 3180 : EIRTempModFac = CurveValue(state,
4018 1590 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeCoolingEIRFTempCurve,
4019 : EvapInletWetBulb,
4020 : CondInletTemp,
4021 : sTES);
4022 1590 : EIRTempModFac = max(EIRTempModFac, 0.0);
4023 1590 : EIRFlowModFac =
4024 3180 : CurveValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeCoolingEIRFFlowCurve, AirMassFlowRatio);
4025 1590 : EIRFlowModFac = max(EIRFlowModFac, 0.0);
4026 1590 : EIR = EIRTempModFac * EIRFlowModFac / state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeCoolingRatedCOP;
4027 :
4028 1590 : EvapElecCoolingPower = EvapTotCap * EIR * EvapRuntimeFraction;
4029 :
4030 1590 : if (TESHasSomeCharge) {
4031 3180 : DischargeCapTempModFac = CurveValue(state,
4032 1590 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeDischargingCapFTempCurve,
4033 : EvapInletWetBulb,
4034 : CondInletTemp,
4035 : sTES);
4036 1590 : DischargeCapTempModFac = max(0.0, DischargeCapTempModFac);
4037 3180 : DischargeCapFlowModFac = CurveValue(
4038 1590 : state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeDischargingCapFFlowCurve, AirMassFlowRatio);
4039 1590 : DischargeCapFlowModFac = max(0.0, DischargeCapFlowModFac);
4040 :
4041 3180 : DischargePLF = CurveValue(
4042 1590 : state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeDischargingCapFEvapPLRCurve, PartLoadRatio);
4043 1590 : if (DischargePLF >= PartLoadRatio && DischargePLF > 0.0) {
4044 954 : DischargeRuntimeFraction = PartLoadRatio / DischargePLF;
4045 : } else {
4046 636 : DischargeRuntimeFraction = 1.0; // warn maybe
4047 : }
4048 :
4049 3180 : TotDischargeCap = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeRatedDischargeCap *
4050 1590 : DischargeCapTempModFac * DischargeCapFlowModFac * DischargeRuntimeFraction;
4051 1590 : if (TotDischargeCap > QdotDischargeLimit) {
4052 0 : TotDischargeCap = min(TotDischargeCap, QdotDischargeLimit);
4053 : }
4054 3180 : DischargeEIRTempModFac = CurveValue(state,
4055 1590 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeDischargingEIRFTempCurve,
4056 : EvapInletWetBulb,
4057 : CondInletTemp,
4058 : sTES);
4059 1590 : DischargeEIRTempModFac = max(0.0, DischargeEIRTempModFac);
4060 3180 : DischargeEIRFlowModFac = CurveValue(
4061 1590 : state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeDischargingEIRFFLowCurve, AirMassFlowRatio);
4062 1590 : DischargeEIRFlowModFac = max(0.0, DischargeEIRFlowModFac);
4063 :
4064 3180 : DischargeEIR = (DischargeEIRTempModFac * DischargeEIRFlowModFac) /
4065 1590 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CoolingAndDischargeDischargingRatedCOP;
4066 1590 : DischargeElectricCoolingPower = TotDischargeCap * DischargeEIR * DischargeRuntimeFraction;
4067 1590 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotTES = TotDischargeCap;
4068 : } else {
4069 0 : TotDischargeCap = 0.0;
4070 0 : DischargeRuntimeFraction = 0.0;
4071 0 : DischargeElectricCoolingPower = 0.0;
4072 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotTES = 0.0;
4073 : }
4074 :
4075 1590 : TotCap = EvapTotCap + TotDischargeCap;
4076 : // Calculate full load output conditions
4077 1590 : FullLoadOutAirEnth = EvapInletEnthalpy - TotCap / EvapAirMassFlow;
4078 :
4079 1590 : hTinwout = EvapInletEnthalpy - (1.0 - SHR) * (TotCap / EvapAirMassFlow);
4080 : // The following will often throw psych warnings for neg w, suppress warnings because error condition is handled in next IF
4081 1590 : FullLoadOutAirHumRat = PsyWFnTdbH(state, EvapInletDryBulb, hTinwout, RoutineName, true);
4082 1590 : FullLoadOutAirTemp = PsyTdbFnHW(FullLoadOutAirEnth, FullLoadOutAirHumRat);
4083 : // Check for saturation error and modify temperature at constant enthalpy
4084 1590 : if (FullLoadOutAirTemp < PsyTsatFnHPb(state, FullLoadOutAirEnth, state.dataEnvrn->OutBaroPress, RoutineName)) {
4085 1590 : FullLoadOutAirTemp = PsyTsatFnHPb(state, FullLoadOutAirEnth, state.dataEnvrn->OutBaroPress, RoutineName);
4086 1590 : FullLoadOutAirHumRat = PsyWFnTdbH(state, FullLoadOutAirTemp, FullLoadOutAirEnth, RoutineName);
4087 : }
4088 : // Continuous fan, cycling compressor
4089 1590 : EvapOutletAirEnthalpy = ((PartLoadRatio)*FullLoadOutAirEnth + (1.0 - (PartLoadRatio)) * EvapInletEnthalpy);
4090 1590 : EvapOutletAirHumRat = ((PartLoadRatio)*FullLoadOutAirHumRat + (1.0 - (PartLoadRatio)) * EvapInletHumRat);
4091 1590 : EvapOutletAirTemp = PsyTdbFnHW(EvapOutletAirEnthalpy, EvapOutletAirHumRat);
4092 1590 : if (EvapOutletAirTemp < PsyTsatFnHPb(state, EvapOutletAirEnthalpy, state.dataEnvrn->OutBaroPress, RoutineName)) {
4093 224 : EvapOutletAirTemp = PsyTsatFnHPb(state, EvapOutletAirEnthalpy, state.dataEnvrn->OutBaroPress, RoutineName);
4094 224 : EvapOutletAirHumRat = PsyWFnTdbH(state, EvapOutletAirTemp, EvapOutletAirEnthalpy, RoutineName);
4095 : }
4096 :
4097 1590 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).Temp = EvapOutletAirTemp;
4098 1590 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).HumRat = EvapOutletAirHumRat;
4099 1590 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).Enthalpy = EvapOutletAirEnthalpy;
4100 1590 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).MassFlowRate = EvapAirMassFlow;
4101 1590 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).MassFlowRateMinAvail =
4102 1590 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).MassFlowRateMinAvail;
4103 1590 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).MassFlowRateMaxAvail =
4104 1590 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).MassFlowRateMaxAvail;
4105 :
4106 : // determine condenser leaving conditions
4107 1590 : QdotCond = EvapTotCap * EvapRuntimeFraction + EvapElecCoolingPower;
4108 1590 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).MassFlowRate =
4109 1590 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserAirMassFlow;
4110 1590 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).MassFlowRate =
4111 1590 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserAirMassFlow;
4112 1590 : CondInletEnthalpy = PsyHFnTdbW(CondInletTemp, CondInletHumRat);
4113 1590 : CondOutletEnthalpy = CondInletEnthalpy + QdotCond / state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserAirMassFlow;
4114 1590 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).Temp =
4115 1590 : PsyTdbFnHW(CondOutletEnthalpy, CondInletHumRat);
4116 1590 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).HumRat = CondInletHumRat;
4117 1590 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).Enthalpy = CondOutletEnthalpy;
4118 :
4119 1590 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingPower =
4120 1590 : EvapElecCoolingPower + DischargeElectricCoolingPower + state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).AncillaryControlsPower;
4121 1590 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingEnergy =
4122 1590 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingPower * TimeStepSys * DataGlobalConstants::SecInHour;
4123 1590 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RuntimeFraction =
4124 1590 : (EvapTotCap * EvapRuntimeFraction + TotDischargeCap * DischargeRuntimeFraction) / (EvapTotCap + TotDischargeCap);
4125 :
4126 1590 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingRate =
4127 1590 : EvapTotCap * EvapRuntimeFraction + TotDischargeCap * DischargeRuntimeFraction;
4128 1590 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingEnergy =
4129 1590 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingRate * TimeStepSys * DataGlobalConstants::SecInHour;
4130 1590 : MinAirHumRat = min(state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).HumRat,
4131 1590 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).HumRat);
4132 1590 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingRate =
4133 1590 : EvapAirMassFlow * (PsyHFnTdbW(EvapInletDryBulb, MinAirHumRat) - PsyHFnTdbW(EvapOutletAirTemp, MinAirHumRat));
4134 3180 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingRate >
4135 1590 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingRate) {
4136 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingRate =
4137 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingRate;
4138 : }
4139 1590 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingEnergy =
4140 1590 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingRate * TimeStepSys * DataGlobalConstants::SecInHour;
4141 1590 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapLatCoolingRate =
4142 3180 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingRate -
4143 1590 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingRate;
4144 1590 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapLatCoolingEnergy =
4145 1590 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapLatCoolingRate * TimeStepSys * DataGlobalConstants::SecInHour;
4146 :
4147 : } else { // coil is off; just pass through conditions
4148 804 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotTES = 0.0;
4149 :
4150 804 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingPower =
4151 804 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).AncillaryControlsPower;
4152 804 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingEnergy =
4153 804 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingPower * TimeStepSys * DataGlobalConstants::SecInHour;
4154 804 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RuntimeFraction = 0.0;
4155 :
4156 804 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RuntimeFraction = 0.0;
4157 804 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingRate = 0.0;
4158 804 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingEnergy = 0.0;
4159 804 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingRate = 0.0;
4160 804 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingEnergy = 0.0;
4161 804 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapLatCoolingRate = 0.0;
4162 804 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapLatCoolingEnergy = 0.0;
4163 :
4164 804 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).Temp =
4165 804 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).Temp;
4166 804 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).HumRat =
4167 804 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).HumRat;
4168 804 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).MassFlowRate =
4169 804 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).MassFlowRate;
4170 804 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).MassFlowRateMinAvail =
4171 804 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).MassFlowRateMinAvail;
4172 804 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).MassFlowRateMaxAvail =
4173 804 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).MassFlowRateMaxAvail;
4174 804 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).Enthalpy =
4175 804 : PsyHFnTdbW(state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).Temp,
4176 804 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).HumRat);
4177 : // nothing happens at condenser
4178 804 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).Temp =
4179 804 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).Temp;
4180 804 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).HumRat =
4181 804 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).HumRat;
4182 804 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).MassFlowRate = 0.0;
4183 804 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).MassFlowRate =
4184 804 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).MassFlowRate;
4185 804 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).Enthalpy =
4186 804 : PsyHFnTdbW(state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).Temp,
4187 804 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).HumRat);
4188 804 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondInletTemp =
4189 804 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).Temp;
4190 : }
4191 2394 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Q_TES =
4192 2394 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotTES * TimeStepSys * DataGlobalConstants::SecInHour;
4193 2394 : UpdateTEStorage(state, TESCoilNum);
4194 :
4195 2394 : UpdateColdWeatherProtection(state, TESCoilNum);
4196 :
4197 2394 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserType == TESCondenserType::Evap) {
4198 0 : UpdateEvaporativeCondenserBasinHeater(state, TESCoilNum);
4199 0 : UpdateEvaporativeCondenserWaterUse(
4200 0 : state, TESCoilNum, CondInletHumRat, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum);
4201 : }
4202 2394 : }
4203 :
4204 1344 : void CalcTESCoilChargeOnlyMode(EnergyPlusData &state, int const TESCoilNum)
4205 : {
4206 :
4207 : // SUBROUTINE INFORMATION:
4208 : // AUTHOR Brent Griffith
4209 : // DATE WRITTEN May 2013
4210 : // MODIFIED na
4211 : // RE-ENGINEERED na
4212 :
4213 : // Using/Aliasing
4214 : using Curve::CurveValue;
4215 1344 : auto &TimeStepSys = state.dataHVACGlobal->TimeStepSys;
4216 : using FluidProperties::GetDensityGlycol;
4217 : using FluidProperties::GetSpecificHeatGlycol;
4218 :
4219 : // SUBROUTINE PARAMETER DEFINITIONS:
4220 : static constexpr std::string_view RoutineName("CalcTESCoilChargeOnlyMode");
4221 :
4222 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
4223 : Real64 sTES; // local state of Thermal Energy Storage (C or ice fraction)
4224 : Real64 CondInletTemp; // Condenser inlet temperature (C). Outdoor dry-bulb temp for air-cooled condenser.
4225 : // Outdoor Wetbulb +(1 - effectiveness)*(outdoor drybulb - outdoor wetbulb) for evap condenser.
4226 : Real64 CondInletHumRat; // Condenser inlet humidity ratio (kg/kg). Zero for air-cooled condenser.
4227 : // For evap condenser, its the humidity ratio of the air leaving the evap cooling pads.
4228 : Real64 CondAirMassFlow; // Condenser air mass flow rate [kg/s]
4229 : Real64 CondInletEnthalpy; // condenser inlet enthalpy [J/kg]
4230 : Real64 CondAirSidePressure; // Outdoor barometric pressure at condenser (Pa)
4231 : Real64 QdotCond; // condenser total heat rejection rate [W]
4232 : Real64 CondOutletEnthalpy; // condesner outlet enthalpy [J/kg]
4233 : Real64 OutdoorDryBulb; // outdoor air dry bulb local variable [C]
4234 : Real64 OutdoorHumRat; // outdoor air humidity ratio local [kg/kg]
4235 : Real64 OutdoorWetBulb; // outdoor air wetbulb local [C]
4236 : Real64 CapModFac; // local capacity modifying factor
4237 : Real64 TotCap; // total cooling (charging) capacity
4238 : Real64 EIRModFac; // local energy input ratio modifying factor
4239 : Real64 EIR; // energy input ratio
4240 : Real64 ElecCoolingPower; // compressor electric power
4241 1344 : bool TESCanBeCharged(false); // true if room for tank to be charged.
4242 : Real64 QdotChargeLimit; // limit for charge cooling power to hit limit of storage.
4243 : Real64 rho; // density of fluid in tank (kg/m3)
4244 : Real64 TankMass; // Mass of fluid in tank (kg)
4245 : Real64 CpTank; // Specific heat of water in tank (J/kg K)
4246 :
4247 : // nothing happens at Evaporator
4248 1344 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).Temp =
4249 1344 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).Temp;
4250 1344 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).HumRat =
4251 1344 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).HumRat;
4252 1344 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).MassFlowRate =
4253 1344 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).MassFlowRate;
4254 1344 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).MassFlowRateMinAvail =
4255 1344 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).MassFlowRateMinAvail;
4256 1344 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).MassFlowRateMaxAvail =
4257 1344 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).MassFlowRateMaxAvail;
4258 1344 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).Enthalpy =
4259 1344 : PsyHFnTdbW(state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).Temp,
4260 1344 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).HumRat);
4261 :
4262 : // first deal with condenser
4263 1344 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserType == TESCondenserType::Air) {
4264 1344 : CondAirSidePressure = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).Press;
4265 1344 : if (CondAirSidePressure == state.dataLoopNodes->DefaultNodeValues.Press) {
4266 0 : CondInletTemp = state.dataEnvrn->OutDryBulbTemp;
4267 0 : CondInletHumRat = state.dataEnvrn->OutHumRat;
4268 0 : CondAirSidePressure = state.dataEnvrn->OutBaroPress;
4269 : } else {
4270 1344 : CondInletTemp = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).Temp;
4271 1344 : CondInletHumRat = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).HumRat;
4272 : }
4273 1344 : CondAirMassFlow = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserAirMassFlow;
4274 0 : } else if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserType == TESCondenserType::Evap) {
4275 0 : CondAirSidePressure = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).Press;
4276 0 : if (CondAirSidePressure == state.dataLoopNodes->DefaultNodeValues.Press) {
4277 0 : OutdoorDryBulb = state.dataEnvrn->OutDryBulbTemp;
4278 0 : OutdoorHumRat = state.dataEnvrn->OutHumRat;
4279 0 : CondAirSidePressure = state.dataEnvrn->OutBaroPress;
4280 0 : OutdoorWetBulb = state.dataEnvrn->OutWetBulbTemp;
4281 : } else {
4282 0 : OutdoorDryBulb = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).Temp;
4283 0 : OutdoorHumRat = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).HumRat;
4284 0 : OutdoorWetBulb = PsyTwbFnTdbWPb(state, OutdoorDryBulb, OutdoorHumRat, CondAirSidePressure, RoutineName);
4285 : }
4286 0 : CondAirMassFlow = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserAirMassFlow;
4287 : // direct evap cool model
4288 0 : CondInletTemp =
4289 0 : OutdoorWetBulb + (OutdoorDryBulb - OutdoorWetBulb) * (1.0 - state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapCondEffect);
4290 0 : CondInletHumRat = PsyWFnTdbTwbPb(state, CondInletTemp, OutdoorWetBulb, CondAirSidePressure, RoutineName);
4291 : }
4292 :
4293 1344 : switch (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageMedia) {
4294 0 : case MediaType::Water:
4295 : case MediaType::UserDefindFluid:
4296 0 : sTES = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).FluidTankTempFinalLastTimestep;
4297 0 : if ((sTES > state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).MinimumFluidTankTempLimit) &&
4298 0 : (sTES < state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).MaximumFluidTankTempLimit)) {
4299 0 : TESCanBeCharged = true;
4300 : // find charge limit to reach limits
4301 0 : rho = GetDensityGlycol(state,
4302 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageFluidName,
4303 : sTES,
4304 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageFluidIndex,
4305 : RoutineName);
4306 0 : TankMass = rho * state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).FluidStorageVolume;
4307 0 : CpTank = GetSpecificHeatGlycol(state,
4308 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageFluidName,
4309 : sTES,
4310 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageFluidIndex,
4311 : RoutineName);
4312 : // simple linear approximation of DT/Dt term in McpDT/Dt
4313 0 : QdotChargeLimit = TankMass * CpTank * (sTES - state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).MinimumFluidTankTempLimit) /
4314 0 : (TimeStepSys * DataGlobalConstants::SecInHour);
4315 : } else {
4316 0 : TESCanBeCharged = false;
4317 : }
4318 0 : break;
4319 1344 : case MediaType::Ice:
4320 1344 : sTES = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).IceFracRemainLastTimestep;
4321 1344 : if (sTES < 1.0) {
4322 1344 : TESCanBeCharged = true;
4323 : // find charge limit to reach limit
4324 2688 : QdotChargeLimit = (1.0 - sTES) * state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).IceStorageCapacity /
4325 1344 : (TimeStepSys * DataGlobalConstants::SecInHour);
4326 : } else {
4327 0 : TESCanBeCharged = false;
4328 : }
4329 1344 : break;
4330 0 : default:
4331 0 : break;
4332 : }
4333 :
4334 1344 : if (TESCanBeCharged) { // coil is running
4335 1344 : CapModFac = CurveValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ChargeOnlyChargingCapFTempCurve, CondInletTemp, sTES);
4336 1344 : CapModFac = max(0.0, CapModFac);
4337 1344 : TotCap = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ChargeOnlyRatedCapacity * CapModFac;
4338 1344 : if (TotCap > QdotChargeLimit) {
4339 1 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RuntimeFraction = QdotChargeLimit / TotCap;
4340 1 : TotCap = min(TotCap, QdotChargeLimit);
4341 : } else {
4342 1343 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RuntimeFraction = 1.0;
4343 : }
4344 1344 : EIRModFac = CurveValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ChargeOnlyChargingEIRFTempCurve, CondInletTemp, sTES);
4345 1344 : EIRModFac = max(0.0, EIRModFac);
4346 1344 : EIR = EIRModFac / state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ChargeOnlyRatedCOP;
4347 1344 : ElecCoolingPower = TotCap * EIR;
4348 1344 : QdotCond = TotCap + ElecCoolingPower;
4349 1344 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).MassFlowRate =
4350 1344 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserAirMassFlow;
4351 1344 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).MassFlowRate =
4352 1344 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserAirMassFlow;
4353 1344 : CondInletEnthalpy = PsyHFnTdbW(CondInletTemp, CondInletHumRat);
4354 1344 : CondOutletEnthalpy = CondInletEnthalpy + QdotCond / state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserAirMassFlow;
4355 1344 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).Temp =
4356 1344 : PsyTdbFnHW(CondOutletEnthalpy, CondInletHumRat);
4357 1344 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).HumRat = CondInletHumRat;
4358 1344 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).Enthalpy = CondOutletEnthalpy;
4359 :
4360 1344 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingPower =
4361 1344 : ElecCoolingPower + state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).AncillaryControlsPower;
4362 1344 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingEnergy =
4363 1344 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingPower * TimeStepSys * DataGlobalConstants::SecInHour;
4364 :
4365 1344 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotTES = -TotCap; // negative for cooling
4366 :
4367 : } else { // not running
4368 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingPower =
4369 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).AncillaryControlsPower;
4370 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingEnergy =
4371 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingPower * TimeStepSys * DataGlobalConstants::SecInHour;
4372 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RuntimeFraction = 0.0;
4373 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotTES = 0.0;
4374 0 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).Temp =
4375 0 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).Temp;
4376 0 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).HumRat =
4377 0 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).HumRat;
4378 0 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).MassFlowRate = 0.0;
4379 0 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).MassFlowRate =
4380 0 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).MassFlowRate;
4381 0 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).Enthalpy =
4382 0 : PsyHFnTdbW(state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).Temp,
4383 0 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).HumRat);
4384 : }
4385 1344 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Q_TES =
4386 1344 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotTES * TimeStepSys * DataGlobalConstants::SecInHour;
4387 :
4388 1344 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingRate = 0.0;
4389 1344 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingEnergy = 0.0;
4390 1344 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingRate = 0.0;
4391 1344 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingEnergy = 0.0;
4392 1344 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapLatCoolingRate = 0.0;
4393 1344 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapLatCoolingEnergy = 0.0;
4394 :
4395 1344 : UpdateTEStorage(state, TESCoilNum);
4396 :
4397 1344 : UpdateColdWeatherProtection(state, TESCoilNum);
4398 :
4399 1344 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserType == TESCondenserType::Evap) {
4400 0 : UpdateEvaporativeCondenserBasinHeater(state, TESCoilNum);
4401 0 : UpdateEvaporativeCondenserWaterUse(
4402 0 : state, TESCoilNum, CondInletHumRat, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum);
4403 : }
4404 1344 : }
4405 :
4406 15257 : void CalcTESCoilDischargeOnlyMode(EnergyPlusData &state, int const TESCoilNum, Real64 const PartLoadRatio)
4407 : {
4408 :
4409 : // SUBROUTINE INFORMATION:
4410 : // AUTHOR Brent Griffith
4411 : // DATE WRITTEN April 2013
4412 : // MODIFIED na
4413 : // RE-ENGINEERED na
4414 :
4415 : // Using/Aliasing
4416 : using Curve::CurveValue;
4417 15257 : auto &TimeStepSys = state.dataHVACGlobal->TimeStepSys;
4418 : using FluidProperties::GetDensityGlycol;
4419 : using FluidProperties::GetSpecificHeatGlycol;
4420 :
4421 : // SUBROUTINE PARAMETER DEFINITIONS:
4422 15257 : int constexpr MaxIter(30);
4423 15257 : Real64 constexpr RelaxationFactor(0.4);
4424 15257 : Real64 constexpr Tolerance(0.1);
4425 : static constexpr std::string_view RoutineName("CalcTESCoilDischargeOnlyMode");
4426 : static constexpr std::string_view StorageTankName("CalcTESWaterStorageTank");
4427 :
4428 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
4429 : Real64 AirMassFlowRatio; // evaporator inlet air mass flow divided by design mass flow [ ]
4430 : Real64 EvapAirMassFlow; // local for evaporator air mass flow [kg/s]
4431 : Real64 EvapInletDryBulb; // evaporator inlet air drybulb [C]
4432 : Real64 EvapInletHumRat; // evaporator inlet air humidity ratio [kg/kg]
4433 : Real64 EvapInletWetBulb; // evaporator inlet air wetbulb [C]
4434 : Real64 EvapInletEnthalpy; // evaporator inlet air enthalpy [J/kg]
4435 : Real64 sTES; // state of charge of Thermal Energy Storage
4436 : Real64 TotCapTempModFac; // total coolin capacity modification factor due to temps []
4437 : Real64 TotCapFlowModFac; // Total cooling capacity modification factor due to flow []
4438 : Real64 TotCap; // total cooling capacity
4439 15257 : Real64 SHRTempFac(0.0); // sensible heat ratio modification factor due to temps []
4440 : Real64 SHRFlowFac; // sensible heat ratio modification factor due to flow []
4441 : Real64 SHR; // sensible heat ratio
4442 : Real64 PLF; // part load factor
4443 : Real64 PLR; // part load ratio
4444 : Real64 RuntimeFraction; // compressor running time divided by full time of timestep.
4445 : Real64 FullLoadOutAirEnth; // evaporator outlet full load enthalpy [J/kg]
4446 : Real64 FullLoadOutAirHumRat; // evaporator outlet humidity ratio at full load
4447 : Real64 FullLoadOutAirTemp; // evaporator outlet air temperature at full load [C]
4448 : Real64 hTinwout; // Enthalpy at inlet dry-bulb and outlet humidity ratio [J/kg]
4449 : Real64 EvapOutletAirEnthalpy; // evaporator outlet air enthalpy [J/kg]
4450 : Real64 EvapOutletAirHumRat; // evaporator outlet air humidity ratio [kg/kg]
4451 : Real64 EvapOutletAirTemp; // evaporator outlet drybulb [C]
4452 : Real64 EIRTempModFac; // energy input ratio modification factor due to temperatures []
4453 : Real64 EIRFlowModFac; // energy input ratio modification factor due to flow []
4454 : Real64 EIR; // energy input ratio
4455 : Real64 ElecCoolingPower; // compressor electric power
4456 : Real64 MinAirHumRat; // minimum air humidity ratio
4457 : bool TESHasSomeCharge; // true when there is something avaiable in storage
4458 : Real64 QdotDischargeLimit; // limit for how much storage can be discharged without overshooting
4459 : Real64 rho; // density of water in tank (kg/m3)
4460 : Real64 TankMass; // Mass of water in tank (kg)
4461 : Real64 CpTank; // Specific heat of water in tank (J/kg K)
4462 : Real64 QdotTEStest;
4463 : Real64 RuntimeFractionLimit;
4464 : Real64 PartLoadOutAirEnth; // local leaving enthalpy at part load
4465 : Real64 PartLoadDryCoilOutAirTemp; // local leaving drybulb if coil were dry
4466 : bool CoilMightBeDry;
4467 : int Counter;
4468 : bool Converged;
4469 : Real64 DryCoilTestEvapInletHumRat;
4470 : Real64 DryCoilTestEvapInletWetBulb;
4471 : Real64 hADP;
4472 : Real64 tADP;
4473 : Real64 wADP;
4474 : Real64 hTinwADP;
4475 : Real64 SHRadp;
4476 : Real64 werror;
4477 :
4478 15257 : PLR = PartLoadRatio;
4479 :
4480 15257 : EvapAirMassFlow = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).MassFlowRate;
4481 15257 : EvapInletDryBulb = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).Temp;
4482 15257 : EvapInletHumRat = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).HumRat;
4483 15257 : EvapInletWetBulb = PsyTwbFnTdbWPb(state, EvapInletDryBulb, EvapInletHumRat, state.dataEnvrn->OutBaroPress, RoutineName);
4484 15257 : EvapInletEnthalpy = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).Enthalpy;
4485 15257 : CoilMightBeDry = false;
4486 :
4487 15257 : switch (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageMedia) {
4488 0 : case MediaType::Water:
4489 : case MediaType::UserDefindFluid:
4490 0 : sTES = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).FluidTankTempFinalLastTimestep;
4491 0 : if ((sTES >= state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).MinimumFluidTankTempLimit) &&
4492 0 : (sTES < state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).MaximumFluidTankTempLimit)) {
4493 0 : TESHasSomeCharge = true;
4494 0 : rho = GetDensityGlycol(state,
4495 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageFluidName,
4496 : sTES,
4497 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageFluidIndex,
4498 : StorageTankName);
4499 0 : TankMass = rho * state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).FluidStorageVolume;
4500 0 : CpTank = GetSpecificHeatGlycol(state,
4501 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageFluidName,
4502 : sTES,
4503 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageFluidIndex,
4504 : StorageTankName);
4505 : // simple linear approximation of DT/Dt term in McpDT/Dt
4506 0 : QdotDischargeLimit = TankMass * CpTank * (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).MaximumFluidTankTempLimit - sTES) /
4507 0 : (TimeStepSys * DataGlobalConstants::SecInHour);
4508 : } else {
4509 0 : TESHasSomeCharge = false;
4510 : }
4511 0 : break;
4512 15257 : case MediaType::Ice:
4513 15257 : sTES = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).IceFracRemainLastTimestep;
4514 15257 : if (sTES > 0.0) {
4515 15257 : TESHasSomeCharge = true;
4516 : // discharge limit
4517 15257 : QdotDischargeLimit =
4518 15257 : (sTES)*state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).IceStorageCapacity / (TimeStepSys * DataGlobalConstants::SecInHour);
4519 : } else {
4520 0 : TESHasSomeCharge = false;
4521 : }
4522 15257 : break;
4523 0 : default:
4524 0 : break;
4525 : }
4526 :
4527 15257 : if ((EvapAirMassFlow > SmallMassFlow) && (PLR > 0.0) && TESHasSomeCharge) { // coil is running
4528 10270 : AirMassFlowRatio = EvapAirMassFlow / state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RatedEvapAirMassFlowRate;
4529 :
4530 10270 : TotCapTempModFac =
4531 20540 : CurveValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).DischargeOnlyCapFTempCurve, EvapInletWetBulb, sTES);
4532 10270 : TotCapTempModFac = max(0.0, TotCapTempModFac);
4533 10270 : TotCapFlowModFac = CurveValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).DischargeOnlyCapFFlowCurve, AirMassFlowRatio);
4534 10270 : TotCapFlowModFac = max(0.0, TotCapFlowModFac);
4535 10270 : TotCap = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).DischargeOnlyRatedDischargeCap * TotCapTempModFac * TotCapFlowModFac;
4536 :
4537 10270 : PLF = CurveValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).DischargeOnlyPLFFPLRCurve, PLR);
4538 10270 : if (PLF >= PLR && PLF > 0.0) {
4539 10270 : RuntimeFraction = PLR / PLF;
4540 : } else {
4541 0 : RuntimeFraction = 1.0; // warn maybe
4542 : }
4543 : // Calculate electricity consumed. First, get EIR modifying factors for off-rated conditions
4544 10270 : EIRTempModFac =
4545 20540 : CurveValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).DischargeOnlyEIRFTempCurve, EvapInletWetBulb, sTES);
4546 10270 : EIRTempModFac = max(EIRTempModFac, 0.0);
4547 10270 : EIRFlowModFac = CurveValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).DischargeOnlyEIRFFlowCurve, AirMassFlowRatio);
4548 10270 : EIRFlowModFac = max(EIRFlowModFac, 0.0);
4549 10270 : EIR = EIRTempModFac * EIRFlowModFac / state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).DischargeOnlyRatedCOP;
4550 :
4551 10270 : ElecCoolingPower = TotCap * EIR * RuntimeFraction;
4552 10270 : QdotTEStest = TotCap * RuntimeFraction + ElecCoolingPower;
4553 :
4554 10270 : if (QdotTEStest > QdotDischargeLimit) {
4555 58 : RuntimeFractionLimit = QdotDischargeLimit / (TotCap + TotCap * EIR);
4556 58 : RuntimeFraction = min(RuntimeFraction, RuntimeFractionLimit);
4557 58 : PLR = RuntimeFraction * PLF;
4558 58 : ElecCoolingPower = TotCap * EIR * RuntimeFraction;
4559 : }
4560 : // now see if coil is running dry
4561 10270 : PartLoadOutAirEnth = EvapInletEnthalpy - (TotCap * PartLoadRatio) / EvapAirMassFlow;
4562 10270 : PartLoadDryCoilOutAirTemp = PsyTdbFnHW(PartLoadOutAirEnth, EvapInletHumRat);
4563 10270 : if (PartLoadDryCoilOutAirTemp > PsyTsatFnHPb(state, PartLoadOutAirEnth, state.dataEnvrn->OutBaroPress, RoutineName)) {
4564 0 : CoilMightBeDry = true;
4565 : // find wADP, humidity ratio at apparatus dewpoint and inlet hum rat that would have dry coil
4566 0 : DryCoilTestEvapInletHumRat = EvapInletHumRat;
4567 0 : DryCoilTestEvapInletWetBulb = EvapInletWetBulb;
4568 0 : Counter = 0;
4569 0 : Converged = false;
4570 0 : while (!Converged) {
4571 0 : TotCapTempModFac = CurveValue(
4572 0 : state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).DischargeOnlyCapFTempCurve, DryCoilTestEvapInletWetBulb, sTES);
4573 0 : TotCapTempModFac = max(0.0, TotCapTempModFac);
4574 0 : TotCapFlowModFac =
4575 0 : CurveValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).DischargeOnlyCapFFlowCurve, AirMassFlowRatio);
4576 0 : TotCapFlowModFac = max(0.0, TotCapFlowModFac);
4577 0 : TotCap =
4578 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).DischargeOnlyRatedDischargeCap * TotCapTempModFac * TotCapFlowModFac;
4579 : // coil bypass factor = 0.0
4580 0 : hADP = EvapInletEnthalpy - (TotCap / EvapAirMassFlow);
4581 0 : tADP = PsyTsatFnHPb(state, hADP, state.dataEnvrn->OutBaroPress, RoutineName);
4582 0 : wADP = min(EvapInletHumRat, PsyWFnTdbH(state, tADP, hADP, RoutineName));
4583 0 : hTinwADP = PsyHFnTdbW(EvapInletDryBulb, wADP);
4584 0 : if ((EvapInletEnthalpy - hADP) > 1.e-10) {
4585 0 : SHRadp = min((hTinwADP - hADP) / (EvapInletEnthalpy - hADP), 1.0);
4586 : } else {
4587 0 : SHRadp = 1.0;
4588 : }
4589 :
4590 0 : if ((wADP > DryCoilTestEvapInletHumRat) || (Counter >= 1 && Counter < MaxIter)) {
4591 0 : if (DryCoilTestEvapInletHumRat <= 0.0) DryCoilTestEvapInletHumRat = 0.00001;
4592 0 : werror = (DryCoilTestEvapInletHumRat - wADP) / DryCoilTestEvapInletHumRat;
4593 :
4594 0 : DryCoilTestEvapInletHumRat = RelaxationFactor * wADP + (1.0 - RelaxationFactor) * DryCoilTestEvapInletHumRat;
4595 0 : DryCoilTestEvapInletWetBulb =
4596 0 : PsyTwbFnTdbWPb(state, EvapInletDryBulb, DryCoilTestEvapInletHumRat, state.dataEnvrn->OutBaroPress, RoutineName);
4597 :
4598 0 : ++Counter;
4599 0 : if (std::abs(werror) <= Tolerance) {
4600 0 : Converged = true;
4601 : } else {
4602 0 : Converged = false;
4603 : }
4604 : } else {
4605 0 : Converged = true;
4606 : }
4607 : }
4608 : } // coil will be wet so use SHR curves
4609 : {
4610 10270 : if (state.dataCurveManager->PerfCurve(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).DischargeOnlySHRFTempCurve).numDims ==
4611 : 2) {
4612 20540 : SHRTempFac = CurveValue(
4613 10270 : state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).DischargeOnlySHRFTempCurve, EvapInletWetBulb, EvapInletDryBulb);
4614 : } else {
4615 0 : SHRTempFac = CurveValue(state,
4616 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).DischargeOnlySHRFTempCurve,
4617 : EvapInletWetBulb,
4618 : EvapInletDryBulb,
4619 : sTES);
4620 : }
4621 : }
4622 :
4623 10270 : SHRFlowFac = CurveValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).DischargeOnlySHRFFLowCurve, AirMassFlowRatio);
4624 10270 : SHR = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).DischargeOnlyRatedSHR * SHRTempFac * SHRFlowFac;
4625 10270 : SHR = min(SHR, 1.0); // warn maybe
4626 10270 : SHR = max(SHR, 0.0); // warn maybe
4627 10270 : if (CoilMightBeDry) {
4628 0 : if ((EvapInletHumRat < DryCoilTestEvapInletHumRat) && (SHRadp > SHR)) { // coil is dry for sure
4629 0 : SHR = 1.0;
4630 0 : } else if (SHRadp > SHR) {
4631 0 : SHR = SHRadp;
4632 : }
4633 : }
4634 : // Calculate full load output conditions
4635 10270 : FullLoadOutAirEnth = EvapInletEnthalpy - TotCap / EvapAirMassFlow;
4636 :
4637 10270 : hTinwout = EvapInletEnthalpy - (1.0 - SHR) * (TotCap / EvapAirMassFlow);
4638 : // The following will often throw psych warnings for neg w, suppress warnings because error condition is handled in next IF
4639 10270 : FullLoadOutAirHumRat = PsyWFnTdbH(state, EvapInletDryBulb, hTinwout, RoutineName, true);
4640 10270 : FullLoadOutAirTemp = PsyTdbFnHW(FullLoadOutAirEnth, FullLoadOutAirHumRat);
4641 : // Check for saturation error and modify temperature at constant enthalpy
4642 10270 : if (FullLoadOutAirTemp < PsyTsatFnHPb(state, FullLoadOutAirEnth, state.dataEnvrn->OutBaroPress, RoutineName)) {
4643 0 : FullLoadOutAirTemp = PsyTsatFnHPb(state, FullLoadOutAirEnth, state.dataEnvrn->OutBaroPress, RoutineName);
4644 0 : FullLoadOutAirHumRat = PsyWFnTdbH(state, FullLoadOutAirTemp, FullLoadOutAirEnth, RoutineName);
4645 : }
4646 :
4647 : // Continuous fan, cycling compressor
4648 10270 : EvapOutletAirEnthalpy = ((PLR)*FullLoadOutAirEnth + (1.0 - (PLR)) * EvapInletEnthalpy);
4649 10270 : EvapOutletAirHumRat = ((PLR)*FullLoadOutAirHumRat + (1.0 - (PLR)) * EvapInletHumRat);
4650 10270 : EvapOutletAirTemp = PsyTdbFnHW(EvapOutletAirEnthalpy, EvapOutletAirHumRat);
4651 10270 : if (EvapOutletAirTemp < PsyTsatFnHPb(state, EvapOutletAirEnthalpy, state.dataEnvrn->OutBaroPress, RoutineName)) {
4652 0 : EvapOutletAirTemp = PsyTsatFnHPb(state, EvapOutletAirEnthalpy, state.dataEnvrn->OutBaroPress, RoutineName);
4653 0 : EvapOutletAirHumRat = PsyWFnTdbH(state, EvapOutletAirTemp, EvapOutletAirEnthalpy, RoutineName);
4654 : }
4655 :
4656 10270 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).Temp = EvapOutletAirTemp;
4657 10270 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).HumRat = EvapOutletAirHumRat;
4658 10270 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).Enthalpy = EvapOutletAirEnthalpy;
4659 10270 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).MassFlowRate = EvapAirMassFlow;
4660 10270 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).MassFlowRateMinAvail =
4661 10270 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).MassFlowRateMinAvail;
4662 10270 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).MassFlowRateMaxAvail =
4663 10270 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).MassFlowRateMaxAvail;
4664 10270 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingPower =
4665 10270 : ElecCoolingPower + state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).AncillaryControlsPower;
4666 10270 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingEnergy =
4667 10270 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingPower * TimeStepSys * DataGlobalConstants::SecInHour;
4668 10270 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RuntimeFraction = RuntimeFraction;
4669 10270 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingRate = TotCap * RuntimeFraction; // double check this
4670 10270 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingEnergy =
4671 10270 : TotCap * RuntimeFraction * TimeStepSys * DataGlobalConstants::SecInHour;
4672 10270 : MinAirHumRat = min(state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).HumRat,
4673 10270 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).HumRat);
4674 10270 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingRate =
4675 10270 : EvapAirMassFlow * (PsyHFnTdbW(EvapInletDryBulb, MinAirHumRat) - PsyHFnTdbW(EvapOutletAirTemp, MinAirHumRat));
4676 20540 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingRate >
4677 10270 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingRate) {
4678 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingRate =
4679 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingRate;
4680 : }
4681 10270 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingEnergy =
4682 10270 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingRate * TimeStepSys * DataGlobalConstants::SecInHour;
4683 10270 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapLatCoolingRate =
4684 20540 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingRate -
4685 10270 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingRate;
4686 10270 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapLatCoolingEnergy =
4687 10270 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapLatCoolingRate * TimeStepSys * DataGlobalConstants::SecInHour;
4688 :
4689 10270 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotTES =
4690 10270 : TotCap * RuntimeFraction + ElecCoolingPower; // all heat rejection into storage
4691 :
4692 : } else { // coil is off; just pass through conditions
4693 4987 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotTES = 0.0;
4694 :
4695 4987 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingPower =
4696 4987 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).AncillaryControlsPower;
4697 4987 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingEnergy =
4698 4987 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElecCoolingPower * TimeStepSys * DataGlobalConstants::SecInHour;
4699 4987 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RuntimeFraction = 0.0;
4700 :
4701 4987 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).RuntimeFraction = 0.0;
4702 4987 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingRate = 0.0;
4703 4987 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapTotCoolingEnergy = 0.0;
4704 4987 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingRate = 0.0;
4705 4987 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapSensCoolingEnergy = 0.0;
4706 4987 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapLatCoolingRate = 0.0;
4707 4987 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapLatCoolingEnergy = 0.0;
4708 :
4709 4987 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).Temp =
4710 4987 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).Temp;
4711 4987 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).HumRat =
4712 4987 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).HumRat;
4713 4987 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).MassFlowRate =
4714 4987 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).MassFlowRate;
4715 4987 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).MassFlowRateMinAvail =
4716 4987 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).MassFlowRateMinAvail;
4717 4987 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).MassFlowRateMaxAvail =
4718 4987 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirInletNodeNum).MassFlowRateMaxAvail;
4719 4987 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).Enthalpy =
4720 4987 : PsyHFnTdbW(state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).Temp,
4721 4987 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapAirOutletNodeNum).HumRat);
4722 : }
4723 :
4724 : // nothing happens at condenser
4725 15257 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).Temp =
4726 15257 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).Temp;
4727 15257 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).HumRat =
4728 15257 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).HumRat;
4729 15257 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).MassFlowRate = 0.0;
4730 15257 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).MassFlowRate =
4731 15257 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).MassFlowRate;
4732 15257 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).Enthalpy =
4733 15257 : PsyHFnTdbW(state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).Temp,
4734 15257 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirOutletNodeNum).HumRat);
4735 15257 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondInletTemp =
4736 15257 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).Temp;
4737 15257 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Q_TES =
4738 15257 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotTES * TimeStepSys * DataGlobalConstants::SecInHour;
4739 15257 : UpdateTEStorage(state, TESCoilNum);
4740 :
4741 15257 : UpdateColdWeatherProtection(state, TESCoilNum);
4742 :
4743 15257 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserType == TESCondenserType::Evap) {
4744 6069 : UpdateEvaporativeCondenserBasinHeater(state, TESCoilNum);
4745 12138 : UpdateEvaporativeCondenserWaterUse(
4746 : state,
4747 : TESCoilNum,
4748 6069 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum).HumRat,
4749 6069 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondAirInletNodeNum);
4750 : }
4751 15257 : }
4752 :
4753 64047 : void UpdateTEStorage(EnergyPlusData &state, int const TESCoilNum)
4754 : {
4755 :
4756 : // SUBROUTINE INFORMATION:
4757 : // AUTHOR <author>
4758 : // DATE WRITTEN <date_written>
4759 : // MODIFIED na
4760 : // RE-ENGINEERED na
4761 :
4762 64047 : switch (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageMedia) {
4763 16945 : case MediaType::Water:
4764 : case MediaType::UserDefindFluid:
4765 16945 : CalcTESWaterStorageTank(state, TESCoilNum);
4766 16945 : break;
4767 47102 : case MediaType::Ice:
4768 47102 : CalcTESIceStorageTank(state, TESCoilNum);
4769 47102 : break;
4770 0 : default:
4771 0 : break;
4772 : }
4773 64047 : }
4774 :
4775 16945 : void CalcTESWaterStorageTank(EnergyPlusData &state, int const TESCoilNum)
4776 : {
4777 :
4778 : // SUBROUTINE INFORMATION:
4779 : // AUTHOR <author>
4780 : // DATE WRITTEN <date_written>
4781 : // MODIFIED na
4782 : // RE-ENGINEERED na
4783 :
4784 : // Using/Aliasing
4785 16945 : auto &SysTimeElapsed = state.dataHVACGlobal->SysTimeElapsed;
4786 16945 : auto &TimeStepSys = state.dataHVACGlobal->TimeStepSys;
4787 : using FluidProperties::GetDensityGlycol;
4788 : using FluidProperties::GetSpecificHeatGlycol;
4789 : using WaterThermalTanks::WaterThermalTankData;
4790 :
4791 : // SUBROUTINE PARAMETER DEFINITIONS:
4792 : static constexpr std::string_view RoutineName("CalcTESWaterStorageTank");
4793 : static constexpr std::string_view calcTESIceStorageTank("CalcTESIceStorageTank");
4794 :
4795 : Real64 TimeElapsed; // Fraction of the current hour that has elapsed (h)
4796 : Real64 AmbientTemp; // Current ambient air temperature around tank (C)
4797 : Real64 TankMass; // Mass of water in tank (kg)
4798 : Real64 LossCoeff; // Loss coefficient to ambient environment (W/K)
4799 : Real64 TankTemp; // Instantaneous tank temperature (C)
4800 : Real64 NewTankTemp; // Predicted new tank temperature (C)
4801 : Real64 CpTank; // Specific heat of water in tank (J/kg K)
4802 : Real64 UseInletTemp; // Use side inlet temperature (C)
4803 : Real64 UseMassFlowRate; // Use side flow rate, including effectiveness factor (kg/s)
4804 : Real64 SourceInletTemp; // Source side inlet temperature (C)
4805 : Real64 SourceMassFlowRate; // Source side flow rate, including effectiveness factor (kg/s)
4806 : Real64 TimeRemaining; // Time remaining in the current timestep (s)
4807 : Real64 CpPlantConnection; // Specific heat of fluid in plant connection (J/kg K)
4808 : Real64 deltaTsum; // Change in integrated tank temperature, dividing by time gives the average (C s)
4809 : Real64 SecInTimeStep; // Seconds in one timestep (s)
4810 : Real64 rho; // density of water in tank (kg/m3)
4811 : Real64 QdotTES; // heat exchange directly into tank from charging system [W]
4812 : Real64 NewOutletTemp; // calculated new tankoutlet temp (C)
4813 :
4814 16945 : SecInTimeStep = TimeStepSys * DataGlobalConstants::SecInHour;
4815 16945 : TimeRemaining = SecInTimeStep;
4816 :
4817 16945 : TimeElapsed = state.dataGlobal->HourOfDay + state.dataGlobal->TimeStep * state.dataGlobal->TimeStepZone + SysTimeElapsed;
4818 :
4819 16945 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TimeElapsed != TimeElapsed) {
4820 2840 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).FluidTankTempFinalLastTimestep =
4821 2840 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).FluidTankTempFinal;
4822 2840 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TimeElapsed = TimeElapsed;
4823 : }
4824 :
4825 16945 : TankTemp = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).FluidTankTempFinalLastTimestep;
4826 16945 : AmbientTemp = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageAmbientNodeNum).Temp;
4827 16945 : UseInletTemp = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantInletNodeNum).Temp;
4828 16945 : SourceInletTemp = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).FluidTankTempFinalLastTimestep;
4829 33890 : rho = GetDensityGlycol(state,
4830 16945 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageFluidName,
4831 : TankTemp,
4832 16945 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageFluidIndex,
4833 : RoutineName);
4834 16945 : TankMass = rho * state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).FluidStorageVolume;
4835 33890 : CpTank = GetSpecificHeatGlycol(state,
4836 16945 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageFluidName,
4837 : TankTemp,
4838 16945 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageFluidIndex,
4839 : RoutineName);
4840 :
4841 16945 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantConnectionAvailable) {
4842 33890 : UseMassFlowRate = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantInletNodeNum).MassFlowRate *
4843 16945 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantEffectiveness;
4844 : } else {
4845 0 : UseMassFlowRate = 0.0;
4846 : }
4847 16945 : SourceMassFlowRate = 0.0;
4848 16945 : LossCoeff = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageUA;
4849 16945 : QdotTES = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotTES;
4850 :
4851 16945 : NewTankTemp = WaterThermalTanks::WaterThermalTankData::CalcTankTemp(TankTemp,
4852 : AmbientTemp,
4853 : UseInletTemp,
4854 : SourceInletTemp,
4855 : TankMass,
4856 : CpTank,
4857 : UseMassFlowRate,
4858 : SourceMassFlowRate,
4859 : LossCoeff,
4860 : QdotTES,
4861 : TimeRemaining);
4862 :
4863 16945 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).FluidTankTempFinal = NewTankTemp;
4864 :
4865 16945 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantConnectionAvailable) {
4866 16945 : CpPlantConnection =
4867 50835 : GetSpecificHeatGlycol(state,
4868 16945 : state.dataPlnt->PlantLoop(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantLoopNum).FluidName,
4869 16945 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantInletNodeNum).Temp,
4870 16945 : state.dataPlnt->PlantLoop(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantLoopNum).FluidIndex,
4871 : calcTESIceStorageTank);
4872 :
4873 16945 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotPlant =
4874 16945 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantInletNodeNum).MassFlowRate *
4875 16945 : CpPlantConnection * state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantEffectiveness * (UseInletTemp - NewTankTemp);
4876 16945 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Q_Plant =
4877 16945 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotPlant * TimeStepSys * DataGlobalConstants::SecInHour;
4878 : // now get correct outlet temp with actual massflow (not modified by effectiveness)
4879 16945 : if (state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantInletNodeNum).MassFlowRate >
4880 : DataBranchAirLoopPlant::MassFlowTolerance) {
4881 16924 : NewOutletTemp =
4882 : UseInletTemp -
4883 33848 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotPlant /
4884 16924 : (state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantInletNodeNum).MassFlowRate *
4885 : CpPlantConnection);
4886 : } else {
4887 21 : NewOutletTemp = UseInletTemp;
4888 : }
4889 16945 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantOutletNodeNum).Temp = NewOutletTemp;
4890 : }
4891 :
4892 16945 : deltaTsum = WaterThermalTankData::CalcTempIntegral(TankTemp,
4893 : NewTankTemp,
4894 : AmbientTemp,
4895 : UseInletTemp,
4896 : SourceInletTemp,
4897 : TankMass,
4898 : CpTank,
4899 : UseMassFlowRate,
4900 : SourceMassFlowRate,
4901 : LossCoeff,
4902 : QdotTES,
4903 : TimeRemaining);
4904 16945 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotAmbient = (LossCoeff * (AmbientTemp * TimeRemaining - deltaTsum)) / SecInTimeStep;
4905 16945 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Q_Ambient =
4906 16945 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotAmbient * TimeStepSys * DataGlobalConstants::SecInHour;
4907 16945 : }
4908 :
4909 47102 : void CalcTESIceStorageTank(EnergyPlusData &state, int const TESCoilNum)
4910 : {
4911 :
4912 : // SUBROUTINE INFORMATION:
4913 : // AUTHOR <author>
4914 : // DATE WRITTEN <date_written>
4915 : // MODIFIED na
4916 : // RE-ENGINEERED na
4917 :
4918 : // Using/Aliasing
4919 47102 : auto &SysTimeElapsed = state.dataHVACGlobal->SysTimeElapsed;
4920 47102 : auto &TimeStepSys = state.dataHVACGlobal->TimeStepSys;
4921 : using FluidProperties::GetSpecificHeatGlycol;
4922 :
4923 : // SUBROUTINE PARAMETER DEFINITIONS:
4924 47102 : constexpr Real64 FreezingTemp(0.0); // zero degrees C
4925 : static constexpr std::string_view RoutineName("CalcTESIceStorageTank");
4926 :
4927 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
4928 : Real64 Cp; // local specific heat
4929 : Real64 QdotIce; // local rate of heat transfer to ice (negative cooling) [W]
4930 : Real64 TimeElapsed; // Fraction of the current hour that has elapsed (h)
4931 : Real64 NewOutletTemp; // calculated new tank outlet temp (C)
4932 :
4933 47102 : TimeElapsed = state.dataGlobal->HourOfDay + state.dataGlobal->TimeStep * state.dataGlobal->TimeStepZone + SysTimeElapsed;
4934 :
4935 47102 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TimeElapsed != TimeElapsed) {
4936 8520 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).IceFracRemainLastTimestep =
4937 8520 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).IceFracRemain;
4938 8520 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TimeElapsed = TimeElapsed;
4939 : }
4940 :
4941 : // update plant connection (if any)
4942 47102 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantConnectionAvailable) {
4943 0 : Cp = GetSpecificHeatGlycol(state,
4944 0 : state.dataPlnt->PlantLoop(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantLoopNum).FluidName,
4945 0 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantInletNodeNum).Temp,
4946 0 : state.dataPlnt->PlantLoop(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantLoopNum).FluidIndex,
4947 : RoutineName);
4948 :
4949 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotPlant =
4950 0 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantInletNodeNum).MassFlowRate * Cp *
4951 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantEffectiveness *
4952 0 : (state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantInletNodeNum).Temp - FreezingTemp);
4953 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Q_Plant =
4954 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotPlant * TimeStepSys * DataGlobalConstants::SecInHour;
4955 : // now get correct outlet temp with actual massflow (not modified by effectiveness)
4956 0 : if (state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantInletNodeNum).MassFlowRate >
4957 : DataBranchAirLoopPlant::MassFlowTolerance) {
4958 0 : NewOutletTemp =
4959 0 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantInletNodeNum).Temp +
4960 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotPlant /
4961 0 : (state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantInletNodeNum).MassFlowRate * Cp);
4962 : } else {
4963 0 : NewOutletTemp = state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantInletNodeNum).Temp;
4964 : }
4965 0 : state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).TESPlantOutletNodeNum).Temp = NewOutletTemp;
4966 : } else {
4967 47102 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotPlant = 0.0;
4968 47102 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Q_Plant = 0.0;
4969 : }
4970 :
4971 : // update ambient heat transfer
4972 :
4973 47102 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotAmbient =
4974 94204 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageUA *
4975 47102 : (state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageAmbientNodeNum).Temp - FreezingTemp);
4976 47102 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).Q_Ambient =
4977 47102 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotAmbient * TimeStepSys * DataGlobalConstants::SecInHour;
4978 :
4979 141306 : QdotIce = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotPlant +
4980 47102 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotAmbient +
4981 47102 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).QdotTES;
4982 :
4983 47102 : if (QdotIce < 0.0) { // charging ice level
4984 17161 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).IceFracRemain =
4985 34322 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).IceFracRemainLastTimestep +
4986 34322 : std::abs(QdotIce) /
4987 17161 : (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).IceStorageCapacity / (TimeStepSys * DataGlobalConstants::SecInHour));
4988 17161 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).IceFracRemain > 1.0)
4989 2764 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).IceFracRemain = 1.0;
4990 : } else { // not charging,but discharging
4991 29941 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).IceFracRemain =
4992 59882 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).IceFracRemainLastTimestep -
4993 29941 : QdotIce / (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).IceStorageCapacity / (TimeStepSys * DataGlobalConstants::SecInHour));
4994 29941 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).IceFracRemain < 0.0)
4995 4187 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).IceFracRemain = 0.0;
4996 : }
4997 47102 : }
4998 :
4999 64047 : void UpdateColdWeatherProtection(EnergyPlusData &state, int const TESCoilNum)
5000 : {
5001 :
5002 : // SUBROUTINE INFORMATION:
5003 : // AUTHOR B. Griffith
5004 : // DATE WRITTEN April 2013
5005 : // MODIFIED na
5006 : // RE-ENGINEERED na
5007 :
5008 : // Using/Aliasing
5009 : using ScheduleManager::GetCurrentScheduleValue;
5010 :
5011 128094 : if ((state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageAmbientNodeNum).Temp <
5012 76544 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ColdWeatherMinimumTempLimit) &&
5013 12497 : (GetCurrentScheduleValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).AvailSchedNum) != 0.0)) {
5014 12497 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElectColdWeatherPower =
5015 12497 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ColdWeatherAncillaryPower;
5016 :
5017 : } else {
5018 51550 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElectColdWeatherPower = 0.0;
5019 : }
5020 64047 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElectColdWeatherEnergy =
5021 64047 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElectColdWeatherPower * state.dataHVACGlobal->TimeStepSys *
5022 : DataGlobalConstants::SecInHour;
5023 64047 : }
5024 :
5025 16071 : void UpdateEvaporativeCondenserBasinHeater(EnergyPlusData &state, int const TESCoilNum)
5026 : {
5027 :
5028 : // SUBROUTINE INFORMATION:
5029 : // AUTHOR B. Griffith
5030 : // DATE WRITTEN April 2013
5031 : // MODIFIED na
5032 : // RE-ENGINEERED na
5033 :
5034 : // PURPOSE OF THIS SUBROUTINE:
5035 : // determine basin heater electrical power and energy
5036 :
5037 : // Using/Aliasing
5038 16071 : auto &TimeStepSys = state.dataHVACGlobal->TimeStepSys;
5039 :
5040 64284 : CalcBasinHeaterPower(state,
5041 16071 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).BasinHeaterPowerFTempDiff,
5042 16071 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).BasinHeaterAvailSchedNum,
5043 16071 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).BasinHeaterSetpointTemp,
5044 16071 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElectEvapCondBasinHeaterPower);
5045 :
5046 16071 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElectEvapCondBasinHeaterEnergy =
5047 16071 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElectEvapCondBasinHeaterPower * TimeStepSys * DataGlobalConstants::SecInHour;
5048 16071 : }
5049 :
5050 16067 : void UpdateEvaporativeCondenserWaterUse(EnergyPlusData &state, int const TESCoilNum, Real64 const HumRatAfterEvap, int const InletNodeNum)
5051 : {
5052 :
5053 : // SUBROUTINE INFORMATION:
5054 : // AUTHOR B. Griffith
5055 : // DATE WRITTEN June 2013
5056 : // MODIFIED na
5057 : // RE-ENGINEERED na
5058 :
5059 : // PURPOSE OF THIS SUBROUTINE:
5060 : // update and calculate water consumption for evaporatively cooled condensers
5061 :
5062 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
5063 : Real64 AvailWaterRate;
5064 : Real64 RhoWater;
5065 :
5066 16067 : RhoWater = RhoH2O(state.dataLoopNodes->Node(InletNodeNum).Temp);
5067 16067 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapWaterConsumpRate =
5068 32134 : (HumRatAfterEvap - state.dataLoopNodes->Node(InletNodeNum).HumRat) * state.dataLoopNodes->Node(InletNodeNum).MassFlowRate / RhoWater *
5069 16067 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserRuntimeFraction;
5070 :
5071 : // Set the demand request for supply water from water storage tank (if needed)
5072 16067 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapWaterSupplyMode == EvapWaterSupply::WaterSupplyFromTank) {
5073 0 : state.dataWaterData->WaterStorage(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapWaterSupTankID)
5074 0 : .VdotRequestDemand(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapWaterTankDemandARRID) =
5075 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapWaterConsumpRate;
5076 : }
5077 :
5078 : // check if should be starved by restricted flow from tank
5079 16067 : if (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapWaterSupplyMode == EvapWaterSupply::WaterSupplyFromTank) {
5080 0 : AvailWaterRate = state.dataWaterData->WaterStorage(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapWaterSupTankID)
5081 0 : .VdotAvailDemand(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapWaterTankDemandARRID);
5082 0 : if (AvailWaterRate < state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapWaterConsumpRate) {
5083 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapWaterStarvMakupRate =
5084 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapWaterConsumpRate - AvailWaterRate;
5085 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapWaterConsumpRate = AvailWaterRate;
5086 : } else {
5087 0 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapWaterStarvMakupRate = 0.0;
5088 : }
5089 : }
5090 :
5091 16067 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapWaterConsump =
5092 16067 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapWaterConsumpRate * state.dataHVACGlobal->TimeStepSys *
5093 : DataGlobalConstants::SecInHour;
5094 16067 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapWaterStarvMakup =
5095 16067 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapWaterStarvMakupRate * state.dataHVACGlobal->TimeStepSys *
5096 : DataGlobalConstants::SecInHour;
5097 16067 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapCondPumpElecPower =
5098 32134 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapCondPumpElecNomPower *
5099 16067 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).CondenserRuntimeFraction;
5100 16067 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapCondPumpElecConsumption =
5101 16067 : state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).EvapCondPumpElecPower * state.dataHVACGlobal->TimeStepSys *
5102 : DataGlobalConstants::SecInHour;
5103 16067 : }
5104 :
5105 4 : void GetTESCoilIndex(
5106 : EnergyPlusData &state, std::string const &CoilName, int &CoilIndex, bool &ErrorsFound, std::string_view const CurrentModuleObject)
5107 : {
5108 :
5109 : // SUBROUTINE INFORMATION:
5110 : // AUTHOR Richard Raustad
5111 : // DATE WRITTEN August 2013
5112 : // MODIFIED na
5113 : // RE-ENGINEERED na
5114 :
5115 : // PURPOSE OF THIS SUBROUTINE:
5116 : // This subroutine sets an index for a given TES Cooling Coil -- issues error message if that
5117 : // coil is not a legal TES Cooling Coil.
5118 :
5119 : // Obtains and allocates TESCoil related parameters from input file
5120 4 : if (state.dataPackagedThermalStorageCoil->GetTESInputFlag) { // First time subroutine has been called, get input data
5121 1 : GetTESCoilInput(state);
5122 1 : state.dataPackagedThermalStorageCoil->GetTESInputFlag =
5123 : false; // Set logic flag to disallow getting the input data on future calls to this subroutine
5124 : }
5125 :
5126 4 : if (state.dataPackagedThermalStorageCoil->NumTESCoils > 0) {
5127 4 : CoilIndex = UtilityRoutines::FindItem(CoilName, state.dataPackagedThermalStorageCoil->TESCoil);
5128 : } else {
5129 0 : CoilIndex = 0;
5130 : }
5131 :
5132 4 : if (CoilIndex == 0) {
5133 0 : if (!CurrentModuleObject.empty()) {
5134 0 : ShowSevereError(state, fmt::format("{}, GetTESCoilIndex: TES Cooling Coil not found={}", CurrentModuleObject, CoilName));
5135 : } else {
5136 0 : ShowSevereError(state, "GetTESCoilIndex: TES Cooling Coil not found=" + CoilName);
5137 : }
5138 0 : ErrorsFound = true;
5139 : }
5140 4 : }
5141 :
5142 0 : void GetTESCoilAirInletNode(
5143 : EnergyPlusData &state, std::string const &CoilName, int &CoilAirInletNode, bool &ErrorsFound, std::string const &CurrentModuleObject)
5144 : {
5145 :
5146 : // SUBROUTINE INFORMATION:
5147 : // AUTHOR Richard Raustad
5148 : // DATE WRITTEN July 2015
5149 : // MODIFIED na
5150 : // RE-ENGINEERED na
5151 :
5152 : // PURPOSE OF THIS SUBROUTINE:
5153 : // This subroutine gets a given TES Cooling Coil's air inlet node -- issues error message if that
5154 : // coil is not a legal TES Cooling Coil and sets air node to 0, otherwise, returns inlet air node number.
5155 :
5156 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
5157 : int CoilIndex;
5158 :
5159 : // Obtains and allocates TESCoil related parameters from input file
5160 0 : if (state.dataPackagedThermalStorageCoil->GetTESInputFlag) { // First time subroutine has been called, get input data
5161 0 : GetTESCoilInput(state);
5162 0 : state.dataPackagedThermalStorageCoil->GetTESInputFlag =
5163 : false; // Set logic flag to disallow getting the input data on future calls to this subroutine
5164 : }
5165 :
5166 0 : if (state.dataPackagedThermalStorageCoil->NumTESCoils > 0) {
5167 0 : CoilIndex =
5168 0 : UtilityRoutines::FindItem(CoilName, state.dataPackagedThermalStorageCoil->TESCoil, state.dataPackagedThermalStorageCoil->NumTESCoils);
5169 : } else {
5170 0 : CoilIndex = 0;
5171 : }
5172 :
5173 0 : if (CoilIndex == 0) {
5174 0 : ShowSevereError(state, CurrentModuleObject + ", GetTESCoilAirInletNode: TES Cooling Coil not found=" + CoilName);
5175 0 : ErrorsFound = true;
5176 0 : CoilAirInletNode = 0;
5177 : } else {
5178 0 : CoilAirInletNode = state.dataPackagedThermalStorageCoil->TESCoil(CoilIndex).EvapAirInletNodeNum;
5179 : }
5180 0 : }
5181 :
5182 0 : void GetTESCoilAirOutletNode(
5183 : EnergyPlusData &state, std::string const &CoilName, int &CoilAirOutletNode, bool &ErrorsFound, std::string const &CurrentModuleObject)
5184 : {
5185 :
5186 : // SUBROUTINE INFORMATION:
5187 : // AUTHOR Richard Raustad
5188 : // DATE WRITTEN July 2015
5189 : // MODIFIED na
5190 : // RE-ENGINEERED na
5191 :
5192 : // PURPOSE OF THIS SUBROUTINE:
5193 : // This subroutine gets a given TES Cooling Coil's air outlet node -- issues error message if that
5194 : // coil is not a legal TES Cooling Coil and sets air node to 0, otherwise, returns outlet air node number.
5195 :
5196 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
5197 : int CoilIndex;
5198 :
5199 : // Obtains and allocates TESCoil related parameters from input file
5200 0 : if (state.dataPackagedThermalStorageCoil->GetTESInputFlag) { // First time subroutine has been called, get input data
5201 0 : GetTESCoilInput(state);
5202 0 : state.dataPackagedThermalStorageCoil->GetTESInputFlag =
5203 : false; // Set logic flag to disallow getting the input data on future calls to this subroutine
5204 : }
5205 :
5206 0 : if (state.dataPackagedThermalStorageCoil->NumTESCoils > 0) {
5207 0 : CoilIndex =
5208 0 : UtilityRoutines::FindItem(CoilName, state.dataPackagedThermalStorageCoil->TESCoil, state.dataPackagedThermalStorageCoil->NumTESCoils);
5209 : } else {
5210 0 : CoilIndex = 0;
5211 : }
5212 :
5213 0 : if (CoilIndex == 0) {
5214 0 : ShowSevereError(state, CurrentModuleObject + ", GetTESCoilAirOutletNode: TES Cooling Coil not found=" + CoilName);
5215 0 : ErrorsFound = true;
5216 0 : CoilAirOutletNode = 0;
5217 : } else {
5218 0 : CoilAirOutletNode = state.dataPackagedThermalStorageCoil->TESCoil(CoilIndex).EvapAirOutletNodeNum;
5219 : }
5220 0 : }
5221 :
5222 4 : void GetTESCoilCoolingCapacity(
5223 : EnergyPlusData &state, std::string const &CoilName, Real64 &CoilCoolCapacity, bool &ErrorsFound, std::string const &CurrentModuleObject)
5224 : {
5225 :
5226 : // SUBROUTINE INFORMATION:
5227 : // AUTHOR Richard Raustad
5228 : // DATE WRITTEN July 2015
5229 : // MODIFIED na
5230 : // RE-ENGINEERED na
5231 :
5232 : // PURPOSE OF THIS SUBROUTINE:
5233 : // This subroutine gets a given TES Cooling Coil's cooling only capacity -- issues error message if that
5234 : // coil is not a legal TES Cooling Coil and sets capacity to 0, otherwise, returns cooling capacity.
5235 :
5236 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
5237 : int CoilIndex;
5238 :
5239 : // Obtains and allocates TESCoil related parameters from input file
5240 4 : if (state.dataPackagedThermalStorageCoil->GetTESInputFlag) { // First time subroutine has been called, get input data
5241 0 : GetTESCoilInput(state);
5242 0 : state.dataPackagedThermalStorageCoil->GetTESInputFlag =
5243 : false; // Set logic flag to disallow getting the input data on future calls to this subroutine
5244 : }
5245 :
5246 4 : if (state.dataPackagedThermalStorageCoil->NumTESCoils > 0) {
5247 4 : CoilIndex =
5248 4 : UtilityRoutines::FindItem(CoilName, state.dataPackagedThermalStorageCoil->TESCoil, state.dataPackagedThermalStorageCoil->NumTESCoils);
5249 : } else {
5250 0 : CoilIndex = 0;
5251 : }
5252 :
5253 4 : if (CoilIndex == 0) {
5254 0 : ShowSevereError(state, CurrentModuleObject + ", GetTESCoilCoolingCapacity: TES Cooling Coil not found=" + CoilName);
5255 0 : ErrorsFound = true;
5256 0 : CoilCoolCapacity = 0.0;
5257 : } else {
5258 4 : if (state.dataPackagedThermalStorageCoil->TESCoil(CoilIndex).CoolingOnlyModeIsAvailable) { // get input data for this mode
5259 4 : CoilCoolCapacity = state.dataPackagedThermalStorageCoil->TESCoil(CoilIndex).CoolingOnlyRatedTotCap;
5260 0 : } else if (state.dataPackagedThermalStorageCoil->TESCoil(CoilIndex).CoolingAndChargeModeAvailable) {
5261 0 : CoilCoolCapacity = state.dataPackagedThermalStorageCoil->TESCoil(CoilIndex).CoolingAndChargeRatedTotCap;
5262 0 : } else if (state.dataPackagedThermalStorageCoil->TESCoil(CoilIndex).CoolingAndDischargeModeAvailable) {
5263 0 : CoilCoolCapacity = state.dataPackagedThermalStorageCoil->TESCoil(CoilIndex).CoolingAndDischargeRatedTotCap;
5264 : } else {
5265 0 : CoilCoolCapacity = 0.0;
5266 : }
5267 : }
5268 4 : }
5269 :
5270 0 : void GetTESCoilCoolingAirFlowRate(
5271 : EnergyPlusData &state, std::string const &CoilName, Real64 &CoilCoolAirFlow, bool &ErrorsFound, std::string const &CurrentModuleObject)
5272 : {
5273 :
5274 : // SUBROUTINE INFORMATION:
5275 : // AUTHOR Richard Raustad
5276 : // DATE WRITTEN September 2015
5277 : // MODIFIED na
5278 : // RE-ENGINEERED na
5279 :
5280 : // PURPOSE OF THIS SUBROUTINE:
5281 : // This subroutine gets a given TES Cooling Coil's evaporator air flow rate -- issues error message if that
5282 : // coil is not a legal TES Cooling Coil and sets air flow to 0, otherwise, returns cooling air flow rate.
5283 :
5284 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
5285 : int CoilIndex;
5286 :
5287 : // Obtains and allocates TESCoil related parameters from input file
5288 0 : if (state.dataPackagedThermalStorageCoil->GetTESInputFlag) { // First time subroutine has been called, get input data
5289 0 : GetTESCoilInput(state);
5290 0 : state.dataPackagedThermalStorageCoil->GetTESInputFlag =
5291 : false; // Set logic flag to disallow getting the input data on future calls to this subroutine
5292 : }
5293 :
5294 0 : if (state.dataPackagedThermalStorageCoil->NumTESCoils > 0) {
5295 0 : CoilIndex =
5296 0 : UtilityRoutines::FindItem(CoilName, state.dataPackagedThermalStorageCoil->TESCoil, state.dataPackagedThermalStorageCoil->NumTESCoils);
5297 : } else {
5298 0 : CoilIndex = 0;
5299 : }
5300 :
5301 0 : if (CoilIndex == 0) {
5302 0 : ShowSevereError(state, CurrentModuleObject + ", GetTESCoilCoolingCapacity: TES Cooling Coil not found=" + CoilName);
5303 0 : ErrorsFound = true;
5304 0 : CoilCoolAirFlow = 0.0;
5305 : } else {
5306 0 : CoilCoolAirFlow = state.dataPackagedThermalStorageCoil->TESCoil(CoilIndex).RatedEvapAirVolFlowRate;
5307 : }
5308 0 : }
5309 :
5310 2313 : } // namespace EnergyPlus::PackagedThermalStorageCoil
|