Line data Source code
1 : // EnergyPlus, Copyright (c) 1996-2024, 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 <array>
50 : #include <cassert>
51 : #include <cmath>
52 : #include <string>
53 :
54 : // ObjexxFCL Headers
55 : #include <ObjexxFCL/Array.functions.hh>
56 : #include <ObjexxFCL/Fmath.hh>
57 :
58 : // EnergyPlus Headers
59 : #include <EnergyPlus/Autosizing/All_Simple_Sizing.hh>
60 : #include <EnergyPlus/Autosizing/CoolingAirFlowSizing.hh>
61 : #include <EnergyPlus/Autosizing/CoolingCapacitySizing.hh>
62 : #include <EnergyPlus/Autosizing/HeatingAirFlowSizing.hh>
63 : #include <EnergyPlus/Autosizing/HeatingCapacitySizing.hh>
64 : #include <EnergyPlus/Autosizing/SystemAirFlowSizing.hh>
65 : #include <EnergyPlus/Autosizing/WaterHeatingCapacitySizing.hh>
66 : #include <EnergyPlus/BranchNodeConnections.hh>
67 : #include <EnergyPlus/CurveManager.hh>
68 : #include <EnergyPlus/DXCoils.hh>
69 : #include <EnergyPlus/Data/EnergyPlusData.hh>
70 : #include <EnergyPlus/DataAirSystems.hh>
71 : #include <EnergyPlus/DataDefineEquip.hh>
72 : #include <EnergyPlus/DataGlobalConstants.hh>
73 : #include <EnergyPlus/DataHVACGlobals.hh>
74 : #include <EnergyPlus/DataHeatBalFanSys.hh>
75 : #include <EnergyPlus/DataHeatBalance.hh>
76 : #include <EnergyPlus/DataIPShortCuts.hh>
77 : #include <EnergyPlus/DataLoopNode.hh>
78 : #include <EnergyPlus/DataSizing.hh>
79 : #include <EnergyPlus/DataZoneControls.hh>
80 : #include <EnergyPlus/DataZoneEnergyDemands.hh>
81 : #include <EnergyPlus/DataZoneEquipment.hh>
82 : #include <EnergyPlus/EMSManager.hh>
83 : #include <EnergyPlus/Fans.hh>
84 : #include <EnergyPlus/FluidProperties.hh>
85 : #include <EnergyPlus/General.hh>
86 : #include <EnergyPlus/GeneralRoutines.hh>
87 : #include <EnergyPlus/GlobalNames.hh>
88 : #include <EnergyPlus/HVACVariableRefrigerantFlow.hh>
89 : #include <EnergyPlus/HeatingCoils.hh>
90 : #include <EnergyPlus/InputProcessing/InputProcessor.hh>
91 : #include <EnergyPlus/MixedAir.hh>
92 : #include <EnergyPlus/NodeInputManager.hh>
93 : #include <EnergyPlus/OutAirNodeManager.hh>
94 : #include <EnergyPlus/OutputProcessor.hh>
95 : #include <EnergyPlus/Plant/DataPlant.hh>
96 : #include <EnergyPlus/Plant/PlantLocation.hh>
97 : #include <EnergyPlus/PlantUtilities.hh>
98 : #include <EnergyPlus/Psychrometrics.hh>
99 : #include <EnergyPlus/ScheduleManager.hh>
100 : #include <EnergyPlus/SteamCoils.hh>
101 : #include <EnergyPlus/UnitarySystem.hh>
102 : #include <EnergyPlus/UtilityRoutines.hh>
103 : #include <EnergyPlus/WaterCoils.hh>
104 : #include <EnergyPlus/WaterManager.hh>
105 : #include <EnergyPlus/ZoneTempPredictorCorrector.hh>
106 :
107 : namespace EnergyPlus::HVACVariableRefrigerantFlow {
108 : // Module containing the Variable Refrigerant Flow (VRF or VRV) simulation routines
109 :
110 : // MODULE INFORMATION:
111 : // AUTHOR Richard Raustad, FSEC
112 : // DATE WRITTEN August 2010
113 : // MODIFIED Apr 2012, R. Raustad, FSEC, Added Heat Recovery Operating Mode
114 : // Jul 2015, RP Zhang, XF Pang, LBNL, Added a new physics based VRF model applicable for Fluid Temperature Control
115 : // RE-ENGINEERED na
116 :
117 : // PURPOSE OF THIS MODULE:
118 : // To encapsulate the data and algorithms required to
119 : // manage the VRF System Component
120 :
121 : using namespace DataZoneEnergyDemands;
122 : using namespace Psychrometrics;
123 : using namespace DataPlant;
124 :
125 : constexpr std::array<std::string_view, (int)TUType::Num> tuTypeNames = {"ZoneHVAC:TerminalUnit:VariableRefrigerantFlow"};
126 :
127 250981 : void SimulateVRF(EnergyPlusData &state,
128 : std::string_view CompName,
129 : bool const FirstHVACIteration,
130 : int const ZoneNum,
131 : int &CompIndex,
132 : bool &HeatingActive,
133 : bool &CoolingActive,
134 : int const OAUnitNum, // If the system is an equipment of OutdoorAirUnit
135 : Real64 const OAUCoilOutTemp, // the coil inlet temperature of OutdoorAirUnit
136 : bool const ZoneEquipment, // TRUE if called as zone equipment
137 : Real64 &SysOutputProvided,
138 : Real64 &LatOutputProvided)
139 : {
140 :
141 : // SUBROUTINE INFORMATION:
142 : // AUTHOR Richard Raustad, FSEC
143 : // DATE WRITTEN August 2010
144 : // MODIFIED Jul 2015, RP Zhang (LBNL), XF Pang (LBNL), Y Yura (Daikin Inc). Add a physics-based VRF model applicable for Fluid
145 : // Temperature Control RE-ENGINEERED na
146 :
147 : // PURPOSE OF THIS SUBROUTINE:
148 : // This subroutine manages VRF terminal unit simulation.
149 :
150 : // METHODOLOGY EMPLOYED:
151 : // Simulate all terminal units
152 : // Once all terminal units have been simulated, simulate VRF condenser
153 :
154 : int VRFTUNum; // current VRF system terminal unit index
155 : int VRFCondenser; // index to VRF AC system object - AirConditioner:VariableRefrigerantFlow
156 : int TUListNum; // index to VRF AC system terminal unit list
157 : int IndexToTUInTUList; // index to pointer in VRF AC system terminal unit list
158 : Real64 OnOffAirFlowRatio; // ratio of compressor ON airflow to average airflow over timestep
159 : int DXCoolingCoilIndex; // index to this terminal units DX cooling coil
160 : int DXHeatingCoilIndex; // index to this terminal units DX heating coil
161 : Real64 QZnReq;
162 :
163 : // Obtains and Allocates VRF system related parameters from input file
164 250981 : if (state.dataHVACVarRefFlow->GetVRFInputFlag) { // First time subroutine has been entered
165 12 : GetVRFInput(state);
166 12 : state.dataHVACVarRefFlow->GetVRFInputFlag = false;
167 : }
168 :
169 : // CompIndex accounting
170 250981 : if (CompIndex == 0) {
171 62 : VRFTUNum = Util::FindItemInList(CompName, state.dataHVACVarRefFlow->VRFTU);
172 62 : if (VRFTUNum == 0) {
173 0 : ShowFatalError(state, format("SimulateVRF: VRF Terminal Unit not found={}", CompName));
174 : }
175 62 : CompIndex = VRFTUNum;
176 :
177 : } else {
178 250919 : VRFTUNum = CompIndex;
179 250919 : if (VRFTUNum > state.dataHVACVarRefFlow->NumVRFTU || VRFTUNum < 1) {
180 0 : ShowFatalError(state,
181 0 : format("SimulateVRF: Invalid CompIndex passed={}, Number of VRF Terminal Units = {}, VRF Terminal Unit name = {}",
182 : VRFTUNum,
183 0 : state.dataHVACVarRefFlow->NumVRFTU,
184 : CompName));
185 : }
186 250919 : if (state.dataHVACVarRefFlow->CheckEquipName(VRFTUNum)) {
187 62 : if (!CompName.empty() && CompName != state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name) {
188 0 : ShowFatalError(state,
189 0 : format("SimulateVRF: Invalid CompIndex passed={}, VRF Terminal Unit name={}, stored VRF TU Name for that index={}",
190 : VRFTUNum,
191 : CompName,
192 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name));
193 : }
194 62 : state.dataHVACVarRefFlow->CheckEquipName(VRFTUNum) = false;
195 : }
196 : }
197 :
198 : // the VRF condenser index
199 250981 : VRFCondenser = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum;
200 :
201 266057 : if ((state.dataHVACVarRefFlow->VRF(VRFCondenser).CondenserType == DataHeatBalance::RefrigCondenserType::Water) &&
202 15076 : (state.dataHVACVarRefFlow->VRF(VRFCondenser).checkPlantCondTypeOneTime)) {
203 : // scan for loop connection data
204 1 : bool errFlag = false;
205 3 : PlantUtilities::ScanPlantLoopsForObject(state,
206 1 : state.dataHVACVarRefFlow->VRF(VRFCondenser).Name,
207 1 : state.dataHVACVarRefFlow->VRF(VRFCondenser).VRFType,
208 1 : state.dataHVACVarRefFlow->VRF(VRFCondenser).SourcePlantLoc,
209 : errFlag,
210 : _,
211 : _,
212 : _,
213 1 : state.dataHVACVarRefFlow->VRF(VRFCondenser).CondenserNodeNum,
214 : _);
215 :
216 1 : if (errFlag) {
217 0 : ShowSevereError(state, "GetVRFInput: Error scanning for plant loop data");
218 : }
219 :
220 1 : state.dataHVACVarRefFlow->VRF(VRFCondenser).checkPlantCondTypeOneTime = false;
221 : }
222 :
223 : // the terminal unit list object index
224 250981 : TUListNum = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex;
225 : // the entry number in the terminal unit list (which item in the terminal unit list, e.g. second in list)
226 250981 : IndexToTUInTUList = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).IndexToTUInTUList;
227 : // index to cooling coil (coil is optional but at least one must be present)
228 250981 : DXCoolingCoilIndex = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex;
229 : // index to heating coil (coil is optional but at least one must be present)
230 250981 : DXHeatingCoilIndex = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex;
231 250981 : QZnReq = 0.0;
232 :
233 : // Initialize terminal unit
234 250981 : InitVRF(state, VRFTUNum, ZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); // Initialize all VRFTU related parameters
235 :
236 : // Simulate terminal unit
237 250981 : SimVRF(state, VRFTUNum, FirstHVACIteration, OnOffAirFlowRatio, SysOutputProvided, LatOutputProvided, QZnReq);
238 :
239 : // mark this terminal unit as simulated
240 250981 : state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).IsSimulated(IndexToTUInTUList) = true;
241 :
242 : // keep track of individual coil loads
243 250981 : if (DXCoolingCoilIndex > 0) {
244 250981 : state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(IndexToTUInTUList) =
245 250981 : state.dataDXCoils->DXCoilTotalCooling(DXCoolingCoilIndex);
246 : } else {
247 0 : state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(IndexToTUInTUList) = 0.0;
248 : }
249 250981 : if (DXHeatingCoilIndex > 0) {
250 250981 : state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(IndexToTUInTUList) =
251 250981 : state.dataDXCoils->DXCoilTotalHeating(DXHeatingCoilIndex);
252 : } else {
253 0 : state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(IndexToTUInTUList) = 0.0;
254 : }
255 :
256 : // Report the current VRF terminal unit
257 250981 : ReportVRFTerminalUnit(state, VRFTUNum);
258 :
259 250981 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TotalCoolingRate > 0.0) CoolingActive = true;
260 250981 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TotalHeatingRate > 0.0) HeatingActive = true;
261 :
262 : // make sure all TU in a list are able to get simulated, otherwise condenser is never simulated **
263 : // either fatal on GetInput, or keep track of unused TU's and set their respective flag to TRUE **
264 : // after all VRF terminal units have been simulated, call the VRF condenser model
265 250981 : if (all(state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).IsSimulated)) {
266 :
267 57046 : if (state.dataHVACVarRefFlow->VRF(VRFCondenser).VRFAlgorithmType == AlgorithmType::FluidTCtrl) {
268 : // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control
269 16365 : state.dataHVACVarRefFlow->VRF(VRFCondenser).CalcVRFCondenser_FluidTCtrl(state);
270 : } else {
271 : // Algorithm Type: VRF model based on system curve
272 40681 : CalcVRFCondenser(state, VRFCondenser);
273 : }
274 :
275 57046 : ReportVRFCondenser(state, VRFCondenser);
276 :
277 57046 : if (state.dataHVACVarRefFlow->VRF(VRFCondenser).CondenserType == DataHeatBalance::RefrigCondenserType::Water)
278 3769 : UpdateVRFCondenser(state, VRFCondenser);
279 : }
280 250981 : }
281 :
282 1 : PlantComponent *VRFCondenserEquipment::factory(EnergyPlusData &state, std::string const &objectName)
283 : {
284 : // Process the input data if it hasn't been done already
285 1 : if (state.dataHVACVarRefFlow->GetVRFInputFlag) {
286 1 : GetVRFInput(state);
287 1 : state.dataHVACVarRefFlow->GetVRFInputFlag = false;
288 : }
289 : // Now look for this object in the list
290 1 : for (auto &obj : state.dataHVACVarRefFlow->VRF) {
291 1 : if (obj.Name == objectName) {
292 1 : return &obj;
293 : }
294 2 : }
295 : // If we didn't find it, fatal
296 : ShowFatalError(state, format("LocalVRFCondenserFactory: Error getting inputs for object named: {}", objectName)); // LCOV_EXCL_LINE
297 : // Shut up the compiler
298 : return nullptr; // LCOV_EXCL_LINE
299 : }
300 :
301 5 : void VRFCondenserEquipment::onInitLoopEquip(EnergyPlusData &state, [[maybe_unused]] const PlantLocation &calledFromLocation)
302 : {
303 5 : this->SizeVRFCondenser(state);
304 5 : }
305 :
306 5 : void VRFCondenserEquipment::getDesignCapacities([[maybe_unused]] EnergyPlusData &state,
307 : [[maybe_unused]] const PlantLocation &calledFromLocation,
308 : Real64 &MaxLoad,
309 : Real64 &MinLoad,
310 : Real64 &OptLoad)
311 : {
312 5 : MinLoad = 0.0;
313 5 : MaxLoad = max(this->CoolingCapacity, this->HeatingCapacity); // greater of cooling and heating capacity
314 5 : OptLoad = max(this->CoolingCapacity,
315 : this->HeatingCapacity); // connects to single loop, need to switch between cooling/heating capacity?
316 5 : }
317 :
318 15053 : void VRFCondenserEquipment::simulate(EnergyPlusData &state,
319 : const PlantLocation &calledFromLocation,
320 : bool FirstHVACIteration,
321 : [[maybe_unused]] Real64 &CurLoad,
322 : [[maybe_unused]] bool RunFlag)
323 : {
324 15053 : if (calledFromLocation.loopNum == this->SourcePlantLoc.loopNum) { // condenser loop
325 15053 : PlantUtilities::UpdateChillerComponentCondenserSide(state,
326 : this->SourcePlantLoc.loopNum,
327 : this->SourcePlantLoc.loopSideNum,
328 : PlantEquipmentType::HeatPumpVRF,
329 : this->CondenserNodeNum,
330 : this->CondenserOutletNodeNum,
331 : this->QCondenser,
332 : this->CondenserInletTemp,
333 : this->CondenserSideOutletTemp,
334 : this->WaterCondenserMassFlow,
335 : FirstHVACIteration);
336 : } else {
337 0 : ShowFatalError(state, format("SimVRFCondenserPlant:: Invalid loop connection {}", cVRFTypes(VRF_HeatPump)));
338 : }
339 15053 : }
340 :
341 40681 : void CalcVRFCondenser(EnergyPlusData &state, int const VRFCond)
342 : {
343 :
344 : // SUBROUTINE INFORMATION:
345 : // AUTHOR R. Raustad, FSEC
346 : // DATE WRITTEN September 2010
347 :
348 : // PURPOSE OF THIS SUBROUTINE:
349 : // Model the interactions of VRF terminal units with a single variable-speed condenser.
350 : // The terminal units are simulated first, and then the condenser is simulated.
351 : // If terminal units require more capacity than can be delivered by condenser, a limit is set.
352 :
353 : using Curve::CurveValue;
354 : using PlantUtilities::SetComponentFlowRate;
355 : using Psychrometrics::RhoH2O;
356 :
357 : static constexpr std::string_view RoutineName("VRFCondenser");
358 :
359 : int NumTU; // loop counter
360 :
361 : Real64 TotCoolCapTempModFac; // cooling CAPFT curve output
362 : Real64 TotHeatCapTempModFac; // heating CAPFT curve output
363 : Real64 TotCoolEIRTempModFac; // cooling EIRFT curve output
364 : Real64 TotHeatEIRTempModFac; // heating EIRFT curve output
365 : Real64 InletAirWetBulbC; // coil inlet air wet-bulb temperature (C)
366 : Real64 InletAirDryBulbC; // coil inlet air dry-bulb temperature (C)
367 40681 : Real64 CondInletTemp(0.0); // condenser inlet air temperature (C)
368 : Real64 CondInletHumRat; // condenser inlet air humidity ratio (kg/kg)
369 : Real64 OutdoorDryBulb; // outdoor dry-bulb temperature (C)
370 : Real64 OutdoorHumRat; // outdoor humidity ratio (kg/kg)
371 : Real64 OutdoorPressure; // outdoor pressure (Pa)
372 : Real64 OutdoorWetBulb; // outdoor wet-bulb temperature (C)
373 : Real64 CoolOABoundary; // output of cooling boundary curve (outdoor temperature, C)
374 : Real64 HeatOABoundary; // output of heating boundary curve (outdoor temperature, C)
375 : Real64 EIRFPLRModFac; // EIRFPLR curve output
376 : Real64 UpperStageCompressorRatio; // used for crankcase heater power calculation
377 : Real64 RhoAir; // Density of air [kg/m3]
378 : Real64 RhoWater; // Density of water [kg/m3]
379 : Real64 CpCond; // Specific Heat of water [J/kg-k]
380 : Real64 CondAirMassFlow; // Condenser air mass flow rate [kg/s]
381 : Real64 CondWaterMassFlow; // Condenser water mass flow rate [kg/s]
382 : Real64 PartLoadFraction; // Part load fraction from PLFFPLR curve
383 : Real64 VRFRTF; // VRF runtime fraction when cycling below MINPLR
384 : Real64 OutdoorCoilT; // Outdoor coil temperature (C)
385 : Real64 OutdoorCoildw; // Outdoor coil delta w assuming coil temp of OutdoorCoilT (kg/kg)
386 : Real64 FractionalDefrostTime; // Fraction of time step system is in defrost
387 : Real64 HeatingCapacityMultiplier; // Multiplier for heating capacity when system is in defrost
388 : Real64 InputPowerMultiplier; // Multiplier for power when system is in defrost
389 : Real64 LoadDueToDefrost; // Additional load due to defrost
390 : Real64 DefrostEIRTempModFac; // EIR modifier for defrost (function of entering drybulb, outside wetbulb)
391 : Real64 HRCAPFTConst; // stead-state capacity fraction
392 : Real64 HRInitialCapFrac; // Fractional cooling degradation at the start of heat recovery from cooling mode
393 : Real64 HRCapTC; // Time constant used to recover from initial degradation in cooling heat recovery
394 : Real64 HREIRFTConst; // stead-state EIR fraction
395 : Real64 HRInitialEIRFrac; // Fractional cooling degradation at the start of heat recovery from cooling mode
396 : Real64 HREIRTC; // Time constant used to recover from initial degradation in cooling heat recovery
397 : Real64 CurrentEndTime; // end time of current time step
398 : Real64 SUMultiplier; // multiplier for simulating mode changes
399 : Real64 CondPower; // condenser power [W]
400 : Real64 CondCapacity; // condenser heat rejection [W]
401 : Real64 CondOutletTemp; // Outlet temperature from VRF condenser [C]
402 : Real64 TotPower; // total condenser power use [W]
403 : bool HRHeatRequestFlag; // flag indicating VRF TU could operate in heating mode
404 : bool HRCoolRequestFlag; // flag indicating VRF TU could operate in cooling mode
405 :
406 40681 : auto &vrf = state.dataHVACVarRefFlow->VRF(VRFCond);
407 :
408 : // variable initializations
409 40681 : int TUListNum = vrf.ZoneTUListPtr;
410 40681 : int NumTUInList = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList;
411 40681 : int NumTUInCoolingMode = 0; // number of terminal units actually cooling
412 40681 : int NumTUInHeatingMode = 0; // number of terminal units actually heating
413 40681 : Real64 TUCoolingLoad = 0.0; // sum of TU's cooling coil load (W)
414 40681 : Real64 TUHeatingLoad = 0.0; // sum of TU's heating coil load (W)
415 40681 : Real64 TUParasiticPower = 0.0; // total terminal unit parasitic power (W)
416 40681 : Real64 TUFanPower = 0.0; // total terminal unit fan power (W)
417 40681 : Real64 CoolingPLR = 0.0; // condenser cooling PLR
418 40681 : Real64 HeatingPLR = 0.0; // condenser heating PLR
419 40681 : Real64 CyclingRatio = 1.0; // cycling ratio of condenser's compressors
420 40681 : Real64 SumCoolInletWB = 0.0; // sum of active TU's DX cooling coil inlet air wet-bulb temperature
421 40681 : Real64 SumHeatInletDB = 0.0; // sum of active TU's DX heating coil inlet air dry-bulb temperature
422 40681 : Real64 SumHeatInletWB = 0.0; // sum of active TU's DX heating coil inlet air wet-bulb temperature
423 40681 : Real64 TotalCondCoolingCapacity = 0.0; // total available condenser cooling capacity (W)
424 40681 : Real64 TotalCondHeatingCapacity = 0.0; // total available condenser heating capacity (W)
425 40681 : Real64 TotalTUCoolingCapacity = 0.0; // sum of TU's cooling capacity including piping losses (W)
426 40681 : Real64 TotalTUHeatingCapacity = 0.0; // sum of TU's heating capacity including piping losses (W)
427 :
428 40681 : vrf.ElecCoolingPower = 0.0;
429 40681 : vrf.ElecHeatingPower = 0.0;
430 40681 : vrf.CrankCaseHeaterPower = 0.0;
431 40681 : vrf.EvapCondPumpElecPower = 0.0;
432 40681 : vrf.EvapWaterConsumpRate = 0.0;
433 40681 : vrf.DefrostPower = 0.0;
434 40681 : vrf.OperatingCoolingCOP = 0.0;
435 40681 : vrf.OperatingHeatingCOP = 0.0;
436 40681 : vrf.OperatingCOP = 0.0;
437 40681 : vrf.SCHE = 0.0;
438 40681 : vrf.BasinHeaterPower = 0.0;
439 40681 : vrf.VRFHeatRec = 0.0;
440 :
441 : // set condenser entering air conditions
442 40681 : if (vrf.CondenserNodeNum != 0) {
443 40681 : OutdoorDryBulb = state.dataLoopNodes->Node(vrf.CondenserNodeNum).Temp;
444 40681 : if (vrf.CondenserType != DataHeatBalance::RefrigCondenserType::Water) {
445 36912 : OutdoorHumRat = state.dataLoopNodes->Node(vrf.CondenserNodeNum).HumRat;
446 36912 : OutdoorPressure = state.dataLoopNodes->Node(vrf.CondenserNodeNum).Press;
447 36912 : OutdoorWetBulb = state.dataLoopNodes->Node(vrf.CondenserNodeNum).OutAirWetBulb;
448 : } else {
449 3769 : OutdoorHumRat = state.dataEnvrn->OutHumRat;
450 3769 : OutdoorPressure = state.dataEnvrn->OutBaroPress;
451 3769 : OutdoorWetBulb = state.dataEnvrn->OutWetBulbTemp;
452 : }
453 : } else {
454 0 : OutdoorDryBulb = state.dataEnvrn->OutDryBulbTemp;
455 0 : OutdoorHumRat = state.dataEnvrn->OutHumRat;
456 0 : OutdoorPressure = state.dataEnvrn->OutBaroPress;
457 0 : OutdoorWetBulb = state.dataEnvrn->OutWetBulbTemp;
458 : }
459 :
460 40681 : if (vrf.CondenserType == DataHeatBalance::RefrigCondenserType::Air) {
461 36912 : CondInletTemp = OutdoorDryBulb; // Outdoor dry-bulb temp
462 3769 : } else if (vrf.CondenserType == DataHeatBalance::RefrigCondenserType::Evap) {
463 0 : RhoAir = PsyRhoAirFnPbTdbW(state, OutdoorPressure, OutdoorDryBulb, OutdoorHumRat);
464 0 : CondAirMassFlow = RhoAir * vrf.EvapCondAirVolFlowRate;
465 : // (Outdoor wet-bulb temp from DataEnvironment) + (1.0-EvapCondEffectiveness) * (drybulb - wetbulb)
466 0 : CondInletTemp = OutdoorWetBulb + (OutdoorDryBulb - OutdoorWetBulb) * (1.0 - vrf.EvapCondEffectiveness);
467 0 : CondInletHumRat = PsyWFnTdbTwbPb(state, CondInletTemp, OutdoorWetBulb, OutdoorPressure);
468 3769 : } else if (vrf.CondenserType == DataHeatBalance::RefrigCondenserType::Water) {
469 3769 : CondInletTemp = OutdoorDryBulb; // node inlet temp from above
470 3769 : OutdoorWetBulb = CondInletTemp; // for watercooled
471 3769 : CondWaterMassFlow = vrf.WaterCondenserDesignMassFlow;
472 : } else {
473 0 : assert(false);
474 : }
475 40681 : vrf.CondenserInletTemp = CondInletTemp;
476 :
477 : // sum loads on TU coils
478 228429 : for (NumTU = 1; NumTU <= NumTUInList; ++NumTU) {
479 187748 : TUCoolingLoad += state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU);
480 187748 : TUHeatingLoad += state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU);
481 : }
482 :
483 40681 : vrf.TUCoolingLoad = TUCoolingLoad;
484 40681 : vrf.TUHeatingLoad = TUHeatingLoad;
485 :
486 : // no need to do anything else if the terminal units are off
487 40681 : if (TUCoolingLoad == 0.0 && TUHeatingLoad == 0.0) {
488 6746 : vrf.SUMultiplier = 0.0;
489 6746 : vrf.VRFCondPLR = 0.0;
490 6746 : vrf.VRFCondRTF = 0.0;
491 6746 : vrf.VRFCondCyclingRatio = 0.0;
492 6746 : vrf.QCondenser = 0.0;
493 6746 : vrf.TotalCoolingCapacity = 0.0;
494 6746 : vrf.TotalHeatingCapacity = 0.0;
495 6746 : vrf.OperatingMode = 0.0;
496 6746 : vrf.HRHeatingActive = false;
497 6746 : vrf.HRCoolingActive = false;
498 6746 : state.dataHVACVarRefFlow->CurrentEndTimeLast = double((state.dataGlobal->DayOfSim - 1) * 24) + state.dataGlobal->CurrentTime -
499 6746 : state.dataGlobal->TimeStepZone + state.dataHVACGlobal->SysTimeElapsed;
500 6746 : if (vrf.CondenserType == DataHeatBalance::RefrigCondenserType::Water) {
501 487 : state.dataHVACVarRefFlow->CondenserWaterMassFlowRate = 0.0;
502 974 : SetComponentFlowRate(
503 487 : state, state.dataHVACVarRefFlow->CondenserWaterMassFlowRate, vrf.CondenserNodeNum, vrf.CondenserOutletNodeNum, vrf.SourcePlantLoc);
504 487 : vrf.WaterCondenserMassFlow = state.dataHVACVarRefFlow->CondenserWaterMassFlowRate;
505 487 : vrf.CondenserSideOutletTemp = CondInletTemp;
506 : }
507 6746 : return;
508 : }
509 :
510 : // switch modes if summed coil capacity shows opposite operating mode
511 : // if total TU heating exceeds total TU cooling * ( 1 + 1/COP) then system is in heating mode
512 33935 : if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond) && TUHeatingLoad > (TUCoolingLoad * (1.0 + 1.0 / vrf.CoolingCOP))) {
513 0 : state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = true;
514 0 : state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false;
515 0 : vrf.ModeChange = true;
516 0 : if (!state.dataHVACVarRefFlow->LastModeHeating(VRFCond)) {
517 0 : state.dataHVACVarRefFlow->LastModeHeating(VRFCond) = true;
518 : // reset heat recovery startup timer
519 0 : vrf.HRTimer = 0.0;
520 0 : vrf.HRHeatingActive = false;
521 0 : vrf.HRCoolingActive = false;
522 : }
523 33935 : } else if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond) && (TUCoolingLoad * (1.0 + 1.0 / vrf.CoolingCOP)) > TUHeatingLoad) {
524 1 : state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = true;
525 1 : state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false;
526 1 : vrf.ModeChange = true;
527 1 : if (!state.dataHVACVarRefFlow->LastModeCooling(VRFCond)) {
528 1 : state.dataHVACVarRefFlow->LastModeCooling(VRFCond) = true;
529 : // reset heat recovery startup timer
530 1 : vrf.HRTimer = 0.0;
531 1 : vrf.HRHeatingActive = false;
532 1 : vrf.HRCoolingActive = false;
533 : }
534 33934 : } else if (TUCoolingLoad > 0.0 && TUHeatingLoad > 0.0 &&
535 0 : ((state.dataHVACVarRefFlow->CoolingLoad(VRFCond) && state.dataHVACVarRefFlow->LastModeHeating(VRFCond)) ||
536 0 : (state.dataHVACVarRefFlow->HeatingLoad(VRFCond) && state.dataHVACVarRefFlow->LastModeCooling(VRFCond)))) {
537 0 : vrf.ModeChange = true;
538 : // reset heat recovery startup timer
539 0 : vrf.HRTimer = 0.0;
540 0 : vrf.HRHeatingActive = false;
541 0 : vrf.HRCoolingActive = false;
542 : }
543 :
544 : // loop through TU's and calculate average inlet conditions for active coils
545 190977 : for (NumTU = 1; NumTU <= NumTUInList; ++NumTU) {
546 157042 : int TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU);
547 157042 : int CoolCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex;
548 157042 : int HeatCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatCoilIndex;
549 157042 : TUParasiticPower +=
550 157042 : state.dataHVACVarRefFlow->VRFTU(TUIndex).ParasiticCoolElecPower + state.dataHVACVarRefFlow->VRFTU(TUIndex).ParasiticHeatElecPower;
551 157042 : TUFanPower += state.dataHVACVarRefFlow->VRFTU(TUIndex).FanPower;
552 :
553 157042 : if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) > 0.0) {
554 79736 : SumCoolInletWB += state.dataDXCoils->DXCoilCoolInletAirWBTemp(CoolCoilIndex) *
555 79736 : state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) / TUCoolingLoad;
556 79736 : ++NumTUInCoolingMode;
557 : }
558 157042 : if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) > 0.0) {
559 65924 : SumHeatInletDB += state.dataDXCoils->DXCoilHeatInletAirDBTemp(HeatCoilIndex) *
560 65924 : state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) / TUHeatingLoad;
561 65924 : SumHeatInletWB += state.dataDXCoils->DXCoilHeatInletAirWBTemp(HeatCoilIndex) *
562 65924 : state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) / TUHeatingLoad;
563 65924 : ++NumTUInHeatingMode;
564 : }
565 : }
566 :
567 33935 : bool CoolingCoilAvailableFlag = any(state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).CoolingCoilAvailable);
568 33935 : bool HeatingCoilAvailableFlag = any(state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).HeatingCoilAvailable);
569 :
570 : // calculate capacities and energy use
571 33935 : if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond) && CoolingCoilAvailableFlag) {
572 18818 : InletAirWetBulbC = SumCoolInletWB;
573 18818 : TotCoolCapTempModFac = CurveValue(state, vrf.CoolCapFT, InletAirWetBulbC, CondInletTemp);
574 18818 : TotCoolEIRTempModFac = CurveValue(state, vrf.CoolEIRFT, InletAirWetBulbC, CondInletTemp);
575 :
576 : // recalculate cooling Cap and EIR curve output if using boundary curve along with dual Cap and EIR curves.
577 18818 : if (vrf.CoolBoundaryCurvePtr > 0) {
578 18818 : CoolOABoundary = CurveValue(state, vrf.CoolBoundaryCurvePtr, InletAirWetBulbC);
579 18818 : if (OutdoorDryBulb > CoolOABoundary) {
580 18817 : if (vrf.CoolCapFTHi > 0) TotCoolCapTempModFac = CurveValue(state, vrf.CoolCapFTHi, InletAirWetBulbC, CondInletTemp);
581 : }
582 : }
583 18818 : if (vrf.EIRCoolBoundaryCurvePtr > 0) {
584 18818 : CoolOABoundary = CurveValue(state, vrf.EIRCoolBoundaryCurvePtr, InletAirWetBulbC);
585 18818 : if (OutdoorDryBulb > CoolOABoundary) {
586 18817 : if (vrf.CoolEIRFTHi > 0) TotCoolEIRTempModFac = CurveValue(state, vrf.CoolEIRFTHi, InletAirWetBulbC, CondInletTemp);
587 : }
588 : }
589 :
590 : // Warn user if curve output goes negative
591 18818 : if (TotCoolCapTempModFac < 0.0) {
592 0 : if (!state.dataGlobal->WarmupFlag && NumTUInCoolingMode > 0) {
593 0 : if (vrf.CoolCapFTErrorIndex == 0) {
594 0 : ShowSevereMessage(state, format("{} \"{}\":", cVRFTypes(VRF_HeatPump), vrf.Name));
595 0 : ShowContinueError(
596 : state,
597 0 : format(" Cooling Capacity Modifier curve (function of temperature) output is negative ({:.3T}).", TotCoolCapTempModFac));
598 0 : ShowContinueError(state,
599 0 : format(" Negative value occurs using an outdoor air temperature of {:.1T} C and an average indoor air "
600 : "wet-bulb temperature of {:.1T} C.",
601 : CondInletTemp,
602 : InletAirWetBulbC));
603 0 : ShowContinueErrorTimeStamp(state, " Resetting curve output to zero and continuing simulation.");
604 : }
605 0 : ShowRecurringWarningErrorAtEnd(
606 : state,
607 0 : format("{} \"{}\": Cooling Capacity Modifier curve (function of temperature) output is negative warning continues...",
608 0 : PlantEquipTypeNames[static_cast<int>(PlantEquipmentType::HeatPumpVRF)],
609 0 : vrf.Name),
610 0 : vrf.CoolCapFTErrorIndex,
611 : TotCoolCapTempModFac,
612 : TotCoolCapTempModFac);
613 0 : TotCoolCapTempModFac = 0.0;
614 : }
615 : }
616 :
617 : // Warn user if curve output goes negative
618 18818 : if (TotCoolEIRTempModFac < 0.0) {
619 0 : if (!state.dataGlobal->WarmupFlag && NumTUInCoolingMode > 0) {
620 0 : if (vrf.EIRFTempCoolErrorIndex == 0) {
621 0 : ShowSevereMessage(state, format("{} \"{}\":", cVRFTypes(VRF_HeatPump), vrf.Name));
622 0 : ShowContinueError(state,
623 0 : format(" Cooling Energy Input Ratio Modifier curve (function of temperature) output is negative ({:.3T}).",
624 : TotCoolEIRTempModFac));
625 0 : ShowContinueError(state,
626 0 : format(" Negative value occurs using an outdoor air temperature of {:.1T} C and an average indoor air "
627 : "wet-bulb temperature of {:.1T} C.",
628 : CondInletTemp,
629 : InletAirWetBulbC));
630 0 : ShowContinueErrorTimeStamp(state, " Resetting curve output to zero and continuing simulation.");
631 : }
632 0 : ShowRecurringWarningErrorAtEnd(
633 : state,
634 0 : format("{} \"{}\": Cooling Energy Input Ratio Modifier curve (function of temperature) output is negative warning continues...",
635 0 : PlantEquipTypeNames[static_cast<int>(PlantEquipmentType::HeatPumpVRF)],
636 0 : vrf.Name),
637 0 : vrf.EIRFTempCoolErrorIndex,
638 : TotCoolEIRTempModFac,
639 : TotCoolEIRTempModFac);
640 0 : TotCoolEIRTempModFac = 0.0;
641 : }
642 : }
643 :
644 18818 : TotalCondCoolingCapacity = vrf.CoolingCapacity * state.dataHVACVarRefFlow->CoolCombinationRatio(VRFCond) * TotCoolCapTempModFac;
645 18818 : TotalTUCoolingCapacity = TotalCondCoolingCapacity * vrf.PipingCorrectionCooling;
646 :
647 18818 : if (TotalCondCoolingCapacity > 0.0) {
648 18818 : CoolingPLR = (TUCoolingLoad / vrf.PipingCorrectionCooling) / TotalCondCoolingCapacity;
649 : } else {
650 0 : CoolingPLR = 0.0;
651 : }
652 :
653 : // Warn user if curve output goes negative
654 18818 : if (TotCoolCapTempModFac < 0.0) {
655 0 : if (!state.dataGlobal->WarmupFlag && NumTUInCoolingMode > 0) {
656 0 : if (vrf.CoolCapFTErrorIndex == 0) {
657 0 : ShowSevereMessage(state, format("{} \"{}\":", cVRFTypes(VRF_HeatPump), vrf.Name));
658 0 : ShowContinueError(
659 : state,
660 0 : format(" Cooling Capacity Modifier curve (function of temperature) output is negative ({:.3T}).", TotCoolCapTempModFac));
661 0 : ShowContinueError(state,
662 0 : format(" Negative value occurs using an outdoor air temperature of {:.1T} C and an average indoor air "
663 : "wet-bulb temperature of {:.1T} C.",
664 : CondInletTemp,
665 : InletAirWetBulbC));
666 0 : ShowContinueErrorTimeStamp(state, " Resetting curve output to zero and continuing simulation.");
667 : }
668 0 : ShowRecurringWarningErrorAtEnd(
669 : state,
670 0 : format("{} \"{}\": Cooling Capacity Modifier curve (function of temperature) output is negative warning continues...",
671 0 : PlantEquipTypeNames[static_cast<int>(PlantEquipmentType::HeatPumpVRF)],
672 0 : vrf.Name),
673 0 : vrf.CoolCapFTErrorIndex,
674 : TotCoolCapTempModFac,
675 : TotCoolCapTempModFac);
676 0 : TotCoolCapTempModFac = 0.0;
677 : }
678 : }
679 : // Warn user if curve output goes negative
680 18818 : if (TotCoolEIRTempModFac < 0.0) {
681 0 : if (!state.dataGlobal->WarmupFlag && NumTUInCoolingMode > 0) {
682 0 : if (vrf.EIRFTempCoolErrorIndex == 0) {
683 0 : ShowSevereMessage(state, format("{} \"{}\":", cVRFTypes(VRF_HeatPump), vrf.Name));
684 0 : ShowContinueError(state,
685 0 : format(" Cooling Energy Input Ratio Modifier curve (function of temperature) output is negative ({:.3T}).",
686 : TotCoolEIRTempModFac));
687 0 : ShowContinueError(state,
688 0 : format(" Negative value occurs using an outdoor air temperature of {:.1T} C and an average indoor air "
689 : "wet-bulb temperature of {:.1T} C.",
690 : CondInletTemp,
691 : InletAirWetBulbC));
692 0 : ShowContinueErrorTimeStamp(state, " Resetting curve output to zero and continuing simulation.");
693 : }
694 0 : ShowRecurringWarningErrorAtEnd(
695 : state,
696 0 : format("{} \"{}\": Cooling Energy Input Ratio Modifier curve (function of temperature) output is negative warning continues...",
697 0 : PlantEquipTypeNames[static_cast<int>(PlantEquipmentType::HeatPumpVRF)],
698 0 : vrf.Name),
699 0 : vrf.EIRFTempCoolErrorIndex,
700 : TotCoolEIRTempModFac,
701 : TotCoolEIRTempModFac);
702 0 : TotCoolEIRTempModFac = 0.0;
703 : }
704 : }
705 :
706 15117 : } else if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond) && HeatingCoilAvailableFlag) {
707 15112 : InletAirDryBulbC = SumHeatInletDB;
708 15112 : InletAirWetBulbC = SumHeatInletWB;
709 15112 : switch (vrf.HeatingPerformanceOATType) {
710 1453 : case HVAC::OATType::DryBulb: {
711 1453 : TotHeatCapTempModFac = CurveValue(state, vrf.HeatCapFT, InletAirDryBulbC, CondInletTemp);
712 1453 : TotHeatEIRTempModFac = CurveValue(state, vrf.HeatEIRFT, InletAirDryBulbC, CondInletTemp);
713 1453 : } break;
714 13659 : case HVAC::OATType::WetBulb: {
715 13659 : TotHeatCapTempModFac = CurveValue(state, vrf.HeatCapFT, InletAirDryBulbC, OutdoorWetBulb);
716 13659 : TotHeatEIRTempModFac = CurveValue(state, vrf.HeatEIRFT, InletAirDryBulbC, OutdoorWetBulb);
717 13659 : } break;
718 0 : default: {
719 0 : TotHeatCapTempModFac = 1.0;
720 0 : TotHeatEIRTempModFac = 1.0;
721 0 : } break;
722 : }
723 : // recalculate heating Cap and EIR curve output if using boundary curve along with dual Cap and EIR curves.
724 15112 : if (vrf.HeatBoundaryCurvePtr > 0) {
725 15112 : HeatOABoundary = CurveValue(state, vrf.HeatBoundaryCurvePtr, InletAirDryBulbC);
726 15112 : switch (vrf.HeatingPerformanceOATType) {
727 1453 : case HVAC::OATType::DryBulb: {
728 1453 : if (OutdoorDryBulb > HeatOABoundary) {
729 1453 : if (vrf.HeatCapFTHi > 0) TotHeatCapTempModFac = CurveValue(state, vrf.HeatCapFTHi, InletAirDryBulbC, CondInletTemp);
730 : }
731 1453 : } break;
732 13659 : case HVAC::OATType::WetBulb: {
733 13659 : if (OutdoorWetBulb > HeatOABoundary) {
734 2670 : if (vrf.HeatCapFTHi > 0) TotHeatCapTempModFac = CurveValue(state, vrf.HeatCapFTHi, InletAirDryBulbC, OutdoorWetBulb);
735 : }
736 13659 : } break;
737 0 : default: {
738 0 : TotHeatCapTempModFac = 1.0;
739 0 : } break;
740 : }
741 : }
742 15112 : if (vrf.EIRHeatBoundaryCurvePtr > 0) {
743 15112 : HeatOABoundary = CurveValue(state, vrf.EIRHeatBoundaryCurvePtr, InletAirDryBulbC);
744 15112 : switch (vrf.HeatingPerformanceOATType) {
745 1453 : case HVAC::OATType::DryBulb: {
746 1453 : if (OutdoorDryBulb > HeatOABoundary) {
747 1453 : if (vrf.HeatEIRFTHi > 0) TotHeatEIRTempModFac = CurveValue(state, vrf.HeatEIRFTHi, InletAirDryBulbC, CondInletTemp);
748 : }
749 1453 : } break;
750 13659 : case HVAC::OATType::WetBulb: {
751 13659 : if (OutdoorWetBulb > HeatOABoundary) {
752 2670 : if (vrf.HeatEIRFTHi > 0) TotHeatEIRTempModFac = CurveValue(state, vrf.HeatEIRFTHi, InletAirDryBulbC, OutdoorWetBulb);
753 : }
754 13659 : } break;
755 0 : default: {
756 0 : TotHeatEIRTempModFac = 1.0;
757 0 : } break;
758 : }
759 : }
760 :
761 : // Warn user if curve output goes negative
762 15112 : if (TotHeatCapTempModFac < 0.0) {
763 0 : if (!state.dataGlobal->WarmupFlag && NumTUInHeatingMode > 0) {
764 0 : if (vrf.HeatCapFTErrorIndex == 0) {
765 0 : ShowSevereMessage(state, format("{} \"{}\":", cVRFTypes(VRF_HeatPump), vrf.Name));
766 0 : ShowContinueError(
767 : state,
768 0 : format(" Heating Capacity Modifier curve (function of temperature) output is negative ({:.3T}).", TotHeatCapTempModFac));
769 :
770 0 : switch (vrf.HeatingPerformanceOATType) {
771 0 : case HVAC::OATType::DryBulb: {
772 0 : ShowContinueError(state,
773 0 : format(" Negative value occurs using an outdoor air temperature of {:.1T} C and an average indoor air "
774 : "dry-bulb temperature of {:.1T} C.",
775 : CondInletTemp,
776 : InletAirDryBulbC));
777 0 : } break;
778 0 : case HVAC::OATType::WetBulb: {
779 0 : ShowContinueError(state,
780 0 : format(" Negative value occurs using an outdoor air wet-bulb temperature of {:.1T} C and an average "
781 : "indoor air wet-bulb temperature of {:.1T} C.",
782 : OutdoorWetBulb,
783 : InletAirWetBulbC));
784 0 : } break;
785 0 : default:
786 : // should never get here
787 0 : break;
788 : }
789 :
790 0 : ShowContinueErrorTimeStamp(state, " Resetting curve output to zero and continuing simulation.");
791 : }
792 0 : ShowRecurringWarningErrorAtEnd(
793 : state,
794 0 : format("{} \"{}\": Heating Capacity Ratio Modifier curve (function of temperature) output is negative warning continues...",
795 0 : PlantEquipTypeNames[static_cast<int>(PlantEquipmentType::HeatPumpVRF)],
796 0 : vrf.Name),
797 0 : vrf.HeatCapFTErrorIndex,
798 : TotHeatCapTempModFac,
799 : TotHeatCapTempModFac);
800 0 : TotHeatCapTempModFac = 0.0;
801 : }
802 : }
803 : // Warn user if curve output goes negative
804 15112 : if (TotHeatEIRTempModFac < 0.0) {
805 0 : if (!state.dataGlobal->WarmupFlag && NumTUInHeatingMode > 0) {
806 0 : if (vrf.EIRFTempHeatErrorIndex == 0) {
807 0 : ShowSevereMessage(state, format("{} \"{}\":", cVRFTypes(VRF_HeatPump), vrf.Name));
808 0 : ShowContinueError(state,
809 0 : format(" Heating Energy Input Ratio Modifier curve (function of temperature) output is negative ({:.3T}).",
810 : TotHeatEIRTempModFac));
811 0 : switch (vrf.HeatingPerformanceOATType) {
812 0 : case HVAC::OATType::DryBulb: {
813 0 : ShowContinueError(state,
814 0 : format(" Negative value occurs using an outdoor air dry-bulb temperature of {:.1T} C and an "
815 : "average indoor air dry-bulb temperature of {:.1T} C.",
816 : CondInletTemp,
817 : InletAirDryBulbC));
818 0 : } break;
819 0 : case HVAC::OATType::WetBulb: {
820 0 : ShowContinueError(state,
821 0 : format(" Negative value occurs using an outdoor air wet-bulb temperature of {:.1T} C and an "
822 : "average indoor air wet-bulb temperature of {:.1T} C.",
823 : OutdoorWetBulb,
824 : InletAirWetBulbC));
825 0 : } break;
826 0 : default:
827 0 : break;
828 : }
829 0 : ShowContinueErrorTimeStamp(state, " Resetting curve output to zero and continuing simulation.");
830 : }
831 0 : ShowRecurringWarningErrorAtEnd(
832 : state,
833 0 : format("{} \"{}\": Heating Energy Input Ratio Modifier curve (function of temperature) output is negative warning continues...",
834 0 : PlantEquipTypeNames[static_cast<int>(PlantEquipmentType::HeatPumpVRF)],
835 0 : vrf.Name),
836 0 : vrf.EIRFTempHeatErrorIndex,
837 : TotHeatEIRTempModFac,
838 : TotHeatEIRTempModFac);
839 0 : TotHeatEIRTempModFac = 0.0;
840 : }
841 : }
842 :
843 : // Initializing defrost adjustment factors
844 15112 : LoadDueToDefrost = 0.0;
845 15112 : HeatingCapacityMultiplier = 1.0;
846 15112 : FractionalDefrostTime = 0.0;
847 15112 : InputPowerMultiplier = 1.0;
848 :
849 : // Check outdoor temperature to determine of defrost is active
850 15112 : if (OutdoorDryBulb <= vrf.MaxOATDefrost && vrf.CondenserType != DataHeatBalance::RefrigCondenserType::Water) {
851 :
852 : // Calculating adjustment factors for defrost
853 : // Calculate delta w through outdoor coil by assuming a coil temp of 0.82*DBT-9.7(F) per DOE2.1E
854 2871 : OutdoorCoilT = 0.82 * OutdoorDryBulb - 8.589;
855 2871 : OutdoorCoildw = max(1.0e-6, (OutdoorHumRat - PsyWFnTdpPb(state, OutdoorCoilT, OutdoorPressure)));
856 :
857 : // Calculate defrost adjustment factors depending on defrost control type
858 2871 : if (vrf.DefrostControl == StandardRatings::HPdefrostControl::Timed) {
859 2871 : FractionalDefrostTime = vrf.DefrostFraction;
860 2871 : if (FractionalDefrostTime > 0.0) {
861 2871 : HeatingCapacityMultiplier = 0.909 - 107.33 * OutdoorCoildw;
862 2871 : InputPowerMultiplier = 0.90 - 36.45 * OutdoorCoildw;
863 : }
864 : } else { // else defrost control is on-demand
865 0 : FractionalDefrostTime = 1.0 / (1.0 + 0.01446 / OutdoorCoildw);
866 0 : HeatingCapacityMultiplier = 0.875 * (1.0 - FractionalDefrostTime);
867 0 : InputPowerMultiplier = 0.954 * (1.0 - FractionalDefrostTime);
868 : }
869 :
870 2871 : if (FractionalDefrostTime > 0.0) {
871 : // Calculate defrost adjustment factors depending on defrost control strategy
872 2871 : if (vrf.DefrostStrategy == StandardRatings::DefrostStrat::ReverseCycle) {
873 0 : LoadDueToDefrost = (0.01 * FractionalDefrostTime) * (7.222 - OutdoorDryBulb) * (vrf.HeatingCapacity / 1.01667);
874 0 : DefrostEIRTempModFac = CurveValue(state, vrf.DefrostEIRPtr, max(15.555, InletAirWetBulbC), max(15.555, OutdoorDryBulb));
875 :
876 : // Warn user if curve output goes negative
877 0 : if (DefrostEIRTempModFac < 0.0) {
878 0 : if (!state.dataGlobal->WarmupFlag) {
879 0 : if (vrf.DefrostHeatErrorIndex == 0) {
880 0 : ShowSevereMessage(state, format("{} \"{}\":", cVRFTypes(VRF_HeatPump), vrf.Name));
881 0 : ShowContinueError(
882 : state,
883 0 : format(" Defrost Energy Input Ratio Modifier curve (function of temperature) output is negative ({:.3T}).",
884 : DefrostEIRTempModFac));
885 0 : ShowContinueError(state,
886 0 : format(" Negative value occurs using an outdoor air dry-bulb temperature of {:.1T} C and an "
887 : "average indoor air wet-bulb temperature of {:.1T} C.",
888 : OutdoorDryBulb,
889 : InletAirWetBulbC));
890 0 : ShowContinueErrorTimeStamp(state, " Resetting curve output to zero and continuing simulation.");
891 : }
892 0 : ShowRecurringWarningErrorAtEnd(state,
893 0 : format("{} \"{}\": Defrost Energy Input Ratio Modifier curve (function of temperature) "
894 : "output is negative warning continues...",
895 0 : PlantEquipTypeNames[static_cast<int>(PlantEquipmentType::HeatPumpVRF)],
896 0 : vrf.Name),
897 0 : vrf.DefrostHeatErrorIndex,
898 : DefrostEIRTempModFac,
899 : DefrostEIRTempModFac);
900 0 : DefrostEIRTempModFac = 0.0;
901 : }
902 : }
903 :
904 0 : vrf.DefrostPower = DefrostEIRTempModFac * (vrf.HeatingCapacity / 1.01667) * FractionalDefrostTime;
905 :
906 : } else { // Defrost strategy is resistive
907 2871 : vrf.DefrostPower = vrf.DefrostCapacity * FractionalDefrostTime;
908 : }
909 : }
910 : }
911 :
912 15112 : TotalCondHeatingCapacity =
913 15112 : vrf.HeatingCapacity * state.dataHVACVarRefFlow->HeatCombinationRatio(VRFCond) * TotHeatCapTempModFac * HeatingCapacityMultiplier;
914 15112 : TotalTUHeatingCapacity = TotalCondHeatingCapacity * vrf.PipingCorrectionHeating;
915 15112 : if (TotalCondHeatingCapacity > 0.0) {
916 15112 : HeatingPLR = (TUHeatingLoad / vrf.PipingCorrectionHeating) / TotalCondHeatingCapacity;
917 15112 : HeatingPLR += (LoadDueToDefrost * HeatingPLR) / TotalCondHeatingCapacity;
918 : } else {
919 0 : HeatingPLR = 0.0;
920 : }
921 : }
922 :
923 33935 : vrf.VRFCondPLR = max(CoolingPLR, HeatingPLR);
924 33935 : Real64 tmpVRFCondPLR = 0.0;
925 33935 : if (CoolingPLR > 0.0 || HeatingPLR > 0.0) tmpVRFCondPLR = max(vrf.MinPLR, vrf.VRFCondPLR);
926 :
927 33935 : HRHeatRequestFlag = any(state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).HRHeatRequest);
928 33935 : HRCoolRequestFlag = any(state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).HRCoolRequest);
929 33935 : HREIRFTConst = 1.0;
930 33935 : Real64 HREIRAdjustment = 1.0;
931 :
932 33935 : if (!state.dataGlobal->DoingSizing && !state.dataGlobal->WarmupFlag) {
933 4784 : if (HRHeatRequestFlag && HRCoolRequestFlag) {
934 : // determine operating mode change
935 0 : if (!vrf.HRCoolingActive && !vrf.HRHeatingActive) {
936 0 : vrf.ModeChange = true;
937 0 : vrf.HRTimer = 0.0;
938 : }
939 0 : if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond)) {
940 0 : if (vrf.HRHeatingActive && !vrf.HRCoolingActive) {
941 0 : vrf.HRModeChange = true;
942 : }
943 0 : vrf.HRCoolingActive = true;
944 0 : vrf.HRHeatingActive = false;
945 0 : int HRCAPFT = vrf.HRCAPFTCool; // Index to cool capacity as a function of temperature\PLR curve for heat recovery
946 0 : if (HRCAPFT > 0) {
947 : // VRF(VRFCond)%HRCAPFTCoolConst = 0.9d0 ! initialized to 0.9
948 0 : if (state.dataCurveManager->PerfCurve(vrf.HRCAPFTCool)->numDims == 2) { // Curve type for HRCAPFTCool
949 0 : vrf.HRCAPFTCoolConst = CurveValue(state, HRCAPFT, InletAirWetBulbC, CondInletTemp);
950 : } else {
951 0 : vrf.HRCAPFTCoolConst = CurveValue(state, HRCAPFT, tmpVRFCondPLR);
952 : }
953 : }
954 0 : HRCAPFTConst = vrf.HRCAPFTCoolConst;
955 0 : HRInitialCapFrac = vrf.HRInitialCoolCapFrac; // Fractional cooling degradation at the start of heat recovery from cooling mode
956 0 : HRCapTC = vrf.HRCoolCapTC; // Time constant used to recover from initial degradation in cooling heat recovery
957 :
958 0 : int HREIRFT = vrf.HREIRFTCool; // Index to cool EIR as a function of temperature curve for heat recovery
959 0 : if (HREIRFT > 0) {
960 : // VRF(VRFCond)%HREIRFTCoolConst = 1.1d0 ! initialized to 1.1
961 0 : if (state.dataCurveManager->PerfCurve(vrf.HREIRFTCool)->numDims == 2) { // Curve type for HREIRFTCool
962 0 : vrf.HREIRFTCoolConst = CurveValue(state, HREIRFT, InletAirWetBulbC, CondInletTemp);
963 : } else {
964 0 : vrf.HREIRFTCoolConst = CurveValue(state, HREIRFT, tmpVRFCondPLR);
965 : }
966 : }
967 0 : HREIRFTConst = vrf.HREIRFTCoolConst;
968 0 : HRInitialEIRFrac = vrf.HRInitialCoolEIRFrac; // Fractional cooling degradation at the start of heat recovery from cooling mode
969 0 : HREIRTC = vrf.HRCoolEIRTC; // Time constant used to recover from initial degradation in cooling heat recovery
970 0 : } else if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond)) {
971 0 : if (!vrf.HRHeatingActive && vrf.HRCoolingActive) {
972 0 : vrf.HRModeChange = true;
973 : }
974 0 : vrf.HRCoolingActive = false;
975 0 : vrf.HRHeatingActive = true;
976 0 : int HRCAPFT = vrf.HRCAPFTHeat; // Index to heat capacity as a function of temperature\PLR curve for heat recovery
977 0 : if (HRCAPFT > 0) {
978 : // VRF(VRFCond)%HRCAPFTHeatConst = 1.1d0 ! initialized to 1.1
979 0 : if (state.dataCurveManager->PerfCurve(vrf.HRCAPFTHeat)->numDims == 2) { // Curve type for HRCAPFTCool
980 0 : switch (vrf.HeatingPerformanceOATType) {
981 0 : case HVAC::OATType::DryBulb: {
982 0 : vrf.HRCAPFTHeatConst = CurveValue(state, HRCAPFT, InletAirDryBulbC, CondInletTemp);
983 0 : } break;
984 0 : case HVAC::OATType::WetBulb: {
985 0 : vrf.HRCAPFTHeatConst = CurveValue(state, HRCAPFT, InletAirDryBulbC, OutdoorWetBulb);
986 0 : } break;
987 0 : default: {
988 0 : vrf.HRCAPFTHeatConst = 1.0;
989 0 : } break;
990 : }
991 : } else {
992 0 : vrf.HRCAPFTHeatConst = CurveValue(state, HRCAPFT, tmpVRFCondPLR);
993 : }
994 : }
995 0 : HRCAPFTConst = vrf.HRCAPFTHeatConst;
996 0 : HRInitialCapFrac = vrf.HRInitialHeatCapFrac; // Fractional heating degradation at the start of heat recovery from cooling mode
997 0 : HRCapTC = vrf.HRHeatCapTC; // Time constant used to recover from initial degradation in heating heat recovery
998 :
999 0 : int HREIRFT = vrf.HREIRFTHeat; // Index to cool EIR as a function of temperature curve for heat recovery
1000 0 : if (HREIRFT > 0) {
1001 : // VRF(VRFCond)%HREIRFTCoolConst = 1.1d0 ! initialized to 1.1
1002 0 : if (state.dataCurveManager->PerfCurve(vrf.HREIRFTHeat)->numDims == 2) { // Curve type for HREIRFTHeat
1003 0 : switch (vrf.HeatingPerformanceOATType) {
1004 0 : case HVAC::OATType::DryBulb: {
1005 0 : vrf.HREIRFTHeatConst = CurveValue(state, HREIRFT, InletAirDryBulbC, CondInletTemp);
1006 0 : } break;
1007 0 : case HVAC::OATType::WetBulb: {
1008 0 : vrf.HREIRFTHeatConst = CurveValue(state, HREIRFT, InletAirDryBulbC, OutdoorWetBulb);
1009 0 : } break;
1010 0 : default: {
1011 0 : vrf.HREIRFTHeatConst = 1.0;
1012 0 : } break;
1013 : }
1014 : } else {
1015 0 : vrf.HREIRFTHeatConst = CurveValue(state, HREIRFT, tmpVRFCondPLR);
1016 : }
1017 : }
1018 0 : HREIRFTConst = vrf.HREIRFTHeatConst;
1019 0 : HRInitialEIRFrac = vrf.HRInitialHeatEIRFrac; // Fractional heating degradation at the start of heat recovery from heating mode
1020 0 : HREIRTC = vrf.HRHeatEIRTC; // Time constant used to recover from initial degradation in heating heat recovery
1021 : } else {
1022 : // zone thermostats satisfied, condenser is off. Set values anyway
1023 0 : HRCAPFTConst = 1.0;
1024 0 : HRInitialCapFrac = 1.0;
1025 0 : HRCapTC = 1.0;
1026 0 : HREIRFTConst = 1.0;
1027 0 : HRInitialEIRFrac = 1.0;
1028 0 : HREIRTC = 1.0;
1029 0 : if (vrf.HRHeatingActive || vrf.HRCoolingActive) {
1030 0 : vrf.HRModeChange = true;
1031 : }
1032 0 : vrf.HRCoolingActive = false;
1033 0 : vrf.HRHeatingActive = false;
1034 : }
1035 :
1036 0 : } else { // IF(HRHeatRequestFlag .AND. HRCoolRequestFlag)THEN -- Heat recovery turned off
1037 4784 : HRCAPFTConst = 1.0;
1038 4784 : HRInitialCapFrac = 1.0;
1039 4784 : HRCapTC = 0.0;
1040 4784 : HREIRFTConst = 1.0;
1041 4784 : HRInitialEIRFrac = 1.0;
1042 4784 : HREIRTC = 0.0;
1043 4784 : vrf.HRModeChange = false;
1044 4784 : vrf.HRCoolingActive = false;
1045 4784 : vrf.HRHeatingActive = false;
1046 4784 : vrf.HRTimer = 0.0;
1047 : }
1048 :
1049 : // Calculate the capacity modification factor (SUMultiplier) for the HR mode transition period
1050 4784 : CurrentEndTime = double((state.dataGlobal->DayOfSim - 1) * 24) + state.dataGlobal->CurrentTime - state.dataGlobal->TimeStepZone +
1051 4784 : state.dataHVACGlobal->SysTimeElapsed;
1052 :
1053 4784 : if (vrf.ModeChange || vrf.HRModeChange) {
1054 0 : if (vrf.HRCoolingActive && vrf.HRTimer == 0.0) {
1055 0 : vrf.HRTimer = state.dataHVACVarRefFlow->CurrentEndTimeLast;
1056 0 : } else if (vrf.HRHeatingActive && vrf.HRTimer == 0.0) {
1057 0 : vrf.HRTimer = state.dataHVACVarRefFlow->CurrentEndTimeLast;
1058 0 : } else if (!vrf.HRCoolingActive && !vrf.HRHeatingActive) {
1059 0 : vrf.HRTimer = 0.0;
1060 : }
1061 : }
1062 :
1063 4784 : vrf.HRTime = max(0.0, CurrentEndTime - vrf.HRTimer);
1064 4784 : if (vrf.HRTime < (HRCapTC * 5.0)) {
1065 0 : if (HRCapTC > 0.0) {
1066 0 : SUMultiplier = min(1.0, 1.0 - std::exp(-vrf.HRTime / HRCapTC));
1067 : } else {
1068 0 : SUMultiplier = 1.0;
1069 : }
1070 : } else {
1071 4784 : SUMultiplier = 1.0;
1072 4784 : vrf.ModeChange = false;
1073 4784 : vrf.HRModeChange = false;
1074 : }
1075 4784 : vrf.SUMultiplier = SUMultiplier;
1076 :
1077 4784 : state.dataHVACVarRefFlow->CurrentEndTimeLast = CurrentEndTime;
1078 :
1079 4784 : if (vrf.HeatRecoveryUsed && vrf.HRCoolingActive) {
1080 0 : TotalCondCoolingCapacity *= HRCAPFTConst;
1081 0 : TotalCondCoolingCapacity =
1082 0 : HRInitialCapFrac * TotalCondCoolingCapacity + (1.0 - HRInitialCapFrac) * TotalCondCoolingCapacity * SUMultiplier;
1083 0 : TotalTUCoolingCapacity = TotalCondCoolingCapacity * vrf.PipingCorrectionCooling;
1084 0 : if (TotalCondCoolingCapacity > 0.0) {
1085 0 : CoolingPLR = min(1.0, (TUCoolingLoad / vrf.PipingCorrectionCooling) / TotalCondCoolingCapacity);
1086 : } else {
1087 0 : CoolingPLR = 0.0;
1088 : }
1089 0 : HREIRAdjustment = HRInitialEIRFrac + (HREIRFTConst - HRInitialEIRFrac) * SUMultiplier;
1090 0 : vrf.VRFHeatRec = TUHeatingLoad;
1091 4784 : } else if (vrf.HeatRecoveryUsed && vrf.HRHeatingActive) {
1092 0 : TotalCondHeatingCapacity *= HRCAPFTConst;
1093 0 : TotalCondHeatingCapacity =
1094 0 : HRInitialCapFrac * TotalCondHeatingCapacity + (1.0 - HRInitialCapFrac) * TotalCondHeatingCapacity * SUMultiplier;
1095 0 : TotalTUHeatingCapacity = TotalCondHeatingCapacity * vrf.PipingCorrectionHeating;
1096 0 : if (TotalCondHeatingCapacity > 0.0) {
1097 0 : HeatingPLR = min(1.0, (TUHeatingLoad / vrf.PipingCorrectionHeating) / TotalCondHeatingCapacity);
1098 : } else {
1099 0 : HeatingPLR = 0.0;
1100 : }
1101 0 : HREIRAdjustment = HRInitialEIRFrac + (HREIRFTConst - HRInitialEIRFrac) * SUMultiplier;
1102 0 : vrf.VRFHeatRec = TUCoolingLoad;
1103 : }
1104 4784 : vrf.VRFCondPLR = max(CoolingPLR, HeatingPLR);
1105 : }
1106 :
1107 33935 : if (vrf.MinPLR > 0.0) {
1108 33935 : CyclingRatio = min(1.0, vrf.VRFCondPLR / vrf.MinPLR);
1109 33935 : if (vrf.VRFCondPLR < vrf.MinPLR && vrf.VRFCondPLR > 0.0) {
1110 17695 : vrf.VRFCondPLR = vrf.MinPLR;
1111 17695 : if (CoolingPLR > 0.0) CoolingPLR = vrf.MinPLR; // also adjust local PLR variables
1112 17695 : if (HeatingPLR > 0.0) HeatingPLR = vrf.MinPLR; // also adjust local PLR variables
1113 : }
1114 : }
1115 33935 : vrf.VRFCondCyclingRatio = CyclingRatio; // report variable for cycling rate
1116 33935 : vrf.TotalCoolingCapacity = TotalCondCoolingCapacity * CoolingPLR * CyclingRatio;
1117 33935 : vrf.TotalHeatingCapacity = TotalCondHeatingCapacity * HeatingPLR * CyclingRatio;
1118 :
1119 33935 : vrf.OperatingMode = 0; // report variable for heating or cooling mode
1120 33935 : EIRFPLRModFac = 1.0;
1121 33935 : VRFRTF = 0.0;
1122 : // cooling and heating is optional (only one may exist), if so then performance curve for missing coil are not required
1123 33935 : if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond) && CoolingPLR > 0.0) {
1124 18818 : vrf.OperatingMode = ModeCoolingOnly;
1125 18818 : if (CoolingPLR > 1.0) {
1126 434 : if (vrf.CoolEIRFPLR2 > 0) EIRFPLRModFac = CurveValue(state, vrf.CoolEIRFPLR2, max(vrf.MinPLR, CoolingPLR));
1127 : } else {
1128 18384 : if (vrf.CoolEIRFPLR1 > 0) EIRFPLRModFac = CurveValue(state, vrf.CoolEIRFPLR1, max(vrf.MinPLR, CoolingPLR));
1129 : }
1130 :
1131 18818 : if (EIRFPLRModFac < 0.0) {
1132 0 : if (vrf.CoolEIRFPLRErrorIndex == 0) {
1133 0 : ShowSevereMessage(state, fmt::format("{} \"{}\":", std::string(cVRFTypes(VRF_HeatPump)), vrf.Name));
1134 0 : ShowContinueError(state, format(" Cooling EIR Modifier curve (function of PLR) output is negative ({:.3T}).", EIRFPLRModFac));
1135 0 : ShowContinueError(state, format(" Negative value occurs using a cooling Part Load Ratio (PLR) of {:.2T}.", CoolingPLR));
1136 0 : ShowContinueErrorTimeStamp(state, " Resetting curve output to zero and continuing simulation.");
1137 : }
1138 0 : ShowRecurringWarningErrorAtEnd(
1139 : state,
1140 0 : fmt::format("{} \"{}\": Cooling EIR Modifier curve (function of PLR) output is negative warning continues...",
1141 0 : PlantEquipTypeNames[static_cast<int>(PlantEquipmentType::HeatPumpVRF)],
1142 0 : vrf.Name),
1143 0 : vrf.CoolEIRFPLRErrorIndex,
1144 : EIRFPLRModFac,
1145 : EIRFPLRModFac);
1146 0 : EIRFPLRModFac = 0.0;
1147 : }
1148 :
1149 : // find part load fraction to calculate RTF
1150 18818 : if (vrf.CoolPLFFPLR > 0) {
1151 18818 : PartLoadFraction = max(0.7, CurveValue(state, vrf.CoolPLFFPLR, CyclingRatio));
1152 : } else {
1153 0 : PartLoadFraction = 1.0;
1154 : }
1155 18818 : VRFRTF = min(1.0, (CyclingRatio / PartLoadFraction));
1156 :
1157 18818 : vrf.ElecCoolingPower = (vrf.RatedCoolingPower * TotCoolCapTempModFac) * TotCoolEIRTempModFac * EIRFPLRModFac * HREIRAdjustment * VRFRTF;
1158 : }
1159 33935 : if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond) && HeatingPLR > 0.0) {
1160 15112 : vrf.OperatingMode = ModeHeatingOnly;
1161 15112 : if (HeatingPLR > 1.0) {
1162 990 : if (vrf.HeatEIRFPLR2 > 0) EIRFPLRModFac = CurveValue(state, vrf.HeatEIRFPLR2, max(vrf.MinPLR, HeatingPLR));
1163 : } else {
1164 14122 : if (vrf.HeatEIRFPLR1 > 0) EIRFPLRModFac = CurveValue(state, vrf.HeatEIRFPLR1, max(vrf.MinPLR, HeatingPLR));
1165 : }
1166 :
1167 15112 : if (EIRFPLRModFac < 0.0) {
1168 0 : if (vrf.HeatEIRFPLRErrorIndex == 0) {
1169 0 : ShowSevereMessage(state, fmt::format("{} \"{}\":", std::string(cVRFTypes(VRF_HeatPump)), vrf.Name));
1170 0 : ShowContinueError(state, format(" Heating EIR Modifier curve (function of PLR) output is negative ({:.3T}).", EIRFPLRModFac));
1171 0 : ShowContinueError(state, format(" Negative value occurs using a heating Part Load Ratio (PLR) of {:.2T}.", HeatingPLR));
1172 0 : ShowContinueErrorTimeStamp(state, " Resetting curve output to zero and continuing simulation.");
1173 : }
1174 0 : ShowRecurringWarningErrorAtEnd(
1175 : state,
1176 0 : fmt::format("{} \"{}\": Heating EIR Modifier curve (function of PLR) output is negative warning continues...",
1177 0 : PlantEquipTypeNames[static_cast<int>(PlantEquipmentType::HeatPumpVRF)],
1178 0 : vrf.Name),
1179 0 : vrf.HeatEIRFPLRErrorIndex,
1180 : EIRFPLRModFac,
1181 : EIRFPLRModFac);
1182 0 : EIRFPLRModFac = 0.0;
1183 : }
1184 :
1185 : // find part load fraction to calculate RTF
1186 15112 : if (vrf.HeatPLFFPLR > 0) {
1187 15112 : PartLoadFraction = max(0.7, CurveValue(state, vrf.HeatPLFFPLR, CyclingRatio));
1188 : } else {
1189 0 : PartLoadFraction = 1.0;
1190 : }
1191 15112 : VRFRTF = min(1.0, (CyclingRatio / PartLoadFraction));
1192 :
1193 15112 : vrf.ElecHeatingPower =
1194 15112 : (vrf.RatedHeatingPower * TotHeatCapTempModFac) * TotHeatEIRTempModFac * EIRFPLRModFac * HREIRAdjustment * VRFRTF * InputPowerMultiplier;
1195 :
1196 : // adjust defrost power based on heating RTF
1197 15112 : vrf.DefrostPower *= VRFRTF;
1198 : }
1199 33935 : vrf.VRFCondRTF = VRFRTF;
1200 :
1201 : // calculate crankcase heater power
1202 33935 : if (vrf.MaxOATCCHeater > OutdoorDryBulb) {
1203 : // calculate crankcase heater power
1204 2871 : vrf.CrankCaseHeaterPower = vrf.CCHeaterPower * (1.0 - VRFRTF);
1205 2871 : if (vrf.NumCompressors > 1) {
1206 2871 : UpperStageCompressorRatio = (1.0 - vrf.CompressorSizeRatio) / (vrf.NumCompressors - 1);
1207 4289 : for (int Stage = 1; Stage <= vrf.NumCompressors - 2; ++Stage) {
1208 1418 : if (vrf.VRFCondPLR < (vrf.CompressorSizeRatio + Stage * UpperStageCompressorRatio)) {
1209 5 : vrf.CrankCaseHeaterPower += vrf.CCHeaterPower;
1210 : }
1211 : }
1212 : }
1213 : } else {
1214 31064 : vrf.CrankCaseHeaterPower = 0.0;
1215 : }
1216 :
1217 33935 : CondCapacity = max(vrf.TotalCoolingCapacity, vrf.TotalHeatingCapacity);
1218 33935 : CondPower = max(vrf.ElecCoolingPower, vrf.ElecHeatingPower);
1219 33935 : if (vrf.ElecCoolingPower > 0.0) {
1220 18818 : vrf.QCondenser = CondCapacity + CondPower - vrf.TUHeatingLoad / vrf.PipingCorrectionHeating;
1221 15117 : } else if (vrf.ElecHeatingPower > 0.0) {
1222 15112 : vrf.QCondenser = -CondCapacity + CondPower + vrf.TUCoolingLoad / vrf.PipingCorrectionCooling;
1223 : } else {
1224 5 : vrf.QCondenser = 0.0;
1225 : }
1226 :
1227 33935 : if (vrf.CondenserType == DataHeatBalance::RefrigCondenserType::Evap) {
1228 : // Calculate basin heater power
1229 0 : CalcBasinHeaterPower(state, vrf.BasinHeaterPowerFTempDiff, vrf.BasinHeaterSchedulePtr, vrf.BasinHeaterSetPointTemp, vrf.BasinHeaterPower);
1230 0 : vrf.BasinHeaterPower *= (1.0 - VRFRTF);
1231 :
1232 : // calculate evaporative condenser pump power and water consumption
1233 0 : if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond) && CoolingPLR > 0.0) {
1234 : //******************
1235 : // WATER CONSUMPTION IN m3 OF WATER FOR DIRECT
1236 : // H2O [m3/s] = Delta W[kgWater/kgDryAir]*Mass Flow Air[kgDryAir/s]
1237 : // /RhoWater [kgWater/m3]
1238 : //******************
1239 0 : RhoWater = RhoH2O(OutdoorDryBulb);
1240 0 : vrf.EvapWaterConsumpRate = (CondInletHumRat - OutdoorHumRat) * CondAirMassFlow / RhoWater * vrf.VRFCondPLR;
1241 0 : vrf.EvapCondPumpElecPower = vrf.EvapCondPumpPower * VRFRTF;
1242 : }
1243 33935 : } else if (vrf.CondenserType == DataHeatBalance::RefrigCondenserType::Water) {
1244 :
1245 3282 : if (CondCapacity > 0.0) {
1246 3281 : state.dataHVACVarRefFlow->CondenserWaterMassFlowRate = CondWaterMassFlow;
1247 : } else {
1248 1 : state.dataHVACVarRefFlow->CondenserWaterMassFlowRate = 0.0;
1249 : }
1250 6564 : SetComponentFlowRate(
1251 3282 : state, state.dataHVACVarRefFlow->CondenserWaterMassFlowRate, vrf.CondenserNodeNum, vrf.CondenserOutletNodeNum, vrf.SourcePlantLoc);
1252 :
1253 : // should be the same as above just entering this function
1254 : // VRF( VRFCond ).CondenserInletTemp = state.dataLoopNodes->Node(VRF(VRFCond).CondenserNodeNum).Temp;
1255 3282 : vrf.WaterCondenserMassFlow = state.dataLoopNodes->Node(vrf.CondenserNodeNum).MassFlowRate;
1256 :
1257 3282 : CpCond = FluidProperties::GetSpecificHeatGlycol(state,
1258 3282 : state.dataPlnt->PlantLoop(vrf.SourcePlantLoc.loopNum).FluidName,
1259 : vrf.CondenserInletTemp,
1260 3282 : state.dataPlnt->PlantLoop(vrf.SourcePlantLoc.loopNum).FluidIndex,
1261 : RoutineName);
1262 3282 : if (CondWaterMassFlow > 0.0) {
1263 3281 : CondOutletTemp = vrf.QCondenser / (CondWaterMassFlow * CpCond) + CondInletTemp;
1264 : } else {
1265 1 : CondOutletTemp = CondInletTemp;
1266 : }
1267 3282 : vrf.CondenserSideOutletTemp = CondOutletTemp;
1268 : }
1269 :
1270 : // calculate operating COP
1271 33935 : if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond) && CoolingPLR > 0.0) {
1272 18818 : if (vrf.ElecCoolingPower != 0.0) {
1273 : // this calc should use delivered capacity, not condenser capacity, use VRF(VRFCond)%TUCoolingLoad
1274 18818 : vrf.OperatingCoolingCOP =
1275 18818 : (vrf.TotalCoolingCapacity) / (vrf.ElecCoolingPower + vrf.CrankCaseHeaterPower + vrf.EvapCondPumpElecPower + vrf.DefrostPower);
1276 : } else {
1277 0 : vrf.OperatingCoolingCOP = 0.0;
1278 : }
1279 : }
1280 33935 : if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond) && HeatingPLR > 0.0) {
1281 15112 : if (vrf.ElecHeatingPower != 0.0) {
1282 : // this calc should use delivered capacity, not condenser capacity, use VRF(VRFCond)%TUHeatingLoad
1283 15112 : vrf.OperatingHeatingCOP =
1284 15112 : (vrf.TotalHeatingCapacity) / (vrf.ElecHeatingPower + vrf.CrankCaseHeaterPower + vrf.EvapCondPumpElecPower + vrf.DefrostPower);
1285 : } else {
1286 0 : vrf.OperatingHeatingCOP = 0.0;
1287 : }
1288 : }
1289 :
1290 33935 : TotPower = TUParasiticPower + TUFanPower + vrf.ElecHeatingPower + vrf.ElecCoolingPower + vrf.CrankCaseHeaterPower + vrf.EvapCondPumpElecPower +
1291 33935 : vrf.DefrostPower;
1292 33935 : if (TotPower > 0.0) {
1293 33935 : vrf.OperatingCOP = (vrf.TUCoolingLoad + vrf.TUHeatingLoad) / TotPower;
1294 33935 : vrf.SCHE = vrf.OperatingCOP * 3.412141633; // see StandardRatings::ConvFromSIToIP
1295 : }
1296 :
1297 : // limit the TU capacity when the condenser is maxed out on capacity
1298 : // I think this next line will make the max cap report variable match the coil objects, will probably change the answer though
1299 : // IF(CoolingLoad(VRFCond) .AND. NumTUInCoolingMode .GT. 0 .AND. MaxCoolingCapacity(VRFCond) == MaxCap)THEN
1300 33935 : if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond) && NumTUInCoolingMode > 0) {
1301 :
1302 : // IF TU capacity is greater than condenser capacity find maximum allowed TU capacity (i.e., conserve energy)
1303 18820 : if (TUCoolingLoad > TotalTUCoolingCapacity) {
1304 436 : LimitTUCapacity(state,
1305 : VRFCond,
1306 : NumTUInList,
1307 : TotalTUCoolingCapacity,
1308 436 : state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad,
1309 436 : state.dataHVACVarRefFlow->MaxCoolingCapacity(VRFCond),
1310 : TotalTUHeatingCapacity,
1311 436 : state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad,
1312 436 : state.dataHVACVarRefFlow->MaxHeatingCapacity(VRFCond));
1313 : }
1314 15115 : } else if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond) && NumTUInHeatingMode > 0) {
1315 : // IF TU capacity is greater than condenser capacity
1316 15115 : if (TUHeatingLoad > TotalTUHeatingCapacity) {
1317 993 : LimitTUCapacity(state,
1318 : VRFCond,
1319 : NumTUInList,
1320 : TotalTUHeatingCapacity,
1321 993 : state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad,
1322 993 : state.dataHVACVarRefFlow->MaxHeatingCapacity(VRFCond),
1323 : TotalTUCoolingCapacity,
1324 993 : state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad,
1325 993 : state.dataHVACVarRefFlow->MaxCoolingCapacity(VRFCond));
1326 : }
1327 : } else {
1328 : }
1329 : }
1330 :
1331 13 : void GetVRFInput(EnergyPlusData &state)
1332 : {
1333 :
1334 : // SUBROUTINE INFORMATION:
1335 : // AUTHOR Richard Raustad, FSEC
1336 : // DATE WRITTEN August 2015
1337 : // MODIFIED na
1338 : // RE-ENGINEERED na
1339 :
1340 : // PURPOSE OF THIS SUBROUTINE:
1341 : // Manages GetInput processing and program termination
1342 :
1343 : // METHODOLOGY EMPLOYED:
1344 : // Calls "Get" routines to read in data.
1345 :
1346 : // SUBROUTINE PARAMETER DEFINITIONS:
1347 : static constexpr std::string_view RoutineName("GetVRFInput: "); // include trailing blank space
1348 :
1349 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
1350 13 : bool ErrorsFound(false); // If errors detected in input
1351 :
1352 13 : GetVRFInputData(state, ErrorsFound);
1353 :
1354 13 : if (ErrorsFound) {
1355 0 : ShowFatalError(
1356 : state,
1357 0 : format("{}Errors found in getting AirConditioner:VariableRefrigerantFlow system input. Preceding condition(s) causes termination.",
1358 : RoutineName));
1359 : }
1360 13 : }
1361 :
1362 13 : void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound)
1363 : {
1364 :
1365 : // SUBROUTINE INFORMATION:
1366 : // AUTHOR Richard Raustad, FSEC
1367 : // DATE WRITTEN August 2010
1368 : // MODIFIED July 2012, Chandan Sharma - FSEC: Added zone sys avail managers
1369 : // RE-ENGINEERED na
1370 :
1371 : // PURPOSE OF THIS SUBROUTINE:
1372 : // Obtains input data for VRF systems and stores it in data structures
1373 :
1374 : using namespace DataLoopNode;
1375 : using BranchNodeConnections::SetUpCompSets;
1376 : using BranchNodeConnections::TestCompSet;
1377 : using Curve::checkCurveIsNormalizedToOne;
1378 : using Curve::CurveValue;
1379 : using Curve::GetCurveIndex;
1380 : using DXCoils::GetDXCoilIndex;
1381 :
1382 : using DataSizing::AutoSize;
1383 : using DXCoils::GetCoilCondenserInletNode;
1384 : using DXCoils::GetCoilTypeNum;
1385 : using DXCoils::GetDXCoilAvailSchPtr;
1386 : using DXCoils::GetDXCoilCapFTCurveIndex;
1387 : using DXCoils::GetDXCoilName;
1388 : using DXCoils::RatedInletAirTempHeat;
1389 : using DXCoils::RatedInletWetBulbTemp;
1390 : using DXCoils::RatedOutdoorAirTemp;
1391 : using DXCoils::RatedOutdoorAirTempHeat;
1392 : using DXCoils::RatedOutdoorWetBulbTempHeat;
1393 : using DXCoils::SetDXCoolingCoilData;
1394 : using MixedAir::GetOAMixerNodeNumbers;
1395 : using NodeInputManager::GetOnlySingleNode;
1396 : using OutAirNodeManager::CheckOutAirNodeNumber;
1397 : using ScheduleManager::CheckScheduleValueMinMax;
1398 : using ScheduleManager::GetScheduleIndex;
1399 : using SingleDuct::GetATMixer;
1400 : using WaterManager::SetupTankDemandComponent;
1401 : using WaterManager::SetupTankSupplyComponent;
1402 :
1403 : static constexpr std::string_view RoutineName("GetVRFInput: "); // include trailing blank space
1404 : static constexpr std::string_view routineName = "GetVRFInput";
1405 :
1406 13 : std::string cCurrentModuleObject;
1407 :
1408 13 : Array1D_int OANodeNums(4); // Node numbers of OA mixer (OA, EA, RA, MA)
1409 :
1410 : // InputProcessor routines
1411 13 : int NumParams = 0; // Number of arguments
1412 13 : int NumAlphas = 0; // Number of alpha arguments
1413 13 : int NumNums = 0; // Number of real arguments
1414 : int IOStat; // Status
1415 : bool errFlag; // error flag for mining functions
1416 : bool IsNotOK; // Flag to verify name
1417 :
1418 : // Compute for allocation
1419 13 : int MaxAlphas = 0;
1420 13 : int MaxNumbers = 0;
1421 :
1422 : {
1423 : // Terminal Units
1424 :
1425 : // The number of VRF constant volume TUs (anticipating different types of TU's)
1426 13 : int NumVRFCTU = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "ZoneHVAC:TerminalUnit:VariableRefrigerantFlow");
1427 13 : if (NumVRFCTU > 0) {
1428 13 : state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(
1429 : state, "ZoneHVAC:TerminalUnit:VariableRefrigerantFlow", NumParams, NumAlphas, NumNums);
1430 13 : MaxAlphas = max(MaxAlphas, NumAlphas);
1431 13 : MaxNumbers = max(MaxNumbers, NumNums);
1432 : }
1433 :
1434 13 : state.dataHVACVarRefFlow->NumVRFTU = NumVRFCTU;
1435 13 : if (state.dataHVACVarRefFlow->NumVRFTU > 0) {
1436 13 : state.dataHVACVarRefFlow->VRFTU.allocate(state.dataHVACVarRefFlow->NumVRFTU);
1437 13 : state.dataHVACVarRefFlow->CheckEquipName.dimension(state.dataHVACVarRefFlow->NumVRFTU, true);
1438 13 : state.dataHVACVarRefFlow->VRFTUNumericFields.allocate(state.dataHVACVarRefFlow->NumVRFTU);
1439 : }
1440 : }
1441 :
1442 : {
1443 : // VRF AirConditioners
1444 :
1445 26 : state.dataHVACVarRefFlow->NumVRFCond_SysCurve =
1446 13 : state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "AirConditioner:VariableRefrigerantFlow");
1447 13 : if (state.dataHVACVarRefFlow->NumVRFCond_SysCurve > 0) {
1448 9 : state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(
1449 : state, "AirConditioner:VariableRefrigerantFlow", NumParams, NumAlphas, NumNums);
1450 9 : MaxAlphas = max(MaxAlphas, NumAlphas);
1451 9 : MaxNumbers = max(MaxNumbers, NumNums);
1452 : }
1453 :
1454 26 : state.dataHVACVarRefFlow->NumVRFCond_FluidTCtrl_HP =
1455 13 : state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "AirConditioner:VariableRefrigerantFlow:FluidTemperatureControl");
1456 13 : if (state.dataHVACVarRefFlow->NumVRFCond_FluidTCtrl_HP > 0) {
1457 3 : state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(
1458 : state, "AirConditioner:VariableRefrigerantFlow:FluidTemperatureControl", NumParams, NumAlphas, NumNums);
1459 3 : MaxAlphas = max(MaxAlphas, NumAlphas);
1460 3 : MaxNumbers = max(MaxNumbers, NumNums);
1461 : }
1462 :
1463 26 : state.dataHVACVarRefFlow->NumVRFCond_FluidTCtrl_HR =
1464 13 : state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "AirConditioner:VariableRefrigerantFlow:FluidTemperatureControl:HR");
1465 13 : if (state.dataHVACVarRefFlow->NumVRFCond_FluidTCtrl_HR > 0) {
1466 1 : state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(
1467 : state, "AirConditioner:VariableRefrigerantFlow:FluidTemperatureControl:HR", NumParams, NumAlphas, NumNums);
1468 1 : MaxAlphas = max(MaxAlphas, NumAlphas);
1469 1 : MaxNumbers = max(MaxNumbers, NumNums);
1470 : }
1471 :
1472 13 : state.dataHVACVarRefFlow->NumVRFCond = state.dataHVACVarRefFlow->NumVRFCond_SysCurve + state.dataHVACVarRefFlow->NumVRFCond_FluidTCtrl_HP +
1473 13 : state.dataHVACVarRefFlow->NumVRFCond_FluidTCtrl_HR;
1474 :
1475 13 : if (state.dataHVACVarRefFlow->NumVRFCond > 0) {
1476 13 : state.dataHVACVarRefFlow->VRF.allocate(state.dataHVACVarRefFlow->NumVRFCond);
1477 13 : state.dataHVACVarRefFlow->VrfUniqueNames.reserve(static_cast<unsigned>(state.dataHVACVarRefFlow->NumVRFCond));
1478 13 : state.dataHVACVarRefFlow->MaxCoolingCapacity.allocate(state.dataHVACVarRefFlow->NumVRFCond);
1479 13 : state.dataHVACVarRefFlow->MaxHeatingCapacity.allocate(state.dataHVACVarRefFlow->NumVRFCond);
1480 13 : state.dataHVACVarRefFlow->CoolCombinationRatio.allocate(state.dataHVACVarRefFlow->NumVRFCond);
1481 13 : state.dataHVACVarRefFlow->HeatCombinationRatio.allocate(state.dataHVACVarRefFlow->NumVRFCond);
1482 13 : state.dataHVACVarRefFlow->MaxCoolingCapacity = MaxCap;
1483 13 : state.dataHVACVarRefFlow->MaxHeatingCapacity = MaxCap;
1484 13 : state.dataHVACVarRefFlow->CoolCombinationRatio = 1.0;
1485 13 : state.dataHVACVarRefFlow->HeatCombinationRatio = 1.0;
1486 : }
1487 : }
1488 :
1489 : {
1490 : // ZoneTerminalUnitList
1491 :
1492 13 : state.dataHVACVarRefFlow->NumVRFTULists = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "ZoneTerminalUnitList");
1493 13 : if (state.dataHVACVarRefFlow->NumVRFTULists > 0) {
1494 13 : state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, "ZoneTerminalUnitList", NumParams, NumAlphas, NumNums);
1495 13 : MaxAlphas = max(MaxAlphas, NumAlphas);
1496 13 : MaxNumbers = max(MaxNumbers, NumNums);
1497 :
1498 13 : state.dataHVACVarRefFlow->TerminalUnitList.allocate(state.dataHVACVarRefFlow->NumVRFTULists);
1499 : }
1500 : }
1501 :
1502 13 : Array1D_string cAlphaFieldNames;
1503 13 : cAlphaFieldNames.allocate(MaxAlphas);
1504 13 : Array1D_string cAlphaArgs;
1505 13 : cAlphaArgs.allocate(MaxAlphas);
1506 13 : Array1D_bool lAlphaFieldBlanks;
1507 13 : lAlphaFieldBlanks.dimension(MaxAlphas, false);
1508 :
1509 13 : Array1D_string cNumericFieldNames;
1510 13 : cNumericFieldNames.allocate(MaxNumbers);
1511 13 : Array1D<Real64> rNumericArgs;
1512 13 : rNumericArgs.dimension(MaxNumbers, 0.0);
1513 13 : Array1D_bool lNumericFieldBlanks;
1514 13 : lNumericFieldBlanks.dimension(MaxNumbers, false);
1515 :
1516 : // read all terminal unit list objects
1517 13 : cCurrentModuleObject = "ZoneTerminalUnitList";
1518 27 : for (int TUListNum = 1; TUListNum <= state.dataHVACVarRefFlow->NumVRFTULists; ++TUListNum) {
1519 14 : state.dataInputProcessing->inputProcessor->getObjectItem(state,
1520 : cCurrentModuleObject,
1521 : TUListNum,
1522 : cAlphaArgs,
1523 : NumAlphas,
1524 : rNumericArgs,
1525 : NumNums,
1526 : IOStat,
1527 : lNumericFieldBlanks,
1528 : lAlphaFieldBlanks,
1529 : cAlphaFieldNames,
1530 : cNumericFieldNames);
1531 14 : Util::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
1532 :
1533 14 : auto &thisTUList = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum);
1534 14 : thisTUList.Name = cAlphaArgs(1);
1535 14 : thisTUList.NumTUInList = NumAlphas - 1;
1536 14 : thisTUList.ZoneTUPtr.allocate(thisTUList.NumTUInList);
1537 14 : thisTUList.ZoneTUName.allocate(thisTUList.NumTUInList);
1538 14 : thisTUList.IsSimulated.allocate(thisTUList.NumTUInList);
1539 14 : thisTUList.TotalCoolLoad.allocate(thisTUList.NumTUInList);
1540 14 : thisTUList.TotalHeatLoad.allocate(thisTUList.NumTUInList);
1541 14 : thisTUList.CoolingCoilPresent.allocate(thisTUList.NumTUInList);
1542 14 : thisTUList.HeatingCoilPresent.allocate(thisTUList.NumTUInList);
1543 14 : thisTUList.TerminalUnitNotSizedYet.allocate(thisTUList.NumTUInList);
1544 14 : thisTUList.HRHeatRequest.allocate(thisTUList.NumTUInList);
1545 14 : thisTUList.HRCoolRequest.allocate(thisTUList.NumTUInList);
1546 14 : thisTUList.CoolingCoilAvailable.allocate(thisTUList.NumTUInList);
1547 14 : thisTUList.HeatingCoilAvailable.allocate(thisTUList.NumTUInList);
1548 14 : thisTUList.CoolingCoilAvailSchPtr.allocate(thisTUList.NumTUInList);
1549 14 : thisTUList.HeatingCoilAvailSchPtr.allocate(thisTUList.NumTUInList);
1550 14 : thisTUList.ZoneTUPtr = 0;
1551 14 : thisTUList.IsSimulated = false;
1552 14 : thisTUList.TotalCoolLoad = 0.0;
1553 14 : thisTUList.TotalHeatLoad = 0.0;
1554 14 : thisTUList.CoolingCoilPresent = true;
1555 14 : thisTUList.HeatingCoilPresent = true;
1556 14 : thisTUList.TerminalUnitNotSizedYet = true;
1557 14 : thisTUList.HRHeatRequest = false;
1558 14 : thisTUList.HRCoolRequest = false;
1559 14 : thisTUList.CoolingCoilAvailable = false;
1560 14 : thisTUList.HeatingCoilAvailable = false;
1561 14 : thisTUList.CoolingCoilAvailSchPtr = -1;
1562 14 : thisTUList.HeatingCoilAvailSchPtr = -1;
1563 :
1564 76 : for (int TUNum = 1; TUNum <= thisTUList.NumTUInList; ++TUNum) {
1565 62 : thisTUList.ZoneTUName(TUNum) = cAlphaArgs(TUNum + 1);
1566 : }
1567 : }
1568 :
1569 2040 : auto checkCurveMinMaxOutput = [&state](int CurveIndex) -> std::array<Real64, 4> {
1570 20 : Real64 MinCurveVal = 999.0;
1571 20 : Real64 MaxCurveVal = -999.0;
1572 20 : Real64 MinCurvePLR = 0.0;
1573 20 : Real64 MaxCurvePLR = 1.0;
1574 :
1575 2040 : for (int i = 0; i <= 100; ++i) { // 0 to 1.0 with 0.01 increment
1576 2020 : const Real64 CurveInput = i / 100.0;
1577 2020 : Real64 CurveVal = CurveValue(state, CurveIndex, CurveInput);
1578 2020 : if (CurveVal < MinCurveVal) {
1579 20 : MinCurveVal = CurveVal;
1580 20 : MinCurvePLR = CurveInput;
1581 : }
1582 2020 : if (CurveVal > MaxCurveVal) {
1583 2020 : MaxCurveVal = CurveVal;
1584 2020 : MaxCurvePLR = CurveInput;
1585 : }
1586 : }
1587 20 : return {MinCurvePLR, MinCurveVal, MaxCurvePLR, MaxCurveVal};
1588 13 : };
1589 :
1590 : // read all VRF condenser objects: Algorithm Type 1_system curve based model
1591 13 : cCurrentModuleObject = "AirConditioner:VariableRefrigerantFlow";
1592 23 : for (int VRFNum = 1; VRFNum <= state.dataHVACVarRefFlow->NumVRFCond_SysCurve; ++VRFNum) {
1593 10 : state.dataInputProcessing->inputProcessor->getObjectItem(state,
1594 : cCurrentModuleObject,
1595 : VRFNum,
1596 : cAlphaArgs,
1597 : NumAlphas,
1598 : rNumericArgs,
1599 : NumNums,
1600 : IOStat,
1601 : lNumericFieldBlanks,
1602 : lAlphaFieldBlanks,
1603 : cAlphaFieldNames,
1604 : cNumericFieldNames);
1605 10 : GlobalNames::VerifyUniqueInterObjectName(
1606 20 : state, state.dataHVACVarRefFlow->VrfUniqueNames, cAlphaArgs(1), cCurrentModuleObject, cAlphaFieldNames(1), ErrorsFound);
1607 :
1608 10 : auto &thisVrfSys = state.dataHVACVarRefFlow->VRF(VRFNum);
1609 10 : thisVrfSys.Name = cAlphaArgs(1);
1610 10 : thisVrfSys.VRFSystemTypeNum = VRF_HeatPump;
1611 10 : thisVrfSys.VRFAlgorithmType = AlgorithmType::SysCurve;
1612 10 : if (lAlphaFieldBlanks(2)) {
1613 2 : thisVrfSys.SchedPtr = ScheduleManager::ScheduleAlwaysOn;
1614 : } else {
1615 8 : thisVrfSys.SchedPtr = GetScheduleIndex(state, cAlphaArgs(2));
1616 8 : if (thisVrfSys.SchedPtr == 0) {
1617 0 : ShowSevereError(state, format("{}=\"{}\" invalid data", cCurrentModuleObject, thisVrfSys.Name));
1618 0 : ShowContinueError(state, format("Invalid-not found {}=\"{}\".", cAlphaFieldNames(2), cAlphaArgs(2)));
1619 0 : ErrorsFound = true;
1620 : }
1621 : }
1622 :
1623 10 : thisVrfSys.CoolingCapacity = rNumericArgs(1);
1624 10 : thisVrfSys.CoolingCOP = rNumericArgs(2);
1625 10 : thisVrfSys.MinOATCooling = rNumericArgs(3);
1626 10 : thisVrfSys.MaxOATCooling = rNumericArgs(4);
1627 :
1628 10 : thisVrfSys.CoolCapFT = GetCurveIndex(state, cAlphaArgs(3));
1629 10 : if (thisVrfSys.CoolCapFT > 0) {
1630 : // Verify Curve Object, only legal type is biquadratic
1631 10 : ErrorsFound |= Curve::CheckCurveDims(state,
1632 : thisVrfSys.CoolCapFT, // Curve index
1633 : {2}, // Valid dimensions
1634 : RoutineName, // Routine name
1635 : cCurrentModuleObject, // Object Type
1636 : thisVrfSys.Name, // Object Name
1637 10 : cAlphaFieldNames(3)); // Field Name
1638 :
1639 10 : if (!ErrorsFound) {
1640 10 : checkCurveIsNormalizedToOne(state,
1641 20 : std::string{RoutineName} + cCurrentModuleObject,
1642 10 : thisVrfSys.Name,
1643 : thisVrfSys.CoolCapFT,
1644 10 : cAlphaFieldNames(3),
1645 10 : cAlphaArgs(3),
1646 : RatedInletWetBulbTemp,
1647 : RatedOutdoorAirTemp);
1648 : }
1649 : }
1650 :
1651 10 : thisVrfSys.CoolBoundaryCurvePtr = GetCurveIndex(state, cAlphaArgs(4));
1652 10 : if (thisVrfSys.CoolBoundaryCurvePtr > 0) {
1653 : // Verify Curve Object, only legal type is linear, quadratic, or cubic
1654 10 : ErrorsFound |= Curve::CheckCurveDims(state,
1655 : thisVrfSys.CoolBoundaryCurvePtr, // Curve index
1656 : {1}, // Valid dimensions
1657 : RoutineName, // Routine name
1658 : cCurrentModuleObject, // Object Type
1659 : thisVrfSys.Name, // Object Name
1660 10 : cAlphaFieldNames(4)); // Field Name
1661 : }
1662 :
1663 10 : thisVrfSys.CoolCapFTHi = GetCurveIndex(state, cAlphaArgs(5));
1664 10 : if (thisVrfSys.CoolCapFTHi > 0) {
1665 : // Verify Curve Object, only legal type is biquadratic
1666 10 : ErrorsFound |= Curve::CheckCurveDims(state,
1667 : thisVrfSys.CoolCapFTHi, // Curve index
1668 : {2}, // Valid dimensions
1669 : RoutineName, // Routine name
1670 : cCurrentModuleObject, // Object Type
1671 : thisVrfSys.Name, // Object Name
1672 10 : cAlphaFieldNames(5)); // Field Name
1673 : }
1674 :
1675 10 : thisVrfSys.CoolEIRFT = GetCurveIndex(state, cAlphaArgs(6));
1676 10 : if (thisVrfSys.CoolEIRFT > 0) {
1677 : // Verify Curve Object, only legal type is biquadratic
1678 10 : ErrorsFound |= Curve::CheckCurveDims(state,
1679 : thisVrfSys.CoolEIRFT, // Curve index
1680 : {2}, // Valid dimensions
1681 : RoutineName, // Routine name
1682 : cCurrentModuleObject, // Object Type
1683 : thisVrfSys.Name, // Object Name
1684 10 : cAlphaFieldNames(6)); // Field Name
1685 : }
1686 :
1687 10 : thisVrfSys.EIRCoolBoundaryCurvePtr = GetCurveIndex(state, cAlphaArgs(7));
1688 10 : if (thisVrfSys.EIRCoolBoundaryCurvePtr > 0) {
1689 : // Verify Curve Object, only legal type is linear, quadratic, or cubic
1690 10 : ErrorsFound |= Curve::CheckCurveDims(state,
1691 : thisVrfSys.EIRCoolBoundaryCurvePtr, // Curve index
1692 : {1}, // Valid dimensions
1693 : RoutineName, // Routine name
1694 : cCurrentModuleObject, // Object Type
1695 : thisVrfSys.Name, // Object Name
1696 10 : cAlphaFieldNames(7)); // Field Name
1697 : }
1698 :
1699 10 : thisVrfSys.CoolEIRFTHi = GetCurveIndex(state, cAlphaArgs(8));
1700 10 : if (thisVrfSys.CoolEIRFTHi > 0) {
1701 : // Verify Curve Object, only legal type is biquadratic
1702 10 : ErrorsFound |= Curve::CheckCurveDims(state,
1703 : thisVrfSys.CoolEIRFTHi, // Curve index
1704 : {2}, // Valid dimensions
1705 : RoutineName, // Routine name
1706 : cCurrentModuleObject, // Object Type
1707 : thisVrfSys.Name, // Object Name
1708 10 : cAlphaFieldNames(8)); // Field Name
1709 : }
1710 :
1711 10 : thisVrfSys.CoolEIRFPLR1 = GetCurveIndex(state, cAlphaArgs(9));
1712 10 : if (thisVrfSys.CoolEIRFPLR1 > 0) {
1713 : // Verify Curve Object, only legal type is linear, quadratic, or cubic
1714 10 : ErrorsFound |= Curve::CheckCurveDims(state,
1715 : thisVrfSys.CoolEIRFPLR1, // Curve index
1716 : {1}, // Valid dimensions
1717 : RoutineName, // Routine name
1718 : cCurrentModuleObject, // Object Type
1719 : thisVrfSys.Name, // Object Name
1720 10 : cAlphaFieldNames(9)); // Field Name
1721 : }
1722 :
1723 10 : thisVrfSys.CoolEIRFPLR2 = GetCurveIndex(state, cAlphaArgs(10));
1724 10 : if (thisVrfSys.CoolEIRFPLR2 > 0) {
1725 : // Verify Curve Object, only legal type is linear, quadratic, or cubic
1726 10 : ErrorsFound |= Curve::CheckCurveDims(state,
1727 : thisVrfSys.CoolEIRFPLR2, // Curve index
1728 : {1}, // Valid dimensions
1729 : RoutineName, // Routine name
1730 : cCurrentModuleObject, // Object Type
1731 : thisVrfSys.Name, // Object Name
1732 10 : cAlphaFieldNames(10)); // Field Name
1733 : }
1734 :
1735 10 : thisVrfSys.CoolCombRatioPTR = GetCurveIndex(state, cAlphaArgs(11));
1736 10 : if (thisVrfSys.CoolCombRatioPTR > 0) {
1737 : // Verify Curve Object, only legal type is linear, quadratic, or cubic
1738 10 : ErrorsFound |= Curve::CheckCurveDims(state,
1739 : thisVrfSys.CoolCombRatioPTR, // Curve index
1740 : {1}, // Valid dimensions
1741 : RoutineName, // Routine name
1742 : cCurrentModuleObject, // Object Type
1743 : thisVrfSys.Name, // Object Name
1744 10 : cAlphaFieldNames(11)); // Field Name
1745 : }
1746 :
1747 10 : thisVrfSys.CoolPLFFPLR = GetCurveIndex(state, cAlphaArgs(12));
1748 10 : if (thisVrfSys.CoolPLFFPLR > 0) {
1749 : // Verify Curve Object, only legal type is linear, quadratic, or cubic
1750 10 : ErrorsFound |= Curve::CheckCurveDims(state,
1751 : thisVrfSys.CoolPLFFPLR, // Curve index
1752 : {1}, // Valid dimensions
1753 : RoutineName, // Routine name
1754 : cCurrentModuleObject, // Object Type
1755 : thisVrfSys.Name, // Object Name
1756 10 : cAlphaFieldNames(12)); // Field Name
1757 10 : if (!ErrorsFound) {
1758 : // Test PLF curve minimum and maximum. Cap if less than 0.7 or greater than 1.0.
1759 10 : auto [MinCurvePLR, MinCurveVal, MaxCurvePLR, MaxCurveVal] = checkCurveMinMaxOutput(thisVrfSys.CoolPLFFPLR);
1760 :
1761 10 : if (MinCurveVal < 0.7) {
1762 0 : ShowWarningError(state, format("{}{}=\"{}\", invalid", RoutineName, cCurrentModuleObject, thisVrfSys.Name));
1763 0 : ShowContinueError(state, format("...{}=\"{}\" has out of range values.", cAlphaFieldNames(12), cAlphaArgs(12)));
1764 0 : ShowContinueError(state,
1765 0 : format("...Curve minimum must be >= 0.7, curve min at PLR = {:.2T} is {:.3T}", MinCurvePLR, MinCurveVal));
1766 0 : ShowContinueError(state, "...Setting curve minimum to 0.7 and simulation continues.");
1767 0 : Curve::SetCurveOutputMinValue(state, thisVrfSys.CoolPLFFPLR, ErrorsFound, 0.7);
1768 : }
1769 :
1770 10 : if (MaxCurveVal > 1.0) {
1771 0 : ShowWarningError(state, format("{}{}=\"{}\", invalid", RoutineName, cCurrentModuleObject, thisVrfSys.Name));
1772 0 : ShowContinueError(state, format("...{}=\"{}\" has out of range values.", cAlphaFieldNames(12), cAlphaArgs(12)));
1773 0 : ShowContinueError(state,
1774 0 : format("...Curve maximum must be <= 1.0, curve max at PLR = {:.2T} is {:.3T}", MaxCurvePLR, MaxCurveVal));
1775 0 : ShowContinueError(state, "...Setting curve maximum to 1.0 and simulation continues.");
1776 0 : Curve::SetCurveOutputMaxValue(state, thisVrfSys.CoolPLFFPLR, ErrorsFound, 1.0);
1777 : }
1778 : }
1779 : }
1780 :
1781 10 : thisVrfSys.HeatingCapacity = rNumericArgs(5);
1782 10 : thisVrfSys.HeatingCapacitySizeRatio = rNumericArgs(6);
1783 10 : if (!lNumericFieldBlanks(6) && thisVrfSys.HeatingCapacity == AutoSize) {
1784 2 : thisVrfSys.LockHeatingCapacity = true;
1785 : }
1786 10 : thisVrfSys.HeatingCOP = rNumericArgs(7);
1787 10 : thisVrfSys.MinOATHeating = rNumericArgs(8);
1788 10 : thisVrfSys.MaxOATHeating = rNumericArgs(9);
1789 10 : if (thisVrfSys.MinOATHeating >= thisVrfSys.MaxOATHeating) {
1790 0 : ShowSevereError(state, format("{}, \"{}\"", cCurrentModuleObject, thisVrfSys.Name));
1791 0 : ShowContinueError(state,
1792 0 : format("... {} ({:.3T}) must be less than maximum ({:.3T}).",
1793 : cNumericFieldNames(8),
1794 0 : thisVrfSys.MinOATHeating,
1795 0 : thisVrfSys.MaxOATHeating));
1796 0 : ErrorsFound = true;
1797 : }
1798 :
1799 10 : thisVrfSys.HeatCapFT = GetCurveIndex(state, cAlphaArgs(13));
1800 10 : if (thisVrfSys.HeatCapFT > 0) {
1801 : // Verify Curve Object, only legal type is biquadratic
1802 10 : ErrorsFound |= Curve::CheckCurveDims(state,
1803 : thisVrfSys.HeatCapFT, // Curve index
1804 : {2}, // Valid dimensions
1805 : RoutineName, // Routine name
1806 : cCurrentModuleObject, // Object Type
1807 : thisVrfSys.Name, // Object Name
1808 10 : cAlphaFieldNames(13)); // Field Name
1809 :
1810 10 : if (!ErrorsFound) {
1811 10 : if (Util::SameString(cAlphaArgs(19), "WETBULBTEMPERATURE")) {
1812 9 : checkCurveIsNormalizedToOne(state,
1813 18 : std::string{RoutineName} + cCurrentModuleObject,
1814 9 : thisVrfSys.Name,
1815 : thisVrfSys.HeatCapFT,
1816 9 : cAlphaFieldNames(13),
1817 9 : cAlphaArgs(13),
1818 : RatedInletAirTempHeat,
1819 : RatedOutdoorWetBulbTempHeat);
1820 1 : } else if (Util::SameString(cAlphaArgs(19), "DRYBULBTEMPERATURE")) {
1821 1 : checkCurveIsNormalizedToOne(state,
1822 2 : std::string{RoutineName} + cCurrentModuleObject,
1823 1 : thisVrfSys.Name,
1824 : thisVrfSys.HeatCapFT,
1825 1 : cAlphaFieldNames(13),
1826 1 : cAlphaArgs(13),
1827 : RatedInletAirTempHeat,
1828 : RatedOutdoorAirTempHeat);
1829 : }
1830 : }
1831 : }
1832 :
1833 10 : thisVrfSys.HeatBoundaryCurvePtr = GetCurveIndex(state, cAlphaArgs(14));
1834 10 : if (thisVrfSys.HeatBoundaryCurvePtr > 0) {
1835 : // Verify Curve Object, only legal type is linear, quadratic, or cubic
1836 10 : ErrorsFound |= Curve::CheckCurveDims(state,
1837 : thisVrfSys.HeatBoundaryCurvePtr, // Curve index
1838 : {1}, // Valid dimensions
1839 : RoutineName, // Routine name
1840 : cCurrentModuleObject, // Object Type
1841 : thisVrfSys.Name, // Object Name
1842 10 : cAlphaFieldNames(14)); // Field Name
1843 : }
1844 :
1845 10 : thisVrfSys.HeatCapFTHi = GetCurveIndex(state, cAlphaArgs(15));
1846 10 : if (thisVrfSys.HeatCapFTHi > 0) {
1847 : // Verify Curve Object, only legal type is biquadratic
1848 10 : ErrorsFound |= Curve::CheckCurveDims(state,
1849 : thisVrfSys.HeatCapFTHi, // Curve index
1850 : {2}, // Valid dimensions
1851 : RoutineName, // Routine name
1852 : cCurrentModuleObject, // Object Type
1853 : thisVrfSys.Name, // Object Name
1854 10 : cAlphaFieldNames(15)); // Field Name
1855 : }
1856 :
1857 10 : thisVrfSys.HeatEIRFT = GetCurveIndex(state, cAlphaArgs(16));
1858 10 : if (thisVrfSys.HeatEIRFT > 0) {
1859 : // Verify Curve Object, only legal type is biquadratic
1860 10 : ErrorsFound |= Curve::CheckCurveDims(state,
1861 : thisVrfSys.HeatEIRFT, // Curve index
1862 : {2}, // Valid dimensions
1863 : RoutineName, // Routine name
1864 : cCurrentModuleObject, // Object Type
1865 : thisVrfSys.Name, // Object Name
1866 10 : cAlphaFieldNames(16)); // Field Name
1867 : }
1868 :
1869 10 : thisVrfSys.EIRHeatBoundaryCurvePtr = GetCurveIndex(state, cAlphaArgs(17));
1870 10 : if (thisVrfSys.EIRHeatBoundaryCurvePtr > 0) {
1871 : // Verify Curve Object, only legal type is linear, quadratic, or cubic
1872 10 : ErrorsFound |= Curve::CheckCurveDims(state,
1873 : thisVrfSys.EIRHeatBoundaryCurvePtr, // Curve index
1874 : {1}, // Valid dimensions
1875 : RoutineName, // Routine name
1876 : cCurrentModuleObject, // Object Type
1877 : thisVrfSys.Name, // Object Name
1878 10 : cAlphaFieldNames(17)); // Field Name
1879 : }
1880 :
1881 10 : thisVrfSys.HeatEIRFTHi = GetCurveIndex(state, cAlphaArgs(18));
1882 10 : if (thisVrfSys.HeatEIRFTHi > 0) {
1883 : // Verify Curve Object, only legal type is biquadratic
1884 10 : ErrorsFound |= Curve::CheckCurveDims(state,
1885 : thisVrfSys.HeatEIRFTHi, // Curve index
1886 : {2}, // Valid dimensions
1887 : RoutineName, // Routine name
1888 : cCurrentModuleObject, // Object Type
1889 : thisVrfSys.Name, // Object Name
1890 10 : cAlphaFieldNames(18)); // Field Name
1891 : }
1892 :
1893 10 : if (Util::SameString(cAlphaArgs(19), "WETBULBTEMPERATURE")) {
1894 9 : thisVrfSys.HeatingPerformanceOATType = HVAC::OATType::WetBulb;
1895 1 : } else if (Util::SameString(cAlphaArgs(19), "DRYBULBTEMPERATURE")) {
1896 1 : thisVrfSys.HeatingPerformanceOATType = HVAC::OATType::DryBulb;
1897 : } else {
1898 0 : ShowSevereError(
1899 : state,
1900 0 : format(
1901 0 : "{}, \"{}\" illegal {} input for this object = {}", cCurrentModuleObject, thisVrfSys.Name, cAlphaFieldNames(19), cAlphaArgs(19)));
1902 0 : ShowContinueError(state, "... input must be WETBULBTEMPERATURE or DRYBULBTEMPERATURE.");
1903 0 : ErrorsFound = true;
1904 : }
1905 :
1906 10 : thisVrfSys.HeatEIRFPLR1 = GetCurveIndex(state, cAlphaArgs(20));
1907 10 : if (thisVrfSys.HeatEIRFPLR1 > 0) {
1908 : // Verify Curve Object, only legal type is linear, quadratic, or cubic
1909 10 : ErrorsFound |= Curve::CheckCurveDims(state,
1910 : thisVrfSys.HeatEIRFPLR1, // Curve index
1911 : {1}, // Valid dimensions
1912 : RoutineName, // Routine name
1913 : cCurrentModuleObject, // Object Type
1914 : thisVrfSys.Name, // Object Name
1915 10 : cAlphaFieldNames(20)); // Field Name
1916 : }
1917 :
1918 10 : thisVrfSys.HeatEIRFPLR2 = GetCurveIndex(state, cAlphaArgs(21));
1919 10 : if (thisVrfSys.HeatEIRFPLR2 > 0) {
1920 : // Verify Curve Object, only legal type is linear, quadratic, or cubic
1921 10 : ErrorsFound |= Curve::CheckCurveDims(state,
1922 : thisVrfSys.HeatEIRFPLR2, // Curve index
1923 : {1}, // Valid dimensions
1924 : RoutineName, // Routine name
1925 : cCurrentModuleObject, // Object Type
1926 : thisVrfSys.Name, // Object Name
1927 10 : cAlphaFieldNames(21)); // Field Name
1928 : }
1929 :
1930 10 : thisVrfSys.HeatCombRatioPTR = GetCurveIndex(state, cAlphaArgs(22));
1931 10 : if (thisVrfSys.HeatCombRatioPTR > 0) {
1932 : // Verify Curve Object, only legal type is linear, quadratic, or cubic
1933 10 : ErrorsFound |= Curve::CheckCurveDims(state,
1934 : thisVrfSys.HeatCombRatioPTR, // Curve index
1935 : {1}, // Valid dimensions
1936 : RoutineName, // Routine name
1937 : cCurrentModuleObject, // Object Type
1938 : thisVrfSys.Name, // Object Name
1939 10 : cAlphaFieldNames(22)); // Field Name
1940 : }
1941 10 : thisVrfSys.HeatPLFFPLR = GetCurveIndex(state, cAlphaArgs(23));
1942 10 : if (thisVrfSys.HeatPLFFPLR > 0) {
1943 : // Verify Curve Object, only legal type is linear, quadratic, or cubic
1944 10 : ErrorsFound |= Curve::CheckCurveDims(state,
1945 : thisVrfSys.HeatPLFFPLR, // Curve index
1946 : {1}, // Valid dimensions
1947 : RoutineName, // Routine name
1948 : cCurrentModuleObject, // Object Type
1949 : thisVrfSys.Name, // Object Name
1950 10 : cAlphaFieldNames(23)); // Field Name
1951 :
1952 10 : if (!ErrorsFound) {
1953 10 : auto [MinCurvePLR, MinCurveVal, MaxCurvePLR, MaxCurveVal] = checkCurveMinMaxOutput(thisVrfSys.HeatPLFFPLR);
1954 :
1955 10 : if (MinCurveVal < 0.7) {
1956 0 : ShowWarningError(state, format("{}{}=\"{}\", invalid", RoutineName, cCurrentModuleObject, thisVrfSys.Name));
1957 0 : ShowContinueError(state, format("...{}=\"{}\" has out of range values.", cAlphaFieldNames(23), cAlphaArgs(23)));
1958 0 : ShowContinueError(state,
1959 0 : format("...Curve minimum must be >= 0.7, curve min at PLR = {:.2T} is {:.3T}", MinCurvePLR, MinCurveVal));
1960 0 : ShowContinueError(state, "...Setting curve minimum to 0.7 and simulation continues.");
1961 0 : Curve::SetCurveOutputMinValue(state, thisVrfSys.HeatPLFFPLR, ErrorsFound, 0.7);
1962 : }
1963 :
1964 10 : if (MaxCurveVal > 1.0) {
1965 0 : ShowWarningError(state, format("{}{}=\"{}\", invalid", RoutineName, cCurrentModuleObject, thisVrfSys.Name));
1966 0 : ShowContinueError(state, format("...{}=\"{}\" has out of range values.", cAlphaFieldNames(23), cAlphaArgs(23)));
1967 0 : ShowContinueError(state,
1968 0 : format("...Curve maximum must be <= 1.0, curve max at PLR = {:.2T} is {:.3T}", MaxCurvePLR, MaxCurveVal));
1969 0 : ShowContinueError(state, "...Setting curve maximum to 1.0 and simulation continues.");
1970 0 : Curve::SetCurveOutputMaxValue(state, thisVrfSys.HeatPLFFPLR, ErrorsFound, 1.0);
1971 : }
1972 : }
1973 : }
1974 :
1975 10 : thisVrfSys.MinPLR = rNumericArgs(10);
1976 10 : Real64 minEIRfLowPLRXInput = 0.0;
1977 10 : Real64 maxEIRfLowPLRXInput = 0.0;
1978 :
1979 10 : if (thisVrfSys.CoolEIRFPLR1 > 0) {
1980 10 : Curve::GetCurveMinMaxValues(state, thisVrfSys.CoolEIRFPLR1, minEIRfLowPLRXInput, maxEIRfLowPLRXInput);
1981 10 : if (minEIRfLowPLRXInput > thisVrfSys.MinPLR) {
1982 0 : ShowWarningError(state, format("{}{}=\"{}\", invalid", RoutineName, cCurrentModuleObject, thisVrfSys.Name));
1983 0 : ShowContinueError(state, format("...{} = {} has out of range value.", cAlphaFieldNames(9), cAlphaArgs(9)));
1984 0 : ShowContinueError(state,
1985 0 : format("...Curve minimum value of X = {:.3T} must be <= Minimum Heat Pump Part-Load Ratio = {:.3T}.",
1986 : minEIRfLowPLRXInput,
1987 0 : thisVrfSys.MinPLR));
1988 0 : ErrorsFound = true;
1989 : }
1990 10 : if (maxEIRfLowPLRXInput < 1.0) {
1991 0 : ShowWarningError(state, format("{}{}=\"{}\", suspicious", RoutineName, cCurrentModuleObject, thisVrfSys.Name));
1992 0 : ShowContinueError(state, format("...{} = {} has unexpected value.", cAlphaFieldNames(9), cAlphaArgs(9)));
1993 0 : ShowContinueError(state,
1994 0 : format("...Curve maximum value of X = {:.3T} should be 1 and will result in lower energy use than expected.",
1995 : maxEIRfLowPLRXInput));
1996 : }
1997 10 : minEIRfLowPLRXInput = 0.0;
1998 10 : maxEIRfLowPLRXInput = 0.0;
1999 : }
2000 10 : if (thisVrfSys.HeatEIRFPLR1 > 0) {
2001 10 : Curve::GetCurveMinMaxValues(state, thisVrfSys.HeatEIRFPLR1, minEIRfLowPLRXInput, maxEIRfLowPLRXInput);
2002 10 : if (minEIRfLowPLRXInput > thisVrfSys.MinPLR) {
2003 0 : ShowWarningError(state, format("{}{}=\"{}\", invalid", RoutineName, cCurrentModuleObject, thisVrfSys.Name));
2004 0 : ShowContinueError(state, format("...{} = {} has out of range value.", cAlphaFieldNames(20), cAlphaArgs(20)));
2005 0 : ShowContinueError(state,
2006 0 : format("...Curve minimum value of X = {:.3T} must be <= Minimum Heat Pump Part-Load Ratio = {:.3T}.",
2007 : minEIRfLowPLRXInput,
2008 0 : thisVrfSys.MinPLR));
2009 0 : ErrorsFound = true;
2010 : }
2011 10 : if (maxEIRfLowPLRXInput < 1.0) {
2012 0 : ShowWarningError(state, format("{}{}=\"{}\", suspicious", RoutineName, cCurrentModuleObject, thisVrfSys.Name));
2013 0 : ShowContinueError(state, format("...{} = {} has unexpected value.", cAlphaFieldNames(20), cAlphaArgs(20)));
2014 0 : ShowContinueError(state,
2015 0 : format("...Curve maximum value of X = {:.3T} should be 1 and will result in lower energy use than expected.",
2016 : maxEIRfLowPLRXInput));
2017 : }
2018 : }
2019 :
2020 10 : thisVrfSys.MasterZonePtr = Util::FindItemInList(cAlphaArgs(24), state.dataHeatBal->Zone);
2021 :
2022 10 : thisVrfSys.ThermostatPriority = static_cast<ThermostatCtrlType>(getEnumValue(ThermostatCtrlTypeUC, cAlphaArgs(25)));
2023 :
2024 10 : if (thisVrfSys.ThermostatPriority == ThermostatCtrlType::MasterThermostatPriority) {
2025 1 : if (thisVrfSys.MasterZonePtr == 0) {
2026 0 : ShowSevereError(state, format("{} = \"{}\"", cCurrentModuleObject, thisVrfSys.Name));
2027 0 : ShowContinueError(state, format("{} must be entered when {} = {}", cAlphaFieldNames(24), cAlphaFieldNames(25), cAlphaArgs(25)));
2028 0 : ErrorsFound = true;
2029 : }
2030 9 : } else if (thisVrfSys.ThermostatPriority == ThermostatCtrlType::Invalid) {
2031 0 : ShowSevereError(state, format("{} = \"{}\"", cCurrentModuleObject, thisVrfSys.Name));
2032 0 : ShowContinueError(state, format("Illegal {} = {}", cAlphaFieldNames(25), cAlphaArgs(25)));
2033 0 : ErrorsFound = true;
2034 : }
2035 :
2036 10 : if (thisVrfSys.ThermostatPriority == ThermostatCtrlType::ScheduledPriority) {
2037 0 : thisVrfSys.SchedPriorityPtr = GetScheduleIndex(state, cAlphaArgs(26));
2038 0 : if (thisVrfSys.SchedPriorityPtr == 0) {
2039 0 : ShowSevereError(state, format("{} = \"{}\"", cCurrentModuleObject, thisVrfSys.Name));
2040 0 : ShowContinueError(state, format("...{} = {} not found.", cAlphaFieldNames(26), cAlphaArgs(26)));
2041 0 : ShowContinueError(state, format("A schedule name is required when {}={}", cAlphaFieldNames(25), cAlphaArgs(25)));
2042 0 : ErrorsFound = true;
2043 : }
2044 : }
2045 :
2046 10 : thisVrfSys.ZoneTUListPtr = Util::FindItemInList(cAlphaArgs(27), state.dataHVACVarRefFlow->TerminalUnitList);
2047 10 : if (thisVrfSys.ZoneTUListPtr == 0) {
2048 0 : ShowSevereError(state, format("{} = \"{}\"", cCurrentModuleObject, thisVrfSys.Name));
2049 0 : ShowContinueError(state, format("{} = {} not found.", cAlphaFieldNames(27), cAlphaArgs(27)));
2050 0 : ErrorsFound = true;
2051 : }
2052 :
2053 10 : thisVrfSys.HeatRecoveryUsed = false;
2054 10 : if (!lAlphaFieldBlanks(28)) {
2055 10 : if (Util::SameString(cAlphaArgs(28), "No")) {
2056 9 : thisVrfSys.HeatRecoveryUsed = false;
2057 1 : } else if (Util::SameString(cAlphaArgs(28), "Yes")) {
2058 1 : thisVrfSys.HeatRecoveryUsed = true;
2059 : } else {
2060 0 : ShowSevereError(state, format("{} = \"{}\"", cCurrentModuleObject, thisVrfSys.Name));
2061 0 : ShowContinueError(state, format("Illegal {} = {}", cAlphaFieldNames(28), cAlphaArgs(28)));
2062 0 : ErrorsFound = true;
2063 : }
2064 : }
2065 :
2066 10 : thisVrfSys.EquivPipeLngthCool = rNumericArgs(11);
2067 10 : thisVrfSys.VertPipeLngth = rNumericArgs(12);
2068 10 : thisVrfSys.PCFLengthCoolPtr = GetCurveIndex(state, cAlphaArgs(29));
2069 10 : if (thisVrfSys.PCFLengthCoolPtr > 0) {
2070 : // Verify Curve Object, only legal type is linear, quadratic, cubic, or biquadratic
2071 10 : ErrorsFound |= Curve::CheckCurveDims(state,
2072 : thisVrfSys.PCFLengthCoolPtr, // Curve index
2073 : {1, 2}, // Valid dimensions // MULTIPLECURVEDIMS
2074 : RoutineName, // Routine name
2075 : cCurrentModuleObject, // Object Type
2076 : thisVrfSys.Name, // Object Name
2077 10 : cAlphaFieldNames(29)); // Field Name
2078 : }
2079 10 : thisVrfSys.PCFHeightCool = rNumericArgs(13);
2080 :
2081 10 : thisVrfSys.EquivPipeLngthHeat = rNumericArgs(14);
2082 10 : thisVrfSys.PCFLengthHeatPtr = GetCurveIndex(state, cAlphaArgs(30));
2083 10 : if (thisVrfSys.PCFLengthHeatPtr > 0) {
2084 : // Verify Curve Object, only legal type is linear, quadratic, cubic, or biquadratic
2085 0 : ErrorsFound |= Curve::CheckCurveDims(state,
2086 : thisVrfSys.PCFLengthHeatPtr, // Curve index
2087 : {1, 2}, // Valid dimensions // MULTIPLECURVEDIMS
2088 : RoutineName, // Routine name
2089 : cCurrentModuleObject, // Object Type
2090 : thisVrfSys.Name, // Object Name
2091 0 : cAlphaFieldNames(30)); // Field Name
2092 : }
2093 :
2094 10 : thisVrfSys.PCFHeightHeat = rNumericArgs(15);
2095 :
2096 10 : thisVrfSys.CCHeaterPower = rNumericArgs(16);
2097 10 : thisVrfSys.NumCompressors = rNumericArgs(17);
2098 10 : thisVrfSys.CompressorSizeRatio = rNumericArgs(18);
2099 10 : thisVrfSys.MaxOATCCHeater = rNumericArgs(19);
2100 :
2101 10 : if (!lAlphaFieldBlanks(31)) {
2102 10 : thisVrfSys.DefrostStrategy = static_cast<StandardRatings::DefrostStrat>(getEnumValue(StandardRatings::DefrostStratUC, cAlphaArgs(31)));
2103 10 : if (thisVrfSys.DefrostStrategy == StandardRatings::DefrostStrat::Invalid) {
2104 0 : ShowSevereError(state,
2105 0 : format("{}, \"{}\" {} not found: {}", cCurrentModuleObject, thisVrfSys.Name, cAlphaFieldNames(31), cAlphaArgs(31)));
2106 0 : ErrorsFound = true;
2107 : }
2108 : } else {
2109 0 : thisVrfSys.DefrostStrategy = StandardRatings::DefrostStrat::ReverseCycle;
2110 : }
2111 :
2112 10 : if (!lAlphaFieldBlanks(32)) {
2113 10 : thisVrfSys.DefrostControl =
2114 10 : static_cast<StandardRatings::HPdefrostControl>(getEnumValue(StandardRatings::HPdefrostControlUC, cAlphaArgs(32)));
2115 :
2116 10 : if (thisVrfSys.DefrostControl == StandardRatings::HPdefrostControl::Invalid) {
2117 0 : ShowSevereError(state,
2118 0 : format("{}, \"{}\" {} not found: {}", cCurrentModuleObject, thisVrfSys.Name, cAlphaFieldNames(32), cAlphaArgs(32)));
2119 :
2120 0 : ErrorsFound = true;
2121 : }
2122 : } else {
2123 0 : thisVrfSys.DefrostControl = StandardRatings::HPdefrostControl::Timed;
2124 : }
2125 :
2126 10 : if (!lAlphaFieldBlanks(33)) {
2127 0 : thisVrfSys.DefrostEIRPtr = GetCurveIndex(state, cAlphaArgs(33));
2128 0 : if (thisVrfSys.DefrostEIRPtr > 0) {
2129 : // Verify Curve Object, expected type is BiQuadratic
2130 0 : ErrorsFound |= Curve::CheckCurveDims(state,
2131 : thisVrfSys.DefrostEIRPtr, // Curve index
2132 : {2}, // Valid dimensions
2133 : RoutineName, // Routine name
2134 : cCurrentModuleObject, // Object Type
2135 : thisVrfSys.Name, // Object Name
2136 0 : cAlphaFieldNames(33)); // Field Name
2137 : } else {
2138 0 : if (thisVrfSys.DefrostStrategy == StandardRatings::DefrostStrat::ReverseCycle) {
2139 0 : ShowSevereError(
2140 0 : state, format("{}, \"{}\" {} not found: {}", cCurrentModuleObject, thisVrfSys.Name, cAlphaFieldNames(33), cAlphaArgs(33)));
2141 0 : ErrorsFound = true;
2142 : }
2143 : }
2144 : } else {
2145 10 : if (thisVrfSys.DefrostStrategy == StandardRatings::DefrostStrat::ReverseCycle) {
2146 0 : ShowSevereError(state,
2147 0 : format("{}, \"{}\" {} not found: {}", cCurrentModuleObject, thisVrfSys.Name, cAlphaFieldNames(33), cAlphaArgs(33)));
2148 0 : ErrorsFound = true;
2149 : }
2150 : }
2151 :
2152 10 : thisVrfSys.DefrostFraction = rNumericArgs(20);
2153 10 : thisVrfSys.DefrostCapacity = rNumericArgs(21);
2154 10 : if (thisVrfSys.DefrostCapacity == 0.0 && thisVrfSys.DefrostStrategy == StandardRatings::DefrostStrat::Resistive) {
2155 0 : ShowWarningError(
2156 : state,
2157 0 : format("{}, \"{}\" {} = 0.0 for defrost strategy = RESISTIVE.", cCurrentModuleObject, thisVrfSys.Name, cNumericFieldNames(21)));
2158 : }
2159 :
2160 10 : thisVrfSys.MaxOATDefrost = rNumericArgs(22);
2161 :
2162 10 : if (!lAlphaFieldBlanks(35)) {
2163 10 : if (Util::SameString(cAlphaArgs(34), "AirCooled")) thisVrfSys.CondenserType = DataHeatBalance::RefrigCondenserType::Air;
2164 10 : if (Util::SameString(cAlphaArgs(34), "EvaporativelyCooled")) thisVrfSys.CondenserType = DataHeatBalance::RefrigCondenserType::Evap;
2165 10 : if (Util::SameString(cAlphaArgs(34), "WaterCooled")) {
2166 1 : thisVrfSys.CondenserType = DataHeatBalance::RefrigCondenserType::Water;
2167 1 : thisVrfSys.VRFType = PlantEquipmentType::HeatPumpVRF;
2168 1 : if (thisVrfSys.HeatingPerformanceOATType == HVAC::OATType::WetBulb) {
2169 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisVrfSys.Name));
2170 0 : ShowContinueError(state, format("{} = {}", cAlphaFieldNames(34), cAlphaArgs(34)));
2171 0 : ShowContinueError(state, format("Illegal {} input for this object = {}", cAlphaFieldNames(19), cAlphaArgs(19)));
2172 0 : ShowContinueError(state, "... input must be DRYBULBTEMPERATURE when Condenser Type is WaterCooled.");
2173 0 : ShowContinueError(state, format("... {} will be reset to DRYBULBTEMPERATURE and simulation continues.", cAlphaFieldNames(19)));
2174 : }
2175 : }
2176 10 : if (thisVrfSys.CondenserType == DataHeatBalance::RefrigCondenserType::Invalid) {
2177 0 : ShowSevereError(state, cCurrentModuleObject + " = " + thisVrfSys.Name);
2178 0 : ShowContinueError(state, "Illegal " + cAlphaFieldNames(34) + " = " + cAlphaArgs(34));
2179 0 : ErrorsFound = true;
2180 : }
2181 : } else {
2182 0 : thisVrfSys.CondenserType = DataHeatBalance::RefrigCondenserType::Air;
2183 : }
2184 :
2185 : // outdoor condenser node
2186 10 : if (lAlphaFieldBlanks(35)) {
2187 0 : thisVrfSys.CondenserNodeNum = 0;
2188 : } else {
2189 10 : switch (thisVrfSys.CondenserType) {
2190 9 : case DataHeatBalance::RefrigCondenserType::Air:
2191 : case DataHeatBalance::RefrigCondenserType::Evap: {
2192 9 : thisVrfSys.CondenserNodeNum = GetOnlySingleNode(state,
2193 9 : cAlphaArgs(35),
2194 : ErrorsFound,
2195 : DataLoopNode::ConnectionObjectType::AirConditionerVariableRefrigerantFlow,
2196 9 : thisVrfSys.Name,
2197 : DataLoopNode::NodeFluidType::Air,
2198 : DataLoopNode::ConnectionType::OutsideAirReference,
2199 : NodeInputManager::CompFluidStream::Primary,
2200 : ObjectIsNotParent);
2201 9 : if (!CheckOutAirNodeNumber(state, thisVrfSys.CondenserNodeNum)) {
2202 0 : ShowSevereError(state,
2203 0 : format("{}, \"{}\" {} not a valid Outdoor Air Node = {}",
2204 : cCurrentModuleObject,
2205 0 : thisVrfSys.Name,
2206 : cAlphaFieldNames(35),
2207 : cAlphaArgs(35)));
2208 0 : ShowContinueError(state, "...node name does not appear in an OutdoorAir:NodeList or as an OutdoorAir:Node.");
2209 0 : ErrorsFound = true;
2210 : }
2211 9 : } break;
2212 1 : case DataHeatBalance::RefrigCondenserType::Water: {
2213 1 : thisVrfSys.CondenserNodeNum = GetOnlySingleNode(state,
2214 1 : cAlphaArgs(35),
2215 : ErrorsFound,
2216 : DataLoopNode::ConnectionObjectType::AirConditionerVariableRefrigerantFlow,
2217 1 : thisVrfSys.Name,
2218 : DataLoopNode::NodeFluidType::Water,
2219 : DataLoopNode::ConnectionType::Inlet,
2220 : NodeInputManager::CompFluidStream::Secondary,
2221 : ObjectIsNotParent);
2222 1 : } break;
2223 0 : default:
2224 0 : break;
2225 : }
2226 : }
2227 :
2228 10 : if (!lAlphaFieldBlanks(36) && thisVrfSys.CondenserType == DataHeatBalance::RefrigCondenserType::Water) {
2229 1 : thisVrfSys.CondenserOutletNodeNum = GetOnlySingleNode(state,
2230 1 : cAlphaArgs(36),
2231 : ErrorsFound,
2232 : DataLoopNode::ConnectionObjectType::AirConditionerVariableRefrigerantFlow,
2233 1 : thisVrfSys.Name,
2234 : DataLoopNode::NodeFluidType::Water,
2235 : DataLoopNode::ConnectionType::Outlet,
2236 : NodeInputManager::CompFluidStream::Secondary,
2237 : ObjectIsNotParent);
2238 1 : TestCompSet(state, cCurrentModuleObject, thisVrfSys.Name, cAlphaArgs(35), cAlphaArgs(36), "Condenser Water Nodes");
2239 9 : } else if (lAlphaFieldBlanks(36) && thisVrfSys.CondenserType == DataHeatBalance::RefrigCondenserType::Water) {
2240 0 : ShowSevereError(state, format("{}, \"{}\" {} is blank.", cCurrentModuleObject, thisVrfSys.Name, cAlphaFieldNames(36)));
2241 0 : ShowContinueError(state, "...node name must be entered when Condenser Type = WaterCooled.");
2242 0 : ErrorsFound = true;
2243 : }
2244 :
2245 10 : if (lAlphaFieldBlanks(23)) {
2246 0 : if (thisVrfSys.CondenserType == DataHeatBalance::RefrigCondenserType::Water) {
2247 0 : ShowSevereError(state, format("{}, \"{}\" {} is blank.", cCurrentModuleObject, thisVrfSys.Name, cNumericFieldNames(23)));
2248 0 : ShowContinueError(state, format("...input is required when {} = {}", cAlphaFieldNames(34), cAlphaArgs(34)));
2249 0 : ErrorsFound = true;
2250 : }
2251 : } else {
2252 10 : thisVrfSys.WaterCondVolFlowRate = rNumericArgs(23);
2253 : }
2254 10 : thisVrfSys.EvapCondEffectiveness = rNumericArgs(24);
2255 10 : thisVrfSys.EvapCondAirVolFlowRate = rNumericArgs(25);
2256 10 : thisVrfSys.EvapCondPumpPower = rNumericArgs(26);
2257 :
2258 : // Get Water System tank connections
2259 : // A37, \field Supply Water Storage Tank Name
2260 10 : thisVrfSys.EvapWaterSupplyName = cAlphaArgs(37);
2261 10 : if (lAlphaFieldBlanks(37)) {
2262 10 : thisVrfSys.EvapWaterSupplyMode = EvapWaterSupply::FromMains;
2263 : } else {
2264 0 : thisVrfSys.EvapWaterSupplyMode = EvapWaterSupply::FromTank;
2265 0 : SetupTankDemandComponent(state,
2266 : thisVrfSys.Name,
2267 : cCurrentModuleObject,
2268 : thisVrfSys.EvapWaterSupplyName,
2269 : ErrorsFound,
2270 0 : thisVrfSys.EvapWaterSupTankID,
2271 0 : thisVrfSys.EvapWaterTankDemandARRID);
2272 : }
2273 :
2274 : // Basin heater power as a function of temperature must be greater than or equal to 0
2275 10 : thisVrfSys.BasinHeaterPowerFTempDiff = rNumericArgs(27);
2276 10 : if (rNumericArgs(27) < 0.0) {
2277 0 : ShowSevereError(state, format("{}, \"{}\" {} must be >= 0", cCurrentModuleObject, thisVrfSys.Name, cNumericFieldNames(27)));
2278 0 : ErrorsFound = true;
2279 : }
2280 :
2281 10 : thisVrfSys.BasinHeaterSetPointTemp = rNumericArgs(28);
2282 10 : if (thisVrfSys.BasinHeaterPowerFTempDiff > 0.0) {
2283 0 : if (NumNums < 27) {
2284 0 : thisVrfSys.BasinHeaterSetPointTemp = 2.0;
2285 : }
2286 0 : if (thisVrfSys.BasinHeaterSetPointTemp < 2.0) {
2287 0 : ShowWarningError(
2288 : state,
2289 0 : format(
2290 0 : "{}, \"{}\" {} is less than 2 deg C. Freezing could occur.", cCurrentModuleObject, thisVrfSys.Name, cNumericFieldNames(28)));
2291 : }
2292 : }
2293 :
2294 10 : if (!lAlphaFieldBlanks(38)) {
2295 0 : thisVrfSys.BasinHeaterSchedulePtr = GetScheduleIndex(state, cAlphaArgs(38));
2296 0 : if (thisVrfSys.BasinHeaterSchedulePtr == 0) {
2297 0 : ShowSevereError(
2298 : state,
2299 0 : format("{} = \"{}\", {} = \"{}\" was not found.", cCurrentModuleObject, thisVrfSys.Name, cAlphaFieldNames(38), cAlphaArgs(38)));
2300 0 : ShowContinueError(state, "Basin heater will be available to operate throughout the simulation.");
2301 : }
2302 : }
2303 :
2304 10 : if (!lAlphaFieldBlanks(39)) {
2305 : // A39; \field Fuel type, Validate fuel type input
2306 10 : thisVrfSys.fuel = static_cast<Constant::eFuel>(getEnumValue(Constant::eFuelNamesUC, cAlphaArgs(39)));
2307 10 : if (thisVrfSys.fuel == Constant::eFuel::Invalid) {
2308 0 : ShowSevereError(
2309 : state,
2310 0 : format("{} = \"{}\", {} = \"{}\" was not found.", cCurrentModuleObject, thisVrfSys.Name, cAlphaFieldNames(39), cAlphaArgs(39)));
2311 0 : ShowContinueError(
2312 : state, "Valid choices are Electricity, NaturalGas, Propane, Diesel, Gasoline, FuelOilNo1, FuelOilNo2, OtherFuel1 or OtherFuel2");
2313 0 : ErrorsFound = true;
2314 : }
2315 : }
2316 :
2317 10 : if (thisVrfSys.HeatRecoveryUsed) {
2318 1 : if (lAlphaFieldBlanks(29)) {
2319 0 : thisVrfSys.MinOATHeatRecovery = max(thisVrfSys.MinOATCooling, thisVrfSys.MinOATHeating);
2320 : } else {
2321 1 : thisVrfSys.MinOATHeatRecovery = rNumericArgs(29);
2322 1 : if (thisVrfSys.MinOATHeatRecovery < thisVrfSys.MinOATCooling || thisVrfSys.MinOATHeatRecovery < thisVrfSys.MinOATHeating) {
2323 0 : ShowWarningError(state,
2324 0 : format("{} = \"{}\", {} is less than the minimum temperature in heat pump mode.",
2325 : cCurrentModuleObject,
2326 0 : thisVrfSys.Name,
2327 : cNumericFieldNames(29)));
2328 0 : ShowContinueError(state, format("...{} = {:.2T} C", cNumericFieldNames(29), thisVrfSys.MinOATHeatRecovery));
2329 0 : ShowContinueError(state, format("...Minimum Outdoor Temperature in Cooling Mode = {:.2T} C", thisVrfSys.MinOATCooling));
2330 0 : ShowContinueError(state, format("...Minimum Outdoor Temperature in Heating Mode = {:.2T} C", thisVrfSys.MinOATHeating));
2331 0 : ShowContinueError(state,
2332 : "...Minimum Outdoor Temperature in Heat Recovery Mode reset to greater of cooling or heating minimum "
2333 : "temperature and simulation continues.");
2334 0 : thisVrfSys.MinOATHeatRecovery = max(thisVrfSys.MinOATCooling, thisVrfSys.MinOATHeating);
2335 0 : ShowContinueError(state, format("... adjusted {} = {:.2T} C", cNumericFieldNames(29), thisVrfSys.MinOATHeatRecovery));
2336 : }
2337 : }
2338 1 : if (lAlphaFieldBlanks(30)) {
2339 1 : thisVrfSys.MaxOATHeatRecovery = min(thisVrfSys.MaxOATCooling, thisVrfSys.MaxOATHeating);
2340 : } else {
2341 0 : thisVrfSys.MaxOATHeatRecovery = rNumericArgs(30);
2342 0 : if (thisVrfSys.MaxOATHeatRecovery > thisVrfSys.MaxOATCooling || thisVrfSys.MaxOATHeatRecovery > thisVrfSys.MaxOATHeating) {
2343 0 : ShowWarningError(state,
2344 0 : format("{} = \"{}\", {} is greater than the maximum temperature in heat pump mode.",
2345 : cCurrentModuleObject,
2346 0 : thisVrfSys.Name,
2347 : cNumericFieldNames(30)));
2348 0 : ShowContinueError(state, format("...{} = {:.2T} C", cNumericFieldNames(30), thisVrfSys.MaxOATHeatRecovery));
2349 0 : ShowContinueError(state, format("...Maximum Outdoor Temperature in Cooling Mode = {:.2T} C", thisVrfSys.MaxOATCooling));
2350 0 : ShowContinueError(state, format("...Maximum Outdoor Temperature in Heating Mode = {:.2T} C", thisVrfSys.MaxOATHeating));
2351 0 : ShowContinueError(state,
2352 : "...Maximum Outdoor Temperature in Heat Recovery Mode reset to lesser of cooling or heating minimum "
2353 : "temperature and simulation continues.");
2354 0 : thisVrfSys.MaxOATHeatRecovery = min(thisVrfSys.MaxOATCooling, thisVrfSys.MaxOATHeating);
2355 0 : ShowContinueError(state, format("... adjusted {} = {:.2T} C", cNumericFieldNames(30), thisVrfSys.MaxOATHeatRecovery));
2356 : }
2357 : }
2358 :
2359 1 : thisVrfSys.HRCAPFTCool = GetCurveIndex(state, cAlphaArgs(40));
2360 1 : if (thisVrfSys.HRCAPFTCool > 0) {
2361 : // Verify Curve Object, only legal type is bi-quadratic or linear, quadratic, or cubic
2362 0 : ErrorsFound |= Curve::CheckCurveDims(state,
2363 : thisVrfSys.HRCAPFTCool, // Curve index
2364 : {1, 2}, // Valid dimensions // MULTIPLECURVEDIMS
2365 : RoutineName, // Routine name
2366 : cCurrentModuleObject, // Object Type
2367 : thisVrfSys.Name, // Object Name
2368 0 : cAlphaFieldNames(40)); // Field Name
2369 : }
2370 1 : if (!lNumericFieldBlanks(31)) {
2371 0 : thisVrfSys.HRInitialCoolCapFrac = rNumericArgs(31);
2372 : }
2373 1 : thisVrfSys.HRCoolCapTC = rNumericArgs(32);
2374 1 : thisVrfSys.HREIRFTCool = GetCurveIndex(state, cAlphaArgs(41));
2375 1 : if (thisVrfSys.HREIRFTCool > 0) {
2376 : // Verify Curve Object, only legal type is bi-quadratic or linear, quadratic, or cubic
2377 0 : ErrorsFound |= Curve::CheckCurveDims(state,
2378 : thisVrfSys.HREIRFTCool, // Curve index
2379 : {1, 2}, // Valid dimensions // MULTIPLECURVEDIMS
2380 : RoutineName, // Routine name
2381 : cCurrentModuleObject, // Object Type
2382 : thisVrfSys.Name, // Object Name
2383 0 : cAlphaFieldNames(41)); // Field Name
2384 : }
2385 1 : thisVrfSys.HRInitialCoolEIRFrac = rNumericArgs(33);
2386 1 : thisVrfSys.HRCoolEIRTC = rNumericArgs(34);
2387 :
2388 : // INTEGER :: HRCAPFTHeat =0 ! Index to heat capacity as a function of temperature curve for heat recovery
2389 : // REAL(r64) :: HRInitialHeatCapFrac =0.0d0 ! Fractional heating degradation at the start of heat recovery from heating mode
2390 : // REAL(r64) :: HRHeatCapTC =0.0d0 ! Time constant used to recover from initial degradation in heating heat
2391 : // recovery
2392 1 : thisVrfSys.HRCAPFTHeat = GetCurveIndex(state, cAlphaArgs(42));
2393 1 : if (thisVrfSys.HRCAPFTHeat > 0) {
2394 : // Verify Curve Object, only legal type is bi-quadratic or linear, quadratic, or cubic
2395 0 : ErrorsFound |= Curve::CheckCurveDims(state,
2396 : thisVrfSys.HRCAPFTHeat, // Curve index
2397 : {1, 2}, // Valid dimensions // MULTIPLECURVEDIMS
2398 : RoutineName, // Routine name
2399 : cCurrentModuleObject, // Object Type
2400 : thisVrfSys.Name, // Object Name
2401 0 : cAlphaFieldNames(42)); // Field Name
2402 : }
2403 1 : thisVrfSys.HRInitialHeatCapFrac = rNumericArgs(35);
2404 1 : thisVrfSys.HRHeatCapTC = rNumericArgs(36);
2405 :
2406 : // INTEGER :: HREIRFTHeat =0 ! Index to heat EIR as a function of temperature curve for heat recovery
2407 : // REAL(r64) :: HRInitialHeatEIRFrac =0.0d0 ! Fractional EIR degradation at the start of heat recovery from heating mode
2408 : // REAL(r64) :: HRHeatEIRTC =0.0d0 ! Time constant used to recover from initial degradation in heating heat
2409 : // recovery
2410 1 : thisVrfSys.HREIRFTHeat = GetCurveIndex(state, cAlphaArgs(43));
2411 1 : if (thisVrfSys.HREIRFTHeat > 0) {
2412 : // Verify Curve Object, only legal type is bi-quadratic or linear, quadratic, or cubic
2413 0 : ErrorsFound |= Curve::CheckCurveDims(state,
2414 : thisVrfSys.HREIRFTHeat, // Curve index
2415 : {1, 2}, // Valid dimensions // MULTIPLECURVEDIMS
2416 : RoutineName, // Routine name
2417 : cCurrentModuleObject, // Object Type
2418 : thisVrfSys.Name, // Object Name
2419 0 : cAlphaFieldNames(43)); // Field Name
2420 : }
2421 1 : thisVrfSys.HRInitialHeatEIRFrac = rNumericArgs(37);
2422 1 : thisVrfSys.HRHeatEIRTC = rNumericArgs(38);
2423 : }
2424 : }
2425 :
2426 : // Read all VRF condenser objects: Algorithm Type 2_physics based model (VRF-FluidTCtrl-HP)
2427 13 : cCurrentModuleObject = "AirConditioner:VariableRefrigerantFlow:FluidTemperatureControl";
2428 16 : for (int thisNum = 1; thisNum <= state.dataHVACVarRefFlow->NumVRFCond_FluidTCtrl_HP; ++thisNum) {
2429 :
2430 3 : state.dataInputProcessing->inputProcessor->getObjectItem(state,
2431 : cCurrentModuleObject,
2432 : thisNum,
2433 : cAlphaArgs,
2434 : NumAlphas,
2435 : rNumericArgs,
2436 : NumNums,
2437 : IOStat,
2438 : lNumericFieldBlanks,
2439 : lAlphaFieldBlanks,
2440 : cAlphaFieldNames,
2441 : cNumericFieldNames);
2442 :
2443 3 : ErrorObjectHeader eoh{routineName, cCurrentModuleObject, cAlphaArgs(1)};
2444 :
2445 3 : GlobalNames::VerifyUniqueInterObjectName(
2446 6 : state, state.dataHVACVarRefFlow->VrfUniqueNames, cAlphaArgs(1), cCurrentModuleObject, cAlphaFieldNames(1), ErrorsFound);
2447 :
2448 3 : int VRFNum = state.dataHVACVarRefFlow->NumVRFCond_SysCurve + thisNum;
2449 3 : auto &thisVrfFluidCtrl = state.dataHVACVarRefFlow->VRF(VRFNum);
2450 3 : thisVrfFluidCtrl.Name = cAlphaArgs(1);
2451 3 : thisVrfFluidCtrl.VRFSystemTypeNum = VRF_HeatPump;
2452 3 : thisVrfFluidCtrl.VRFAlgorithmType = AlgorithmType::FluidTCtrl;
2453 3 : thisVrfFluidCtrl.fuel = Constant::eFuel::Electricity;
2454 :
2455 3 : if (lAlphaFieldBlanks(2)) {
2456 0 : thisVrfFluidCtrl.SchedPtr = ScheduleManager::ScheduleAlwaysOn;
2457 : } else {
2458 3 : thisVrfFluidCtrl.SchedPtr = GetScheduleIndex(state, cAlphaArgs(2));
2459 3 : if (thisVrfFluidCtrl.SchedPtr == 0) {
2460 0 : ShowSevereError(state, cCurrentModuleObject + "=\"" + thisVrfFluidCtrl.Name + "\" invalid data");
2461 0 : ShowContinueError(state, "Invalid-not found " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\".");
2462 0 : ErrorsFound = true;
2463 : }
2464 : }
2465 :
2466 3 : thisVrfFluidCtrl.ZoneTUListPtr =
2467 3 : Util::FindItemInList(cAlphaArgs(3), state.dataHVACVarRefFlow->TerminalUnitList, state.dataHVACVarRefFlow->NumVRFTULists);
2468 3 : if (thisVrfFluidCtrl.ZoneTUListPtr == 0) {
2469 0 : ShowSevereError(state, cCurrentModuleObject + " = \"" + thisVrfFluidCtrl.Name + "\"");
2470 0 : ShowContinueError(state, cAlphaFieldNames(3) + " = " + cAlphaArgs(3) + " not found.");
2471 0 : ErrorsFound = true;
2472 : }
2473 :
2474 : // Refrigerant type
2475 3 : thisVrfFluidCtrl.refrigName = cAlphaArgs(4);
2476 3 : thisVrfFluidCtrl.refrig = FluidProperties::GetRefrig(state, thisVrfFluidCtrl.refrigName);
2477 3 : if (thisVrfFluidCtrl.refrig == nullptr) {
2478 0 : ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(4), cAlphaArgs(4));
2479 0 : ErrorsFound = true;
2480 : }
2481 :
2482 3 : thisVrfFluidCtrl.RatedEvapCapacity = rNumericArgs(1);
2483 3 : thisVrfFluidCtrl.RatedCompPowerPerCapcity = rNumericArgs(2);
2484 3 : thisVrfFluidCtrl.RatedCompPower = thisVrfFluidCtrl.RatedCompPowerPerCapcity * thisVrfFluidCtrl.RatedEvapCapacity;
2485 3 : thisVrfFluidCtrl.CoolingCapacity = thisVrfFluidCtrl.RatedEvapCapacity;
2486 3 : thisVrfFluidCtrl.RatedHeatCapacity = thisVrfFluidCtrl.RatedEvapCapacity * (1 + thisVrfFluidCtrl.RatedCompPowerPerCapcity);
2487 3 : thisVrfFluidCtrl.HeatingCapacity = thisVrfFluidCtrl.RatedHeatCapacity;
2488 :
2489 : // Reference system COP
2490 3 : thisVrfFluidCtrl.CoolingCOP = 1 / thisVrfFluidCtrl.RatedCompPowerPerCapcity;
2491 3 : thisVrfFluidCtrl.HeatingCOP = 1 / thisVrfFluidCtrl.RatedCompPowerPerCapcity + 1;
2492 :
2493 : // OA temperature range for VRF-HP operations
2494 3 : thisVrfFluidCtrl.MinOATCooling = rNumericArgs(3);
2495 3 : thisVrfFluidCtrl.MaxOATCooling = rNumericArgs(4);
2496 3 : thisVrfFluidCtrl.MinOATHeating = rNumericArgs(5);
2497 3 : thisVrfFluidCtrl.MaxOATHeating = rNumericArgs(6);
2498 3 : if (thisVrfFluidCtrl.MinOATCooling >= thisVrfFluidCtrl.MaxOATCooling) {
2499 0 : ShowSevereError(state, cCurrentModuleObject + ", \"" + thisVrfFluidCtrl.Name + "\"");
2500 0 : ShowContinueError(state,
2501 0 : format("... {} ({:.3T}) must be less than maximum ({:.3T}).",
2502 : cNumericFieldNames(3),
2503 0 : thisVrfFluidCtrl.MinOATCooling,
2504 0 : thisVrfFluidCtrl.MaxOATCooling));
2505 0 : ErrorsFound = true;
2506 : }
2507 3 : if (thisVrfFluidCtrl.MinOATHeating >= thisVrfFluidCtrl.MaxOATHeating) {
2508 0 : ShowSevereError(state, cCurrentModuleObject + ", \"" + thisVrfFluidCtrl.Name + "\"");
2509 0 : ShowContinueError(state,
2510 0 : format("... {} ({:.3T}) must be less than maximum ({:.3T}).",
2511 : cNumericFieldNames(5),
2512 0 : thisVrfFluidCtrl.MinOATHeating,
2513 0 : thisVrfFluidCtrl.MaxOATHeating));
2514 0 : ErrorsFound = true;
2515 : }
2516 :
2517 : // Reference OU SH/SC
2518 3 : thisVrfFluidCtrl.SH = rNumericArgs(7);
2519 3 : thisVrfFluidCtrl.SC = rNumericArgs(8);
2520 :
2521 3 : if (Util::SameString(cAlphaArgs(5), "VariableTemp")) {
2522 1 : thisVrfFluidCtrl.AlgorithmIUCtrl = 1;
2523 2 : } else if (Util::SameString(cAlphaArgs(5), "ConstantTemp")) {
2524 2 : thisVrfFluidCtrl.AlgorithmIUCtrl = 2;
2525 : } else {
2526 0 : thisVrfFluidCtrl.AlgorithmIUCtrl = 1;
2527 : }
2528 :
2529 : // Reference IU Te/Tc for IU Control Algorithm: ConstantTemp
2530 3 : thisVrfFluidCtrl.EvapTempFixed = rNumericArgs(9);
2531 3 : thisVrfFluidCtrl.CondTempFixed = rNumericArgs(10);
2532 :
2533 : // Bounds of Te/Tc for IU Control Algorithm: VariableTemp
2534 3 : thisVrfFluidCtrl.IUEvapTempLow = rNumericArgs(11);
2535 3 : thisVrfFluidCtrl.IUEvapTempHigh = rNumericArgs(12);
2536 3 : thisVrfFluidCtrl.IUCondTempLow = rNumericArgs(13);
2537 3 : thisVrfFluidCtrl.IUCondTempHigh = rNumericArgs(14);
2538 3 : if (thisVrfFluidCtrl.IUEvapTempLow >= thisVrfFluidCtrl.IUEvapTempHigh) {
2539 0 : ShowSevereError(state, cCurrentModuleObject + ", \"" + thisVrfFluidCtrl.Name + "\"");
2540 0 : ShowContinueError(state,
2541 0 : format("... {} ({:.3T}) must be less than maximum ({:.3T}).",
2542 : cNumericFieldNames(11),
2543 0 : thisVrfFluidCtrl.IUEvapTempLow,
2544 0 : thisVrfFluidCtrl.IUEvapTempHigh));
2545 0 : ErrorsFound = true;
2546 : }
2547 3 : if (thisVrfFluidCtrl.IUCondTempLow >= thisVrfFluidCtrl.IUCondTempHigh) {
2548 0 : ShowSevereError(state, cCurrentModuleObject + ", \"" + thisVrfFluidCtrl.Name + "\"");
2549 0 : ShowContinueError(state,
2550 0 : format("... {} ({:.3T}) must be less than maximum ({:.3T}).",
2551 : cNumericFieldNames(13),
2552 0 : thisVrfFluidCtrl.IUCondTempLow,
2553 0 : thisVrfFluidCtrl.IUCondTempHigh));
2554 0 : ErrorsFound = true;
2555 : }
2556 :
2557 : // Get OU fan data
2558 3 : thisVrfFluidCtrl.RatedOUFanPowerPerCapcity = rNumericArgs(15);
2559 3 : thisVrfFluidCtrl.OUAirFlowRatePerCapcity = rNumericArgs(16);
2560 3 : thisVrfFluidCtrl.RatedOUFanPower = thisVrfFluidCtrl.RatedOUFanPowerPerCapcity * thisVrfFluidCtrl.RatedEvapCapacity;
2561 3 : thisVrfFluidCtrl.OUAirFlowRate = thisVrfFluidCtrl.OUAirFlowRatePerCapcity * thisVrfFluidCtrl.RatedEvapCapacity;
2562 :
2563 : // OUEvapTempCurve
2564 3 : int indexOUEvapTempCurve = GetCurveIndex(state, cAlphaArgs(6)); // convert curve name to index number
2565 : // Verify curve name and type
2566 3 : if (indexOUEvapTempCurve == 0) {
2567 0 : if (lAlphaFieldBlanks(6)) {
2568 0 : ShowSevereError(state, std::string{RoutineName} + cCurrentModuleObject + "=\"" + thisVrfFluidCtrl.Name + "\", missing");
2569 0 : ShowContinueError(state, "...required " + cAlphaFieldNames(6) + " is blank.");
2570 : } else {
2571 0 : ShowSevereError(state, std::string{RoutineName} + cCurrentModuleObject + "=\"" + thisVrfFluidCtrl.Name + "\", invalid");
2572 0 : ShowContinueError(state, "...not found " + cAlphaFieldNames(6) + "=\"" + cAlphaArgs(6) + "\".");
2573 : }
2574 0 : ErrorsFound = true;
2575 : } else {
2576 : {
2577 3 : if (state.dataCurveManager->PerfCurve(indexOUEvapTempCurve)->curveType == Curve::CurveType::Quadratic) {
2578 3 : thisVrfFluidCtrl.C1Te = state.dataCurveManager->PerfCurve(indexOUEvapTempCurve)->coeff[0];
2579 3 : thisVrfFluidCtrl.C2Te = state.dataCurveManager->PerfCurve(indexOUEvapTempCurve)->coeff[1];
2580 3 : thisVrfFluidCtrl.C3Te = state.dataCurveManager->PerfCurve(indexOUEvapTempCurve)->coeff[2];
2581 :
2582 : } else {
2583 0 : ShowSevereError(state, std::string{RoutineName} + cCurrentModuleObject + "=\"" + thisVrfFluidCtrl.Name + "\", invalid");
2584 0 : ShowContinueError(
2585 : state,
2586 0 : format("...illegal {} type for this object = {}",
2587 : cAlphaFieldNames(6),
2588 0 : Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(indexOUEvapTempCurve)->curveType)]));
2589 0 : ShowContinueError(state, "... Curve type must be Quadratic.");
2590 0 : ErrorsFound = true;
2591 : }
2592 : }
2593 : }
2594 :
2595 : // OUCondTempCurve
2596 3 : int indexOUCondTempCurve = GetCurveIndex(state, cAlphaArgs(7)); // convert curve name to index number
2597 : // Verify curve name and type
2598 3 : if (indexOUCondTempCurve == 0) {
2599 0 : if (lAlphaFieldBlanks(7)) {
2600 0 : ShowSevereError(state, std::string{RoutineName} + cCurrentModuleObject + "=\"" + thisVrfFluidCtrl.Name + "\", missing");
2601 0 : ShowContinueError(state, "...required " + cAlphaFieldNames(7) + " is blank.");
2602 : } else {
2603 0 : ShowSevereError(state, std::string{RoutineName} + cCurrentModuleObject + "=\"" + thisVrfFluidCtrl.Name + "\", invalid");
2604 0 : ShowContinueError(state, "...not found " + cAlphaFieldNames(7) + "=\"" + cAlphaArgs(7) + "\".");
2605 : }
2606 0 : ErrorsFound = true;
2607 : } else {
2608 : {
2609 3 : if (state.dataCurveManager->PerfCurve(indexOUCondTempCurve)->curveType == Curve::CurveType::Quadratic) {
2610 3 : thisVrfFluidCtrl.C1Tc = state.dataCurveManager->PerfCurve(indexOUCondTempCurve)->coeff[0];
2611 3 : thisVrfFluidCtrl.C2Tc = state.dataCurveManager->PerfCurve(indexOUCondTempCurve)->coeff[1];
2612 3 : thisVrfFluidCtrl.C3Tc = state.dataCurveManager->PerfCurve(indexOUCondTempCurve)->coeff[2];
2613 :
2614 : } else {
2615 0 : ShowSevereError(state, std::string{RoutineName} + cCurrentModuleObject + "=\"" + thisVrfFluidCtrl.Name + "\", invalid");
2616 0 : ShowContinueError(
2617 : state,
2618 0 : format("...illegal {} type for this object = {}",
2619 : cAlphaFieldNames(7),
2620 0 : Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(indexOUCondTempCurve)->curveType)]));
2621 0 : ShowContinueError(state, "... Curve type must be Quadratic.");
2622 0 : ErrorsFound = true;
2623 : }
2624 : }
2625 : }
2626 :
2627 : // Pipe parameters
2628 3 : thisVrfFluidCtrl.RefPipDiaSuc = rNumericArgs(17);
2629 3 : thisVrfFluidCtrl.RefPipDiaDis = rNumericArgs(17);
2630 3 : thisVrfFluidCtrl.RefPipLen = rNumericArgs(18);
2631 3 : thisVrfFluidCtrl.RefPipEquLen = rNumericArgs(19);
2632 3 : thisVrfFluidCtrl.RefPipHei = rNumericArgs(20);
2633 3 : thisVrfFluidCtrl.RefPipInsThi = rNumericArgs(21);
2634 3 : thisVrfFluidCtrl.RefPipInsCon = rNumericArgs(22);
2635 :
2636 : // Check the RefPipEquLen
2637 3 : if (lNumericFieldBlanks(19) && !lNumericFieldBlanks(18)) {
2638 0 : thisVrfFluidCtrl.RefPipEquLen = 1.2 * thisVrfFluidCtrl.RefPipLen;
2639 0 : ShowWarningError(
2640 0 : state, cCurrentModuleObject + ", \"" + thisVrfFluidCtrl.Name + "\", \" " + cNumericFieldNames(19) + "\" is calculated based on");
2641 0 : ShowContinueError(state, "...the provided \"" + cNumericFieldNames(18) + "\" value.");
2642 : }
2643 3 : if (thisVrfFluidCtrl.RefPipEquLen < thisVrfFluidCtrl.RefPipLen) {
2644 0 : thisVrfFluidCtrl.RefPipEquLen = 1.2 * thisVrfFluidCtrl.RefPipLen;
2645 0 : ShowWarningError(state, cCurrentModuleObject + ", \"" + thisVrfFluidCtrl.Name + "\", invalid \" " + cNumericFieldNames(19) + "\" value.");
2646 0 : ShowContinueError(state, "...Equivalent length of main pipe should be greater than or equal to the actual length.");
2647 0 : ShowContinueError(state, format("...The value is recalculated based on the provided \"{}\" value.", cNumericFieldNames(18)));
2648 : }
2649 :
2650 : // Crank case
2651 3 : thisVrfFluidCtrl.CCHeaterPower = rNumericArgs(23);
2652 3 : thisVrfFluidCtrl.NumCompressors = rNumericArgs(24);
2653 3 : thisVrfFluidCtrl.CompressorSizeRatio = rNumericArgs(25);
2654 3 : thisVrfFluidCtrl.MaxOATCCHeater = rNumericArgs(26);
2655 :
2656 : // Defrost
2657 3 : if (!lAlphaFieldBlanks(8)) {
2658 0 : if (Util::SameString(cAlphaArgs(8), "ReverseCycle")) thisVrfFluidCtrl.DefrostStrategy = StandardRatings::DefrostStrat::ReverseCycle;
2659 0 : if (Util::SameString(cAlphaArgs(8), "Resistive")) thisVrfFluidCtrl.DefrostStrategy = StandardRatings::DefrostStrat::Resistive;
2660 0 : if (thisVrfFluidCtrl.DefrostStrategy == StandardRatings::DefrostStrat::Invalid) {
2661 0 : ShowSevereError(state,
2662 0 : cCurrentModuleObject + ", \"" + thisVrfFluidCtrl.Name + "\" " + cAlphaFieldNames(8) + " not found: " + cAlphaArgs(8));
2663 0 : ErrorsFound = true;
2664 : }
2665 : } else {
2666 3 : thisVrfFluidCtrl.DefrostStrategy = StandardRatings::DefrostStrat::ReverseCycle;
2667 : }
2668 :
2669 3 : if (!lAlphaFieldBlanks(9)) {
2670 0 : if (Util::SameString(cAlphaArgs(9), "Timed")) thisVrfFluidCtrl.DefrostControl = StandardRatings::HPdefrostControl::Timed;
2671 0 : if (Util::SameString(cAlphaArgs(9), "OnDemand")) thisVrfFluidCtrl.DefrostControl = StandardRatings::HPdefrostControl::OnDemand;
2672 0 : if (thisVrfFluidCtrl.DefrostControl == StandardRatings::HPdefrostControl::Invalid) {
2673 0 : ShowSevereError(state,
2674 0 : cCurrentModuleObject + ", \"" + thisVrfFluidCtrl.Name + "\" " + cAlphaFieldNames(9) + " not found: " + cAlphaArgs(9));
2675 0 : ErrorsFound = true;
2676 : }
2677 : } else {
2678 3 : thisVrfFluidCtrl.DefrostControl = StandardRatings::HPdefrostControl::Timed;
2679 : }
2680 :
2681 3 : if (!lAlphaFieldBlanks(10)) {
2682 0 : thisVrfFluidCtrl.DefrostEIRPtr = GetCurveIndex(state, cAlphaArgs(10));
2683 0 : if (thisVrfFluidCtrl.DefrostEIRPtr > 0) {
2684 : // Verify Curve Object, expected type is BiQuadratic
2685 0 : ErrorsFound |= Curve::CheckCurveDims(state,
2686 : thisVrfFluidCtrl.DefrostEIRPtr, // Curve index
2687 : {2}, // Valid dimensions
2688 : RoutineName, // Routine name
2689 : cCurrentModuleObject, // Object Type
2690 : thisVrfFluidCtrl.Name, // Object Name
2691 0 : cAlphaFieldNames(10)); // Field Name
2692 : } else {
2693 0 : if (thisVrfFluidCtrl.DefrostStrategy == StandardRatings::DefrostStrat::ReverseCycle &&
2694 0 : thisVrfFluidCtrl.DefrostControl == StandardRatings::HPdefrostControl::OnDemand) {
2695 0 : ShowSevereError(
2696 0 : state, cCurrentModuleObject + ", \"" + thisVrfFluidCtrl.Name + "\" " + cAlphaFieldNames(10) + " not found:" + cAlphaArgs(10));
2697 0 : ErrorsFound = true;
2698 : }
2699 : }
2700 : } else {
2701 3 : if (thisVrfFluidCtrl.DefrostStrategy == StandardRatings::DefrostStrat::ReverseCycle &&
2702 3 : thisVrfFluidCtrl.DefrostControl == StandardRatings::HPdefrostControl::OnDemand) {
2703 0 : ShowSevereError(
2704 0 : state, cCurrentModuleObject + ", \"" + thisVrfFluidCtrl.Name + "\" " + cAlphaFieldNames(10) + " not found:" + cAlphaArgs(10));
2705 0 : ErrorsFound = true;
2706 : }
2707 : }
2708 :
2709 3 : thisVrfFluidCtrl.DefrostFraction = rNumericArgs(27);
2710 3 : thisVrfFluidCtrl.DefrostCapacity = rNumericArgs(28);
2711 3 : thisVrfFluidCtrl.MaxOATDefrost = rNumericArgs(29);
2712 3 : if (thisVrfFluidCtrl.DefrostCapacity == 0.0 && thisVrfFluidCtrl.DefrostStrategy == StandardRatings::DefrostStrat::Resistive) {
2713 0 : ShowWarningError(state,
2714 0 : cCurrentModuleObject + ", \"" + thisVrfFluidCtrl.Name + "\" " + cNumericFieldNames(28) +
2715 : " = 0.0 for defrost strategy = RESISTIVE.");
2716 : }
2717 :
2718 3 : thisVrfFluidCtrl.CompMaxDeltaP = rNumericArgs(30);
2719 :
2720 : //@@ The control type
2721 3 : std::string ThermostatPriorityType = "LoadPriority"; // cAlphaArgs( 25 )
2722 3 : if (Util::SameString(ThermostatPriorityType, "LoadPriority")) {
2723 3 : thisVrfFluidCtrl.ThermostatPriority = ThermostatCtrlType::LoadPriority;
2724 0 : } else if (Util::SameString(ThermostatPriorityType, "ZonePriority")) {
2725 0 : thisVrfFluidCtrl.ThermostatPriority = ThermostatCtrlType::ZonePriority;
2726 0 : } else if (Util::SameString(ThermostatPriorityType, "ThermostatOffsetPriority")) {
2727 0 : thisVrfFluidCtrl.ThermostatPriority = ThermostatCtrlType::ThermostatOffsetPriority;
2728 0 : } else if (Util::SameString(ThermostatPriorityType, "Scheduled")) {
2729 0 : thisVrfFluidCtrl.ThermostatPriority = ThermostatCtrlType::ScheduledPriority;
2730 0 : } else if (Util::SameString(ThermostatPriorityType, "MasterThermostatPriority")) {
2731 0 : thisVrfFluidCtrl.ThermostatPriority = ThermostatCtrlType::MasterThermostatPriority;
2732 0 : if (thisVrfFluidCtrl.MasterZonePtr == 0) {
2733 0 : ShowSevereError(state, cCurrentModuleObject + " = \"" + thisVrfFluidCtrl.Name + "\"");
2734 : //** ShowContinueError(state, cAlphaFieldNames( 24 ) + " must be entered when " + cAlphaFieldNames( 25 ) + " = " + cAlphaArgs( 25 )
2735 : //);
2736 0 : ErrorsFound = true;
2737 : }
2738 : } else {
2739 0 : ShowSevereError(state, cCurrentModuleObject + " = " + thisVrfFluidCtrl.Name);
2740 : // ShowContinueError(state, "Illegal " + cAlphaFieldNames( 25 ) + " = " + cAlphaArgs( 25 ) );
2741 0 : ErrorsFound = true;
2742 : }
2743 :
2744 : // The new VRF model is Air cooled
2745 3 : thisVrfFluidCtrl.CondenserType = DataHeatBalance::RefrigCondenserType::Air;
2746 3 : thisVrfFluidCtrl.CondenserNodeNum = 0;
2747 :
2748 : // Evaporative Capacity & Compressor Power Curves corresponding to each Loading Index / compressor speed
2749 3 : int NumOfCompSpd = rNumericArgs(31);
2750 3 : thisVrfFluidCtrl.CompressorSpeed.dimension(NumOfCompSpd);
2751 3 : thisVrfFluidCtrl.OUCoolingCAPFT.dimension(NumOfCompSpd);
2752 3 : thisVrfFluidCtrl.OUCoolingPWRFT.dimension(NumOfCompSpd);
2753 3 : int Count1Index = 31; // the index of the last numeric field before compressor speed entries
2754 3 : int Count2Index = 9; // the index of the last alpha field before capacity/power curves
2755 17 : for (int NumCompSpd = 1; NumCompSpd <= NumOfCompSpd; NumCompSpd++) {
2756 14 : thisVrfFluidCtrl.CompressorSpeed(NumCompSpd) = rNumericArgs(Count1Index + NumCompSpd);
2757 :
2758 : // Evaporating Capacity Curve
2759 14 : if (!lAlphaFieldBlanks(Count2Index + 2 * NumCompSpd)) {
2760 14 : int indexOUEvapCapCurve = GetCurveIndex(state, cAlphaArgs(Count2Index + 2 * NumCompSpd)); // convert curve name to index number
2761 14 : if (indexOUEvapCapCurve == 0) { // Verify curve name and type
2762 0 : if (lAlphaFieldBlanks(Count2Index + 2 * NumCompSpd)) {
2763 0 : ShowSevereError(state, std::string{RoutineName} + cCurrentModuleObject + "=\"" + thisVrfFluidCtrl.Name + "\", missing");
2764 0 : ShowContinueError(state, "...required " + cAlphaFieldNames(Count2Index + 2 * NumCompSpd) + " is blank.");
2765 : } else {
2766 0 : ShowSevereError(state, std::string{RoutineName} + cCurrentModuleObject + "=\"" + thisVrfFluidCtrl.Name + "\", invalid");
2767 0 : ShowContinueError(state,
2768 0 : format("...not found {}=\"{}\".",
2769 0 : cAlphaFieldNames(Count2Index + 2 * NumCompSpd),
2770 0 : cAlphaArgs(Count2Index + 2 * NumCompSpd)));
2771 : }
2772 0 : ErrorsFound = true;
2773 : } else {
2774 14 : ErrorsFound |= Curve::CheckCurveDims(state,
2775 : indexOUEvapCapCurve, // Curve index
2776 : {2}, // Valid dimensions
2777 : RoutineName, // Routine name
2778 : cCurrentModuleObject, // Object Type
2779 : thisVrfFluidCtrl.Name, // Object Name
2780 14 : cAlphaFieldNames(Count2Index + 2 * NumCompSpd)); // Field Name
2781 :
2782 14 : if (!ErrorsFound) {
2783 14 : thisVrfFluidCtrl.OUCoolingCAPFT(NumCompSpd) = indexOUEvapCapCurve;
2784 : }
2785 : }
2786 : }
2787 :
2788 : // Compressor Power Curve
2789 14 : if (!lAlphaFieldBlanks(Count2Index + 2 * NumCompSpd + 1)) {
2790 14 : int indexOUCompPwrCurve = GetCurveIndex(state, cAlphaArgs(Count2Index + 2 * NumCompSpd + 1)); // convert curve name to index number
2791 14 : if (indexOUCompPwrCurve == 0) { // Verify curve name and type
2792 0 : if (lAlphaFieldBlanks(Count2Index + 2 * NumCompSpd + 1)) {
2793 0 : ShowSevereError(state, std::string{RoutineName} + cCurrentModuleObject + "=\"" + thisVrfFluidCtrl.Name + "\", missing");
2794 0 : ShowContinueError(state, "...required " + cAlphaFieldNames(Count2Index + 2 * NumCompSpd + 1) + " is blank.");
2795 : } else {
2796 0 : ShowSevereError(state, std::string{RoutineName} + cCurrentModuleObject + "=\"" + thisVrfFluidCtrl.Name + "\", invalid");
2797 0 : ShowContinueError(state,
2798 0 : format("...not found {}=\"{}\".",
2799 0 : cAlphaFieldNames(Count2Index + 2 * NumCompSpd + 1),
2800 0 : cAlphaArgs(Count2Index + 2 * NumCompSpd + 1)));
2801 : }
2802 0 : ErrorsFound = true;
2803 : } else {
2804 14 : ErrorsFound |= Curve::CheckCurveDims(state,
2805 : indexOUCompPwrCurve, // Curve index
2806 : {2}, // Valid dimensions
2807 : RoutineName, // Routine name
2808 : cCurrentModuleObject, // Object Type
2809 : thisVrfFluidCtrl.Name, // Object Name
2810 14 : cAlphaFieldNames(Count2Index + 2 * NumCompSpd + 1)); // Field Name
2811 :
2812 14 : if (!ErrorsFound) {
2813 14 : thisVrfFluidCtrl.OUCoolingPWRFT(NumCompSpd) = indexOUCompPwrCurve;
2814 : }
2815 : }
2816 : }
2817 : }
2818 3 : }
2819 :
2820 : // Read all VRF condenser objects: Algorithm Type 2_physics based model (VRF-FluidTCtrl-HR)
2821 13 : cCurrentModuleObject = "AirConditioner:VariableRefrigerantFlow:FluidTemperatureControl:HR";
2822 14 : for (int thisNum = 1; thisNum <= state.dataHVACVarRefFlow->NumVRFCond_FluidTCtrl_HR; ++thisNum) {
2823 :
2824 1 : state.dataInputProcessing->inputProcessor->getObjectItem(state,
2825 : cCurrentModuleObject,
2826 : thisNum,
2827 : cAlphaArgs,
2828 : NumAlphas,
2829 : rNumericArgs,
2830 : NumNums,
2831 : IOStat,
2832 : lNumericFieldBlanks,
2833 : lAlphaFieldBlanks,
2834 : cAlphaFieldNames,
2835 : cNumericFieldNames);
2836 :
2837 1 : ErrorObjectHeader eoh{routineName, cCurrentModuleObject, cAlphaArgs(1)};
2838 :
2839 1 : GlobalNames::VerifyUniqueInterObjectName(
2840 2 : state, state.dataHVACVarRefFlow->VrfUniqueNames, cAlphaArgs(1), cCurrentModuleObject, cAlphaFieldNames(1), ErrorsFound);
2841 :
2842 1 : int VRFNum = state.dataHVACVarRefFlow->NumVRFCond_SysCurve + state.dataHVACVarRefFlow->NumVRFCond_FluidTCtrl_HP + thisNum;
2843 1 : auto &thisVrfFluidCtrlHR = state.dataHVACVarRefFlow->VRF(VRFNum);
2844 :
2845 1 : thisVrfFluidCtrlHR.Name = cAlphaArgs(1);
2846 :
2847 1 : thisVrfFluidCtrlHR.ThermostatPriority = ThermostatCtrlType::LoadPriority;
2848 1 : thisVrfFluidCtrlHR.HeatRecoveryUsed = true;
2849 1 : thisVrfFluidCtrlHR.VRFSystemTypeNum = VRF_HeatPump;
2850 1 : thisVrfFluidCtrlHR.VRFAlgorithmType = AlgorithmType::FluidTCtrl;
2851 1 : thisVrfFluidCtrlHR.fuel = Constant::eFuel::Electricity;
2852 :
2853 1 : if (lAlphaFieldBlanks(2)) {
2854 0 : thisVrfFluidCtrlHR.SchedPtr = ScheduleManager::ScheduleAlwaysOn;
2855 : } else {
2856 1 : thisVrfFluidCtrlHR.SchedPtr = GetScheduleIndex(state, cAlphaArgs(2));
2857 1 : if (thisVrfFluidCtrlHR.SchedPtr == 0) {
2858 0 : ShowSevereError(state, cCurrentModuleObject + "=\"" + thisVrfFluidCtrlHR.Name + "\" invalid data");
2859 0 : ShowContinueError(state, "Invalid-not found " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\".");
2860 0 : ErrorsFound = true;
2861 : }
2862 : }
2863 :
2864 1 : thisVrfFluidCtrlHR.ZoneTUListPtr =
2865 1 : Util::FindItemInList(cAlphaArgs(3), state.dataHVACVarRefFlow->TerminalUnitList, state.dataHVACVarRefFlow->NumVRFTULists);
2866 1 : if (thisVrfFluidCtrlHR.ZoneTUListPtr == 0) {
2867 0 : ShowSevereError(state, cCurrentModuleObject + " = \"" + thisVrfFluidCtrlHR.Name + "\"");
2868 0 : ShowContinueError(state, cAlphaFieldNames(3) + " = " + cAlphaArgs(3) + " not found.");
2869 0 : ErrorsFound = true;
2870 : }
2871 :
2872 : // Refrigerant type
2873 1 : thisVrfFluidCtrlHR.refrigName = cAlphaArgs(4);
2874 1 : if ((thisVrfFluidCtrlHR.refrig = FluidProperties::GetRefrig(state, thisVrfFluidCtrlHR.refrigName)) == nullptr) {
2875 0 : ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(4), cAlphaArgs(4));
2876 0 : ErrorsFound = true;
2877 : }
2878 :
2879 1 : thisVrfFluidCtrlHR.RatedEvapCapacity = rNumericArgs(1);
2880 1 : thisVrfFluidCtrlHR.RatedCompPowerPerCapcity = rNumericArgs(2);
2881 1 : thisVrfFluidCtrlHR.RatedCompPower = thisVrfFluidCtrlHR.RatedCompPowerPerCapcity * thisVrfFluidCtrlHR.RatedEvapCapacity;
2882 1 : thisVrfFluidCtrlHR.CoolingCapacity = thisVrfFluidCtrlHR.RatedEvapCapacity;
2883 1 : thisVrfFluidCtrlHR.HeatingCapacity = thisVrfFluidCtrlHR.RatedEvapCapacity * (1 + thisVrfFluidCtrlHR.RatedCompPowerPerCapcity);
2884 :
2885 : // Reference system COP
2886 1 : thisVrfFluidCtrlHR.CoolingCOP = 1 / thisVrfFluidCtrlHR.RatedCompPowerPerCapcity;
2887 1 : thisVrfFluidCtrlHR.HeatingCOP = 1 / thisVrfFluidCtrlHR.RatedCompPowerPerCapcity + 1;
2888 :
2889 : // OA temperature range for VRF-HP operations
2890 1 : thisVrfFluidCtrlHR.MinOATCooling = rNumericArgs(3);
2891 1 : thisVrfFluidCtrlHR.MaxOATCooling = rNumericArgs(4);
2892 1 : thisVrfFluidCtrlHR.MinOATHeating = rNumericArgs(5);
2893 1 : thisVrfFluidCtrlHR.MaxOATHeating = rNumericArgs(6);
2894 1 : thisVrfFluidCtrlHR.MinOATHeatRecovery = rNumericArgs(7);
2895 1 : thisVrfFluidCtrlHR.MaxOATHeatRecovery = rNumericArgs(8);
2896 1 : if (thisVrfFluidCtrlHR.MinOATCooling >= thisVrfFluidCtrlHR.MaxOATCooling) {
2897 0 : ShowSevereError(state, cCurrentModuleObject + ", \"" + thisVrfFluidCtrlHR.Name + "\"");
2898 0 : ShowContinueError(state,
2899 0 : format("... {} ({:.3T}) must be less than maximum ({:.3T}).",
2900 : cNumericFieldNames(3),
2901 0 : thisVrfFluidCtrlHR.MinOATCooling,
2902 0 : thisVrfFluidCtrlHR.MaxOATCooling));
2903 0 : ErrorsFound = true;
2904 : }
2905 1 : if (thisVrfFluidCtrlHR.MinOATHeating >= thisVrfFluidCtrlHR.MaxOATHeating) {
2906 0 : ShowSevereError(state, cCurrentModuleObject + ", \"" + thisVrfFluidCtrlHR.Name + "\"");
2907 0 : ShowContinueError(state,
2908 0 : format("... {} ({:.3T}) must be less than maximum ({:.3T}).",
2909 : cNumericFieldNames(5),
2910 0 : thisVrfFluidCtrlHR.MinOATHeating,
2911 0 : thisVrfFluidCtrlHR.MaxOATHeating));
2912 0 : ErrorsFound = true;
2913 : }
2914 1 : if (thisVrfFluidCtrlHR.MinOATHeatRecovery >= thisVrfFluidCtrlHR.MaxOATHeatRecovery) {
2915 0 : ShowSevereError(state, cCurrentModuleObject + ", \"" + thisVrfFluidCtrlHR.Name + "\"");
2916 0 : ShowContinueError(state,
2917 0 : format("... {} ({:.3T}) must be less than maximum ({:.3T}).",
2918 : cNumericFieldNames(7),
2919 0 : thisVrfFluidCtrlHR.MinOATHeating,
2920 0 : thisVrfFluidCtrlHR.MaxOATHeating));
2921 0 : ErrorsFound = true;
2922 : }
2923 1 : if (thisVrfFluidCtrlHR.MinOATHeatRecovery < thisVrfFluidCtrlHR.MinOATCooling &&
2924 1 : thisVrfFluidCtrlHR.MinOATHeatRecovery < thisVrfFluidCtrlHR.MinOATHeating) {
2925 0 : ShowWarningError(state,
2926 0 : cCurrentModuleObject + " = \"" + thisVrfFluidCtrlHR.Name + "\", " + cNumericFieldNames(7) +
2927 : " is less than the minimum temperature in heat pump mode.");
2928 0 : ShowContinueError(state, format("...{} = {:.2T} C", cNumericFieldNames(7), thisVrfFluidCtrlHR.MinOATHeatRecovery));
2929 0 : ShowContinueError(state, format("...Minimum Outdoor Temperature in Cooling Mode = {:.2T} C", thisVrfFluidCtrlHR.MinOATCooling));
2930 0 : ShowContinueError(state, format("...Minimum Outdoor Temperature in Heating Mode = {:.2T} C", thisVrfFluidCtrlHR.MinOATHeating));
2931 0 : ShowContinueError(state,
2932 : "...Minimum Outdoor Temperature in Heat Recovery Mode reset to lesser of cooling or heating minimum temperature "
2933 : "and simulation continues.");
2934 0 : thisVrfFluidCtrlHR.MinOATHeatRecovery = min(thisVrfFluidCtrlHR.MinOATCooling, thisVrfFluidCtrlHR.MinOATHeating);
2935 0 : ShowContinueError(state, format("... adjusted {} = {:.2T} C", cNumericFieldNames(7), thisVrfFluidCtrlHR.MinOATHeatRecovery));
2936 : }
2937 1 : if (thisVrfFluidCtrlHR.MaxOATHeatRecovery > thisVrfFluidCtrlHR.MaxOATCooling &&
2938 0 : thisVrfFluidCtrlHR.MaxOATHeatRecovery > thisVrfFluidCtrlHR.MaxOATHeating) {
2939 0 : ShowWarningError(state,
2940 0 : cCurrentModuleObject + " = \"" + thisVrfFluidCtrlHR.Name + "\", " + cNumericFieldNames(8) +
2941 : " is greater than the maximum temperature in heat pump mode.");
2942 0 : ShowContinueError(state, format("...{} = {:.2T} C", cNumericFieldNames(8), thisVrfFluidCtrlHR.MaxOATHeatRecovery));
2943 0 : ShowContinueError(state, format("...Maximum Outdoor Temperature in Cooling Mode = {:.2T} C", thisVrfFluidCtrlHR.MaxOATCooling));
2944 0 : ShowContinueError(state, format("...Maximum Outdoor Temperature in Heating Mode = {:.2T} C", thisVrfFluidCtrlHR.MaxOATHeating));
2945 0 : ShowContinueError(state,
2946 : "...Maximum Outdoor Temperature in Heat Recovery Mode reset to greater of cooling or heating maximum temperature "
2947 : "and simulation continues.");
2948 0 : thisVrfFluidCtrlHR.MaxOATHeatRecovery = max(thisVrfFluidCtrlHR.MaxOATCooling, thisVrfFluidCtrlHR.MaxOATHeating);
2949 0 : ShowContinueError(state, format("... adjusted {} = {:.2T} C", cNumericFieldNames(8), thisVrfFluidCtrlHR.MaxOATHeatRecovery));
2950 : }
2951 :
2952 : // IU Control Type
2953 1 : if (Util::SameString(cAlphaArgs(5), "VariableTemp")) {
2954 1 : thisVrfFluidCtrlHR.AlgorithmIUCtrl = 1;
2955 0 : } else if (Util::SameString(cAlphaArgs(5), "ConstantTemp")) {
2956 0 : thisVrfFluidCtrlHR.AlgorithmIUCtrl = 2;
2957 : } else {
2958 0 : thisVrfFluidCtrlHR.AlgorithmIUCtrl = 1;
2959 : }
2960 :
2961 : // Reference IU Te/Tc for IU Control Algorithm: ConstantTemp
2962 1 : thisVrfFluidCtrlHR.EvapTempFixed = rNumericArgs(9);
2963 1 : thisVrfFluidCtrlHR.CondTempFixed = rNumericArgs(10);
2964 :
2965 : // Bounds of Te/Tc for IU Control Algorithm: VariableTemp
2966 1 : thisVrfFluidCtrlHR.IUEvapTempLow = rNumericArgs(11);
2967 1 : thisVrfFluidCtrlHR.IUEvapTempHigh = rNumericArgs(12);
2968 1 : thisVrfFluidCtrlHR.IUCondTempLow = rNumericArgs(13);
2969 1 : thisVrfFluidCtrlHR.IUCondTempHigh = rNumericArgs(14);
2970 1 : if (thisVrfFluidCtrlHR.IUEvapTempLow >= thisVrfFluidCtrlHR.IUEvapTempHigh) {
2971 0 : ShowSevereError(state, cCurrentModuleObject + ", \"" + thisVrfFluidCtrlHR.Name + "\"");
2972 0 : ShowContinueError(state,
2973 0 : format("... {} ({:.3T}) must be less than maximum ({:.3T}).",
2974 : cNumericFieldNames(11),
2975 0 : thisVrfFluidCtrlHR.IUEvapTempLow,
2976 0 : thisVrfFluidCtrlHR.IUEvapTempHigh));
2977 0 : ErrorsFound = true;
2978 : }
2979 1 : if (thisVrfFluidCtrlHR.IUCondTempLow >= thisVrfFluidCtrlHR.IUCondTempHigh) {
2980 0 : ShowSevereError(state, cCurrentModuleObject + ", \"" + thisVrfFluidCtrlHR.Name + "\"");
2981 0 : ShowContinueError(state,
2982 0 : format("... {} ({:.3T}) must be less than maximum ({:.3T}).",
2983 : cNumericFieldNames(13),
2984 0 : thisVrfFluidCtrlHR.IUCondTempLow,
2985 0 : thisVrfFluidCtrlHR.IUCondTempHigh));
2986 0 : ErrorsFound = true;
2987 : }
2988 :
2989 : // Reference OU SH/SC
2990 1 : thisVrfFluidCtrlHR.SH = rNumericArgs(15);
2991 1 : thisVrfFluidCtrlHR.SC = rNumericArgs(16);
2992 1 : if (thisVrfFluidCtrlHR.SH > 20) {
2993 0 : ShowWarningError(state, cCurrentModuleObject + ", \"" + thisVrfFluidCtrlHR.Name + "\", \" " + cNumericFieldNames(15));
2994 0 : ShowContinueError(state, "...is higher than 20C, which is usually the maximum of normal range.");
2995 : }
2996 1 : if (thisVrfFluidCtrlHR.SC > 20) {
2997 0 : ShowWarningError(state, cCurrentModuleObject + ", \"" + thisVrfFluidCtrlHR.Name + "\", \" " + cNumericFieldNames(15));
2998 0 : ShowContinueError(state, "...is higher than 20C, which is usually the maximum of normal range.");
2999 : }
3000 :
3001 : // OU Heat Exchanger Rated Bypass Factor
3002 1 : thisVrfFluidCtrlHR.RateBFOUEvap = rNumericArgs(17);
3003 1 : thisVrfFluidCtrlHR.RateBFOUCond = rNumericArgs(18);
3004 :
3005 : // Difference between Outdoor Unit Te and OAT during Simultaneous Heating and Cooling operations
3006 1 : thisVrfFluidCtrlHR.DiffOUTeTo = rNumericArgs(19);
3007 :
3008 : // HR OU Heat Exchanger Capacity Ratio
3009 1 : thisVrfFluidCtrlHR.HROUHexRatio = rNumericArgs(20);
3010 :
3011 : // Get OU fan data
3012 1 : thisVrfFluidCtrlHR.RatedOUFanPowerPerCapcity = rNumericArgs(21);
3013 1 : thisVrfFluidCtrlHR.OUAirFlowRatePerCapcity = rNumericArgs(22);
3014 1 : thisVrfFluidCtrlHR.RatedOUFanPower = thisVrfFluidCtrlHR.RatedOUFanPowerPerCapcity * thisVrfFluidCtrlHR.RatedEvapCapacity;
3015 1 : thisVrfFluidCtrlHR.OUAirFlowRate = thisVrfFluidCtrlHR.OUAirFlowRatePerCapcity * thisVrfFluidCtrlHR.RatedEvapCapacity;
3016 :
3017 : // OUEvapTempCurve
3018 1 : int indexOUEvapTempCurve = GetCurveIndex(state, cAlphaArgs(6)); // convert curve name to index number
3019 : // Verify curve name and type
3020 1 : if (indexOUEvapTempCurve == 0) {
3021 0 : if (lAlphaFieldBlanks(6)) {
3022 0 : ShowSevereError(state, std::string{RoutineName} + cCurrentModuleObject + "=\"" + thisVrfFluidCtrlHR.Name + "\", missing");
3023 0 : ShowContinueError(state, "...required " + cAlphaFieldNames(6) + " is blank.");
3024 : } else {
3025 0 : ShowSevereError(state, std::string{RoutineName} + cCurrentModuleObject + "=\"" + thisVrfFluidCtrlHR.Name + "\", invalid");
3026 0 : ShowContinueError(state, "...not found " + cAlphaFieldNames(6) + "=\"" + cAlphaArgs(6) + "\".");
3027 : }
3028 0 : ErrorsFound = true;
3029 : } else {
3030 1 : if (state.dataCurveManager->PerfCurve(indexOUEvapTempCurve)->curveType == Curve::CurveType::Quadratic) {
3031 1 : thisVrfFluidCtrlHR.C1Te = state.dataCurveManager->PerfCurve(indexOUEvapTempCurve)->coeff[0];
3032 1 : thisVrfFluidCtrlHR.C2Te = state.dataCurveManager->PerfCurve(indexOUEvapTempCurve)->coeff[1];
3033 1 : thisVrfFluidCtrlHR.C3Te = state.dataCurveManager->PerfCurve(indexOUEvapTempCurve)->coeff[2];
3034 : } else {
3035 0 : ShowSevereError(state, std::string{RoutineName} + cCurrentModuleObject + "=\"" + thisVrfFluidCtrlHR.Name + "\", invalid");
3036 0 : ShowContinueError(state,
3037 0 : format("...illegal {} type for this object = {}",
3038 : cAlphaFieldNames(6),
3039 0 : Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(indexOUEvapTempCurve)->curveType)]));
3040 0 : ShowContinueError(state, "... Curve type must be Quadratic.");
3041 0 : ErrorsFound = true;
3042 : }
3043 : }
3044 :
3045 : // OUCondTempCurve
3046 1 : int indexOUCondTempCurve = GetCurveIndex(state, cAlphaArgs(7)); // convert curve name to index number
3047 : // Verify curve name and type
3048 1 : if (indexOUCondTempCurve == 0) {
3049 0 : if (lAlphaFieldBlanks(7)) {
3050 0 : ShowSevereError(state, std::string{RoutineName} + cCurrentModuleObject + "=\"" + thisVrfFluidCtrlHR.Name + "\", missing");
3051 0 : ShowContinueError(state, "...required " + cAlphaFieldNames(7) + " is blank.");
3052 : } else {
3053 0 : ShowSevereError(state, std::string{RoutineName} + cCurrentModuleObject + "=\"" + thisVrfFluidCtrlHR.Name + "\", invalid");
3054 0 : ShowContinueError(state, "...not found " + cAlphaFieldNames(7) + "=\"" + cAlphaArgs(7) + "\".");
3055 : }
3056 0 : ErrorsFound = true;
3057 : } else {
3058 1 : if (state.dataCurveManager->PerfCurve(indexOUCondTempCurve)->curveType == Curve::CurveType::Quadratic) {
3059 1 : thisVrfFluidCtrlHR.C1Tc = state.dataCurveManager->PerfCurve(indexOUCondTempCurve)->coeff[0];
3060 1 : thisVrfFluidCtrlHR.C2Tc = state.dataCurveManager->PerfCurve(indexOUCondTempCurve)->coeff[1];
3061 1 : thisVrfFluidCtrlHR.C3Tc = state.dataCurveManager->PerfCurve(indexOUCondTempCurve)->coeff[2];
3062 : } else {
3063 0 : ShowSevereError(state, std::string{RoutineName} + cCurrentModuleObject + "=\"" + thisVrfFluidCtrlHR.Name + "\", invalid");
3064 0 : ShowContinueError(state,
3065 0 : format("...illegal {} type for this object = {}",
3066 : cAlphaFieldNames(7),
3067 0 : Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(indexOUCondTempCurve)->curveType)]));
3068 0 : ShowContinueError(state, "... Curve type must be Quadratic.");
3069 0 : ErrorsFound = true;
3070 : }
3071 : }
3072 :
3073 : // Pipe parameters
3074 1 : thisVrfFluidCtrlHR.RefPipDiaSuc = rNumericArgs(23);
3075 1 : thisVrfFluidCtrlHR.RefPipDiaDis = rNumericArgs(24);
3076 1 : thisVrfFluidCtrlHR.RefPipLen = rNumericArgs(25);
3077 1 : thisVrfFluidCtrlHR.RefPipEquLen = rNumericArgs(26);
3078 1 : thisVrfFluidCtrlHR.RefPipHei = rNumericArgs(27);
3079 1 : thisVrfFluidCtrlHR.RefPipInsThi = rNumericArgs(28);
3080 1 : thisVrfFluidCtrlHR.RefPipInsCon = rNumericArgs(29);
3081 :
3082 : // Check the RefPipEquLen
3083 1 : if (lNumericFieldBlanks(26) && !lNumericFieldBlanks(25)) {
3084 0 : thisVrfFluidCtrlHR.RefPipEquLen = 1.2 * thisVrfFluidCtrlHR.RefPipLen;
3085 0 : ShowWarningError(
3086 0 : state, cCurrentModuleObject + ", \"" + thisVrfFluidCtrlHR.Name + "\", \" " + cNumericFieldNames(26) + "\" is calculated based on");
3087 0 : ShowContinueError(state, "...the provided \"" + cNumericFieldNames(25) + "\" value.");
3088 : }
3089 1 : if (thisVrfFluidCtrlHR.RefPipEquLen < thisVrfFluidCtrlHR.RefPipLen) {
3090 0 : thisVrfFluidCtrlHR.RefPipEquLen = 1.2 * thisVrfFluidCtrlHR.RefPipLen;
3091 0 : ShowWarningError(state,
3092 0 : cCurrentModuleObject + ", \"" + thisVrfFluidCtrlHR.Name + "\", invalid \" " + cNumericFieldNames(26) + "\" value.");
3093 0 : ShowContinueError(state, "...Equivalent length of main pipe should be greater than or equal to the actual length.");
3094 0 : ShowContinueError(state, format("...The value is recalculated based on the provided \"{}\" value.", cNumericFieldNames(25)));
3095 : }
3096 :
3097 : // Crank case
3098 1 : thisVrfFluidCtrlHR.CCHeaterPower = rNumericArgs(30);
3099 1 : thisVrfFluidCtrlHR.NumCompressors = rNumericArgs(31);
3100 1 : thisVrfFluidCtrlHR.CompressorSizeRatio = rNumericArgs(32);
3101 1 : thisVrfFluidCtrlHR.MaxOATCCHeater = rNumericArgs(33);
3102 :
3103 : // Defrost
3104 1 : if (!lAlphaFieldBlanks(8)) {
3105 0 : if (Util::SameString(cAlphaArgs(8), "ReverseCycle")) thisVrfFluidCtrlHR.DefrostStrategy = StandardRatings::DefrostStrat::ReverseCycle;
3106 0 : if (Util::SameString(cAlphaArgs(8), "Resistive")) thisVrfFluidCtrlHR.DefrostStrategy = StandardRatings::DefrostStrat::Resistive;
3107 0 : if (thisVrfFluidCtrlHR.DefrostStrategy == StandardRatings::DefrostStrat::Invalid) {
3108 0 : ShowSevereError(
3109 0 : state, cCurrentModuleObject + ", \"" + thisVrfFluidCtrlHR.Name + "\" " + cAlphaFieldNames(8) + " not found: " + cAlphaArgs(8));
3110 0 : ErrorsFound = true;
3111 : }
3112 : } else {
3113 1 : thisVrfFluidCtrlHR.DefrostStrategy = StandardRatings::DefrostStrat::ReverseCycle;
3114 : }
3115 :
3116 1 : if (!lAlphaFieldBlanks(9)) {
3117 0 : if (Util::SameString(cAlphaArgs(9), "Timed")) thisVrfFluidCtrlHR.DefrostControl = StandardRatings::HPdefrostControl::Timed;
3118 0 : if (Util::SameString(cAlphaArgs(9), "OnDemand")) thisVrfFluidCtrlHR.DefrostControl = StandardRatings::HPdefrostControl::OnDemand;
3119 0 : if (thisVrfFluidCtrlHR.DefrostControl == StandardRatings::HPdefrostControl::Invalid) {
3120 0 : ShowSevereError(
3121 0 : state, cCurrentModuleObject + ", \"" + thisVrfFluidCtrlHR.Name + "\" " + cAlphaFieldNames(9) + " not found: " + cAlphaArgs(9));
3122 0 : ErrorsFound = true;
3123 : }
3124 : } else {
3125 1 : thisVrfFluidCtrlHR.DefrostControl = StandardRatings::HPdefrostControl::Timed;
3126 : }
3127 :
3128 1 : if (!lAlphaFieldBlanks(10)) {
3129 0 : thisVrfFluidCtrlHR.DefrostEIRPtr = GetCurveIndex(state, cAlphaArgs(10));
3130 0 : if (thisVrfFluidCtrlHR.DefrostEIRPtr > 0) {
3131 : // Verify Curve Object, expected type is BiQuadratic
3132 0 : ErrorsFound |= Curve::CheckCurveDims(state,
3133 : thisVrfFluidCtrlHR.DefrostEIRPtr, // Curve index
3134 : {2}, // Valid dimensions
3135 : RoutineName, // Routine name
3136 : cCurrentModuleObject, // Object Type
3137 : thisVrfFluidCtrlHR.Name, // Object Name
3138 0 : cAlphaFieldNames(10)); // Field Name
3139 : } else {
3140 0 : if (thisVrfFluidCtrlHR.DefrostStrategy == StandardRatings::DefrostStrat::ReverseCycle &&
3141 0 : thisVrfFluidCtrlHR.DefrostControl == StandardRatings::HPdefrostControl::OnDemand) {
3142 0 : ShowSevereError(state,
3143 0 : cCurrentModuleObject + ", \"" + thisVrfFluidCtrlHR.Name + "\" " + cAlphaFieldNames(10) +
3144 0 : " not found:" + cAlphaArgs(10));
3145 0 : ErrorsFound = true;
3146 : }
3147 : }
3148 : } else {
3149 1 : if (thisVrfFluidCtrlHR.DefrostStrategy == StandardRatings::DefrostStrat::ReverseCycle &&
3150 1 : thisVrfFluidCtrlHR.DefrostControl == StandardRatings::HPdefrostControl::OnDemand) {
3151 0 : ShowSevereError(
3152 0 : state, cCurrentModuleObject + ", \"" + thisVrfFluidCtrlHR.Name + "\" " + cAlphaFieldNames(10) + " not found:" + cAlphaArgs(10));
3153 0 : ErrorsFound = true;
3154 : }
3155 : }
3156 :
3157 1 : thisVrfFluidCtrlHR.DefrostFraction = rNumericArgs(34);
3158 1 : thisVrfFluidCtrlHR.DefrostCapacity = rNumericArgs(35);
3159 1 : thisVrfFluidCtrlHR.MaxOATDefrost = rNumericArgs(36);
3160 1 : if (thisVrfFluidCtrlHR.DefrostCapacity == 0.0 && thisVrfFluidCtrlHR.DefrostStrategy == StandardRatings::DefrostStrat::Resistive) {
3161 0 : ShowWarningError(state,
3162 0 : cCurrentModuleObject + ", \"" + thisVrfFluidCtrlHR.Name + "\" " + cNumericFieldNames(35) +
3163 : " = 0.0 for defrost strategy = RESISTIVE.");
3164 : }
3165 :
3166 : // HR mode transition
3167 1 : thisVrfFluidCtrlHR.HRInitialCoolCapFrac = rNumericArgs(37);
3168 1 : thisVrfFluidCtrlHR.HRCoolCapTC = rNumericArgs(38);
3169 1 : thisVrfFluidCtrlHR.HRInitialCoolEIRFrac = rNumericArgs(39);
3170 1 : thisVrfFluidCtrlHR.HRCoolEIRTC = rNumericArgs(40);
3171 1 : thisVrfFluidCtrlHR.HRInitialHeatCapFrac = rNumericArgs(41);
3172 1 : thisVrfFluidCtrlHR.HRHeatCapTC = rNumericArgs(42);
3173 1 : thisVrfFluidCtrlHR.HRInitialHeatEIRFrac = rNumericArgs(43);
3174 1 : thisVrfFluidCtrlHR.HRHeatEIRTC = rNumericArgs(44);
3175 :
3176 : // Compressor configuration
3177 1 : thisVrfFluidCtrlHR.CompMaxDeltaP = rNumericArgs(45);
3178 1 : thisVrfFluidCtrlHR.EffCompInverter = rNumericArgs(46);
3179 1 : thisVrfFluidCtrlHR.CoffEvapCap = rNumericArgs(47);
3180 :
3181 : // The new VRF model is Air cooled
3182 1 : thisVrfFluidCtrlHR.CondenserType = DataHeatBalance::RefrigCondenserType::Air;
3183 1 : thisVrfFluidCtrlHR.CondenserNodeNum = 0;
3184 :
3185 : // Evaporative Capacity & Compressor Power Curves corresponding to each Loading Index / compressor speed
3186 1 : int NumOfCompSpd = rNumericArgs(48);
3187 1 : thisVrfFluidCtrlHR.CompressorSpeed.dimension(NumOfCompSpd);
3188 1 : thisVrfFluidCtrlHR.OUCoolingCAPFT.dimension(NumOfCompSpd);
3189 1 : thisVrfFluidCtrlHR.OUCoolingPWRFT.dimension(NumOfCompSpd);
3190 1 : int Count1Index = 48; // the index of the last numeric field before compressor speed entries
3191 1 : int Count2Index = 9; // the index of the last alpha field before capacity/power curves
3192 4 : for (int NumCompSpd = 1; NumCompSpd <= NumOfCompSpd; NumCompSpd++) {
3193 3 : thisVrfFluidCtrlHR.CompressorSpeed(NumCompSpd) = rNumericArgs(Count1Index + NumCompSpd);
3194 :
3195 : // Evaporating Capacity Curve
3196 3 : if (!lAlphaFieldBlanks(Count2Index + 2 * NumCompSpd)) {
3197 3 : int indexOUEvapCapCurve = GetCurveIndex(state, cAlphaArgs(Count2Index + 2 * NumCompSpd)); // convert curve name to index number
3198 3 : if (indexOUEvapCapCurve == 0) { // Verify curve name and type
3199 0 : if (lAlphaFieldBlanks(Count2Index + 2 * NumCompSpd)) {
3200 0 : ShowSevereError(state, std::string{RoutineName} + cCurrentModuleObject + "=\"" + thisVrfFluidCtrlHR.Name + "\", missing");
3201 0 : ShowContinueError(state, "...required " + cAlphaFieldNames(Count2Index + 2 * NumCompSpd) + " is blank.");
3202 : } else {
3203 0 : ShowSevereError(state, std::string{RoutineName} + cCurrentModuleObject + "=\"" + thisVrfFluidCtrlHR.Name + "\", invalid");
3204 0 : ShowContinueError(state,
3205 0 : format("...not found {}=\"{}\".",
3206 0 : cAlphaFieldNames(Count2Index + 2 * NumCompSpd),
3207 0 : cAlphaArgs(Count2Index + 2 * NumCompSpd)));
3208 : }
3209 0 : ErrorsFound = true;
3210 : } else {
3211 3 : ErrorsFound |= Curve::CheckCurveDims(state,
3212 : indexOUEvapCapCurve, // Curve index
3213 : {2}, // Valid dimensions
3214 : RoutineName, // Routine name
3215 : cCurrentModuleObject, // Object Type
3216 : thisVrfFluidCtrlHR.Name, // Object Name
3217 3 : cAlphaFieldNames(Count2Index + 2 * NumCompSpd)); // Field Name
3218 :
3219 3 : if (!ErrorsFound) {
3220 3 : thisVrfFluidCtrlHR.OUCoolingCAPFT(NumCompSpd) = indexOUEvapCapCurve;
3221 : }
3222 : }
3223 : }
3224 :
3225 : // Compressor Power Curve
3226 3 : if (!lAlphaFieldBlanks(Count2Index + 2 * NumCompSpd + 1)) {
3227 3 : int indexOUCompPwrCurve = GetCurveIndex(state, cAlphaArgs(Count2Index + 2 * NumCompSpd + 1)); // convert curve name to index number
3228 3 : if (indexOUCompPwrCurve == 0) { // Verify curve name and type
3229 0 : if (lAlphaFieldBlanks(Count2Index + 2 * NumCompSpd + 1)) {
3230 0 : ShowSevereError(state, std::string{RoutineName} + cCurrentModuleObject + "=\"" + thisVrfFluidCtrlHR.Name + "\", missing");
3231 0 : ShowContinueError(state, "...required " + cAlphaFieldNames(Count2Index + 2 * NumCompSpd + 1) + " is blank.");
3232 : } else {
3233 0 : ShowSevereError(state, std::string{RoutineName} + cCurrentModuleObject + "=\"" + thisVrfFluidCtrlHR.Name + "\", invalid");
3234 0 : ShowContinueError(state,
3235 0 : format("...not found {}=\"{}\".",
3236 0 : cAlphaFieldNames(Count2Index + 2 * NumCompSpd + 1),
3237 0 : cAlphaArgs(Count2Index + 2 * NumCompSpd + 1)));
3238 : }
3239 0 : ErrorsFound = true;
3240 : } else {
3241 3 : ErrorsFound |= Curve::CheckCurveDims(state,
3242 : indexOUCompPwrCurve, // Curve index
3243 : {2}, // Valid dimensions
3244 : RoutineName, // Routine name
3245 : cCurrentModuleObject, // Object Type
3246 : thisVrfFluidCtrlHR.Name, // Object Name
3247 3 : cAlphaFieldNames(Count2Index + 2 * NumCompSpd + 1)); // Field Name
3248 :
3249 3 : if (!ErrorsFound) {
3250 3 : thisVrfFluidCtrlHR.OUCoolingPWRFT(NumCompSpd) = indexOUCompPwrCurve;
3251 : }
3252 : }
3253 : }
3254 : }
3255 : }
3256 :
3257 13 : cCurrentModuleObject = "ZoneHVAC:TerminalUnit:VariableRefrigerantFlow";
3258 75 : for (int VRFTUNum = 1; VRFTUNum <= state.dataHVACVarRefFlow->NumVRFTU; ++VRFTUNum) {
3259 :
3260 : // initialize local node number variables
3261 62 : int CCoilInletNodeNum = 0;
3262 62 : int CCoilOutletNodeNum = 0;
3263 62 : int HCoilInletNodeNum = 0;
3264 62 : int HCoilOutletNodeNum = 0;
3265 62 : OANodeNums = 0;
3266 :
3267 62 : state.dataInputProcessing->inputProcessor->getObjectItem(state,
3268 : cCurrentModuleObject,
3269 : VRFTUNum,
3270 : cAlphaArgs,
3271 : NumAlphas,
3272 : rNumericArgs,
3273 : NumNums,
3274 : IOStat,
3275 : lNumericFieldBlanks,
3276 : lAlphaFieldBlanks,
3277 : cAlphaFieldNames,
3278 : cNumericFieldNames);
3279 :
3280 62 : ErrorObjectHeader eoh{routineName, cCurrentModuleObject, cAlphaArgs(1)};
3281 :
3282 62 : state.dataHVACVarRefFlow->VRFTUNumericFields(VRFTUNum).FieldNames.allocate(NumNums);
3283 62 : state.dataHVACVarRefFlow->VRFTUNumericFields(VRFTUNum).FieldNames = cNumericFieldNames;
3284 62 : Util::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
3285 :
3286 62 : auto &thisVrfTU = state.dataHVACVarRefFlow->VRFTU(VRFTUNum);
3287 62 : thisVrfTU.Name = cAlphaArgs(1);
3288 63 : for (int NumList = 1; NumList <= state.dataHVACVarRefFlow->NumVRFTULists; ++NumList) {
3289 63 : int ZoneTerminalUnitListNum = Util::FindItemInList(thisVrfTU.Name,
3290 63 : state.dataHVACVarRefFlow->TerminalUnitList(NumList).ZoneTUName,
3291 63 : state.dataHVACVarRefFlow->TerminalUnitList(NumList).NumTUInList);
3292 63 : if (ZoneTerminalUnitListNum > 0) {
3293 62 : thisVrfTU.IndexToTUInTUList = ZoneTerminalUnitListNum;
3294 62 : state.dataHVACVarRefFlow->TerminalUnitList(NumList).ZoneTUPtr(ZoneTerminalUnitListNum) = VRFTUNum;
3295 62 : thisVrfTU.TUListIndex = NumList;
3296 62 : break;
3297 : }
3298 : }
3299 62 : if (thisVrfTU.TUListIndex == 0) {
3300 0 : ShowSevereError(state, cCurrentModuleObject + " = " + thisVrfTU.Name);
3301 0 : ShowContinueError(state, "Terminal unit not found on any ZoneTerminalUnitList.");
3302 0 : ErrorsFound = true;
3303 : }
3304 :
3305 63 : for (int NumCond = 1; NumCond <= state.dataHVACVarRefFlow->NumVRFCond; ++NumCond) {
3306 63 : if (state.dataHVACVarRefFlow->VRF(NumCond).ZoneTUListPtr != thisVrfTU.TUListIndex) continue;
3307 62 : thisVrfTU.VRFSysNum = NumCond;
3308 62 : break;
3309 : }
3310 62 : thisVrfTU.type = TUType::ConstantVolume;
3311 62 : if (lAlphaFieldBlanks(2)) {
3312 5 : thisVrfTU.SchedPtr = ScheduleManager::ScheduleAlwaysOn;
3313 : } else {
3314 57 : thisVrfTU.SchedPtr = GetScheduleIndex(state, cAlphaArgs(2));
3315 57 : if (thisVrfTU.SchedPtr == 0) {
3316 0 : ShowSevereError(state, cCurrentModuleObject + "=\"" + thisVrfTU.Name + "\" invalid data");
3317 0 : ShowContinueError(state, "Invalid-not found " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\".");
3318 0 : ErrorsFound = true;
3319 : }
3320 : }
3321 :
3322 62 : thisVrfTU.VRFTUInletNodeNum = GetOnlySingleNode(state,
3323 62 : cAlphaArgs(3),
3324 : ErrorsFound,
3325 : DataLoopNode::ConnectionObjectType::ZoneHVACTerminalUnitVariableRefrigerantFlow,
3326 62 : thisVrfTU.Name,
3327 : DataLoopNode::NodeFluidType::Air,
3328 : DataLoopNode::ConnectionType::Inlet,
3329 : NodeInputManager::CompFluidStream::Primary,
3330 : ObjectIsParent);
3331 :
3332 62 : thisVrfTU.VRFTUOutletNodeNum = GetOnlySingleNode(state,
3333 62 : cAlphaArgs(4),
3334 : ErrorsFound,
3335 : DataLoopNode::ConnectionObjectType::ZoneHVACTerminalUnitVariableRefrigerantFlow,
3336 62 : thisVrfTU.Name,
3337 : DataLoopNode::NodeFluidType::Air,
3338 : DataLoopNode::ConnectionType::Outlet,
3339 : NodeInputManager::CompFluidStream::Primary,
3340 : ObjectIsParent);
3341 :
3342 62 : thisVrfTU.MaxCoolAirVolFlow = rNumericArgs(1);
3343 62 : thisVrfTU.MaxNoCoolAirVolFlow = rNumericArgs(2);
3344 62 : thisVrfTU.MaxHeatAirVolFlow = rNumericArgs(3);
3345 62 : thisVrfTU.MaxNoHeatAirVolFlow = rNumericArgs(4);
3346 62 : thisVrfTU.CoolOutAirVolFlow = rNumericArgs(5);
3347 62 : thisVrfTU.HeatOutAirVolFlow = rNumericArgs(6);
3348 62 : thisVrfTU.NoCoolHeatOutAirVolFlow = rNumericArgs(7);
3349 :
3350 62 : thisVrfTU.FanOpModeSchedPtr = GetScheduleIndex(state, cAlphaArgs(5));
3351 : // default to constant fan operating mode
3352 62 : if (thisVrfTU.FanOpModeSchedPtr == 0) {
3353 1 : if (!lAlphaFieldBlanks(5)) {
3354 0 : ShowSevereError(state, cCurrentModuleObject + " = " + thisVrfTU.Name);
3355 0 : ShowContinueError(state, "..." + cAlphaFieldNames(5) + " = " + cAlphaArgs(5) + " not found.");
3356 0 : ShowContinueError(state, "...Defaulting to constant fan operating mode and simulation continues.");
3357 : }
3358 1 : thisVrfTU.fanOp = HVAC::FanOp::Continuous;
3359 : }
3360 :
3361 62 : thisVrfTU.fanPlace = static_cast<HVAC::FanPlace>(getEnumValue(HVAC::fanPlaceNamesUC, cAlphaArgs(6)));
3362 62 : assert(thisVrfTU.fanPlace != HVAC::FanPlace::Invalid);
3363 :
3364 62 : if (!lAlphaFieldBlanks(7) && !lAlphaFieldBlanks(8)) {
3365 : // Get fan data
3366 61 : std::string FanName = cAlphaArgs(8);
3367 :
3368 61 : thisVrfTU.fanType = static_cast<HVAC::FanType>(getEnumValue(HVAC::fanTypeNamesUC, cAlphaArgs(7)));
3369 :
3370 61 : if (thisVrfTU.fanType != HVAC::FanType::OnOff && thisVrfTU.fanType != HVAC::FanType::Constant &&
3371 33 : thisVrfTU.fanType != HVAC::FanType::VAV && thisVrfTU.fanType != HVAC::FanType::SystemModel) {
3372 0 : ShowSevereInvalidKey(state,
3373 : eoh,
3374 0 : cAlphaFieldNames(7),
3375 0 : cAlphaArgs(7),
3376 : "Only types Fan:ConstantVolume, Fan:VAV, Fan:OnOff, and Fan:SystemModel are supported");
3377 0 : ErrorsFound = true;
3378 : }
3379 :
3380 61 : if ((thisVrfTU.FanIndex = Fans::GetFanIndex(state, FanName)) == 0) {
3381 0 : ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(8), FanName);
3382 0 : ErrorsFound = true;
3383 :
3384 61 : } else if (thisVrfTU.fanType != state.dataFans->fans(thisVrfTU.FanIndex)->type) {
3385 0 : ShowSevereError(state, cCurrentModuleObject + " = " + thisVrfTU.Name);
3386 0 : ShowContinueError(state, "Fan type specified = " + cAlphaArgs(7));
3387 0 : ShowContinueError(state, format("Actual type of fan {} = {}", FanName, HVAC::fanTypeNames[(int)thisVrfTU.fanType]));
3388 0 : ErrorsFound = true;
3389 : }
3390 :
3391 61 : if (thisVrfTU.VRFSysNum > 0) {
3392 : // VRFTU Supply Air Fan Object Type must be Fan:VariableVolume if VRF Algorithm Type is AlgorithmTypeFluidTCtrl
3393 77 : if (state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).VRFAlgorithmType == AlgorithmType::FluidTCtrl &&
3394 16 : !(thisVrfTU.fanType == HVAC::FanType::VAV || thisVrfTU.fanType == HVAC::FanType::SystemModel)) {
3395 0 : ShowSevereError(state, cCurrentModuleObject + " = " + thisVrfTU.Name);
3396 0 : ShowContinueError(state, "Fan type specified = " + cAlphaArgs(7));
3397 0 : ShowContinueError(
3398 : state, "Fan Object Type must be Fan:VariableVolume if VRF AirConditioner:VariableRefrigerantFlow:FluidTemperatureControl");
3399 0 : ShowContinueError(state, "is used to model VRF outdoor unit.");
3400 0 : ErrorsFound = true;
3401 : }
3402 : // VRFTU Supply Air Fan Object Type must be Fan:OnOff or Fan:ConstantVolume if VRF Algorithm Type is AlgorithmTypeSysCurve
3403 106 : if (state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).VRFAlgorithmType == AlgorithmType::SysCurve &&
3404 45 : !(thisVrfTU.fanType == HVAC::FanType::OnOff || thisVrfTU.fanType == HVAC::FanType::Constant ||
3405 17 : thisVrfTU.fanType == HVAC::FanType::SystemModel)) {
3406 0 : ShowSevereError(state, cCurrentModuleObject + " = " + thisVrfTU.Name);
3407 0 : ShowContinueError(state, "Fan type specified = " + cAlphaArgs(7));
3408 0 : ShowContinueError(state,
3409 : "Fan Object Type must be Fan:SystemModel, Fan:OnOff, or Fan:ConstantVolume if VRF "
3410 : "AirConditioner:VariableRefrigerantFlow");
3411 0 : ShowContinueError(state, "is used to model VRF outdoor unit.");
3412 0 : ErrorsFound = true;
3413 : }
3414 : }
3415 :
3416 61 : auto *fan = state.dataFans->fans(thisVrfTU.FanIndex);
3417 :
3418 61 : thisVrfTU.fanInletNode = fan->inletNodeNum;
3419 61 : thisVrfTU.fanOutletNode = fan->outletNodeNum;
3420 :
3421 61 : Real64 FanVolFlowRate = fan->maxAirFlowRate;
3422 61 : thisVrfTU.ActualFanVolFlowRate = FanVolFlowRate;
3423 61 : int FanInletNodeNum = fan->inletNodeNum;
3424 61 : int FanOutletNodeNum = fan->outletNodeNum;
3425 61 : thisVrfTU.FanAvailSchedPtr = fan->availSchedNum;
3426 :
3427 : // Check fan's schedule for cycling fan operation if constant volume fan is used
3428 61 : if (thisVrfTU.FanOpModeSchedPtr > 0 && thisVrfTU.fanType == HVAC::FanType::Constant) {
3429 8 : if (!CheckScheduleValueMinMax(state, thisVrfTU.FanOpModeSchedPtr, ">", 0.0, "<=", 1.0)) {
3430 0 : ShowSevereError(state, cCurrentModuleObject + " = " + thisVrfTU.Name);
3431 0 : ShowContinueError(state, format("For fan type = {}", HVAC::fanTypeNames[(int)HVAC::FanType::Constant]));
3432 0 : ShowContinueError(state, "Fan operating mode must be continuous (fan operating mode schedule values > 0).");
3433 0 : ShowContinueError(state, format("Error found in {} = {}", cAlphaFieldNames(5), cAlphaArgs(5)));
3434 0 : ShowContinueError(state, "...schedule values must be (>0., <=1.)");
3435 0 : ErrorsFound = true;
3436 : }
3437 : } // IF (FanType_Num == HVAC::FanType_SimpleOnOff .OR. FanType_Num == HVAC::FanType_SimpleConstVolume)THEN
3438 :
3439 : // Add TU to component sets array
3440 183 : SetUpCompSets(state,
3441 : cCurrentModuleObject,
3442 : thisVrfTU.Name,
3443 61 : HVAC::fanTypeNames[(int)thisVrfTU.fanType],
3444 : FanName,
3445 61 : state.dataLoopNodes->NodeID(FanInletNodeNum),
3446 61 : state.dataLoopNodes->NodeID(FanOutletNodeNum));
3447 :
3448 61 : } else {
3449 1 : thisVrfTU.fanPlace = HVAC::FanPlace::Invalid; // reset fan placement when fan is not used so as not to call the fan
3450 : }
3451 :
3452 : // Get OA mixer data
3453 62 : std::string OAMixerType = cAlphaArgs(9);
3454 :
3455 62 : if (!lAlphaFieldBlanks(10)) {
3456 51 : thisVrfTU.OAMixerName = cAlphaArgs(10);
3457 51 : errFlag = false;
3458 51 : OANodeNums = GetOAMixerNodeNumbers(state, thisVrfTU.OAMixerName, errFlag);
3459 :
3460 : // OANodeNums(1) = OAMixer(OAMixerNum)%InletNode
3461 : // OANodeNums(2) = OAMixer(OAMixerNum)%RelNode
3462 : // OANodeNums(3) = OAMixer(OAMixerNum)%RetNode
3463 : // OANodeNums(4) = OAMixer(OAMixerNum)%MixNode
3464 :
3465 51 : if (errFlag) {
3466 0 : ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name);
3467 0 : ErrorsFound = true;
3468 : } else {
3469 51 : thisVrfTU.OAMixerUsed = true;
3470 : }
3471 51 : thisVrfTU.VRFTUOAMixerOANodeNum = OANodeNums(1);
3472 51 : thisVrfTU.VRFTUOAMixerRelNodeNum = OANodeNums(2);
3473 51 : thisVrfTU.VRFTUOAMixerRetNodeNum = OANodeNums(3);
3474 51 : thisVrfTU.VRFTUOAMixerMixedNodeNum = OANodeNums(4);
3475 : }
3476 :
3477 : // Get DX cooling coil data
3478 62 : std::string DXCoolingCoilType = cAlphaArgs(11);
3479 :
3480 62 : errFlag = false;
3481 62 : thisVrfTU.DXCoolCoilType_Num = GetCoilTypeNum(state, DXCoolingCoilType, cAlphaArgs(12), errFlag, false);
3482 62 : if (thisVrfTU.DXCoolCoilType_Num == 0) {
3483 0 : thisVrfTU.CoolingCoilPresent = false;
3484 0 : if (thisVrfTU.TUListIndex > 0 && thisVrfTU.IndexToTUInTUList > 0) {
3485 0 : state.dataHVACVarRefFlow->TerminalUnitList(thisVrfTU.TUListIndex).CoolingCoilPresent(thisVrfTU.IndexToTUInTUList) = false;
3486 : }
3487 : } else {
3488 62 : if (thisVrfTU.VRFSysNum > 0) {
3489 62 : if (state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).VRFAlgorithmType == AlgorithmType::FluidTCtrl) {
3490 : // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control
3491 :
3492 16 : if (Util::SameString(HVAC::cAllCoilTypes(thisVrfTU.DXCoolCoilType_Num), HVAC::cAllCoilTypes(HVAC::CoilVRF_FluidTCtrl_Cooling))) {
3493 16 : errFlag = false;
3494 16 : if (thisVrfTU.TUListIndex > 0 && thisVrfTU.IndexToTUInTUList > 0) {
3495 16 : state.dataHVACVarRefFlow->TerminalUnitList(thisVrfTU.TUListIndex).CoolingCoilAvailSchPtr(thisVrfTU.IndexToTUInTUList) =
3496 32 : GetDXCoilAvailSchPtr(state, DXCoolingCoilType, cAlphaArgs(12), errFlag);
3497 : }
3498 32 : GetDXCoilIndex(
3499 16 : state, cAlphaArgs(12), thisVrfTU.CoolCoilIndex, errFlag, HVAC::cAllCoilTypes(HVAC::CoilVRF_FluidTCtrl_Cooling));
3500 : CCoilInletNodeNum =
3501 16 : DXCoils::GetCoilInletNode(state, HVAC::cAllCoilTypes(HVAC::CoilVRF_FluidTCtrl_Cooling), cAlphaArgs(12), errFlag);
3502 : CCoilOutletNodeNum =
3503 16 : DXCoils::GetCoilOutletNode(state, HVAC::cAllCoilTypes(HVAC::CoilVRF_FluidTCtrl_Cooling), cAlphaArgs(12), errFlag);
3504 16 : thisVrfTU.coolCoilAirInNode = CCoilInletNodeNum;
3505 16 : thisVrfTU.coolCoilAirOutNode = CCoilOutletNodeNum;
3506 :
3507 16 : if (errFlag) ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " \"" + thisVrfTU.Name + "\"");
3508 :
3509 16 : if (thisVrfTU.VRFSysNum > 0) {
3510 32 : SetDXCoolingCoilData(
3511 16 : state, thisVrfTU.CoolCoilIndex, ErrorsFound, _, state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).CondenserType);
3512 32 : SetDXCoolingCoilData(state,
3513 : thisVrfTU.CoolCoilIndex,
3514 : ErrorsFound,
3515 : _,
3516 : _,
3517 16 : state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).CondenserNodeNum);
3518 32 : SetDXCoolingCoilData(state,
3519 : thisVrfTU.CoolCoilIndex,
3520 : ErrorsFound,
3521 : _,
3522 : _,
3523 : _,
3524 16 : state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).MaxOATCCHeater);
3525 32 : SetDXCoolingCoilData(state,
3526 : thisVrfTU.CoolCoilIndex,
3527 : ErrorsFound,
3528 : _,
3529 : _,
3530 : _,
3531 : _,
3532 16 : state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).MinOATCooling);
3533 32 : SetDXCoolingCoilData(state,
3534 : thisVrfTU.CoolCoilIndex,
3535 : ErrorsFound,
3536 : _,
3537 : _,
3538 : _,
3539 : _,
3540 : _,
3541 16 : state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).MaxOATCooling);
3542 :
3543 16 : state.dataDXCoils->DXCoil(thisVrfTU.CoolCoilIndex).VRFIUPtr = VRFTUNum;
3544 16 : state.dataDXCoils->DXCoil(thisVrfTU.CoolCoilIndex).VRFOUPtr = thisVrfTU.VRFSysNum;
3545 16 : state.dataDXCoils->DXCoil(thisVrfTU.CoolCoilIndex).SupplyFanIndex = thisVrfTU.FanIndex;
3546 :
3547 16 : if (thisVrfTU.FanIndex > 0) {
3548 16 : state.dataDXCoils->DXCoil(thisVrfTU.CoolCoilIndex).RatedAirVolFlowRate(1) =
3549 16 : state.dataFans->fans(thisVrfTU.FanIndex)->maxAirFlowRate;
3550 : } else {
3551 0 : state.dataDXCoils->DXCoil(thisVrfTU.CoolCoilIndex).RatedAirVolFlowRate(1) = AutoSize;
3552 : }
3553 :
3554 : } else {
3555 0 : ShowSevereError(state, cCurrentModuleObject + " \"" + thisVrfTU.Name + "\"");
3556 0 : ShowContinueError(
3557 0 : state, "... when checking " + HVAC::cAllCoilTypes(thisVrfTU.DXCoolCoilType_Num) + " \"" + cAlphaArgs(12) + "\"");
3558 0 : ShowContinueError(state, "... terminal unit not connected to condenser.");
3559 0 : ShowContinueError(state, "... check that terminal unit is specified in a terminal unit list object.");
3560 0 : ShowContinueError(state,
3561 : "... also check that the terminal unit list name is specified in an "
3562 : "AirConditioner:VariableRefrigerantFlow object.");
3563 0 : ErrorsFound = true;
3564 : }
3565 : } else {
3566 0 : ShowSevereError(state, cCurrentModuleObject + " \"" + thisVrfTU.Name + "\"");
3567 0 : ShowContinueError(state, "... illegal " + cAlphaFieldNames(12) + " = " + cAlphaArgs(12));
3568 0 : ErrorsFound = true;
3569 : }
3570 :
3571 : } else {
3572 : // Algorithm Type: VRF model based on system curve
3573 :
3574 46 : if (Util::SameString(HVAC::cAllCoilTypes(thisVrfTU.DXCoolCoilType_Num), HVAC::cAllCoilTypes(HVAC::CoilVRF_Cooling))) {
3575 46 : if (thisVrfTU.TUListIndex > 0 && thisVrfTU.IndexToTUInTUList > 0) {
3576 46 : state.dataHVACVarRefFlow->TerminalUnitList(thisVrfTU.TUListIndex).CoolingCoilAvailSchPtr(thisVrfTU.IndexToTUInTUList) =
3577 92 : GetDXCoilAvailSchPtr(state, DXCoolingCoilType, cAlphaArgs(12), errFlag);
3578 : } else {
3579 0 : thisVrfTU.CoolingCoilPresent = false;
3580 : }
3581 46 : errFlag = false;
3582 46 : GetDXCoilIndex(state, cAlphaArgs(12), thisVrfTU.CoolCoilIndex, errFlag, HVAC::cAllCoilTypes(HVAC::CoilVRF_Cooling));
3583 46 : CCoilInletNodeNum = DXCoils::GetCoilInletNode(state, HVAC::cAllCoilTypes(HVAC::CoilVRF_Cooling), cAlphaArgs(12), errFlag);
3584 46 : CCoilOutletNodeNum = DXCoils::GetCoilOutletNode(state, HVAC::cAllCoilTypes(HVAC::CoilVRF_Cooling), cAlphaArgs(12), errFlag);
3585 46 : thisVrfTU.coolCoilAirInNode = CCoilInletNodeNum;
3586 46 : thisVrfTU.coolCoilAirOutNode = CCoilOutletNodeNum;
3587 :
3588 46 : if (errFlag) ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " \"" + thisVrfTU.Name + "\"");
3589 :
3590 92 : SetDXCoolingCoilData(
3591 46 : state, thisVrfTU.CoolCoilIndex, ErrorsFound, _, state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).CondenserType);
3592 92 : SetDXCoolingCoilData(
3593 46 : state, thisVrfTU.CoolCoilIndex, ErrorsFound, _, _, state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).CondenserNodeNum);
3594 92 : SetDXCoolingCoilData(
3595 46 : state, thisVrfTU.CoolCoilIndex, ErrorsFound, _, _, _, state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).MaxOATCCHeater);
3596 92 : SetDXCoolingCoilData(state,
3597 : thisVrfTU.CoolCoilIndex,
3598 : ErrorsFound,
3599 : _,
3600 : _,
3601 : _,
3602 : _,
3603 46 : state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).MinOATCooling);
3604 92 : SetDXCoolingCoilData(state,
3605 : thisVrfTU.CoolCoilIndex,
3606 : ErrorsFound,
3607 : _,
3608 : _,
3609 : _,
3610 : _,
3611 : _,
3612 46 : state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).MaxOATCooling);
3613 :
3614 : } else {
3615 0 : ShowSevereError(state, cCurrentModuleObject + " \"" + thisVrfTU.Name + "\"");
3616 0 : ShowContinueError(state, "... illegal " + cAlphaFieldNames(12) + " = " + cAlphaArgs(12));
3617 0 : ErrorsFound = true;
3618 : }
3619 : }
3620 : } else {
3621 0 : ShowSevereError(state, cCurrentModuleObject + " \"" + thisVrfTU.Name + "\"");
3622 0 : ShowContinueError(state, "... when checking " + HVAC::cAllCoilTypes(thisVrfTU.DXCoolCoilType_Num) + " \"" + cAlphaArgs(12) + "\"");
3623 0 : ShowContinueError(state, "... terminal unit not connected to condenser.");
3624 0 : ShowContinueError(state, "... check that terminal unit is specified in a terminal unit list object.");
3625 0 : ShowContinueError(
3626 : state, "... also check that the terminal unit list name is specified in an AirConditioner:VariableRefrigerantFlow object.");
3627 0 : ErrorsFound = true;
3628 : }
3629 : }
3630 :
3631 : // Get DX heating coil data
3632 62 : std::string DXHeatingCoilType = cAlphaArgs(13);
3633 :
3634 : // Get the heating to cooling sizing ratio input before writing to DX heating coil data
3635 62 : if (!lNumericFieldBlanks(10)) {
3636 0 : thisVrfTU.HeatingCapacitySizeRatio = rNumericArgs(10);
3637 : }
3638 :
3639 62 : errFlag = false;
3640 62 : thisVrfTU.DXHeatCoilType_Num = GetCoilTypeNum(state, DXHeatingCoilType, cAlphaArgs(14), errFlag, false);
3641 62 : if (thisVrfTU.DXHeatCoilType_Num == 0) {
3642 0 : thisVrfTU.HeatingCoilPresent = false;
3643 0 : if (thisVrfTU.TUListIndex > 0 && thisVrfTU.IndexToTUInTUList > 0) {
3644 0 : state.dataHVACVarRefFlow->TerminalUnitList(thisVrfTU.TUListIndex).HeatingCoilPresent(thisVrfTU.IndexToTUInTUList) = false;
3645 : }
3646 : } else {
3647 62 : if (thisVrfTU.VRFSysNum > 0) {
3648 62 : if (state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).VRFAlgorithmType == AlgorithmType::FluidTCtrl) {
3649 : // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control
3650 :
3651 16 : if (Util::SameString(HVAC::cAllCoilTypes(thisVrfTU.DXHeatCoilType_Num), HVAC::cAllCoilTypes(HVAC::CoilVRF_FluidTCtrl_Heating))) {
3652 16 : errFlag = false;
3653 16 : if (thisVrfTU.TUListIndex > 0 && thisVrfTU.IndexToTUInTUList > 0) {
3654 16 : state.dataHVACVarRefFlow->TerminalUnitList(thisVrfTU.TUListIndex).HeatingCoilAvailSchPtr(thisVrfTU.IndexToTUInTUList) =
3655 32 : GetDXCoilAvailSchPtr(state, DXHeatingCoilType, cAlphaArgs(14), errFlag);
3656 : }
3657 32 : GetDXCoilIndex(
3658 16 : state, cAlphaArgs(14), thisVrfTU.HeatCoilIndex, errFlag, HVAC::cAllCoilTypes(HVAC::CoilVRF_FluidTCtrl_Heating));
3659 : HCoilInletNodeNum =
3660 16 : DXCoils::GetCoilInletNode(state, HVAC::cAllCoilTypes(HVAC::CoilVRF_FluidTCtrl_Heating), cAlphaArgs(14), errFlag);
3661 : HCoilOutletNodeNum =
3662 16 : DXCoils::GetCoilOutletNode(state, HVAC::cAllCoilTypes(HVAC::CoilVRF_FluidTCtrl_Heating), cAlphaArgs(14), errFlag);
3663 16 : thisVrfTU.heatCoilAirInNode = HCoilInletNodeNum;
3664 16 : thisVrfTU.heatCoilAirOutNode = HCoilOutletNodeNum;
3665 :
3666 16 : if (errFlag) ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " \"" + thisVrfTU.Name + "\"");
3667 :
3668 16 : if (thisVrfTU.VRFSysNum > 0) {
3669 32 : SetDXCoolingCoilData(
3670 16 : state, thisVrfTU.HeatCoilIndex, ErrorsFound, _, state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).CondenserType);
3671 32 : SetDXCoolingCoilData(state,
3672 : thisVrfTU.HeatCoilIndex,
3673 : ErrorsFound,
3674 : _,
3675 : _,
3676 16 : state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).CondenserNodeNum);
3677 32 : SetDXCoolingCoilData(state,
3678 : thisVrfTU.HeatCoilIndex,
3679 : ErrorsFound,
3680 : _,
3681 : _,
3682 : _,
3683 16 : state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).MaxOATCCHeater);
3684 32 : SetDXCoolingCoilData(state,
3685 : thisVrfTU.HeatCoilIndex,
3686 : ErrorsFound,
3687 : _,
3688 : _,
3689 : _,
3690 : _,
3691 : _,
3692 : _,
3693 16 : state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).MinOATHeating);
3694 32 : SetDXCoolingCoilData(state,
3695 : thisVrfTU.HeatCoilIndex,
3696 : ErrorsFound,
3697 : _,
3698 : _,
3699 : _,
3700 : _,
3701 : _,
3702 : _,
3703 : _,
3704 16 : state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).MaxOATHeating);
3705 32 : SetDXCoolingCoilData(state,
3706 : thisVrfTU.HeatCoilIndex,
3707 : ErrorsFound,
3708 : _,
3709 : _,
3710 : _,
3711 : _,
3712 : _,
3713 : _,
3714 : _,
3715 : _,
3716 16 : state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).HeatingPerformanceOATType);
3717 : // Set defrost controls in child object to trip child object defrost calculations
3718 32 : SetDXCoolingCoilData(state,
3719 : thisVrfTU.HeatCoilIndex,
3720 : ErrorsFound,
3721 : _,
3722 : _,
3723 : _,
3724 : _,
3725 : _,
3726 : _,
3727 : _,
3728 : _,
3729 : _,
3730 16 : state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).DefrostStrategy);
3731 32 : SetDXCoolingCoilData(state,
3732 : thisVrfTU.HeatCoilIndex,
3733 : ErrorsFound,
3734 : _,
3735 : _,
3736 : _,
3737 : _,
3738 : _,
3739 : _,
3740 : _,
3741 : _,
3742 : _,
3743 : _,
3744 16 : state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).DefrostControl);
3745 32 : SetDXCoolingCoilData(state,
3746 : thisVrfTU.HeatCoilIndex,
3747 : ErrorsFound,
3748 : _,
3749 : _,
3750 : _,
3751 : _,
3752 : _,
3753 : _,
3754 : _,
3755 : _,
3756 : _,
3757 : _,
3758 : _,
3759 16 : state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).DefrostEIRPtr);
3760 32 : SetDXCoolingCoilData(state,
3761 : thisVrfTU.HeatCoilIndex,
3762 : ErrorsFound,
3763 : _,
3764 : _,
3765 : _,
3766 : _,
3767 : _,
3768 : _,
3769 : _,
3770 : _,
3771 : _,
3772 : _,
3773 : _,
3774 : _,
3775 16 : state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).DefrostFraction);
3776 32 : SetDXCoolingCoilData(state,
3777 : thisVrfTU.HeatCoilIndex,
3778 : ErrorsFound,
3779 : _,
3780 : _,
3781 : _,
3782 : _,
3783 : _,
3784 : _,
3785 : _,
3786 : _,
3787 : _,
3788 : _,
3789 : _,
3790 : _,
3791 : _,
3792 : _,
3793 16 : state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).MaxOATDefrost);
3794 : // If defrost is disabled in the VRF condenser, it must be disabled in the DX coil
3795 : // Defrost primarily handled in parent object, set defrost capacity to 1 to avoid autosizing.
3796 : // Defrost capacity is used for nothing more than setting defrost power/consumption report
3797 : // variables which are not reported. The coil's defrost algorithm IS used to derate the coil
3798 48 : SetDXCoolingCoilData(state,
3799 : thisVrfTU.HeatCoilIndex,
3800 : ErrorsFound,
3801 : _,
3802 : _,
3803 : _,
3804 : _,
3805 : _,
3806 : _,
3807 : _,
3808 : _,
3809 : _,
3810 : _,
3811 : _,
3812 : _,
3813 : _,
3814 32 : 1.0); // DefrostCapacity=1.0
3815 :
3816 16 : state.dataDXCoils->DXCoil(thisVrfTU.HeatCoilIndex).VRFIUPtr = VRFTUNum;
3817 16 : state.dataDXCoils->DXCoil(thisVrfTU.HeatCoilIndex).VRFOUPtr = thisVrfTU.VRFSysNum;
3818 16 : state.dataDXCoils->DXCoil(thisVrfTU.HeatCoilIndex).SupplyFanIndex = thisVrfTU.FanIndex;
3819 :
3820 16 : if (thisVrfTU.FanIndex > 0) {
3821 16 : state.dataDXCoils->DXCoil(thisVrfTU.HeatCoilIndex).RatedAirVolFlowRate(1) =
3822 16 : state.dataFans->fans(thisVrfTU.FanIndex)->maxAirFlowRate;
3823 : } else {
3824 0 : state.dataDXCoils->DXCoil(thisVrfTU.HeatCoilIndex).RatedAirVolFlowRate(1) = AutoSize;
3825 : }
3826 :
3827 : // Terminal unit heating to cooling sizing ratio has precedence over VRF system sizing ratio
3828 16 : if (thisVrfTU.HeatingCapacitySizeRatio > 1.0) {
3829 0 : SetDXCoolingCoilData(state,
3830 : thisVrfTU.HeatCoilIndex,
3831 : ErrorsFound,
3832 : _,
3833 : _,
3834 : _,
3835 : _,
3836 : _,
3837 : _,
3838 : _,
3839 : _,
3840 : _,
3841 : _,
3842 : _,
3843 : _,
3844 : _,
3845 : _,
3846 : _,
3847 : _,
3848 : _,
3849 0 : thisVrfTU.HeatingCapacitySizeRatio);
3850 16 : } else if (state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).HeatingCapacitySizeRatio > 1.0) {
3851 0 : SetDXCoolingCoilData(state,
3852 : thisVrfTU.HeatCoilIndex,
3853 : ErrorsFound,
3854 : _,
3855 : _,
3856 : _,
3857 : _,
3858 : _,
3859 : _,
3860 : _,
3861 : _,
3862 : _,
3863 : _,
3864 : _,
3865 : _,
3866 : _,
3867 : _,
3868 : _,
3869 : _,
3870 : _,
3871 0 : state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).HeatingCapacitySizeRatio);
3872 : }
3873 : } else {
3874 0 : ShowSevereError(state, cCurrentModuleObject + " \"" + thisVrfTU.Name + "\"");
3875 0 : ShowContinueError(
3876 0 : state, "... when checking " + HVAC::cAllCoilTypes(thisVrfTU.DXHeatCoilType_Num) + " \"" + cAlphaArgs(14) + "\"");
3877 0 : ShowContinueError(state, "... terminal unit not connected to condenser.");
3878 0 : ShowContinueError(state, "... check that terminal unit is specified in a terminal unit list object.");
3879 0 : ShowContinueError(state,
3880 : "... also check that the terminal unit list name is specified in an "
3881 : "AirConditioner:VariableRefrigerantFlow object.");
3882 0 : ErrorsFound = true;
3883 : }
3884 : } else {
3885 0 : ShowSevereError(state, cCurrentModuleObject + " \"" + thisVrfTU.Name + "\"");
3886 0 : ShowContinueError(state, "... illegal " + cAlphaFieldNames(14) + " = " + cAlphaArgs(14));
3887 0 : ErrorsFound = true;
3888 : }
3889 :
3890 : } else {
3891 : // Algorithm Type: VRF model based on system curve
3892 46 : if (Util::SameString(HVAC::cAllCoilTypes(thisVrfTU.DXHeatCoilType_Num), HVAC::cAllCoilTypes(HVAC::CoilVRF_Heating))) {
3893 46 : if (thisVrfTU.TUListIndex > 0 && thisVrfTU.IndexToTUInTUList > 0) {
3894 46 : state.dataHVACVarRefFlow->TerminalUnitList(thisVrfTU.TUListIndex).HeatingCoilAvailSchPtr(thisVrfTU.IndexToTUInTUList) =
3895 92 : GetDXCoilAvailSchPtr(state, DXHeatingCoilType, cAlphaArgs(14), errFlag);
3896 : } else {
3897 0 : thisVrfTU.HeatingCoilPresent = false;
3898 : }
3899 46 : errFlag = false;
3900 46 : GetDXCoilIndex(state, cAlphaArgs(14), thisVrfTU.HeatCoilIndex, errFlag, HVAC::cAllCoilTypes(HVAC::CoilVRF_Heating));
3901 46 : HCoilInletNodeNum = DXCoils::GetCoilInletNode(state, HVAC::cAllCoilTypes(HVAC::CoilVRF_Heating), cAlphaArgs(14), errFlag);
3902 46 : HCoilOutletNodeNum = DXCoils::GetCoilOutletNode(state, HVAC::cAllCoilTypes(HVAC::CoilVRF_Heating), cAlphaArgs(14), errFlag);
3903 46 : thisVrfTU.heatCoilAirInNode = HCoilInletNodeNum;
3904 46 : thisVrfTU.heatCoilAirOutNode = HCoilOutletNodeNum;
3905 :
3906 46 : if (errFlag) ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " \"" + thisVrfTU.Name + "\"");
3907 :
3908 92 : SetDXCoolingCoilData(
3909 46 : state, thisVrfTU.HeatCoilIndex, ErrorsFound, _, state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).CondenserType);
3910 92 : SetDXCoolingCoilData(
3911 46 : state, thisVrfTU.HeatCoilIndex, ErrorsFound, _, _, state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).CondenserNodeNum);
3912 92 : SetDXCoolingCoilData(
3913 46 : state, thisVrfTU.HeatCoilIndex, ErrorsFound, _, _, _, state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).MaxOATCCHeater);
3914 92 : SetDXCoolingCoilData(state,
3915 : thisVrfTU.HeatCoilIndex,
3916 : ErrorsFound,
3917 : _,
3918 : _,
3919 : _,
3920 : _,
3921 : _,
3922 : _,
3923 46 : state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).MinOATHeating);
3924 92 : SetDXCoolingCoilData(state,
3925 : thisVrfTU.HeatCoilIndex,
3926 : ErrorsFound,
3927 : _,
3928 : _,
3929 : _,
3930 : _,
3931 : _,
3932 : _,
3933 : _,
3934 : _,
3935 46 : state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).HeatingPerformanceOATType);
3936 : // Set defrost controls in child object to trip child object defrost calculations
3937 92 : SetDXCoolingCoilData(state,
3938 : thisVrfTU.HeatCoilIndex,
3939 : ErrorsFound,
3940 : _,
3941 : _,
3942 : _,
3943 : _,
3944 : _,
3945 : _,
3946 : _,
3947 : _,
3948 : _,
3949 46 : state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).DefrostStrategy);
3950 92 : SetDXCoolingCoilData(state,
3951 : thisVrfTU.HeatCoilIndex,
3952 : ErrorsFound,
3953 : _,
3954 : _,
3955 : _,
3956 : _,
3957 : _,
3958 : _,
3959 : _,
3960 : _,
3961 : _,
3962 : _,
3963 46 : state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).DefrostControl);
3964 92 : SetDXCoolingCoilData(state,
3965 : thisVrfTU.HeatCoilIndex,
3966 : ErrorsFound,
3967 : _,
3968 : _,
3969 : _,
3970 : _,
3971 : _,
3972 : _,
3973 : _,
3974 : _,
3975 : _,
3976 : _,
3977 : _,
3978 46 : state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).DefrostEIRPtr);
3979 92 : SetDXCoolingCoilData(state,
3980 : thisVrfTU.HeatCoilIndex,
3981 : ErrorsFound,
3982 : _,
3983 : _,
3984 : _,
3985 : _,
3986 : _,
3987 : _,
3988 : _,
3989 : _,
3990 : _,
3991 : _,
3992 : _,
3993 : _,
3994 46 : state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).DefrostFraction);
3995 92 : SetDXCoolingCoilData(state,
3996 : thisVrfTU.HeatCoilIndex,
3997 : ErrorsFound,
3998 : _,
3999 : _,
4000 : _,
4001 : _,
4002 : _,
4003 : _,
4004 : _,
4005 : _,
4006 : _,
4007 : _,
4008 : _,
4009 : _,
4010 : _,
4011 : _,
4012 46 : state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).MaxOATDefrost);
4013 : // If defrost is disabled in the VRF condenser, it must be disabled in the DX coil
4014 : // Defrost primarily handled in parent object, set defrost capacity to 1 to avoid autosizing.
4015 : // Defrost capacity is used for nothing more than setting defrost power/consumption report
4016 : // variables which are not reported. The coil's defrost algorithm IS used to derate the coil
4017 138 : SetDXCoolingCoilData(state,
4018 : thisVrfTU.HeatCoilIndex,
4019 : ErrorsFound,
4020 : _,
4021 : _,
4022 : _,
4023 : _,
4024 : _,
4025 : _,
4026 : _,
4027 : _,
4028 : _,
4029 : _,
4030 : _,
4031 : _,
4032 : _,
4033 92 : 1.0); // DefrostCapacity=1.0
4034 : // Terminal unit heating to cooling sizing ratio has precedence over VRF system sizing ratio
4035 46 : if (thisVrfTU.HeatingCapacitySizeRatio > 1.0) {
4036 0 : SetDXCoolingCoilData(state,
4037 : thisVrfTU.HeatCoilIndex,
4038 : ErrorsFound,
4039 : _,
4040 : _,
4041 : _,
4042 : _,
4043 : _,
4044 : _,
4045 : _,
4046 : _,
4047 : _,
4048 : _,
4049 : _,
4050 : _,
4051 : _,
4052 : _,
4053 : _,
4054 : _,
4055 : _,
4056 0 : thisVrfTU.HeatingCapacitySizeRatio);
4057 46 : } else if (state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).HeatingCapacitySizeRatio > 1.0) {
4058 0 : SetDXCoolingCoilData(state,
4059 : thisVrfTU.HeatCoilIndex,
4060 : ErrorsFound,
4061 : _,
4062 : _,
4063 : _,
4064 : _,
4065 : _,
4066 : _,
4067 : _,
4068 : _,
4069 : _,
4070 : _,
4071 : _,
4072 : _,
4073 : _,
4074 : _,
4075 : _,
4076 : _,
4077 : _,
4078 0 : state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).HeatingCapacitySizeRatio);
4079 : }
4080 : // Check VRF DX heating coil heating capacity as a function of temperature performance curve. Only report here for
4081 : // biquadratic curve type.
4082 92 : if (thisVrfTU.VRFSysNum > 0 && thisVrfTU.HeatCoilIndex > 0 &&
4083 46 : state.dataCurveManager->PerfCurve(GetDXCoilCapFTCurveIndex(state, thisVrfTU.HeatCoilIndex, ErrorsFound))->numDims == 2) {
4084 15 : if (state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).HeatingPerformanceOATType == HVAC::OATType::WetBulb) {
4085 45 : checkCurveIsNormalizedToOne(
4086 : state,
4087 30 : "GetDXCoils: " + HVAC::cAllCoilTypes(thisVrfTU.DXHeatCoilType_Num),
4088 15 : DXCoils::GetDXCoilName(
4089 15 : state, thisVrfTU.HeatCoilIndex, ErrorsFound, HVAC::cAllCoilTypes(thisVrfTU.DXHeatCoilType_Num)),
4090 : GetDXCoilCapFTCurveIndex(state, thisVrfTU.HeatCoilIndex, ErrorsFound),
4091 : "Heating Capacity Ratio Modifier Function of Temperature Curve Name",
4092 30 : Curve::GetCurveName(state, GetDXCoilCapFTCurveIndex(state, thisVrfTU.HeatCoilIndex, ErrorsFound)),
4093 : RatedInletAirTempHeat,
4094 : RatedOutdoorWetBulbTempHeat);
4095 0 : } else if (state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).HeatingPerformanceOATType == HVAC::OATType::DryBulb) {
4096 0 : checkCurveIsNormalizedToOne(
4097 : state,
4098 0 : "GetDXCoils: " + HVAC::cAllCoilTypes(thisVrfTU.DXHeatCoilType_Num),
4099 0 : DXCoils::GetDXCoilName(
4100 0 : state, thisVrfTU.HeatCoilIndex, ErrorsFound, HVAC::cAllCoilTypes(thisVrfTU.DXHeatCoilType_Num)),
4101 : GetDXCoilCapFTCurveIndex(state, thisVrfTU.HeatCoilIndex, ErrorsFound),
4102 : "Heating Capacity Ratio Modifier Function of Temperature Curve Name",
4103 0 : Curve::GetCurveName(state, GetDXCoilCapFTCurveIndex(state, thisVrfTU.HeatCoilIndex, ErrorsFound)),
4104 : RatedInletAirTempHeat,
4105 : RatedOutdoorAirTempHeat);
4106 : }
4107 : }
4108 :
4109 : } else {
4110 0 : ShowSevereError(state, cCurrentModuleObject + " \"" + thisVrfTU.Name + "\"");
4111 0 : ShowContinueError(state, "... illegal " + cAlphaFieldNames(14) + " = " + cAlphaArgs(14));
4112 0 : ErrorsFound = true;
4113 : }
4114 : }
4115 : } else {
4116 0 : ShowSevereError(state, cCurrentModuleObject + " \"" + thisVrfTU.Name + "\"");
4117 0 : ShowContinueError(state, "... when checking " + HVAC::cAllCoilTypes(thisVrfTU.DXHeatCoilType_Num) + " \"" + cAlphaArgs(14) + "\"");
4118 0 : ShowContinueError(state, "... terminal unit not connected to condenser.");
4119 0 : ShowContinueError(state, "... check that terminal unit is specified in a terminal unit list object.");
4120 0 : ShowContinueError(
4121 : state, "... also check that the terminal unit list name is specified in an AirConditioner:VariableRefrigerantFlow object.");
4122 0 : ErrorsFound = true;
4123 : }
4124 : }
4125 :
4126 62 : if (!thisVrfTU.CoolingCoilPresent && thisVrfTU.DXCoolCoilType_Num == 0 && !thisVrfTU.HeatingCoilPresent &&
4127 0 : thisVrfTU.DXHeatCoilType_Num == 0) {
4128 0 : ShowSevereError(state, cCurrentModuleObject + " \"" + thisVrfTU.Name + "\"");
4129 0 : ShowContinueError(state, "... no valid coils entered for this terminal unit. Simulation will not proceed.");
4130 0 : ErrorsFound = true;
4131 : }
4132 :
4133 62 : if (!lAlphaFieldBlanks(15)) {
4134 1 : thisVrfTU.AvailManagerListName = cAlphaArgs(15);
4135 : }
4136 62 : thisVrfTU.ParasiticElec = rNumericArgs(8);
4137 62 : thisVrfTU.ParasiticOffElec = rNumericArgs(9);
4138 :
4139 62 : thisVrfTU.HVACSizingIndex = 0;
4140 62 : if (!lAlphaFieldBlanks(16)) {
4141 0 : thisVrfTU.HVACSizingIndex = Util::FindItemInList(cAlphaArgs(16), state.dataSize->ZoneHVACSizing);
4142 0 : if (thisVrfTU.HVACSizingIndex == 0) {
4143 0 : ShowSevereError(state, cAlphaFieldNames(16) + " = " + cAlphaArgs(16) + " not found.");
4144 0 : ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name);
4145 0 : ErrorsFound = true;
4146 : }
4147 : }
4148 :
4149 : // supplemental heating coil
4150 62 : if (!lAlphaFieldBlanks(17) && !lAlphaFieldBlanks(18)) {
4151 :
4152 11 : thisVrfTU.SuppHeatCoilType = cAlphaArgs(17);
4153 11 : thisVrfTU.SuppHeatCoilName = cAlphaArgs(18);
4154 :
4155 11 : errFlag = false;
4156 11 : if (Util::SameString(thisVrfTU.SuppHeatCoilType, "Coil:Heating:Water")) {
4157 2 : thisVrfTU.SuppHeatCoilType_Num = HVAC::Coil_HeatingWater;
4158 9 : } else if (Util::SameString(thisVrfTU.SuppHeatCoilType, "Coil:Heating:Steam")) {
4159 2 : thisVrfTU.SuppHeatCoilType_Num = HVAC::Coil_HeatingSteam;
4160 10 : } else if (Util::SameString(thisVrfTU.SuppHeatCoilType, "Coil:Heating:Fuel") ||
4161 10 : Util::SameString(thisVrfTU.SuppHeatCoilType, "Coil:Heating:Electric")) {
4162 7 : thisVrfTU.SuppHeatCoilType_Num =
4163 7 : HeatingCoils::GetHeatingCoilTypeNum(state, thisVrfTU.SuppHeatCoilType, thisVrfTU.SuppHeatCoilName, errFlag);
4164 : }
4165 :
4166 11 : thisVrfTU.SuppHeatingCoilPresent = true;
4167 :
4168 11 : if (thisVrfTU.SuppHeatCoilType_Num == HVAC::Coil_HeatingGasOrOtherFuel || thisVrfTU.SuppHeatCoilType_Num == HVAC::Coil_HeatingElectric) {
4169 7 : errFlag = false;
4170 7 : thisVrfTU.SuppHeatCoilType_Num =
4171 7 : HeatingCoils::GetHeatingCoilTypeNum(state, thisVrfTU.SuppHeatCoilType, thisVrfTU.SuppHeatCoilName, errFlag);
4172 7 : if (errFlag) {
4173 0 : ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name);
4174 0 : ErrorsFound = true;
4175 : } else {
4176 7 : ValidateComponent(state, thisVrfTU.SuppHeatCoilType, thisVrfTU.SuppHeatCoilName, IsNotOK, cCurrentModuleObject);
4177 7 : if (IsNotOK) {
4178 0 : ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name);
4179 0 : ErrorsFound = true;
4180 : } else { // mine data from supplemental heating coil
4181 : // Get the supplemental heating coil index
4182 7 : thisVrfTU.SuppHeatCoilIndex =
4183 7 : HeatingCoils::GetHeatingCoilIndex(state, thisVrfTU.SuppHeatCoilType, thisVrfTU.SuppHeatCoilName, IsNotOK);
4184 7 : if (IsNotOK) {
4185 0 : ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name);
4186 0 : ErrorsFound = true;
4187 : }
4188 : // Get the design supplemental heating capacity
4189 7 : errFlag = false;
4190 7 : thisVrfTU.DesignSuppHeatingCapacity =
4191 7 : HeatingCoils::GetCoilCapacity(state, thisVrfTU.SuppHeatCoilType, thisVrfTU.SuppHeatCoilName, errFlag);
4192 7 : if (errFlag) {
4193 0 : ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name);
4194 0 : ErrorsFound = true;
4195 : }
4196 : // Get the supplemental heating Coil air inlet node
4197 7 : errFlag = false;
4198 7 : thisVrfTU.SuppHeatCoilAirInletNode =
4199 7 : HeatingCoils::GetCoilInletNode(state, thisVrfTU.SuppHeatCoilType, thisVrfTU.SuppHeatCoilName, errFlag);
4200 7 : if (errFlag) {
4201 0 : ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name);
4202 0 : ErrorsFound = true;
4203 : }
4204 : // Get the supplemental heating Coil air outlet node
4205 7 : errFlag = false;
4206 7 : thisVrfTU.SuppHeatCoilAirOutletNode =
4207 7 : HeatingCoils::GetCoilOutletNode(state, thisVrfTU.SuppHeatCoilType, thisVrfTU.SuppHeatCoilName, errFlag);
4208 7 : if (errFlag) {
4209 0 : ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name);
4210 0 : ErrorsFound = true;
4211 : }
4212 : } // IF (IsNotOK) THEN
4213 : }
4214 :
4215 4 : } else if (thisVrfTU.SuppHeatCoilType_Num == HVAC::Coil_HeatingWater) {
4216 :
4217 2 : ValidateComponent(state, thisVrfTU.SuppHeatCoilType, thisVrfTU.SuppHeatCoilName, IsNotOK, cCurrentModuleObject);
4218 2 : if (IsNotOK) {
4219 0 : ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name);
4220 0 : ErrorsFound = true;
4221 : } else { // mine data from heating coil object
4222 :
4223 : // Get the supplemental heating coil water Inlet or control node number
4224 2 : errFlag = false;
4225 2 : thisVrfTU.SuppHeatCoilFluidInletNode =
4226 2 : WaterCoils::GetCoilWaterInletNode(state, "Coil:Heating:Water", thisVrfTU.SuppHeatCoilName, errFlag);
4227 2 : if (errFlag) {
4228 0 : ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name);
4229 0 : ErrorsFound = true;
4230 : }
4231 : // Get the supplemental heating coil hot water max volume flow rate
4232 2 : errFlag = false;
4233 2 : thisVrfTU.SuppHeatCoilFluidMaxFlow =
4234 2 : WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", thisVrfTU.SuppHeatCoilName, errFlag);
4235 2 : if (errFlag) {
4236 0 : ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name);
4237 0 : ErrorsFound = true;
4238 : }
4239 : // Get the supplemental heating Coil air inlet node
4240 2 : errFlag = false;
4241 2 : thisVrfTU.SuppHeatCoilAirInletNode =
4242 2 : WaterCoils::GetCoilInletNode(state, "Coil:Heating:Water", thisVrfTU.SuppHeatCoilName, errFlag);
4243 2 : if (errFlag) {
4244 0 : ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name);
4245 0 : ErrorsFound = true;
4246 : }
4247 : // Get the supplemental heating coil air outlet node
4248 2 : errFlag = false;
4249 2 : thisVrfTU.SuppHeatCoilAirOutletNode =
4250 2 : WaterCoils::GetCoilOutletNode(state, "Coil:Heating:Water", thisVrfTU.SuppHeatCoilName, errFlag);
4251 2 : if (errFlag) {
4252 0 : ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name);
4253 0 : ErrorsFound = true;
4254 : }
4255 : }
4256 :
4257 2 : } else if (thisVrfTU.SuppHeatCoilType_Num == HVAC::Coil_HeatingSteam) {
4258 :
4259 2 : ValidateComponent(state, thisVrfTU.SuppHeatCoilType, thisVrfTU.SuppHeatCoilName, IsNotOK, cCurrentModuleObject);
4260 2 : if (IsNotOK) {
4261 0 : ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name);
4262 0 : ErrorsFound = true;
4263 : } else { // mine data from supplemental heating coil object
4264 2 : errFlag = false;
4265 2 : thisVrfTU.SuppHeatCoilIndex = SteamCoils::GetSteamCoilIndex(state, "COIL:HEATING:STEAM", thisVrfTU.SuppHeatCoilName, errFlag);
4266 2 : if (thisVrfTU.SuppHeatCoilIndex == 0) {
4267 0 : ShowSevereError(state, cCurrentModuleObject + " = " + thisVrfTU.Name);
4268 0 : ErrorsFound = true;
4269 : }
4270 : // Get the supplemental heating Coil steam inlet node number
4271 2 : errFlag = false;
4272 2 : thisVrfTU.SuppHeatCoilFluidInletNode =
4273 2 : SteamCoils::GetCoilSteamInletNode(state, "Coil:Heating:Steam", thisVrfTU.SuppHeatCoilName, errFlag);
4274 2 : if (errFlag) {
4275 0 : ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name);
4276 0 : ErrorsFound = true;
4277 : }
4278 : // Get the supplemental heating coil steam max volume flow rate
4279 2 : thisVrfTU.SuppHeatCoilFluidMaxFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, thisVrfTU.SuppHeatCoilIndex, errFlag);
4280 2 : if (thisVrfTU.SuppHeatCoilFluidMaxFlow > 0.0) {
4281 0 : int SteamIndex = 0; // fluid type index of 0 is passed if steam
4282 0 : Real64 TempSteamIn = 100.0;
4283 0 : Real64 SteamDensity = FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, SteamIndex, RoutineName);
4284 0 : thisVrfTU.SuppHeatCoilFluidMaxFlow =
4285 0 : SteamCoils::GetCoilMaxSteamFlowRate(state, thisVrfTU.SuppHeatCoilIndex, errFlag) * SteamDensity;
4286 : }
4287 : // Get the supplemental heating coil air inlet node
4288 2 : errFlag = false;
4289 2 : thisVrfTU.SuppHeatCoilAirInletNode =
4290 2 : SteamCoils::GetCoilAirInletNode(state, thisVrfTU.SuppHeatCoilIndex, thisVrfTU.SuppHeatCoilName, errFlag);
4291 2 : if (errFlag) {
4292 0 : ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name);
4293 0 : ErrorsFound = true;
4294 : }
4295 : // Get the supplemental heating coil air outlet node
4296 2 : errFlag = false;
4297 2 : thisVrfTU.SuppHeatCoilAirOutletNode =
4298 2 : SteamCoils::GetCoilAirOutletNode(state, thisVrfTU.SuppHeatCoilIndex, thisVrfTU.SuppHeatCoilName, errFlag);
4299 2 : if (errFlag) {
4300 0 : ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name);
4301 0 : ErrorsFound = true;
4302 : }
4303 : }
4304 : }
4305 : } else { // if (!lAlphaFieldBlanks(17) && !lAlphaFieldBlanks(18)) {
4306 51 : if (!lAlphaFieldBlanks(17) && lAlphaFieldBlanks(18)) {
4307 0 : ShowWarningError(state, cCurrentModuleObject + " = " + thisVrfTU.Name + "\"");
4308 0 : ShowContinueError(state, "...Supplemental heating coil type = " + cAlphaArgs(17));
4309 0 : ShowContinueError(state, "...But missing the associated supplemental heating coil name. ");
4310 0 : ShowContinueError(state, "...The supplemental heating coil will not be simulated. ");
4311 : }
4312 51 : if (lAlphaFieldBlanks(17) && !lAlphaFieldBlanks(18)) {
4313 0 : ShowWarningError(state, cCurrentModuleObject + " = " + thisVrfTU.Name + "\"");
4314 0 : ShowContinueError(state, "...Supplemental heating coil name = " + cAlphaArgs(18));
4315 0 : ShowContinueError(state, "...But missing the associated supplemental heating coil type. ");
4316 0 : ShowContinueError(state, "...The supplemental heating coil will not be simulated. ");
4317 : }
4318 : }
4319 :
4320 62 : if (!lAlphaFieldBlanks(19)) {
4321 1 : thisVrfTU.ZoneNum = Util::FindItemInList(cAlphaArgs(19), state.dataHeatBal->Zone);
4322 1 : if (thisVrfTU.ZoneNum == 0) {
4323 0 : ShowSevereError(state, cCurrentModuleObject + " = " + cAlphaArgs(1));
4324 0 : ShowContinueError(state, "Illegal " + cAlphaFieldNames(19) + " = " + cAlphaArgs(19));
4325 0 : ErrorsFound = true;
4326 : }
4327 : }
4328 :
4329 62 : auto &vrfTU = state.dataHVACVarRefFlow->VRFTU(VRFTUNum);
4330 62 : if (!lAlphaFieldBlanks(20) && !lAlphaFieldBlanks(21)) {
4331 1 : vrfTU.DesignSpecMultispeedHPType = cAlphaArgs(20);
4332 1 : vrfTU.DesignSpecMultispeedHPName = cAlphaArgs(21);
4333 1 : vrfTU.DesignSpecMSHPIndex = UnitarySystems::getDesignSpecMSHPIndex(state, cAlphaArgs(21));
4334 1 : auto const &designSpecFan = state.dataUnitarySystems->designSpecMSHP[vrfTU.DesignSpecMSHPIndex];
4335 1 : if (vrfTU.DXCoolCoilType_Num == HVAC::CoilVRF_Cooling) {
4336 1 : int NumSpeeds = designSpecFan.numOfSpeedCooling;
4337 1 : vrfTU.NumOfSpeedCooling = NumSpeeds;
4338 1 : vrfTU.CoolVolumeFlowRate.resize(NumSpeeds + 1);
4339 1 : vrfTU.CoolMassFlowRate.resize(NumSpeeds + 1);
4340 1 : if (vrfTU.MaxCoolAirVolFlow != DataSizing::AutoSize) {
4341 0 : Real64 AirFlowRate = vrfTU.MaxCoolAirVolFlow;
4342 0 : for (int i = 1; i <= vrfTU.NumOfSpeedCooling; ++i) {
4343 0 : if (state.dataUnitarySystems->designSpecMSHP[vrfTU.DesignSpecMSHPIndex].coolingVolFlowRatio[i] == DataSizing::AutoSize) {
4344 0 : vrfTU.CoolVolumeFlowRate[i] = double(i) / double(vrfTU.NumOfSpeedCooling) * AirFlowRate;
4345 : } else {
4346 0 : vrfTU.CoolVolumeFlowRate[i] =
4347 0 : state.dataUnitarySystems->designSpecMSHP[vrfTU.DesignSpecMSHPIndex].coolingVolFlowRatio[i] * AirFlowRate;
4348 : }
4349 0 : vrfTU.CoolMassFlowRate[i] = vrfTU.CoolVolumeFlowRate[i] * state.dataEnvrn->StdRhoAir;
4350 : }
4351 : }
4352 : }
4353 1 : if (vrfTU.DXHeatCoilType_Num == HVAC::CoilVRF_Heating) {
4354 1 : int NumSpeeds = designSpecFan.numOfSpeedHeating;
4355 1 : vrfTU.NumOfSpeedHeating = NumSpeeds;
4356 1 : vrfTU.HeatVolumeFlowRate.resize(NumSpeeds + 1);
4357 1 : vrfTU.HeatMassFlowRate.resize(NumSpeeds + 1);
4358 1 : if (vrfTU.MaxHeatAirVolFlow != DataSizing::AutoSize) {
4359 0 : Real64 AirFlowRate = vrfTU.MaxHeatAirVolFlow;
4360 0 : for (int i = 1; i <= vrfTU.NumOfSpeedHeating; ++i) {
4361 0 : if (state.dataUnitarySystems->designSpecMSHP[vrfTU.DesignSpecMSHPIndex].heatingVolFlowRatio[i] == DataSizing::AutoSize) {
4362 0 : vrfTU.HeatVolumeFlowRate[i] = double(i) / double(vrfTU.NumOfSpeedHeating) * AirFlowRate;
4363 : } else {
4364 0 : vrfTU.HeatVolumeFlowRate[i] =
4365 0 : state.dataUnitarySystems->designSpecMSHP[vrfTU.DesignSpecMSHPIndex].heatingVolFlowRatio[i] * AirFlowRate;
4366 : }
4367 0 : vrfTU.HeatMassFlowRate[i] = vrfTU.HeatVolumeFlowRate[i] * state.dataEnvrn->StdRhoAir;
4368 : }
4369 : }
4370 : }
4371 : } else {
4372 61 : if (vrfTU.fanType == HVAC::FanType::SystemModel) {
4373 32 : auto *fanSystem = dynamic_cast<Fans::FanSystem *>(state.dataFans->fans(vrfTU.FanIndex));
4374 32 : assert(fanSystem != nullptr);
4375 :
4376 32 : if (fanSystem->speedControl == Fans::SpeedControl::Discrete) {
4377 16 : if (fanSystem->numSpeeds > 1) {
4378 1 : if (vrfTU.DXCoolCoilType_Num == HVAC::CoilVRF_Cooling) {
4379 1 : vrfTU.NumOfSpeedCooling = fanSystem->numSpeeds;
4380 1 : vrfTU.CoolVolumeFlowRate.resize(fanSystem->numSpeeds + 1);
4381 1 : vrfTU.CoolMassFlowRate.resize(fanSystem->numSpeeds + 1);
4382 1 : if (vrfTU.MaxCoolAirVolFlow != DataSizing::AutoSize) {
4383 0 : for (int i = 1; i <= vrfTU.NumOfSpeedCooling; ++i) {
4384 0 : vrfTU.CoolMassFlowRate[i] = fanSystem->massFlowAtSpeed[i - 1];
4385 : }
4386 : }
4387 : }
4388 1 : if (vrfTU.DXHeatCoilType_Num == HVAC::CoilVRF_Heating) {
4389 1 : vrfTU.NumOfSpeedHeating = fanSystem->numSpeeds;
4390 1 : vrfTU.HeatVolumeFlowRate.resize(fanSystem->numSpeeds + 1);
4391 1 : vrfTU.HeatMassFlowRate.resize(fanSystem->numSpeeds + 1);
4392 1 : if (vrfTU.MaxHeatAirVolFlow != DataSizing::AutoSize) {
4393 0 : for (int i = 1; i <= vrfTU.NumOfSpeedCooling; ++i) {
4394 0 : vrfTU.HeatMassFlowRate[i] = fanSystem->massFlowAtSpeed[i - 1];
4395 : }
4396 : }
4397 : }
4398 2 : ShowWarningError(state,
4399 2 : cCurrentModuleObject + " = " + thisVrfTU.Name + " with Fan:SystemModel is used in " + cAlphaArgs(8) + "\"");
4400 1 : ShowContinueError(state, format("...The number of speed = {:.0R}.", double(fanSystem->numSpeeds)));
4401 1 : ShowContinueError(state, "...Multiple speed fan will be applied to this unit. The speed number is determined by load.");
4402 : }
4403 : }
4404 : }
4405 : }
4406 :
4407 : // set supplemental heating coil operation temperature limits
4408 62 : if (thisVrfTU.SuppHeatingCoilPresent) {
4409 : // Set maximum supply air temperature for supplemental heating coil
4410 11 : if (NumNums < 11) {
4411 0 : thisVrfTU.MaxSATFromSuppHeatCoil = DataSizing::AutoSize;
4412 : } else {
4413 11 : thisVrfTU.MaxSATFromSuppHeatCoil = rNumericArgs(11);
4414 : }
4415 : // set maximum outdoor dry-bulb temperature for supplemental heating coil operation
4416 11 : if (NumNums < 12) {
4417 0 : thisVrfTU.MaxOATSuppHeatingCoil = 21.0;
4418 : } else {
4419 11 : thisVrfTU.MaxOATSuppHeatingCoil = rNumericArgs(12);
4420 : }
4421 : }
4422 :
4423 : // Add cooling coil to component sets array
4424 62 : if (thisVrfTU.CoolingCoilPresent) {
4425 :
4426 124 : SetUpCompSets(state,
4427 : cCurrentModuleObject,
4428 : thisVrfTU.Name,
4429 62 : HVAC::cAllCoilTypes(thisVrfTU.DXCoolCoilType_Num),
4430 62 : cAlphaArgs(12),
4431 62 : state.dataLoopNodes->NodeID(CCoilInletNodeNum),
4432 62 : state.dataLoopNodes->NodeID(CCoilOutletNodeNum));
4433 : // set heating coil present flag
4434 124 : SetDXCoolingCoilData(
4435 62 : state, thisVrfTU.CoolCoilIndex, ErrorsFound, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, thisVrfTU.HeatingCoilPresent);
4436 :
4437 : // check that curve types are present in VRF Condenser if cooling coil is present in terminal unit (can be blank)
4438 : // all curves are checked for correct type if a curve name is entered in the VRF condenser object. Check that the
4439 : // curve is present if the corresponding coil is entered in the terminal unit.
4440 62 : if (thisVrfTU.VRFSysNum > 0) {
4441 :
4442 62 : if (state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).VRFAlgorithmType != AlgorithmType::FluidTCtrl) {
4443 :
4444 92 : if (state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).CoolingCapacity <= 0 &&
4445 46 : state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).CoolingCapacity != AutoSize) {
4446 0 : ShowSevereError(state, cCurrentModuleObject + " \"" + thisVrfTU.Name + "\"");
4447 0 : ShowContinueError(state,
4448 : "...This terminal unit contains a cooling coil and rated cooling capacity is also required in the "
4449 : "associated condenser object.");
4450 0 : ShowContinueError(state,
4451 0 : "...Rated Cooling Capacity must also be specified for condenser = " +
4452 0 : std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).VRFSystemTypeNum)) + " \"" +
4453 0 : state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).Name + "\".");
4454 0 : ErrorsFound = true;
4455 : }
4456 : }
4457 : }
4458 : }
4459 :
4460 : // Add heating coil to component sets array
4461 62 : if (thisVrfTU.HeatingCoilPresent) {
4462 :
4463 124 : SetUpCompSets(state,
4464 : cCurrentModuleObject,
4465 : thisVrfTU.Name,
4466 62 : HVAC::cAllCoilTypes(thisVrfTU.DXHeatCoilType_Num),
4467 62 : cAlphaArgs(14),
4468 62 : state.dataLoopNodes->NodeID(HCoilInletNodeNum),
4469 62 : state.dataLoopNodes->NodeID(HCoilOutletNodeNum));
4470 : // set cooling coil present flag
4471 124 : SetDXCoolingCoilData(
4472 62 : state, thisVrfTU.HeatCoilIndex, ErrorsFound, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, thisVrfTU.CoolingCoilPresent);
4473 :
4474 62 : if (thisVrfTU.VRFSysNum > 0) {
4475 :
4476 62 : if (state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).VRFAlgorithmType != AlgorithmType::FluidTCtrl) {
4477 :
4478 92 : if (state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).HeatingCapacity <= 0 &&
4479 46 : state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).HeatingCapacity != AutoSize) {
4480 0 : ShowSevereError(state, cCurrentModuleObject + " \"" + thisVrfTU.Name + "\"");
4481 0 : ShowContinueError(state,
4482 : "...This terminal unit contains a heating coil and rated heating capacity is also required in the "
4483 : "associated condenser object.");
4484 0 : ShowContinueError(state,
4485 0 : "...Rated Heating Capacity must also be specified for condenser = " +
4486 0 : std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).VRFSystemTypeNum)) + " \"" +
4487 0 : state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).Name + "\".");
4488 0 : ErrorsFound = true;
4489 : }
4490 :
4491 46 : if (state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).HeatCapFT == 0) {
4492 0 : ShowSevereError(state, cCurrentModuleObject + " \"" + thisVrfTU.Name + "\"");
4493 0 : ShowContinueError(state,
4494 : "...This terminal unit contains a heating coil and heating performance curves are also required in the "
4495 : "associated condenser object.");
4496 0 : ShowContinueError(
4497 : state,
4498 0 : "...Heating Capacity Ratio Modifier Function of Low Temperature Curve must also be specified for condenser = " +
4499 0 : std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).VRFSystemTypeNum)) + " \"" +
4500 0 : state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).Name + "\".");
4501 0 : ErrorsFound = true;
4502 : }
4503 :
4504 46 : if (state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).HeatEIRFT == 0) {
4505 0 : ShowSevereError(state, cCurrentModuleObject + " \"" + thisVrfTU.Name + "\"");
4506 0 : ShowContinueError(state,
4507 : "...This terminal unit contains a heating coil and heating performance curves are also required in the "
4508 : "associated condenser object.");
4509 0 : ShowContinueError(
4510 : state,
4511 0 : "...Heating Energy Input Ratio Modifier Function of Low Temperature Curve must also be specified for condenser = " +
4512 0 : std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).VRFSystemTypeNum)) + " \"" +
4513 0 : state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).Name + "\".");
4514 0 : ErrorsFound = true;
4515 : }
4516 :
4517 46 : if (state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).HeatEIRFPLR1 == 0) {
4518 0 : ShowSevereError(state, cCurrentModuleObject + " \"" + thisVrfTU.Name + "\"");
4519 0 : ShowContinueError(state,
4520 : "...This terminal unit contains a heating coil and heating performance curves are also required in the "
4521 : "associated condenser object.");
4522 0 : ShowContinueError(state,
4523 : "...Heating Energy Input Ratio Modifier Function of Low Part-Load Ratio Curve must also be specified "
4524 0 : "for condenser = " +
4525 0 : std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).VRFSystemTypeNum)) + " \"" +
4526 0 : state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).Name + "\".");
4527 : }
4528 : }
4529 : }
4530 : }
4531 :
4532 : // Add supplemental heating coil to component sets array
4533 62 : if (thisVrfTU.SuppHeatingCoilPresent) {
4534 33 : SetUpCompSets(state,
4535 : cCurrentModuleObject,
4536 : thisVrfTU.Name,
4537 11 : HVAC::cAllCoilTypes(thisVrfTU.SuppHeatCoilType_Num),
4538 : thisVrfTU.SuppHeatCoilName,
4539 11 : state.dataLoopNodes->NodeID(thisVrfTU.SuppHeatCoilAirInletNode),
4540 11 : state.dataLoopNodes->NodeID(thisVrfTU.SuppHeatCoilAirOutletNode));
4541 : }
4542 : // Set up component set for OA mixer - use OA node and Mixed air node
4543 62 : if (thisVrfTU.OAMixerUsed)
4544 102 : SetUpCompSets(state,
4545 : cCurrentModuleObject,
4546 : thisVrfTU.Name,
4547 : "UNDEFINED",
4548 : thisVrfTU.OAMixerName,
4549 51 : state.dataLoopNodes->NodeID(OANodeNums(1)),
4550 51 : state.dataLoopNodes->NodeID(OANodeNums(4)));
4551 :
4552 : // Get AirTerminal mixer data
4553 62 : GetATMixer(state,
4554 62 : thisVrfTU.Name,
4555 62 : thisVrfTU.ATMixerName,
4556 62 : thisVrfTU.ATMixerIndex,
4557 62 : thisVrfTU.ATMixerType,
4558 62 : thisVrfTU.ATMixerPriNode,
4559 62 : thisVrfTU.ATMixerSecNode,
4560 62 : thisVrfTU.ATMixerOutNode,
4561 : thisVrfTU.VRFTUOutletNodeNum);
4562 62 : if (thisVrfTU.ATMixerType == HVAC::MixerType::InletSide || thisVrfTU.ATMixerType == HVAC::MixerType::SupplySide) {
4563 10 : thisVrfTU.ATMixerExists = true;
4564 : }
4565 : // check that the VRF TU have local outside air and DOA
4566 62 : if (thisVrfTU.ATMixerExists && OANodeNums(4) > 0) {
4567 0 : ShowSevereError(
4568 0 : state, cCurrentModuleObject + " = \"" + thisVrfTU.Name + "\". VRF terminal unit has local as well as central outdoor air specified");
4569 0 : ErrorsFound = true;
4570 : }
4571 :
4572 : // for ZoneHVAC check that TU inlet node is a zone exhaust node otherwise ZoneAirNode and ZoneNum = 0
4573 62 : if (!thisVrfTU.ATMixerExists || thisVrfTU.ATMixerType == HVAC::MixerType::SupplySide) {
4574 389 : for (int CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) {
4575 333 : if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZone).IsControlled) continue;
4576 492 : for (int NodeNum = 1; NodeNum <= state.dataZoneEquip->ZoneEquipConfig(CtrlZone).NumExhaustNodes; ++NodeNum) {
4577 270 : if (thisVrfTU.VRFTUInletNodeNum == state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ExhaustNode(NodeNum)) {
4578 54 : thisVrfTU.ZoneAirNode = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ZoneNode;
4579 54 : thisVrfTU.ZoneNum = CtrlZone;
4580 54 : break;
4581 : }
4582 : }
4583 : }
4584 62 : } else if (thisVrfTU.ATMixerType == HVAC::MixerType::InletSide) {
4585 42 : for (int CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) {
4586 36 : if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZone).IsControlled) continue;
4587 54 : for (int NodeNum = 1; NodeNum <= state.dataZoneEquip->ZoneEquipConfig(CtrlZone).NumInletNodes; ++NodeNum) {
4588 30 : if (thisVrfTU.VRFTUOutletNodeNum == state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(NodeNum)) {
4589 6 : thisVrfTU.ZoneAirNode = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ZoneNode;
4590 6 : thisVrfTU.ZoneNum = CtrlZone;
4591 6 : break;
4592 : }
4593 : }
4594 : }
4595 : }
4596 62 : CheckVRFTUNodeConnections(state, VRFTUNum, ErrorsFound);
4597 62 : } // end Number of VRF Terminal Unit Loop
4598 :
4599 : // perform additional error checking
4600 27 : for (auto const &thisTUList : state.dataHVACVarRefFlow->TerminalUnitList) {
4601 76 : for (int VRFTUNum = 1; VRFTUNum <= thisTUList.NumTUInList; ++VRFTUNum) {
4602 62 : int const tuPtr = thisTUList.ZoneTUPtr(VRFTUNum);
4603 62 : if (tuPtr == 0) {
4604 : // TU name in zone terminal unit list not found
4605 0 : ShowSevereError(state, format("ZoneTerminalUnitList \"{}\"", thisTUList.Name));
4606 0 : ShowContinueError(state, format("...Zone Terminal Unit = {} improperly connected to system.", thisTUList.ZoneTUName(VRFTUNum)));
4607 0 : ShowContinueError(state, "...either the ZoneHVAC:TerminalUnit:VariableRefrigerantFlow object does not exist,");
4608 0 : ShowContinueError(state, "...the ZoneHVAC:TerminalUnit:VariableRefrigerantFlow object name is misspelled,");
4609 0 : ShowContinueError(state, "...or the ZoneTerminalUnitList object is not named in an AirConditioner:VariableRefrigerantFlow object.");
4610 0 : ErrorsFound = true;
4611 : } else {
4612 62 : int const sysNum = state.dataHVACVarRefFlow->VRFTU(tuPtr).VRFSysNum;
4613 62 : if (sysNum > 0) {
4614 62 : auto &thisVRFSys = state.dataHVACVarRefFlow->VRF(sysNum);
4615 62 : if (thisTUList.NumTUInList == 1 && thisVRFSys.VRFAlgorithmType == AlgorithmType::SysCurve) {
4616 1 : if (thisVRFSys.HeatRecoveryUsed) {
4617 0 : ShowWarningError(state, format("ZoneTerminalUnitList \"{}\"", thisTUList.Name));
4618 0 : ShowWarningError(state, "...Only 1 Terminal Unit connected to system and heat recovery is selected.");
4619 0 : ShowContinueError(state, format("...Heat recovery will be disabled for {}.", thisVRFSys.Name));
4620 0 : thisVRFSys.HeatRecoveryUsed = false;
4621 : }
4622 : }
4623 : }
4624 : }
4625 : }
4626 13 : }
4627 :
4628 : // warn when number of ZoneTerminalUnitList different from number of AirConditioner:VariableRefrigerantFlow
4629 13 : if (state.dataHVACVarRefFlow->NumVRFTULists != state.dataHVACVarRefFlow->NumVRFCond) {
4630 0 : ShowSevereError(state,
4631 0 : format("The number of AirConditioner:VariableRefrigerantFlow objects ({}) does not match the number of "
4632 : "ZoneTerminalUnitList objects ({}).",
4633 0 : state.dataHVACVarRefFlow->NumVRFCond,
4634 0 : state.dataHVACVarRefFlow->NumVRFTULists));
4635 0 : for (int NumCond = 1; NumCond <= state.dataHVACVarRefFlow->NumVRFCond; ++NumCond) {
4636 0 : if (state.dataHVACVarRefFlow->VRF(NumCond).ZoneTUListPtr > 0) {
4637 0 : ShowContinueError(state,
4638 0 : format("...AirConditioner:VariableRefrigerantFlow = {} specifies Zone Terminal Unit List Name = {}",
4639 0 : state.dataHVACVarRefFlow->VRF(NumCond).Name,
4640 0 : state.dataHVACVarRefFlow->TerminalUnitList(state.dataHVACVarRefFlow->VRF(NumCond).ZoneTUListPtr).Name));
4641 : } else {
4642 0 : ShowContinueError(state,
4643 0 : format("...AirConditioner:VariableRefrigerantFlow = {} Zone Terminal Unit List Name not found.",
4644 0 : state.dataHVACVarRefFlow->VRF(NumCond).Name));
4645 : }
4646 : }
4647 0 : ShowContinueError(state, "...listing ZoneTerminalUnitList objects.");
4648 0 : for (int NumList = 1; NumList <= state.dataHVACVarRefFlow->NumVRFTULists; ++NumList) {
4649 0 : ShowContinueError(state, "...ZoneTerminalUnitList = " + state.dataHVACVarRefFlow->TerminalUnitList(NumList).Name);
4650 : }
4651 0 : ErrorsFound = true;
4652 : }
4653 :
4654 : // Set up output variables
4655 75 : for (int VRFTUNum = 1; VRFTUNum <= state.dataHVACVarRefFlow->NumVRFTU; ++VRFTUNum) {
4656 62 : auto &thisVrfTU = state.dataHVACVarRefFlow->VRFTU(VRFTUNum);
4657 62 : if (thisVrfTU.CoolingCoilPresent) {
4658 124 : SetupOutputVariable(state,
4659 : "Zone VRF Air Terminal Cooling Electricity Rate",
4660 : Constant::Units::W,
4661 62 : thisVrfTU.ParasiticCoolElecPower,
4662 : OutputProcessor::TimeStepType::System,
4663 : OutputProcessor::StoreType::Average,
4664 62 : thisVrfTU.Name);
4665 124 : SetupOutputVariable(state,
4666 : "Zone VRF Air Terminal Cooling Electricity Energy",
4667 : Constant::Units::J,
4668 62 : thisVrfTU.ParasiticElecCoolConsumption,
4669 : OutputProcessor::TimeStepType::System,
4670 : OutputProcessor::StoreType::Sum,
4671 62 : thisVrfTU.Name,
4672 : Constant::eResource::Electricity,
4673 : OutputProcessor::Group::HVAC,
4674 : OutputProcessor::EndUseCat::Cooling);
4675 124 : SetupOutputVariable(state,
4676 : "Zone VRF Air Terminal Total Cooling Rate",
4677 : Constant::Units::W,
4678 62 : thisVrfTU.TotalCoolingRate,
4679 : OutputProcessor::TimeStepType::System,
4680 : OutputProcessor::StoreType::Average,
4681 62 : thisVrfTU.Name);
4682 124 : SetupOutputVariable(state,
4683 : "Zone VRF Air Terminal Sensible Cooling Rate",
4684 : Constant::Units::W,
4685 62 : thisVrfTU.SensibleCoolingRate,
4686 : OutputProcessor::TimeStepType::System,
4687 : OutputProcessor::StoreType::Average,
4688 62 : thisVrfTU.Name);
4689 124 : SetupOutputVariable(state,
4690 : "Zone VRF Air Terminal Latent Cooling Rate",
4691 : Constant::Units::W,
4692 62 : thisVrfTU.LatentCoolingRate,
4693 : OutputProcessor::TimeStepType::System,
4694 : OutputProcessor::StoreType::Average,
4695 62 : thisVrfTU.Name);
4696 124 : SetupOutputVariable(state,
4697 : "Zone VRF Air Terminal Total Cooling Energy",
4698 : Constant::Units::J,
4699 62 : thisVrfTU.TotalCoolingEnergy,
4700 : OutputProcessor::TimeStepType::System,
4701 : OutputProcessor::StoreType::Sum,
4702 62 : thisVrfTU.Name);
4703 124 : SetupOutputVariable(state,
4704 : "Zone VRF Air Terminal Sensible Cooling Energy",
4705 : Constant::Units::J,
4706 62 : thisVrfTU.SensibleCoolingEnergy,
4707 : OutputProcessor::TimeStepType::System,
4708 : OutputProcessor::StoreType::Sum,
4709 62 : thisVrfTU.Name);
4710 124 : SetupOutputVariable(state,
4711 : "Zone VRF Air Terminal Latent Cooling Energy",
4712 : Constant::Units::J,
4713 62 : thisVrfTU.LatentCoolingEnergy,
4714 : OutputProcessor::TimeStepType::System,
4715 : OutputProcessor::StoreType::Sum,
4716 62 : thisVrfTU.Name);
4717 : }
4718 62 : if (thisVrfTU.HeatingCoilPresent) {
4719 124 : SetupOutputVariable(state,
4720 : "Zone VRF Air Terminal Heating Electricity Rate",
4721 : Constant::Units::W,
4722 62 : thisVrfTU.ParasiticHeatElecPower,
4723 : OutputProcessor::TimeStepType::System,
4724 : OutputProcessor::StoreType::Average,
4725 62 : thisVrfTU.Name);
4726 124 : SetupOutputVariable(state,
4727 : "Zone VRF Air Terminal Heating Electricity Energy",
4728 : Constant::Units::J,
4729 62 : thisVrfTU.ParasiticElecHeatConsumption,
4730 : OutputProcessor::TimeStepType::System,
4731 : OutputProcessor::StoreType::Sum,
4732 62 : thisVrfTU.Name,
4733 : Constant::eResource::Electricity,
4734 : OutputProcessor::Group::HVAC,
4735 : OutputProcessor::EndUseCat::Heating);
4736 124 : SetupOutputVariable(state,
4737 : "Zone VRF Air Terminal Total Heating Rate",
4738 : Constant::Units::W,
4739 62 : thisVrfTU.TotalHeatingRate,
4740 : OutputProcessor::TimeStepType::System,
4741 : OutputProcessor::StoreType::Average,
4742 62 : thisVrfTU.Name);
4743 124 : SetupOutputVariable(state,
4744 : "Zone VRF Air Terminal Sensible Heating Rate",
4745 : Constant::Units::W,
4746 62 : thisVrfTU.SensibleHeatingRate,
4747 : OutputProcessor::TimeStepType::System,
4748 : OutputProcessor::StoreType::Average,
4749 62 : thisVrfTU.Name);
4750 124 : SetupOutputVariable(state,
4751 : "Zone VRF Air Terminal Latent Heating Rate",
4752 : Constant::Units::W,
4753 62 : thisVrfTU.LatentHeatingRate,
4754 : OutputProcessor::TimeStepType::System,
4755 : OutputProcessor::StoreType::Average,
4756 62 : thisVrfTU.Name);
4757 124 : SetupOutputVariable(state,
4758 : "Zone VRF Air Terminal Total Heating Energy",
4759 : Constant::Units::J,
4760 62 : thisVrfTU.TotalHeatingEnergy,
4761 : OutputProcessor::TimeStepType::System,
4762 : OutputProcessor::StoreType::Sum,
4763 62 : thisVrfTU.Name);
4764 124 : SetupOutputVariable(state,
4765 : "Zone VRF Air Terminal Sensible Heating Energy",
4766 : Constant::Units::J,
4767 62 : thisVrfTU.SensibleHeatingEnergy,
4768 : OutputProcessor::TimeStepType::System,
4769 : OutputProcessor::StoreType::Sum,
4770 62 : thisVrfTU.Name);
4771 124 : SetupOutputVariable(state,
4772 : "Zone VRF Air Terminal Latent Heating Energy",
4773 : Constant::Units::J,
4774 62 : thisVrfTU.LatentHeatingEnergy,
4775 : OutputProcessor::TimeStepType::System,
4776 : OutputProcessor::StoreType::Sum,
4777 62 : thisVrfTU.Name);
4778 : }
4779 62 : SetupOutputVariable(state,
4780 : "Zone VRF Air Terminal Fan Availability Status",
4781 : Constant::Units::None,
4782 62 : (int &)thisVrfTU.availStatus,
4783 : OutputProcessor::TimeStepType::System,
4784 : OutputProcessor::StoreType::Average,
4785 62 : thisVrfTU.Name);
4786 62 : if (state.dataGlobal->AnyEnergyManagementSystemInModel) {
4787 0 : SetupEMSActuator(state,
4788 : "Variable Refrigerant Flow Terminal Unit",
4789 : thisVrfTU.Name,
4790 : "Part Load Ratio",
4791 : "[fraction]",
4792 0 : thisVrfTU.EMSOverridePartLoadFrac,
4793 0 : thisVrfTU.EMSValueForPartLoadFrac);
4794 : }
4795 62 : if (thisVrfTU.NumOfSpeedCooling > 1 || thisVrfTU.NumOfSpeedHeating > 1) {
4796 4 : SetupOutputVariable(state,
4797 : "Zone VRF Air Terminal Multispeed Fan Cycling Ratio",
4798 : Constant::Units::None,
4799 2 : thisVrfTU.CycRatio,
4800 : OutputProcessor::TimeStepType::System,
4801 : OutputProcessor::StoreType::Average,
4802 2 : thisVrfTU.Name);
4803 4 : SetupOutputVariable(state,
4804 : "Zone VRF Air Terminal Multispeed Fan Speed Ratio",
4805 : Constant::Units::None,
4806 2 : thisVrfTU.SpeedRatio,
4807 : OutputProcessor::TimeStepType::System,
4808 : OutputProcessor::StoreType::Average,
4809 2 : thisVrfTU.Name);
4810 2 : SetupOutputVariable(state,
4811 : "Zone VRF Air Terminal Multispeed Fan Speed Level",
4812 : Constant::Units::None,
4813 2 : thisVrfTU.SpeedNum,
4814 : OutputProcessor::TimeStepType::System,
4815 : OutputProcessor::StoreType::Average,
4816 2 : thisVrfTU.Name);
4817 : }
4818 : }
4819 :
4820 27 : for (int NumCond = 1; NumCond <= state.dataHVACVarRefFlow->NumVRFCond; ++NumCond) {
4821 14 : auto &thisVrf = state.dataHVACVarRefFlow->VRF(NumCond);
4822 14 : std::string_view const sFuelType = Constant::eFuelNames[static_cast<int>(thisVrf.fuel)];
4823 28 : SetupOutputVariable(state,
4824 : "VRF Heat Pump Total Cooling Rate",
4825 : Constant::Units::W,
4826 14 : thisVrf.TotalCoolingCapacity,
4827 : OutputProcessor::TimeStepType::System,
4828 : OutputProcessor::StoreType::Average,
4829 14 : thisVrf.Name);
4830 28 : SetupOutputVariable(state,
4831 : "VRF Heat Pump Total Heating Rate",
4832 : Constant::Units::W,
4833 14 : thisVrf.TotalHeatingCapacity,
4834 : OutputProcessor::TimeStepType::System,
4835 : OutputProcessor::StoreType::Average,
4836 14 : thisVrf.Name);
4837 42 : SetupOutputVariable(state,
4838 28 : format("VRF Heat Pump Cooling {} Rate", sFuelType),
4839 : Constant::Units::W,
4840 14 : thisVrf.ElecCoolingPower,
4841 : OutputProcessor::TimeStepType::System,
4842 : OutputProcessor::StoreType::Average,
4843 14 : thisVrf.Name);
4844 42 : SetupOutputVariable(state,
4845 28 : format("VRF Heat Pump Cooling {} Energy", sFuelType),
4846 : Constant::Units::J,
4847 14 : thisVrf.CoolElecConsumption,
4848 : OutputProcessor::TimeStepType::System,
4849 : OutputProcessor::StoreType::Sum,
4850 14 : thisVrf.Name,
4851 14 : Constant::eFuel2eResource[(int)thisVrf.fuel],
4852 : OutputProcessor::Group::HVAC,
4853 : OutputProcessor::EndUseCat::Cooling);
4854 42 : SetupOutputVariable(state,
4855 28 : format("VRF Heat Pump Heating {} Rate", sFuelType),
4856 : Constant::Units::W,
4857 14 : thisVrf.ElecHeatingPower,
4858 : OutputProcessor::TimeStepType::System,
4859 : OutputProcessor::StoreType::Average,
4860 14 : thisVrf.Name);
4861 42 : SetupOutputVariable(state,
4862 28 : format("VRF Heat Pump Heating {} Energy", sFuelType),
4863 : Constant::Units::J,
4864 14 : thisVrf.HeatElecConsumption,
4865 : OutputProcessor::TimeStepType::System,
4866 : OutputProcessor::StoreType::Sum,
4867 14 : thisVrf.Name,
4868 14 : Constant::eFuel2eResource[(int)thisVrf.fuel],
4869 : OutputProcessor::Group::HVAC,
4870 : OutputProcessor::EndUseCat::Heating);
4871 :
4872 28 : SetupOutputVariable(state,
4873 : "VRF Heat Pump Cooling COP",
4874 : Constant::Units::None,
4875 14 : thisVrf.OperatingCoolingCOP,
4876 : OutputProcessor::TimeStepType::System,
4877 : OutputProcessor::StoreType::Average,
4878 14 : thisVrf.Name);
4879 28 : SetupOutputVariable(state,
4880 : "VRF Heat Pump Heating COP",
4881 : Constant::Units::None,
4882 14 : thisVrf.OperatingHeatingCOP,
4883 : OutputProcessor::TimeStepType::System,
4884 : OutputProcessor::StoreType::Average,
4885 14 : thisVrf.Name);
4886 28 : SetupOutputVariable(state,
4887 : "VRF Heat Pump COP",
4888 : Constant::Units::None,
4889 14 : thisVrf.OperatingCOP,
4890 : OutputProcessor::TimeStepType::System,
4891 : OutputProcessor::StoreType::Average,
4892 14 : thisVrf.Name);
4893 :
4894 14 : if (thisVrf.VRFAlgorithmType == AlgorithmType::FluidTCtrl) {
4895 : // For VRF_FluidTCtrl Model
4896 8 : SetupOutputVariable(state,
4897 : "VRF Heat Pump Compressor Electricity Rate",
4898 : Constant::Units::W,
4899 4 : thisVrf.Ncomp,
4900 : OutputProcessor::TimeStepType::System,
4901 : OutputProcessor::StoreType::Average,
4902 4 : thisVrf.Name);
4903 8 : SetupOutputVariable(state,
4904 : "VRF Heat Pump Outdoor Unit Fan Power",
4905 : Constant::Units::W,
4906 4 : thisVrf.OUFanPower,
4907 : OutputProcessor::TimeStepType::System,
4908 : OutputProcessor::StoreType::Average,
4909 4 : thisVrf.Name);
4910 8 : SetupOutputVariable(state,
4911 : "VRF Heat Pump Compressor Rotating Speed",
4912 : Constant::Units::rev_min,
4913 4 : thisVrf.CompActSpeed,
4914 : OutputProcessor::TimeStepType::System,
4915 : OutputProcessor::StoreType::Average,
4916 4 : thisVrf.Name);
4917 8 : SetupOutputVariable(state,
4918 : "VRF Heat Pump Indoor Unit Evaporating Temperature",
4919 : Constant::Units::C,
4920 4 : thisVrf.IUEvaporatingTemp,
4921 : OutputProcessor::TimeStepType::System,
4922 : OutputProcessor::StoreType::Average,
4923 4 : thisVrf.Name);
4924 8 : SetupOutputVariable(state,
4925 : "VRF Heat Pump Outdoor Unit Condensing Temperature",
4926 : Constant::Units::C,
4927 4 : thisVrf.CondensingTemp,
4928 : OutputProcessor::TimeStepType::System,
4929 : OutputProcessor::StoreType::Average,
4930 4 : thisVrf.Name);
4931 8 : SetupOutputVariable(state,
4932 : "VRF Heat Pump Indoor Unit Condensing Temperature",
4933 : Constant::Units::C,
4934 4 : thisVrf.IUCondensingTemp,
4935 : OutputProcessor::TimeStepType::System,
4936 : OutputProcessor::StoreType::Average,
4937 4 : thisVrf.Name);
4938 8 : SetupOutputVariable(state,
4939 : "VRF Heat Pump Outdoor Unit Evaporating Temperature",
4940 : Constant::Units::C,
4941 4 : thisVrf.EvaporatingTemp,
4942 : OutputProcessor::TimeStepType::System,
4943 : OutputProcessor::StoreType::Average,
4944 4 : thisVrf.Name);
4945 8 : SetupOutputVariable(state,
4946 : "VRF Heat Pump Cooling Capacity at Max Compressor Speed",
4947 : Constant::Units::W,
4948 4 : thisVrf.CoolingCapacity,
4949 : OutputProcessor::TimeStepType::System,
4950 : OutputProcessor::StoreType::Average,
4951 4 : thisVrf.Name);
4952 8 : SetupOutputVariable(state,
4953 : "VRF Heat Pump Heating Capacity at Max Compressor Speed",
4954 : Constant::Units::W,
4955 4 : thisVrf.HeatingCapacity,
4956 : OutputProcessor::TimeStepType::System,
4957 : OutputProcessor::StoreType::Average,
4958 4 : thisVrf.Name);
4959 8 : SetupOutputVariable(state,
4960 : "VRF Heat Pump Indoor Unit Piping Correction for Cooling",
4961 : Constant::Units::None,
4962 4 : thisVrf.PipingCorrectionCooling,
4963 : OutputProcessor::TimeStepType::System,
4964 : OutputProcessor::StoreType::Average,
4965 4 : thisVrf.Name);
4966 8 : SetupOutputVariable(state,
4967 : "VRF Heat Pump Indoor Unit Piping Correction for Heating",
4968 : Constant::Units::None,
4969 4 : thisVrf.PipingCorrectionHeating,
4970 : OutputProcessor::TimeStepType::System,
4971 : OutputProcessor::StoreType::Average,
4972 4 : thisVrf.Name);
4973 8 : SetupOutputVariable(state,
4974 : "VRF Heat Pump Outdoor Unit Evaporator Heat Extract Rate",
4975 : Constant::Units::W,
4976 4 : thisVrf.OUEvapHeatRate,
4977 : OutputProcessor::TimeStepType::System,
4978 : OutputProcessor::StoreType::Average,
4979 4 : thisVrf.Name);
4980 8 : SetupOutputVariable(state,
4981 : "VRF Heat Pump Outdoor Unit Condenser Heat Release Rate",
4982 : Constant::Units::W,
4983 4 : thisVrf.OUCondHeatRate,
4984 : OutputProcessor::TimeStepType::System,
4985 : OutputProcessor::StoreType::Average,
4986 4 : thisVrf.Name);
4987 :
4988 : } else {
4989 : // For VRF_SysCurve Model
4990 20 : SetupOutputVariable(state,
4991 : "VRF Heat Pump Maximum Capacity Cooling Rate",
4992 : Constant::Units::W,
4993 10 : state.dataHVACVarRefFlow->MaxCoolingCapacity(NumCond),
4994 : OutputProcessor::TimeStepType::System,
4995 : OutputProcessor::StoreType::Average,
4996 10 : thisVrf.Name);
4997 20 : SetupOutputVariable(state,
4998 : "VRF Heat Pump Maximum Capacity Heating Rate",
4999 : Constant::Units::W,
5000 10 : state.dataHVACVarRefFlow->MaxHeatingCapacity(NumCond),
5001 : OutputProcessor::TimeStepType::System,
5002 : OutputProcessor::StoreType::Average,
5003 10 : thisVrf.Name);
5004 : }
5005 :
5006 14 : if (thisVrf.DefrostStrategy == StandardRatings::DefrostStrat::Resistive ||
5007 4 : (thisVrf.DefrostStrategy == StandardRatings::DefrostStrat::ReverseCycle && thisVrf.fuel == Constant::eFuel::Electricity)) {
5008 28 : SetupOutputVariable(state,
5009 : "VRF Heat Pump Defrost Electricity Rate",
5010 : Constant::Units::W,
5011 14 : thisVrf.DefrostPower,
5012 : OutputProcessor::TimeStepType::System,
5013 : OutputProcessor::StoreType::Average,
5014 14 : thisVrf.Name);
5015 28 : SetupOutputVariable(state,
5016 : "VRF Heat Pump Defrost Electricity Energy",
5017 : Constant::Units::J,
5018 14 : thisVrf.DefrostConsumption,
5019 : OutputProcessor::TimeStepType::System,
5020 : OutputProcessor::StoreType::Sum,
5021 14 : thisVrf.Name,
5022 : Constant::eResource::Electricity,
5023 : OutputProcessor::Group::HVAC,
5024 : OutputProcessor::EndUseCat::Heating);
5025 :
5026 : } else { // defrost energy applied to fuel type
5027 0 : SetupOutputVariable(state,
5028 0 : format("VRF Heat Pump Defrost {} Rate", sFuelType),
5029 : Constant::Units::W,
5030 0 : thisVrf.DefrostPower,
5031 : OutputProcessor::TimeStepType::System,
5032 : OutputProcessor::StoreType::Average,
5033 0 : thisVrf.Name);
5034 0 : SetupOutputVariable(state,
5035 0 : format("VRF Heat Pump Defrost {} Energy", sFuelType),
5036 : Constant::Units::J,
5037 0 : thisVrf.DefrostConsumption,
5038 : OutputProcessor::TimeStepType::System,
5039 : OutputProcessor::StoreType::Sum,
5040 0 : thisVrf.Name,
5041 0 : Constant::eFuel2eResource[(int)thisVrf.fuel],
5042 : OutputProcessor::Group::HVAC,
5043 : OutputProcessor::EndUseCat::Heating);
5044 : }
5045 :
5046 28 : SetupOutputVariable(state,
5047 : "VRF Heat Pump Part Load Ratio",
5048 : Constant::Units::None,
5049 14 : thisVrf.VRFCondPLR,
5050 : OutputProcessor::TimeStepType::System,
5051 : OutputProcessor::StoreType::Average,
5052 14 : thisVrf.Name);
5053 28 : SetupOutputVariable(state,
5054 : "VRF Heat Pump Runtime Fraction",
5055 : Constant::Units::None,
5056 14 : thisVrf.VRFCondRTF,
5057 : OutputProcessor::TimeStepType::System,
5058 : OutputProcessor::StoreType::Average,
5059 14 : thisVrf.Name);
5060 28 : SetupOutputVariable(state,
5061 : "VRF Heat Pump Cycling Ratio",
5062 : Constant::Units::None,
5063 14 : thisVrf.VRFCondCyclingRatio,
5064 : OutputProcessor::TimeStepType::System,
5065 : OutputProcessor::StoreType::Average,
5066 14 : thisVrf.Name);
5067 :
5068 14 : SetupOutputVariable(state,
5069 : "VRF Heat Pump Operating Mode",
5070 : Constant::Units::None,
5071 14 : thisVrf.OperatingMode,
5072 : OutputProcessor::TimeStepType::System,
5073 : OutputProcessor::StoreType::Average,
5074 14 : thisVrf.Name);
5075 28 : SetupOutputVariable(state,
5076 : "VRF Heat Pump Condenser Inlet Temperature",
5077 : Constant::Units::C,
5078 14 : thisVrf.CondenserInletTemp,
5079 : OutputProcessor::TimeStepType::System,
5080 : OutputProcessor::StoreType::Average,
5081 14 : thisVrf.Name);
5082 :
5083 28 : SetupOutputVariable(state,
5084 : "VRF Heat Pump Crankcase Heater Electricity Rate",
5085 : Constant::Units::W,
5086 14 : thisVrf.CrankCaseHeaterPower,
5087 : OutputProcessor::TimeStepType::System,
5088 : OutputProcessor::StoreType::Average,
5089 14 : thisVrf.Name);
5090 28 : SetupOutputVariable(state,
5091 : "VRF Heat Pump Crankcase Heater Electricity Energy",
5092 : Constant::Units::J,
5093 14 : thisVrf.CrankCaseHeaterElecConsumption,
5094 : OutputProcessor::TimeStepType::System,
5095 : OutputProcessor::StoreType::Sum,
5096 14 : thisVrf.Name,
5097 : Constant::eResource::Electricity,
5098 : OutputProcessor::Group::HVAC,
5099 : OutputProcessor::EndUseCat::Cooling);
5100 28 : SetupOutputVariable(state,
5101 : "VRF Heat Pump Terminal Unit Cooling Load Rate",
5102 : Constant::Units::W,
5103 14 : thisVrf.TUCoolingLoad,
5104 : OutputProcessor::TimeStepType::System,
5105 : OutputProcessor::StoreType::Average,
5106 14 : thisVrf.Name);
5107 28 : SetupOutputVariable(state,
5108 : "VRF Heat Pump Terminal Unit Heating Load Rate",
5109 : Constant::Units::W,
5110 14 : thisVrf.TUHeatingLoad,
5111 : OutputProcessor::TimeStepType::System,
5112 : OutputProcessor::StoreType::Average,
5113 14 : thisVrf.Name);
5114 14 : if (thisVrf.HeatRecoveryUsed) {
5115 4 : SetupOutputVariable(state,
5116 : "VRF Heat Pump Heat Recovery Status Change Multiplier",
5117 : Constant::Units::None,
5118 2 : thisVrf.SUMultiplier,
5119 : OutputProcessor::TimeStepType::System,
5120 : OutputProcessor::StoreType::Average,
5121 2 : thisVrf.Name);
5122 4 : SetupOutputVariable(state,
5123 : "VRF Heat Pump Simultaneous Cooling and Heating Efficiency",
5124 : Constant::Units::Btu_h_W,
5125 2 : thisVrf.SCHE,
5126 : OutputProcessor::TimeStepType::System,
5127 : OutputProcessor::StoreType::Average,
5128 2 : thisVrf.Name);
5129 4 : SetupOutputVariable(state,
5130 : "VRF Heat Pump Heat Recovery Rate",
5131 : Constant::Units::W,
5132 2 : thisVrf.VRFHeatRec,
5133 : OutputProcessor::TimeStepType::System,
5134 : OutputProcessor::StoreType::Average,
5135 2 : thisVrf.Name);
5136 4 : SetupOutputVariable(state,
5137 : "VRF Heat Pump Heat Recovery Energy",
5138 : Constant::Units::J,
5139 2 : thisVrf.VRFHeatEnergyRec,
5140 : OutputProcessor::TimeStepType::System,
5141 : OutputProcessor::StoreType::Sum,
5142 2 : thisVrf.Name,
5143 : Constant::eResource::EnergyTransfer,
5144 : OutputProcessor::Group::Plant,
5145 : OutputProcessor::EndUseCat::HeatRecovery);
5146 : }
5147 :
5148 14 : if (thisVrf.CondenserType == DataHeatBalance::RefrigCondenserType::Evap) {
5149 0 : SetupOutputVariable(state,
5150 : "VRF Heat Pump Evaporative Condenser Water Use Volume",
5151 : Constant::Units::m3,
5152 0 : thisVrf.EvapWaterConsumpRate,
5153 : OutputProcessor::TimeStepType::System,
5154 : OutputProcessor::StoreType::Sum,
5155 0 : thisVrf.Name,
5156 : Constant::eResource::Water,
5157 : OutputProcessor::Group::HVAC,
5158 : OutputProcessor::EndUseCat::Cooling);
5159 0 : SetupOutputVariable(state,
5160 : "VRF Heat Pump Evaporative Condenser Pump Electricity Rate",
5161 : Constant::Units::W,
5162 0 : thisVrf.EvapCondPumpElecPower,
5163 : OutputProcessor::TimeStepType::System,
5164 : OutputProcessor::StoreType::Average,
5165 0 : thisVrf.Name);
5166 0 : SetupOutputVariable(state,
5167 : "VRF Heat Pump Evaporative Condenser Pump Electricity Energy",
5168 : Constant::Units::J,
5169 0 : thisVrf.EvapCondPumpElecConsumption,
5170 : OutputProcessor::TimeStepType::System,
5171 : OutputProcessor::StoreType::Sum,
5172 0 : thisVrf.Name,
5173 : Constant::eResource::Electricity,
5174 : OutputProcessor::Group::HVAC,
5175 : OutputProcessor::EndUseCat::Cooling);
5176 :
5177 0 : if (thisVrf.BasinHeaterPowerFTempDiff > 0.0) {
5178 0 : SetupOutputVariable(state,
5179 : "VRF Heat Pump Basin Heater Electricity Rate",
5180 : Constant::Units::W,
5181 0 : thisVrf.BasinHeaterPower,
5182 : OutputProcessor::TimeStepType::System,
5183 : OutputProcessor::StoreType::Average,
5184 0 : thisVrf.Name);
5185 0 : SetupOutputVariable(state,
5186 : "VRF Heat Pump Basin Heater Electricity Energy",
5187 : Constant::Units::J,
5188 0 : thisVrf.BasinHeaterConsumption,
5189 : OutputProcessor::TimeStepType::System,
5190 : OutputProcessor::StoreType::Sum,
5191 0 : thisVrf.Name,
5192 : Constant::eResource::Electricity,
5193 : OutputProcessor::Group::HVAC,
5194 : OutputProcessor::EndUseCat::Cooling);
5195 : }
5196 :
5197 14 : } else if (thisVrf.CondenserType == DataHeatBalance::RefrigCondenserType::Water) {
5198 2 : SetupOutputVariable(state,
5199 : "VRF Heat Pump Condenser Outlet Temperature",
5200 : Constant::Units::C,
5201 1 : thisVrf.CondenserSideOutletTemp,
5202 : OutputProcessor::TimeStepType::System,
5203 : OutputProcessor::StoreType::Average,
5204 1 : thisVrf.Name);
5205 2 : SetupOutputVariable(state,
5206 : "VRF Heat Pump Condenser Mass Flow Rate",
5207 : Constant::Units::kg_s,
5208 1 : thisVrf.WaterCondenserMassFlow,
5209 : OutputProcessor::TimeStepType::System,
5210 : OutputProcessor::StoreType::Average,
5211 1 : thisVrf.Name);
5212 2 : SetupOutputVariable(state,
5213 : "VRF Heat Pump Condenser Heat Transfer Rate",
5214 : Constant::Units::W,
5215 1 : thisVrf.QCondenser,
5216 : OutputProcessor::TimeStepType::System,
5217 : OutputProcessor::StoreType::Average,
5218 1 : thisVrf.Name);
5219 2 : SetupOutputVariable(state,
5220 : "VRF Heat Pump Condenser Heat Transfer Energy",
5221 : Constant::Units::J,
5222 1 : thisVrf.QCondEnergy,
5223 : OutputProcessor::TimeStepType::System,
5224 : OutputProcessor::StoreType::Sum,
5225 1 : thisVrf.Name);
5226 : }
5227 :
5228 14 : if (state.dataGlobal->AnyEnergyManagementSystemInModel) {
5229 0 : SetupEMSActuator(state,
5230 : "Variable Refrigerant Flow Heat Pump",
5231 : thisVrf.Name,
5232 : "Operating Mode",
5233 : "[integer]",
5234 0 : thisVrf.EMSOverrideHPOperatingMode,
5235 0 : thisVrf.EMSValueForHPOperatingMode);
5236 : }
5237 : }
5238 13 : }
5239 :
5240 62 : void CheckVRFTUNodeConnections(EnergyPlusData &state, int const VRFTUNum, bool &ErrorsFound)
5241 : {
5242 :
5243 : constexpr static std::string_view cTerminalUnitType("ZoneHVAC:TerminalUnit:VariableRefrigerantFlow");
5244 62 : auto const &nodeID = state.dataLoopNodes->NodeID;
5245 62 : auto &vrfTU = state.dataHVACVarRefFlow->VRFTU(VRFTUNum);
5246 62 : std::string const cTUName(vrfTU.Name);
5247 62 : bool const CoolingCoilPresent = vrfTU.CoolingCoilPresent;
5248 62 : bool const HeatingCoilPresent = vrfTU.HeatingCoilPresent;
5249 62 : bool const SuppHeatingCoilPresent = vrfTU.SuppHeatingCoilPresent;
5250 62 : HVAC::FanPlace const fanPlace = vrfTU.fanPlace;
5251 62 : bool const FanPresent = fanPlace != HVAC::FanPlace::Invalid;
5252 62 : bool const OAMixerUsed = vrfTU.OAMixerUsed;
5253 62 : int const VRFTUInletNodeNum = vrfTU.VRFTUInletNodeNum;
5254 62 : int const VRFTUOutletNodeNum = vrfTU.VRFTUOutletNodeNum;
5255 62 : int const coolCoilAirInNode = vrfTU.coolCoilAirInNode;
5256 62 : int const coolCoilAirOutNode = vrfTU.coolCoilAirOutNode;
5257 62 : int const heatCoilAirInNode = vrfTU.heatCoilAirInNode;
5258 62 : int const heatCoilAirOutNode = vrfTU.heatCoilAirOutNode;
5259 62 : int const fanInletNode = vrfTU.fanInletNode;
5260 62 : int const fanOutletNode = vrfTU.fanOutletNode;
5261 62 : int const SuppHeatCoilAirInletNode = vrfTU.SuppHeatCoilAirInletNode;
5262 62 : int const SuppHeatCoilAirOutletNode = vrfTU.SuppHeatCoilAirOutletNode;
5263 62 : int const VRFTUOAMixerRetNodeNum = vrfTU.VRFTUOAMixerRetNodeNum;
5264 62 : int const VRFTUOAMixerMixedNodeNum = vrfTU.VRFTUOAMixerMixedNodeNum;
5265 :
5266 : // check that TU object internal nodes (TU inlet to TU outlet) are correctly connected
5267 : // the following is checked regardless of fan placement
5268 62 : if (CoolingCoilPresent && HeatingCoilPresent) {
5269 62 : if (coolCoilAirOutNode != heatCoilAirInNode) {
5270 0 : ShowSevereError(state, fmt::format("{}=\"{}\",", cTerminalUnitType, cTUName));
5271 0 : ShowContinueError(state, "The cooling coil air outlet node name must match the heating coil air inlet node name.");
5272 0 : if (coolCoilAirOutNode > 0 && heatCoilAirInNode > 0) {
5273 0 : ShowContinueError(state, format("... Cooling coil air outlet node = {}", nodeID(coolCoilAirOutNode)));
5274 0 : ShowContinueError(state, format("... Heating coil air inlet node = {}", nodeID(heatCoilAirInNode)));
5275 : }
5276 0 : ErrorsFound = true;
5277 : }
5278 : }
5279 :
5280 : // check the TU inlet node name with the first component
5281 62 : if (fanPlace == HVAC::FanPlace::DrawThru || !FanPresent) {
5282 57 : if (OAMixerUsed) {
5283 46 : if (VRFTUInletNodeNum != VRFTUOAMixerRetNodeNum) {
5284 0 : ShowSevereError(state, fmt::format("{}=\"{}\",", cTerminalUnitType, cTUName));
5285 0 : ShowContinueError(state,
5286 : "... For draw thru or no fan when an OA mixer is specified the terminal unit "
5287 : "inlet node name must match the OA mixer return air stream node name.");
5288 0 : if (VRFTUInletNodeNum > 0 && VRFTUOAMixerRetNodeNum > 0) {
5289 0 : ShowContinueError(state, format("... Terminal unit inlet node name = {}.", nodeID(VRFTUInletNodeNum)));
5290 0 : ShowContinueError(state, format("... OA mixer return air stream node name = {}.", nodeID(VRFTUOAMixerRetNodeNum)));
5291 : }
5292 0 : ErrorsFound = true;
5293 : }
5294 : // check mixer outlet with next component
5295 46 : if (CoolingCoilPresent) {
5296 46 : if (VRFTUOAMixerMixedNodeNum != coolCoilAirInNode) {
5297 0 : ShowSevereError(state, fmt::format("{}=\"{}\",", cTerminalUnitType, cTUName));
5298 0 : ShowContinueError(state,
5299 : "... For draw thru or no fan when an OA mixer is specified and a cooling coil is present "
5300 : "the OA mixer mixed air node name must match the cooling coil inlet node name.");
5301 0 : if (VRFTUOAMixerMixedNodeNum > 0 && coolCoilAirInNode > 0) {
5302 0 : ShowContinueError(state, format("... OA mixer mixed air node name = {}.", nodeID(VRFTUOAMixerMixedNodeNum)));
5303 0 : ShowContinueError(state, format("... Cooling coil inlet node name = {}.", nodeID(coolCoilAirInNode)));
5304 : }
5305 0 : ErrorsFound = true;
5306 : }
5307 0 : } else if (HeatingCoilPresent) {
5308 0 : if (VRFTUOAMixerMixedNodeNum != heatCoilAirInNode) {
5309 0 : ShowSevereError(state, fmt::format("{}=\"{}\",", cTerminalUnitType, cTUName));
5310 0 : ShowContinueError(state,
5311 : "... For draw thru or no fan when an OA mixer is specified and a cooling coil is not present "
5312 : "the OA mixer mixed air node name must match the heating coil inlet node name.");
5313 0 : if (VRFTUOAMixerMixedNodeNum > 0 && heatCoilAirInNode > 0) {
5314 0 : ShowContinueError(state, format("... OA mixer mixed air node name = {}.", nodeID(VRFTUOAMixerMixedNodeNum)));
5315 0 : ShowContinueError(state, format("... Heating coil inlet node name = {}.", nodeID(heatCoilAirInNode)));
5316 : }
5317 0 : ErrorsFound = true;
5318 : }
5319 : }
5320 : } else { // OAMixer not used
5321 11 : if (CoolingCoilPresent) {
5322 11 : if (VRFTUInletNodeNum != coolCoilAirInNode) {
5323 0 : ShowSevereError(state, fmt::format("{}=\"{}\",", cTerminalUnitType, cTUName));
5324 0 : ShowContinueError(
5325 : state,
5326 : "... For draw thru or no fan when no OA mixer is specified and a cooling coil is present the terminal unit inlet "
5327 : "node name must match the cooling coil inlet node name.");
5328 0 : if (VRFTUInletNodeNum > 0 && coolCoilAirInNode > 0) {
5329 0 : ShowContinueError(state, format("... Terminal unit inlet node name = {}.", nodeID(VRFTUInletNodeNum)));
5330 0 : ShowContinueError(state, format("... Cooling coil inlet node name = {}.", nodeID(coolCoilAirInNode)));
5331 : }
5332 0 : ErrorsFound = true;
5333 : }
5334 0 : } else if (HeatingCoilPresent) {
5335 0 : if (VRFTUInletNodeNum != heatCoilAirInNode) {
5336 0 : ShowSevereError(state, fmt::format("{}=\"{}\",", cTerminalUnitType, cTUName));
5337 0 : ShowContinueError(state,
5338 : "... For draw thru or no fan when no cooling coil or OA mixer is specified the terminal unit inlet "
5339 : "node name must match the heating coil inlet node name.");
5340 0 : if (VRFTUInletNodeNum > 0 && heatCoilAirInNode > 0) {
5341 0 : ShowContinueError(state, format("... Terminal unit inlet node name = {}.", nodeID(VRFTUInletNodeNum)));
5342 0 : ShowContinueError(state, format("... Heating coil inlet node name = {}.", nodeID(heatCoilAirInNode)));
5343 : }
5344 0 : ErrorsFound = true;
5345 : }
5346 : }
5347 : }
5348 : }
5349 62 : if (fanPlace == HVAC::FanPlace::BlowThru && !OAMixerUsed) {
5350 0 : if (VRFTUInletNodeNum != fanInletNode) {
5351 0 : ShowSevereError(state, fmt::format("{}=\"{}\",", cTerminalUnitType, cTUName));
5352 0 : ShowContinueError(state,
5353 : "... For blow thru fan when no OA mixer is specified the terminal unit inlet "
5354 : "node name must match the fan inlet node name.");
5355 0 : if (VRFTUInletNodeNum > 0 && fanInletNode > 0) {
5356 0 : ShowContinueError(state, format("... Terminal unit inlet node name = {}.", nodeID(VRFTUInletNodeNum)));
5357 0 : ShowContinueError(state, format("... Fan inlet node name = {}.", nodeID(fanInletNode)));
5358 : }
5359 0 : ErrorsFound = true;
5360 : }
5361 62 : } else if (OAMixerUsed) { // when OA mixer is used TU inlet = OAMixer return node regardless of fan placement
5362 51 : if (VRFTUInletNodeNum != VRFTUOAMixerRetNodeNum) {
5363 0 : ShowSevereError(state, fmt::format("{}=\"{}\",", cTerminalUnitType, cTUName));
5364 0 : ShowContinueError(state,
5365 : "... When an OA mixer is specified the terminal unit inlet "
5366 : "node name must match the OA mixer return node name.");
5367 0 : if (VRFTUInletNodeNum > 0 && VRFTUOAMixerRetNodeNum > 0) {
5368 0 : ShowContinueError(state, format("... Terminal unit inlet node name = {}.", nodeID(VRFTUInletNodeNum)));
5369 0 : ShowContinueError(state, format("... Fan inlet node name = {}.", nodeID(VRFTUOAMixerRetNodeNum)));
5370 : }
5371 0 : ErrorsFound = true;
5372 : }
5373 : }
5374 : // check the next component
5375 62 : if (CoolingCoilPresent) {
5376 62 : if (fanPlace == HVAC::FanPlace::BlowThru) {
5377 5 : if (fanOutletNode != coolCoilAirInNode) {
5378 0 : ShowSevereError(state, fmt::format("{}=\"{}\",", cTerminalUnitType, cTUName));
5379 0 : ShowContinueError(state,
5380 : "... For blow thru fan when a cooling coil is present "
5381 : "fan outlet node name must match the cooling coil inlet node name.");
5382 0 : if (fanOutletNode > 0 && coolCoilAirInNode > 0) {
5383 0 : ShowContinueError(state, format("... The fan outlet node name = {}.", nodeID(fanOutletNode)));
5384 0 : ShowContinueError(state, format("... Cooling coil inlet node name = {}.", nodeID(coolCoilAirInNode)));
5385 : }
5386 0 : ErrorsFound = true;
5387 : }
5388 : }
5389 62 : if (!HeatingCoilPresent && fanPlace == HVAC::FanPlace::DrawThru) {
5390 0 : if (coolCoilAirOutNode != fanInletNode) {
5391 0 : ShowSevereError(state, fmt::format("{}=\"{}\",", cTerminalUnitType, cTUName));
5392 0 : ShowContinueError(state,
5393 : "... For draw thru fan when a heating coil is not present "
5394 : "the cooling coil outlet node name must match the fan inlet node name.");
5395 0 : if (coolCoilAirOutNode > 0 && fanInletNode > 0) {
5396 0 : ShowContinueError(state, format("... Cooling coil outlet node name = {}.", nodeID(coolCoilAirOutNode)));
5397 0 : ShowContinueError(state, format("... The fan inlet node name = {}.", nodeID(fanInletNode)));
5398 : }
5399 0 : ErrorsFound = true;
5400 : }
5401 : }
5402 : }
5403 62 : if (HeatingCoilPresent) {
5404 62 : if (fanPlace == HVAC::FanPlace::DrawThru) {
5405 56 : if (heatCoilAirOutNode != fanInletNode) {
5406 0 : ShowSevereError(state, fmt::format("{}=\"{}\",", cTerminalUnitType, cTUName));
5407 0 : ShowContinueError(state,
5408 : "... For draw thru fan when a heating coil is present "
5409 : "the heating coil outlet node name must match the fan inlet node name.");
5410 0 : if (heatCoilAirOutNode > 0 && fanInletNode > 0) {
5411 0 : ShowContinueError(state, format("... Heating coil outlet node name = {}.", nodeID(heatCoilAirOutNode)));
5412 0 : ShowContinueError(state, format("... The fan inlet node name = {}.", nodeID(fanInletNode)));
5413 : }
5414 0 : ErrorsFound = true;
5415 : }
5416 : }
5417 : }
5418 62 : if (SuppHeatingCoilPresent) {
5419 11 : if (SuppHeatCoilAirOutletNode != VRFTUOutletNodeNum) {
5420 0 : ShowSevereError(state, fmt::format("{}=\"{}\",", cTerminalUnitType, cTUName));
5421 0 : ShowContinueError(state, "... The supplemental heating coil outlet node name must match the terminal unit outlet node name.");
5422 0 : if (SuppHeatCoilAirOutletNode > 0 && VRFTUOutletNodeNum > 0) {
5423 0 : ShowContinueError(state, format("... Supplemental heating coil outlet node name = {}.", nodeID(SuppHeatCoilAirOutletNode)));
5424 0 : ShowContinueError(state, format("... Terminal unit outlet node name = {}.", nodeID(VRFTUOutletNodeNum)));
5425 : }
5426 0 : ErrorsFound = true;
5427 : }
5428 11 : if (fanPlace == HVAC::FanPlace::DrawThru) {
5429 11 : if (fanOutletNode != SuppHeatCoilAirInletNode) {
5430 0 : ShowSevereError(state, fmt::format("{}=\"{}\",", cTerminalUnitType, cTUName));
5431 0 : ShowContinueError(state,
5432 : "... For draw thru fan when a supplemental heating coil is present "
5433 : "the fan outlet node name must match the supplemental heating coil inlet node name.");
5434 0 : if (fanOutletNode > 0 && SuppHeatCoilAirInletNode > 0) {
5435 0 : ShowContinueError(state, format("... Fan outlet node name = {}.", nodeID(fanOutletNode)));
5436 0 : ShowContinueError(state, format("... Supplemental heating coil inlet node name = {}.", nodeID(SuppHeatCoilAirInletNode)));
5437 : }
5438 0 : ErrorsFound = true;
5439 : }
5440 : } else {
5441 0 : if (heatCoilAirOutNode != SuppHeatCoilAirInletNode) {
5442 0 : ShowSevereError(state, fmt::format("{}=\"{}\",", cTerminalUnitType, cTUName));
5443 0 : ShowContinueError(state,
5444 : "... For blow thru or no fan when a supplemental heating coil is present the heating "
5445 : "coil outlet node name must match the supplemental heating coil inlet node name.");
5446 0 : if (heatCoilAirOutNode > 0 && SuppHeatCoilAirInletNode > 0) {
5447 0 : ShowContinueError(state, format("... Heating coil outlet node name = {}.", nodeID(heatCoilAirOutNode)));
5448 0 : ShowContinueError(state, format("... Supplemental heating coil inlet node name = {}.", nodeID(SuppHeatCoilAirInletNode)));
5449 : }
5450 0 : ErrorsFound = true;
5451 : }
5452 : }
5453 51 : } else if (CoolingCoilPresent && !HeatingCoilPresent && (fanPlace == HVAC::FanPlace::BlowThru || !FanPresent)) {
5454 0 : if (coolCoilAirOutNode != VRFTUOutletNodeNum) {
5455 0 : ShowSevereError(state, fmt::format("{}=\"{}\",", cTerminalUnitType, cTUName));
5456 0 : ShowContinueError(state,
5457 : "... For blow through or no fan and no heating or supplemental heating coil the cooling coil outlet node name must "
5458 : "match the terminal unit outlet node name.");
5459 0 : if (coolCoilAirOutNode > 0 && VRFTUOutletNodeNum > 0) {
5460 0 : ShowContinueError(state, format("... Cooling coil outlet node name = {}.", nodeID(coolCoilAirOutNode)));
5461 0 : ShowContinueError(state, format("... Terminal unit outlet node name = {}.", nodeID(VRFTUOutletNodeNum)));
5462 : }
5463 0 : ErrorsFound = true;
5464 : }
5465 0 : if (fanPlace == HVAC::FanPlace::DrawThru) {
5466 0 : if (fanOutletNode != VRFTUOutletNodeNum) {
5467 0 : ShowSevereError(state, fmt::format("{}=\"{}\",", cTerminalUnitType, cTUName));
5468 0 : ShowContinueError(state,
5469 : "... For draw through fan and no supplemental heating coil the fan outlet node name must "
5470 : "match the terminal unit outlet node name.");
5471 0 : if (fanOutletNode > 0 && VRFTUOutletNodeNum > 0) {
5472 0 : ShowContinueError(state, format("... Fan outlet node name = {}.", nodeID(fanOutletNode)));
5473 0 : ShowContinueError(state, format("... Terminal unit outlet node name = {}.", nodeID(VRFTUOutletNodeNum)));
5474 : }
5475 0 : ErrorsFound = true;
5476 : }
5477 : }
5478 51 : } else if (fanPlace == HVAC::FanPlace::DrawThru) {
5479 45 : if (fanOutletNode != VRFTUOutletNodeNum) {
5480 0 : ShowSevereError(state, fmt::format("{}=\"{}\",", cTerminalUnitType, cTUName));
5481 0 : ShowContinueError(state,
5482 : "... For draw through fan and no supplemental heating coil the fan outlet node name must "
5483 : "match the terminal unit outlet node name.");
5484 0 : if (fanOutletNode > 0 && VRFTUOutletNodeNum > 0) {
5485 0 : ShowContinueError(state, format("... Fan outlet node name = {}.", nodeID(fanOutletNode)));
5486 0 : ShowContinueError(state, format("... Terminal unit outlet node name = {}.", nodeID(VRFTUOutletNodeNum)));
5487 : }
5488 0 : ErrorsFound = true;
5489 : }
5490 : }
5491 62 : }
5492 :
5493 250981 : void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool const FirstHVACIteration, Real64 &OnOffAirFlowRatio, Real64 &QZnReq)
5494 : {
5495 :
5496 : // SUBROUTINE INFORMATION:
5497 : // AUTHOR Richard Raustad, FSEC
5498 : // DATE WRITTEN August 2010
5499 : // MODIFIED July 2012, Chandan Sharma - FSEC: Added zone sys avail managers
5500 : // RE-ENGINEERED na
5501 :
5502 : // PURPOSE OF THIS SUBROUTINE:
5503 : // This subroutine is for initializations of the VRF Components.
5504 :
5505 : // METHODOLOGY EMPLOYED:
5506 : // Uses the status flags to trigger initializations.
5507 :
5508 : using DataSizing::AutoSize;
5509 : using DataZoneEquipment::CheckZoneEquipmentList;
5510 :
5511 : using PlantUtilities::InitComponentNodes;
5512 : using ScheduleManager::GetCurrentScheduleValue;
5513 : using SingleDuct::SimATMixer;
5514 :
5515 : static constexpr std::string_view RoutineName("InitVRF");
5516 :
5517 : int InNode; // TU inlet node
5518 : int OutNode; // TU outlet node
5519 : int OutsideAirNode; // TU mixer outside air inlet node
5520 : int NumTULoop; // loop counter, number of TU's in list
5521 : int ELLoop; // loop counter, number of zone equipment lists
5522 : int ListLoop; // loop counter, number of equipment is each list
5523 : int VRFCond; // index to VRF condenser
5524 : int TUIndex; // index to TU
5525 : int TUListNum; // index to VRF AC system terminal unit list
5526 : int TUListIndex; // pointer to TU list for this VRF system
5527 : int IndexToTUInTUList; // index to TU in TerminalUnilList
5528 : Real64 RhoAir; // air density at InNode
5529 : Real64 CurrentEndTime; // end time of current time step
5530 250981 : Real64 TimeStepSysLast(0.0); // system time step on last time step
5531 : Real64 TempOutput; // Sensible output of TU
5532 : Real64 LoadToCoolingSP; // thermostat load to cooling setpoint (W)
5533 : Real64 LoadToHeatingSP; // thermostat load to heating setpoint (W)
5534 : bool EnableSystem; // use to turn on secondary operating mode if OA temp limits exceeded
5535 : bool ErrorsFound; // flag returned from mining call
5536 : Real64 rho; // density of water (kg/m3)
5537 : Real64 OutsideDryBulbTemp; // Outdoor air temperature at external node height
5538 : bool errFlag; // local error flag
5539 : Real64 SuppHeatCoilLoad; // additional heating required by supplemental heater (W)
5540 : Real64 SuppHeatCoilCapacity; // supplemental heating coil size (W)
5541 :
5542 : // ALLOCATE and Initialize subroutine variables
5543 250981 : if (state.dataHVACVarRefFlow->MyOneTimeFlag) {
5544 :
5545 13 : state.dataHVACVarRefFlow->MyEnvrnFlag.allocate(state.dataHVACVarRefFlow->NumVRFTU);
5546 13 : state.dataHVACVarRefFlow->MySizeFlag.allocate(state.dataHVACVarRefFlow->NumVRFTU);
5547 13 : state.dataHVACVarRefFlow->MyVRFFlag.allocate(state.dataHVACVarRefFlow->NumVRFTU);
5548 13 : state.dataHVACVarRefFlow->MyZoneEqFlag.allocate(state.dataHVACVarRefFlow->NumVRFTU);
5549 13 : state.dataHVACVarRefFlow->MyBeginTimeStepFlag.allocate(state.dataHVACVarRefFlow->NumVRFCond);
5550 13 : state.dataHVACVarRefFlow->MaxDeltaT.allocate(state.dataHVACVarRefFlow->NumVRFCond);
5551 13 : state.dataHVACVarRefFlow->MinDeltaT.allocate(state.dataHVACVarRefFlow->NumVRFCond);
5552 13 : state.dataHVACVarRefFlow->LastModeCooling.allocate(state.dataHVACVarRefFlow->NumVRFCond);
5553 13 : state.dataHVACVarRefFlow->LastModeHeating.allocate(state.dataHVACVarRefFlow->NumVRFCond);
5554 13 : state.dataHVACVarRefFlow->HeatingLoad.allocate(state.dataHVACVarRefFlow->NumVRFCond);
5555 13 : state.dataHVACVarRefFlow->CoolingLoad.allocate(state.dataHVACVarRefFlow->NumVRFCond);
5556 13 : state.dataHVACVarRefFlow->NumCoolingLoads.allocate(state.dataHVACVarRefFlow->NumVRFCond);
5557 13 : state.dataHVACVarRefFlow->SumCoolingLoads.allocate(state.dataHVACVarRefFlow->NumVRFCond);
5558 13 : state.dataHVACVarRefFlow->NumHeatingLoads.allocate(state.dataHVACVarRefFlow->NumVRFCond);
5559 13 : state.dataHVACVarRefFlow->SumHeatingLoads.allocate(state.dataHVACVarRefFlow->NumVRFCond);
5560 13 : state.dataHVACVarRefFlow->MyVRFCondFlag.allocate(state.dataHVACVarRefFlow->NumVRFCond);
5561 13 : state.dataHVACVarRefFlow->MyEnvrnFlag = true;
5562 13 : state.dataHVACVarRefFlow->MySizeFlag = true;
5563 13 : state.dataHVACVarRefFlow->MyVRFFlag = true;
5564 13 : state.dataHVACVarRefFlow->MyZoneEqFlag = true;
5565 13 : state.dataHVACVarRefFlow->MyBeginTimeStepFlag = true;
5566 13 : state.dataHVACVarRefFlow->MaxDeltaT = 0.0;
5567 13 : state.dataHVACVarRefFlow->MinDeltaT = 0.0;
5568 13 : state.dataHVACVarRefFlow->LastModeCooling = false;
5569 13 : state.dataHVACVarRefFlow->LastModeHeating = true;
5570 13 : state.dataHVACVarRefFlow->NumCoolingLoads = 0;
5571 13 : state.dataHVACVarRefFlow->SumCoolingLoads = 0.0;
5572 13 : state.dataHVACVarRefFlow->NumHeatingLoads = 0;
5573 13 : state.dataHVACVarRefFlow->SumHeatingLoads = 0.0;
5574 :
5575 13 : state.dataHVACVarRefFlow->MyOneTimeFlag = false;
5576 13 : state.dataHVACVarRefFlow->MyVRFCondFlag = true;
5577 :
5578 : } // IF (MyOneTimeFlag) THEN
5579 :
5580 : // identify VRF condenser connected to this TU
5581 250981 : VRFCond = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum;
5582 250981 : TUListIndex = state.dataHVACVarRefFlow->VRF(VRFCond).ZoneTUListPtr;
5583 250981 : InNode = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum;
5584 250981 : OutNode = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum;
5585 250981 : OutsideAirNode = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum;
5586 250981 : IndexToTUInTUList = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).IndexToTUInTUList;
5587 :
5588 250981 : SuppHeatCoilCapacity = 0.0;
5589 250981 : SuppHeatCoilLoad = 0.0;
5590 250981 : LoadToCoolingSP = 0.0;
5591 250981 : LoadToHeatingSP = 0.0;
5592 250981 : ErrorsFound = false;
5593 250981 : bool SetPointErrorFlag = false;
5594 :
5595 : // set condenser inlet temp, used as surrogate for OAT (used to check limits of operation)
5596 250981 : if (state.dataHVACVarRefFlow->VRF(VRFCond).CondenserType == DataHeatBalance::RefrigCondenserType::Water) {
5597 15076 : OutsideDryBulbTemp = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).Temp;
5598 : } else {
5599 235905 : if (OutsideAirNode == 0) {
5600 33843 : OutsideDryBulbTemp = state.dataEnvrn->OutDryBulbTemp;
5601 : } else {
5602 202062 : OutsideDryBulbTemp = state.dataLoopNodes->Node(OutsideAirNode).Temp;
5603 : }
5604 : }
5605 :
5606 250981 : if (allocated(state.dataAvail->ZoneComp)) {
5607 250937 : auto &availMgr = state.dataAvail->ZoneComp(DataZoneEquipment::ZoneEquipType::VariableRefrigerantFlowTerminal).ZoneCompAvailMgrs(VRFTUNum);
5608 250937 : if (state.dataHVACVarRefFlow->MyZoneEqFlag(VRFTUNum)) { // initialize the name of each availability manager list and zone number
5609 62 : availMgr.AvailManagerListName = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).AvailManagerListName;
5610 62 : availMgr.ZoneNum = ZoneNum;
5611 62 : state.dataHVACVarRefFlow->MyZoneEqFlag(VRFTUNum) = false;
5612 : }
5613 250937 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).availStatus = availMgr.availStatus;
5614 : }
5615 :
5616 250981 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MySuppCoilPlantScanFlag && allocated(state.dataPlnt->PlantLoop)) {
5617 62 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num == HVAC::Coil_HeatingWater) {
5618 : // hot water supplemental heating coil
5619 2 : errFlag = false;
5620 4 : PlantUtilities::ScanPlantLoopsForObject(state,
5621 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName,
5622 : PlantEquipmentType::CoilWaterSimpleHeating,
5623 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilPlantLoc,
5624 : errFlag,
5625 : _,
5626 : _,
5627 : _,
5628 : _,
5629 : _);
5630 :
5631 2 : WaterCoils::SetCoilDesFlow(state,
5632 2 : HVAC::cAllCoilTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num),
5633 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName,
5634 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow,
5635 : errFlag);
5636 :
5637 2 : if (errFlag) {
5638 0 : ShowFatalError(state, format("{}: Program terminated for previous conditions.", RoutineName));
5639 : }
5640 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow = WaterCoils::GetCoilMaxWaterFlowRate(
5641 2 : state, "Coil:Heating:Water", state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName, ErrorsFound);
5642 :
5643 2 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow > 0.0) {
5644 0 : rho = FluidProperties::GetDensityGlycol(
5645 : state,
5646 0 : state.dataPlnt->PlantLoop(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilPlantLoc.loopNum).FluidName,
5647 : Constant::HWInitConvTemp,
5648 0 : state.dataPlnt->PlantLoop(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilPlantLoc.loopNum).FluidIndex,
5649 : RoutineName);
5650 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow =
5651 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow * rho;
5652 : }
5653 :
5654 : // fill fluid outlet node for hot water coil SuppHeatCoilFluidOutletNode
5655 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidOutletNode =
5656 2 : DataPlant::CompData::getPlantComponent(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilPlantLoc).NodeNumOut;
5657 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MySuppCoilPlantScanFlag = false;
5658 :
5659 60 : } else if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num == HVAC::Coil_HeatingSteam) {
5660 : // steam supplemental heating coil
5661 2 : errFlag = false;
5662 4 : PlantUtilities::ScanPlantLoopsForObject(state,
5663 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName,
5664 : PlantEquipmentType::CoilSteamAirHeating,
5665 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilPlantLoc,
5666 : errFlag,
5667 : _,
5668 : _,
5669 : _,
5670 : _,
5671 : _);
5672 2 : if (errFlag) {
5673 0 : ShowFatalError(state, format("{}: Program terminated for previous conditions.", RoutineName));
5674 : }
5675 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow =
5676 2 : SteamCoils::GetCoilMaxSteamFlowRate(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilIndex, ErrorsFound);
5677 2 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow > 0.0) {
5678 0 : int SteamIndex = 0; // fluid type index of 0 is passed if steam
5679 0 : Real64 TempSteamIn = 100.0;
5680 0 : Real64 SteamDensity = FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, SteamIndex, RoutineName);
5681 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow =
5682 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow * SteamDensity;
5683 : }
5684 :
5685 : // fill fluid outlet node for steam coil SuppHeatCoilFluidOutletNode
5686 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidOutletNode =
5687 2 : DataPlant::CompData::getPlantComponent(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilPlantLoc).NodeNumOut;
5688 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MySuppCoilPlantScanFlag = false;
5689 :
5690 : } else { // VRF terminal unit not connected to plant
5691 58 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MySuppCoilPlantScanFlag = false;
5692 : }
5693 250919 : } else if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MySuppCoilPlantScanFlag && !state.dataGlobal->AnyPlantInModel) {
5694 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MySuppCoilPlantScanFlag = false;
5695 : }
5696 :
5697 : // one-time check to see if VRF TU's are on ZoneHVAC:EquipmentList or AirloopHVAC or issue warning
5698 250981 : if (state.dataHVACVarRefFlow->ZoneEquipmentListNotChecked) {
5699 164 : if (state.dataAirLoop->AirLoopInputsFilled) state.dataHVACVarRefFlow->ZoneEquipmentListNotChecked = false;
5700 164 : bool AirLoopFound = false;
5701 164 : bool errorsFound = false;
5702 164 : bool AirNodeFound = false;
5703 164 : int ctrlZoneNum = 0;
5704 164 : std::string const cCurrentModuleObject = "ZoneHVAC:TerminalUnit:VariableRefrigerantFlow";
5705 339 : for (TUListNum = 1; TUListNum <= state.dataHVACVarRefFlow->NumVRFTULists; ++TUListNum) {
5706 998 : for (NumTULoop = 1; NumTULoop <= state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList; ++NumTULoop) {
5707 823 : AirLoopFound = false; // reset for next TU
5708 823 : ctrlZoneNum = 0; // reset for next TU
5709 823 : TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTULoop);
5710 823 : std::string const thisObjectName = state.dataHVACVarRefFlow->VRFTU(TUIndex).Name;
5711 823 : if (state.dataHVACVarRefFlow->VRFTU(TUIndex).isInZone) goto EquipList_exit; // already found previously
5712 445 : for (ELLoop = 1; ELLoop <= state.dataGlobal->NumOfZones; ++ELLoop) { // NumOfZoneEquipLists
5713 415 : if (state.dataZoneEquip->ZoneEquipList(ELLoop).Name == "") continue; // dimensioned by NumOfZones. Only valid ones have names.
5714 797 : for (ListLoop = 1; ListLoop <= state.dataZoneEquip->ZoneEquipList(ELLoop).NumOfEquipTypes; ++ListLoop) {
5715 531 : if (!Util::SameString(state.dataZoneEquip->ZoneEquipList(ELLoop).EquipTypeName(ListLoop),
5716 531 : tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(TUIndex).type]))
5717 235 : continue;
5718 296 : if (!Util::SameString(state.dataZoneEquip->ZoneEquipList(ELLoop).EquipName(ListLoop),
5719 296 : state.dataHVACVarRefFlow->VRFTU(TUIndex).Name))
5720 236 : continue;
5721 60 : state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum = ELLoop;
5722 60 : state.dataHVACVarRefFlow->VRFTU(TUIndex).isInZone = true;
5723 60 : if (state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFSysNum).MasterZonePtr == ELLoop) {
5724 9 : state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFSysNum).MasterZoneTUIndex = TUIndex;
5725 : }
5726 60 : if (state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneAirNode == 0) {
5727 0 : bool ZoneNodeNotFound = true;
5728 0 : for (int CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) {
5729 0 : if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZone).IsControlled) continue;
5730 0 : for (int NodeNum = 1; NodeNum <= state.dataZoneEquip->ZoneEquipConfig(CtrlZone).NumExhaustNodes; ++NodeNum) {
5731 0 : if (state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUInletNodeNum ==
5732 0 : state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ExhaustNode(NodeNum)) {
5733 0 : state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneAirNode =
5734 0 : state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ZoneNode;
5735 0 : ZoneNodeNotFound = false;
5736 0 : break;
5737 : }
5738 : }
5739 0 : for (int NodeNum = 1; NodeNum <= state.dataZoneEquip->ZoneEquipConfig(CtrlZone).NumInletNodes; ++NodeNum) {
5740 0 : if (state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOutletNodeNum ==
5741 0 : state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(NodeNum)) {
5742 0 : state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneAirNode =
5743 0 : state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ZoneNode;
5744 0 : ZoneNodeNotFound = false;
5745 0 : break;
5746 : }
5747 : }
5748 0 : if (!ZoneNodeNotFound) break;
5749 : }
5750 0 : if (ZoneNodeNotFound) {
5751 0 : ShowSevereError(state,
5752 0 : format("ZoneHVAC:TerminalUnit:VariableRefrigerantFlow \"{}\" Zone terminal unit air inlet node name "
5753 : "must be the same as a zone inlet or exhaust node name.",
5754 0 : state.dataHVACVarRefFlow->VRFTU(TUIndex).Name));
5755 0 : ShowContinueError(state,
5756 : "... Zone inlet and exhaust node name is specified in ZoneHVAC:EquipmentConnections object.");
5757 0 : ShowContinueError(state,
5758 0 : format("... Zone terminal unit inlet node name = {}",
5759 0 : state.dataLoopNodes->NodeID(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUInletNodeNum)));
5760 0 : ShowContinueError(state,
5761 0 : format("... Zone terminal unit outlet node name = {}",
5762 0 : state.dataLoopNodes->NodeID(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOutletNodeNum)));
5763 : }
5764 : }
5765 60 : goto EquipList_exit;
5766 : }
5767 : }
5768 : // check if the TU is connected to an air loop
5769 30 : if (!state.dataHVACVarRefFlow->VRFTU(TUIndex).isInAirLoop) {
5770 31 : for (int AirLoopNum = 1; AirLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++AirLoopNum) {
5771 23 : for (int BranchNum = 1; BranchNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).NumBranches; ++BranchNum) {
5772 35 : for (int CompNum = 1;
5773 35 : CompNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).TotalComponents;
5774 : ++CompNum) {
5775 24 : if (Util::SameString(state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).Name,
5776 25 : thisObjectName) &&
5777 1 : Util::SameString(state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).TypeOf,
5778 : cCurrentModuleObject)) {
5779 1 : state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum = AirLoopNum;
5780 1 : AirLoopFound = true;
5781 1 : state.dataHVACVarRefFlow->VRFTU(TUIndex).isInAirLoop = true;
5782 2 : BranchNodeConnections::TestCompSet(
5783 : state,
5784 : cCurrentModuleObject,
5785 : thisObjectName,
5786 1 : state.dataLoopNodes->NodeID(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUInletNodeNum),
5787 1 : state.dataLoopNodes->NodeID(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOutletNodeNum),
5788 : "Air Nodes");
5789 1 : if (state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum > 0) {
5790 1 : state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneAirNode =
5791 1 : state.dataZoneEquip->ZoneEquipConfig(state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum).ZoneNode;
5792 1 : int ControlledZoneNum = state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum;
5793 5 : for (int TstatZoneNum = 1; TstatZoneNum <= state.dataZoneCtrls->NumTempControlledZones; ++TstatZoneNum) {
5794 5 : if (state.dataZoneCtrls->TempControlledZone(TstatZoneNum).ActualZoneNum !=
5795 5 : state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum)
5796 4 : continue;
5797 1 : state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFSysNum).MasterZoneTUIndex =
5798 : TUIndex;
5799 1 : AirNodeFound = true;
5800 1 : ctrlZoneNum = ControlledZoneNum;
5801 1 : goto EquipList_exit;
5802 : }
5803 0 : for (int TstatZoneNum = 1; TstatZoneNum <= state.dataZoneCtrls->NumComfortControlledZones; ++TstatZoneNum) {
5804 0 : if (state.dataZoneCtrls->ComfortControlledZone(TstatZoneNum).ActualZoneNum !=
5805 0 : state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum)
5806 0 : continue;
5807 0 : state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFSysNum).MasterZoneTUIndex =
5808 : TUIndex;
5809 0 : AirNodeFound = true;
5810 0 : ctrlZoneNum = ControlledZoneNum;
5811 0 : goto EquipList_exit;
5812 : }
5813 0 : if (!AirNodeFound && state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum > 0) {
5814 0 : ShowSevereError(state, format("Input errors for {}:{}", cCurrentModuleObject, thisObjectName));
5815 0 : ShowContinueError(state, "Did not find Air node (Zone with Thermostat or Thermal Comfort Thermostat).");
5816 : // ShowContinueError(state, format("specified Controlling Zone or Thermostat Location name = {}{}", //,
5817 : // loc_controlZoneName));
5818 0 : errorsFound = true;
5819 : }
5820 0 : } else if (AirLoopFound) { // control zone name not entered in TU object input
5821 0 : state.dataHVACVarRefFlow->VRFTU(TUIndex).isSetPointControlled = true;
5822 : }
5823 : }
5824 23 : if (AirLoopFound) break;
5825 : }
5826 11 : if (AirLoopFound) break;
5827 : }
5828 11 : if (AirLoopFound) break;
5829 : }
5830 : }
5831 :
5832 : // check if the TU is connected to an outside air system
5833 29 : if (!AirLoopFound && !state.dataHVACVarRefFlow->VRFTU(TUIndex).isInOASys) {
5834 29 : for (int OASysNum = 1; OASysNum <= state.dataAirLoop->NumOASystems; ++OASysNum) {
5835 31 : for (int OACompNum = 1; OACompNum <= state.dataAirLoop->OutsideAirSys(OASysNum).NumComponents; ++OACompNum) {
5836 21 : if (!Util::SameString(state.dataAirLoop->OutsideAirSys(OASysNum).ComponentName(OACompNum),
5837 43 : state.dataHVACVarRefFlow->VRFTU(TUIndex).Name) ||
5838 1 : !Util::SameString(state.dataAirLoop->OutsideAirSys(OASysNum).ComponentType(OACompNum), cCurrentModuleObject))
5839 20 : continue;
5840 1 : state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum = 0; // need air loop number here?
5841 1 : state.dataHVACVarRefFlow->VRFTU(TUIndex).isInOASys = true;
5842 1 : AirLoopFound = true;
5843 1 : state.dataHVACVarRefFlow->VRFTU(TUIndex).isSetPointControlled = true;
5844 : // user may have inadvertently entered a zone name in the OA system TU object
5845 1 : state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum = 0;
5846 1 : state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneAirNode = 0;
5847 2 : BranchNodeConnections::TestCompSet(
5848 : state,
5849 : cCurrentModuleObject,
5850 : thisObjectName,
5851 1 : state.dataLoopNodes->NodeID(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUInletNodeNum),
5852 1 : state.dataLoopNodes->NodeID(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOutletNodeNum),
5853 : "Air Nodes");
5854 1 : goto EquipList_exit;
5855 : }
5856 : }
5857 : }
5858 10 : EquipList_exit:;
5859 823 : if (ctrlZoneNum > 0) {
5860 1 : int inletNodeADUNum = 0;
5861 1 : DataZoneEquipment::ZoneEquipType sysType_Num = DataZoneEquipment::ZoneEquipType::Invalid;
5862 1 : std::string sysName = "";
5863 1 : for (int inletNode = 1; inletNode <= state.dataZoneEquip->ZoneEquipConfig(ctrlZoneNum).NumInletNodes; inletNode++) {
5864 1 : if (state.dataZoneEquip->ZoneEquipConfig(ctrlZoneNum).InletNodeAirLoopNum(inletNode) !=
5865 1 : state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum)
5866 0 : continue;
5867 1 : inletNodeADUNum = state.dataZoneEquip->ZoneEquipConfig(ctrlZoneNum).InletNodeADUNum(inletNode);
5868 1 : if (inletNodeADUNum > 0 && inletNodeADUNum <= (int)state.dataDefineEquipment->AirDistUnit.size()) {
5869 1 : sysType_Num = DataZoneEquipment::ZoneEquipType::AirDistributionUnit;
5870 1 : sysName = state.dataDefineEquipment->AirDistUnit(inletNodeADUNum).Name;
5871 1 : break;
5872 : }
5873 : }
5874 1 : if (inletNodeADUNum > 0) {
5875 1 : if (state.dataZoneEquip->ZoneEquipConfig(ctrlZoneNum).EquipListIndex > 0) {
5876 1 : for (int EquipNum = 1;
5877 1 : EquipNum <=
5878 1 : state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ctrlZoneNum).EquipListIndex).NumOfEquipTypes;
5879 : ++EquipNum) {
5880 1 : if ((state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ctrlZoneNum).EquipListIndex)
5881 2 : .EquipType(EquipNum) != sysType_Num) ||
5882 1 : state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ctrlZoneNum).EquipListIndex)
5883 1 : .EquipName(EquipNum) != sysName)
5884 0 : continue;
5885 1 : state.dataHVACVarRefFlow->VRFTU(TUIndex).zoneSequenceCoolingNum =
5886 1 : state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ctrlZoneNum).EquipListIndex)
5887 1 : .CoolingPriority(EquipNum);
5888 1 : state.dataHVACVarRefFlow->VRFTU(TUIndex).zoneSequenceHeatingNum =
5889 1 : state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ctrlZoneNum).EquipListIndex)
5890 1 : .HeatingPriority(EquipNum);
5891 1 : break;
5892 : }
5893 : }
5894 : } else {
5895 0 : ShowSevereError(state, format("Input errors for {}:{}", cCurrentModuleObject, thisObjectName));
5896 0 : ShowContinueError(state, "Did not find ZoneHVAC:EquipmentList connected to this VRF terminal unit.");
5897 0 : errorsFound = true;
5898 : }
5899 1 : }
5900 :
5901 : // Find the number of zones (zone Inlet nodes) attached to an air loop from the air loop number
5902 823 : if (AirLoopFound || state.dataHVACVarRefFlow->VRFTU(TUIndex).isInAirLoop) {
5903 12 : int NumAirLoopZones = 0;
5904 12 : bool initLoadBasedControlFlowFracFlagReady = false;
5905 12 : Real64 initLoadBasedControlCntrlZoneTerminalUnitMassFlowRateMax = 0.0;
5906 12 : if (allocated(state.dataAirLoop->AirToZoneNodeInfo) && state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum > 0)
5907 11 : NumAirLoopZones = state.dataAirLoop->AirToZoneNodeInfo(state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum).NumZonesCooled +
5908 11 : state.dataAirLoop->AirToZoneNodeInfo(state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum).NumZonesHeated;
5909 12 : if (allocated(state.dataAirLoop->AirToZoneNodeInfo)) {
5910 12 : initLoadBasedControlFlowFracFlagReady = true;
5911 67 : for (int ZoneInSysIndex = 1; ZoneInSysIndex <= NumAirLoopZones; ++ZoneInSysIndex) {
5912 : // zone inlet nodes for cooling
5913 55 : if (state.dataAirLoop->AirToZoneNodeInfo(state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum).NumZonesCooled > 0) {
5914 55 : if (state.dataAirLoop->AirToZoneNodeInfo(state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum)
5915 55 : .TermUnitCoolInletNodes(ZoneInSysIndex) == -999) {
5916 : // the data structure for the zones inlet nodes has not been filled
5917 0 : initLoadBasedControlFlowFracFlagReady = false;
5918 : } else {
5919 55 : int ZoneInletNodeNum = state.dataAirLoop->AirToZoneNodeInfo(state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum)
5920 55 : .TermUnitCoolInletNodes(ZoneInSysIndex);
5921 55 : if (state.dataLoopNodes->Node(ZoneInletNodeNum).MassFlowRateMax == -999.0) {
5922 : // the node mass flow rate has not been set
5923 10 : initLoadBasedControlFlowFracFlagReady = false;
5924 : }
5925 : }
5926 : }
5927 : // zone inlet nodes for heating
5928 55 : if (state.dataAirLoop->AirToZoneNodeInfo(state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum).NumZonesHeated > 0) {
5929 0 : if (state.dataAirLoop->AirToZoneNodeInfo(state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum)
5930 0 : .TermUnitHeatInletNodes(ZoneInSysIndex) == -999) {
5931 : // the data structure for the zones inlet nodes has not been filled
5932 0 : initLoadBasedControlFlowFracFlagReady = false;
5933 : } else {
5934 0 : int ZoneInletNodeNum = state.dataAirLoop->AirToZoneNodeInfo(state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum)
5935 0 : .TermUnitHeatInletNodes(ZoneInSysIndex);
5936 0 : if (state.dataLoopNodes->Node(ZoneInletNodeNum).MassFlowRateMax == -999.0) {
5937 : // the node mass flow rate has not been set
5938 0 : initLoadBasedControlFlowFracFlagReady = false;
5939 : }
5940 : }
5941 : }
5942 : }
5943 : }
5944 12 : if (allocated(state.dataAirLoop->AirToZoneNodeInfo) && initLoadBasedControlFlowFracFlagReady) {
5945 8 : Real64 SumOfMassFlowRateMax = 0.0; // initialize the sum of the maximum flows
5946 43 : for (int ZoneInSysIndex = 1; ZoneInSysIndex <= NumAirLoopZones; ++ZoneInSysIndex) {
5947 35 : int ZoneInletNodeNum = state.dataAirLoop->AirToZoneNodeInfo(state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum)
5948 35 : .TermUnitCoolInletNodes(ZoneInSysIndex);
5949 35 : SumOfMassFlowRateMax += state.dataLoopNodes->Node(ZoneInletNodeNum).MassFlowRateMax;
5950 35 : if (state.dataAirLoop->AirToZoneNodeInfo(state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum)
5951 35 : .CoolCtrlZoneNums(ZoneInSysIndex) == state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum) {
5952 7 : initLoadBasedControlCntrlZoneTerminalUnitMassFlowRateMax =
5953 7 : state.dataLoopNodes->Node(ZoneInletNodeNum).MassFlowRateMax;
5954 : }
5955 : }
5956 8 : if (SumOfMassFlowRateMax != 0.0 && state.dataAirLoop->AirLoopInputsFilled) {
5957 1 : if (initLoadBasedControlCntrlZoneTerminalUnitMassFlowRateMax >= HVAC::SmallAirVolFlow) {
5958 1 : state.dataHVACVarRefFlow->VRFTU(TUIndex).controlZoneMassFlowFrac =
5959 1 : initLoadBasedControlCntrlZoneTerminalUnitMassFlowRateMax / SumOfMassFlowRateMax;
5960 2 : BaseSizer::reportSizerOutput(state,
5961 1 : tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(TUIndex).type],
5962 1 : state.dataHVACVarRefFlow->VRFTU(TUIndex).Name,
5963 : "Fraction of Supply Air Flow That Goes Through the Controlling Zone",
5964 1 : state.dataHVACVarRefFlow->VRFTU(TUIndex).controlZoneMassFlowFrac);
5965 1 : state.dataHVACVarRefFlow->VRFTU(TUIndex).isSetPointControlled = false; // redundant
5966 : } else {
5967 0 : if (state.dataHVACVarRefFlow->VRFTU(TUIndex).isInAirLoop && state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum == 0 &&
5968 0 : state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneAirNode == 0) {
5969 : // TU must be set point controlled and use constant fan mode (or coil out T won't change with PLR/air flow)
5970 0 : state.dataHVACVarRefFlow->VRFTU(TUIndex).isSetPointControlled = true;
5971 0 : if (state.dataHVACVarRefFlow->VRFTU(TUIndex).FanOpModeSchedPtr > 0) {
5972 0 : if (ScheduleManager::GetScheduleMinValue(state, state.dataHVACVarRefFlow->VRFTU(TUIndex).FanOpModeSchedPtr) ==
5973 : 0.0) {
5974 0 : ShowSevereError(state,
5975 0 : format("{} = {}",
5976 0 : tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(TUIndex).type],
5977 0 : state.dataHVACVarRefFlow->VRFTU(TUIndex).Name));
5978 0 : ShowContinueError(state,
5979 : "When using set point control, fan operating mode must be continuous (fan "
5980 : "operating mode schedule values > 0).");
5981 0 : ShowContinueError(
5982 : state,
5983 0 : format("Error found in Supply Air Fan Operating Mode Schedule Name = {}",
5984 0 : state.dataScheduleMgr->Schedule(state.dataHVACVarRefFlow->VRFTU(TUIndex).FanOpModeSchedPtr)
5985 0 : .Name));
5986 0 : ShowContinueError(state, "...schedule values must be (>0., <=1.)");
5987 0 : ErrorsFound = true;
5988 : }
5989 : }
5990 : } else {
5991 0 : ShowSevereError(state,
5992 0 : format("{} = {}",
5993 0 : tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(TUIndex).type],
5994 0 : state.dataHVACVarRefFlow->VRFTU(TUIndex).Name));
5995 0 : ShowContinueError(state, " The Fraction of Supply Air Flow That Goes Through the Controlling Zone is set to 1.");
5996 0 : state.dataHVACVarRefFlow->VRFTU(TUIndex).controlZoneMassFlowFrac = 1.0;
5997 0 : BaseSizer::reportSizerOutput(state,
5998 0 : tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(TUIndex).type],
5999 0 : state.dataHVACVarRefFlow->VRFTU(TUIndex).Name,
6000 : "Fraction of Supply Air Flow That Goes Through the Controlling Zone",
6001 0 : state.dataHVACVarRefFlow->VRFTU(TUIndex).controlZoneMassFlowFrac);
6002 : }
6003 : }
6004 7 : } else if (state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum == 0) {
6005 : // TU must be set point controlled and use constant fan mode (or coil outlet T won't change with PLR/air flow rate)
6006 : // TU inlet air flow rate is also determined by OA system, not TU
6007 1 : state.dataHVACVarRefFlow->VRFTU(TUIndex).isSetPointControlled = true;
6008 : }
6009 : }
6010 : }
6011 :
6012 823 : if (state.dataHVACVarRefFlow->VRFTU(TUIndex).isInZone && state.dataAirLoop->AirLoopInputsFilled) {
6013 60 : if (state.dataHVACVarRefFlow->VRFTU(TUIndex).fanPlace == HVAC::FanPlace::Invalid) {
6014 0 : ShowSevereError(state,
6015 0 : format("ZoneHVAC:TerminalUnit:VariableRefrigerantFlow = {}", state.dataHVACVarRefFlow->VRFTU(TUIndex).Name));
6016 0 : ShowContinueError(state, "Illegal Supply Air Fan Placement.");
6017 0 : ErrorsFound = true;
6018 : }
6019 60 : if (state.dataHVACVarRefFlow->VRFTU(TUIndex).FanIndex == 0) {
6020 0 : ShowSevereError(state,
6021 0 : format("ZoneHVAC:TerminalUnit:VariableRefrigerantFlow = {}", state.dataHVACVarRefFlow->VRFTU(TUIndex).Name));
6022 0 : ShowContinueError(state, "VRF Terminal Unit fan is required when used as zone equipment.");
6023 0 : ErrorsFound = true;
6024 : }
6025 : }
6026 :
6027 823 : if (state.dataHVACVarRefFlow->VRFTU(TUIndex).isSetPointControlled && state.dataAirLoop->AirLoopInputsFilled) {
6028 1 : bool missingSetPoint = false;
6029 1 : Real64 TUOutNodeSP = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOutletNodeNum).TempSetPoint;
6030 1 : Real64 coolCoilOutNodeSP = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).coolCoilAirOutNode).TempSetPoint;
6031 1 : Real64 heatCoilOutNodeSP = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).heatCoilAirOutNode).TempSetPoint;
6032 : // SP can be at outlet of TU or at outlet of coils
6033 : // if supp heat coil is present, a SP must be at the outlet of the TU
6034 1 : if (state.dataHVACVarRefFlow->VRFTU(TUIndex).SuppHeatingCoilPresent) {
6035 0 : if (TUOutNodeSP == DataLoopNode::SensedNodeFlagValue) missingSetPoint = true;
6036 : } else {
6037 1 : if (state.dataHVACVarRefFlow->VRFTU(TUIndex).fanPlace == HVAC::FanPlace::DrawThru) {
6038 : // then SP must be at TU outlet
6039 0 : if (TUOutNodeSP == DataLoopNode::SensedNodeFlagValue) missingSetPoint = true;
6040 : // or at coil outlet nodes
6041 0 : if (missingSetPoint) {
6042 0 : if (coolCoilOutNodeSP != DataLoopNode::SensedNodeFlagValue && heatCoilOutNodeSP != DataLoopNode::SensedNodeFlagValue)
6043 0 : missingSetPoint = false;
6044 : }
6045 : } else {
6046 : // else fan is blow thru or missing
6047 1 : if (TUOutNodeSP == DataLoopNode::SensedNodeFlagValue) missingSetPoint = true;
6048 : }
6049 : }
6050 1 : if (missingSetPoint) {
6051 0 : if (!state.dataGlobal->AnyEnergyManagementSystemInModel) {
6052 0 : ShowSevereError(state,
6053 0 : format("ZoneHVAC:TerminalUnit:VariableRefrigerantFlow: Missing temperature setpoint for {}",
6054 0 : state.dataHVACVarRefFlow->VRFTU(TUIndex).Name));
6055 0 : ShowContinueError(state, "...use a Setpoint Manager to establish a setpoint at the TU or coil(s) outlet node.");
6056 0 : ErrorsFound = true;
6057 0 : } else if (state.dataGlobal->AnyEnergyManagementSystemInModel) {
6058 0 : bool SPNotFound = false;
6059 0 : EMSManager::CheckIfNodeSetPointManagedByEMS(
6060 0 : state, state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOutletNodeNum, HVAC::CtrlVarType::Temp, SetPointErrorFlag);
6061 0 : SPNotFound = SPNotFound || SetPointErrorFlag;
6062 0 : EMSManager::CheckIfNodeSetPointManagedByEMS(
6063 0 : state, state.dataHVACVarRefFlow->VRFTU(TUIndex).coolCoilAirOutNode, HVAC::CtrlVarType::Temp, SetPointErrorFlag);
6064 0 : SPNotFound = SPNotFound || SetPointErrorFlag;
6065 0 : EMSManager::CheckIfNodeSetPointManagedByEMS(
6066 0 : state, state.dataHVACVarRefFlow->VRFTU(TUIndex).heatCoilAirOutNode, HVAC::CtrlVarType::Temp, SetPointErrorFlag);
6067 0 : SPNotFound = SPNotFound || SetPointErrorFlag;
6068 :
6069 : // We disable the check at end (if API), because one of the nodes is enough, so there's an almost certainty
6070 : // that it will throw as you're unlikely going to actuate all three nodes
6071 : // It's not ideal, but it's better to let slide a bad condition rather than throw false positives...
6072 0 : state.dataLoopNodes->NodeSetpointCheck(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOutletNodeNum)
6073 0 : .needsSetpointChecking = false;
6074 0 : state.dataLoopNodes->NodeSetpointCheck(state.dataHVACVarRefFlow->VRFTU(TUIndex).coolCoilAirOutNode)
6075 0 : .needsSetpointChecking = false;
6076 0 : state.dataLoopNodes->NodeSetpointCheck(state.dataHVACVarRefFlow->VRFTU(TUIndex).heatCoilAirOutNode)
6077 0 : .needsSetpointChecking = false;
6078 :
6079 0 : if (SPNotFound && state.dataAirLoop->AirLoopInputsFilled) {
6080 0 : ShowSevereError(
6081 : state,
6082 0 : format("ZoneHVAC:TerminalUnit:VariableRefrigerantFlow: Missing temperature setpoint for unitary system = {}",
6083 0 : state.dataHVACVarRefFlow->VRFTU(TUIndex).Name));
6084 0 : ShowContinueError(state, "...use a Setpoint Manager to establish a setpoint at the TU or coil(s) outlet node.");
6085 0 : ShowContinueError(state, "...or use an EMS actuator to establish a temperature setpoint at the coil control node.");
6086 0 : ErrorsFound = true;
6087 : }
6088 : }
6089 : }
6090 : }
6091 :
6092 1624 : if (state.dataHVACVarRefFlow->VRFTU(TUIndex).isInAirLoop || state.dataHVACVarRefFlow->VRFTU(TUIndex).isInOASys ||
6093 801 : state.dataHVACVarRefFlow->VRFTU(TUIndex).isInZone)
6094 815 : continue;
6095 8 : if (!state.dataAirLoop->AirLoopInputsFilled) continue;
6096 0 : ShowSevereError(state,
6097 0 : format("InitVRF: VRF Terminal Unit = [{},{}] is not on any ZoneHVAC:EquipmentList, AirloopHVAC or "
6098 : "AirLoopHVAC:OutdoorAirSystem:EquipmentList. It will not be simulated.",
6099 0 : tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(TUIndex).type],
6100 0 : state.dataHVACVarRefFlow->VRFTU(TUIndex).Name));
6101 0 : ShowContinueError(state, "...The VRF AC System associated with this terminal unit may also not be simulated.");
6102 823 : }
6103 : }
6104 :
6105 : // TU inlet node must be the same as a zone exhaust node and the OA Mixer return node
6106 : // check that TU inlet node is a zone exhaust node.
6107 326 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInZone &&
6108 162 : (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerExists ||
6109 32 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerType == HVAC::MixerType::SupplySide)) {
6110 142 : bool ZoneNodeNotFound = true;
6111 551 : for (int CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) {
6112 551 : if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZone).IsControlled) continue;
6113 682 : for (int NodeNum = 1; NodeNum <= state.dataZoneEquip->ZoneEquipConfig(CtrlZone).NumExhaustNodes; ++NodeNum) {
6114 412 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum ==
6115 412 : state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ExhaustNode(NodeNum)) {
6116 142 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneAirNode = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ZoneNode;
6117 142 : ZoneNodeNotFound = false;
6118 142 : break;
6119 : }
6120 : }
6121 412 : if (!ZoneNodeNotFound) break;
6122 : }
6123 142 : if (ZoneNodeNotFound && !state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInAirLoop) {
6124 0 : ShowSevereError(state,
6125 0 : format("{} \"{}\" Zone terminal unit air inlet node name must be the same as a zone exhaust node name.",
6126 : cCurrentModuleObject,
6127 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name));
6128 0 : ShowContinueError(state, "... Zone exhaust node name is specified in ZoneHVAC:EquipmentConnections object.");
6129 0 : ShowContinueError(state,
6130 0 : format("... Zone terminal unit inlet node name = {}",
6131 0 : state.dataLoopNodes->NodeID(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum)));
6132 0 : ErrorsFound = true;
6133 : }
6134 : }
6135 : // check OA Mixer return node
6136 294 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInZone && !state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerExists &&
6137 130 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) {
6138 130 : Array1D_int OANodeNums = MixedAir::GetOAMixerNodeNumbers(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerName, errFlag);
6139 130 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum != OANodeNums(3)) {
6140 0 : ShowSevereError(
6141 : state,
6142 0 : format("{} \"{}\" Zone terminal unit air inlet node name must be the same as the OutdoorAir:Mixer return air node name.",
6143 : cCurrentModuleObject,
6144 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name));
6145 0 : ShowContinueError(state,
6146 0 : format("... Zone terminal unit air inlet node name = {}",
6147 0 : state.dataLoopNodes->NodeID(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum)));
6148 0 : ShowContinueError(state, format("... OutdoorAir:Mixer return air node name = {}", state.dataLoopNodes->NodeID(OANodeNums(3))));
6149 0 : ErrorsFound = true;
6150 : }
6151 130 : }
6152 : // check that TU outlet node is a zone inlet node.
6153 326 : if ((state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInZone &&
6154 162 : (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerExists ||
6155 32 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerType == HVAC::MixerType::InletSide))) {
6156 150 : bool ZoneNodeNotFound = true;
6157 543 : for (int CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) {
6158 543 : if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZone).IsControlled) continue;
6159 750 : for (int NodeNum = 1; NodeNum <= state.dataZoneEquip->ZoneEquipConfig(CtrlZone).NumInletNodes; ++NodeNum) {
6160 504 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum ==
6161 504 : state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(NodeNum)) {
6162 150 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneAirNode = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ZoneNode;
6163 150 : ZoneNodeNotFound = false;
6164 150 : break;
6165 : }
6166 : }
6167 396 : if (!ZoneNodeNotFound) break;
6168 : }
6169 150 : if (ZoneNodeNotFound) {
6170 0 : ShowSevereError(state,
6171 0 : format("{} \"{}\" Zone terminal unit air outlet node name must be the same as a zone inlet node name.",
6172 : cCurrentModuleObject,
6173 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name));
6174 0 : ShowContinueError(state, "... Zone inlet node name is specified in ZoneHVAC:EquipmentConnections object.");
6175 0 : ShowContinueError(state,
6176 0 : format("... Zone terminal unit outlet node name = {}",
6177 0 : state.dataLoopNodes->NodeID(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum)));
6178 0 : ErrorsFound = true;
6179 : }
6180 : }
6181 :
6182 164 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInZone && state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerExists) {
6183 : // check that OA flow in cooling must be set to zero when connected to DOAS
6184 32 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow != 0) {
6185 0 : ShowWarningError(state, format("{} = {}", cCurrentModuleObject, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name));
6186 0 : ShowContinueError(state, format(".. Cooling Outdoor Air Flow Rate must be zero when {}", cCurrentModuleObject));
6187 0 : ShowContinueError(state, "..object is connected to central dedicated outdoor air system via AirTerminal:SingleDuct:Mixer");
6188 0 : ShowContinueError(state, ".. Cooling Outdoor Air Flow Rate is set to 0 and simulation continues.");
6189 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow = 0;
6190 : }
6191 : // check that OA flow in heating must be set to zero when connected to DOAS
6192 32 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow != 0) {
6193 0 : ShowWarningError(state, format("{} = {}", cCurrentModuleObject, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name));
6194 0 : ShowContinueError(state, format(".. Heating Outdoor Air Flow Rate must be zero when {}", cCurrentModuleObject));
6195 0 : ShowContinueError(state, "..object is connected to central dedicated outdoor air system via AirTerminal:SingleDuct:Mixer");
6196 0 : ShowContinueError(state, ".. Heating Outdoor Air Flow Rate is set to 0 and simulation continues.");
6197 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow = 0;
6198 : }
6199 : // check that OA flow in no cooling and no heating must be set to zero when connected to DOAS
6200 32 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow != 0) {
6201 0 : ShowWarningError(state, format("{} = {}", cCurrentModuleObject, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name));
6202 0 : ShowContinueError(state, format(".. No Load Outdoor Air Flow Rate must be zero when {}", cCurrentModuleObject));
6203 0 : ShowContinueError(state, "..object is connected to central dedicated outdoor air system via AirTerminal:SingleDuct:Mixer");
6204 0 : ShowContinueError(state, ".. No Load Outdoor Air Flow Rate is set to 0 and simulation continues.");
6205 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow = 0;
6206 : }
6207 : }
6208 164 : } // IF(ZoneEquipmentListNotChecked)THEN
6209 :
6210 : // Size TU
6211 250981 : if (state.dataHVACVarRefFlow->MySizeFlag(VRFTUNum)) {
6212 122 : if (!state.dataGlobal->ZoneSizingCalc && !state.dataGlobal->SysSizingCalc) {
6213 62 : SizeVRF(state, VRFTUNum);
6214 62 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).TerminalUnitNotSizedYet(IndexToTUInTUList) = false;
6215 62 : state.dataHVACVarRefFlow->MySizeFlag(VRFTUNum) = false;
6216 : } // IF ( .NOT. ZoneSizingCalc) THEN
6217 : } // IF (MySizeFlag(VRFTUNum)) THEN
6218 :
6219 : // Do the Begin Environment initializations
6220 250981 : if (state.dataGlobal->BeginEnvrnFlag && state.dataHVACVarRefFlow->MyEnvrnFlag(VRFTUNum)) {
6221 :
6222 : // Change the Volume Flow Rates to Mass Flow Rates
6223 :
6224 371 : RhoAir = state.dataEnvrn->StdRhoAir;
6225 : // set the mass flow rates from the input volume flow rates
6226 371 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow = RhoAir * state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow;
6227 371 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow = RhoAir * state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow;
6228 371 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow = RhoAir * state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow;
6229 371 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow = RhoAir * state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow;
6230 371 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow = RhoAir * state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow;
6231 371 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow = RhoAir * state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow;
6232 371 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow =
6233 371 : RhoAir * state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow;
6234 : // set the node max and min mass flow rates
6235 : // outside air mixer is optional, check that node num > 0
6236 371 : if (OutsideAirNode > 0) {
6237 305 : state.dataLoopNodes->Node(OutsideAirNode).MassFlowRateMax =
6238 305 : max(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow);
6239 305 : state.dataLoopNodes->Node(OutsideAirNode).MassFlowRateMin = 0.0;
6240 305 : state.dataLoopNodes->Node(OutsideAirNode).MassFlowRateMinAvail = 0.0;
6241 : }
6242 371 : state.dataLoopNodes->Node(OutNode).MassFlowRateMax =
6243 371 : max(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow);
6244 371 : state.dataLoopNodes->Node(OutNode).MassFlowRateMin = 0.0;
6245 371 : state.dataLoopNodes->Node(OutNode).MassFlowRateMinAvail = 0.0;
6246 371 : state.dataLoopNodes->Node(InNode).MassFlowRateMax =
6247 371 : max(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow);
6248 371 : state.dataLoopNodes->Node(InNode).MassFlowRateMin = 0.0;
6249 371 : state.dataLoopNodes->Node(InNode).MassFlowRateMinAvail = 0.0;
6250 371 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRelNodeNum > 0) {
6251 305 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRelNodeNum).MassFlowRateMinAvail = 0.0;
6252 : }
6253 :
6254 371 : state.dataHVACVarRefFlow->MyEnvrnFlag(VRFTUNum) = false;
6255 :
6256 371 : if (state.dataHVACVarRefFlow->VRF(VRFCond).CondenserType == DataHeatBalance::RefrigCondenserType::Water) {
6257 : rho =
6258 24 : FluidProperties::GetDensityGlycol(state,
6259 24 : state.dataPlnt->PlantLoop(state.dataHVACVarRefFlow->VRF(VRFCond).SourcePlantLoc.loopNum).FluidName,
6260 : Constant::CWInitConvTemp,
6261 24 : state.dataPlnt->PlantLoop(state.dataHVACVarRefFlow->VRF(VRFCond).SourcePlantLoc.loopNum).FluidIndex,
6262 : RoutineName);
6263 24 : state.dataHVACVarRefFlow->VRF(VRFCond).WaterCondenserDesignMassFlow = state.dataHVACVarRefFlow->VRF(VRFCond).WaterCondVolFlowRate * rho;
6264 :
6265 72 : InitComponentNodes(state,
6266 : 0.0,
6267 24 : state.dataHVACVarRefFlow->VRF(VRFCond).WaterCondenserDesignMassFlow,
6268 24 : state.dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum,
6269 24 : state.dataHVACVarRefFlow->VRF(VRFCond).CondenserOutletNodeNum);
6270 : }
6271 : // IF(MyVRFCondFlag(VRFCond))THEN
6272 371 : state.dataHVACVarRefFlow->VRF(VRFCond).HRTimer = 0.0;
6273 371 : state.dataHVACVarRefFlow->VRF(VRFCond).ModeChange = false;
6274 371 : state.dataHVACVarRefFlow->VRF(VRFCond).HRModeChange = false;
6275 371 : state.dataHVACVarRefFlow->MyVRFCondFlag(VRFCond) = false;
6276 : // END IF
6277 :
6278 371 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode > 0) {
6279 24 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num == HVAC::Coil_HeatingWater) {
6280 12 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow == DataSizing::AutoSize) {
6281 4 : WaterCoils::SimulateWaterCoilComponents(state,
6282 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName,
6283 : FirstHVACIteration,
6284 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilIndex);
6285 : // design hot water volume flow rate
6286 2 : Real64 CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(
6287 2 : state, "Coil:Heating:Water", state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName, ErrorsFound);
6288 2 : if (CoilMaxVolFlowRate != DataSizing::AutoSize) {
6289 2 : rho = FluidProperties::GetDensityGlycol(
6290 : state,
6291 2 : state.dataPlnt->PlantLoop(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilPlantLoc.loopNum).FluidName,
6292 : Constant::HWInitConvTemp,
6293 2 : state.dataPlnt->PlantLoop(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilPlantLoc.loopNum).FluidIndex,
6294 : RoutineName);
6295 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow = CoilMaxVolFlowRate * rho;
6296 : }
6297 : }
6298 : }
6299 :
6300 24 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num == HVAC::Coil_HeatingSteam) {
6301 12 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow == DataSizing::AutoSize) {
6302 6 : SteamCoils::SimulateSteamCoilComponents(state,
6303 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName,
6304 : FirstHVACIteration,
6305 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilIndex,
6306 4 : 1.0);
6307 : // design steam volume flow rate
6308 : Real64 CoilMaxVolFlowRate =
6309 2 : SteamCoils::GetCoilMaxSteamFlowRate(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilIndex, ErrorsFound);
6310 2 : if (CoilMaxVolFlowRate != DataSizing::AutoSize) {
6311 2 : int SteamIndex = 0; // fluid type index of 0 is passed if steam
6312 2 : Real64 TempSteamIn = 100.0;
6313 2 : Real64 SteamDensity = FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, SteamIndex, RoutineName);
6314 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow = CoilMaxVolFlowRate * SteamDensity;
6315 : }
6316 : }
6317 : }
6318 : // init water/steam coils min and max flow rates
6319 72 : InitComponentNodes(state,
6320 : 0.0,
6321 24 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow,
6322 24 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode,
6323 24 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidOutletNode);
6324 : }
6325 :
6326 : // the first time an air loop VRF TU is simulated set isSimulated = true so that the TU initialization
6327 : // will occur with the first TU simulated this time step. Zone VRF TUs are called during sizing which, if air
6328 : // loop TUs are included, alters when all TUs appear to have been simulated. Also, BeginEnvrnFlag is true multiple
6329 : // times during the simulation, reset each time to avoid a different order during sizing and simulation
6330 371 : if (state.dataHVACVarRefFlow->TerminalUnitList(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex).reset_isSimulatedFlags) {
6331 : // if no TUs are in the air loop or outdoor air system they will all be simulated during ManageZoneEquipment
6332 : // and there is no need to adjust the order of simulation (i.e., when isSimulated are all true for a given system)
6333 365 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInAirLoop || state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInOASys) {
6334 6 : state.dataHVACVarRefFlow->TerminalUnitList(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex).IsSimulated = true;
6335 6 : state.dataHVACVarRefFlow->TerminalUnitList(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex).reset_isSimulatedFlags = false;
6336 : }
6337 : }
6338 :
6339 : } // IF (BeginEnvrnFlag .and. MyEnvrnFlag(VRFTUNum)) THEN
6340 :
6341 : // reset environment flag for next environment
6342 250981 : if (!state.dataGlobal->BeginEnvrnFlag) {
6343 248665 : state.dataHVACVarRefFlow->MyEnvrnFlag(VRFTUNum) = true;
6344 248665 : state.dataHVACVarRefFlow->MyVRFCondFlag(VRFCond) = true;
6345 248665 : state.dataHVACVarRefFlow->TerminalUnitList(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex).reset_isSimulatedFlags = true;
6346 : }
6347 :
6348 : // If all VRF Terminal Units on this VRF AC System have been simulated, reset the IsSimulated flag
6349 : // The condenser will be simulated after all terminal units have been simulated (see Sub SimulateVRF)
6350 250981 : if (all(state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).IsSimulated)) {
6351 : // this should be the first time through on the next iteration. All TU's and condenser have been simulated.
6352 : // reset simulation flag for each terminal unit
6353 57038 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).IsSimulated = false;
6354 : // after all TU's have been simulated, reset operating mode flag if necessary
6355 57038 : if (state.dataHVACVarRefFlow->LastModeHeating(VRFCond) && state.dataHVACVarRefFlow->CoolingLoad(VRFCond)) {
6356 85 : state.dataHVACVarRefFlow->LastModeCooling(VRFCond) = true;
6357 85 : state.dataHVACVarRefFlow->LastModeHeating(VRFCond) = false;
6358 : // SwitchedMode(VRFCond) = .TRUE.
6359 : }
6360 57038 : if (state.dataHVACVarRefFlow->LastModeCooling(VRFCond) && state.dataHVACVarRefFlow->HeatingLoad(VRFCond)) {
6361 71 : state.dataHVACVarRefFlow->LastModeHeating(VRFCond) = true;
6362 71 : state.dataHVACVarRefFlow->LastModeCooling(VRFCond) = false;
6363 : // SwitchedMode(VRFCond) = .TRUE.
6364 : }
6365 : } // IF(ALL(TerminalUnitList(VRFTU(VRFTUNum)%TUListIndex)%IsSimulated))THEN
6366 :
6367 : // get operating capacity of water and steam coil
6368 250981 : if (FirstHVACIteration) {
6369 125697 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode > 0) {
6370 7308 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num == HVAC::Coil_HeatingWater) {
6371 : // set hot water full flow rate for sizing
6372 3654 : Real64 mdot = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow;
6373 7308 : PlantUtilities::SetComponentFlowRate(state,
6374 : mdot,
6375 3654 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode,
6376 3654 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidOutletNode,
6377 3654 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilPlantLoc);
6378 :
6379 : // simulate water coil to find operating capacity
6380 7308 : WaterCoils::SimulateWaterCoilComponents(state,
6381 3654 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName,
6382 : FirstHVACIteration,
6383 3654 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilIndex,
6384 : SuppHeatCoilCapacity);
6385 3654 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSuppHeatingCapacity = SuppHeatCoilCapacity;
6386 : } // from iF VRFTU(VRFTUNum).SuppHeatCoilType_Num == HVAC::Coil_HeatingWater
6387 7308 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num == HVAC::Coil_HeatingSteam) {
6388 : // set hot water full flow rate for sizing
6389 3654 : Real64 mdot = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow;
6390 7308 : PlantUtilities::SetComponentFlowRate(state,
6391 : mdot,
6392 3654 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode,
6393 3654 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidOutletNode,
6394 3654 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilPlantLoc);
6395 :
6396 : // simulate steam coil to find operating capacity
6397 10962 : SteamCoils::SimulateSteamCoilComponents(state,
6398 3654 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName,
6399 : FirstHVACIteration,
6400 3654 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilIndex,
6401 7308 : 1.0,
6402 : ErrorsFound); // QCoilReq, simulate any load > 0 to get max capacity of steam coil
6403 3654 : SuppHeatCoilCapacity =
6404 3654 : SteamCoils::GetCoilCapacity(state, "Coil:Heating:Steam", state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName, ErrorsFound);
6405 :
6406 3654 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSuppHeatingCapacity = SuppHeatCoilCapacity;
6407 : } // from if VRFTU( VRFTUNum ).SuppHeatCoilType_Num == HVAC::Coil_HeatingSteam
6408 : }
6409 : }
6410 : // initialize water/steam coil inlet flow rate to zero
6411 250981 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode > 0) {
6412 14588 : Real64 mdot = 0.0;
6413 29176 : PlantUtilities::SetComponentFlowRate(state,
6414 : mdot,
6415 14588 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode,
6416 14588 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidOutletNode,
6417 14588 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilPlantLoc);
6418 : }
6419 :
6420 : // one-time checks of flow rate vs fan flow rate
6421 250981 : if (state.dataHVACVarRefFlow->MyVRFFlag(VRFTUNum)) {
6422 182 : if (!state.dataGlobal->ZoneSizingCalc && !state.dataGlobal->SysSizingCalc) {
6423 122 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanPlace != HVAC::FanPlace::Invalid) { // was > 0 (is 0 invalid?)
6424 121 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate != AutoSize) {
6425 :
6426 61 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow >
6427 61 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate) {
6428 0 : ShowWarningError(state,
6429 0 : format("InitVRF: VRF Terminal Unit = [{}, \"{}\"]",
6430 0 : tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type],
6431 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name));
6432 0 : ShowContinueError(state, "... has Supply Air Flow Rate During Cooling Operation > Max Fan Volume Flow Rate, should be <=");
6433 0 : ShowContinueError(state,
6434 0 : format("... Supply Air Flow Rate During Cooling Operation = {:.4R} m3/s",
6435 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow));
6436 0 : ShowContinueError(state,
6437 0 : format("... Max Fan Volume Flow Rate = {:.4R} m3/s",
6438 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate));
6439 0 : ShowContinueError(
6440 : state, "...the supply air flow rate during cooling operation will be reduced to match and the simulation continues.");
6441 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate;
6442 : }
6443 :
6444 61 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow >
6445 61 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate) {
6446 0 : ShowWarningError(state,
6447 0 : format("InitVRF: VRF Terminal Unit = [{}, \"{}\"]",
6448 0 : tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type],
6449 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name));
6450 0 : ShowContinueError(state, "... has Supply Air Flow Rate When No Cooling is Needed > Max Fan Volume Flow Rate, should be <=");
6451 0 : ShowContinueError(state,
6452 0 : format("... Supply Air Flow Rate When No Cooling is Needed = {:.4R} m3/s",
6453 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow));
6454 0 : ShowContinueError(state,
6455 0 : format("... Max Fan Volume Flow Rate = {:.4R} m3/s",
6456 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate));
6457 0 : ShowContinueError(
6458 : state, "...the supply air flow rate when no cooling is needed will be reduced to match and the simulation continues.");
6459 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow =
6460 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate;
6461 : }
6462 :
6463 61 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow > state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow) {
6464 0 : ShowWarningError(state,
6465 0 : format("InitVRF: VRF Terminal Unit = [{}, \"{}\"]",
6466 0 : tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type],
6467 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name));
6468 0 : ShowContinueError(
6469 : state,
6470 : "...The Outdoor Air Flow Rate During Cooling Operation exceeds the Supply Air Flow Rate During Cooling Operation.");
6471 0 : ShowContinueError(state,
6472 0 : format("...Outdoor Air Flow Rate During Cooling Operation = {:.4R} m3/s",
6473 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow));
6474 0 : ShowContinueError(state,
6475 0 : format("... Supply Air Flow Rate During Cooling Operation = {:.4R} m3/s",
6476 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow));
6477 0 : ShowContinueError(state, "...the outdoor air flow rate will be reduced to match and the simulation continues.");
6478 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow;
6479 : }
6480 :
6481 61 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow >
6482 61 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate) {
6483 0 : ShowWarningError(state,
6484 0 : format("InitVRF: VRF Terminal Unit = [{}, \"{}\"]",
6485 0 : tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type],
6486 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name));
6487 0 : ShowContinueError(state, "... has Supply Air Flow Rate During Heating Operation > Max Fan Volume Flow Rate, should be <=");
6488 0 : ShowContinueError(state,
6489 0 : format("... Supply Air Flow Rate During Heating Operation = {:.4R} m3/s",
6490 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow));
6491 0 : ShowContinueError(state,
6492 0 : format("... Max Fan Volume Flow Rate = {:.4R} m3/s",
6493 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate));
6494 0 : ShowContinueError(
6495 : state, "...the supply air flow rate during cooling operation will be reduced to match and the simulation continues.");
6496 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate;
6497 : }
6498 :
6499 61 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow >
6500 61 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate) {
6501 0 : ShowWarningError(state,
6502 0 : format("InitVRF: VRF Terminal Unit = [{}, \"{}\"]",
6503 0 : tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type],
6504 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name));
6505 0 : ShowContinueError(state, "... has Supply Air Flow Rate When No Heating is Needed > Max Fan Volume Flow Rate, should be <=");
6506 0 : ShowContinueError(state,
6507 0 : format("... Supply Air Flow Rate When No Heating is Needed = {:.4R} m3/s",
6508 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow));
6509 0 : ShowContinueError(state,
6510 0 : format("... Max Fan Volume Flow Rate = {:.4R} m3/s",
6511 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate));
6512 0 : ShowContinueError(
6513 : state, "...the supply air flow rate when no cooling is needed will be reduced to match and the simulation continues.");
6514 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow =
6515 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate;
6516 : }
6517 :
6518 61 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow > state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow) {
6519 0 : ShowWarningError(state,
6520 0 : format("InitVRF: VRF Terminal Unit = [{}, \"{}\"]",
6521 0 : tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type],
6522 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name));
6523 0 : ShowContinueError(
6524 : state,
6525 : "...The Outdoor Air Flow Rate During Heating Operation exceeds the Supply Air Flow Rate During Heating Operation.");
6526 0 : ShowContinueError(state,
6527 0 : format("...Outdoor Air Flow Rate During Heating Operation = {:.4R} m3/s",
6528 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow));
6529 0 : ShowContinueError(state,
6530 0 : format("... Supply Air Flow Rate During Heating Operation = {:.4R} m3/s",
6531 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow));
6532 0 : ShowContinueError(state, "...the outdoor air flow rate will be reduced to match and the simulation continues.");
6533 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow;
6534 : }
6535 :
6536 61 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow >
6537 61 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate) {
6538 0 : ShowWarningError(state,
6539 0 : format("InitVRF: VRF Terminal Unit = [{}, \"{}\"]",
6540 0 : tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type],
6541 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name));
6542 0 : ShowContinueError(
6543 : state, "... has a Outdoor Air Flow Rate When No Cooling or Heating is Needed > Max Fan Volume Flow Rate, should be <=");
6544 0 : ShowContinueError(state,
6545 0 : format("... Outdoor Air Flow Rate When No Cooling or Heating is Needed = {:.4R} m3/s",
6546 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow));
6547 0 : ShowContinueError(state,
6548 0 : format("... Max Fan Volume Flow Rate = {:.4R} m3/s",
6549 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate));
6550 0 : ShowContinueError(state,
6551 : "...the outdoor air flow rate when no cooling or heating is needed will be reduced to match and the "
6552 : "simulation continues.");
6553 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow =
6554 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate;
6555 : }
6556 :
6557 61 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate > 0.0) {
6558 122 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingSpeedRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow /
6559 61 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate;
6560 122 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingSpeedRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow /
6561 61 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate;
6562 61 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoHeatingSpeedRatio =
6563 61 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow /
6564 61 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate;
6565 61 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio =
6566 61 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow /
6567 61 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate;
6568 : }
6569 :
6570 61 : state.dataHVACVarRefFlow->MyVRFFlag(VRFTUNum) = false;
6571 : } else {
6572 60 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate =
6573 60 : state.dataFans->fans(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex)->maxAirFlowRate;
6574 : }
6575 : } else {
6576 1 : state.dataHVACVarRefFlow->MyVRFFlag(VRFTUNum) = false;
6577 : }
6578 : }
6579 : } // IF(MyVRFFlag(VRFTUNum))THEN
6580 :
6581 : // calculate end time of current time step to determine if max capacity reset is required
6582 250981 : CurrentEndTime = double((state.dataGlobal->DayOfSim - 1) * 24) + state.dataGlobal->CurrentTime - state.dataGlobal->TimeStepZone +
6583 250981 : state.dataHVACGlobal->SysTimeElapsed;
6584 :
6585 : // Initialize the maximum allowed terminal unit capacity. Total terminal unit capacity must not
6586 : // exceed the available condenser capacity. This variable is used to limit the terminal units
6587 : // providing more capacity than allowed. Example: TU loads are 1-ton, 2-ton, 3-ton, and 4-ton connected
6588 : // to a condenser having only 9-tons available. This variable will be set to 3-tons and the 4-ton
6589 : // terminal unit will be limited to 3-tons (see SimVRFCondenser where this variable is calculated).
6590 353219 : if (CurrentEndTime > state.dataHVACVarRefFlow->CurrentEndTimeLast || TimeStepSysLast > state.dataHVACGlobal->TimeStepSys ||
6591 102238 : (FirstHVACIteration && state.dataHVACVarRefFlow->MyBeginTimeStepFlag(VRFCond))) {
6592 28472 : state.dataHVACVarRefFlow->MaxCoolingCapacity(VRFCond) = MaxCap;
6593 28472 : state.dataHVACVarRefFlow->MaxHeatingCapacity(VRFCond) = MaxCap;
6594 28472 : state.dataHVACVarRefFlow->MyBeginTimeStepFlag(VRFCond) = false;
6595 : }
6596 :
6597 250981 : if (!FirstHVACIteration) state.dataHVACVarRefFlow->MyBeginTimeStepFlag(VRFCond) = true;
6598 :
6599 : // Do the following initializations (every time step).
6600 :
6601 250981 : TimeStepSysLast = state.dataHVACGlobal->TimeStepSys;
6602 250981 : state.dataHVACVarRefFlow->CurrentEndTimeLast = CurrentEndTime;
6603 :
6604 250981 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr > 0) {
6605 247793 : if (GetCurrentScheduleValue(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr) == 0.0) {
6606 69438 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOp = HVAC::FanOp::Cycling;
6607 : } else {
6608 178355 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOp = HVAC::FanOp::Continuous;
6609 : }
6610 : }
6611 :
6612 : // if condenser is off, all terminal unit coils are off
6613 250981 : if (GetCurrentScheduleValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).SchedPtr) == 0.0) {
6614 20400 : state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false;
6615 20400 : state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false;
6616 : } else {
6617 :
6618 : //*** Operating Mode Initialization done at beginning of each iteration ***!
6619 : //*** assumes all TU's and Condenser were simulated last iteration ***!
6620 : //*** this code is done ONCE each iteration when all TU's IsSimulated flag is FALSE ***!
6621 : // Determine operating mode prior to simulating any terminal units connected to a VRF condenser
6622 : // this should happen at the beginning of a time step where all TU's are polled to see what
6623 : // mode the heat pump condenser will operate in
6624 230581 : if (!any(state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).IsSimulated)) {
6625 52972 : InitializeOperatingMode(state, FirstHVACIteration, VRFCond, TUListIndex, OnOffAirFlowRatio);
6626 : }
6627 : //*** End of Operating Mode Initialization done at beginning of each iteration ***!
6628 :
6629 : // disable VRF system when outside limits of operation based on OAT
6630 230581 : EnableSystem = false; // flag used to switch operating modes when OAT is outside operating limits
6631 230581 : if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond)) {
6632 128171 : if ((OutsideDryBulbTemp < state.dataHVACVarRefFlow->VRF(VRFCond).MinOATCooling ||
6633 128171 : OutsideDryBulbTemp > state.dataHVACVarRefFlow->VRF(VRFCond).MaxOATCooling) &&
6634 0 : any(state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).CoolingCoilPresent)) {
6635 0 : state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false;
6636 : // test if heating load exists, account for thermostat control type
6637 0 : switch (state.dataHVACVarRefFlow->VRF(VRFCond).ThermostatPriority) {
6638 0 : case ThermostatCtrlType::LoadPriority:
6639 : case ThermostatCtrlType::ZonePriority: {
6640 0 : if (state.dataHVACVarRefFlow->SumHeatingLoads(VRFCond) > 0.0) EnableSystem = true;
6641 0 : } break;
6642 0 : case ThermostatCtrlType::ThermostatOffsetPriority: {
6643 0 : if (state.dataHVACVarRefFlow->MinDeltaT(VRFCond) < 0.0) EnableSystem = true;
6644 0 : } break;
6645 0 : case ThermostatCtrlType::ScheduledPriority:
6646 : case ThermostatCtrlType::MasterThermostatPriority: {
6647 : // can't switch modes if scheduled (i.e., would be switching to unscheduled mode)
6648 : // or master TSTAT used (i.e., master zone only has a specific load - can't switch)
6649 0 : } break;
6650 0 : default:
6651 0 : break;
6652 : }
6653 0 : if (EnableSystem) {
6654 0 : if ((OutsideDryBulbTemp >= state.dataHVACVarRefFlow->VRF(VRFCond).MinOATHeating &&
6655 0 : OutsideDryBulbTemp <= state.dataHVACVarRefFlow->VRF(VRFCond).MaxOATHeating) &&
6656 0 : any(state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HeatingCoilPresent)) {
6657 0 : state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = true;
6658 : } else {
6659 0 : if (any(state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).CoolingCoilAvailable)) {
6660 0 : if (state.dataHVACVarRefFlow->VRF(VRFCond).CoolingMaxTempLimitIndex == 0) {
6661 0 : ShowWarningMessage(state,
6662 0 : format("{} \"{}\".",
6663 0 : cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum),
6664 0 : state.dataHVACVarRefFlow->VRF(VRFCond).Name));
6665 0 : ShowContinueError(state,
6666 : "...InitVRF: VRF Heat Pump Min/Max Operating Temperature in Cooling Mode Limits have been "
6667 : "exceeded and VRF system is disabled.");
6668 0 : if (state.dataHVACVarRefFlow->VRF(VRFCond).CondenserType == DataHeatBalance::RefrigCondenserType::Water) {
6669 0 : ShowContinueError(state,
6670 0 : format("... Outdoor Unit Inlet Water Temperature = {:.3T}", OutsideDryBulbTemp));
6671 : } else {
6672 0 : ShowContinueError(state,
6673 0 : format("... Outdoor Unit Inlet Air Temperature = {:.3T}", OutsideDryBulbTemp));
6674 : }
6675 0 : ShowContinueError(state,
6676 0 : format("... Cooling Minimum Outdoor Unit Inlet Temperature = {:.3T}",
6677 0 : state.dataHVACVarRefFlow->VRF(VRFCond).MinOATCooling));
6678 0 : ShowContinueError(state,
6679 0 : format("... Cooling Maximum Outdoor Unit Inlet Temperature = {:.3T}",
6680 0 : state.dataHVACVarRefFlow->VRF(VRFCond).MaxOATCooling));
6681 0 : ShowContinueErrorTimeStamp(state, "... Check VRF Heat Pump Min/Max Outdoor Temperature in Cooling Mode limits.");
6682 : }
6683 0 : ShowRecurringWarningErrorAtEnd(state,
6684 0 : std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)) + " \"" +
6685 0 : state.dataHVACVarRefFlow->VRF(VRFCond).Name +
6686 : "\" -- Exceeded VRF Heat Pump min/max cooling temperature limit error continues...",
6687 0 : state.dataHVACVarRefFlow->VRF(VRFCond).CoolingMaxTempLimitIndex,
6688 : OutsideDryBulbTemp,
6689 : OutsideDryBulbTemp);
6690 : }
6691 : }
6692 : } else {
6693 0 : if (any(state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).CoolingCoilAvailable)) {
6694 0 : if (state.dataHVACVarRefFlow->VRF(VRFCond).CoolingMaxTempLimitIndex == 0) {
6695 0 : ShowWarningMessage(state,
6696 0 : format("{} \"{}\".",
6697 0 : cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum),
6698 0 : state.dataHVACVarRefFlow->VRF(VRFCond).Name));
6699 0 : ShowContinueError(state,
6700 : "...InitVRF: VRF Heat Pump Min/Max Operating Temperature in Cooling Mode Limits have been exceeded "
6701 : "and VRF system is disabled.");
6702 0 : if (state.dataHVACVarRefFlow->VRF(VRFCond).CondenserType == DataHeatBalance::RefrigCondenserType::Water) {
6703 0 : ShowContinueError(state, format("... Outdoor Unit Inlet Water Temperature = {:.3T}", OutsideDryBulbTemp));
6704 : } else {
6705 0 : ShowContinueError(state,
6706 0 : format("... Outdoor Unit Inlet Air Temperature = {:.3T}", OutsideDryBulbTemp));
6707 : }
6708 0 : ShowContinueError(state,
6709 0 : format("... Cooling Minimum Outdoor Unit Inlet Temperature = {:.3T}",
6710 0 : state.dataHVACVarRefFlow->VRF(VRFCond).MinOATCooling));
6711 0 : ShowContinueError(state,
6712 0 : format("... Cooling Maximum Outdoor Unit Inlet Temperature = {:.3T}",
6713 0 : state.dataHVACVarRefFlow->VRF(VRFCond).MaxOATCooling));
6714 0 : ShowContinueErrorTimeStamp(state, "... Check VRF Heat Pump Min/Max Outdoor Temperature in Cooling Mode limits.");
6715 : }
6716 0 : ShowRecurringWarningErrorAtEnd(state,
6717 0 : std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)) + " \"" +
6718 0 : state.dataHVACVarRefFlow->VRF(VRFCond).Name +
6719 : "\" -- Exceeded VRF Heat Pump min/max cooling temperature limit error continues...",
6720 0 : state.dataHVACVarRefFlow->VRF(VRFCond).CoolingMaxTempLimitIndex,
6721 : OutsideDryBulbTemp,
6722 : OutsideDryBulbTemp);
6723 : }
6724 : }
6725 : }
6726 102410 : } else if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond)) {
6727 94131 : if ((OutsideDryBulbTemp < state.dataHVACVarRefFlow->VRF(VRFCond).MinOATHeating ||
6728 94131 : OutsideDryBulbTemp > state.dataHVACVarRefFlow->VRF(VRFCond).MaxOATHeating) &&
6729 0 : any(state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HeatingCoilPresent)) {
6730 0 : state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false;
6731 : // test if cooling load exists, account for thermostat control type
6732 0 : switch (state.dataHVACVarRefFlow->VRF(VRFCond).ThermostatPriority) {
6733 0 : case ThermostatCtrlType::LoadPriority:
6734 : case ThermostatCtrlType::ZonePriority: {
6735 0 : if (state.dataHVACVarRefFlow->SumCoolingLoads(VRFCond) < 0.0) EnableSystem = true;
6736 0 : } break;
6737 0 : case ThermostatCtrlType::ThermostatOffsetPriority: {
6738 0 : if (state.dataHVACVarRefFlow->MaxDeltaT(VRFCond) > 0.0) EnableSystem = true;
6739 0 : } break;
6740 0 : case ThermostatCtrlType::ScheduledPriority:
6741 : case ThermostatCtrlType::MasterThermostatPriority: {
6742 0 : } break;
6743 0 : default:
6744 0 : break;
6745 : }
6746 0 : if (EnableSystem) {
6747 0 : if ((OutsideDryBulbTemp >= state.dataHVACVarRefFlow->VRF(VRFCond).MinOATCooling &&
6748 0 : OutsideDryBulbTemp <= state.dataHVACVarRefFlow->VRF(VRFCond).MaxOATCooling) &&
6749 0 : any(state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).CoolingCoilPresent)) {
6750 0 : state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = true;
6751 : } else {
6752 0 : if (any(state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HeatingCoilAvailable)) {
6753 0 : if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatingMaxTempLimitIndex == 0) {
6754 0 : ShowWarningMessage(state,
6755 0 : format("{} \"{}\".",
6756 0 : cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum),
6757 0 : state.dataHVACVarRefFlow->VRF(VRFCond).Name));
6758 0 : ShowContinueError(state,
6759 : "...InitVRF: VRF Heat Pump Min/Max Operating Temperature in Heating Mode Limits have been "
6760 : "exceeded and VRF system is disabled.");
6761 0 : if (state.dataHVACVarRefFlow->VRF(VRFCond).CondenserType == DataHeatBalance::RefrigCondenserType::Water) {
6762 0 : ShowContinueError(state,
6763 0 : format("... Outdoor Unit Inlet Water Temperature = {:.3T}", OutsideDryBulbTemp));
6764 : } else {
6765 0 : ShowContinueError(state,
6766 0 : format("... Outdoor Unit Inlet Air Temperature = {:.3T}", OutsideDryBulbTemp));
6767 : }
6768 0 : ShowContinueError(state,
6769 0 : format("... Heating Minimum Outdoor Unit Inlet Temperature = {:.3T}",
6770 0 : state.dataHVACVarRefFlow->VRF(VRFCond).MinOATHeating));
6771 0 : ShowContinueError(state,
6772 0 : format("... Heating Maximum Outdoor Unit Inlet Temperature = {:.3T}",
6773 0 : state.dataHVACVarRefFlow->VRF(VRFCond).MaxOATHeating));
6774 0 : ShowContinueErrorTimeStamp(state, "... Check VRF Heat Pump Min/Max Outdoor Temperature in Heating Mode limits.");
6775 : }
6776 0 : ShowRecurringWarningErrorAtEnd(state,
6777 0 : std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)) + " \"" +
6778 0 : state.dataHVACVarRefFlow->VRF(VRFCond).Name +
6779 : "\" -- Exceeded VRF Heat Pump min/max heating temperature limit error continues...",
6780 0 : state.dataHVACVarRefFlow->VRF(VRFCond).HeatingMaxTempLimitIndex,
6781 : OutsideDryBulbTemp,
6782 : OutsideDryBulbTemp);
6783 : }
6784 : }
6785 : } else {
6786 0 : if (any(state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HeatingCoilAvailable)) {
6787 0 : if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatingMaxTempLimitIndex == 0) {
6788 0 : ShowWarningMessage(state,
6789 0 : format("{} \"{}\".",
6790 0 : cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum),
6791 0 : state.dataHVACVarRefFlow->VRF(VRFCond).Name));
6792 0 : ShowContinueError(state,
6793 : "...InitVRF: VRF Heat Pump Min/Max Operating Temperature in Heating Mode Limits have been exceeded "
6794 : "and VRF system is disabled.");
6795 0 : if (state.dataHVACVarRefFlow->VRF(VRFCond).CondenserType == DataHeatBalance::RefrigCondenserType::Water) {
6796 0 : ShowContinueError(state, format("... Outdoor Unit Inlet Water Temperature = {:.3T}", OutsideDryBulbTemp));
6797 : } else {
6798 0 : ShowContinueError(state, format("... Outdoor Unit Inlet Air Temperature = {:.3T}", OutsideDryBulbTemp));
6799 : }
6800 0 : ShowContinueError(state,
6801 0 : format("... Heating Minimum Outdoor Unit Inlet Temperature = {:.3T}",
6802 0 : state.dataHVACVarRefFlow->VRF(VRFCond).MinOATHeating));
6803 0 : ShowContinueError(state,
6804 0 : format("... Heating Maximum Outdoor Unit Inlet Temperature = {:.3T}",
6805 0 : state.dataHVACVarRefFlow->VRF(VRFCond).MaxOATHeating));
6806 0 : ShowContinueErrorTimeStamp(state, "... Check VRF Heat Pump Min/Max Outdoor Temperature in Heating Mode limits.");
6807 : }
6808 0 : ShowRecurringWarningErrorAtEnd(state,
6809 0 : std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)) + " \"" +
6810 0 : state.dataHVACVarRefFlow->VRF(VRFCond).Name +
6811 : "\" -- Exceeded VRF Heat Pump min/max heating temperature limit error continues...",
6812 0 : state.dataHVACVarRefFlow->VRF(VRFCond).HeatingMaxTempLimitIndex,
6813 : OutsideDryBulbTemp,
6814 : OutsideDryBulbTemp);
6815 : }
6816 : }
6817 : }
6818 : }
6819 :
6820 : } // IF (GetCurrentScheduleValue(state, VRF(VRFCond)%SchedPtr) .EQ. 0.0) THEN
6821 :
6822 : // initialize terminal unit flow rate
6823 407831 : if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond) ||
6824 156850 : (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed &&
6825 23602 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList))) {
6826 94160 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) {
6827 79440 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate =
6828 79440 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow;
6829 79440 : state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow;
6830 : } else {
6831 14720 : if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInOASys)
6832 13355 : state.dataLoopNodes->Node(InNode).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow;
6833 : }
6834 185483 : } else if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond) ||
6835 28662 : (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed &&
6836 557 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList))) {
6837 128337 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) {
6838 109917 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate =
6839 109917 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow;
6840 109917 : state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow;
6841 : } else {
6842 18420 : if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInOASys)
6843 16608 : state.dataLoopNodes->Node(InNode).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow;
6844 : }
6845 : } else {
6846 28484 : if (state.dataHVACVarRefFlow->LastModeCooling(VRFCond)) {
6847 13172 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) {
6848 12616 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate =
6849 12616 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow;
6850 12616 : state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow;
6851 : } else {
6852 556 : if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInOASys)
6853 545 : state.dataLoopNodes->Node(InNode).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow;
6854 : }
6855 15312 : } else if (state.dataHVACVarRefFlow->LastModeHeating(VRFCond)) {
6856 15312 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) {
6857 15165 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate =
6858 15165 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow;
6859 15165 : state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow;
6860 : } else {
6861 147 : if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInOASys)
6862 147 : state.dataLoopNodes->Node(InNode).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow;
6863 : }
6864 : }
6865 : }
6866 :
6867 250981 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerExists) {
6868 : // There is an air terminal mixer
6869 30655 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerType == HVAC::MixerType::InletSide) { // if there is an inlet side air terminal mixer
6870 : // set the primary air inlet mass flow rate
6871 18393 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerPriNode).MassFlowRate =
6872 18393 : min(state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerPriNode).MassFlowRateMaxAvail,
6873 18393 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate);
6874 : // now calculate the the mixer outlet air conditions (and the secondary air inlet flow rate). The mixer outlet flow rate has already
6875 : // been set above (it is the "inlet" node flow rate)
6876 36786 : SimATMixer(state,
6877 18393 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerName,
6878 : FirstHVACIteration,
6879 18393 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerIndex);
6880 : }
6881 : } else {
6882 220326 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed)
6883 217138 : MixedAir::SimOAMixer(
6884 217138 : state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerName, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerIndex);
6885 : }
6886 250981 : OnOffAirFlowRatio = 1.0;
6887 :
6888 : // these flags are used in Subroutine CalcVRF to turn on the correct coil (heating or cooling)
6889 : // valid operating modes
6890 : // Heat Pump (heat recovery flags are set to FALSE):
6891 : // CoolingLoad(VRFCond) - TU can only operate in this mode if heat recovery is not used and there is a cooling load
6892 : // HeatingLoad(VRFCond) - TU can only operate in this mode if heat recovery is not used and there is a heating load
6893 : // Heat Recovery (heat pump flags are set same as for Heat Pump operation):
6894 : // TerminalUnitList(TUListIndex)%HRCoolRequest(IndexToTUInTUList) - TU will operate in this mode if heat recovery is used
6895 : // TerminalUnitList(TUListIndex)%HRHeatRequest(IndexToTUInTUList) - TU will operate in this mode if heat recovery is used
6896 :
6897 250981 : getVRFTUZoneLoad(state, VRFTUNum, QZnReq, LoadToHeatingSP, LoadToCoolingSP, false);
6898 :
6899 250981 : if (std::abs(QZnReq) < HVAC::SmallLoad) QZnReq = 0.0;
6900 : // set initial terminal unit operating mode for heat recovery
6901 : // operating mode for non-heat recovery set above using CoolingLoad(VRFCond) or HeatingLoad(VRFCond) variables
6902 : // first turn off terminal unit
6903 250981 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false;
6904 250981 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false;
6905 : // then set according to LoadToXXXXingSP variables
6906 250981 : if (LoadToCoolingSP < -1.0 * HVAC::SmallLoad) {
6907 110419 : if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond) ||
6908 208 : state.dataHVACVarRefFlow->HeatingLoad(VRFCond)) { // don't allow heat recovery if control logic dictates unit is off
6909 110034 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = true;
6910 : }
6911 : }
6912 250981 : if (LoadToHeatingSP > HVAC::SmallLoad) {
6913 205956 : if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond) ||
6914 102761 : state.dataHVACVarRefFlow->HeatingLoad(VRFCond)) { // don't allow heat recovery if control logic dictates unit is off
6915 90710 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = true;
6916 : }
6917 : }
6918 250981 : if (LoadToCoolingSP > 0.0 && LoadToHeatingSP < 0.0) QZnReq = 0.0;
6919 :
6920 : // next check for overshoot when constant fan mode is used
6921 : // check operating load to see if OA will overshoot setpoint temperature when constant fan mode is used
6922 435076 : if ((state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOp == HVAC::FanOp::Continuous || state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerExists) &&
6923 184095 : !state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isSetPointControlled) {
6924 180907 : SetCompFlowRate(state, VRFTUNum, VRFCond, true);
6925 :
6926 180907 : if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmType == AlgorithmType::FluidTCtrl) {
6927 : // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control
6928 58545 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF_FluidTCtrl(
6929 : state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
6930 : } else {
6931 : // Algorithm Type: VRF model based on system curve
6932 122362 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF(
6933 : state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
6934 : }
6935 :
6936 : // If the Terminal Unit has a net cooling capacity (TempOutput < 0) and
6937 : // the zone temp is above the Tstat heating setpoint (QToHeatSetPt < 0)
6938 : // see if the terminal unit operation will exceed the setpoint
6939 : // 4 tests here to cover all possibilities:
6940 : // IF(TempOutput < 0.0d0 .AND. LoadToHeatingSP .LT. 0.0d0)THEN
6941 : // ELSE IF(TempOutput .GT. 0.0d0 .AND. LoadToCoolingSP .GT. 0.0d0)THEN
6942 : // ELSE IF(TempOutput .GT. 0.0d0 .AND. LoadToCoolingSP .LT. 0.0d0)THEN
6943 : // ELSE IF(TempOutput < 0.0d0 .AND. LoadToHeatingSP .GT. 0.0d0)THEN
6944 : // END IF
6945 : // could compress these to 2 complex IF's but logic inside each would get more complex
6946 180907 : if (TempOutput < 0.0 && LoadToHeatingSP < 0.0) {
6947 : // If the net cooling capacity overshoots the heating setpoint count as heating load
6948 9140 : if (TempOutput < LoadToHeatingSP) {
6949 : // Don't count as heating load unless mode is allowed. Also check for floating zone.
6950 1604 : if (state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) !=
6951 3208 : HVAC::ThermostatType::SingleCooling &&
6952 1604 : state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) !=
6953 : HVAC::ThermostatType::Uncontrolled) {
6954 1604 : if (!state.dataHVACVarRefFlow->LastModeHeating(VRFCond)) {
6955 : // system last operated in cooling mode, change air flows and repeat coil off capacity test
6956 10 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) {
6957 9 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate =
6958 9 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow;
6959 9 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).MassFlowRate =
6960 9 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow;
6961 9 : MixedAir::SimOAMixer(
6962 9 : state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerName, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerIndex);
6963 : } else {
6964 1 : state.dataLoopNodes->Node(InNode).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow;
6965 : }
6966 :
6967 10 : if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmType == AlgorithmType::FluidTCtrl) {
6968 : // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control
6969 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF_FluidTCtrl(
6970 : state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
6971 : } else {
6972 : // Algorithm Type: VRF model based on system curve
6973 8 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF(
6974 : state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
6975 : }
6976 :
6977 : // if zone temp will overshoot, pass the LoadToHeatingSP as the load to meet
6978 10 : if (TempOutput < LoadToHeatingSP) {
6979 10 : QZnReq = LoadToHeatingSP;
6980 10 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = true;
6981 10 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false;
6982 : }
6983 : } else {
6984 : // last mode was heating, zone temp will overshoot heating setpoint, reset QznReq to LoadtoHeatingSP
6985 1594 : QZnReq = LoadToHeatingSP;
6986 1594 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = true;
6987 1594 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false;
6988 : }
6989 : }
6990 7536 : } else if (TempOutput > LoadToCoolingSP && LoadToCoolingSP < 0.0) {
6991 : // If the net cooling capacity does not meet the zone cooling load enable cooling
6992 814 : QZnReq = LoadToCoolingSP;
6993 814 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false;
6994 814 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = true;
6995 6722 : } else if (TempOutput < LoadToCoolingSP && LoadToCoolingSP < 0.0) {
6996 : // If the net cooling capacity meets the zone cooling load but does not overshoot heating setpoint
6997 132 : QZnReq = 0.0;
6998 132 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false;
6999 132 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false;
7000 : }
7001 : // If the terminal unit has a net heating capacity and the zone temp is below the Tstat cooling setpoint
7002 : // see if the terminal unit operation will exceed the setpoint
7003 171767 : } else if (TempOutput > 0.0 && LoadToCoolingSP > 0.0) {
7004 : // If the net heating capacity overshoots the cooling setpoint count as cooling load
7005 23519 : if (TempOutput > LoadToCoolingSP) {
7006 : // Don't count as cooling load unless mode is allowed. Also check for floating zone.
7007 8225 : if (state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) !=
7008 16450 : HVAC::ThermostatType::SingleHeating &&
7009 8225 : state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) !=
7010 : HVAC::ThermostatType::Uncontrolled) {
7011 8225 : if (!state.dataHVACVarRefFlow->LastModeCooling(VRFCond)) {
7012 28 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) {
7013 24 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate =
7014 24 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow;
7015 24 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).MassFlowRate =
7016 24 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow;
7017 24 : MixedAir::SimOAMixer(
7018 24 : state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerName, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerIndex);
7019 : } else {
7020 4 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate =
7021 4 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow;
7022 : }
7023 :
7024 28 : if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmType == AlgorithmType::FluidTCtrl) {
7025 : // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control
7026 6 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF_FluidTCtrl(
7027 : state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
7028 : } else {
7029 : // Algorithm Type: VRF model based on system curve
7030 22 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF(
7031 : state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
7032 : }
7033 :
7034 : // if zone temp will overshoot, pass the LoadToCoolingSP as the load to meet
7035 28 : if (TempOutput > LoadToCoolingSP) {
7036 28 : QZnReq = LoadToCoolingSP;
7037 28 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = true;
7038 28 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false;
7039 : }
7040 : } else {
7041 8197 : QZnReq = LoadToCoolingSP;
7042 8197 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = true;
7043 8197 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false;
7044 : }
7045 : }
7046 15294 : } else if (TempOutput < LoadToHeatingSP) {
7047 : // Don't count as heating load unless mode is allowed. Also check for floating zone.
7048 10469 : if (state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) !=
7049 20938 : HVAC::ThermostatType::SingleCooling &&
7050 10469 : state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) !=
7051 : HVAC::ThermostatType::Uncontrolled) {
7052 10469 : if (!state.dataHVACVarRefFlow->LastModeHeating(VRFCond)) {
7053 1 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) {
7054 0 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate =
7055 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow;
7056 0 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).MassFlowRate =
7057 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow;
7058 0 : MixedAir::SimOAMixer(
7059 0 : state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerName, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerIndex);
7060 : } else {
7061 1 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate =
7062 1 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow;
7063 : }
7064 :
7065 1 : if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmType == AlgorithmType::FluidTCtrl) {
7066 : // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control
7067 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF_FluidTCtrl(
7068 : state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
7069 : } else {
7070 : // Algorithm Type: VRF model based on system curve
7071 1 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF(
7072 : state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
7073 : }
7074 :
7075 : // if zone temp will overshoot, pass the LoadToHeatingSP as the load to meet
7076 1 : if (TempOutput < LoadToHeatingSP) {
7077 1 : QZnReq = LoadToHeatingSP;
7078 1 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = true;
7079 1 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false;
7080 : }
7081 : } else {
7082 10468 : QZnReq = LoadToHeatingSP;
7083 10468 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = true;
7084 10468 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false;
7085 : }
7086 : }
7087 4825 : } else if (TempOutput > LoadToHeatingSP && TempOutput < LoadToCoolingSP) {
7088 : // If the net capacity does not overshoot either setpoint
7089 4825 : QZnReq = 0.0;
7090 4825 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false;
7091 4825 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false;
7092 : } else {
7093 : // If the net heating capacity meets the zone heating load but does not overshoot cooling setpoint
7094 0 : QZnReq = 0.0;
7095 0 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false;
7096 0 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false;
7097 : }
7098 : // If the terminal unit has a net heating capacity and the zone temp is above the Tstat cooling setpoint
7099 : // see if the terminal unit operation will exceed the setpoint
7100 148248 : } else if (TempOutput > 0.0 && LoadToCoolingSP < 0.0) {
7101 : // If the net heating capacity overshoots the cooling setpoint count as cooling load
7102 : // Don't count as cooling load unless mode is allowed. Also check for floating zone.
7103 161318 : if (state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != HVAC::ThermostatType::SingleHeating &&
7104 80659 : state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != HVAC::ThermostatType::Uncontrolled) {
7105 80659 : if (!state.dataHVACVarRefFlow->LastModeCooling(VRFCond)) {
7106 20 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) {
7107 11 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate =
7108 11 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow;
7109 11 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).MassFlowRate =
7110 11 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow;
7111 11 : MixedAir::SimOAMixer(
7112 11 : state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerName, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerIndex);
7113 : } else {
7114 9 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate =
7115 9 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow;
7116 : }
7117 :
7118 20 : if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmType == AlgorithmType::FluidTCtrl) {
7119 : // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control
7120 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF_FluidTCtrl(
7121 : state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
7122 : } else {
7123 : // Algorithm Type: VRF model based on system curve
7124 20 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF(
7125 : state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
7126 : }
7127 :
7128 : // if zone temp will overshoot, pass the LoadToCoolingSP as the load to meet
7129 20 : if (TempOutput > LoadToCoolingSP) {
7130 20 : QZnReq = LoadToCoolingSP;
7131 20 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = true;
7132 20 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false;
7133 : }
7134 : // last mode was cooling, zone temp will overshoot cooling setpoint, reset QznReq to LoadtoCoolingSP
7135 : } else {
7136 80639 : QZnReq = LoadToCoolingSP;
7137 80639 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = true;
7138 80639 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false;
7139 : }
7140 : }
7141 : // If the Terminal Unit has a net cooling capacity (TempOutput < 0) and
7142 : // the zone temp is below the Tstat heating setpoint (QToHeatSetPt > 0)
7143 : // see if the terminal unit operation will exceed the setpoint
7144 67589 : } else if (TempOutput < 0.0 && LoadToHeatingSP > 0.0) {
7145 : // Don't count as heating load unless mode is allowed. Also check for floating zone.
7146 121824 : if (state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != HVAC::ThermostatType::SingleCooling &&
7147 60912 : state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != HVAC::ThermostatType::Uncontrolled) {
7148 60912 : if (!state.dataHVACVarRefFlow->LastModeHeating(VRFCond)) {
7149 : // system last operated in cooling mode, change air flows and repeat coil off capacity test
7150 0 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) {
7151 0 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate =
7152 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow;
7153 0 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).MassFlowRate =
7154 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow;
7155 0 : MixedAir::SimOAMixer(
7156 0 : state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerName, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerIndex);
7157 : } else {
7158 0 : state.dataLoopNodes->Node(InNode).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow;
7159 : }
7160 :
7161 0 : if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmType == AlgorithmType::FluidTCtrl) {
7162 : // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control
7163 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF_FluidTCtrl(
7164 : state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
7165 : } else {
7166 : // Algorithm Type: VRF model based on system curve
7167 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF(
7168 : state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
7169 : }
7170 :
7171 : // if zone temp will overshoot, pass the LoadToHeatingSP as the load to meet
7172 0 : if (TempOutput < LoadToHeatingSP) {
7173 0 : QZnReq = LoadToHeatingSP;
7174 0 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = true;
7175 0 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false;
7176 : }
7177 : } else {
7178 : // last mode was heating, zone temp will overshoot heating setpoint, reset QznReq to LoadtoHeatingSP
7179 60912 : QZnReq = LoadToHeatingSP;
7180 60912 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = true;
7181 60912 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false;
7182 : }
7183 : }
7184 : }
7185 : // test that the system is active if constant fan logic enables system when thermostat control logic did not
7186 180907 : if (!state.dataHVACVarRefFlow->CoolingLoad(VRFCond) && !state.dataHVACVarRefFlow->HeatingLoad(VRFCond)) {
7187 7928 : if (state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) &&
7188 8054 : OutsideDryBulbTemp >= state.dataHVACVarRefFlow->VRF(VRFCond).MinOATCooling &&
7189 126 : OutsideDryBulbTemp <= state.dataHVACVarRefFlow->VRF(VRFCond).MaxOATCooling) {
7190 126 : state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = true;
7191 7802 : } else if (state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) &&
7192 7810 : OutsideDryBulbTemp >= state.dataHVACVarRefFlow->VRF(VRFCond).MinOATHeating &&
7193 8 : OutsideDryBulbTemp <= state.dataHVACVarRefFlow->VRF(VRFCond).MaxOATHeating) {
7194 8 : state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = true;
7195 : }
7196 : }
7197 : } // IF(VRFTU(VRFTUNum)%fanOp == HVAC::FanOp::Continuous)THEN
7198 :
7199 250981 : if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed) {
7200 77070 : if (OutsideDryBulbTemp < state.dataHVACVarRefFlow->VRF(VRFCond).MinOATHeatRecovery ||
7201 38535 : OutsideDryBulbTemp > state.dataHVACVarRefFlow->VRF(VRFCond).MaxOATHeatRecovery) {
7202 40722 : if ((any(state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest) && state.dataHVACVarRefFlow->HeatingLoad(VRFCond)) ||
7203 20361 : (any(state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest) && state.dataHVACVarRefFlow->CoolingLoad(VRFCond))) {
7204 7 : if (state.dataHVACVarRefFlow->VRF(VRFCond).HRMaxTempLimitIndex == 0) {
7205 2 : ShowWarningMessage(state,
7206 2 : format("{} \"{}\".",
7207 1 : cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum),
7208 1 : state.dataHVACVarRefFlow->VRF(VRFCond).Name));
7209 1 : ShowContinueError(state,
7210 : "...InitVRF: VRF Heat Pump Min/Max Outdoor Temperature in Heat Recovery Mode Limits have been exceeded and "
7211 : "VRF heat recovery is disabled.");
7212 1 : ShowContinueError(state, format("... Outdoor Dry-Bulb Temperature = {:.3T}", OutsideDryBulbTemp));
7213 2 : ShowContinueError(state,
7214 2 : format("... Heat Recovery Minimum Outdoor Dry-Bulb Temperature = {:.3T}",
7215 1 : state.dataHVACVarRefFlow->VRF(VRFCond).MinOATHeatRecovery));
7216 2 : ShowContinueError(state,
7217 2 : format("... Heat Recovery Maximum Outdoor Dry-Bulb Temperature = {:.3T}",
7218 1 : state.dataHVACVarRefFlow->VRF(VRFCond).MaxOATHeatRecovery));
7219 1 : ShowContinueErrorTimeStamp(state, "... Check VRF Heat Pump Min/Max Outdoor Temperature in Heat Recovery Mode limits.");
7220 1 : ShowContinueError(state, "...the system will operate in heat pump mode when applicable.");
7221 : }
7222 21 : ShowRecurringWarningErrorAtEnd(state,
7223 14 : std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)) + " \"" +
7224 21 : state.dataHVACVarRefFlow->VRF(VRFCond).Name +
7225 : "\" -- Exceeded VRF Heat Recovery min/max outdoor temperature limit error continues...",
7226 7 : state.dataHVACVarRefFlow->VRF(VRFCond).HRMaxTempLimitIndex,
7227 : OutsideDryBulbTemp,
7228 : OutsideDryBulbTemp);
7229 : }
7230 : // Allow heat pump mode to operate if within limits
7231 40722 : if (OutsideDryBulbTemp < state.dataHVACVarRefFlow->VRF(VRFCond).MinOATCooling ||
7232 20361 : OutsideDryBulbTemp > state.dataHVACVarRefFlow->VRF(VRFCond).MaxOATCooling) {
7233 : // Disable cooling mode only, heating model will still be allowed
7234 0 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false;
7235 : }
7236 40722 : if (OutsideDryBulbTemp < state.dataHVACVarRefFlow->VRF(VRFCond).MinOATHeating ||
7237 20361 : OutsideDryBulbTemp > state.dataHVACVarRefFlow->VRF(VRFCond).MaxOATHeating) {
7238 : // Disable heating mode only, cooling model will still be allowed
7239 20361 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false;
7240 : }
7241 : }
7242 : } else {
7243 212446 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest = false;
7244 212446 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest = false;
7245 : }
7246 :
7247 : // Override operating mode when using EMS
7248 : // this logic seems suspect, uses a "just run it on" mentality. Nee to test using EMS.
7249 250981 : if (state.dataHVACVarRefFlow->VRF(VRFCond).EMSOverrideHPOperatingMode) {
7250 0 : if (state.dataHVACVarRefFlow->VRF(VRFCond).EMSValueForHPOperatingMode == 0.0) { // Off
7251 0 : state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false;
7252 0 : state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false;
7253 0 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false;
7254 0 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false;
7255 0 : } else if (state.dataHVACVarRefFlow->VRF(VRFCond).EMSValueForHPOperatingMode == 1.0) { // Cooling
7256 0 : state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false;
7257 0 : state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = true;
7258 0 : QZnReq = LoadToCoolingSP;
7259 0 : if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed) {
7260 0 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false;
7261 0 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = true;
7262 : }
7263 0 : } else if (state.dataHVACVarRefFlow->VRF(VRFCond).EMSValueForHPOperatingMode == 2.0) { // Heating
7264 0 : state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = true;
7265 0 : state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false;
7266 0 : QZnReq = LoadToHeatingSP;
7267 0 : if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed) {
7268 0 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = true;
7269 0 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false;
7270 : }
7271 : } else {
7272 0 : if (state.dataHVACVarRefFlow->VRF(VRFCond).HPOperatingModeErrorIndex == 0) {
7273 0 : ShowWarningMessage(state,
7274 0 : format("{} \"{}\".",
7275 0 : cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum),
7276 0 : state.dataHVACVarRefFlow->VRF(VRFCond).Name));
7277 0 : ShowContinueError(
7278 : state,
7279 0 : format("...InitVRF: Illegal HP operating mode = {:.0T}", state.dataHVACVarRefFlow->VRF(VRFCond).EMSValueForHPOperatingMode));
7280 0 : ShowContinueError(state, "...InitVRF: VRF HP operating mode will not be controlled by EMS.");
7281 : }
7282 0 : ShowRecurringWarningErrorAtEnd(state,
7283 0 : std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)) + " \"" +
7284 0 : state.dataHVACVarRefFlow->VRF(VRFCond).Name + "\" -- Illegal HP operating mode error continues...",
7285 0 : state.dataHVACVarRefFlow->VRF(VRFCond).HPOperatingModeErrorIndex,
7286 0 : state.dataHVACVarRefFlow->VRF(VRFCond).EMSValueForHPOperatingMode,
7287 0 : state.dataHVACVarRefFlow->VRF(VRFCond).EMSValueForHPOperatingMode);
7288 : }
7289 : }
7290 :
7291 : // set the TU flow rate. Check for heat recovery operation first, these will be FALSE if HR is not used.
7292 250981 : if (state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList)) {
7293 21511 : state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow;
7294 21511 : state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow;
7295 21511 : state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow;
7296 21511 : state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow;
7297 21511 : state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingSpeedRatio;
7298 21511 : state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio;
7299 229470 : } else if (state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList)) {
7300 13791 : state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow;
7301 13791 : state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow;
7302 13791 : state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow;
7303 13791 : state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow;
7304 13791 : state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingSpeedRatio;
7305 13791 : state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoHeatingSpeedRatio;
7306 215679 : } else if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond) && QZnReq != 0.0) {
7307 96790 : state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow;
7308 96790 : state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow;
7309 96790 : state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow;
7310 96790 : state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow;
7311 96790 : state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingSpeedRatio;
7312 96790 : state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio;
7313 118889 : } else if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond) && QZnReq != 0.0) {
7314 78021 : state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow;
7315 78021 : state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow;
7316 78021 : state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow;
7317 78021 : state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow;
7318 78021 : state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingSpeedRatio;
7319 78021 : state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoHeatingSpeedRatio;
7320 : } else {
7321 40868 : if (state.dataHVACVarRefFlow->LastModeCooling(VRFCond)) {
7322 23203 : state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow;
7323 23203 : state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow;
7324 23203 : state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow;
7325 23203 : state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio;
7326 23203 : state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio;
7327 : }
7328 40868 : if (state.dataHVACVarRefFlow->LastModeHeating(VRFCond)) {
7329 17665 : state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow;
7330 17665 : state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow;
7331 17665 : state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow;
7332 17665 : state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoHeatingSpeedRatio;
7333 17665 : state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoHeatingSpeedRatio;
7334 : }
7335 40868 : state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow;
7336 : }
7337 :
7338 250981 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOp == HVAC::FanOp::Cycling) {
7339 69438 : state.dataHVACVarRefFlow->CompOffMassFlow = 0.0;
7340 69438 : state.dataHVACVarRefFlow->OACompOffMassFlow = 0.0;
7341 69438 : state.dataHVACVarRefFlow->CompOffFlowRatio = 0.0;
7342 : }
7343 :
7344 250981 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedHeating > 0 || state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedCooling > 0) {
7345 6030 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedNum = 0;
7346 6030 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedRatio = 0.0;
7347 6030 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CycRatio = 0.0;
7348 : }
7349 :
7350 250981 : SetAverageAirFlow(state, VRFTUNum, 0.0, OnOffAirFlowRatio);
7351 :
7352 250981 : if (ErrorsFound) {
7353 0 : ShowFatalError(
7354 : state,
7355 0 : format(
7356 : "{}: Errors found in getting ZoneHVAC:TerminalUnit:VariableRefrigerantFlow system input. Preceding condition(s) causes termination.",
7357 : RoutineName));
7358 : }
7359 250981 : }
7360 :
7361 359172 : void SetCompFlowRate(EnergyPlusData &state, int const VRFTUNum, int const VRFCond, bool const UseCurrentMode)
7362 : {
7363 :
7364 : // SUBROUTINE INFORMATION:
7365 : // AUTHOR Richard Raustad, FSEC
7366 : // DATE WRITTEN June 2011
7367 : // MODIFIED na
7368 : // RE-ENGINEERED na
7369 :
7370 : // PURPOSE OF THIS SUBROUTINE:
7371 : // This subroutine is for calling VRF terminal units during Init to initialize flow rate
7372 : // while looping through all terminal units connected to a specific condenser.
7373 : // This allows polling of capacities for all terminal units.
7374 : // Since the heat pump can only heat or cool, a single operating mode is chosen for each condenser.
7375 :
7376 : // METHODOLOGY EMPLOYED:
7377 : // Initializes flow rates for a specific terminal unit.
7378 :
7379 : int IndexToTUInTUList; // - index to TU in specific list for this VRF system
7380 : int TUListIndex; // index to TU list for this VRF system
7381 :
7382 359172 : IndexToTUInTUList = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).IndexToTUInTUList;
7383 359172 : TUListIndex = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex;
7384 :
7385 : // uses current operating mode to set flow rate (after mode is set)
7386 359172 : if (state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList)) {
7387 103638 : state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow;
7388 103638 : state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow;
7389 103638 : state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow;
7390 103638 : state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow;
7391 103638 : state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingSpeedRatio;
7392 103638 : state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio;
7393 255534 : } else if (state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList)) {
7394 88715 : state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow;
7395 88715 : state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow;
7396 88715 : state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow;
7397 88715 : state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow;
7398 88715 : state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingSpeedRatio;
7399 88715 : state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoHeatingSpeedRatio;
7400 166819 : } else if (UseCurrentMode) { // uses current operating mode to set flow rate (after mode is set)
7401 21677 : if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond)) {
7402 11463 : state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow;
7403 11463 : state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow;
7404 11463 : state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow;
7405 11463 : state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow;
7406 11463 : state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingSpeedRatio;
7407 11463 : state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio;
7408 10214 : } else if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond)) {
7409 2286 : state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow;
7410 2286 : state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow;
7411 2286 : state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow;
7412 2286 : state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow;
7413 2286 : state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingSpeedRatio;
7414 2286 : state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoHeatingSpeedRatio;
7415 7928 : } else if (state.dataHVACVarRefFlow->LastModeCooling(VRFCond)) { // if NOT cooling or heating then use last mode
7416 6324 : state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow;
7417 6324 : state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow;
7418 6324 : state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow;
7419 6324 : state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow;
7420 6324 : state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingSpeedRatio;
7421 6324 : state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio;
7422 1604 : } else if (state.dataHVACVarRefFlow->LastModeHeating(VRFCond)) { // if NOT cooling or heating then use last mode
7423 1604 : state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow;
7424 1604 : state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow;
7425 1604 : state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow;
7426 1604 : state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow;
7427 1604 : state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingSpeedRatio;
7428 1604 : state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoHeatingSpeedRatio;
7429 : } else { // should not happen so just set to cooling flow rate
7430 0 : state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow;
7431 0 : state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow;
7432 0 : state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow;
7433 0 : state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow;
7434 0 : state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingSpeedRatio;
7435 0 : state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio;
7436 : }
7437 : } else { // uses previous operating mode to set flow rate (used for looping through each TU in Init before mode is set)
7438 145142 : if (state.dataHVACVarRefFlow->LastModeCooling(VRFCond)) {
7439 80459 : state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow;
7440 80459 : state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow;
7441 80459 : state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow;
7442 80459 : state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow;
7443 80459 : state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingSpeedRatio;
7444 80459 : state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio;
7445 64683 : } else if (state.dataHVACVarRefFlow->LastModeHeating(VRFCond)) {
7446 64683 : state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow;
7447 64683 : state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow;
7448 64683 : state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow;
7449 64683 : state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow;
7450 64683 : state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingSpeedRatio;
7451 64683 : state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoHeatingSpeedRatio;
7452 : } else { // should not happen so just set to cooling flow rate
7453 0 : state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow;
7454 0 : state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow;
7455 0 : state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow;
7456 0 : state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow;
7457 0 : state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingSpeedRatio;
7458 0 : state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio;
7459 : }
7460 : }
7461 :
7462 359172 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOp == HVAC::FanOp::Cycling) {
7463 2552 : state.dataHVACVarRefFlow->CompOffMassFlow = 0.0;
7464 2552 : state.dataHVACVarRefFlow->OACompOffMassFlow = 0.0;
7465 2552 : state.dataHVACVarRefFlow->CompOffFlowRatio = 0.0;
7466 : }
7467 359172 : }
7468 :
7469 62 : void SizeVRF(EnergyPlusData &state, int const VRFTUNum)
7470 : {
7471 :
7472 : // SUBROUTINE INFORMATION:
7473 : // AUTHOR Richard Raustad, FSEC
7474 : // DATE WRITTEN August 2010
7475 : // MODIFIED August 2013 Daeho Kang, add component sizing table entries
7476 : // B Nigusse, FSEC, added scalable sizing
7477 : // RE-ENGINEERED na
7478 :
7479 : // PURPOSE OF THIS SUBROUTINE:
7480 : // This subroutine is for sizing VRF Components for which inputs have not been
7481 : // specified in the input.
7482 :
7483 : // METHODOLOGY EMPLOYED:
7484 : // Obtains flow rates from the zone or system sizing arrays.
7485 :
7486 : using namespace DataSizing;
7487 : using Curve::CurveValue;
7488 : using HVAC::CoolingAirflowSizing;
7489 : using HVAC::CoolingCapacitySizing;
7490 : using HVAC::HeatingAirflowSizing;
7491 : using HVAC::HeatingCapacitySizing;
7492 :
7493 : using PlantUtilities::RegisterPlantCompDesignFlow;
7494 :
7495 : static constexpr std::string_view RoutineName("SizeVRF: "); // include trailing blank space
7496 :
7497 62 : auto &CheckVRFCombinationRatio = state.dataHVACVarRefFlow->CheckVRFCombinationRatio;
7498 : Real64 TUCoolingCapacity; // total terminal unit cooling capacity
7499 : Real64 TUHeatingCapacity; // total terminal unit heating capacity
7500 : int VRFCond; // index to VRF condenser
7501 : Real64 OnOffAirFlowRat; // temporary variable used when sizing coils
7502 : Real64 DXCoilCap; // capacity of DX cooling coil (W)
7503 : bool IsAutoSize; // Indicator to autosize
7504 : Real64 MaxCoolAirVolFlowDes; // Autosized supply air during cooling for reporting
7505 : Real64 MaxCoolAirVolFlowUser; // Hardsized supply air during cooling for reporting
7506 : Real64 MaxHeatAirVolFlowDes; // Autosized supply air during heating for reporting
7507 : Real64 MaxHeatAirVolFlowUser; // Hardsized supply air during heating for reporting
7508 : Real64 MaxNoCoolAirVolFlowDes; // Autosized supply air flow when no cooling is needed for reporting
7509 : Real64 MaxNoCoolAirVolFlowUser; // Hardsized supply air flow when no cooling is needed for reporting
7510 : Real64 MaxNoHeatAirVolFlowDes; // Autosized supply air flow when no heating is needed for reporting
7511 : Real64 MaxNoHeatAirVolFlowUser; // Hardsized supply air flow when no heating is needed for reporting
7512 : Real64 CoolOutAirVolFlowDes; // Autosized outdoor air flow during cooling for reporting
7513 : Real64 CoolOutAirVolFlowUser; // Hardsized outdoor air flow during cooling for reporting
7514 : Real64 HeatOutAirVolFlowDes; // Autosized outdoor air flow during heating for reporting
7515 : Real64 HeatOutAirVolFlowUser; // Hardsized outdoor air flow during heating for reporting
7516 : Real64 NoCoolHeatOutAirVolFlowDes; // Autosized outdoor air when unconditioned for reporting
7517 : Real64 NoCoolHeatOutAirVolFlowUser; // Hardsized outdoor air when unconditioned for reporting
7518 : Real64 CoolingCapacityDes; // Autosized cooling capacity for reporting
7519 : Real64 CoolingCapacityUser; // Hardsized cooling capacity for reporting
7520 : Real64 HeatingCapacityDes; // Autosized heating capacity for reporting
7521 : Real64 HeatingCapacityUser; // Hardsized heating capacity for reporting
7522 : Real64 DefrostCapacityDes; // Autosized defrost heater capacity for reporting
7523 : Real64 DefrostCapacityUser; // Hardsized defrost heater capacity for reporting
7524 : Real64 EvapCondAirVolFlowRateDes; // Autosized evaporative condenser flow for reporting
7525 : Real64 EvapCondAirVolFlowRateUser; // Hardsized evaporative condenser flow for reporting
7526 : Real64 EvapCondPumpPowerDes; // Autosized evaporative condenser pump power for reporting
7527 : Real64 EvapCondPumpPowerUser; // Hardsized evaporative condenser pump power for reporting
7528 :
7529 62 : std::string CompName; // component name
7530 62 : std::string CompType; // component type
7531 62 : std::string SizingString; // input field sizing description (e.g., Nominal Capacity)
7532 : Real64 TempSize; // autosized value of coil input field
7533 62 : int FieldNum = 2; // IDD numeric field number where input field description is found
7534 62 : bool PrintFlag = true; // TRUE when sizing information is reported in the eio file
7535 :
7536 62 : auto &ZoneEqSizing = state.dataSize->ZoneEqSizing;
7537 :
7538 62 : DataSizing::ZoneEqSizingData *select_EqSizing(nullptr);
7539 :
7540 : // sweep specific data into one pointer to avoid if statements throughout this subroutine
7541 62 : if (state.dataSize->CurOASysNum > 0) {
7542 1 : select_EqSizing = &state.dataSize->OASysEqSizing(state.dataSize->CurOASysNum);
7543 61 : } else if (state.dataSize->CurSysNum > 0) {
7544 1 : select_EqSizing = &state.dataSize->UnitarySysEqSizing(state.dataSize->CurSysNum);
7545 60 : } else if (state.dataSize->CurZoneEqNum > 0) {
7546 60 : select_EqSizing = &ZoneEqSizing(state.dataSize->CurZoneEqNum);
7547 60 : state.dataSize->ZoneEqUnitarySys = true;
7548 : } else {
7549 0 : assert(false);
7550 : }
7551 : // Object Data, points to specific array
7552 62 : DataSizing::ZoneEqSizingData &EqSizing(*select_EqSizing);
7553 :
7554 : // can't hurt to initialize these going in, probably redundant
7555 62 : EqSizing.AirFlow = false;
7556 62 : EqSizing.CoolingAirFlow = false;
7557 62 : EqSizing.HeatingAirFlow = false;
7558 62 : EqSizing.AirVolFlow = 0.0;
7559 62 : EqSizing.CoolingAirVolFlow = 0.0;
7560 62 : EqSizing.HeatingAirVolFlow = 0.0;
7561 62 : EqSizing.Capacity = false;
7562 62 : EqSizing.CoolingCapacity = false;
7563 62 : EqSizing.HeatingCapacity = false;
7564 62 : EqSizing.DesCoolingLoad = 0.0;
7565 62 : EqSizing.DesHeatingLoad = 0.0;
7566 62 : EqSizing.OAVolFlow = 0.0;
7567 :
7568 62 : VRFCond = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum;
7569 62 : MaxCoolAirVolFlowDes = 0.0;
7570 62 : MaxCoolAirVolFlowUser = 0.0;
7571 62 : MaxHeatAirVolFlowDes = 0.0;
7572 62 : MaxHeatAirVolFlowUser = 0.0;
7573 62 : MaxNoCoolAirVolFlowDes = 0.0;
7574 62 : MaxNoCoolAirVolFlowUser = 0.0;
7575 62 : MaxNoHeatAirVolFlowDes = 0.0;
7576 62 : MaxNoHeatAirVolFlowUser = 0.0;
7577 62 : CoolOutAirVolFlowDes = 0.0;
7578 62 : CoolOutAirVolFlowUser = 0.0;
7579 62 : HeatOutAirVolFlowDes = 0.0;
7580 62 : HeatOutAirVolFlowUser = 0.0;
7581 62 : NoCoolHeatOutAirVolFlowDes = 0.0;
7582 62 : NoCoolHeatOutAirVolFlowUser = 0.0;
7583 62 : CoolingCapacityDes = 0.0;
7584 62 : CoolingCapacityUser = 0.0;
7585 62 : HeatingCapacityDes = 0.0;
7586 62 : HeatingCapacityUser = 0.0;
7587 62 : DefrostCapacityDes = 0.0;
7588 62 : DefrostCapacityUser = 0.0;
7589 62 : EvapCondAirVolFlowRateDes = 0.0;
7590 62 : EvapCondAirVolFlowRateUser = 0.0;
7591 62 : EvapCondPumpPowerDes = 0.0;
7592 62 : EvapCondPumpPowerUser = 0.0;
7593 :
7594 62 : state.dataSize->DataScalableSizingON = false;
7595 62 : state.dataSize->DataScalableCapSizingON = false;
7596 62 : state.dataSize->DataFracOfAutosizedCoolingAirflow = 1.0;
7597 62 : state.dataSize->DataFracOfAutosizedHeatingAirflow = 1.0;
7598 62 : state.dataSize->DataFracOfAutosizedCoolingCapacity = 1.0;
7599 62 : state.dataSize->DataFracOfAutosizedHeatingCapacity = 1.0;
7600 62 : state.dataSize->SuppHeatCap = 0.0;
7601 :
7602 62 : if (state.dataHVACVarRefFlow->MyOneTimeSizeFlag) {
7603 : // initialize the environment and sizing flags
7604 13 : CheckVRFCombinationRatio.dimension(state.dataHVACVarRefFlow->NumVRFCond, true);
7605 13 : state.dataHVACVarRefFlow->MyOneTimeSizeFlag = false;
7606 : }
7607 :
7608 62 : CompType = tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type];
7609 62 : CompName = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name;
7610 62 : state.dataSize->DataZoneNumber = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum;
7611 :
7612 62 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex > 0) {
7613 61 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInZone) {
7614 60 : state.dataSize->DataFanType = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType;
7615 60 : state.dataSize->DataFanIndex = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex;
7616 60 : state.dataSize->DataFanPlacement = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanPlace;
7617 1 : } else if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInAirLoop) {
7618 1 : state.dataAirSystemsData->PrimaryAirSystems(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).airLoopNum).supFanType =
7619 1 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType;
7620 1 : state.dataAirSystemsData->PrimaryAirSystems(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).airLoopNum).supFanNum =
7621 1 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex;
7622 1 : state.dataAirSystemsData->PrimaryAirSystems(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).airLoopNum).supFanPlace =
7623 1 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanPlace;
7624 : }
7625 : }
7626 :
7627 62 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HVACSizingIndex > 0) {
7628 : // initialize OA flow for sizing other inputs (e.g., capacity)
7629 0 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow == AutoSize) {
7630 0 : EqSizing.OAVolFlow = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).MinOA;
7631 : } else {
7632 0 : EqSizing.OAVolFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow;
7633 : }
7634 0 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow != AutoSize) {
7635 0 : EqSizing.OAVolFlow = max(EqSizing.OAVolFlow, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow);
7636 : }
7637 0 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerExists &&
7638 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInZone) { // set up ATMixer conditions for scalable capacity sizing
7639 0 : EqSizing.OAVolFlow = 0.0; // Equipment OA flow should always be 0 when ATMixer is used
7640 0 : SingleDuct::setATMixerSizingProperties(state,
7641 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerIndex,
7642 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum,
7643 0 : state.dataSize->CurZoneEqNum);
7644 : }
7645 :
7646 0 : int zoneHVACIndex = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HVACSizingIndex;
7647 :
7648 : // Integer representation of sizing method name (e.g., CoolingAirflowSizing, HeatingAirflowSizing, CoolingCapacitySizing,
7649 : // HeatingCapacitySizing, etc.)
7650 0 : int SizingMethod = CoolingAirflowSizing;
7651 0 : PrintFlag = true;
7652 0 : bool errorsFound = false;
7653 : // supply air flow rate sizing method (SupplyAirFlowRate, FlowPerFloorArea, FractionOfAutosizedCoolingAirflow,
7654 : // FractionOfAutosizedHeatingAirflow ...)
7655 0 : int SAFMethod = state.dataSize->ZoneHVACSizing(zoneHVACIndex).CoolingSAFMethod;
7656 0 : EqSizing.SizingMethod(SizingMethod) = SAFMethod;
7657 0 : if (SAFMethod == SupplyAirFlowRate || SAFMethod == FlowPerFloorArea || SAFMethod == FractionOfAutosizedCoolingAirflow) {
7658 0 : if (SAFMethod == SupplyAirFlowRate) {
7659 0 : if (state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxCoolAirVolFlow > 0.0) {
7660 0 : EqSizing.AirVolFlow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxCoolAirVolFlow;
7661 0 : EqSizing.SystemAirFlow = true;
7662 : }
7663 0 : TempSize = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxCoolAirVolFlow;
7664 0 : } else if (SAFMethod == FlowPerFloorArea) {
7665 0 : EqSizing.SystemAirFlow = true;
7666 0 : EqSizing.AirVolFlow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxCoolAirVolFlow *
7667 0 : state.dataHeatBal->Zone(state.dataSize->DataZoneNumber).FloorArea;
7668 0 : TempSize = ZoneEqSizing(state.dataSize->CurZoneEqNum).AirVolFlow;
7669 0 : state.dataSize->DataScalableSizingON = true;
7670 0 : } else if (SAFMethod == FractionOfAutosizedCoolingAirflow) {
7671 0 : state.dataSize->DataFracOfAutosizedCoolingAirflow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxCoolAirVolFlow;
7672 0 : TempSize = AutoSize;
7673 0 : state.dataSize->DataScalableSizingON = true;
7674 : } else {
7675 0 : TempSize = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxCoolAirVolFlow;
7676 : }
7677 :
7678 0 : CoolingAirFlowSizer sizingCoolingAirFlow;
7679 0 : std::string stringOverride = "Cooling Supply Air Flow Rate [m3/s]";
7680 0 : if (state.dataGlobal->isEpJSON) stringOverride = "cooling_supply_air_flow_rate [m3/s]";
7681 0 : sizingCoolingAirFlow.overrideSizingString(stringOverride);
7682 : // sizingCoolingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex);
7683 0 : sizingCoolingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
7684 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow = sizingCoolingAirFlow.size(state, TempSize, errorsFound);
7685 :
7686 0 : } else if (SAFMethod == FlowPerCoolingCapacity) {
7687 0 : SizingMethod = CoolingCapacitySizing; // either this isn't needed or needs to be assigned to EqSizing
7688 0 : TempSize = AutoSize;
7689 0 : PrintFlag = false;
7690 0 : state.dataSize->DataScalableSizingON = true;
7691 0 : state.dataSize->DataFlowUsedForSizing = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesCoolVolFlow;
7692 0 : if (state.dataSize->ZoneHVACSizing(zoneHVACIndex).CoolingCapMethod == FractionOfAutosizedCoolingCapacity) {
7693 0 : state.dataSize->DataFracOfAutosizedCoolingCapacity = state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledCoolingCapacity;
7694 : }
7695 0 : CoolingCapacitySizer sizerCoolingCapacity;
7696 0 : sizerCoolingCapacity.overrideSizingString(SizingString);
7697 0 : sizerCoolingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
7698 0 : state.dataSize->DataAutosizedCoolingCapacity = sizerCoolingCapacity.size(state, TempSize, errorsFound);
7699 0 : state.dataSize->DataFlowPerCoolingCapacity = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxCoolAirVolFlow;
7700 0 : PrintFlag = true;
7701 0 : TempSize = AutoSize;
7702 0 : CoolingAirFlowSizer sizingCoolingAirFlow;
7703 0 : std::string stringOverride = "Cooling Supply Air Flow Rate [m3/s]";
7704 0 : if (state.dataGlobal->isEpJSON) stringOverride = "cooling_supply_air_flow_rate [m3/s]";
7705 0 : sizingCoolingAirFlow.overrideSizingString(stringOverride);
7706 : // sizingCoolingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex);
7707 0 : sizingCoolingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
7708 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow = sizingCoolingAirFlow.size(state, TempSize, errorsFound);
7709 0 : }
7710 : // Multispeed Fan cooling flow sizing
7711 0 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedCooling > 0) {
7712 0 : Real64 AirFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow;
7713 0 : for (int i = 1; i <= state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedCooling; ++i) {
7714 0 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSpecMSHPIndex > -1) {
7715 0 : if (state.dataUnitarySystems->designSpecMSHP[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSpecMSHPIndex]
7716 0 : .coolingVolFlowRatio[i] == DataSizing::AutoSize) {
7717 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolVolumeFlowRate[i] =
7718 0 : double(i) / double(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedCooling) * AirFlowRate;
7719 : } else {
7720 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolVolumeFlowRate[i] =
7721 0 : state.dataUnitarySystems->designSpecMSHP[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSpecMSHPIndex]
7722 0 : .coolingVolFlowRatio[i] *
7723 : AirFlowRate;
7724 : }
7725 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[i] =
7726 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolVolumeFlowRate[i] * state.dataEnvrn->StdRhoAir;
7727 : } else {
7728 0 : auto *fanSystem = dynamic_cast<Fans::FanSystem *>(state.dataFans->fans(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex));
7729 0 : assert(fanSystem != nullptr);
7730 0 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[i] == 0.0) {
7731 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[i] = fanSystem->massFlowAtSpeed[i - 1];
7732 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolVolumeFlowRate[i] =
7733 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[i] / state.dataEnvrn->StdRhoAir;
7734 : }
7735 : }
7736 : }
7737 : }
7738 :
7739 0 : SizingMethod = HeatingAirflowSizing;
7740 0 : FieldNum = 3; // N3, \field Supply Air Flow Rate During Heating Operation
7741 0 : PrintFlag = true;
7742 0 : SizingString = state.dataHVACVarRefFlow->VRFTUNumericFields(VRFTUNum).FieldNames(FieldNum) + " [m3/s]";
7743 0 : SAFMethod = state.dataSize->ZoneHVACSizing(zoneHVACIndex).HeatingSAFMethod;
7744 0 : EqSizing.SizingMethod(SizingMethod) = SAFMethod;
7745 0 : if (SAFMethod == SupplyAirFlowRate || SAFMethod == FlowPerFloorArea || SAFMethod == FractionOfAutosizedHeatingAirflow) {
7746 0 : if (SAFMethod == SupplyAirFlowRate) {
7747 0 : if (state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxHeatAirVolFlow > 0.0) {
7748 0 : EqSizing.AirVolFlow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxHeatAirVolFlow;
7749 0 : EqSizing.SystemAirFlow = true;
7750 : }
7751 0 : TempSize = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxHeatAirVolFlow;
7752 0 : } else if (SAFMethod == FlowPerFloorArea) {
7753 0 : EqSizing.SystemAirFlow = true;
7754 0 : EqSizing.AirVolFlow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxHeatAirVolFlow *
7755 0 : state.dataHeatBal->Zone(state.dataSize->DataZoneNumber).FloorArea;
7756 0 : TempSize = ZoneEqSizing(state.dataSize->CurZoneEqNum).AirVolFlow;
7757 0 : state.dataSize->DataScalableSizingON = true;
7758 0 : } else if (SAFMethod == FractionOfAutosizedHeatingAirflow) {
7759 0 : state.dataSize->DataFracOfAutosizedHeatingAirflow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxHeatAirVolFlow;
7760 0 : TempSize = AutoSize;
7761 0 : state.dataSize->DataScalableSizingON = true;
7762 : } else {
7763 0 : TempSize = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxHeatAirVolFlow;
7764 : }
7765 0 : errorsFound = false;
7766 0 : HeatingAirFlowSizer sizingHeatingAirFlow;
7767 0 : sizingHeatingAirFlow.overrideSizingString(SizingString);
7768 : // sizingHeatingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex);
7769 0 : sizingHeatingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
7770 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow = sizingHeatingAirFlow.size(state, TempSize, errorsFound);
7771 0 : } else if (SAFMethod == FlowPerHeatingCapacity) {
7772 0 : SizingMethod = HeatingCapacitySizing; // either this isn't needed or needs to be assigned to EqSizing
7773 0 : TempSize = AutoSize;
7774 0 : PrintFlag = false;
7775 0 : state.dataSize->DataScalableSizingON = true;
7776 0 : state.dataSize->DataFlowUsedForSizing = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesHeatVolFlow;
7777 0 : if (state.dataSize->ZoneHVACSizing(zoneHVACIndex).HeatingCapMethod == FractionOfAutosizedHeatingCapacity) {
7778 0 : state.dataSize->DataFracOfAutosizedHeatingCapacity = state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity;
7779 : }
7780 0 : errorsFound = false;
7781 0 : HeatingCapacitySizer sizerHeatingCapacity;
7782 0 : sizerHeatingCapacity.overrideSizingString(SizingString);
7783 0 : sizerHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
7784 0 : state.dataSize->DataAutosizedHeatingCapacity = sizerHeatingCapacity.size(state, TempSize, errorsFound);
7785 0 : state.dataSize->DataFlowPerHeatingCapacity = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxHeatAirVolFlow;
7786 0 : SizingMethod = HeatingAirflowSizing; // either this isn't needed or needs to be assigned to EqSizing
7787 0 : PrintFlag = true;
7788 0 : TempSize = AutoSize;
7789 0 : errorsFound = false;
7790 0 : HeatingAirFlowSizer sizingHeatingAirFlow;
7791 0 : sizingHeatingAirFlow.overrideSizingString(SizingString);
7792 : // sizingHeatingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex);
7793 0 : sizingHeatingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
7794 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow = sizingHeatingAirFlow.size(state, TempSize, errorsFound);
7795 0 : }
7796 : // Multispeed Fan heating flow sizing
7797 0 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedHeating > 0) {
7798 0 : Real64 AirFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow;
7799 0 : for (int i = 1; i <= state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedHeating; ++i) {
7800 0 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSpecMSHPIndex > -1) {
7801 0 : if (state.dataUnitarySystems->designSpecMSHP[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSpecMSHPIndex]
7802 0 : .heatingVolFlowRatio[i] == DataSizing::AutoSize) {
7803 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatVolumeFlowRate[i] =
7804 0 : double(i) / double(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedHeating) * AirFlowRate;
7805 : } else {
7806 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatVolumeFlowRate[i] =
7807 0 : state.dataUnitarySystems->designSpecMSHP[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSpecMSHPIndex]
7808 0 : .heatingVolFlowRatio[i] *
7809 : AirFlowRate;
7810 : }
7811 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[i] =
7812 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatVolumeFlowRate[i] * state.dataEnvrn->StdRhoAir;
7813 : } else {
7814 0 : auto *fanSystem = dynamic_cast<Fans::FanSystem *>(state.dataFans->fans(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex));
7815 0 : assert(fanSystem != nullptr);
7816 0 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[i] == 0.0) {
7817 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[i] = fanSystem->massFlowAtSpeed[i - 1];
7818 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatVolumeFlowRate[i] =
7819 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[i] / state.dataEnvrn->StdRhoAir;
7820 : }
7821 : }
7822 : }
7823 : }
7824 :
7825 0 : PrintFlag = true;
7826 0 : SAFMethod = state.dataSize->ZoneHVACSizing(zoneHVACIndex).NoCoolHeatSAFMethod;
7827 0 : EqSizing.SizingMethod(SizingMethod) = SAFMethod;
7828 0 : if ((SAFMethod == SupplyAirFlowRate) || (SAFMethod == FlowPerFloorArea) || (SAFMethod == FractionOfAutosizedHeatingAirflow) ||
7829 : (SAFMethod == FractionOfAutosizedCoolingAirflow)) {
7830 0 : if (SAFMethod == SupplyAirFlowRate) {
7831 0 : if (state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxNoCoolHeatAirVolFlow > 0.0) {
7832 0 : EqSizing.AirVolFlow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxNoCoolHeatAirVolFlow;
7833 0 : EqSizing.SystemAirFlow = true;
7834 : }
7835 0 : TempSize = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxNoCoolHeatAirVolFlow;
7836 0 : } else if (SAFMethod == FlowPerFloorArea) {
7837 0 : EqSizing.SystemAirFlow = true;
7838 0 : EqSizing.AirVolFlow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxNoCoolHeatAirVolFlow *
7839 0 : state.dataHeatBal->Zone(state.dataSize->DataZoneNumber).FloorArea;
7840 0 : TempSize = ZoneEqSizing(state.dataSize->CurZoneEqNum).AirVolFlow;
7841 0 : state.dataSize->DataScalableSizingON = true;
7842 0 : } else if (SAFMethod == FractionOfAutosizedCoolingAirflow) {
7843 0 : state.dataSize->DataFracOfAutosizedCoolingAirflow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxNoCoolHeatAirVolFlow;
7844 0 : state.dataSize->DataFracOfAutosizedHeatingAirflow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxNoCoolHeatAirVolFlow;
7845 0 : TempSize = AutoSize;
7846 0 : state.dataSize->DataScalableSizingON = true;
7847 0 : } else if (SAFMethod == FractionOfAutosizedHeatingAirflow) {
7848 0 : state.dataSize->DataFracOfAutosizedCoolingAirflow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxNoCoolHeatAirVolFlow;
7849 0 : state.dataSize->DataFracOfAutosizedHeatingAirflow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxNoCoolHeatAirVolFlow;
7850 0 : TempSize = AutoSize;
7851 0 : state.dataSize->DataScalableSizingON = true;
7852 : } else {
7853 0 : TempSize = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxNoCoolHeatAirVolFlow;
7854 : }
7855 0 : CoolingAirFlowSizer sizingCoolingAirFlow;
7856 0 : std::string stringOverride = "No Cooling Supply Air Flow Rate [m3/s]";
7857 0 : if (state.dataGlobal->isEpJSON) stringOverride = "no_cooling_supply_air_flow_rate [m3/s]";
7858 0 : sizingCoolingAirFlow.overrideSizingString(stringOverride);
7859 : // sizingCoolingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex);
7860 0 : sizingCoolingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
7861 0 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedCooling > 0) {
7862 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolVolumeFlowRate[1];
7863 0 : sizingCoolingAirFlow.reportSizerOutput(state,
7864 : sizingCoolingAirFlow.compType,
7865 : sizingCoolingAirFlow.compName,
7866 0 : "Design Size " + stringOverride,
7867 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow);
7868 : } else {
7869 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow = sizingCoolingAirFlow.size(state, TempSize, errorsFound);
7870 : }
7871 0 : }
7872 :
7873 0 : SizingMethod = HeatingAirflowSizing;
7874 0 : FieldNum = 4; // N4, \field Supply Air Flow Rate When No Heating is Needed
7875 0 : PrintFlag = true;
7876 0 : SizingString = state.dataHVACVarRefFlow->VRFTUNumericFields(VRFTUNum).FieldNames(FieldNum) + " [m3/s]";
7877 0 : SAFMethod = state.dataSize->ZoneHVACSizing(zoneHVACIndex).NoCoolHeatSAFMethod;
7878 0 : EqSizing.SizingMethod(SizingMethod) = SAFMethod;
7879 0 : if ((SAFMethod == SupplyAirFlowRate) || (SAFMethod == FlowPerFloorArea) || (SAFMethod == FractionOfAutosizedHeatingAirflow) ||
7880 : (SAFMethod == FractionOfAutosizedCoolingAirflow)) {
7881 0 : if (SAFMethod == SupplyAirFlowRate) {
7882 0 : if (state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxNoCoolHeatAirVolFlow > 0.0) {
7883 0 : EqSizing.AirVolFlow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxNoCoolHeatAirVolFlow;
7884 0 : EqSizing.SystemAirFlow = true;
7885 : }
7886 0 : TempSize = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxNoCoolHeatAirVolFlow;
7887 0 : } else if (SAFMethod == FlowPerFloorArea) {
7888 0 : EqSizing.SystemAirFlow = true;
7889 0 : EqSizing.AirVolFlow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxNoCoolHeatAirVolFlow *
7890 0 : state.dataHeatBal->Zone(state.dataSize->DataZoneNumber).FloorArea;
7891 0 : TempSize = ZoneEqSizing(state.dataSize->CurZoneEqNum).AirVolFlow;
7892 0 : state.dataSize->DataScalableSizingON = true;
7893 0 : } else if (SAFMethod == FractionOfAutosizedHeatingAirflow) {
7894 0 : state.dataSize->DataFracOfAutosizedCoolingAirflow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxNoCoolHeatAirVolFlow;
7895 0 : state.dataSize->DataFracOfAutosizedHeatingAirflow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxNoCoolHeatAirVolFlow;
7896 0 : TempSize = AutoSize;
7897 0 : state.dataSize->DataScalableSizingON = true;
7898 0 : } else if (SAFMethod == FractionOfAutosizedCoolingAirflow) {
7899 0 : state.dataSize->DataFracOfAutosizedCoolingAirflow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxNoCoolHeatAirVolFlow;
7900 0 : state.dataSize->DataFracOfAutosizedHeatingAirflow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxNoCoolHeatAirVolFlow;
7901 0 : TempSize = AutoSize;
7902 0 : state.dataSize->DataScalableSizingON = true;
7903 : } else {
7904 0 : TempSize = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxNoCoolHeatAirVolFlow;
7905 : }
7906 0 : errorsFound = false;
7907 0 : HeatingAirFlowSizer sizingNoHeatingAirFlow;
7908 0 : sizingNoHeatingAirFlow.overrideSizingString(SizingString);
7909 : // sizingNoHeatingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex);
7910 0 : sizingNoHeatingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
7911 0 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedHeating > 0) {
7912 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatVolumeFlowRate[1];
7913 0 : sizingNoHeatingAirFlow.reportSizerOutput(state,
7914 : sizingNoHeatingAirFlow.compType,
7915 : sizingNoHeatingAirFlow.compName,
7916 0 : "Design Size " + SizingString,
7917 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow);
7918 : } else {
7919 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow = sizingNoHeatingAirFlow.size(state, TempSize, errorsFound);
7920 : }
7921 0 : }
7922 :
7923 : // initialize capacity sizing variables: cooling
7924 0 : SizingMethod = CoolingCapacitySizing;
7925 : // capacity sizing methods (HeatingDesignCapacity, CapacityPerFloorArea, FractionOfAutosizedCoolingCapacity, and
7926 : // FractionOfAutosizedHeatingCapacity )
7927 0 : int CapSizingMethod = state.dataSize->ZoneHVACSizing(zoneHVACIndex).CoolingCapMethod;
7928 0 : EqSizing.SizingMethod(SizingMethod) = CapSizingMethod;
7929 0 : if (CapSizingMethod == CoolingDesignCapacity || CapSizingMethod == CapacityPerFloorArea ||
7930 : CapSizingMethod == FractionOfAutosizedCoolingCapacity) {
7931 0 : if (CapSizingMethod == HeatingDesignCapacity) {
7932 0 : if (state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledCoolingCapacity > 0.0) {
7933 0 : EqSizing.CoolingCapacity = true;
7934 0 : EqSizing.DesCoolingLoad = state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledCoolingCapacity;
7935 : }
7936 0 : } else if (CapSizingMethod == CapacityPerFloorArea) {
7937 0 : EqSizing.CoolingCapacity = true;
7938 0 : EqSizing.DesCoolingLoad = state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledCoolingCapacity *
7939 0 : state.dataHeatBal->Zone(state.dataSize->DataZoneNumber).FloorArea;
7940 0 : state.dataSize->DataScalableCapSizingON = true;
7941 0 : } else if (CapSizingMethod == FractionOfAutosizedCoolingCapacity) {
7942 0 : state.dataSize->DataFracOfAutosizedCoolingCapacity = state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledCoolingCapacity;
7943 0 : state.dataSize->DataScalableCapSizingON = true;
7944 : }
7945 : }
7946 :
7947 : // initialize capacity sizing variables: heating
7948 0 : SizingMethod = HeatingCapacitySizing;
7949 0 : CapSizingMethod = state.dataSize->ZoneHVACSizing(zoneHVACIndex).HeatingCapMethod;
7950 0 : EqSizing.SizingMethod(SizingMethod) = CapSizingMethod;
7951 0 : if (CapSizingMethod == HeatingDesignCapacity || CapSizingMethod == CapacityPerFloorArea ||
7952 : CapSizingMethod == FractionOfAutosizedHeatingCapacity) {
7953 0 : if (CapSizingMethod == HeatingDesignCapacity) {
7954 0 : if (state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity > 0.0) {
7955 0 : EqSizing.HeatingCapacity = true;
7956 0 : EqSizing.DesHeatingLoad = state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity;
7957 : }
7958 0 : } else if (CapSizingMethod == CapacityPerFloorArea) {
7959 0 : EqSizing.HeatingCapacity = true;
7960 0 : EqSizing.DesHeatingLoad = state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity *
7961 0 : state.dataHeatBal->Zone(state.dataSize->DataZoneNumber).FloorArea;
7962 0 : state.dataSize->DataScalableCapSizingON = true;
7963 0 : } else if (CapSizingMethod == FractionOfAutosizedHeatingCapacity) {
7964 0 : state.dataSize->DataFracOfAutosizedHeatingCapacity = state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity;
7965 0 : state.dataSize->DataScalableCapSizingON = true;
7966 : }
7967 : }
7968 : } else {
7969 : // no scalable sizing method has been specified. Sizing proceeds using the method
7970 : // specified in the zoneHVAC object
7971 :
7972 62 : PrintFlag = true;
7973 :
7974 62 : TempSize = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow;
7975 62 : bool errorsFound = false;
7976 62 : CoolingAirFlowSizer sizingCoolingAirFlow;
7977 62 : std::string stringOverride = "Cooling Supply Air Flow Rate [m3/s]";
7978 62 : if (state.dataGlobal->isEpJSON) stringOverride = "cooling_supply_air_flow_rate [m3/s]";
7979 62 : sizingCoolingAirFlow.overrideSizingString(stringOverride);
7980 : // sizingCoolingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex);
7981 62 : sizingCoolingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
7982 62 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow = sizingCoolingAirFlow.size(state, TempSize, errorsFound);
7983 : // Multispeed Fan cooling flow sizing
7984 62 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedCooling > 0) {
7985 2 : Real64 AirFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow;
7986 6 : for (int i = 1; i <= state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedCooling; ++i) {
7987 4 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSpecMSHPIndex > -1) {
7988 2 : if (state.dataUnitarySystems->designSpecMSHP[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSpecMSHPIndex]
7989 2 : .coolingVolFlowRatio[i] == DataSizing::AutoSize) {
7990 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolVolumeFlowRate[i] =
7991 2 : double(i) / double(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedCooling) * AirFlowRate;
7992 : } else {
7993 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolVolumeFlowRate[i] =
7994 0 : state.dataUnitarySystems->designSpecMSHP[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSpecMSHPIndex]
7995 0 : .coolingVolFlowRatio[i] *
7996 : AirFlowRate;
7997 : }
7998 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[i] =
7999 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolVolumeFlowRate[i] * state.dataEnvrn->StdRhoAir;
8000 : } else {
8001 2 : auto *fanSystem = dynamic_cast<Fans::FanSystem *>(state.dataFans->fans(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex));
8002 2 : assert(fanSystem != nullptr);
8003 2 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[i] == 0.0) {
8004 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[i] = fanSystem->massFlowAtSpeed[i - 1];
8005 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolVolumeFlowRate[i] =
8006 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[i] / state.dataEnvrn->StdRhoAir;
8007 : }
8008 : }
8009 : }
8010 : }
8011 :
8012 62 : FieldNum = 3; // N3, \field Supply Air Flow Rate During Heating Operation
8013 62 : SizingString = state.dataHVACVarRefFlow->VRFTUNumericFields(VRFTUNum).FieldNames(FieldNum) + " [m3/s]";
8014 62 : int SizingMethod = HeatingAirflowSizing; // either this isn't needed or needs to be assigned to EqSizing
8015 62 : TempSize = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow;
8016 62 : errorsFound = false;
8017 62 : HeatingAirFlowSizer sizingHeatingAirFlow;
8018 62 : sizingHeatingAirFlow.overrideSizingString(SizingString);
8019 : // sizingHeatingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex);
8020 62 : sizingHeatingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
8021 62 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow = sizingHeatingAirFlow.size(state, TempSize, errorsFound);
8022 : // Multispeed Fan heating flow sizing
8023 62 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedHeating > 0) {
8024 2 : Real64 AirFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow;
8025 6 : for (int i = 1; i <= state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedHeating; ++i) {
8026 4 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSpecMSHPIndex > -1) {
8027 2 : if (state.dataUnitarySystems->designSpecMSHP[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSpecMSHPIndex]
8028 2 : .heatingVolFlowRatio[i] == DataSizing::AutoSize) {
8029 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatVolumeFlowRate[i] =
8030 2 : double(i) / double(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedHeating) * AirFlowRate;
8031 : } else {
8032 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatVolumeFlowRate[i] =
8033 0 : state.dataUnitarySystems->designSpecMSHP[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSpecMSHPIndex]
8034 0 : .heatingVolFlowRatio[i] *
8035 : AirFlowRate;
8036 : }
8037 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[i] =
8038 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatVolumeFlowRate[i] * state.dataEnvrn->StdRhoAir;
8039 : } else {
8040 2 : auto *fanSystem = dynamic_cast<Fans::FanSystem *>(state.dataFans->fans(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex));
8041 2 : assert(fanSystem != nullptr);
8042 2 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[i] == 0.0) {
8043 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[i] = fanSystem->massFlowAtSpeed[i - 1];
8044 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatVolumeFlowRate[i] =
8045 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[i] / state.dataEnvrn->StdRhoAir;
8046 : }
8047 : }
8048 : }
8049 : }
8050 :
8051 62 : errorsFound = false;
8052 62 : SystemAirFlowSizer sizerSystemAirFlow;
8053 62 : std::string sizingString = "No Cooling Supply Air Flow Rate [m3/s]";
8054 62 : sizerSystemAirFlow.overrideSizingString(sizingString);
8055 62 : sizerSystemAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
8056 62 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedCooling > 0) {
8057 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolVolumeFlowRate[1];
8058 6 : sizerSystemAirFlow.reportSizerOutput(state,
8059 : sizerSystemAirFlow.compType,
8060 : sizerSystemAirFlow.compName,
8061 2 : "Design Size " + sizingString,
8062 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow);
8063 : } else {
8064 60 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow =
8065 60 : sizerSystemAirFlow.size(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow, errorsFound);
8066 : }
8067 :
8068 62 : SystemAirFlowSizer sizerSystemAirFlow2;
8069 62 : sizingString = "No Heating Supply Air Flow Rate [m3/s]";
8070 62 : sizerSystemAirFlow2.overrideSizingString(sizingString);
8071 62 : sizerSystemAirFlow2.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
8072 62 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedHeating > 0) {
8073 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatVolumeFlowRate[1];
8074 6 : sizerSystemAirFlow.reportSizerOutput(state,
8075 : sizerSystemAirFlow.compType,
8076 : sizerSystemAirFlow.compName,
8077 2 : "Design Size " + sizingString,
8078 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow);
8079 : } else {
8080 60 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow =
8081 60 : sizerSystemAirFlow2.size(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow, errorsFound);
8082 : }
8083 62 : }
8084 62 : IsAutoSize = false;
8085 62 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow == AutoSize) {
8086 37 : IsAutoSize = true;
8087 : }
8088 62 : if (state.dataSize->CurZoneEqNum > 0) {
8089 60 : if (!IsAutoSize && !state.dataSize->ZoneSizingRunDone) { // Simulation continue
8090 0 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow > 0.0) {
8091 0 : BaseSizer::reportSizerOutput(state,
8092 0 : tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type],
8093 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name,
8094 : "User-Specified Outdoor Air Flow Rate During Cooling Operation [m3/s]",
8095 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow);
8096 : }
8097 : } else {
8098 60 : CheckZoneSizing(state, tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type], state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name);
8099 60 : CoolOutAirVolFlowDes =
8100 60 : min(state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).MinOA, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow);
8101 60 : if (CoolOutAirVolFlowDes < HVAC::SmallAirVolFlow) {
8102 0 : CoolOutAirVolFlowDes = 0.0;
8103 : }
8104 :
8105 60 : if (IsAutoSize) {
8106 35 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow = CoolOutAirVolFlowDes;
8107 70 : BaseSizer::reportSizerOutput(state,
8108 35 : tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type],
8109 35 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name,
8110 : "Design Size Outdoor Air Flow Rate During Cooling Operation [m3/s]",
8111 : CoolOutAirVolFlowDes);
8112 : } else {
8113 25 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow > 0.0 && CoolOutAirVolFlowDes > 0.0) {
8114 0 : CoolOutAirVolFlowUser = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow;
8115 0 : BaseSizer::reportSizerOutput(state,
8116 0 : tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type],
8117 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name,
8118 : "Design Size Outdoor Air Flow Rate During Cooling Operation [m3/s]",
8119 : CoolOutAirVolFlowDes,
8120 : "User-Specified Outdoor Air Flow Rate During Cooling Operation [m3/s]",
8121 : CoolOutAirVolFlowUser);
8122 0 : if (state.dataGlobal->DisplayExtraWarnings) {
8123 0 : if ((std::abs(CoolOutAirVolFlowDes - CoolOutAirVolFlowUser) / CoolOutAirVolFlowUser) >
8124 0 : state.dataSize->AutoVsHardSizingThreshold) {
8125 0 : ShowMessage(state,
8126 0 : format("SizeVRF: Potential issue with equipment sizing for {} {}",
8127 0 : tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type],
8128 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name));
8129 0 : ShowContinueError(
8130 : state,
8131 0 : format("User-Specified Outdoor Air Flow Rate During Cooling Operation of {:.5R} [m3/s]", CoolOutAirVolFlowUser));
8132 0 : ShowContinueError(state,
8133 0 : format("differs from Design Size Outdoor Air Flow Rate During Cooling Operation of {:.5R} [m3/s]",
8134 : CoolOutAirVolFlowDes));
8135 0 : ShowContinueError(state, "This may, or may not, indicate mismatched component sizes.");
8136 0 : ShowContinueError(state, "Verify that the value entered is intended and is consistent with other components.");
8137 : }
8138 : }
8139 : }
8140 : }
8141 : }
8142 : } else {
8143 2 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow == DataSizing::AutoSize) {
8144 2 : if (state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).OASysExists) {
8145 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow = 0.0;
8146 : } else {
8147 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow =
8148 0 : min(state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).DesOutAirVolFlow,
8149 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow);
8150 : }
8151 4 : BaseSizer::reportSizerOutput(state,
8152 2 : tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type],
8153 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name,
8154 : "Design Size Outdoor Air Flow Rate During Cooling Operation [m3/s]",
8155 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow);
8156 : }
8157 : }
8158 :
8159 62 : IsAutoSize = false;
8160 62 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow == AutoSize) {
8161 37 : IsAutoSize = true;
8162 : }
8163 62 : if (state.dataSize->CurZoneEqNum > 0) {
8164 60 : if (!IsAutoSize && !state.dataSize->ZoneSizingRunDone) { // Simulation continue
8165 0 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow > 0.0) {
8166 0 : BaseSizer::reportSizerOutput(state,
8167 0 : tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type],
8168 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name,
8169 : "Outdoor Air Flow Rate During Heating Operation [m3/s]",
8170 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow);
8171 : }
8172 : } else {
8173 60 : CheckZoneSizing(state, tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type], state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name);
8174 60 : HeatOutAirVolFlowDes =
8175 60 : min(state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).MinOA, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow);
8176 60 : if (HeatOutAirVolFlowDes < HVAC::SmallAirVolFlow) {
8177 0 : HeatOutAirVolFlowDes = 0.0;
8178 : }
8179 :
8180 60 : if (IsAutoSize) {
8181 35 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow = HeatOutAirVolFlowDes;
8182 70 : BaseSizer::reportSizerOutput(state,
8183 35 : tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type],
8184 35 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name,
8185 : "Design Size Outdoor Air Flow Rate During Heating Operation [m3/s]",
8186 : HeatOutAirVolFlowDes);
8187 : } else {
8188 25 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow > 0.0 && HeatOutAirVolFlowDes > 0.0) {
8189 0 : HeatOutAirVolFlowUser = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow;
8190 0 : BaseSizer::reportSizerOutput(state,
8191 0 : tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type],
8192 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name,
8193 : "Design Size Outdoor Air Flow Rate During Heating Operation [m3/s]",
8194 : HeatOutAirVolFlowDes,
8195 : "User-Specified Outdoor Air Flow Rate During Heating Operation [m3/s]",
8196 : HeatOutAirVolFlowUser);
8197 0 : if (state.dataGlobal->DisplayExtraWarnings) {
8198 0 : if ((std::abs(HeatOutAirVolFlowDes - HeatOutAirVolFlowUser) / HeatOutAirVolFlowUser) >
8199 0 : state.dataSize->AutoVsHardSizingThreshold) {
8200 0 : ShowMessage(state,
8201 0 : format("SizeVRF: Potential issue with equipment sizing for {} {}",
8202 0 : tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type],
8203 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name));
8204 0 : ShowContinueError(
8205 : state,
8206 0 : format("User-Specified Outdoor Air Flow Rate During Heating Operation of {:.5R} [m3/s]", HeatOutAirVolFlowUser));
8207 0 : ShowContinueError(state,
8208 0 : format("differs from Design Size Outdoor Air Flow Rate During Heating Operation of {:.5R} [m3/s]",
8209 : HeatOutAirVolFlowDes));
8210 0 : ShowContinueError(state, "This may, or may not, indicate mismatched component sizes.");
8211 0 : ShowContinueError(state, "Verify that the value entered is intended and is consistent with other components.");
8212 : }
8213 : }
8214 : }
8215 : }
8216 : }
8217 : } else {
8218 2 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow == DataSizing::AutoSize) {
8219 2 : if (state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).OASysExists) {
8220 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow = 0.0;
8221 : } else {
8222 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow =
8223 0 : min(state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).DesOutAirVolFlow,
8224 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow);
8225 : }
8226 4 : BaseSizer::reportSizerOutput(state,
8227 2 : tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type],
8228 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name,
8229 : "Design Size Outdoor Air Flow Rate During Heating Operation [m3/s]",
8230 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow);
8231 : }
8232 : }
8233 62 : EqSizing.OAVolFlow =
8234 62 : max(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow);
8235 :
8236 72 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerExists &&
8237 10 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInZone) { // set up ATMixer conditions for use in component sizing
8238 10 : EqSizing.OAVolFlow = 0.0; // Equipment OA flow should always be 0 when ATMixer is used
8239 30 : SingleDuct::setATMixerSizingProperties(state,
8240 10 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerIndex,
8241 10 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum,
8242 10 : state.dataSize->CurZoneEqNum);
8243 : }
8244 :
8245 62 : IsAutoSize = false;
8246 62 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow == AutoSize) {
8247 36 : IsAutoSize = true;
8248 : }
8249 62 : if (state.dataSize->CurZoneEqNum > 0) {
8250 60 : if (!IsAutoSize && !state.dataSize->ZoneSizingRunDone) { // Simulation continue
8251 0 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow > 0.0) {
8252 0 : BaseSizer::reportSizerOutput(state,
8253 0 : tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type],
8254 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name,
8255 : "User-Specified Outdoor Air Flow Rate When No Cooling or Heating is Needed [m3/s]",
8256 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow);
8257 : }
8258 : } else {
8259 60 : CheckZoneSizing(state, tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type], state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name);
8260 60 : NoCoolHeatOutAirVolFlowDes = min(state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).MinOA,
8261 60 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow,
8262 60 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow);
8263 60 : if (NoCoolHeatOutAirVolFlowDes < HVAC::SmallAirVolFlow) {
8264 25 : NoCoolHeatOutAirVolFlowDes = 0.0;
8265 : }
8266 :
8267 60 : if (IsAutoSize) {
8268 34 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow = NoCoolHeatOutAirVolFlowDes;
8269 68 : BaseSizer::reportSizerOutput(state,
8270 34 : tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type],
8271 34 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name,
8272 : "Design Size Outdoor Air Flow Rate When No Cooling or Heating is Needed [m3/s]",
8273 : NoCoolHeatOutAirVolFlowDes);
8274 : } else {
8275 26 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow > 0.0 && NoCoolHeatOutAirVolFlowDes > 0.0) {
8276 0 : NoCoolHeatOutAirVolFlowUser = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow;
8277 0 : BaseSizer::reportSizerOutput(state,
8278 0 : tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type],
8279 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name,
8280 : "Design Size Outdoor Air Flow Rate When No Cooling or Heating is Needed [m3/s]",
8281 : NoCoolHeatOutAirVolFlowDes,
8282 : "User-Specified Outdoor Air Flow Rate When No Cooling or Heating is Needed [m3/s]",
8283 : NoCoolHeatOutAirVolFlowUser);
8284 0 : if (state.dataGlobal->DisplayExtraWarnings) {
8285 0 : if ((std::abs(NoCoolHeatOutAirVolFlowDes - NoCoolHeatOutAirVolFlowUser) / NoCoolHeatOutAirVolFlowUser) >
8286 0 : state.dataSize->AutoVsHardSizingThreshold) {
8287 0 : ShowMessage(state,
8288 0 : format("SizeVRF: Potential issue with equipment sizing for {} {}",
8289 0 : tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type],
8290 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name));
8291 0 : ShowContinueError(state,
8292 0 : format("User-Specified Outdoor Air Flow Rate When No Cooling or Heating is Needed of {:.5R} [m3/s]",
8293 : NoCoolHeatOutAirVolFlowUser));
8294 0 : ShowContinueError(
8295 : state,
8296 0 : format("differs from Design Size Outdoor Air Flow Rate When No Cooling or Heating is Needed of {:.5R} [m3/s]",
8297 : NoCoolHeatOutAirVolFlowDes));
8298 0 : ShowContinueError(state, "This may, or may not, indicate mismatched component sizes.");
8299 0 : ShowContinueError(state, "Verify that the value entered is intended and is consistent with other components.");
8300 : }
8301 : }
8302 : }
8303 : }
8304 : }
8305 : } else {
8306 2 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow == DataSizing::AutoSize) {
8307 2 : if (state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).OASysExists) {
8308 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow = 0.0;
8309 : } else {
8310 0 : if (!(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedCooling > 0 &&
8311 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedHeating > 0)) {
8312 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow =
8313 0 : min(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow);
8314 : } else {
8315 0 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSpecMSHPIndex > -1) {
8316 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow =
8317 0 : min(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatVolumeFlowRate[1],
8318 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolVolumeFlowRate[1]);
8319 : }
8320 : }
8321 : }
8322 4 : BaseSizer::reportSizerOutput(state,
8323 2 : tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type],
8324 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name,
8325 : "Design Size Outdoor Air Flow Rate When No Cooling or Heating Heating is Needed [m3/s]",
8326 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow);
8327 : }
8328 : }
8329 :
8330 62 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatingCoilPresent) {
8331 11 : bool ErrorsFound = false;
8332 11 : TempSize = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxSATFromSuppHeatCoil;
8333 11 : MaxHeaterOutletTempSizer sizerMaxHeaterOutTemp;
8334 11 : std::string stringOverride = "Maximum Supply Air Temperature from Supplemental Heater [C]";
8335 11 : if (state.dataGlobal->isEpJSON) stringOverride = "maximum_supply_air_temperature_from_supplemental_heater [C]";
8336 11 : sizerMaxHeaterOutTemp.overrideSizingString(stringOverride);
8337 11 : sizerMaxHeaterOutTemp.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
8338 11 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxSATFromSuppHeatCoil = sizerMaxHeaterOutTemp.size(state, TempSize, ErrorsFound);
8339 11 : }
8340 :
8341 62 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num == HVAC::Coil_HeatingWater) {
8342 2 : bool ErrorsFound = false;
8343 2 : WaterCoils::SetCoilDesFlow(state,
8344 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType,
8345 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName,
8346 2 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow,
8347 : ErrorsFound);
8348 : }
8349 :
8350 62 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatingCoilPresent) {
8351 11 : CompType = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType;
8352 11 : CompName = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName;
8353 11 : PrintFlag = false; // why isn't this being reported?
8354 11 : TempSize = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSuppHeatingCapacity;
8355 11 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num == HVAC::Coil_HeatingWater) {
8356 : // sizing result should always be reported
8357 2 : if (TempSize == DataSizing::AutoSize) {
8358 0 : WaterHeatingCapacitySizer sizerWaterHeatingCapacity;
8359 0 : bool ErrorsFound = false;
8360 0 : std::string stringOverride = "Supplemental Heating Coil Nominal Capacity [W]";
8361 0 : if (state.dataGlobal->isEpJSON) stringOverride = "supplemental_heating_coil_nominal_capacity [W]";
8362 0 : sizerWaterHeatingCapacity.overrideSizingString(stringOverride);
8363 0 : sizerWaterHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
8364 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSuppHeatingCapacity = sizerWaterHeatingCapacity.size(state, TempSize, ErrorsFound);
8365 0 : }
8366 : } else {
8367 9 : SizingString = "Supplemental Heating Coil Nominal Capacity [W]";
8368 9 : if (TempSize == DataSizing::AutoSize) {
8369 7 : bool errorsFound = false;
8370 7 : HeatingCapacitySizer sizerHeatingCapacity;
8371 7 : sizerHeatingCapacity.overrideSizingString(SizingString);
8372 7 : sizerHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
8373 7 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSuppHeatingCapacity = sizerHeatingCapacity.size(state, TempSize, errorsFound);
8374 7 : }
8375 : }
8376 : }
8377 :
8378 62 : EqSizing.CoolingAirFlow = true;
8379 62 : EqSizing.CoolingAirVolFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow;
8380 62 : EqSizing.HeatingAirFlow = true;
8381 62 : EqSizing.HeatingAirVolFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow;
8382 :
8383 62 : if (CheckVRFCombinationRatio(VRFCond)) {
8384 62 : OnOffAirFlowRat = 1.0;
8385 : // set up the outside air data for sizing the DX coils
8386 62 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInZone) state.dataSize->ZoneEqDXCoil = true;
8387 62 : if (state.dataSize->CurZoneEqNum > 0) {
8388 85 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow > 0.0 ||
8389 25 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow > 0.0) {
8390 35 : EqSizing.OAVolFlow =
8391 35 : max(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow);
8392 : } else {
8393 25 : EqSizing.OAVolFlow = 0.0;
8394 : }
8395 : } else {
8396 2 : EqSizing.OAVolFlow = 0.0;
8397 : }
8398 :
8399 62 : Real64 SuppHeatCoilLoad = 0.0;
8400 : // simulate the TU to size the coils
8401 62 : if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmType == AlgorithmType::FluidTCtrl) {
8402 : // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control
8403 16 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF_FluidTCtrl(
8404 : state, VRFTUNum, true, 0.0, TUCoolingCapacity, OnOffAirFlowRat, SuppHeatCoilLoad);
8405 : } else {
8406 : // Algorithm Type: VRF model based on system curve
8407 46 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF(state, VRFTUNum, true, 0.0, TUCoolingCapacity, OnOffAirFlowRat, SuppHeatCoilLoad);
8408 : }
8409 :
8410 : // ZoneEqDXCoil = .FALSE.
8411 62 : TUCoolingCapacity = 0.0;
8412 62 : TUHeatingCapacity = 0.0;
8413 62 : bool FoundAll = true;
8414 : bool errFlag; // temporary variable used for error checking
8415 62 : int TUListNum = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex;
8416 204 : for (int NumTU = 1; NumTU <= state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList; ++NumTU) {
8417 190 : int TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU);
8418 190 : if (state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex > 0) {
8419 570 : DXCoilCap = DXCoils::GetCoilCapacityByIndexType(state,
8420 190 : state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex,
8421 190 : state.dataHVACVarRefFlow->VRFTU(TUIndex).DXCoolCoilType_Num,
8422 : errFlag);
8423 190 : TUCoolingCapacity += DXCoilCap;
8424 190 : if (DXCoilCap == AutoSize) {
8425 48 : FoundAll = false;
8426 48 : break;
8427 : }
8428 : }
8429 142 : if (state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatCoilIndex > 0) {
8430 426 : DXCoilCap = DXCoils::GetCoilCapacityByIndexType(state,
8431 142 : state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatCoilIndex,
8432 142 : state.dataHVACVarRefFlow->VRFTU(TUIndex).DXHeatCoilType_Num,
8433 : errFlag);
8434 142 : TUHeatingCapacity += DXCoilCap;
8435 142 : if (DXCoilCap == AutoSize) {
8436 0 : FoundAll = false;
8437 0 : break;
8438 : }
8439 : }
8440 : }
8441 :
8442 62 : if (FoundAll && (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmType == AlgorithmType::SysCurve)) {
8443 : // Size VRF rated cooling/heating capacity (VRF-SysCurve Model)
8444 :
8445 : // Size VRF( VRFCond ).CoolingCapacity
8446 10 : IsAutoSize = false;
8447 10 : if (state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity == AutoSize) {
8448 10 : IsAutoSize = true;
8449 : }
8450 10 : CoolingCapacityDes = TUCoolingCapacity;
8451 10 : if (IsAutoSize) {
8452 10 : state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity = CoolingCapacityDes;
8453 30 : BaseSizer::reportSizerOutput(state,
8454 20 : std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)),
8455 10 : state.dataHVACVarRefFlow->VRF(VRFCond).Name,
8456 : "Design Size Rated Total Cooling Capacity (gross) [W]",
8457 : CoolingCapacityDes);
8458 : } else {
8459 0 : if (state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity > 0.0 && CoolingCapacityDes > 0.0) {
8460 0 : CoolingCapacityUser = state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity;
8461 0 : BaseSizer::reportSizerOutput(state,
8462 0 : std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)),
8463 0 : state.dataHVACVarRefFlow->VRF(VRFCond).Name,
8464 : "Design Size Rated Total Cooling Capacity (gross) [W]",
8465 : CoolingCapacityDes,
8466 : "User-Specified Rated Total Cooling Capacity (gross) [W]",
8467 : CoolingCapacityUser);
8468 0 : if (state.dataGlobal->DisplayExtraWarnings) {
8469 0 : if ((std::abs(CoolingCapacityDes - CoolingCapacityUser) / CoolingCapacityUser) > state.dataSize->AutoVsHardSizingThreshold) {
8470 0 : ShowMessage(state,
8471 0 : format("SizeVRF: Potential issue with equipment sizing for {} {}",
8472 0 : cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum),
8473 0 : state.dataHVACVarRefFlow->VRFTU(VRFCond).Name));
8474 0 : ShowContinueError(state,
8475 0 : format("User-Specified Rated Total Cooling Capacity (gross) of {:.2R} [W]", CoolingCapacityUser));
8476 0 : ShowContinueError(
8477 0 : state, format("differs from Design Size Rated Total Cooling Capacity (gross) of {:.2R} [W]", CoolingCapacityDes));
8478 0 : ShowContinueError(state, "This may, or may not, indicate mismatched component sizes.");
8479 0 : ShowContinueError(state, "Verify that the value entered is intended and is consistent with other components.");
8480 : }
8481 : }
8482 : }
8483 : }
8484 :
8485 10 : if (state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity > 0.0) {
8486 10 : state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCombinationRatio =
8487 10 : TUCoolingCapacity / state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity;
8488 : }
8489 :
8490 : // Size VRF( VRFCond ).HeatingCapacity
8491 10 : IsAutoSize = false;
8492 10 : if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity == AutoSize) {
8493 10 : IsAutoSize = true;
8494 : }
8495 10 : if (state.dataHVACVarRefFlow->VRF(VRFCond).LockHeatingCapacity) {
8496 2 : HeatingCapacityDes =
8497 2 : state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity * state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacitySizeRatio;
8498 : } else {
8499 8 : HeatingCapacityDes = TUHeatingCapacity;
8500 : }
8501 10 : if (IsAutoSize) {
8502 10 : state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity = HeatingCapacityDes;
8503 30 : BaseSizer::reportSizerOutput(state,
8504 20 : std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)),
8505 10 : state.dataHVACVarRefFlow->VRF(VRFCond).Name,
8506 : "Design Size Rated Total Heating Capacity [W]",
8507 : HeatingCapacityDes);
8508 : } else {
8509 0 : if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity > 0.0 && HeatingCapacityDes > 0.0) {
8510 0 : HeatingCapacityUser = state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity;
8511 0 : BaseSizer::reportSizerOutput(state,
8512 0 : std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)),
8513 0 : state.dataHVACVarRefFlow->VRF(VRFCond).Name,
8514 : "Design Size Rated Total Heating Capacity [W]",
8515 : HeatingCapacityDes,
8516 : "User-Specified Rated Total Heating Capacity [W]",
8517 : HeatingCapacityUser);
8518 0 : if (state.dataGlobal->DisplayExtraWarnings) {
8519 0 : if ((std::abs(HeatingCapacityDes - HeatingCapacityUser) / HeatingCapacityUser) > state.dataSize->AutoVsHardSizingThreshold) {
8520 0 : ShowMessage(state,
8521 0 : format("SizeVRF: Potential issue with equipment sizing for {} {}",
8522 0 : cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum),
8523 0 : state.dataHVACVarRefFlow->VRFTU(VRFCond).Name));
8524 0 : ShowContinueError(state, format("User-Specified Rated Total Heating Capacity of {:.2R} [W]", HeatingCapacityUser));
8525 0 : ShowContinueError(state,
8526 0 : format("differs from Design Size Rated Total Heating Capacity of {:.2R} [W]", HeatingCapacityDes));
8527 0 : ShowContinueError(state, "This may, or may not, indicate mismatched component sizes.");
8528 0 : ShowContinueError(state, "Verify that the value entered is intended and is consistent with other components.");
8529 : }
8530 : }
8531 : }
8532 : }
8533 :
8534 10 : if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity > 0.0) {
8535 10 : state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCombinationRatio =
8536 10 : TUHeatingCapacity / state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity;
8537 : }
8538 :
8539 : // calculate the piping correction factors only once
8540 10 : if (state.dataHVACVarRefFlow->VRF(VRFCond).PCFLengthCoolPtr > 0) {
8541 : {
8542 10 : if (state.dataCurveManager->PerfCurve(state.dataHVACVarRefFlow->VRF(VRFCond).PCFLengthCoolPtr)->numDims == 2) {
8543 10 : state.dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionCooling =
8544 10 : min(1.0,
8545 : max(0.5,
8546 40 : CurveValue(state,
8547 10 : state.dataHVACVarRefFlow->VRF(VRFCond).PCFLengthCoolPtr,
8548 10 : state.dataHVACVarRefFlow->VRF(VRFCond).EquivPipeLngthCool,
8549 10 : state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCombinationRatio) +
8550 10 : state.dataHVACVarRefFlow->VRF(VRFCond).VertPipeLngth * state.dataHVACVarRefFlow->VRF(VRFCond).PCFHeightCool));
8551 : } else {
8552 0 : state.dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionCooling =
8553 0 : min(1.0,
8554 : max(0.5,
8555 0 : CurveValue(state,
8556 0 : state.dataHVACVarRefFlow->VRF(VRFCond).PCFLengthCoolPtr,
8557 0 : state.dataHVACVarRefFlow->VRF(VRFCond).EquivPipeLngthCool) +
8558 0 : state.dataHVACVarRefFlow->VRF(VRFCond).VertPipeLngth * state.dataHVACVarRefFlow->VRF(VRFCond).PCFHeightCool));
8559 : }
8560 : }
8561 : } else {
8562 0 : state.dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionCooling = min(
8563 : 1.0,
8564 0 : max(0.5, (1.0 + state.dataHVACVarRefFlow->VRF(VRFCond).VertPipeLngth * state.dataHVACVarRefFlow->VRF(VRFCond).PCFHeightCool)));
8565 : }
8566 :
8567 10 : if (state.dataHVACVarRefFlow->VRF(VRFCond).PCFLengthHeatPtr > 0) {
8568 : {
8569 0 : if (state.dataCurveManager->PerfCurve(state.dataHVACVarRefFlow->VRF(VRFCond).PCFLengthHeatPtr)->numDims == 2) {
8570 0 : state.dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionHeating =
8571 0 : min(1.0,
8572 : max(0.5,
8573 0 : CurveValue(state,
8574 0 : state.dataHVACVarRefFlow->VRF(VRFCond).PCFLengthHeatPtr,
8575 0 : state.dataHVACVarRefFlow->VRF(VRFCond).EquivPipeLngthHeat,
8576 0 : state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCombinationRatio) +
8577 0 : state.dataHVACVarRefFlow->VRF(VRFCond).VertPipeLngth * state.dataHVACVarRefFlow->VRF(VRFCond).PCFHeightHeat));
8578 : } else {
8579 0 : state.dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionHeating =
8580 0 : min(1.0,
8581 : max(0.5,
8582 0 : CurveValue(state,
8583 0 : state.dataHVACVarRefFlow->VRF(VRFCond).PCFLengthHeatPtr,
8584 0 : state.dataHVACVarRefFlow->VRF(VRFCond).EquivPipeLngthHeat) +
8585 0 : state.dataHVACVarRefFlow->VRF(VRFCond).VertPipeLngth * state.dataHVACVarRefFlow->VRF(VRFCond).PCFHeightHeat));
8586 : }
8587 : }
8588 : } else {
8589 10 : state.dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionHeating = min(
8590 : 1.0,
8591 10 : max(0.5, (1.0 + state.dataHVACVarRefFlow->VRF(VRFCond).VertPipeLngth * state.dataHVACVarRefFlow->VRF(VRFCond).PCFHeightHeat)));
8592 : }
8593 :
8594 10 : state.dataHVACVarRefFlow->VRF(VRFCond).RatedCoolingPower =
8595 10 : state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity / state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCOP;
8596 10 : state.dataHVACVarRefFlow->VRF(VRFCond).RatedHeatingPower =
8597 10 : state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity / state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCOP;
8598 :
8599 10 : if (state.dataHVACVarRefFlow->VRF(VRFCond).CoolCombRatioPTR > 0) {
8600 10 : state.dataHVACVarRefFlow->CoolCombinationRatio(VRFCond) = CurveValue(
8601 10 : state, state.dataHVACVarRefFlow->VRF(VRFCond).CoolCombRatioPTR, state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCombinationRatio);
8602 : } else {
8603 0 : state.dataHVACVarRefFlow->CoolCombinationRatio(VRFCond) = 1.0;
8604 : }
8605 :
8606 10 : if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatCombRatioPTR > 0) {
8607 10 : state.dataHVACVarRefFlow->HeatCombinationRatio(VRFCond) = CurveValue(
8608 10 : state, state.dataHVACVarRefFlow->VRF(VRFCond).HeatCombRatioPTR, state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCombinationRatio);
8609 : } else {
8610 0 : state.dataHVACVarRefFlow->HeatCombinationRatio(VRFCond) = 1.0;
8611 : }
8612 : }
8613 :
8614 62 : if (FoundAll && (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmType == AlgorithmType::FluidTCtrl)) {
8615 : // Size VRF rated evaporative capacity (VRF-FluidTCtrl Model)
8616 : // Set piping correction factors to 1.0 here for reporting to eio output - recalculated every time step in
8617 : // VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl
8618 4 : state.dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionCooling = 1.0;
8619 4 : state.dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionHeating = 1.0;
8620 :
8621 : // Size VRF( VRFCond ).RatedEvapCapacity
8622 4 : IsAutoSize = false;
8623 4 : if (state.dataHVACVarRefFlow->VRF(VRFCond).RatedEvapCapacity == AutoSize) {
8624 2 : IsAutoSize = true;
8625 : }
8626 :
8627 4 : CoolingCapacityDes = TUCoolingCapacity;
8628 4 : HeatingCapacityDes = TUHeatingCapacity;
8629 :
8630 4 : if (IsAutoSize) {
8631 : // RatedEvapCapacity
8632 2 : state.dataHVACVarRefFlow->VRF(VRFCond).RatedEvapCapacity =
8633 2 : max(CoolingCapacityDes, HeatingCapacityDes / (1 + state.dataHVACVarRefFlow->VRF(VRFCond).RatedCompPowerPerCapcity));
8634 :
8635 : // Other parameters dependent on RatedEvapCapacity
8636 2 : state.dataHVACVarRefFlow->VRF(VRFCond).RatedCompPower =
8637 2 : state.dataHVACVarRefFlow->VRF(VRFCond).RatedCompPowerPerCapcity * state.dataHVACVarRefFlow->VRF(VRFCond).RatedEvapCapacity;
8638 2 : state.dataHVACVarRefFlow->VRF(VRFCond).RatedOUFanPower =
8639 2 : state.dataHVACVarRefFlow->VRF(VRFCond).RatedOUFanPowerPerCapcity * state.dataHVACVarRefFlow->VRF(VRFCond).RatedEvapCapacity;
8640 2 : state.dataHVACVarRefFlow->VRF(VRFCond).OUAirFlowRate =
8641 2 : state.dataHVACVarRefFlow->VRF(VRFCond).OUAirFlowRatePerCapcity * state.dataHVACVarRefFlow->VRF(VRFCond).RatedEvapCapacity;
8642 :
8643 2 : state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity = state.dataHVACVarRefFlow->VRF(VRFCond).RatedEvapCapacity;
8644 2 : state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity =
8645 2 : state.dataHVACVarRefFlow->VRF(VRFCond).RatedEvapCapacity * (1 + state.dataHVACVarRefFlow->VRF(VRFCond).RatedCompPowerPerCapcity);
8646 :
8647 6 : BaseSizer::reportSizerOutput(state,
8648 4 : std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)),
8649 2 : state.dataHVACVarRefFlow->VRF(VRFCond).Name,
8650 : "Design Size Rated Total Heating Capacity [W]",
8651 2 : state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity);
8652 6 : BaseSizer::reportSizerOutput(state,
8653 4 : std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)),
8654 2 : state.dataHVACVarRefFlow->VRF(VRFCond).Name,
8655 : "Design Size Rated Total Cooling Capacity (gross) [W]",
8656 2 : state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity);
8657 : } else {
8658 2 : CoolingCapacityUser = state.dataHVACVarRefFlow->VRF(VRFCond).RatedEvapCapacity;
8659 2 : HeatingCapacityUser = state.dataHVACVarRefFlow->VRF(VRFCond).RatedHeatCapacity;
8660 :
8661 6 : BaseSizer::reportSizerOutput(state,
8662 4 : std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)),
8663 2 : state.dataHVACVarRefFlow->VRF(VRFCond).Name,
8664 : "Design Size Rated Total Cooling Capacity (gross) [W]",
8665 : CoolingCapacityDes,
8666 : "User-Specified Rated Total Cooling Capacity (gross) [W]",
8667 : CoolingCapacityUser);
8668 6 : BaseSizer::reportSizerOutput(state,
8669 4 : std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)),
8670 2 : state.dataHVACVarRefFlow->VRF(VRFCond).Name,
8671 : "Design Size Rated Total Heating Capacity [W]",
8672 : HeatingCapacityDes,
8673 : "User-Specified Rated Total Heating Capacity [W]",
8674 : HeatingCapacityUser);
8675 :
8676 2 : if (state.dataGlobal->DisplayExtraWarnings) {
8677 1 : if ((std::abs(CoolingCapacityDes - CoolingCapacityUser) / CoolingCapacityUser) > state.dataSize->AutoVsHardSizingThreshold) {
8678 2 : ShowMessage(state,
8679 2 : format("SizeVRF: Potential issue with equipment sizing for {} {}",
8680 1 : cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum),
8681 1 : state.dataHVACVarRefFlow->VRFTU(VRFCond).Name));
8682 1 : ShowContinueError(state, format("User-Specified Rated Total Cooling Capacity (gross) of {:.2R} [W]", CoolingCapacityUser));
8683 2 : ShowContinueError(state,
8684 2 : format("differs from Design Size Rated Total Cooling Capacity (gross) of {:.2R} [W]", CoolingCapacityDes));
8685 1 : ShowContinueError(state, "This may, or may not, indicate mismatched component sizes.");
8686 1 : ShowContinueError(state, "Verify that the value entered is intended and is consistent with other components.");
8687 : }
8688 :
8689 1 : if ((std::abs(HeatingCapacityDes - HeatingCapacityUser) / HeatingCapacityUser) > state.dataSize->AutoVsHardSizingThreshold) {
8690 2 : ShowMessage(state,
8691 2 : format("SizeVRF: Potential issue with equipment sizing for {} {}",
8692 1 : cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum),
8693 1 : state.dataHVACVarRefFlow->VRFTU(VRFCond).Name));
8694 1 : ShowContinueError(state, format("User-Specified Rated Total Heating Capacity of {:.2R} [W]", HeatingCapacityUser));
8695 1 : ShowContinueError(state, format("differs from Design Size Rated Total Heating Capacity of {:.2R} [W]", HeatingCapacityDes));
8696 1 : ShowContinueError(state, "This may, or may not, indicate mismatched component sizes.");
8697 1 : ShowContinueError(state, "Verify that the value entered is intended and is consistent with other components.");
8698 : }
8699 : }
8700 : }
8701 : }
8702 :
8703 62 : if (FoundAll) {
8704 : // autosize resistive defrost heater capacity
8705 14 : IsAutoSize = false;
8706 14 : if (state.dataHVACVarRefFlow->VRF(VRFCond).DefrostCapacity == AutoSize) {
8707 8 : IsAutoSize = true;
8708 : }
8709 14 : if (state.dataHVACVarRefFlow->VRF(VRFCond).DefrostStrategy == StandardRatings::DefrostStrat::Resistive) {
8710 10 : DefrostCapacityDes = state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity;
8711 : } else {
8712 4 : DefrostCapacityDes = 0.0;
8713 : }
8714 14 : if (IsAutoSize) {
8715 8 : state.dataHVACVarRefFlow->VRF(VRFCond).DefrostCapacity = DefrostCapacityDes;
8716 24 : BaseSizer::reportSizerOutput(state,
8717 16 : std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)),
8718 8 : state.dataHVACVarRefFlow->VRF(VRFCond).Name,
8719 : "Design Size Resistive Defrost Heater Capacity [W]",
8720 : DefrostCapacityDes);
8721 : } else {
8722 6 : if (state.dataHVACVarRefFlow->VRF(VRFCond).DefrostCapacity > 0.0 && DefrostCapacityDes > 0.0) {
8723 2 : DefrostCapacityUser = state.dataHVACVarRefFlow->VRF(VRFCond).DefrostCapacity;
8724 6 : BaseSizer::reportSizerOutput(state,
8725 4 : std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)),
8726 2 : state.dataHVACVarRefFlow->VRF(VRFCond).Name,
8727 : "Design Size Resistive Defrost Heater Capacity [W]",
8728 : DefrostCapacityDes,
8729 : "User-Specified Resistive Defrost Heater Capacity",
8730 : DefrostCapacityUser);
8731 2 : if (state.dataGlobal->DisplayExtraWarnings) {
8732 0 : if ((std::abs(DefrostCapacityDes - DefrostCapacityUser) / DefrostCapacityUser) > state.dataSize->AutoVsHardSizingThreshold) {
8733 0 : ShowMessage(state,
8734 0 : format("SizeVRF: Potential issue with equipment sizing for {} {}",
8735 0 : cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum),
8736 0 : state.dataHVACVarRefFlow->VRFTU(VRFCond).Name));
8737 0 : ShowContinueError(state, format("User-Specified Resistive Defrost Heater Capacity of {:.2R} [W]", DefrostCapacityUser));
8738 0 : ShowContinueError(state,
8739 0 : format("differs from Design Size Resistive Defrost Heater Capacity of {:.2R} [W]", DefrostCapacityDes));
8740 0 : ShowContinueError(state, "This may, or may not, indicate mismatched component sizes.");
8741 0 : ShowContinueError(state, "Verify that the value entered is intended and is consistent with other components.");
8742 : }
8743 : }
8744 : }
8745 : }
8746 :
8747 14 : IsAutoSize = false;
8748 14 : if (state.dataHVACVarRefFlow->VRF(VRFCond).EvapCondAirVolFlowRate == AutoSize) {
8749 2 : IsAutoSize = true;
8750 : }
8751 : // Auto-size condenser air flow to Total Capacity * 0.000114 m3/s/w (850 cfm/ton)
8752 14 : EvapCondAirVolFlowRateDes = state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity * 0.000114;
8753 14 : if (IsAutoSize) {
8754 2 : state.dataHVACVarRefFlow->VRF(VRFCond).EvapCondAirVolFlowRate = EvapCondAirVolFlowRateDes;
8755 6 : BaseSizer::reportSizerOutput(state,
8756 4 : std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)),
8757 2 : state.dataHVACVarRefFlow->VRF(VRFCond).Name,
8758 : "Design Size Evaporative Condenser Air Flow Rate [m3/s]",
8759 : EvapCondAirVolFlowRateDes);
8760 : } else {
8761 12 : if (state.dataHVACVarRefFlow->VRF(VRFCond).EvapCondAirVolFlowRate > 0.0 && EvapCondAirVolFlowRateDes > 0.0) {
8762 0 : EvapCondAirVolFlowRateUser = state.dataHVACVarRefFlow->VRF(VRFCond).EvapCondAirVolFlowRate;
8763 0 : BaseSizer::reportSizerOutput(state,
8764 0 : std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)),
8765 0 : state.dataHVACVarRefFlow->VRF(VRFCond).Name,
8766 : "Design Size Evaporative Condenser Air Flow Rate [m3/s]",
8767 : EvapCondAirVolFlowRateDes,
8768 : "User-Specified Evaporative Condenser Air Flow Rate [m3/s]",
8769 : EvapCondAirVolFlowRateUser);
8770 0 : if (state.dataGlobal->DisplayExtraWarnings) {
8771 0 : if ((std::abs(EvapCondAirVolFlowRateDes - EvapCondAirVolFlowRateUser) / EvapCondAirVolFlowRateUser) >
8772 0 : state.dataSize->AutoVsHardSizingThreshold) {
8773 0 : ShowMessage(state,
8774 0 : format("SizeVRF: Potential issue with equipment sizing for {} {}",
8775 0 : cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum),
8776 0 : state.dataHVACVarRefFlow->VRFTU(VRFCond).Name));
8777 0 : ShowContinueError(
8778 0 : state, format("User-Specified Evaporative Condenser Air Flow Rate of {:.5R} [m3/s]", EvapCondAirVolFlowRateUser));
8779 0 : ShowContinueError(
8780 : state,
8781 0 : format("differs from Design Size Evaporative Condenser Air Flow Rate of {:.5R} [m3/s]", EvapCondAirVolFlowRateDes));
8782 0 : ShowContinueError(state, "This may, or may not, indicate mismatched component sizes.");
8783 0 : ShowContinueError(state, "Verify that the value entered is intended and is consistent with other components.");
8784 : }
8785 : }
8786 : }
8787 : }
8788 :
8789 14 : IsAutoSize = false;
8790 14 : if (state.dataHVACVarRefFlow->VRF(VRFCond).EvapCondPumpPower == AutoSize) {
8791 0 : IsAutoSize = true;
8792 : }
8793 : // Auto-size evap condenser pump power to Total Capacity * 0.004266 w/w (15 w/ton)
8794 14 : EvapCondPumpPowerDes = state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity * 0.004266;
8795 14 : if (IsAutoSize) {
8796 0 : state.dataHVACVarRefFlow->VRF(VRFCond).EvapCondPumpPower = EvapCondPumpPowerDes;
8797 0 : BaseSizer::reportSizerOutput(state,
8798 0 : std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)),
8799 0 : state.dataHVACVarRefFlow->VRF(VRFCond).Name,
8800 : "Design Size Evaporative Condenser Pump Rated Power Consumption [W]",
8801 : EvapCondPumpPowerDes);
8802 :
8803 : } else {
8804 14 : if (state.dataHVACVarRefFlow->VRF(VRFCond).EvapCondPumpPower > 0.0 && EvapCondPumpPowerDes > 0.0) {
8805 0 : EvapCondPumpPowerUser = state.dataHVACVarRefFlow->VRF(VRFCond).EvapCondPumpPower;
8806 0 : BaseSizer::reportSizerOutput(state,
8807 0 : std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)),
8808 0 : state.dataHVACVarRefFlow->VRF(VRFCond).Name,
8809 : "Design Size Evaporative Condenser Pump Rated Power Consumption [W]",
8810 : EvapCondPumpPowerDes,
8811 : "User-Specified Evaporative Condenser Pump Rated Power Consumption [W]",
8812 : EvapCondPumpPowerUser);
8813 0 : if (state.dataGlobal->DisplayExtraWarnings) {
8814 0 : if ((std::abs(EvapCondPumpPowerDes - EvapCondPumpPowerUser) / EvapCondPumpPowerUser) >
8815 0 : state.dataSize->AutoVsHardSizingThreshold) {
8816 0 : ShowMessage(state,
8817 0 : format("SizeVRF: Potential issue with equipment sizing for {} {}",
8818 0 : cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum),
8819 0 : state.dataHVACVarRefFlow->VRFTU(VRFCond).Name));
8820 0 : ShowContinueError(
8821 : state,
8822 0 : format("User-Specified Evaporative Condenser Pump Rated Power Consumption of {:.2R} [W]", EvapCondPumpPowerUser));
8823 0 : ShowContinueError(state,
8824 0 : format("differs from Design Size Evaporative Condenser Pump Rated Power Consumption of {:.2R} [W]",
8825 : EvapCondPumpPowerDes));
8826 0 : ShowContinueError(state, "This may, or may not, indicate mismatched component sizes.");
8827 0 : ShowContinueError(state, "Verify that the value entered is intended and is consistent with other components.");
8828 : }
8829 : }
8830 : }
8831 : }
8832 :
8833 : // Report to eio other information not related to autosizing
8834 14 : if (state.dataHVACVarRefFlow->MyOneTimeEIOFlag) {
8835 : static constexpr std::string_view Format_990(
8836 : "! <VRF System Information>, VRF System Type, VRF System Name, VRF System Cooling Combination Ratio, VRF "
8837 : "System Heating Combination Ratio, VRF System Cooling Piping Correction Factor, VRF System Heating Piping "
8838 : "Correction Factor\n");
8839 13 : print(state.files.eio, Format_990);
8840 13 : state.dataHVACVarRefFlow->MyOneTimeEIOFlag = false;
8841 : }
8842 : static constexpr std::string_view Format_991(" VRF System Information, {}, {}, {:.5R}, {:.5R}, {:.5R}, {:.5R}\n");
8843 14 : print(state.files.eio,
8844 : Format_991,
8845 14 : cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum),
8846 14 : state.dataHVACVarRefFlow->VRF(VRFCond).Name,
8847 14 : state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCombinationRatio,
8848 14 : state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCombinationRatio,
8849 14 : state.dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionCooling,
8850 14 : state.dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionHeating);
8851 :
8852 14 : CheckVRFCombinationRatio(VRFCond) = false;
8853 : }
8854 : }
8855 :
8856 62 : state.dataSize->DataScalableCapSizingON = false;
8857 62 : }
8858 :
8859 5 : void VRFCondenserEquipment::SizeVRFCondenser(EnergyPlusData &state)
8860 : {
8861 :
8862 : // SUBROUTINE INFORMATION:
8863 : // AUTHOR Richard Raustad, FSEC
8864 : // DATE WRITTEN August 2012
8865 : // MODIFIED na
8866 : // RE-ENGINEERED na
8867 :
8868 : // PURPOSE OF THIS SUBROUTINE:
8869 : // This subroutine is for sizing VRF Condenser.
8870 :
8871 : // METHODOLOGY EMPLOYED:
8872 : // Set water-cooled plant flow rates.
8873 :
8874 : static constexpr std::string_view RoutineName("SizeVRFCondenser");
8875 :
8876 : Real64 rho; // local fluid density [kg/m3]
8877 : Real64 Cp; // local fluid specific heat [J/kg-k]
8878 : Real64 tmpCondVolFlowRate; // local condenser design volume flow rate [m3/s]
8879 :
8880 : // save the design water flow rate for use by the water loop sizing algorithms
8881 5 : if (this->CondenserType == DataHeatBalance::RefrigCondenserType::Water) {
8882 :
8883 5 : bool ErrorsFound = false;
8884 5 : if (this->WaterCondVolFlowRate == DataSizing::AutoSize) {
8885 1 : int PltSizCondNum = 0;
8886 1 : if (this->SourcePlantLoc.loopNum > 0) PltSizCondNum = state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).PlantSizNum;
8887 1 : if (PltSizCondNum > 0) {
8888 1 : rho = FluidProperties::GetDensityGlycol(state,
8889 1 : state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidName,
8890 1 : state.dataSize->PlantSizData(PltSizCondNum).ExitTemp,
8891 1 : state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidIndex,
8892 : RoutineName);
8893 :
8894 1 : Cp = FluidProperties::GetSpecificHeatGlycol(state,
8895 1 : state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidName,
8896 1 : state.dataSize->PlantSizData(PltSizCondNum).ExitTemp,
8897 1 : state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidIndex,
8898 : RoutineName);
8899 1 : tmpCondVolFlowRate =
8900 1 : max(this->CoolingCapacity, this->HeatingCapacity) / (state.dataSize->PlantSizData(PltSizCondNum).DeltaT * Cp * rho);
8901 1 : if (this->HeatingCapacity != DataSizing::AutoSize && this->CoolingCapacity != DataSizing::AutoSize) {
8902 1 : this->WaterCondVolFlowRate = tmpCondVolFlowRate;
8903 1 : BaseSizer::reportSizerOutput(state,
8904 : "AirConditioner:VariableRefrigerantFlow",
8905 : this->Name,
8906 : "Design Condenser Water Flow Rate [m3/s]",
8907 : this->WaterCondVolFlowRate);
8908 : }
8909 :
8910 1 : rho = FluidProperties::GetDensityGlycol(state,
8911 1 : state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidName,
8912 : Constant::CWInitConvTemp,
8913 1 : state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidIndex,
8914 : RoutineName);
8915 1 : this->WaterCondenserDesignMassFlow = this->WaterCondVolFlowRate * rho;
8916 1 : PlantUtilities::InitComponentNodes(
8917 : state, 0.0, this->WaterCondenserDesignMassFlow, this->CondenserNodeNum, this->CondenserOutletNodeNum);
8918 :
8919 : } else {
8920 0 : ShowSevereError(state, "Autosizing of condenser water flow rate requires a condenser loop Sizing:Plant object");
8921 0 : ShowContinueError(state, format("... occurs in AirConditioner:VariableRefrigerantFlow object={}", this->Name));
8922 0 : ShowContinueError(state, "... plant loop name must be referenced in Sizing:Plant object");
8923 0 : ErrorsFound = true;
8924 : }
8925 : }
8926 :
8927 5 : if (ErrorsFound) {
8928 0 : ShowFatalError(state, "Preceding sizing errors cause program termination");
8929 : }
8930 :
8931 5 : PlantUtilities::RegisterPlantCompDesignFlow(state, this->CondenserNodeNum, this->WaterCondVolFlowRate);
8932 : }
8933 5 : }
8934 :
8935 250981 : void SimVRF(EnergyPlusData &state,
8936 : int const VRFTUNum,
8937 : bool const FirstHVACIteration,
8938 : Real64 &OnOffAirFlowRatio,
8939 : Real64 &SysOutputProvided,
8940 : Real64 &LatOutputProvided,
8941 : Real64 const QZnReq)
8942 : {
8943 :
8944 : // SUBROUTINE INFORMATION:
8945 : // AUTHOR Richard Raustad, FSEC
8946 : // DATE WRITTEN August 2010
8947 : // MODIFIED na
8948 : // RE-ENGINEERED na
8949 :
8950 : // PURPOSE OF THIS SUBROUTINE:
8951 : // This subroutine simulates the VRF TU's.
8952 :
8953 : // METHODOLOGY EMPLOYED:
8954 : // Simulate terminal unit to meet zone load.
8955 :
8956 250981 : Real64 PartLoadRatio(1.0);
8957 250981 : Real64 SuppHeatCoilLoad(0.0); // supplemental heating coil load (W)
8958 :
8959 250981 : if (state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).VRFAlgorithmType == AlgorithmType::FluidTCtrl) {
8960 : // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control
8961 63201 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ControlVRF_FluidTCtrl(
8962 : state, VRFTUNum, QZnReq, FirstHVACIteration, PartLoadRatio, OnOffAirFlowRatio, SuppHeatCoilLoad);
8963 63201 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF_FluidTCtrl(
8964 : state, VRFTUNum, FirstHVACIteration, PartLoadRatio, SysOutputProvided, OnOffAirFlowRatio, SuppHeatCoilLoad, LatOutputProvided);
8965 63201 : if (PartLoadRatio ==
8966 : 0.0) { // set coil inlet conditions when coil does not operate. Inlet conditions are set in ControlVRF_FluidTCtrl when PLR=1
8967 3818 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingCoilPresent) {
8968 3818 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).coilInNodeT =
8969 3818 : state.dataLoopNodes->Node(state.dataDXCoils->DXCoil(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex).AirInNode).Temp;
8970 3818 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).coilInNodeW =
8971 3818 : state.dataLoopNodes->Node(state.dataDXCoils->DXCoil(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex).AirInNode).HumRat;
8972 : } else {
8973 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).coilInNodeT =
8974 0 : state.dataLoopNodes->Node(state.dataDXCoils->DXCoil(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex).AirInNode).Temp;
8975 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).coilInNodeW =
8976 0 : state.dataLoopNodes->Node(state.dataDXCoils->DXCoil(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex).AirInNode).HumRat;
8977 : }
8978 : }
8979 : // CalcVRF( VRFTUNum, FirstHVACIteration, PartLoadRatio, SysOutputProvided, OnOffAirFlowRatio, LatOutputProvided );
8980 : } else {
8981 : // Algorithm Type: VRF model based on system curve
8982 187780 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ControlVRF(
8983 : state, VRFTUNum, QZnReq, FirstHVACIteration, PartLoadRatio, OnOffAirFlowRatio, SuppHeatCoilLoad);
8984 187780 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF(
8985 : state, VRFTUNum, FirstHVACIteration, PartLoadRatio, SysOutputProvided, OnOffAirFlowRatio, SuppHeatCoilLoad, LatOutputProvided);
8986 : }
8987 :
8988 250981 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TerminalUnitSensibleRate = SysOutputProvided;
8989 250981 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TerminalUnitLatentRate = LatOutputProvided;
8990 250981 : }
8991 :
8992 187780 : void VRFTerminalUnitEquipment::ControlVRF(EnergyPlusData &state,
8993 : int const VRFTUNum, // Index to VRF terminal unit
8994 : Real64 const QZnReq, // Index to zone number
8995 : bool const FirstHVACIteration, // flag for 1st HVAC iteration in the time step
8996 : Real64 &PartLoadRatio, // unit part load ratio
8997 : Real64 &OnOffAirFlowRatio, // ratio of compressor ON airflow to AVERAGE airflow over timestep
8998 : Real64 &SuppHeatCoilLoad // supplemental heating coil load (W)
8999 : )
9000 : {
9001 :
9002 : // SUBROUTINE INFORMATION:
9003 : // AUTHOR Richard Raustad
9004 : // DATE WRITTEN July 2005
9005 :
9006 : // PURPOSE OF THIS SUBROUTINE:
9007 : // Determine the part load fraction of the heat pump for this time step.
9008 :
9009 : // METHODOLOGY EMPLOYED:
9010 : // Use RegulaFalsi technique to iterate on part-load ratio until convergence is achieved.
9011 :
9012 187780 : PartLoadRatio = 0.0;
9013 187780 : state.dataHVACVarRefFlow->LoopDXCoolCoilRTF = 0.0;
9014 187780 : state.dataHVACVarRefFlow->LoopDXHeatCoilRTF = 0.0;
9015 187780 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatPartLoadRatio = 0.0;
9016 :
9017 : // The RETURNS here will jump back to SimVRF where the CalcVRF routine will simulate with latest PLR
9018 :
9019 : // do nothing else if TU is scheduled off
9020 187780 : if (ScheduleManager::GetCurrentScheduleValue(state, this->SchedPtr) == 0.0) return;
9021 :
9022 : // do nothing if TU has no load (TU will be modeled using PLR=0)
9023 187780 : if (QZnReq == 0.0) return;
9024 :
9025 : // Set EMS value for PLR and return
9026 163659 : if (this->EMSOverridePartLoadFrac) {
9027 0 : PartLoadRatio = this->EMSValueForPartLoadFrac;
9028 0 : return;
9029 : }
9030 :
9031 : // Get result when DX coil is operating at the minimum PLR (1E-20) if not otherwise specified
9032 163659 : PartLoadRatio = this->MinOperatingPLR;
9033 :
9034 163659 : this->ControlVRFToLoad(state, VRFTUNum, QZnReq, FirstHVACIteration, PartLoadRatio, OnOffAirFlowRatio, SuppHeatCoilLoad);
9035 : }
9036 :
9037 163659 : void VRFTerminalUnitEquipment::ControlVRFToLoad(EnergyPlusData &state,
9038 : int const VRFTUNum,
9039 : Real64 const QZnReq,
9040 : bool const FirstHVACIteration,
9041 : Real64 &PartLoadRatio,
9042 : Real64 &OnOffAirFlowRatio,
9043 : Real64 &SuppHeatCoilLoad)
9044 : {
9045 :
9046 163659 : int constexpr MaxIte(500); // maximum number of iterations
9047 163659 : Real64 constexpr MinPLF(0.0); // minimum part load factor allowed
9048 163659 : Real64 constexpr ErrorTol(0.001); // tolerance for RegulaFalsi iterations
9049 :
9050 163659 : int VRFCond = this->VRFSysNum;
9051 163659 : Real64 FullOutput = 0.0; // unit full output when compressor is operating [W]
9052 163659 : Real64 TempOutput = 0.0; // unit output when iteration limit exceeded [W]
9053 163659 : Real64 TempMinPLR = 0.0; // min PLR used in Regula Falsi call
9054 163659 : Real64 TempMaxPLR = 0.0; // max PLR used in Regula Falsi call
9055 163659 : Real64 NoCompOutput = 0.0; // output when no active compressor [W]
9056 163659 : bool VRFCoolingMode = state.dataHVACVarRefFlow->CoolingLoad(VRFCond);
9057 163659 : bool VRFHeatingMode = state.dataHVACVarRefFlow->HeatingLoad(VRFCond);
9058 163659 : int IndexToTUInTUList = this->IndexToTUInTUList;
9059 163659 : auto &thisVRFCond = state.dataHVACVarRefFlow->VRF(VRFCond);
9060 163659 : int TUListIndex = thisVRFCond.ZoneTUListPtr;
9061 163659 : bool HRCoolingMode = state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList);
9062 163659 : bool HRHeatingMode = state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList);
9063 163659 : auto &thisVRFTU = state.dataHVACVarRefFlow->VRFTU(VRFTUNum);
9064 :
9065 163659 : if (thisVRFCond.VRFAlgorithmType == AlgorithmType::FluidTCtrl) {
9066 : // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control
9067 0 : this->CalcVRF_FluidTCtrl(state, VRFTUNum, FirstHVACIteration, PartLoadRatio, NoCompOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
9068 : } else {
9069 : // Algorithm Type: VRF model based on system curve
9070 163659 : this->CalcVRF(state, VRFTUNum, FirstHVACIteration, PartLoadRatio, NoCompOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
9071 : }
9072 :
9073 163659 : bool DXCoolingCoilOprCtrl = true;
9074 :
9075 163659 : if (VRFCoolingMode && HRHeatingMode) {
9076 : // IF the system is in cooling mode, but the terminal unit requests heating (heat recovery)
9077 0 : if (NoCompOutput >= QZnReq) {
9078 0 : PartLoadRatio = 0.0;
9079 29498 : return;
9080 : }
9081 163659 : } else if (VRFHeatingMode && HRCoolingMode) {
9082 : // IF the system is in heating mode, but the terminal unit requests cooling (heat recovery)
9083 5 : if (NoCompOutput <= QZnReq) {
9084 0 : PartLoadRatio = 0.0;
9085 0 : return;
9086 : }
9087 163654 : } else if (VRFCoolingMode || HRCoolingMode) {
9088 : // IF the system is in cooling mode and/or the terminal unit requests cooling
9089 81856 : if (NoCompOutput <= QZnReq) {
9090 0 : DXCoolingCoilOprCtrl = false;
9091 0 : if (!this->SuppHeatingCoilPresent || HRCoolingMode) {
9092 0 : PartLoadRatio = 0.0;
9093 0 : return;
9094 : }
9095 : }
9096 81798 : } else if (VRFHeatingMode || HRHeatingMode) {
9097 : // IF the system is in heating mode and/or the terminal unit requests heating
9098 69276 : if (NoCompOutput >= QZnReq) {
9099 15 : PartLoadRatio = 0.0;
9100 15 : return;
9101 : }
9102 : }
9103 :
9104 : // Otherwise the coil needs to turn on. Get full load result
9105 163644 : PartLoadRatio = 1.0;
9106 163644 : if (!DXCoolingCoilOprCtrl) PartLoadRatio = 0.0;
9107 163644 : if (thisVRFCond.VRFAlgorithmType == AlgorithmType::FluidTCtrl) {
9108 : // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control
9109 0 : this->CalcVRF_FluidTCtrl(state, VRFTUNum, FirstHVACIteration, PartLoadRatio, FullOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
9110 : } else {
9111 : // Algorithm Type: VRF model based on system curve
9112 163644 : if (this->NumOfSpeedHeating > 0 && VRFHeatingMode) {
9113 2676 : this->SpeedNum = this->NumOfSpeedHeating;
9114 2676 : this->SpeedRatio = 1.0;
9115 2676 : this->CycRatio = 1.0;
9116 : }
9117 163644 : if (this->NumOfSpeedCooling > 0 && VRFCoolingMode) {
9118 3127 : this->SpeedNum = this->NumOfSpeedCooling;
9119 3127 : this->SpeedRatio = 1.0;
9120 3127 : this->CycRatio = 1.0;
9121 : }
9122 163644 : this->CalcVRF(state, VRFTUNum, FirstHVACIteration, PartLoadRatio, FullOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
9123 : }
9124 :
9125 : // set supplemental heating coil calculation if the condition requires
9126 163644 : if (this->SuppHeatingCoilPresent) {
9127 14453 : if (this->isSetPointControlled) {
9128 0 : auto const &thisSuppHeatCoilAirInletNode = state.dataLoopNodes->Node(this->SuppHeatCoilAirInletNode);
9129 0 : if (this->suppTempSetPoint > thisSuppHeatCoilAirInletNode.Temp) {
9130 0 : Real64 mDot = thisSuppHeatCoilAirInletNode.MassFlowRate;
9131 0 : Real64 Tin = thisSuppHeatCoilAirInletNode.Temp;
9132 0 : Real64 Win = thisSuppHeatCoilAirInletNode.HumRat;
9133 0 : Real64 CpAirIn = Psychrometrics::PsyCpAirFnW(Win);
9134 0 : SuppHeatCoilLoad = mDot * CpAirIn * (this->suppTempSetPoint - Tin);
9135 0 : this->SuppHeatingCoilLoad = SuppHeatCoilLoad;
9136 : } else {
9137 0 : SuppHeatCoilLoad = 0.0;
9138 : }
9139 : } else {
9140 : // not sure why FirstHVAC has anything to do with this but that was already here
9141 : // another branch should test removing FirstHVACIteration to get same answer each iteration
9142 14453 : if (!FirstHVACIteration &&
9143 7219 : ((QZnReq > HVAC::SmallLoad && QZnReq > FullOutput) || (((QZnReq - NoCompOutput) > HVAC::SmallLoad) && QZnReq <= 0.0))) {
9144 2416 : Real64 ZoneLoad = 0.0;
9145 2416 : Real64 LoadToHeatingSP = 0.0;
9146 2416 : Real64 LoadToCoolingSP = 0.0;
9147 2416 : getVRFTUZoneLoad(state, VRFTUNum, ZoneLoad, LoadToHeatingSP, LoadToCoolingSP, false);
9148 2416 : if ((QZnReq - NoCompOutput) > HVAC::SmallLoad && QZnReq <= 0.0) {
9149 61 : if (LoadToHeatingSP < 0.0 && QZnReq == 0.0) {
9150 0 : SuppHeatCoilLoad = max(0.0, LoadToHeatingSP - FullOutput);
9151 : } else {
9152 61 : SuppHeatCoilLoad = max(0.0, QZnReq - FullOutput);
9153 : }
9154 2355 : } else if (FullOutput < (LoadToHeatingSP - HVAC::SmallLoad) && LoadToHeatingSP > 0.0) {
9155 2074 : if (QZnReq > 0.0 && (NoCompOutput - QZnReq) >= HVAC::SmallLoad) {
9156 0 : SuppHeatCoilLoad = 0.0;
9157 : } else {
9158 2074 : SuppHeatCoilLoad = max(0.0, LoadToHeatingSP - FullOutput);
9159 : }
9160 : } else {
9161 281 : SuppHeatCoilLoad = 0.0;
9162 : }
9163 2416 : } else {
9164 12037 : SuppHeatCoilLoad = 0.0;
9165 : }
9166 : }
9167 14453 : if (this->DesignSuppHeatingCapacity > 0.0) {
9168 14453 : this->SuppHeatPartLoadRatio = min(1.0, SuppHeatCoilLoad / this->DesignSuppHeatingCapacity);
9169 : }
9170 : } else { // does it matter what these are if there is no supp heater?
9171 149191 : SuppHeatCoilLoad = 0.0;
9172 149191 : this->SuppHeatPartLoadRatio = 0.0;
9173 : }
9174 :
9175 163644 : if ((VRFCoolingMode && !thisVRFCond.HeatRecoveryUsed) || (thisVRFCond.HeatRecoveryUsed && HRCoolingMode)) {
9176 : // Since we are cooling, we expect FullOutput < NoCompOutput
9177 : // If the QZnReq <= FullOutput the unit needs to run full out
9178 81861 : if (QZnReq <= FullOutput) {
9179 : // if no coil present in terminal unit, no need to reset PLR?
9180 4895 : if (thisVRFTU.CoolingCoilPresent && DXCoolingCoilOprCtrl) {
9181 4895 : PartLoadRatio = 1.0;
9182 : // the zone set point could be exceeded if set point control is used so protect against that
9183 4895 : if (this->isSetPointControlled) {
9184 0 : if (state.dataLoopNodes->Node(this->coolCoilAirOutNode).Temp > this->coilTempSetPoint) return;
9185 : } else {
9186 4895 : return;
9187 : }
9188 : } else {
9189 0 : PartLoadRatio = 0.0;
9190 0 : return;
9191 : }
9192 : }
9193 81783 : } else if ((VRFHeatingMode && !thisVRFCond.HeatRecoveryUsed) || (thisVRFCond.HeatRecoveryUsed && HRHeatingMode)) {
9194 : // Since we are heating, we expect FullOutput > NoCompOutput
9195 : // If the QZnReq >= FullOutput the unit needs to run full out
9196 69261 : if (QZnReq >= FullOutput) {
9197 : // if no coil present in terminal unit, no need reset PLR?
9198 12066 : if (this->HeatingCoilPresent) {
9199 12066 : PartLoadRatio = 1.0;
9200 : // the zone set point could be exceeded if set point control is used so protect against that
9201 12066 : if (this->isSetPointControlled) {
9202 1 : if (state.dataLoopNodes->Node(this->heatCoilAirOutNode).Temp < this->coilTempSetPoint) return;
9203 : } else {
9204 12065 : return;
9205 : }
9206 : } else {
9207 0 : PartLoadRatio = 0.0;
9208 0 : return;
9209 : }
9210 : }
9211 : } else {
9212 : // VRF terminal unit is off
9213 : // shouldn't actually get here
9214 12522 : PartLoadRatio = 0.0;
9215 12522 : return;
9216 : }
9217 :
9218 : // The coil will not operate at PLR=0 or PLR=1, calculate the operating part-load ratio
9219 :
9220 134161 : if ((VRFHeatingMode || HRHeatingMode) || ((VRFCoolingMode && DXCoolingCoilOprCtrl) || HRCoolingMode)) {
9221 :
9222 134161 : int NumOfSpeed = 1;
9223 134161 : if (this->NumOfSpeedHeating > 1 && ((VRFHeatingMode || HRHeatingMode))) {
9224 2676 : NumOfSpeed = this->NumOfSpeedHeating;
9225 : }
9226 134161 : if (this->NumOfSpeedCooling > 1 && ((VRFCoolingMode || HRCoolingMode))) {
9227 3127 : NumOfSpeed = this->NumOfSpeedCooling;
9228 : }
9229 :
9230 134161 : for (int SpeedNum = 1; SpeedNum <= NumOfSpeed; ++SpeedNum) {
9231 :
9232 134161 : if (NumOfSpeed > 1) {
9233 5803 : this->SpeedNum = SpeedNum;
9234 5803 : this->CalcVRF(state, VRFTUNum, FirstHVACIteration, 1.0, FullOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
9235 5803 : if ((VRFHeatingMode || HRHeatingMode) && QZnReq >= FullOutput) continue;
9236 5803 : if ((VRFCoolingMode || HRCoolingMode) && QZnReq <= FullOutput) continue;
9237 : }
9238 :
9239 134161 : if (SpeedNum == 1) {
9240 134161 : this->SpeedRatio = 0.0;
9241 : }
9242 134161 : int SolFla = 0; // Flag of RegulaFalsi solver
9243 9579449 : auto f = [&state, VRFTUNum, FirstHVACIteration, QZnReq, OnOffAirFlowRatio](Real64 const PartLoadRatio) {
9244 940933 : Real64 QZnReqTemp = QZnReq; // denominator representing zone load (W)
9245 : Real64 ActualOutput; // delivered capacity of VRF terminal unit
9246 940933 : Real64 SuppHeatCoilLoad = 0.0;
9247 940933 : bool setPointControlled = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isSetPointControlled;
9248 940933 : Real64 nonConstOnOffAirFlowRatio = OnOffAirFlowRatio;
9249 :
9250 940933 : if (state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).VRFAlgorithmType ==
9251 : AlgorithmType::FluidTCtrl) {
9252 : // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control
9253 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF_FluidTCtrl(
9254 : state, VRFTUNum, FirstHVACIteration, PartLoadRatio, ActualOutput, nonConstOnOffAirFlowRatio, SuppHeatCoilLoad);
9255 : } else {
9256 : // Algorithm Type: VRF model based on system curve
9257 940933 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF(
9258 : state, VRFTUNum, FirstHVACIteration, PartLoadRatio, ActualOutput, nonConstOnOffAirFlowRatio, SuppHeatCoilLoad);
9259 : }
9260 :
9261 940933 : if (setPointControlled) {
9262 11986 : Real64 outletNodeT = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum).Temp;
9263 11986 : return (outletNodeT - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).coilTempSetPoint);
9264 : } else {
9265 928947 : if (std::abs(QZnReq) < 100.0) QZnReqTemp = sign(100.0, QZnReq);
9266 928947 : return (ActualOutput - QZnReq) / QZnReqTemp;
9267 : }
9268 134161 : };
9269 134161 : General::SolveRoot(state, ErrorTol, MaxIte, SolFla, PartLoadRatio, f, 0.0, 1.0);
9270 134161 : if (SpeedNum == 1) {
9271 134161 : if (this->NumOfSpeedCooling > 1 || this->NumOfSpeedHeating > 1) {
9272 5803 : this->CycRatio = PartLoadRatio;
9273 : }
9274 134161 : this->SpeedRatio = 0.0;
9275 134161 : if (SolFla > 0 && PartLoadRatio <= 1.0) break;
9276 : } else {
9277 0 : this->CycRatio = 1.0;
9278 0 : this->SpeedRatio = PartLoadRatio;
9279 0 : if (SolFla > 0 && PartLoadRatio <= 1.0) break;
9280 : }
9281 :
9282 0 : if (SolFla == -1) {
9283 : // Very low loads may not converge quickly. Tighten PLR boundary and try again.
9284 0 : TempMaxPLR = -0.1;
9285 0 : bool ContinueIter = true;
9286 0 : while (ContinueIter && TempMaxPLR < 1.0) {
9287 0 : TempMaxPLR += 0.1;
9288 :
9289 0 : if (thisVRFCond.VRFAlgorithmType == AlgorithmType::FluidTCtrl) {
9290 : // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control
9291 0 : this->CalcVRF_FluidTCtrl(state, VRFTUNum, FirstHVACIteration, TempMaxPLR, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
9292 : } else {
9293 : // Algorithm Type: VRF model based on system curve
9294 0 : this->CalcVRF(state, VRFTUNum, FirstHVACIteration, TempMaxPLR, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
9295 : }
9296 :
9297 0 : if (VRFHeatingMode && TempOutput > QZnReq) ContinueIter = false;
9298 0 : if (VRFCoolingMode && TempOutput < QZnReq) ContinueIter = false;
9299 : }
9300 0 : TempMinPLR = TempMaxPLR;
9301 0 : ContinueIter = true;
9302 0 : while (ContinueIter && TempMinPLR > 0.0) {
9303 0 : TempMaxPLR = TempMinPLR;
9304 0 : TempMinPLR -= 0.01;
9305 :
9306 0 : if (thisVRFCond.VRFAlgorithmType == AlgorithmType::FluidTCtrl) {
9307 : // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control
9308 0 : this->CalcVRF_FluidTCtrl(state, VRFTUNum, FirstHVACIteration, TempMinPLR, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
9309 : } else {
9310 : // Algorithm Type: VRF model based on system curve
9311 0 : this->CalcVRF(state, VRFTUNum, FirstHVACIteration, TempMinPLR, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
9312 : }
9313 :
9314 0 : if (VRFHeatingMode && TempOutput < QZnReq) ContinueIter = false;
9315 0 : if (VRFCoolingMode && TempOutput > QZnReq) ContinueIter = false;
9316 : }
9317 0 : General::SolveRoot(state, ErrorTol, MaxIte, SolFla, PartLoadRatio, f, TempMinPLR, TempMaxPLR);
9318 0 : if (SolFla == -1) {
9319 0 : if (!FirstHVACIteration && !state.dataGlobal->WarmupFlag) {
9320 0 : if (this->IterLimitExceeded == 0) {
9321 0 : ShowWarningMessage(state, format("{} \"{}\"", tuTypeNames[(int)this->type], this->Name));
9322 0 : ShowContinueError(
9323 : state,
9324 0 : format(" Iteration limit exceeded calculating terminal unit part-load ratio, maximum iterations = {}", MaxIte));
9325 0 : ShowContinueErrorTimeStamp(state, format(" Part-load ratio returned = {:.3R}", PartLoadRatio));
9326 :
9327 0 : if (thisVRFCond.VRFAlgorithmType == AlgorithmType::FluidTCtrl) {
9328 : // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control
9329 0 : this->CalcVRF_FluidTCtrl(
9330 : state, VRFTUNum, FirstHVACIteration, PartLoadRatio, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
9331 : } else {
9332 : // Algorithm Type: VRF model based on system curve
9333 0 : this->CalcVRF(state, VRFTUNum, FirstHVACIteration, PartLoadRatio, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
9334 : }
9335 :
9336 0 : ShowContinueError(state, format(" Load requested = {:.5T}, Load delivered = {:.5T}", QZnReq, TempOutput));
9337 0 : ShowRecurringWarningErrorAtEnd(state,
9338 0 : format("{} \"{}\" -- Terminal unit Iteration limit exceeded error continues...",
9339 0 : tuTypeNames[(int)this->type],
9340 0 : this->Name),
9341 0 : this->IterLimitExceeded);
9342 : } else {
9343 0 : ShowRecurringWarningErrorAtEnd(state,
9344 0 : format("{} \"{}\" -- Terminal unit Iteration limit exceeded error continues...",
9345 0 : tuTypeNames[(int)this->type],
9346 0 : this->Name),
9347 0 : this->IterLimitExceeded);
9348 : }
9349 : }
9350 0 : } else if (SolFla == -2) {
9351 0 : if (!FirstHVACIteration && !state.dataGlobal->WarmupFlag) {
9352 0 : if (thisVRFTU.FirstIterfailed == 0) {
9353 0 : ShowWarningMessage(state, format("{} \"{}\"", tuTypeNames[(int)this->type], this->Name));
9354 0 : ShowContinueError(state, "Terminal unit part-load ratio calculation failed: PLR limits of 0 to 1 exceeded");
9355 0 : ShowContinueError(state, "Please fill out a bug report and forward to the EnergyPlus support group.");
9356 0 : ShowContinueErrorTimeStamp(state, "");
9357 0 : ShowRecurringWarningErrorAtEnd(
9358 : state,
9359 0 : format("{} \"{}\" -- Terminal unit part-load ratio limits of 0 to 1 exceeded error continues...",
9360 0 : tuTypeNames[(int)this->type],
9361 0 : this->Name),
9362 0 : this->FirstIterfailed);
9363 : } else {
9364 0 : ShowRecurringWarningErrorAtEnd(
9365 : state,
9366 0 : format("{} \"{}\" -- Terminal unit part-load ratio limits of 0 to 1 exceeded error continues...",
9367 0 : tuTypeNames[(int)this->type],
9368 0 : this->Name),
9369 0 : thisVRFTU.FirstIterfailed);
9370 : }
9371 : }
9372 0 : PartLoadRatio = max(MinPLF, std::abs(QZnReq - NoCompOutput) / std::abs(FullOutput - NoCompOutput));
9373 : }
9374 0 : } else if (SolFla == -2) {
9375 0 : if (!FirstHVACIteration && !state.dataGlobal->WarmupFlag) {
9376 0 : if (thisVRFTU.FirstIterfailed == 0) {
9377 0 : ShowWarningMessage(state, format("{} \"{}\"", tuTypeNames[(int)this->type], this->Name));
9378 :
9379 0 : ShowContinueError(state, "Terminal unit part-load ratio calculation failed: PLR limits of 0 to 1 exceeded");
9380 0 : ShowContinueError(state, "Please fill out a bug report and forward to the EnergyPlus support group.");
9381 0 : ShowContinueErrorTimeStamp(state, "");
9382 0 : ShowRecurringWarningErrorAtEnd(
9383 : state,
9384 0 : format("{} \"{}\" -- Terminal unit part-load ratio limits of 0 to 1 exceeded error continues...",
9385 0 : tuTypeNames[(int)this->type],
9386 0 : " \"" + this->Name),
9387 0 : this->FirstIterfailed);
9388 : } else {
9389 0 : ShowRecurringWarningErrorAtEnd(
9390 : state,
9391 0 : format("{} \"{}\" -- Terminal unit part-load ratio limits of 0 to 1 exceeded error continues...",
9392 0 : tuTypeNames[(int)this->type],
9393 0 : this->Name),
9394 0 : this->FirstIterfailed);
9395 : }
9396 : }
9397 0 : if (FullOutput - NoCompOutput == 0.0) {
9398 0 : PartLoadRatio = 0.0;
9399 : } else {
9400 0 : PartLoadRatio = min(1.0, max(MinPLF, std::abs(QZnReq - NoCompOutput) / std::abs(FullOutput - NoCompOutput)));
9401 : }
9402 : }
9403 : }
9404 : }
9405 : }
9406 :
9407 1704059 : void VRFTerminalUnitEquipment::CalcVRF(EnergyPlusData &state,
9408 : int const VRFTUNum, // Unit index in VRF terminal unit array
9409 : bool const FirstHVACIteration, // flag for 1st HVAC iteration in the time step
9410 : Real64 const PartLoadRatio, // compressor part load fraction
9411 : Real64 &LoadMet, // load met by unit (W)
9412 : Real64 &OnOffAirFlowRatio, // ratio of ON air flow to average air flow
9413 : Real64 &SuppHeatCoilLoad, // supplemental heating coil load (W)
9414 : ObjexxFCL::Optional<Real64> LatOutputProvided // delivered latent capacity (kgWater/s)
9415 : )
9416 : {
9417 :
9418 : // SUBROUTINE INFORMATION:
9419 : // AUTHOR Richard Raustad
9420 : // DATE WRITTEN July 2005
9421 : // MODIFIED July 2012, Chandan Sharma - FSEC: Added zone sys avail managers
9422 : // RE-ENGINEERED na
9423 :
9424 : // PURPOSE OF THIS SUBROUTINE:
9425 : // Simulate the components making up the VRF terminal unit.
9426 :
9427 : // METHODOLOGY EMPLOYED:
9428 : // Simulates the unit components sequentially in the air flow direction.
9429 :
9430 : using DXCoils::SimDXCoil;
9431 : using SingleDuct::SimATMixer;
9432 : using SteamCoils::SimulateSteamCoilComponents;
9433 : using WaterCoils::SimulateWaterCoilComponents;
9434 :
9435 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
9436 : int VRFTUOutletNodeNum; // TU air outlet node
9437 : int VRFTUInletNodeNum; // TU air inlet node
9438 : Real64 AirMassFlow; // total supply air mass flow [m3/s]
9439 : HVAC::FanOp fanOp; // fan operating mode, HVAC::FanOp::Cycling or HVAC::FanOp::Continuous
9440 : int VRFCond; // index to VRF condenser
9441 1704059 : Real64 SpecHumOut(0.0); // specific humidity ratio at outlet node
9442 1704059 : Real64 SpecHumIn(0.0); // specific humidity ratio at inlet node
9443 : int TUListIndex; // index to TU list for this VRF system
9444 : int IndexToTUInTUList; // index to TU in specific list for the VRF system
9445 : int ZoneNode; // Zone node of VRFTU is serving
9446 :
9447 1704059 : VRFCond = this->VRFSysNum;
9448 1704059 : TUListIndex = state.dataHVACVarRefFlow->VRF(VRFCond).ZoneTUListPtr;
9449 1704059 : IndexToTUInTUList = this->IndexToTUInTUList;
9450 1704059 : VRFTUOutletNodeNum = this->VRFTUOutletNodeNum;
9451 1704059 : VRFTUInletNodeNum = this->VRFTUInletNodeNum;
9452 1704059 : fanOp = this->fanOp;
9453 1704059 : ZoneNode = this->ZoneAirNode;
9454 :
9455 : // Set inlet air mass flow rate based on PLR and compressor on/off air flow rates
9456 1704059 : SetAverageAirFlow(state, VRFTUNum, PartLoadRatio, OnOffAirFlowRatio);
9457 :
9458 1704059 : AirMassFlow = state.dataLoopNodes->Node(VRFTUInletNodeNum).MassFlowRate;
9459 1704059 : if (this->ATMixerExists) {
9460 : // There is an air terminal mixer
9461 360197 : state.dataHVACVarRefFlow->ATMixOutNode = this->ATMixerOutNode;
9462 360197 : if (this->ATMixerType == HVAC::MixerType::InletSide) { // if there is an inlet side air terminal mixer
9463 : // set the primary air inlet mass flow rate
9464 224226 : state.dataLoopNodes->Node(this->ATMixerPriNode).MassFlowRate =
9465 224226 : min(state.dataLoopNodes->Node(this->ATMixerPriNode).MassFlowRateMaxAvail, state.dataLoopNodes->Node(VRFTUInletNodeNum).MassFlowRate);
9466 : // now calculate the the mixer outlet air conditions (and the secondary air inlet flow rate). The mixer outlet flow rate has already
9467 : // been set above (it is the "inlet" node flow rate)
9468 224226 : SimATMixer(state, this->ATMixerName, FirstHVACIteration, this->ATMixerIndex);
9469 : }
9470 : } else {
9471 : // ATMixOutNode = 0;
9472 1343862 : if (this->OAMixerUsed) MixedAir::SimOAMixer(state, this->OAMixerName, this->OAMixerIndex);
9473 : }
9474 : // if blow through, simulate fan then coils
9475 1704059 : if (this->fanPlace == HVAC::FanPlace::BlowThru) {
9476 190907 : if (this->fanType == HVAC::FanType::SystemModel) {
9477 0 : if (OnOffAirFlowRatio > 0.0) {
9478 0 : state.dataFans->fans(this->FanIndex)->simulate(state, FirstHVACIteration, _, _);
9479 : } else {
9480 0 : state.dataFans->fans(this->FanIndex)->simulate(state, FirstHVACIteration, _, _, PartLoadRatio);
9481 : }
9482 : } else {
9483 190907 : state.dataFans->fans(this->FanIndex)->simulate(state, FirstHVACIteration, state.dataHVACVarRefFlow->FanSpeedRatio);
9484 : }
9485 : }
9486 :
9487 1704059 : if (this->CoolingCoilPresent) {
9488 : // above condition for heat pump mode, below condition for heat recovery mode
9489 2430733 : if ((!state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && state.dataHVACVarRefFlow->CoolingLoad(VRFCond)) ||
9490 726674 : (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed &&
9491 173677 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList))) {
9492 2177312 : SimDXCoil(state,
9493 : "",
9494 : HVAC::CompressorOp::On,
9495 : FirstHVACIteration,
9496 1088656 : this->CoolCoilIndex,
9497 : fanOp,
9498 : PartLoadRatio,
9499 : OnOffAirFlowRatio,
9500 : _,
9501 1088656 : state.dataHVACVarRefFlow->MaxCoolingCapacity(VRFCond),
9502 1088656 : state.dataHVACVarRefFlow->VRF(this->VRFSysNum).VRFCondCyclingRatio);
9503 : } else { // cooling coil is off
9504 615403 : SimDXCoil(state, "", HVAC::CompressorOp::Off, FirstHVACIteration, this->CoolCoilIndex, fanOp, 0.0, OnOffAirFlowRatio);
9505 : }
9506 1704059 : state.dataHVACVarRefFlow->LoopDXCoolCoilRTF = state.dataAirLoop->LoopDXCoilRTF;
9507 : } else {
9508 0 : state.dataHVACVarRefFlow->LoopDXCoolCoilRTF = 0.0;
9509 : }
9510 :
9511 1704059 : if (this->HeatingCoilPresent) {
9512 : // above condition for heat pump mode, below condition for heat recovery mode
9513 3014243 : if ((!state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && state.dataHVACVarRefFlow->HeatingLoad(VRFCond)) ||
9514 1310184 : (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed &&
9515 173677 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList))) {
9516 1343958 : SimDXCoil(state,
9517 : "",
9518 : HVAC::CompressorOp::Off,
9519 : FirstHVACIteration,
9520 447986 : this->HeatCoilIndex,
9521 : fanOp,
9522 : PartLoadRatio,
9523 : OnOffAirFlowRatio,
9524 : _,
9525 447986 : state.dataHVACVarRefFlow->MaxHeatingCapacity(VRFCond));
9526 : } else {
9527 1256073 : SimDXCoil(state, "", HVAC::CompressorOp::Off, FirstHVACIteration, this->HeatCoilIndex, fanOp, 0.0, OnOffAirFlowRatio, _);
9528 : }
9529 1704059 : state.dataHVACVarRefFlow->LoopDXHeatCoilRTF = state.dataAirLoop->LoopDXCoilRTF;
9530 : } else {
9531 0 : state.dataHVACVarRefFlow->LoopDXHeatCoilRTF = 0.0;
9532 : }
9533 :
9534 : // if draw through, simulate coils then fan
9535 1704059 : if (this->fanPlace == HVAC::FanPlace::DrawThru) {
9536 1493647 : if (this->fanType == HVAC::FanType::SystemModel) {
9537 818301 : if (OnOffAirFlowRatio > 0.0) {
9538 782818 : state.dataFans->fans(this->FanIndex)->simulate(state, FirstHVACIteration, _, _);
9539 : } else {
9540 35483 : state.dataFans->fans(this->FanIndex)->simulate(state, FirstHVACIteration, _, _, PartLoadRatio);
9541 : }
9542 :
9543 : } else {
9544 675346 : state.dataFans->fans(this->FanIndex)->simulate(state, FirstHVACIteration, state.dataHVACVarRefFlow->FanSpeedRatio);
9545 : }
9546 : }
9547 :
9548 : // track fan power per terminal unit for calculating COP
9549 1704059 : this->FanPower = (this->FanIndex == 0) ? 0.0 : state.dataFans->fans(this->FanIndex)->totalPower;
9550 :
9551 : // run supplemental heating coil
9552 1704059 : if (this->SuppHeatingCoilPresent) {
9553 156472 : Real64 SuppPLR = this->SuppHeatPartLoadRatio;
9554 156472 : this->CalcVRFSuppHeatingCoil(state, VRFTUNum, FirstHVACIteration, SuppPLR, SuppHeatCoilLoad);
9555 156472 : if ((state.dataLoopNodes->Node(this->SuppHeatCoilAirOutletNode).Temp > this->MaxSATFromSuppHeatCoil) && SuppPLR > 0.0) {
9556 : // adjust the heating load to maximum allowed
9557 0 : Real64 MaxHeatCoilLoad = this->HeatingCoilCapacityLimit(state, this->SuppHeatCoilAirInletNode, this->MaxSATFromSuppHeatCoil);
9558 0 : this->CalcVRFSuppHeatingCoil(state, VRFTUNum, FirstHVACIteration, SuppPLR, MaxHeatCoilLoad);
9559 0 : SuppHeatCoilLoad = MaxHeatCoilLoad;
9560 : }
9561 : }
9562 :
9563 1704059 : Real64 LatentLoadMet = 0.0; // latent load delivered [kgWater/s]
9564 1704059 : Real64 TempOut = 0.0;
9565 1704059 : Real64 TempIn = 0.0;
9566 1704059 : if (this->ATMixerExists) {
9567 360197 : if (this->ATMixerType == HVAC::MixerType::SupplySide) {
9568 : // Air terminal supply side mixer, calculate supply side mixer output
9569 135971 : SimATMixer(state, this->ATMixerName, FirstHVACIteration, this->ATMixerIndex);
9570 135971 : TempOut = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->ATMixOutNode).Temp;
9571 135971 : SpecHumOut = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->ATMixOutNode).HumRat;
9572 135971 : AirMassFlow = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->ATMixOutNode).MassFlowRate;
9573 : } else {
9574 : // Air terminal inlet side mixer
9575 224226 : TempOut = state.dataLoopNodes->Node(VRFTUOutletNodeNum).Temp;
9576 224226 : SpecHumOut = state.dataLoopNodes->Node(VRFTUOutletNodeNum).HumRat;
9577 : }
9578 360197 : TempIn = state.dataLoopNodes->Node(ZoneNode).Temp;
9579 360197 : SpecHumIn = state.dataLoopNodes->Node(ZoneNode).HumRat;
9580 : } else {
9581 1343862 : TempOut = state.dataLoopNodes->Node(VRFTUOutletNodeNum).Temp;
9582 1343862 : SpecHumOut = state.dataLoopNodes->Node(VRFTUOutletNodeNum).HumRat;
9583 1343862 : if (ZoneNode > 0) {
9584 1324357 : TempIn = state.dataLoopNodes->Node(ZoneNode).Temp;
9585 1324357 : SpecHumIn = state.dataLoopNodes->Node(ZoneNode).HumRat;
9586 : } else {
9587 19505 : TempIn = state.dataLoopNodes->Node(VRFTUInletNodeNum).Temp;
9588 19505 : SpecHumIn = state.dataLoopNodes->Node(VRFTUInletNodeNum).HumRat;
9589 : }
9590 : }
9591 : // calculate sensible load met using delta enthalpy
9592 1704059 : LoadMet = AirMassFlow * PsyDeltaHSenFnTdb2W2Tdb1W1(TempOut, SpecHumOut, TempIn, SpecHumIn); // sensible {W}
9593 1704059 : LatentLoadMet = AirMassFlow * (SpecHumOut - SpecHumIn); // latent {kgWater/s}
9594 1704059 : if (present(LatOutputProvided)) {
9595 : // CR9155 Remove specific humidity calculations
9596 187780 : LatOutputProvided = LatentLoadMet;
9597 : }
9598 1704059 : }
9599 :
9600 250981 : void ReportVRFTerminalUnit(EnergyPlusData &state, int const VRFTUNum) // index to VRF terminal unit
9601 : {
9602 :
9603 : // SUBROUTINE INFORMATION:
9604 : // AUTHOR Richard Raustad, FSEC
9605 : // DATE WRITTEN August 2010
9606 : // MODIFIED na
9607 : // RE-ENGINEERED na
9608 :
9609 : // PURPOSE OF THIS SUBROUTINE:
9610 : // This subroutine updates the report variables for the VRF Terminal Units.
9611 :
9612 : using namespace DataSizing;
9613 :
9614 : Real64 TotalConditioning; // - sum of sensible and latent rates
9615 : Real64 SensibleConditioning; // - sensible rate
9616 : Real64 LatentConditioning; // - latent rate
9617 : Real64 ReportingConstant; // - used to convert watts to joules
9618 : int VRFCond; // - index to VRF condenser
9619 : int TUListIndex; // - index to terminal unit list
9620 : int IndexToTUInTUList; // - index to the TU in the list
9621 : bool HRHeatRequestFlag; // - indicates TU could be in heat mode
9622 : bool HRCoolRequestFlag; // - indicates TU could be in cool mode
9623 :
9624 250981 : VRFCond = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum;
9625 250981 : TUListIndex = state.dataHVACVarRefFlow->VRF(VRFCond).ZoneTUListPtr;
9626 250981 : IndexToTUInTUList = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).IndexToTUInTUList;
9627 250981 : HRHeatRequestFlag = state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList);
9628 250981 : HRCoolRequestFlag = state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList);
9629 250981 : ReportingConstant = state.dataHVACGlobal->TimeStepSysSec;
9630 :
9631 : // account for terminal unit parasitic On/Off power use
9632 : // account for heat recovery first since these flags will be FALSE otherwise, each TU may have different operating mode
9633 :
9634 250981 : if (HRCoolRequestFlag) {
9635 21511 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingCoilPresent) {
9636 21511 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower =
9637 21511 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElec * state.dataHVACVarRefFlow->LoopDXCoolCoilRTF +
9638 21511 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec * (1.0 - state.dataHVACVarRefFlow->LoopDXCoolCoilRTF);
9639 21511 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecCoolConsumption =
9640 21511 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower * ReportingConstant;
9641 21511 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower = 0.0;
9642 21511 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecHeatConsumption = 0.0;
9643 : } else {
9644 : // cooling parasitic power report variable is not even available when there is no cooling coil, report for heating
9645 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec;
9646 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecHeatConsumption =
9647 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower * ReportingConstant;
9648 : }
9649 229470 : } else if (HRHeatRequestFlag) {
9650 13791 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingCoilPresent) {
9651 13791 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower = 0.0;
9652 13791 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecCoolConsumption = 0.0;
9653 13791 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower =
9654 13791 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElec * state.dataHVACVarRefFlow->LoopDXHeatCoilRTF +
9655 13791 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec * (1.0 - state.dataHVACVarRefFlow->LoopDXHeatCoilRTF);
9656 13791 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecHeatConsumption =
9657 13791 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower * ReportingConstant;
9658 : } else {
9659 : // heating parasitic power report variable is not even available when there is no heating coil, report for cooling
9660 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec;
9661 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecCoolConsumption =
9662 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower * ReportingConstant;
9663 : }
9664 324567 : } else if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond) ||
9665 108888 : (!state.dataHVACVarRefFlow->HeatingLoad(VRFCond) &&
9666 28545 : state.dataHVACVarRefFlow->LastModeCooling(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum))) {
9667 120020 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingCoilPresent) {
9668 120020 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower =
9669 120020 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElec * state.dataHVACVarRefFlow->LoopDXCoolCoilRTF +
9670 120020 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec * (1.0 - state.dataHVACVarRefFlow->LoopDXCoolCoilRTF);
9671 120020 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecCoolConsumption =
9672 120020 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower * ReportingConstant;
9673 120020 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower = 0.0;
9674 120020 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecHeatConsumption = 0.0;
9675 : } else {
9676 : // cooling parasitic power report variable is not even available when there is no cooling coil, report for heating
9677 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec;
9678 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecHeatConsumption =
9679 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower * ReportingConstant;
9680 : }
9681 110975 : } else if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond) ||
9682 15316 : (!state.dataHVACVarRefFlow->CoolingLoad(VRFCond) &&
9683 15316 : state.dataHVACVarRefFlow->LastModeHeating(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum))) {
9684 95659 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingCoilPresent) {
9685 95659 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower = 0.0;
9686 95659 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecCoolConsumption = 0.0;
9687 95659 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower =
9688 95659 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElec * state.dataHVACVarRefFlow->LoopDXHeatCoilRTF +
9689 95659 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec * (1.0 - state.dataHVACVarRefFlow->LoopDXHeatCoilRTF);
9690 95659 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecHeatConsumption =
9691 95659 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower * ReportingConstant;
9692 : } else {
9693 : // heating parasitic power report variable is not even available when there is no heating coil, report for cooling
9694 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec;
9695 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecCoolConsumption =
9696 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower * ReportingConstant;
9697 : }
9698 : } else {
9699 : // happens when there is no cooling or heating load
9700 0 : if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingCoilPresent) {
9701 : // report all for heating
9702 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec;
9703 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecHeatConsumption =
9704 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower * ReportingConstant;
9705 0 : } else if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingCoilPresent) {
9706 : // report all for cooling
9707 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec;
9708 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecCoolConsumption =
9709 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower * ReportingConstant;
9710 : } else {
9711 : // split parasitic between both reporting variables
9712 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec / 2.0;
9713 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecCoolConsumption =
9714 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower * ReportingConstant;
9715 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec / 2.0;
9716 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecHeatConsumption =
9717 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower * ReportingConstant;
9718 : }
9719 : }
9720 :
9721 250981 : SensibleConditioning = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TerminalUnitSensibleRate;
9722 250981 : LatentConditioning = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TerminalUnitLatentRate;
9723 250981 : Real64 TempOut = 0.0;
9724 250981 : Real64 TempIn = 0.0;
9725 250981 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerExists) {
9726 30655 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerType == HVAC::MixerType::SupplySide) {
9727 : // Air terminal supply side mixer
9728 12262 : TempOut = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerOutNode).Temp;
9729 12262 : TempIn = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneAirNode).Temp;
9730 : } else {
9731 : // Air terminal inlet side mixer
9732 18393 : TempOut = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum).Temp;
9733 18393 : TempIn = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneAirNode).Temp;
9734 : }
9735 : } else {
9736 220326 : TempOut = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum).Temp;
9737 220326 : TempIn = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).Temp;
9738 : }
9739 : // latent heat vaporization/condensation used in moist air psychrometrics
9740 250981 : Real64 const H2OHtOfVap = PsyHgAirFnWTdb(0.0, TempOut);
9741 : // convert latent in kg/s to watts
9742 250981 : TotalConditioning = SensibleConditioning + (LatentConditioning * H2OHtOfVap);
9743 :
9744 250981 : if (TotalConditioning <= 0.0) {
9745 148757 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TotalCoolingRate = std::abs(TotalConditioning);
9746 148757 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TotalHeatingRate = 0.0;
9747 : } else {
9748 102224 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TotalCoolingRate = 0.0;
9749 102224 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TotalHeatingRate = TotalConditioning;
9750 : }
9751 250981 : if (SensibleConditioning <= 0.0) {
9752 153496 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SensibleCoolingRate = std::abs(SensibleConditioning);
9753 153496 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SensibleHeatingRate = 0.0;
9754 : } else {
9755 97485 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SensibleCoolingRate = 0.0;
9756 97485 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SensibleHeatingRate = SensibleConditioning;
9757 : }
9758 250981 : if (LatentConditioning <= 0.0) {
9759 191367 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).LatentCoolingRate = std::abs(LatentConditioning) * H2OHtOfVap;
9760 191367 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).LatentHeatingRate = 0.0;
9761 : } else {
9762 59614 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).LatentCoolingRate = 0.0;
9763 59614 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).LatentHeatingRate = LatentConditioning * H2OHtOfVap;
9764 : }
9765 250981 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TotalCoolingEnergy = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TotalCoolingRate * ReportingConstant;
9766 250981 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SensibleCoolingEnergy =
9767 250981 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SensibleCoolingRate * ReportingConstant;
9768 250981 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).LatentCoolingEnergy = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).LatentCoolingRate * ReportingConstant;
9769 250981 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TotalHeatingEnergy = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TotalHeatingRate * ReportingConstant;
9770 250981 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SensibleHeatingEnergy =
9771 250981 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SensibleHeatingRate * ReportingConstant;
9772 250981 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).LatentHeatingEnergy = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).LatentHeatingRate * ReportingConstant;
9773 :
9774 250981 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).firstPass) {
9775 122 : if (!state.dataHVACVarRefFlow->MySizeFlag(VRFTUNum)) {
9776 62 : DataSizing::resetHVACSizingGlobals(state, state.dataSize->CurZoneEqNum, 0, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).firstPass);
9777 : }
9778 : }
9779 :
9780 : // reset to 1 in case blow through fan configuration (fan resets to 1, but for blow thru fans coil sets back down < 1)
9781 250981 : state.dataHVACGlobal->OnOffFanPartLoadFraction = 1.0;
9782 250981 : }
9783 :
9784 57046 : void ReportVRFCondenser(EnergyPlusData &state, int const VRFCond) // index to VRF condensing unit
9785 : {
9786 :
9787 : // SUBROUTINE INFORMATION:
9788 : // AUTHOR Richard Raustad, FSEC
9789 : // DATE WRITTEN August 2010
9790 : // MODIFIED na
9791 : // RE-ENGINEERED na
9792 :
9793 : // PURPOSE OF THIS SUBROUTINE:
9794 : // This subroutine updates the report variables for the VRF Condenser.
9795 :
9796 : Real64 ReportingConstant; // - conversion constant for energy
9797 :
9798 57046 : ReportingConstant = state.dataHVACGlobal->TimeStepSysSec;
9799 :
9800 : // calculate VRF condenser power/energy use
9801 57046 : state.dataHVACVarRefFlow->VRF(VRFCond).CoolElecConsumption = state.dataHVACVarRefFlow->VRF(VRFCond).ElecCoolingPower * ReportingConstant;
9802 57046 : state.dataHVACVarRefFlow->VRF(VRFCond).HeatElecConsumption = state.dataHVACVarRefFlow->VRF(VRFCond).ElecHeatingPower * ReportingConstant;
9803 :
9804 57046 : state.dataHVACVarRefFlow->VRF(VRFCond).DefrostConsumption = state.dataHVACVarRefFlow->VRF(VRFCond).DefrostPower * ReportingConstant;
9805 57046 : state.dataHVACVarRefFlow->VRF(VRFCond).BasinHeaterConsumption = state.dataHVACVarRefFlow->VRF(VRFCond).BasinHeaterPower * ReportingConstant;
9806 :
9807 57046 : state.dataHVACVarRefFlow->VRF(VRFCond).EvapCondPumpElecConsumption =
9808 57046 : state.dataHVACVarRefFlow->VRF(VRFCond).EvapCondPumpElecPower * ReportingConstant;
9809 57046 : state.dataHVACVarRefFlow->VRF(VRFCond).CrankCaseHeaterElecConsumption =
9810 57046 : state.dataHVACVarRefFlow->VRF(VRFCond).CrankCaseHeaterPower * ReportingConstant;
9811 :
9812 57046 : state.dataHVACVarRefFlow->VRF(VRFCond).QCondEnergy = state.dataHVACVarRefFlow->VRF(VRFCond).QCondenser * ReportingConstant;
9813 57046 : state.dataHVACVarRefFlow->VRF(VRFCond).VRFHeatEnergyRec = state.dataHVACVarRefFlow->VRF(VRFCond).VRFHeatRec * ReportingConstant;
9814 57046 : }
9815 :
9816 3769 : void UpdateVRFCondenser(EnergyPlusData &state, int const VRFCond) // index to VRF condensing unit
9817 : {
9818 :
9819 : // SUBROUTINE INFORMATION:
9820 : // AUTHOR Richard Raustad, FSEC
9821 : // DATE WRITTEN May 2012
9822 : // MODIFIED na
9823 : // RE-ENGINEERED na
9824 :
9825 : // PURPOSE OF THIS SUBROUTINE:
9826 : // This subroutine updates the node data for the VRF Condenser.
9827 :
9828 : int CondenserOutletNode; // - outlet node for VRF water-cooled condenser
9829 :
9830 3769 : CondenserOutletNode = state.dataHVACVarRefFlow->VRF(VRFCond).CondenserOutletNodeNum;
9831 :
9832 3769 : state.dataLoopNodes->Node(CondenserOutletNode).Temp = state.dataHVACVarRefFlow->VRF(VRFCond).CondenserSideOutletTemp;
9833 :
9834 3769 : state.dataLoopNodes->Node(CondenserOutletNode).MassFlowRate = state.dataHVACVarRefFlow->CondenserWaterMassFlowRate;
9835 3769 : state.dataLoopNodes->Node(CondenserOutletNode).MassFlowRateMaxAvail = state.dataLoopNodes->Node(CondenserOutletNode).MassFlowRateMaxAvail;
9836 3769 : state.dataLoopNodes->Node(CondenserOutletNode).MassFlowRateMinAvail = state.dataLoopNodes->Node(CondenserOutletNode).MassFlowRateMinAvail;
9837 3769 : }
9838 :
9839 2 : void isVRFCoilPresent(EnergyPlusData &state, std::string_view VRFTUName, bool &CoolCoilPresent, bool &HeatCoilPresent)
9840 : {
9841 :
9842 2 : if (state.dataHVACVarRefFlow->GetVRFInputFlag) {
9843 0 : GetVRFInput(state);
9844 0 : state.dataHVACVarRefFlow->GetVRFInputFlag = false;
9845 : }
9846 :
9847 : int WhichVRFTU =
9848 2 : Util::FindItemInList(VRFTUName, state.dataHVACVarRefFlow->VRFTU, &VRFTerminalUnitEquipment::Name, state.dataHVACVarRefFlow->NumVRFTU);
9849 2 : if (WhichVRFTU != 0) {
9850 2 : CoolCoilPresent = state.dataHVACVarRefFlow->VRFTU(WhichVRFTU).CoolingCoilPresent;
9851 2 : HeatCoilPresent = state.dataHVACVarRefFlow->VRFTU(WhichVRFTU).HeatingCoilPresent;
9852 : } else {
9853 0 : ShowSevereError(state, format("isVRFCoilPresent: Could not find VRF TU = \"{}\"", VRFTUName));
9854 : }
9855 2 : }
9856 :
9857 : // End of Reporting subroutines for the Module
9858 : // *****************************************************************************
9859 :
9860 : // Utility subroutines for the Module
9861 :
9862 4049295 : void SetAverageAirFlow(EnergyPlusData &state,
9863 : int const VRFTUNum, // Unit index
9864 : Real64 const PartLoadRatio, // unit part load ratio
9865 : Real64 &OnOffAirFlowRatio // ratio of compressor ON airflow to average airflow over timestep
9866 : )
9867 : {
9868 :
9869 : // SUBROUTINE INFORMATION:
9870 : // AUTHOR Richard Raustad
9871 : // DATE WRITTEN August 2010
9872 : // MODIFIED July 2012, Chandan Sharma - FSEC: Added zone sys avail managers
9873 : // RE-ENGINEERED na
9874 :
9875 : // PURPOSE OF THIS SUBROUTINE:
9876 : // Set the average air mass flow rates using the part load fraction of the heat pump for this time step
9877 : // Set OnOffAirFlowRatio to be used by DX coils
9878 :
9879 : using ScheduleManager::GetCurrentScheduleValue;
9880 :
9881 : int InletNode; // inlet node number
9882 : int OutsideAirNode; // outside air node number
9883 : int AirRelNode; // relief air node number
9884 4049295 : Real64 AverageUnitMassFlow(0.0); // average supply air mass flow rate over time step
9885 4049295 : Real64 AverageOAMassFlow(0.0); // average outdoor air mass flow rate over time step
9886 :
9887 4049295 : InletNode = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum;
9888 4049295 : OutsideAirNode = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum;
9889 4049295 : AirRelNode = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRelNodeNum;
9890 :
9891 4049295 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOp == HVAC::FanOp::Cycling && state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedNum == 0) {
9892 550951 : Real64 partLoadRat = PartLoadRatio;
9893 550951 : if (partLoadRat == 0.0 && state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatPartLoadRatio > 0.0) {
9894 1014 : partLoadRat = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatPartLoadRatio;
9895 : }
9896 550951 : AverageUnitMassFlow =
9897 550951 : (partLoadRat * state.dataHVACVarRefFlow->CompOnMassFlow) + ((1 - partLoadRat) * state.dataHVACVarRefFlow->CompOffMassFlow);
9898 550951 : AverageOAMassFlow =
9899 550951 : (partLoadRat * state.dataHVACVarRefFlow->OACompOnMassFlow) + ((1 - partLoadRat) * state.dataHVACVarRefFlow->OACompOffMassFlow);
9900 : } else {
9901 3498344 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedNum == 0) {
9902 3432365 : if (PartLoadRatio == 0.0) {
9903 : // set the average OA air flow to off compressor values if the compressor PartLoadRatio is zero
9904 754476 : AverageUnitMassFlow = state.dataHVACVarRefFlow->CompOffMassFlow;
9905 754476 : AverageOAMassFlow = state.dataHVACVarRefFlow->OACompOffMassFlow;
9906 : } else {
9907 2677889 : AverageUnitMassFlow = state.dataHVACVarRefFlow->CompOnMassFlow;
9908 2677889 : AverageOAMassFlow = state.dataHVACVarRefFlow->OACompOnMassFlow;
9909 : }
9910 : } else {
9911 65979 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedNum == 1) {
9912 60176 : if (state.dataHVACVarRefFlow->CoolingLoad(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum)) {
9913 39637 : AverageUnitMassFlow =
9914 39637 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedNum] *
9915 : PartLoadRatio +
9916 39637 : (1.0 - PartLoadRatio) * state.dataHVACVarRefFlow->CompOffMassFlow;
9917 20539 : } else if (state.dataHVACVarRefFlow->HeatingLoad(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum)) {
9918 17285 : AverageUnitMassFlow =
9919 17285 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedNum] *
9920 : PartLoadRatio +
9921 17285 : (1.0 - PartLoadRatio) * state.dataHVACVarRefFlow->CompOffMassFlow;
9922 : }
9923 : } else {
9924 5803 : if (state.dataHVACVarRefFlow->CoolingLoad(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum)) {
9925 3127 : AverageUnitMassFlow =
9926 3127 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedNum] *
9927 : PartLoadRatio +
9928 3127 : (1.0 - PartLoadRatio) *
9929 3127 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedNum - 1];
9930 2676 : } else if (state.dataHVACVarRefFlow->HeatingLoad(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum)) {
9931 2676 : AverageUnitMassFlow =
9932 2676 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedNum] *
9933 : PartLoadRatio +
9934 2676 : (1.0 - PartLoadRatio) *
9935 2676 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedNum - 1];
9936 : }
9937 : }
9938 : }
9939 : }
9940 4049295 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedNum == 0) {
9941 3983316 : if (state.dataHVACVarRefFlow->CompOffFlowRatio > 0.0) {
9942 3425679 : state.dataHVACVarRefFlow->FanSpeedRatio =
9943 3425679 : (PartLoadRatio * state.dataHVACVarRefFlow->CompOnFlowRatio) + ((1 - PartLoadRatio) * state.dataHVACVarRefFlow->CompOffFlowRatio);
9944 : } else {
9945 557637 : state.dataHVACVarRefFlow->FanSpeedRatio = state.dataHVACVarRefFlow->CompOnFlowRatio;
9946 : }
9947 : }
9948 :
9949 : // if the terminal unit and fan are scheduled on then set flow rate
9950 4049295 : if (GetCurrentScheduleValue(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SchedPtr) > 0.0 &&
9951 8010082 : (GetCurrentScheduleValue(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr) > 0.0 || state.dataHVACGlobal->TurnFansOn) &&
9952 3960787 : !state.dataHVACGlobal->TurnFansOff) {
9953 :
9954 : // so for sure OA system TUs should use inlet node flow rate, don't overwrite inlet node flow rate
9955 : // could there be a reason for air loops to use inlet node flow? Possibly when VAV TUs used?
9956 3929006 : if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInOASys) state.dataLoopNodes->Node(InletNode).MassFlowRate = AverageUnitMassFlow;
9957 3929006 : if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInOASys) state.dataLoopNodes->Node(InletNode).MassFlowRateMaxAvail = AverageUnitMassFlow;
9958 3929006 : if (OutsideAirNode > 0) {
9959 3526332 : state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate = AverageOAMassFlow;
9960 3526332 : state.dataLoopNodes->Node(OutsideAirNode).MassFlowRateMaxAvail = AverageOAMassFlow;
9961 3526332 : state.dataLoopNodes->Node(AirRelNode).MassFlowRate = AverageOAMassFlow;
9962 3526332 : state.dataLoopNodes->Node(AirRelNode).MassFlowRateMaxAvail = AverageOAMassFlow;
9963 : }
9964 3929006 : if (AverageUnitMassFlow > 0.0) {
9965 3830508 : OnOffAirFlowRatio = state.dataHVACVarRefFlow->CompOnMassFlow / AverageUnitMassFlow;
9966 : } else {
9967 98498 : OnOffAirFlowRatio = 0.0;
9968 : }
9969 :
9970 : } else { // terminal unit and/or fan is off
9971 :
9972 120289 : if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInOASys) {
9973 107820 : state.dataLoopNodes->Node(InletNode).MassFlowRate = 0.0;
9974 107820 : OnOffAirFlowRatio = 0.0;
9975 : }
9976 120289 : if (OutsideAirNode > 0) {
9977 107820 : state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate = 0.0;
9978 107820 : state.dataLoopNodes->Node(AirRelNode).MassFlowRate = 0.0;
9979 : }
9980 : }
9981 4049295 : }
9982 :
9983 52972 : void InitializeOperatingMode(EnergyPlusData &state,
9984 : bool const FirstHVACIteration, // flag for first time through HVAC systems
9985 : int const VRFCond, // Condenser Unit index
9986 : int const TUListNum, // Condenser Unit terminal unit list
9987 : Real64 &OnOffAirFlowRatio // ratio of on to off flow rate
9988 : )
9989 : {
9990 :
9991 : // SUBROUTINE INFORMATION:
9992 : // AUTHOR Richard Raustad
9993 : // DATE WRITTEN July 2012 (Moved from InitVRF)
9994 : // MODIFIED na
9995 : // RE-ENGINEERED na
9996 :
9997 : // PURPOSE OF THIS SUBROUTINE:
9998 : // Scans each zone coil and determines the load based on control
9999 : // Moved from Init to clean up and localize code segments
10000 :
10001 : using ScheduleManager::GetCurrentScheduleValue;
10002 :
10003 : Real64 ZoneDeltaT; // zone temperature difference from setpoint
10004 : Real64 SPTempHi; // thermostat setpoint high
10005 : Real64 SPTempLo; // thermostat setpoint low
10006 : int NumTU; // loop counter, number of TU's in list
10007 : Real64 ZoneLoad; // current zone load (W)
10008 : Real64 LoadToCoolingSP; // thermostat load to cooling setpoint (W)
10009 : Real64 LoadToHeatingSP; // thermostat load to heating setpoint (W)
10010 : Real64 TempOutput; // terminal unit output [W]
10011 : Real64 SuppHeatCoilLoad; // supplemental heating coil load
10012 :
10013 52972 : state.dataHVACVarRefFlow->MaxDeltaT = 0.0;
10014 52972 : state.dataHVACVarRefFlow->MinDeltaT = 0.0;
10015 52972 : state.dataHVACVarRefFlow->NumCoolingLoads = 0;
10016 52972 : state.dataHVACVarRefFlow->SumCoolingLoads = 0.0;
10017 52972 : state.dataHVACVarRefFlow->NumHeatingLoads = 0;
10018 52972 : state.dataHVACVarRefFlow->SumHeatingLoads = 0.0;
10019 52972 : SuppHeatCoilLoad = 0.0;
10020 :
10021 52972 : state.dataHVACVarRefFlow->NumCoolingLoads(VRFCond) = 0;
10022 52972 : state.dataHVACVarRefFlow->NumHeatingLoads(VRFCond) = 0;
10023 52972 : state.dataHVACVarRefFlow->SumCoolingLoads(VRFCond) = 0.0;
10024 52972 : state.dataHVACVarRefFlow->SumHeatingLoads(VRFCond) = 0.0;
10025 52972 : state.dataHVACVarRefFlow->MaxDeltaT(VRFCond) = 0.0;
10026 52972 : state.dataHVACVarRefFlow->MinDeltaT(VRFCond) = 0.0;
10027 52972 : ZoneDeltaT = 0.0;
10028 52972 : state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false;
10029 52972 : state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false;
10030 52972 : state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).CoolingCoilAvailable = false;
10031 52972 : state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).HeatingCoilAvailable = false;
10032 : // loop through all TU's to find operating mode. Be careful not to mix loop counters with current TU/Cond index
10033 283465 : for (NumTU = 1; NumTU <= state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList; ++NumTU) {
10034 : // make sure TU's have been sized before looping through each one of them to determine operating mode
10035 230513 : if (any(state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TerminalUnitNotSizedYet)) break;
10036 230493 : int TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU);
10037 :
10038 : // check to see if coil is present
10039 230493 : if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).CoolingCoilPresent(NumTU)) {
10040 : // now check to see if coil is scheduled off
10041 230493 : if (GetCurrentScheduleValue(state, state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).CoolingCoilAvailSchPtr(NumTU)) > 0.0) {
10042 230493 : state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).CoolingCoilAvailable(NumTU) = true;
10043 : }
10044 : }
10045 :
10046 : // check to see if coil is present
10047 230493 : if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).HeatingCoilPresent(NumTU)) {
10048 : // now check to see if coil is scheduled off
10049 230493 : if (GetCurrentScheduleValue(state, state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).HeatingCoilAvailSchPtr(NumTU)) > 0.0) {
10050 230493 : state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).HeatingCoilAvailable(NumTU) = true;
10051 : }
10052 : }
10053 :
10054 230493 : if (state.dataHVACVarRefFlow->VRFTU(TUIndex).isSetPointControlled) {
10055 : // set point temperature may only reside at the TU outlet node
10056 3192 : Real64 coolCoilTempSetPoint = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOutletNodeNum).TempSetPoint;
10057 3192 : state.dataHVACVarRefFlow->VRFTU(TUIndex).suppTempSetPoint = coolCoilTempSetPoint;
10058 3192 : Real64 heatCoilTempSetPoint = coolCoilTempSetPoint;
10059 : // adjust coil control for fan heat when set point is at outlet node
10060 3192 : Real64 coolfanDeltaT = 0.0;
10061 3192 : Real64 heatfanDeltaT = 0.0;
10062 3192 : if (state.dataHVACVarRefFlow->VRFTU(TUIndex).fanPlace == HVAC::FanPlace::DrawThru) {
10063 0 : if (state.dataHVACVarRefFlow->VRFTU(TUIndex).fanOutletNode > 0)
10064 0 : coolfanDeltaT = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).fanOutletNode).Temp -
10065 0 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).fanInletNode).Temp;
10066 : }
10067 3192 : heatfanDeltaT = coolfanDeltaT;
10068 : // or the set point could be placed at either or both coils, update both if necessary
10069 3192 : if (state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolingCoilPresent) {
10070 3192 : if (state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).coolCoilAirOutNode).TempSetPoint !=
10071 : DataLoopNode::SensedNodeFlagValue) {
10072 3192 : coolCoilTempSetPoint = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).coolCoilAirOutNode).TempSetPoint;
10073 : //// should we adjust for fan heat or not? What if it's a mixed air SP that already adjusts for fan heat?
10074 : // coolfanDeltaT = 0.0;
10075 : }
10076 : }
10077 3192 : if (state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatingCoilPresent) {
10078 3192 : if (state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).heatCoilAirOutNode).TempSetPoint !=
10079 : DataLoopNode::SensedNodeFlagValue) {
10080 3192 : heatCoilTempSetPoint = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).heatCoilAirOutNode).TempSetPoint;
10081 : //// should we adjust for fan heat or not? What if it's a mixed air SP that already adjusts for fan heat?
10082 : // heatfanDeltaT = 0.0;
10083 : }
10084 : }
10085 : // set a flow rate and simulate ATMixer/OASystem if needed
10086 3192 : if (FirstHVACIteration) {
10087 1598 : SetAverageAirFlow(state, TUIndex, 1.0, OnOffAirFlowRatio);
10088 1598 : if (state.dataHVACVarRefFlow->VRFTU(TUIndex).ATMixerExists) {
10089 : // There is an air terminal mixer
10090 0 : if (state.dataHVACVarRefFlow->VRFTU(TUIndex).ATMixerType ==
10091 : HVAC::MixerType::InletSide) { // if there is an inlet side air terminal mixer
10092 : // set the primary air inlet mass flow rate
10093 0 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).ATMixerPriNode).MassFlowRate =
10094 0 : min(state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).ATMixerPriNode).MassFlowRateMaxAvail,
10095 0 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUInletNodeNum).MassFlowRate);
10096 : // now calculate the the mixer outlet air conditions (and the secondary air inlet flow rate). The mixer outlet flow rate
10097 : // has already been set above (it is the "inlet" node flow rate)
10098 0 : SingleDuct::SimATMixer(state,
10099 0 : state.dataHVACVarRefFlow->VRFTU(TUIndex).ATMixerName,
10100 : FirstHVACIteration,
10101 0 : state.dataHVACVarRefFlow->VRFTU(TUIndex).ATMixerIndex);
10102 : }
10103 : } else {
10104 : // simulate OA Mixer
10105 1598 : if (state.dataHVACVarRefFlow->VRFTU(TUIndex).OAMixerUsed)
10106 0 : MixedAir::SimOAMixer(
10107 0 : state, state.dataHVACVarRefFlow->VRFTU(TUIndex).OAMixerName, state.dataHVACVarRefFlow->VRFTU(TUIndex).OAMixerIndex);
10108 : }
10109 : }
10110 : // identify a coil inlet temperature
10111 3192 : if (state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolingCoilPresent) {
10112 3192 : state.dataHVACVarRefFlow->VRFTU(TUIndex).coilInNodeT =
10113 3192 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).coolCoilAirInNode).Temp;
10114 3192 : state.dataHVACVarRefFlow->VRFTU(TUIndex).coilInNodeW =
10115 3192 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).coolCoilAirInNode).HumRat;
10116 : } else {
10117 0 : state.dataHVACVarRefFlow->VRFTU(TUIndex).coilInNodeT =
10118 0 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).heatCoilAirInNode).Temp;
10119 0 : state.dataHVACVarRefFlow->VRFTU(TUIndex).coilInNodeW =
10120 0 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).heatCoilAirInNode).HumRat;
10121 : }
10122 3192 : Real64 coilInletTemp = state.dataHVACVarRefFlow->VRFTU(TUIndex).coilInNodeT;
10123 3192 : Real64 coilInletHumRat = state.dataHVACVarRefFlow->VRFTU(TUIndex).coilInNodeW;
10124 3192 : Real64 coilInletMassFlow = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUInletNodeNum).MassFlowRate;
10125 3192 : state.dataHVACVarRefFlow->VRFTU(TUIndex).coolSPActive = false;
10126 3192 : state.dataHVACVarRefFlow->VRFTU(TUIndex).heatSPActive = false;
10127 :
10128 3192 : if ((heatCoilTempSetPoint - coilInletTemp - heatfanDeltaT) > HVAC::SmallTempDiff) { // heating
10129 1366 : Real64 CpAirIn = Psychrometrics::PsyCpAirFnW(coilInletHumRat);
10130 1366 : ZoneLoad = coilInletMassFlow * CpAirIn * (heatCoilTempSetPoint - coilInletTemp - heatfanDeltaT);
10131 1366 : state.dataHVACVarRefFlow->VRFTU(TUIndex).heatSPActive = true;
10132 1366 : state.dataHVACVarRefFlow->VRFTU(TUIndex).heatLoadToSP = ZoneLoad;
10133 1366 : ++state.dataHVACVarRefFlow->NumHeatingLoads(VRFCond);
10134 1366 : state.dataHVACVarRefFlow->SumHeatingLoads(VRFCond) += ZoneLoad;
10135 1366 : state.dataHVACVarRefFlow->MinDeltaT(VRFCond) = min(state.dataHVACVarRefFlow->MinDeltaT(VRFCond), -1.0);
10136 1366 : state.dataHVACVarRefFlow->VRFTU(TUIndex).coilTempSetPoint = heatCoilTempSetPoint - heatfanDeltaT;
10137 1826 : } else if ((coilInletTemp - coolCoilTempSetPoint - coolfanDeltaT) > HVAC::SmallTempDiff) { // cooling
10138 1812 : Real64 CpAirIn = Psychrometrics::PsyCpAirFnW(coilInletHumRat);
10139 1812 : ZoneLoad = coilInletMassFlow * CpAirIn * (coolCoilTempSetPoint - coilInletTemp - coolfanDeltaT);
10140 1812 : state.dataHVACVarRefFlow->VRFTU(TUIndex).coolSPActive = true;
10141 1812 : state.dataHVACVarRefFlow->VRFTU(TUIndex).coolLoadToSP = ZoneLoad;
10142 1812 : ++state.dataHVACVarRefFlow->NumCoolingLoads(VRFCond);
10143 1812 : state.dataHVACVarRefFlow->SumCoolingLoads(VRFCond) += ZoneLoad;
10144 1812 : state.dataHVACVarRefFlow->MaxDeltaT(VRFCond) = max(state.dataHVACVarRefFlow->MaxDeltaT(VRFCond), 1.0);
10145 1812 : state.dataHVACVarRefFlow->VRFTU(TUIndex).coilTempSetPoint = coolCoilTempSetPoint - coolfanDeltaT;
10146 : }
10147 : } else { // else is not set point controlled
10148 : // Constant fan systems are tested for ventilation load to determine if load to be met changes.
10149 : // more logic may be needed here, what is the OA flow rate, was last mode heating or cooling, what control is used, etc...
10150 :
10151 227301 : int ThisZoneNum = state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum;
10152 227301 : getVRFTUZoneLoad(state, TUIndex, ZoneLoad, LoadToHeatingSP, LoadToCoolingSP, true);
10153 :
10154 227301 : if (state.dataHVACVarRefFlow->VRF(VRFCond).ThermostatPriority == ThermostatCtrlType::ThermostatOffsetPriority) {
10155 : // for TSTATPriority, just check difference between zone temp and thermostat setpoint
10156 0 : if (ThisZoneNum > 0) {
10157 0 : auto const &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ThisZoneNum);
10158 0 : SPTempHi = state.dataHeatBalFanSys->ZoneThermostatSetPointHi(ThisZoneNum);
10159 0 : SPTempLo = state.dataHeatBalFanSys->ZoneThermostatSetPointLo(ThisZoneNum);
10160 :
10161 0 : switch (state.dataHeatBalFanSys->TempControlType(ThisZoneNum)) {
10162 0 : case HVAC::ThermostatType::Uncontrolled:
10163 : // MaxDeltaT denotes cooling, MinDeltaT denotes heating
10164 0 : break;
10165 0 : case HVAC::ThermostatType::SingleHeating:
10166 : // if heating load, ZoneDeltaT will be negative
10167 0 : ZoneDeltaT = min(0.0, thisZoneHB.ZT - SPTempLo);
10168 0 : state.dataHVACVarRefFlow->MinDeltaT(VRFCond) = min(state.dataHVACVarRefFlow->MinDeltaT(VRFCond), ZoneDeltaT);
10169 0 : break;
10170 0 : case HVAC::ThermostatType::SingleCooling:
10171 : // if cooling load, ZoneDeltaT will be positive
10172 0 : ZoneDeltaT = max(0.0, thisZoneHB.ZT - SPTempHi);
10173 0 : state.dataHVACVarRefFlow->MaxDeltaT(VRFCond) = max(state.dataHVACVarRefFlow->MaxDeltaT(VRFCond), ZoneDeltaT);
10174 0 : break;
10175 0 : case HVAC::ThermostatType::SingleHeatCool:
10176 0 : ZoneDeltaT = thisZoneHB.ZT - SPTempHi; //- SPTempHi and SPTempLo are same value
10177 0 : if (ZoneDeltaT > 0.0) {
10178 0 : state.dataHVACVarRefFlow->MaxDeltaT(VRFCond) = max(state.dataHVACVarRefFlow->MaxDeltaT(VRFCond), ZoneDeltaT);
10179 : } else {
10180 0 : state.dataHVACVarRefFlow->MinDeltaT(VRFCond) = min(state.dataHVACVarRefFlow->MinDeltaT(VRFCond), ZoneDeltaT);
10181 : }
10182 0 : break;
10183 0 : case HVAC::ThermostatType::DualSetPointWithDeadBand:
10184 0 : if (thisZoneHB.ZT - SPTempHi > 0.0) {
10185 0 : ZoneDeltaT = max(0.0, thisZoneHB.ZT - SPTempHi);
10186 0 : state.dataHVACVarRefFlow->MaxDeltaT(VRFCond) = max(state.dataHVACVarRefFlow->MaxDeltaT(VRFCond), ZoneDeltaT);
10187 0 : } else if (SPTempLo - thisZoneHB.ZT > 0.0) {
10188 0 : ZoneDeltaT = min(0.0, thisZoneHB.ZT - SPTempLo);
10189 0 : state.dataHVACVarRefFlow->MinDeltaT(VRFCond) = min(state.dataHVACVarRefFlow->MinDeltaT(VRFCond), ZoneDeltaT);
10190 : }
10191 0 : break;
10192 0 : default:
10193 0 : break;
10194 : }
10195 : }
10196 231069 : } else if (state.dataHVACVarRefFlow->VRF(VRFCond).ThermostatPriority == ThermostatCtrlType::LoadPriority ||
10197 3768 : state.dataHVACVarRefFlow->VRF(VRFCond).ThermostatPriority == ThermostatCtrlType::ZonePriority) {
10198 223533 : if (state.dataHVACVarRefFlow->VRFTU(TUIndex).fanOp == HVAC::FanOp::Continuous) {
10199 174510 : SetCompFlowRate(state, TUIndex, VRFCond);
10200 :
10201 174510 : if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmType == AlgorithmType::FluidTCtrl) {
10202 : // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control
10203 58515 : state.dataHVACVarRefFlow->VRFTU(TUIndex).CalcVRF_FluidTCtrl(
10204 : state, TUIndex, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
10205 : } else {
10206 : // Algorithm Type: VRF model based on system curve
10207 115995 : state.dataHVACVarRefFlow->VRFTU(TUIndex).CalcVRF(
10208 : state, TUIndex, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
10209 : }
10210 :
10211 : // If the Terminal Unit has a net cooling capacity (NoCompOutput < 0) and
10212 : // the zone temp is above the Tstat heating setpoint (QToHeatSetPt < 0)
10213 174510 : if (TempOutput < 0.0 && LoadToHeatingSP < 0.0) {
10214 : // If the net cooling capacity overshoots the heating setpoint count as heating load
10215 8423 : if (TempOutput < LoadToHeatingSP) {
10216 : // Don't count as heating load unless mode is allowed. Also check for floating zone.
10217 3146 : if (state.dataHeatBalFanSys->TempControlType(ThisZoneNum) != HVAC::ThermostatType::SingleCooling &&
10218 1573 : state.dataHeatBalFanSys->TempControlType(ThisZoneNum) != HVAC::ThermostatType::Uncontrolled) {
10219 1573 : if (!state.dataHVACVarRefFlow->LastModeHeating(VRFCond)) {
10220 : // if last mode was cooling, make sure heating flow rate is used
10221 8 : if (state.dataHVACVarRefFlow->VRFTU(TUIndex).OAMixerUsed) {
10222 7 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOAMixerRetNodeNum).MassFlowRate =
10223 7 : state.dataHVACVarRefFlow->VRFTU(TUIndex).MaxHeatAirMassFlow;
10224 7 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOAMixerOANodeNum).MassFlowRate =
10225 7 : state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatOutAirMassFlow;
10226 7 : MixedAir::SimOAMixer(state,
10227 7 : state.dataHVACVarRefFlow->VRFTU(TUIndex).OAMixerName,
10228 7 : state.dataHVACVarRefFlow->VRFTU(TUIndex).OAMixerIndex);
10229 : } else {
10230 1 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUInletNodeNum).MassFlowRate =
10231 1 : state.dataHVACVarRefFlow->VRFTU(TUIndex).MaxHeatAirMassFlow;
10232 : }
10233 :
10234 : // recalculate using correct flow rate
10235 8 : if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmType == AlgorithmType::FluidTCtrl) {
10236 : // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control
10237 2 : state.dataHVACVarRefFlow->VRFTU(TUIndex).CalcVRF_FluidTCtrl(
10238 : state, TUIndex, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
10239 : } else {
10240 : // Algorithm Type: VRF model based on system curve
10241 6 : state.dataHVACVarRefFlow->VRFTU(TUIndex).CalcVRF(
10242 : state, TUIndex, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
10243 : }
10244 :
10245 8 : if (TempOutput < LoadToHeatingSP) {
10246 8 : ++state.dataHVACVarRefFlow->NumHeatingLoads(VRFCond);
10247 : // sum heating load on condenser, not total zone heating load
10248 8 : state.dataHVACVarRefFlow->SumHeatingLoads(VRFCond) += (LoadToHeatingSP - TempOutput);
10249 : }
10250 : } else {
10251 1565 : ++state.dataHVACVarRefFlow->NumHeatingLoads(VRFCond);
10252 : // sum heating load on condenser, not total zone heating load
10253 1565 : state.dataHVACVarRefFlow->SumHeatingLoads(VRFCond) += (LoadToHeatingSP - TempOutput);
10254 : }
10255 : }
10256 6850 : } else if (TempOutput < ZoneLoad) {
10257 : // If the net cooling capacity meets the zone cooling load but does not overshoot heating setpoint, turn
10258 : // off coil do nothing, the zone will float
10259 781 : } else if (ZoneLoad < 0.0) {
10260 : // still a cooling load
10261 781 : ++state.dataHVACVarRefFlow->NumCoolingLoads(VRFCond);
10262 : // sum cooling load on condenser, not total zone cooling load
10263 781 : state.dataHVACVarRefFlow->SumCoolingLoads(VRFCond) += (LoadToCoolingSP - TempOutput);
10264 : }
10265 :
10266 : // If the terminal unit has a net heating capacity and the zone temp is below the Tstat cooling setpoint
10267 166087 : } else if (TempOutput > 0.0 && LoadToCoolingSP > 0.0) {
10268 : // If the net heating capacity overshoots the cooling setpoint count as cooling load
10269 19562 : if (TempOutput > LoadToCoolingSP) {
10270 : // Don't count as cooling load unless mode is allowed. Also check for floating zone.
10271 10676 : if (state.dataHeatBalFanSys->TempControlType(ThisZoneNum) != HVAC::ThermostatType::SingleHeating &&
10272 5338 : state.dataHeatBalFanSys->TempControlType(ThisZoneNum) != HVAC::ThermostatType::Uncontrolled) {
10273 5338 : if (!state.dataHVACVarRefFlow->LastModeCooling(VRFCond)) {
10274 31 : if (state.dataHVACVarRefFlow->VRFTU(TUIndex).OAMixerUsed) {
10275 27 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOAMixerRetNodeNum).MassFlowRate =
10276 27 : state.dataHVACVarRefFlow->VRFTU(TUIndex).MaxCoolAirMassFlow;
10277 27 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOAMixerOANodeNum).MassFlowRate =
10278 27 : state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolOutAirMassFlow;
10279 27 : MixedAir::SimOAMixer(state,
10280 27 : state.dataHVACVarRefFlow->VRFTU(TUIndex).OAMixerName,
10281 27 : state.dataHVACVarRefFlow->VRFTU(TUIndex).OAMixerIndex);
10282 : } else {
10283 4 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUInletNodeNum).MassFlowRate =
10284 4 : state.dataHVACVarRefFlow->VRFTU(TUIndex).MaxCoolAirMassFlow;
10285 : }
10286 :
10287 31 : if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmType == AlgorithmType::FluidTCtrl) {
10288 : // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control
10289 6 : state.dataHVACVarRefFlow->VRFTU(TUIndex).CalcVRF_FluidTCtrl(
10290 : state, TUIndex, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
10291 : } else {
10292 : // Algorithm Type: VRF model based on system curve
10293 25 : state.dataHVACVarRefFlow->VRFTU(TUIndex).CalcVRF(
10294 : state, TUIndex, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
10295 : }
10296 :
10297 31 : if (TempOutput > LoadToCoolingSP) {
10298 31 : ++state.dataHVACVarRefFlow->NumCoolingLoads(VRFCond);
10299 31 : state.dataHVACVarRefFlow->SumCoolingLoads(VRFCond) += (LoadToCoolingSP - TempOutput);
10300 : }
10301 : } else {
10302 5307 : ++state.dataHVACVarRefFlow->NumCoolingLoads(VRFCond);
10303 5307 : state.dataHVACVarRefFlow->SumCoolingLoads(VRFCond) += (LoadToCoolingSP - TempOutput);
10304 : }
10305 : }
10306 14224 : } else if (TempOutput > ZoneLoad) {
10307 : // do nothing, zone will float
10308 10462 : } else if (ZoneLoad > 0.0) {
10309 10462 : ++state.dataHVACVarRefFlow->NumHeatingLoads(VRFCond);
10310 10462 : state.dataHVACVarRefFlow->SumHeatingLoads(VRFCond) += ZoneLoad;
10311 : }
10312 : // ELSE there is no overshoot and the zone has a valid cooling load
10313 146525 : } else if (ZoneLoad < 0.0) {
10314 82549 : ++state.dataHVACVarRefFlow->NumCoolingLoads(VRFCond);
10315 82549 : state.dataHVACVarRefFlow->SumCoolingLoads(VRFCond) += ZoneLoad;
10316 : // ELSE there is no overshoot and the zone has a valid heating load
10317 63976 : } else if (ZoneLoad > 0.0) {
10318 61894 : ++state.dataHVACVarRefFlow->NumHeatingLoads(VRFCond);
10319 61894 : state.dataHVACVarRefFlow->SumHeatingLoads(VRFCond) += ZoneLoad;
10320 : }
10321 : } else { // is cycling fan
10322 49023 : if (ZoneLoad > 0.0) {
10323 16621 : ++state.dataHVACVarRefFlow->NumHeatingLoads(VRFCond);
10324 16621 : state.dataHVACVarRefFlow->SumHeatingLoads(VRFCond) += ZoneLoad;
10325 32402 : } else if (ZoneLoad < 0.0) {
10326 29218 : ++state.dataHVACVarRefFlow->NumCoolingLoads(VRFCond);
10327 29218 : state.dataHVACVarRefFlow->SumCoolingLoads(VRFCond) += ZoneLoad;
10328 : }
10329 : }
10330 : }
10331 : }
10332 : }
10333 :
10334 : // Determine operating mode based on VRF type and thermostat control selection
10335 52972 : switch (state.dataHVACVarRefFlow->VRF(VRFCond).ThermostatPriority) {
10336 0 : case ThermostatCtrlType::ThermostatOffsetPriority: {
10337 0 : if (state.dataHVACVarRefFlow->MaxDeltaT(VRFCond) > std::abs(state.dataHVACVarRefFlow->MinDeltaT(VRFCond)) &&
10338 0 : state.dataHVACVarRefFlow->MaxDeltaT(VRFCond) > 0.0) {
10339 0 : state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false;
10340 0 : state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = true;
10341 0 : } else if (state.dataHVACVarRefFlow->MaxDeltaT(VRFCond) < std::abs(state.dataHVACVarRefFlow->MinDeltaT(VRFCond)) &&
10342 0 : state.dataHVACVarRefFlow->MinDeltaT(VRFCond) < 0.0) {
10343 0 : state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = true;
10344 0 : state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false;
10345 : } else {
10346 0 : state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false;
10347 0 : state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false;
10348 : }
10349 0 : } break;
10350 49203 : case ThermostatCtrlType::LoadPriority: {
10351 69410 : if (state.dataHVACVarRefFlow->SumHeatingLoads(VRFCond) > std::abs(state.dataHVACVarRefFlow->SumCoolingLoads(VRFCond)) &&
10352 20207 : state.dataHVACVarRefFlow->SumHeatingLoads(VRFCond) > 0.0) {
10353 20207 : state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = true;
10354 20207 : state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false;
10355 57992 : } else if (state.dataHVACVarRefFlow->SumHeatingLoads(VRFCond) <= std::abs(state.dataHVACVarRefFlow->SumCoolingLoads(VRFCond)) &&
10356 28996 : state.dataHVACVarRefFlow->SumCoolingLoads(VRFCond) < 0.0) {
10357 27289 : state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false;
10358 27289 : state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = true;
10359 : } else {
10360 1707 : state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false;
10361 1707 : state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false;
10362 : }
10363 49203 : } break;
10364 0 : case ThermostatCtrlType::ZonePriority: {
10365 0 : if (state.dataHVACVarRefFlow->NumHeatingLoads(VRFCond) > state.dataHVACVarRefFlow->NumCoolingLoads(VRFCond) &&
10366 0 : state.dataHVACVarRefFlow->NumHeatingLoads(VRFCond) > 0) {
10367 0 : state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = true;
10368 0 : state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false;
10369 0 : } else if (state.dataHVACVarRefFlow->NumHeatingLoads(VRFCond) <= state.dataHVACVarRefFlow->NumCoolingLoads(VRFCond) &&
10370 0 : state.dataHVACVarRefFlow->NumCoolingLoads(VRFCond) > 0) {
10371 0 : state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false;
10372 0 : state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = true;
10373 : } else {
10374 0 : state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false;
10375 0 : state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false;
10376 : }
10377 0 : } break;
10378 0 : case ThermostatCtrlType::ScheduledPriority: {
10379 0 : if (GetCurrentScheduleValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).SchedPriorityPtr) == 0) {
10380 0 : state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = true;
10381 0 : state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false;
10382 0 : } else if (GetCurrentScheduleValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).SchedPriorityPtr) == 1) {
10383 0 : state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false;
10384 0 : state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = true;
10385 : } else {
10386 0 : state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false;
10387 0 : state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false;
10388 : }
10389 0 : } break;
10390 3769 : case ThermostatCtrlType::MasterThermostatPriority: {
10391 3769 : ZoneLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(state.dataHVACVarRefFlow->VRF(VRFCond).MasterZonePtr).RemainingOutputRequired /
10392 3769 : state.dataHVACVarRefFlow->VRFTU(state.dataHVACVarRefFlow->VRF(VRFCond).MasterZoneTUIndex).controlZoneMassFlowFrac;
10393 3769 : if (state.dataHVACVarRefFlow->VRFTU(state.dataHVACVarRefFlow->VRF(VRFCond).MasterZoneTUIndex).fanOp == HVAC::FanOp::Continuous) {
10394 3755 : SetCompFlowRate(state, state.dataHVACVarRefFlow->VRF(VRFCond).MasterZoneTUIndex, VRFCond);
10395 :
10396 3755 : if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmType == AlgorithmType::FluidTCtrl) {
10397 : // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control
10398 0 : state.dataHVACVarRefFlow->VRFTU(state.dataHVACVarRefFlow->VRF(VRFCond).MasterZoneTUIndex)
10399 0 : .CalcVRF_FluidTCtrl(state,
10400 0 : state.dataHVACVarRefFlow->VRF(VRFCond).MasterZoneTUIndex,
10401 : FirstHVACIteration,
10402 : 0.0,
10403 : TempOutput,
10404 : OnOffAirFlowRatio,
10405 : SuppHeatCoilLoad);
10406 : } else {
10407 : // Algorithm Type: VRF model based on system curve
10408 3755 : state.dataHVACVarRefFlow->VRFTU(state.dataHVACVarRefFlow->VRF(VRFCond).MasterZoneTUIndex)
10409 7510 : .CalcVRF(state,
10410 3755 : state.dataHVACVarRefFlow->VRF(VRFCond).MasterZoneTUIndex,
10411 : FirstHVACIteration,
10412 : 0.0,
10413 : TempOutput,
10414 : OnOffAirFlowRatio,
10415 : SuppHeatCoilLoad);
10416 : }
10417 :
10418 3755 : LoadToCoolingSP =
10419 3755 : state.dataZoneEnergyDemand->ZoneSysEnergyDemand(state.dataHVACVarRefFlow->VRF(VRFCond).MasterZonePtr).OutputRequiredToCoolingSP /
10420 3755 : state.dataHVACVarRefFlow->VRFTU(state.dataHVACVarRefFlow->VRF(VRFCond).MasterZoneTUIndex).controlZoneMassFlowFrac;
10421 3755 : LoadToHeatingSP =
10422 3755 : state.dataZoneEnergyDemand->ZoneSysEnergyDemand(state.dataHVACVarRefFlow->VRF(VRFCond).MasterZonePtr).OutputRequiredToHeatingSP /
10423 3755 : state.dataHVACVarRefFlow->VRFTU(state.dataHVACVarRefFlow->VRF(VRFCond).MasterZoneTUIndex).controlZoneMassFlowFrac;
10424 3755 : if (TempOutput < LoadToHeatingSP) {
10425 1456 : state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false;
10426 1456 : state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = true;
10427 2299 : } else if (TempOutput > LoadToCoolingSP) {
10428 1674 : state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = true;
10429 1674 : state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false;
10430 : } else {
10431 625 : state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false;
10432 625 : state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false;
10433 : }
10434 14 : } else if (ZoneLoad > 0.0) {
10435 0 : state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = true;
10436 0 : state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false;
10437 14 : } else if (ZoneLoad < 0.0) {
10438 0 : state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false;
10439 0 : state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = true;
10440 : } else {
10441 14 : state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false;
10442 14 : state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false;
10443 : }
10444 3769 : } break;
10445 0 : case ThermostatCtrlType::FirstOnPriority: {
10446 : // na
10447 0 : } break;
10448 0 : default:
10449 0 : break;
10450 : }
10451 :
10452 : // limit to one possible mode
10453 52972 : if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond) && state.dataHVACVarRefFlow->HeatingLoad(VRFCond))
10454 0 : state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false;
10455 52972 : }
10456 :
10457 4532 : void LimitTUCapacity(EnergyPlusData &state,
10458 : int const VRFCond, // Condenser Unit index
10459 : int const NumTUInList, // Number of terminal units in list
10460 : Real64 const StartingCapacity, // temporary variable holding condenser capacity [W]
10461 : const Array1D<Real64> &CapArray, // Array of coil capacities in either cooling or heating mode [W]
10462 : Real64 &MaxLimit, // Maximum terminal unit capacity for coils in same operating mode [W]
10463 : Real64 const AltCapacity, // temporary variable holding heat recovery capacity [W]
10464 : const Array1D<Real64> &AltArray, // Array of coil capacities of heat recovery [W]
10465 : Real64 &AltLimit // Maximum terminal unit capacity of heat recovery coils [W]
10466 : )
10467 : {
10468 :
10469 : // SUBROUTINE INFORMATION:
10470 : // AUTHOR Richard Raustad
10471 : // DATE WRITTEN July 2012 (Moved from InitVRF)
10472 : // MODIFIED na
10473 : // RE-ENGINEERED na
10474 :
10475 : // PURPOSE OF THIS SUBROUTINE:
10476 : // Calculate the maximum allowed terminal unit capacity. Total terminal unit capacity must not
10477 : // exceed the available condenser capacity. This variable, MaxCapacity (passed out to MaxCoolingCapacity
10478 : // or MaxHeatingCapacity), is used to limit the terminal units providing more capacity than allowed.
10479 : // Example: TU loads are 1-ton, 2-ton, 3-ton, and 4-ton connected to a condenser having only 9-tons available.
10480 : // This variable is will be set to 3-tons and the 4-ton terminal unit will be limited to 3-tons
10481 : // (see InitVRF where this variable is reset and CalcVRF where the call to the DX coils passes this argument).
10482 :
10483 : // METHODOLOGY EMPLOYED:
10484 : // The coils are simulated and summed. This value is compared to the available capacity. If the summed
10485 : // TU capacity is greater than the available capacity, limit the TU's with the highest capacity so that
10486 : // the TU capacity equals the available capacity. The report variable Variable Refrigerant Flow Heat Pump
10487 : // Maximum Terminal Unit Cool/Heating Capacity holds the value for maximum TU capacity. This value may not
10488 : // match the maximum individual coil capacity exactly since the available capacity uses a load weighted
10489 : // average WB temperature to calculate available capacity. When the TU's are limited, this weighting changes.
10490 : // The extra iterations required for these values to converge is considered excessive.
10491 : // If the global flag SimZoneEquipment could be set for 1 additional iteration, these variables would
10492 : // converge more closely (setting this global flag is not yet implemented).
10493 :
10494 : Real64 RemainingCapacity; // decrement capacity counter to find limiting TU capacity [W]
10495 :
10496 : // limit TU coil capacity to be equal to the condenser capacity (piping losses already accounted for)
10497 4532 : LimitCoilCapacity(NumTUInList, StartingCapacity, CapArray, MaxLimit);
10498 :
10499 : // ** add in logic to limit coils operating opposite to mode when heat recovery is used
10500 : // ** this is a hard one since we are here because the system is overloaded. That means
10501 : // ** that we do not know at this point the actual operating capacity or compressor power.
10502 4532 : if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed) {
10503 1079 : if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond)) {
10504 1078 : RemainingCapacity = StartingCapacity * (1 + 1 / state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCOP);
10505 1078 : if (AltCapacity > RemainingCapacity) {
10506 0 : LimitCoilCapacity(NumTUInList, RemainingCapacity, AltArray, AltLimit);
10507 : }
10508 : }
10509 1079 : if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond)) {
10510 1 : RemainingCapacity = StartingCapacity / (1 + 1 / state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCOP);
10511 1 : if (AltCapacity > RemainingCapacity) {
10512 0 : LimitCoilCapacity(NumTUInList, RemainingCapacity, AltArray, AltLimit);
10513 : }
10514 : }
10515 : }
10516 4532 : }
10517 :
10518 4532 : void LimitCoilCapacity(int const NumTUInList, // Number of terminal units in list
10519 : Real64 const TotalCapacity, // temporary variable holding condenser capacity [W]
10520 : const Array1D<Real64> &CapArray, // Array of coil capacities in either cooling or heating mode [W]
10521 : Real64 &MaxLimit // Maximum terminal unit capacity for coils in same operating mode [W]
10522 : )
10523 : {
10524 :
10525 : // SUBROUTINE INFORMATION:
10526 : // AUTHOR Richard Raustad
10527 : // DATE WRITTEN July 2012 (Moved from InitVRF)
10528 : // MODIFIED na
10529 : // RE-ENGINEERED na
10530 :
10531 : // PURPOSE OF THIS SUBROUTINE:
10532 : // Calculate the maximum allowed terminal unit capacity. Total terminal unit capacity must not
10533 : // exceed the available condenser capacity. This variable, MaxCapacity (passed out to MaxCoolingCapacity
10534 : // or MaxHeatingCapacity), is used to limit the terminal units providing more capacity than allowed.
10535 : // Example: TU loads are 1-ton, 2-ton, 3-ton, and 4-ton connected to a condenser having only 9-tons available.
10536 : // This variable is will be set to 3-tons and the 4-ton terminal unit will be limited to 3-tons
10537 : // (see InitVRF where this variable is reset and CalcVRF where the call to the DX coils passes this argument).
10538 :
10539 : // METHODOLOGY EMPLOYED:
10540 : // The coils are simulated and summed. This value is compared to the available capacity. If the summed
10541 : // TU capacity is greater than the available capacity, limit the TU's with the highest capacity so that
10542 : // the TU capacity equals the available capacity. The report variable Variable Refrigerant Flow Heat Pump
10543 : // Maximum Terminal Unit Cool/Heating Capacity holds the value for maximum TU capacity. This value may not
10544 : // match the maximum individual coil capacity exactly since the available capacity uses a load weighted
10545 : // average WB temperature to calculate available capacity. When the TU's are limited, this weighting changes.
10546 : // The extra iterations required for these values to converge is considered excessive.
10547 : // If the global flag SimZoneEquipment could be set for 1 additional iteration, these variables would
10548 : // converge more closely (setting this global flag is not yet implemented).
10549 :
10550 : int NumTU; // loop counter
10551 : int TempTUIndex; // temp variable used to find max terminal unit limit
10552 : int MinOutputIndex; // index to TU with lowest load
10553 : Real64 MinOutput; // used when finding TU "max" capacity limit
10554 : Real64 RemainingCapacity; // decrement capacity counter to find limiting TU capacity [W]
10555 4532 : Array1D<Real64> Temp(NumTUInList, CapArray); // temporary array for processing terminal units
10556 4532 : Array1D<Real64> Temp2(NumTUInList, Temp); // temporary array for processing terminal units
10557 :
10558 4532 : RemainingCapacity = TotalCapacity;
10559 :
10560 : // sort TU capacity from lowest to highest
10561 19092 : for (TempTUIndex = 1; TempTUIndex <= NumTUInList; ++TempTUIndex) {
10562 14560 : MinOutput = MaxCap;
10563 79262 : for (NumTU = 1; NumTU <= NumTUInList; ++NumTU) {
10564 64702 : if (Temp2(NumTU) < MinOutput) {
10565 22296 : MinOutput = Temp2(NumTU);
10566 22296 : Temp(TempTUIndex) = MinOutput;
10567 22296 : MinOutputIndex = NumTU;
10568 : }
10569 : }
10570 14560 : Temp2(MinOutputIndex) = MaxCap;
10571 : }
10572 :
10573 : // find limit of "terminal unit" capacity so that sum of all TU's does not exceed condenser capacity
10574 : // if the terminal unit capacity multiplied by number of remaining TU's does not exceed remaining available, subtract and cycle
10575 12608 : for (TempTUIndex = 1; TempTUIndex <= NumTUInList; ++TempTUIndex) {
10576 12601 : if ((Temp(TempTUIndex) * (NumTUInList - TempTUIndex + 1)) < RemainingCapacity) {
10577 8076 : RemainingCapacity -= Temp(TempTUIndex);
10578 8076 : continue;
10579 : } else {
10580 : // if it does exceed, limit is found
10581 4525 : MaxLimit = RemainingCapacity / (NumTUInList - TempTUIndex + 1);
10582 4525 : break;
10583 : }
10584 : }
10585 4532 : }
10586 :
10587 15145 : int GetVRFTUOutAirNode(EnergyPlusData &state, int const VRFTUNum)
10588 : {
10589 :
10590 : // FUNCTION INFORMATION:
10591 : // AUTHOR R. Raustad (copy of B Griffith routine)
10592 : // DATE WRITTEN Jan 2015
10593 : // MODIFIED na
10594 : // RE-ENGINEERED na
10595 :
10596 : // PURPOSE OF THIS FUNCTION:
10597 : // lookup function for VRF terminal unit OA inlet node
10598 :
10599 15145 : if (state.dataHVACVarRefFlow->GetVRFInputFlag) {
10600 0 : GetVRFInput(state);
10601 0 : state.dataHVACVarRefFlow->GetVRFInputFlag = false;
10602 : }
10603 :
10604 15145 : if (VRFTUNum > 0 && VRFTUNum <= state.dataHVACVarRefFlow->NumVRFTU) {
10605 15145 : return state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum;
10606 : } else {
10607 0 : return 0;
10608 : }
10609 : }
10610 :
10611 15145 : int GetVRFTUZoneInletAirNode(EnergyPlusData &state, int const VRFTUNum)
10612 : {
10613 :
10614 : // FUNCTION INFORMATION:
10615 : // AUTHOR R. Raustad (copy of B Griffith routine)
10616 : // DATE WRITTEN Jan 2015
10617 : // MODIFIED na
10618 : // RE-ENGINEERED na
10619 :
10620 : // PURPOSE OF THIS FUNCTION:
10621 : // lookup function for VRF terminal unit zone inlet node
10622 :
10623 15145 : if (state.dataHVACVarRefFlow->GetVRFInputFlag) {
10624 0 : GetVRFInput(state);
10625 0 : state.dataHVACVarRefFlow->GetVRFInputFlag = false;
10626 : }
10627 :
10628 15145 : if (VRFTUNum > 0 && VRFTUNum <= state.dataHVACVarRefFlow->NumVRFTU) {
10629 15145 : return state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum;
10630 : } else {
10631 0 : return 0;
10632 : }
10633 : }
10634 :
10635 0 : int GetVRFTUOutAirNodeFromName(EnergyPlusData &state, std::string const &VRFTUName, bool &errorsFound)
10636 : {
10637 : int NodeNum; // return value of node number
10638 :
10639 0 : if (state.dataHVACVarRefFlow->GetVRFInputFlag) {
10640 0 : GetVRFInput(state);
10641 0 : state.dataHVACVarRefFlow->GetVRFInputFlag = false;
10642 : }
10643 :
10644 : int WhichVRFTU =
10645 0 : Util::FindItemInList(VRFTUName, state.dataHVACVarRefFlow->VRFTU, &VRFTerminalUnitEquipment::Name, state.dataHVACVarRefFlow->NumVRFTU);
10646 0 : if (WhichVRFTU != 0) {
10647 0 : NodeNum = state.dataHVACVarRefFlow->VRFTU(WhichVRFTU).VRFTUOutletNodeNum;
10648 : } else {
10649 0 : ShowSevereError(state, format("GetVRFTUOutAirNodeFromName: Could not find VRF TU = \"{}\"", VRFTUName));
10650 0 : errorsFound = true;
10651 0 : NodeNum = 0;
10652 : }
10653 :
10654 0 : return NodeNum;
10655 : }
10656 :
10657 0 : int GetVRFTUInAirNodeFromName(EnergyPlusData &state, std::string const &VRFTUName, bool &errorsFound)
10658 : {
10659 : int NodeNum; // return value of node number
10660 :
10661 0 : if (state.dataHVACVarRefFlow->GetVRFInputFlag) {
10662 0 : GetVRFInput(state);
10663 0 : state.dataHVACVarRefFlow->GetVRFInputFlag = false;
10664 : }
10665 :
10666 : int WhichVRFTU =
10667 0 : Util::FindItemInList(VRFTUName, state.dataHVACVarRefFlow->VRFTU, &VRFTerminalUnitEquipment::Name, state.dataHVACVarRefFlow->NumVRFTU);
10668 0 : if (WhichVRFTU != 0) {
10669 0 : NodeNum = state.dataHVACVarRefFlow->VRFTU(WhichVRFTU).VRFTUInletNodeNum;
10670 : } else {
10671 0 : ShowSevereError(state, format("GetVRFTUInAirNodeFromName: Could not find VRF TU = \"{}\"", VRFTUName));
10672 0 : errorsFound = true;
10673 0 : NodeNum = 0;
10674 : }
10675 :
10676 0 : return NodeNum;
10677 : }
10678 :
10679 15145 : int GetVRFTUMixedAirNode(EnergyPlusData &state, int const VRFTUNum)
10680 : {
10681 :
10682 : // FUNCTION INFORMATION:
10683 : // AUTHOR R. Raustad (copy of B Griffith routine)
10684 : // DATE WRITTEN Jan 2015
10685 : // MODIFIED na
10686 : // RE-ENGINEERED na
10687 :
10688 : // PURPOSE OF THIS FUNCTION:
10689 : // lookup function for VRF terminal unit mixed air node
10690 :
10691 15145 : if (state.dataHVACVarRefFlow->GetVRFInputFlag) {
10692 0 : GetVRFInput(state);
10693 0 : state.dataHVACVarRefFlow->GetVRFInputFlag = false;
10694 : }
10695 :
10696 15145 : if (VRFTUNum > 0 && VRFTUNum <= state.dataHVACVarRefFlow->NumVRFTU) {
10697 15145 : return state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum;
10698 : } else {
10699 0 : return 0;
10700 : }
10701 : }
10702 :
10703 15145 : int GetVRFTUReturnAirNode(EnergyPlusData &state, int const VRFTUNum)
10704 : {
10705 :
10706 : // FUNCTION INFORMATION:
10707 : // AUTHOR R. Raustad (copy of B Griffith routine)
10708 : // DATE WRITTEN Jan 2015
10709 : // MODIFIED na
10710 : // RE-ENGINEERED na
10711 :
10712 : // PURPOSE OF THIS FUNCTION:
10713 : // lookup function for VRF terminal unit return air node
10714 :
10715 15145 : if (state.dataHVACVarRefFlow->GetVRFInputFlag) {
10716 0 : GetVRFInput(state);
10717 0 : state.dataHVACVarRefFlow->GetVRFInputFlag = false;
10718 : }
10719 :
10720 15145 : if (VRFTUNum > 0 && VRFTUNum <= state.dataHVACVarRefFlow->NumVRFTU) {
10721 15145 : return state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum;
10722 : } else {
10723 0 : return 0;
10724 : }
10725 : }
10726 :
10727 0 : int getEqIndex(EnergyPlusData &state, std::string_view VRFTUName)
10728 : {
10729 0 : if (state.dataHVACVarRefFlow->GetVRFInputFlag) {
10730 0 : GetVRFInput(state);
10731 0 : state.dataHVACVarRefFlow->GetVRFInputFlag = false;
10732 : }
10733 :
10734 0 : for (int VRFTUNum = 1; VRFTUNum <= state.dataHVACVarRefFlow->NumVRFTU; VRFTUNum++) {
10735 0 : if (Util::SameString(VRFTUName, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name)) {
10736 0 : return VRFTUNum;
10737 : }
10738 : }
10739 0 : return 0;
10740 : }
10741 :
10742 511748 : void getVRFTUZoneLoad(
10743 : EnergyPlusData &state, int const VRFTUNum, Real64 &zoneLoad, Real64 &LoadToHeatingSP, Real64 &LoadToCoolingSP, bool const InitFlag)
10744 : {
10745 :
10746 511748 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).zoneSequenceCoolingNum > 0 &&
10747 511748 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).zoneSequenceHeatingNum > 0 && state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInAirLoop) {
10748 : // air loop equipment uses sequenced variables
10749 6380 : LoadToCoolingSP = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum)
10750 6380 : .SequencedOutputRequiredToCoolingSP(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).zoneSequenceCoolingNum) /
10751 6380 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).controlZoneMassFlowFrac;
10752 6380 : LoadToHeatingSP = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum)
10753 6380 : .SequencedOutputRequiredToHeatingSP(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).zoneSequenceHeatingNum) /
10754 6380 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).controlZoneMassFlowFrac;
10755 9004 : if (LoadToHeatingSP > 0.0 && LoadToCoolingSP > 0.0 &&
10756 2624 : state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != HVAC::ThermostatType::SingleCooling) {
10757 2624 : zoneLoad = LoadToHeatingSP;
10758 3756 : } else if (LoadToHeatingSP > 0.0 && LoadToCoolingSP > 0.0 &&
10759 0 : state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) ==
10760 : HVAC::ThermostatType::SingleCooling) {
10761 0 : zoneLoad = 0.0;
10762 6516 : } else if (LoadToHeatingSP < 0.0 && LoadToCoolingSP < 0.0 &&
10763 2760 : state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) !=
10764 : HVAC::ThermostatType::SingleHeating) {
10765 2760 : zoneLoad = LoadToCoolingSP;
10766 996 : } else if (LoadToHeatingSP < 0.0 && LoadToCoolingSP < 0.0 &&
10767 0 : state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) ==
10768 : HVAC::ThermostatType::SingleHeating) {
10769 0 : zoneLoad = 0.0;
10770 996 : } else if (LoadToHeatingSP <= 0.0 && LoadToCoolingSP >= 0.0) {
10771 996 : zoneLoad = 0.0;
10772 : }
10773 505368 : } else if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum > 0) {
10774 : // zone equipment uses Remaining* variables
10775 502180 : if (InitFlag) {
10776 : // this will need more investigation. Using Remaining* variable during the initial load calculation seems wrong.
10777 : // This may also have implications when VRF TUs are in the air loop or if SP control is used
10778 : // another question is whether initialization of the operating mode should look at TotalOutputRequired or RemainingOutputRequired
10779 224109 : zoneLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum).RemainingOutputRequired /
10780 224109 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).controlZoneMassFlowFrac;
10781 224109 : LoadToCoolingSP =
10782 224109 : state.dataZoneEnergyDemand->ZoneSysEnergyDemand(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum).OutputRequiredToCoolingSP /
10783 224109 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).controlZoneMassFlowFrac;
10784 224109 : LoadToHeatingSP =
10785 224109 : state.dataZoneEnergyDemand->ZoneSysEnergyDemand(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum).OutputRequiredToHeatingSP /
10786 224109 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).controlZoneMassFlowFrac;
10787 : } else {
10788 278071 : zoneLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum).RemainingOutputRequired /
10789 278071 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).controlZoneMassFlowFrac;
10790 278071 : LoadToCoolingSP =
10791 278071 : state.dataZoneEnergyDemand->ZoneSysEnergyDemand(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum).RemainingOutputReqToCoolSP /
10792 278071 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).controlZoneMassFlowFrac;
10793 278071 : LoadToHeatingSP =
10794 278071 : state.dataZoneEnergyDemand->ZoneSysEnergyDemand(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum).RemainingOutputReqToHeatSP /
10795 278071 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).controlZoneMassFlowFrac;
10796 : }
10797 3188 : } else if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isSetPointControlled) {
10798 3188 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).coolSPActive) {
10799 1810 : LoadToCoolingSP = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).coolLoadToSP;
10800 1810 : zoneLoad = LoadToCoolingSP;
10801 1810 : LoadToHeatingSP = 0.0;
10802 : }
10803 3188 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).heatSPActive) {
10804 1365 : LoadToHeatingSP = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).heatLoadToSP;
10805 1365 : zoneLoad = LoadToHeatingSP;
10806 1365 : LoadToCoolingSP = 0.0;
10807 : }
10808 : }
10809 511748 : }
10810 :
10811 16 : bool getVRFTUNodeNumber(EnergyPlusData &state, int const nodeNumber)
10812 : {
10813 16 : for (int vrfTUIndex = 1; vrfTUIndex <= state.dataHVACVarRefFlow->NumVRFTU; ++vrfTUIndex) {
10814 0 : auto const &vrfTU = state.dataHVACVarRefFlow->VRFTU(vrfTUIndex);
10815 :
10816 0 : bool noVrfTUOutdoorAir = false;
10817 0 : if (vrfTU.CoolOutAirVolFlow == 0 && vrfTU.HeatOutAirVolFlow == 0 && vrfTU.NoCoolHeatOutAirVolFlow == 0) {
10818 0 : noVrfTUOutdoorAir = true;
10819 : }
10820 :
10821 0 : if (noVrfTUOutdoorAir &&
10822 0 : (nodeNumber == vrfTU.VRFTUInletNodeNum || nodeNumber == vrfTU.VRFTUOutletNodeNum || nodeNumber == vrfTU.fanInletNode ||
10823 0 : nodeNumber == vrfTU.fanOutletNode || nodeNumber == vrfTU.heatCoilAirOutNode || nodeNumber == vrfTU.coolCoilAirOutNode ||
10824 0 : nodeNumber == vrfTU.VRFTUOAMixerOANodeNum || nodeNumber == vrfTU.VRFTUOAMixerRelNodeNum || nodeNumber == vrfTU.VRFTUOAMixerRetNodeNum ||
10825 0 : nodeNumber == vrfTU.VRFTUOAMixerMixedNodeNum || nodeNumber == vrfTU.SuppHeatCoilAirInletNode ||
10826 0 : nodeNumber == vrfTU.SuppHeatCoilAirOutletNode)) {
10827 0 : return true;
10828 : }
10829 : }
10830 16 : return false;
10831 : }
10832 :
10833 16365 : void VRFCondenserEquipment::CalcVRFIUTeTc_FluidTCtrl(EnergyPlusData &state)
10834 : {
10835 : // SUBROUTINE INFORMATION:
10836 : // AUTHOR RP Zhang (LBNL), XF Pang (LBNL), Y Yura (Daikin Inc)
10837 : // DATE WRITTEN June 2015
10838 : // MODIFIED na
10839 : // RE-ENGINEERED na
10840 :
10841 : // PURPOSE OF THIS SUBROUTINE:
10842 : // This subroutine is part of the new VRF model based on physics, applicable for Fluid Temperature Control.
10843 : // This subroutine determines the VRF evaporating temperature at cooling mode and the condensing temperature
10844 : // at heating mode. This is the indoor unit side analysis.
10845 :
10846 : // METHODOLOGY EMPLOYED:
10847 : // There are two options to calculate the IU Te/Tc: (1) HighSensible method analyzes the conditions of each IU
10848 : // and then decide and Te/Tc that can satisfy all the zones (2) TeTcConstant method uses fixed values provided
10849 : // by the user.
10850 :
10851 : // Followings for FluidTCtrl Only
10852 16365 : Array1D<Real64> EvapTemp;
10853 16365 : Array1D<Real64> CondTemp;
10854 : Real64 IUMinEvapTemp;
10855 : Real64 IUMaxCondTemp;
10856 :
10857 16365 : int TUListNum = this->ZoneTUListPtr;
10858 16365 : EvapTemp.allocate(state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList);
10859 16365 : CondTemp.allocate(state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList);
10860 16365 : IUMinEvapTemp = 100.0;
10861 16365 : IUMaxCondTemp = 0.0;
10862 :
10863 16365 : if (this->AlgorithmIUCtrl == 1) {
10864 : // 1. HighSensible: analyze the conditions of each IU
10865 :
10866 32562 : for (int i = 1; i <= state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList; i++) {
10867 24031 : int VRFTUNum = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(i);
10868 : // analyze the conditions of each IU
10869 24031 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRFIUVariableTeTc(state, EvapTemp(i), CondTemp(i));
10870 :
10871 : // select the Te/Tc that can satisfy all the zones
10872 24031 : IUMinEvapTemp = min(IUMinEvapTemp, EvapTemp(i), this->IUEvapTempHigh);
10873 24031 : IUMaxCondTemp = max(IUMaxCondTemp, CondTemp(i), this->IUCondTempLow);
10874 : }
10875 :
10876 8531 : this->IUEvaporatingTemp = max(IUMinEvapTemp, this->IUEvapTempLow);
10877 8531 : this->IUCondensingTemp = min(IUMaxCondTemp, this->IUCondTempHigh);
10878 :
10879 : } else {
10880 : // 2. TeTcConstant: use fixed values provided by the user
10881 7834 : this->IUEvaporatingTemp = this->EvapTempFixed;
10882 7834 : this->IUCondensingTemp = this->CondTempFixed;
10883 : }
10884 16365 : }
10885 :
10886 24031 : void VRFTerminalUnitEquipment::CalcVRFIUVariableTeTc(EnergyPlusData &state,
10887 : Real64 &EvapTemp, // evaporating temperature
10888 : Real64 &CondTemp // condensing temperature
10889 : )
10890 : {
10891 : // SUBROUTINE INFORMATION:
10892 : // AUTHOR Xiufeng Pang, LBNL
10893 : // DATE WRITTEN Feb 2014
10894 : // MODIFIED Jul 2015, RP Zhang, LBNL, Modify the bounds of the Te/Tc
10895 : // MODIFIED Nov 2015, RP Zhang, LBNL, take into account OA in Te/Tc determination
10896 : // RE-ENGINEERED na
10897 :
10898 : // PURPOSE OF THIS SUBROUTINE:
10899 : // Calculate the VRF IU Te (cooling mode) and Tc (heating mode), given zonal loads.
10900 :
10901 : // METHODOLOGY EMPLOYED:
10902 : // A new physics based VRF model applicable for Fluid Temperature Control.
10903 :
10904 : using namespace DataZoneEnergyDemands;
10905 : using Psychrometrics::PsyHFnTdbW;
10906 : using SingleDuct::SimATMixer;
10907 :
10908 : int CoolCoilNum; // index to the VRF Cooling DX coil to be simulated
10909 : int HeatCoilNum; // index to the VRF Heating DX coil to be simulated
10910 : int IndexToTUInTUList; // index to TU in specific list for the VRF system
10911 : int TUListIndex; // index to TU list for this VRF system
10912 : int VRFNum; // index to VRF that the VRF Terminal Unit serves
10913 : int VRFInletNode; // VRF inlet node number
10914 : Real64 BFC; // Bypass factor at the cooling mode (-)
10915 : Real64 BFH; // Bypass factor at the heating mode (-)
10916 : Real64 C1Tevap; // Coefficient for indoor unit coil evaporating temperature curve (-)
10917 : Real64 C2Tevap; // Coefficient for indoor unit coil evaporating temperature curve (-)
10918 : Real64 C3Tevap; // Coefficient for indoor unit coil evaporating temperature curve (-)
10919 : Real64 C1Tcond; // Coefficient for indoor unit coil condensing temperature curve (-)
10920 : Real64 C2Tcond; // Coefficient for indoor unit coil condensing temperature curve (-)
10921 : Real64 C3Tcond; // Coefficient for indoor unit coil condensing temperature curve (-)
10922 : Real64 CondTempMin; // Min condensing temperature (C)
10923 : Real64 CondTempMax; // Max condensing temperature, correspond to the maximum heating capacity (C)
10924 : Real64 DeltaT; // Difference between evaporating/condensing temperature and coil surface temperature (C)
10925 : Real64 EvapTempMax; // Max evaporating temperature (C)
10926 : Real64 EvapTempMin; // Min evaporating temperature, correspond to the maximum cooling capacity (C)
10927 : Real64 Garate; // Nominal air mass flow rate
10928 : Real64 H_coil_in; // Air enthalpy at the coil inlet (kJ/kg)
10929 : Real64 QZnReqSenCoolingLoad; // Zone required sensible cooling load (W)
10930 : Real64 QZnReqSenHeatingLoad; // Zone required sensible heating load (W)
10931 : Real64 RHsat; // Relative humidity of the air at saturated condition(-)
10932 : Real64 SH; // Super heating degrees (C)
10933 : Real64 SC; // Subcooling degrees (C)
10934 : Real64 T_coil_in; // Temperature of the air at the coil inlet, after absorbing the heat released by fan (C)
10935 : Real64 T_TU_in; // Air temperature at the indoor unit inlet (C)
10936 : Real64 Tout; // Air temperature at the indoor unit outlet (C)
10937 : Real64 Th2; // Air temperature at the coil surface (C)
10938 : Real64 W_coil_in; // coil inlet air humidity ratio [kg/kg]
10939 : Real64 W_TU_in; // Air humidity ratio at the indoor unit inlet[kg/kg]
10940 :
10941 : // Get the equipment/zone index corresponding to the VRFTU
10942 24031 : CoolCoilNum = this->CoolCoilIndex;
10943 24031 : HeatCoilNum = this->HeatCoilIndex;
10944 24031 : VRFNum = this->VRFSysNum;
10945 24031 : TUListIndex = state.dataHVACVarRefFlow->VRF(VRFNum).ZoneTUListPtr;
10946 24031 : IndexToTUInTUList = this->IndexToTUInTUList;
10947 :
10948 : // Bounds of Te/Tc for VRF IU Control Algorithm: VariableTemp
10949 24031 : EvapTempMin = state.dataHVACVarRefFlow->VRF(VRFNum).IUEvapTempLow;
10950 24031 : EvapTempMax = state.dataHVACVarRefFlow->VRF(VRFNum).IUEvapTempHigh;
10951 24031 : CondTempMin = state.dataHVACVarRefFlow->VRF(VRFNum).IUCondTempLow;
10952 24031 : CondTempMax = state.dataHVACVarRefFlow->VRF(VRFNum).IUCondTempHigh;
10953 :
10954 : // Coefficients describing coil performance
10955 24031 : SH = state.dataDXCoils->DXCoil(CoolCoilNum).SH;
10956 24031 : SC = state.dataDXCoils->DXCoil(HeatCoilNum).SC;
10957 24031 : C1Tevap = state.dataDXCoils->DXCoil(CoolCoilNum).C1Te;
10958 24031 : C2Tevap = state.dataDXCoils->DXCoil(CoolCoilNum).C2Te;
10959 24031 : C3Tevap = state.dataDXCoils->DXCoil(CoolCoilNum).C3Te;
10960 24031 : C1Tcond = state.dataDXCoils->DXCoil(HeatCoilNum).C1Tc;
10961 24031 : C2Tcond = state.dataDXCoils->DXCoil(HeatCoilNum).C2Tc;
10962 24031 : C3Tcond = state.dataDXCoils->DXCoil(HeatCoilNum).C3Tc;
10963 :
10964 24031 : VRFInletNode = this->VRFTUInletNodeNum;
10965 24031 : T_TU_in = state.dataLoopNodes->Node(VRFInletNode).Temp;
10966 24031 : W_TU_in = state.dataLoopNodes->Node(VRFInletNode).HumRat;
10967 24031 : T_coil_in = this->coilInNodeT;
10968 24031 : W_coil_in = this->coilInNodeW;
10969 :
10970 24031 : Garate = state.dataHVACVarRefFlow->CompOnMassFlow;
10971 24031 : H_coil_in = PsyHFnTdbW(T_coil_in, W_coil_in);
10972 24031 : RHsat = 0.98;
10973 24031 : BFC = 0.0592;
10974 24031 : BFH = 0.136;
10975 24031 : Real64 ZoneLoad = 0.0;
10976 24031 : Real64 LoadToHeatingSP = 0.0;
10977 24031 : Real64 LoadToCoolingSP = 0.0;
10978 :
10979 : // 1. COOLING Mode
10980 45510 : if ((Garate > 0.0) && ((!state.dataHVACVarRefFlow->VRF(VRFNum).HeatRecoveryUsed && state.dataHVACVarRefFlow->CoolingLoad(VRFNum)) ||
10981 21479 : (state.dataHVACVarRefFlow->VRF(VRFNum).HeatRecoveryUsed &&
10982 19370 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList)))) {
10983 : // 1.1) Cooling coil is running
10984 14926 : getVRFTUZoneLoad(state, IndexToTUInTUList, ZoneLoad, LoadToHeatingSP, LoadToCoolingSP, false);
10985 14926 : QZnReqSenCoolingLoad = max(0.0, -1.0 * LoadToCoolingSP);
10986 14926 : Tout = T_TU_in - QZnReqSenCoolingLoad * 1.2 / Garate / 1005;
10987 14926 : Th2 = T_coil_in - (T_coil_in - Tout) / (1 - BFC);
10988 14926 : DeltaT = C3Tevap * SH * SH + C2Tevap * SH + C1Tevap;
10989 14926 : EvapTemp = max(min((Th2 - DeltaT), EvapTempMax), EvapTempMin);
10990 :
10991 : } else {
10992 : // 1.2) Cooling coil is not running
10993 9105 : EvapTemp = T_coil_in;
10994 : }
10995 :
10996 : // 2. HEATING Mode
10997 45985 : if ((Garate > 0.0) && ((!state.dataHVACVarRefFlow->VRF(VRFNum).HeatRecoveryUsed && state.dataHVACVarRefFlow->HeatingLoad(VRFNum)) ||
10998 21954 : (state.dataHVACVarRefFlow->VRF(VRFNum).HeatRecoveryUsed &&
10999 19370 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList)))) {
11000 : // 2.1) Heating coil is running
11001 8487 : getVRFTUZoneLoad(state, IndexToTUInTUList, ZoneLoad, LoadToHeatingSP, LoadToCoolingSP, false);
11002 8487 : QZnReqSenHeatingLoad = max(0.0, LoadToHeatingSP);
11003 8487 : Tout = T_TU_in + QZnReqSenHeatingLoad / Garate / 1005;
11004 8487 : Th2 = T_coil_in + (Tout - T_coil_in) / (1 - BFH);
11005 8487 : DeltaT = C3Tcond * SC * SC + C2Tcond * SC + C1Tcond;
11006 8487 : CondTemp = max(min((Th2 + DeltaT), CondTempMax), CondTempMin);
11007 : } else {
11008 : // 2.2) Heating coil is not running
11009 15544 : CondTemp = T_coil_in;
11010 : }
11011 24031 : }
11012 :
11013 16365 : void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state)
11014 : {
11015 :
11016 : // SUBROUTINE INFORMATION:
11017 : // AUTHOR RP Zhang (LBNL), XF Pang (LBNL), Y Yura (Daikin Inc)
11018 : // DATE WRITTEN June 2015
11019 : // MODIFIED Feb 2016, RP Zhang, add the control logics for VRF-HR operations
11020 : // RE-ENGINEERED na
11021 :
11022 : // PURPOSE OF THIS SUBROUTINE:
11023 : // This subroutine is part of the new VRF model based on physics, applicable for Fluid Temperature Control.
11024 : // This is adapted from subroutine CalcVRFCondenser, which is part of the VRF model based on system curves.
11025 : // This subroutine models the interactions of VRF indoor units with the outdoor unit.
11026 : // The indoor terminal units are simulated first, and then the outdoor unit is simulated.
11027 :
11028 : // METHODOLOGY EMPLOYED:
11029 : // A new physics based VRF model applicable for Fluid Temperature Control.
11030 :
11031 : using Curve::CurveValue;
11032 : using General::SolveRoot;
11033 :
11034 : using PlantUtilities::SetComponentFlowRate;
11035 : using Psychrometrics::RhoH2O;
11036 :
11037 : static constexpr std::string_view RoutineName("CalcVRFCondenser_FluidTCtrl");
11038 :
11039 : int VRFCond; // index to VRF condenser
11040 : int TUListNum; // index to TU List
11041 : int NumTUInList; // number of terminal units is list
11042 : int NumTU; // index for loop on terminal units
11043 : int TUIndex; // Index to terminal unit
11044 : int CoolCoilIndex; // index to cooling coil in terminal unit
11045 : int HeatCoilIndex; // index to heating coil in terminal unit
11046 : int NumTUInCoolingMode; // number of terminal units actually cooling
11047 : int NumTUInHeatingMode; // number of terminal units actually heating
11048 :
11049 : Real64 TUParasiticPower; // total terminal unit parasitic power (W)
11050 : Real64 TUFanPower; // total terminal unit fan power (W)
11051 : Real64 InletAirWetBulbC; // coil inlet air wet-bulb temperature (C)
11052 : Real64 InletAirDryBulbC; // coil inlet air dry-bulb temperature (C)
11053 : Real64 CondInletTemp; // condenser inlet air temperature (C)
11054 : Real64 OutdoorDryBulb; // outdoor dry-bulb temperature (C)
11055 : Real64 OutdoorHumRat; // outdoor humidity ratio (kg/kg)
11056 : Real64 OutdoorPressure; // outdoor pressure (Pa)
11057 : Real64 OutdoorWetBulb; // outdoor wet-bulb temperature (C)
11058 : Real64 SumCoolInletWB; // sum of active TU's DX cooling coil inlet air wet-bulb temperature
11059 : Real64 SumHeatInletDB; // sum of active TU's DX heating coil inlet air dry-bulb temperature
11060 : Real64 SumHeatInletWB; // sum of active TU's DX heating coil inlet air wet-bulb temperature
11061 : Real64 TotalTUCoolingCapacity; // sum of TU's cooling capacity (W)
11062 : Real64 TotalTUHeatingCapacity; // sum of TU's heating capacity (W)
11063 : Real64 TotalCondCoolingCapacity; // total available condenser cooling capacity (W)
11064 : Real64 TotalCondHeatingCapacity; // total available condenser heating capacity (W)
11065 : Real64 CoolingPLR; // condenser cooling PLR
11066 : Real64 HeatingPLR; // condenser heating PLR
11067 : Real64 CyclingRatio; // cycling ratio of condenser's compressors
11068 : int Stage; // used for crankcase heater power calculation
11069 : Real64 UpperStageCompressorRatio; // used for crankcase heater power calculation
11070 : Real64 RhoAir; // Density of air [kg/m3]
11071 : Real64 PartLoadFraction; // Part load fraction from PLFFPLR curve
11072 : Real64 VRFRTF; // VRF runtime fraction when cycling below MINPLR
11073 : Real64 OutdoorCoilT; // Outdoor coil temperature (C)
11074 : Real64 OutdoorCoildw; // Outdoor coil delta w assuming coil temp of OutdoorCoilT (kg/kg)
11075 : Real64 FractionalDefrostTime; // Fraction of time step system is in defrost
11076 : Real64 HeatingCapacityMultiplier; // Multiplier for heating capacity when system is in defrost
11077 : Real64 InputPowerMultiplier; // Multiplier for power when system is in defrost
11078 : Real64 LoadDueToDefrost; // Additional load due to defrost
11079 : Real64 DefrostEIRTempModFac; // EIR modifier for defrost (function of entering drybulb, outside wetbulb)
11080 : Real64 HRInitialCapFrac; // Fractional cooling degradation at the start of heat recovery from cooling mode
11081 : Real64 HRCapTC; // Time constant used to recover from initial degradation in cooling heat recovery
11082 : Real64 HRInitialEIRFrac; // Fractional cooling degradation at the start of heat recovery from cooling mode
11083 : Real64 HREIRTC; // Time constant used to recover from initial degradation in cooling heat recovery
11084 : Real64 CurrentEndTime; // end time of current time step
11085 : Real64 SUMultiplier; // multiplier for simulating mode changes
11086 : Real64 CondPower; // condenser power [W]
11087 : Real64 CondCapacity; // condenser heat rejection [W]
11088 : Real64 TotPower; // total condenser power use [W]
11089 : bool HRHeatRequestFlag; // flag indicating VRF TU could operate in heating mode
11090 : bool HRCoolRequestFlag; // flag indicating VRF TU could operate in cooling mode
11091 :
11092 : // Followings for VRF FluidTCtrl Only
11093 : int Counter; // index for iterations [-]
11094 : int NumIteHIUIn; // index for HIU calculation iterations [-]
11095 : int NumOfCompSpdInput; // Number of compressor speed input by the user [-]
11096 : Real64 CompSpdActual; // Actual compressor running speed [rps]
11097 : Real64 C_cap_operation; // Compressor capacity modification algorithm_modified Cap [-]
11098 : Real64 CompEvaporatingCAPSpdMin; // evaporating capacity at the lowest compressor speed [W]
11099 : Real64 CompEvaporatingCAPSpdMax; // evaporating capacity at the highest compressor speed [W]
11100 : Real64 CompEvaporatingPWRSpdMin; // compressor power at the lowest compressor speed [W]
11101 : Real64 CompEvaporatingPWRSpdMax; // compressor power at the highest compressor speed [W]
11102 : Real64 CapMaxTe; // maximum Te during operation, for capacity calculations [C]
11103 : Real64 CapMinTe; // minimum Te during operation, for capacity calculations [C]
11104 : Real64 CapMinPe; // minimum Pe during operation, for capacity calculations [Pa]
11105 : Real64 CapMaxTc; // maximum Tc during operation, for capacity calculations [C]
11106 : Real64 CapMaxPc; // maximum Pc during operation, for capacity calculations [Pa]
11107 : Real64 CapMinTc; // minimum Tc during operation, for capacity calculations [C]
11108 : Real64 CapMinPc; // minimum Pc during operation, for capacity calculations [Pa]
11109 : Real64 h_IU_evap_in; // enthalpy of IU evaporator at inlet [kJ/kg]
11110 : Real64 h_IU_evap_in_new; // enthalpy of IU evaporator at inlet (new) [kJ/kg]
11111 : Real64 h_IU_evap_in_low; // enthalpy of IU evaporator at inlet (low) [kJ/kg]
11112 : Real64 h_IU_evap_in_up; // enthalpy of IU evaporator at inlet (up) [kJ/kg]
11113 : Real64 h_IU_evap_out; // enthalpy of IU evaporator at outlet [kJ/kg]
11114 : Real64 h_IU_evap_out_i; // enthalpy of IU evaporator at outlet (individual) [kJ/kg]
11115 : Real64 h_IU_cond_in; // enthalpy of IU condenser at inlet [kJ/kg]
11116 : Real64 h_IU_cond_in_low; // enthalpy of IU condenser at inlet (low) [kJ/kg]
11117 : Real64 h_IU_cond_in_up; // enthalpy of IU condenser at inlet (up) [kJ/kg]
11118 : Real64 h_IU_cond_out; // enthalpy of IU condenser at outlet [kJ/kg]
11119 : Real64 h_IU_cond_out_i; // enthalpy of IU condenser at outlet (individual) [kJ/kg]
11120 : Real64 h_IU_cond_out_ave; // average enthalpy of the refrigerant leaving IU condensers [kJ/kg]
11121 : Real64 h_IU_PLc_out; // enthalpy of refrigerant at the outlet of IU evaporator side main pipe, after piping loss (c) [kJ/kg]
11122 : Real64 h_comp_in; // enthalpy of refrigerant at compressor inlet, after piping loss (c) [kJ/kg]
11123 : Real64 h_comp_in_new; // enthalpy of refrigerant at compressor inlet (new) [kJ/kg]
11124 : Real64 h_comp_out; // enthalpy of refrigerant at compressor outlet [kJ/kg]
11125 : Real64 h_comp_out_new; // enthalpy of refrigerant at compressor outlet (new) [kJ/kg]
11126 : Real64 m_air; // OU coil air mass flow rate [kg/s]
11127 : Real64 m_ref_IU_cond; // mass flow rate of Refrigerant through IU condensers [kg/s]
11128 : Real64 m_ref_IU_cond_i; // mass flow rate of Refrigerant through an individual IU condenser [kg/s]
11129 : Real64 m_ref_IU_evap; // mass flow rate of Refrigerant through IU evaporators [kg/s]
11130 : Real64 m_ref_IU_evap_i; // mass flow rate of Refrigerant through an individual IU evaporator [kg/s]
11131 : Real64 m_ref_OU_evap; // mass flow rate of Refrigerant through OU evaporator [kg/s]
11132 : Real64 m_ref_OU_cond; // mass flow rate of Refrigerant through OU condenser [kg/s]
11133 : Real64 Ncomp; // compressor power [W]
11134 : Real64 Ncomp_new; // compressor power for temporary use in iterations [W]
11135 : Real64 P_comp_in; // pressure of refrigerant at IU condenser outlet [Pa]
11136 : Real64 Pcond; // VRF condensing pressure [Pa]
11137 : Real64 Pevap; // VRF evaporating pressure [Pa]
11138 : Real64 Pdischarge; // VRF compressor discharge pressure [Pa]
11139 : Real64 Psuction; // VRF compressor suction pressure [Pa]
11140 : Real64 Pipe_DeltP_c; // Piping Loss Algorithm Parameter: Pipe pressure drop (c) [Pa]
11141 : Real64 Pipe_DeltP_h; // Piping Loss Algorithm Parameter: Pipe pressure drop (h) [Pa]
11142 : Real64 Pipe_Q_c; // Piping Loss Algorithm Parameter: Heat loss (c) [W]
11143 : Real64 Pipe_Q_h; // Piping Loss Algorithm Parameter: Heat loss (h) [W]
11144 : Real64 Q_c_TU_PL; // Cooling load to be met at heating mode, including the piping loss(W)
11145 : Real64 Q_h_TU_PL; // Heating load to be met at heating mode, including the piping loss (W)
11146 : Real64 Q_h_OU; // outdoor unit condenser heat release (cooling mode) [W]
11147 : Real64 Q_c_OU; // outdoor unit evaporator heat extract (heating mode) [W]
11148 : Real64 RefMaxPc; // maximum refrigerant condensing pressure [Pa]
11149 : Real64 RefMinTe; // Minimum refrigerant evaporating temperature [Pa]
11150 : Real64 RefMinPe; // Minimum refrigerant evaporating pressure [Pa]
11151 : Real64 RefPLow; // Low Pressure Value for Ps (>0.0) [Pa]
11152 : Real64 RefPHigh; // High Pressure Value for Ps (max in tables) [Pa]
11153 : Real64 RefTLow; // Low Temperature Value for Ps (max in tables) [C]
11154 : Real64 RefTHigh; // High Temperature Value for Ps (max in tables) [C]
11155 : Real64 RefTSat; // Saturated temperature of the refrigerant. Used to check whether the refrigerant is in the superheat area [C]
11156 : Real64 SC_IU_merged; // Piping Loss Algorithm Parameter: average subcooling degrees after the indoor units [C]
11157 : Real64 SH_IU_merged; // Piping Loss Algorithm Parameter: average super heating degrees after the indoor units [C]
11158 : Real64 SC_OU; // subcooling degrees at OU condenser [C]
11159 : Real64 SH_OU; // super heating degrees at OU evaporator [C]
11160 : Real64 SH_Comp; // Temperature difference between compressor inlet node and Tsuction [C]
11161 : Real64 T_comp_in; // temperature of refrigerant at compressor inlet, after piping loss (c) [C]
11162 : Real64 TU_HeatingLoad; // Heating load from terminal units, excluding heating loss [W]
11163 : Real64 TU_CoolingLoad; // Cooling load from terminal units, excluding heating loss [W]
11164 : Real64 Tdischarge; // VRF Compressor discharge refrigerant temperature [C]
11165 : Real64 Tsuction; // VRF compressor suction refrigerant temperature [C]
11166 : Real64 Tolerance; // Tolerance for condensing temperature calculation [C]
11167 : Real64 Tfs; // Temperature of the air at the coil surface [C]
11168 16365 : Array1D<Real64> CompEvaporatingPWRSpd; // Array for the compressor power at certain speed [W]
11169 16365 : Array1D<Real64> CompEvaporatingCAPSpd; // Array for the evaporating capacity at certain speed [W]
11170 :
11171 : // variable initializations
11172 16365 : TUListNum = this->ZoneTUListPtr;
11173 16365 : NumTUInList = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList;
11174 16365 : VRFCond = state.dataHVACVarRefFlow->VRFTU(state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(1)).VRFSysNum;
11175 16365 : TU_CoolingLoad = 0.0;
11176 16365 : TU_HeatingLoad = 0.0;
11177 16365 : TUParasiticPower = 0.0;
11178 16365 : TUFanPower = 0.0;
11179 16365 : CoolingPLR = 0.0;
11180 16365 : HeatingPLR = 0.0;
11181 16365 : CyclingRatio = 1.0;
11182 16365 : SumCoolInletWB = 0.0;
11183 16365 : SumHeatInletDB = 0.0;
11184 16365 : SumHeatInletWB = 0.0;
11185 16365 : TotalCondCoolingCapacity = 0.0;
11186 16365 : TotalCondHeatingCapacity = 0.0;
11187 16365 : TotalTUCoolingCapacity = 0.0;
11188 16365 : TotalTUHeatingCapacity = 0.0;
11189 16365 : NumTUInCoolingMode = 0;
11190 16365 : NumTUInHeatingMode = 0;
11191 16365 : Tolerance = 0.05;
11192 16365 : Counter = 1;
11193 16365 : NumIteHIUIn = 1;
11194 16365 : this->ElecCoolingPower = 0.0;
11195 16365 : this->ElecHeatingPower = 0.0;
11196 16365 : this->CrankCaseHeaterPower = 0.0;
11197 16365 : this->EvapCondPumpElecPower = 0.0; // for EvaporativelyCooled condenser
11198 16365 : this->EvapWaterConsumpRate = 0.0;
11199 16365 : this->DefrostPower = 0.0;
11200 16365 : this->OperatingCoolingCOP = 0.0;
11201 16365 : this->OperatingHeatingCOP = 0.0;
11202 16365 : this->OperatingCOP = 0.0;
11203 16365 : this->SCHE = 0.0;
11204 16365 : this->BasinHeaterPower = 0.0;
11205 16365 : this->CondensingTemp = 60.0; // OutDryBulbTemp;
11206 16365 : this->VRFHeatRec = 0.0;
11207 :
11208 : // Refrigerant data
11209 16365 : RefMinTe = -15;
11210 16365 : RefMaxPc = 4000000.0;
11211 16365 : RefMinPe = this->refrig->getSatPressure(state, RefMinTe, RoutineName);
11212 16365 : RefTLow = this->refrig->PsLowTempValue; // High Temperature Value for Ps (max in tables)
11213 16365 : RefTHigh = this->refrig->PsHighTempValue; // High Temperature Value for Ps (max in tables)
11214 16365 : RefPLow = this->refrig->PsLowPresValue; // Low Pressure Value for Ps (>0.0)
11215 16365 : RefPHigh = this->refrig->PsHighPresValue; // High Pressure Value for Ps (max in tables)
11216 :
11217 : // sum loads on TU coils
11218 79566 : for (NumTU = 1; NumTU <= NumTUInList; ++NumTU) {
11219 63201 : TU_CoolingLoad += state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU);
11220 63201 : TU_HeatingLoad += state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU);
11221 63201 : TUParasiticPower +=
11222 63201 : state.dataHVACVarRefFlow->VRFTU(state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU)).ParasiticCoolElecPower +
11223 63201 : state.dataHVACVarRefFlow->VRFTU(state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU)).ParasiticHeatElecPower;
11224 63201 : TUFanPower += state.dataHVACVarRefFlow->VRFTU(state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU)).FanPower;
11225 : }
11226 16365 : this->TUCoolingLoad = TU_CoolingLoad; // this is cooling coil load, not terminal unit load
11227 16365 : this->TUHeatingLoad = TU_HeatingLoad; // this is heating coil load, not terminal unit load
11228 :
11229 : // loop through TU's and calculate average inlet conditions for active coils
11230 79566 : for (NumTU = 1; NumTU <= NumTUInList; ++NumTU) {
11231 63201 : TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU);
11232 63201 : CoolCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex;
11233 63201 : HeatCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatCoilIndex;
11234 :
11235 63201 : if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) > 0.0) {
11236 36766 : SumCoolInletWB += state.dataDXCoils->DXCoilCoolInletAirWBTemp(CoolCoilIndex) *
11237 36766 : state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) / TU_CoolingLoad;
11238 36766 : ++NumTUInCoolingMode;
11239 : }
11240 63201 : if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) > 0.0) {
11241 22617 : SumHeatInletDB += state.dataDXCoils->DXCoilHeatInletAirDBTemp(HeatCoilIndex) *
11242 22617 : state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) / TU_HeatingLoad;
11243 22617 : SumHeatInletWB += state.dataDXCoils->DXCoilHeatInletAirWBTemp(HeatCoilIndex) *
11244 22617 : state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) / TU_HeatingLoad;
11245 22617 : ++NumTUInHeatingMode;
11246 : }
11247 : }
11248 :
11249 : // set condenser entering air conditions (Outdoor air conditions)
11250 16365 : if (this->CondenserNodeNum != 0) {
11251 0 : OutdoorDryBulb = state.dataLoopNodes->Node(this->CondenserNodeNum).Temp;
11252 0 : if (this->CondenserType != DataHeatBalance::RefrigCondenserType::Water) {
11253 0 : OutdoorHumRat = state.dataLoopNodes->Node(this->CondenserNodeNum).HumRat;
11254 0 : OutdoorPressure = state.dataLoopNodes->Node(this->CondenserNodeNum).Press;
11255 0 : OutdoorWetBulb = state.dataLoopNodes->Node(this->CondenserNodeNum).OutAirWetBulb;
11256 : } else {
11257 0 : OutdoorHumRat = state.dataEnvrn->OutHumRat;
11258 0 : OutdoorPressure = state.dataEnvrn->OutBaroPress;
11259 0 : OutdoorWetBulb = state.dataEnvrn->OutWetBulbTemp;
11260 : }
11261 : } else {
11262 16365 : OutdoorDryBulb = state.dataEnvrn->OutDryBulbTemp;
11263 16365 : OutdoorHumRat = state.dataEnvrn->OutHumRat;
11264 16365 : OutdoorPressure = state.dataEnvrn->OutBaroPress;
11265 16365 : OutdoorWetBulb = state.dataEnvrn->OutWetBulbTemp;
11266 : }
11267 16365 : RhoAir = PsyRhoAirFnPbTdbW(state, OutdoorPressure, OutdoorDryBulb, OutdoorHumRat);
11268 :
11269 16365 : CondInletTemp = OutdoorDryBulb; // this->CondenserType == AirCooled
11270 16365 : this->CondenserInletTemp = CondInletTemp;
11271 :
11272 : //*************
11273 : // VRF-HP MODES:
11274 : // 1. Cooling
11275 : // 2. Heating
11276 : // 3. No running
11277 : // VRF-HR MODES:
11278 : // 1. Cooling Only
11279 : // 2. Cooling Dominant w/o HR Loss
11280 : // 3. Cooling Dominant w/ HR Loss
11281 : // 4. Heating Dominant w/ HR Loss
11282 : // 5. Heating Dominant w/o HR Loss
11283 : // 6. Heating Only
11284 : // 7. No running
11285 :
11286 : // Flag for VRF-HR Operations
11287 16365 : if (TU_HeatingLoad > 0) {
11288 6254 : HRHeatRequestFlag = true;
11289 : } else {
11290 10111 : state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false;
11291 10111 : HRHeatRequestFlag = false;
11292 : }
11293 16365 : if (TU_CoolingLoad > 0) {
11294 9523 : HRCoolRequestFlag = true;
11295 : } else {
11296 6842 : state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false;
11297 6842 : HRCoolRequestFlag = false;
11298 : }
11299 :
11300 : // Initialization for Ncomp iterations
11301 16365 : NumOfCompSpdInput = this->CompressorSpeed.size();
11302 16365 : CompEvaporatingPWRSpd.dimension(NumOfCompSpdInput);
11303 16365 : CompEvaporatingCAPSpd.dimension(NumOfCompSpdInput);
11304 16365 : this->OperatingMode = 0; // report variable for heating or cooling mode
11305 :
11306 : // 1. VRF-HP Cooling Mode .OR. VRF-HR Mode_1
11307 25689 : if ((!this->HeatRecoveryUsed && state.dataHVACVarRefFlow->CoolingLoad(VRFCond)) ||
11308 9324 : (this->HeatRecoveryUsed && !HRHeatRequestFlag && HRCoolRequestFlag)) {
11309 :
11310 9523 : this->OperatingMode = ModeCoolingOnly;
11311 9523 : this->VRFOperationSimPath = 10;
11312 :
11313 : // Initialization of VRF-FluidTCtrl Model
11314 9523 : Q_c_TU_PL = TU_CoolingLoad;
11315 :
11316 : // Evaporator (IU side) operational parameters
11317 9523 : Pevap = this->refrig->getSatPressure(state, this->IUEvaporatingTemp, RoutineName);
11318 9523 : Psuction = Pevap;
11319 9523 : this->EvaporatingTemp =
11320 9523 : this->IUEvaporatingTemp; // GetSatTemperatureRefrig(state, this->RefrigerantName, max( min( Pevap, RefPHigh ), RefPLow
11321 : // ), RefrigerantIndex, RoutineName );
11322 :
11323 : // Condenser (OU side) operation ranges
11324 9523 : CapMaxPc = min(Psuction + this->CompMaxDeltaP, RefMaxPc);
11325 9523 : CapMaxTc = this->refrig->getSatTemperature(state, max(min(CapMaxPc, RefPHigh), RefPLow), RoutineName);
11326 9523 : CapMinTc = OutdoorDryBulb + this->SC;
11327 9523 : CapMinPc = this->refrig->getSatPressure(state, CapMinTc, RoutineName);
11328 :
11329 : // Evaporator (IU side) operation ranges
11330 9523 : CapMinPe = max(CapMinPc - this->CompMaxDeltaP, RefMinPe);
11331 9523 : CapMinTe = this->refrig->getSatTemperature(state, max(min(CapMinPe, RefPHigh), RefPLow), RoutineName);
11332 :
11333 : // Evaporative capacity ranges
11334 9523 : CompEvaporatingCAPSpdMin = this->CoffEvapCap * this->RatedEvapCapacity * CurveValue(state, this->OUCoolingCAPFT(1), CapMinTc, CapMinTe);
11335 9523 : CompEvaporatingPWRSpdMin = this->RatedCompPower * CurveValue(state, this->OUCoolingPWRFT(1), CapMinTc, CapMinTe);
11336 19046 : CompEvaporatingCAPSpdMax = this->CoffEvapCap * this->RatedEvapCapacity *
11337 9523 : CurveValue(state, this->OUCoolingCAPFT(NumOfCompSpdInput), this->CondensingTemp, this->IUEvaporatingTemp);
11338 9523 : CompEvaporatingPWRSpdMax =
11339 9523 : this->RatedCompPower * CurveValue(state, this->OUCoolingPWRFT(NumOfCompSpdInput), this->CondensingTemp, this->IUEvaporatingTemp);
11340 :
11341 : // Initialization for h_IU_evap_in iterations (Label12)
11342 9523 : h_IU_evap_in_low = this->refrig->getSatEnthalpy(state, OutdoorDryBulb - this->SC, 0.0, RoutineName); // Tc = Tamb
11343 9523 : h_IU_evap_in_up = this->refrig->getSatEnthalpy(state, CapMaxTc - this->SC, 0.0, RoutineName); // Tc = CapMaxTc
11344 9523 : h_IU_evap_in = this->refrig->getSatEnthalpy(state, OutdoorDryBulb + 10 - this->SC, 0.0, RoutineName); // Tc = Tamb+10
11345 :
11346 9523 : NumIteHIUIn = 1;
11347 12031 : Label12:;
11348 12031 : m_ref_IU_evap = 0;
11349 12031 : h_IU_evap_out = 0;
11350 12031 : h_IU_evap_out_i = 0;
11351 12031 : m_ref_IU_evap_i = 0;
11352 12031 : SH_IU_merged = 0;
11353 :
11354 : // Calculate total IU refrigerant flow rate and SH_IU_merged
11355 12031 : if (Q_c_TU_PL > CompEvaporatingCAPSpdMax) {
11356 : // Required load is beyond the max system capacity
11357 :
11358 4483 : Q_c_TU_PL = CompEvaporatingCAPSpdMax;
11359 4483 : TU_CoolingLoad = CompEvaporatingCAPSpdMax;
11360 4483 : this->TUCoolingLoad = TU_CoolingLoad;
11361 4483 : RefTSat = this->refrig->getSatTemperature(state, max(min(Pevap, RefPHigh), RefPLow), RoutineName);
11362 : h_IU_evap_out =
11363 4483 : this->refrig->getSupHeatEnthalpy(state, max(RefTSat, this->IUEvaporatingTemp + 3), max(min(Pevap, RefPHigh), RefPLow), RoutineName);
11364 4483 : SH_IU_merged = 3;
11365 4483 : m_ref_IU_evap = TU_CoolingLoad / (h_IU_evap_out - h_IU_evap_in);
11366 :
11367 : } else {
11368 :
11369 35104 : for (NumTU = 1; NumTU <= NumTUInList; NumTU++) { // Calc total refrigerant flow rate
11370 27556 : if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) > 0) {
11371 26891 : TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU);
11372 26891 : CoolCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex;
11373 :
11374 26891 : RefTSat = this->refrig->getSatTemperature(state, max(min(Pevap, RefPHigh), RefPLow), RoutineName);
11375 : h_IU_evap_out_i =
11376 53782 : this->refrig->getSupHeatEnthalpy(state,
11377 26891 : max(RefTSat, this->IUEvaporatingTemp + state.dataDXCoils->DXCoil(CoolCoilIndex).ActualSH),
11378 : max(min(Pevap, RefPHigh), RefPLow),
11379 : RoutineName);
11380 :
11381 26891 : if (h_IU_evap_out_i > h_IU_evap_in) {
11382 26891 : m_ref_IU_evap_i = (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) <= 0.0)
11383 26891 : ? 0.0
11384 26891 : : (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) /
11385 26891 : (h_IU_evap_out_i - h_IU_evap_in)); // Ref Flow Rate in the IU( kg/s )
11386 26891 : m_ref_IU_evap = m_ref_IU_evap + m_ref_IU_evap_i;
11387 26891 : h_IU_evap_out = h_IU_evap_out + m_ref_IU_evap_i * h_IU_evap_out_i;
11388 26891 : SH_IU_merged = SH_IU_merged + m_ref_IU_evap_i * state.dataDXCoils->DXCoil(CoolCoilIndex).ActualSH;
11389 : }
11390 : }
11391 : }
11392 7548 : if (m_ref_IU_evap > 0) {
11393 7548 : h_IU_evap_out = h_IU_evap_out / m_ref_IU_evap;
11394 7548 : SH_IU_merged = SH_IU_merged / m_ref_IU_evap;
11395 : } else {
11396 0 : RefTSat = this->refrig->getSatTemperature(state, max(min(Pevap, RefPHigh), RefPLow), RoutineName);
11397 0 : h_IU_evap_out = this->refrig->getSupHeatEnthalpy(
11398 0 : state, max(RefTSat, this->IUEvaporatingTemp + 3), max(min(Pevap, RefPHigh), RefPLow), RoutineName);
11399 0 : SH_IU_merged = 3;
11400 0 : m_ref_IU_evap = TU_CoolingLoad / (h_IU_evap_out - h_IU_evap_in);
11401 : }
11402 : }
11403 :
11404 : // *Calculate piping loss
11405 12031 : this->VRFOU_PipeLossC(
11406 : state, m_ref_IU_evap, max(min(Pevap, RefPHigh), RefPLow), h_IU_evap_out, SH_IU_merged, OutdoorDryBulb, Pipe_Q_c, Pipe_DeltP_c, h_comp_in);
11407 12031 : Tsuction = this->refrig->getSatTemperature(state, max(min(Pevap - Pipe_DeltP_c, RefPHigh), RefPLow), RoutineName);
11408 12031 : Psuction = Pevap - Pipe_DeltP_c; // This Psuction is used for rps > min; will be updated for rps = min
11409 :
11410 : // Perform iteration to calculate T_comp_in
11411 12031 : T_comp_in = this->refrig->getSupHeatTemp(
11412 : state, max(min(Pevap - Pipe_DeltP_c, RefPHigh), RefPLow), h_comp_in, Tsuction + 3, Tsuction + 30, RoutineName);
11413 12031 : SH_Comp = T_comp_in - Tsuction; // This is used for rps > min; will be updated for rps = min
11414 :
11415 12031 : Q_c_TU_PL = TU_CoolingLoad + Pipe_Q_c;
11416 12031 : Q_h_OU = Q_c_TU_PL + CompEvaporatingPWRSpdMin;
11417 :
11418 : // *Calculate capacity modification factor
11419 12031 : C_cap_operation = this->VRFOU_CapModFactor(
11420 : state, h_comp_in, h_IU_evap_in, max(min(Psuction, RefPHigh), RefPLow), Tsuction + SH_Comp, Tsuction + 8, CapMinTc - 5);
11421 :
11422 12031 : if (Q_c_TU_PL * C_cap_operation < CompEvaporatingCAPSpdMin) {
11423 : // Required cooling load is less than the min cooling capacity, on-off strategy
11424 :
11425 1200 : this->VRFOperationSimPath = 11;
11426 :
11427 1200 : CyclingRatio = Q_c_TU_PL * C_cap_operation / CompEvaporatingCAPSpdMin;
11428 1200 : double CyclingRatioFrac = 0.85 + 0.15 * CyclingRatio;
11429 1200 : double HPRTF = CyclingRatio / CyclingRatioFrac;
11430 1200 : Ncomp = CompEvaporatingPWRSpdMin * HPRTF; //
11431 1200 : CompSpdActual = this->CompressorSpeed(1); //
11432 1200 : this->CondensingTemp = CapMinTc; //
11433 :
11434 : } else {
11435 : // Required cooling load is greater than or equal to the min cooling capacity
11436 :
11437 : // Iteration_Ncomp: Perform iterations to calculate Ncomp (Label10)
11438 10831 : Counter = 1;
11439 10831 : Ncomp = TU_CoolingLoad / this->CoolingCOP;
11440 10831 : Ncomp_new = Ncomp;
11441 18710 : Label10:;
11442 18710 : Q_h_OU = Q_c_TU_PL + Ncomp_new; // Ncomp_new may be updated during Iteration_Ncomp Label10
11443 :
11444 : // *VRF OU TeTc calculations
11445 18710 : m_air = this->OUAirFlowRate * RhoAir;
11446 18710 : SC_OU = this->SC;
11447 18710 : this->VRFOU_TeTc(
11448 18710 : state, HXOpMode::CondMode, Q_h_OU, SC_OU, m_air, OutdoorDryBulb, OutdoorHumRat, OutdoorPressure, Tfs, this->CondensingTemp);
11449 18710 : this->CondensingTemp = min(CapMaxTc, this->CondensingTemp);
11450 18710 : this->SC = SC_OU;
11451 :
11452 : // *VEF OU Compressor Simulation at cooling mode: Specify the compressor speed and power consumption
11453 18710 : this->VRFOU_CalcCompC(state,
11454 : TU_CoolingLoad,
11455 : Tsuction,
11456 : this->CondensingTemp,
11457 : Psuction,
11458 : T_comp_in,
11459 : h_comp_in,
11460 : h_IU_evap_in,
11461 : Pipe_Q_c,
11462 : CapMaxTc,
11463 : Q_h_OU,
11464 : CompSpdActual,
11465 : Ncomp);
11466 :
11467 18710 : if ((std::abs(Ncomp - Ncomp_new) > (Tolerance * Ncomp_new)) && (Counter < 30)) {
11468 7879 : Ncomp_new = Ncomp;
11469 7879 : Counter = Counter + 1;
11470 7879 : goto Label10;
11471 : }
11472 : }
11473 :
11474 : // Update h_IU_evap_in in iterations Label12
11475 12031 : h_IU_evap_in_new = this->refrig->getSatEnthalpy(state, this->CondensingTemp - this->SC, 0.0, RoutineName);
11476 12031 : if ((std::abs(h_IU_evap_in - h_IU_evap_in_new) > Tolerance * h_IU_evap_in) && (h_IU_evap_in < h_IU_evap_in_up) &&
11477 : (h_IU_evap_in > h_IU_evap_in_low)) {
11478 2508 : h_IU_evap_in = h_IU_evap_in_new;
11479 2508 : NumIteHIUIn = NumIteHIUIn + 1;
11480 2508 : goto Label12;
11481 : }
11482 9523 : if ((std::abs(h_IU_evap_in - h_IU_evap_in_new) > Tolerance * h_IU_evap_in)) {
11483 0 : h_IU_evap_in = 0.5 * (h_IU_evap_in_low + h_IU_evap_in_up);
11484 9523 : } else if (h_IU_evap_in > h_IU_evap_in_up) {
11485 0 : h_IU_evap_in = h_IU_evap_in_up;
11486 9523 : } else if (h_IU_evap_in < h_IU_evap_in_low) {
11487 0 : h_IU_evap_in = h_IU_evap_in_low;
11488 : } else {
11489 9523 : h_IU_evap_in = (h_IU_evap_in + h_IU_evap_in_new) / 2;
11490 : }
11491 :
11492 : // Key outputs of this subroutine
11493 9523 : this->CompActSpeed = max(CompSpdActual, 0.0);
11494 9523 : this->Ncomp = max(Ncomp, 0.0) / this->EffCompInverter; // 0.95 is the efficiency of the compressor inverter, can come from IDF //@minor
11495 9523 : this->OUFanPower = this->RatedOUFanPower; //@ * pow_3( CondFlowRatio )
11496 9523 : this->VRFCondCyclingRatio = CyclingRatio; // report variable for cycling rate
11497 :
11498 9523 : Tdischarge = this->CondensingTemp; // outdoor unit condensing temperature
11499 9523 : this->CoolingCapacity =
11500 19046 : this->CoffEvapCap * this->RatedEvapCapacity *
11501 19046 : CurveValue(
11502 9523 : state, this->OUCoolingCAPFT(NumOfCompSpdInput), Tdischarge, Tsuction); // Include the piping loss, at the highest compressor speed
11503 9523 : this->PipingCorrectionCooling = TU_CoolingLoad / (TU_CoolingLoad + Pipe_Q_c);
11504 9523 : state.dataHVACVarRefFlow->MaxCoolingCapacity(VRFCond) = this->CoolingCapacity; // for report, maximum evaporating capacity of the system
11505 :
11506 9523 : this->HeatingCapacity = 0.0; // Include the piping loss
11507 9523 : this->PipingCorrectionHeating = 1.0; // 1 means no piping loss
11508 9523 : state.dataHVACVarRefFlow->MaxHeatingCapacity(VRFCond) = 0.0;
11509 :
11510 9523 : this->OUCondHeatRate = Q_h_OU;
11511 9523 : this->OUEvapHeatRate = 0;
11512 9523 : this->IUCondHeatRate = 0;
11513 9523 : this->IUEvapHeatRate = TU_CoolingLoad;
11514 :
11515 : // 2. VRF-HP Heating Mode .OR. VRF-HR Mode_6
11516 8787 : } else if ((!this->HeatRecoveryUsed && state.dataHVACVarRefFlow->HeatingLoad(VRFCond)) ||
11517 1945 : (this->HeatRecoveryUsed && !HRCoolRequestFlag && HRHeatRequestFlag)) {
11518 :
11519 6254 : this->OperatingMode = ModeHeatingOnly;
11520 6254 : this->VRFOperationSimPath = 60;
11521 :
11522 : // Initialization of VRF-FluidTCtrl Model
11523 6254 : Q_h_TU_PL = TU_HeatingLoad;
11524 6254 : Ncomp = TU_HeatingLoad / this->HeatingCOP;
11525 6254 : this->CondensingTemp = this->IUCondensingTemp;
11526 :
11527 : // Evaporative capacity ranges_Max
11528 6254 : CapMaxTe = OutdoorDryBulb - this->SH;
11529 12508 : CompEvaporatingCAPSpdMax = this->CoffEvapCap * this->RatedEvapCapacity *
11530 6254 : CurveValue(state, this->OUCoolingCAPFT(NumOfCompSpdInput), this->IUCondensingTemp, CapMaxTe);
11531 6254 : CompEvaporatingPWRSpdMax =
11532 6254 : this->RatedCompPower * CurveValue(state, this->OUCoolingPWRFT(NumOfCompSpdInput), this->IUCondensingTemp, CapMaxTe);
11533 :
11534 : // Initialization of h_comp_out iterations (Label23)
11535 6254 : Pcond = this->refrig->getSatPressure(state, 40.0, RoutineName);
11536 6254 : RefTSat = this->refrig->getSatTemperature(state, Pcond, RoutineName);
11537 6254 : h_IU_cond_in_up = this->refrig->getSupHeatEnthalpy(state, max(RefTSat, min(this->IUCondensingTemp + 50, RefTHigh)), Pcond, RoutineName);
11538 6254 : h_IU_cond_in_low = this->refrig->getSatEnthalpy(state, this->IUCondensingTemp, 1.0, RoutineName); // Quality=1
11539 6254 : h_IU_cond_in = h_IU_cond_in_low;
11540 :
11541 13348 : Label23:;
11542 13348 : m_ref_IU_cond = 0;
11543 13348 : h_IU_cond_out_ave = 0;
11544 13348 : SC_IU_merged = 0;
11545 :
11546 : // Calculate total refrigerant flow rate
11547 13348 : if (Q_h_TU_PL > CompEvaporatingCAPSpdMax + CompEvaporatingPWRSpdMax) {
11548 : // Required load is beyond the max system capacity
11549 :
11550 : h_IU_cond_out =
11551 29649 : this->refrig->getSatEnthalpy(state,
11552 9883 : this->refrig->getSatTemperature(state, max(min(Pcond, RefPHigh), RefPLow), RoutineName) - 5.0,
11553 : 0.0,
11554 : RoutineName); // Quality=0
11555 9883 : h_IU_cond_out_ave = h_IU_cond_out;
11556 9883 : SC_IU_merged = 5;
11557 9883 : m_ref_IU_cond = TU_HeatingLoad / (h_IU_cond_in - h_IU_cond_out);
11558 :
11559 : } else {
11560 20782 : for (NumTU = 1; NumTU <= NumTUInList; NumTU++) {
11561 17317 : if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) > 0) {
11562 16948 : TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU);
11563 16948 : HeatCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatCoilIndex;
11564 : h_IU_cond_out_i =
11565 50844 : this->refrig->getSatEnthalpy(state,
11566 16948 : this->refrig->getSatTemperature(state, max(min(Pcond, RefPHigh), RefPLow), RoutineName) -
11567 16948 : state.dataDXCoils->DXCoil(HeatCoilIndex).ActualSC,
11568 : 0.0,
11569 : RoutineName); // Quality=0
11570 16948 : m_ref_IU_cond_i =
11571 16948 : (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) <= 0.0)
11572 16948 : ? 0.0
11573 16948 : : (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) / (h_IU_cond_in - h_IU_cond_out_i));
11574 16948 : m_ref_IU_cond = m_ref_IU_cond + m_ref_IU_cond_i;
11575 16948 : h_IU_cond_out_ave = h_IU_cond_out_ave + m_ref_IU_cond_i * h_IU_cond_out_i;
11576 16948 : SC_IU_merged = SC_IU_merged + m_ref_IU_cond_i * state.dataDXCoils->DXCoil(HeatCoilIndex).ActualSC;
11577 : }
11578 : }
11579 3465 : if (m_ref_IU_cond > 0) {
11580 3465 : h_IU_cond_out_ave = h_IU_cond_out_ave / m_ref_IU_cond; // h_merge
11581 3465 : SC_IU_merged = SC_IU_merged / m_ref_IU_cond;
11582 : } else {
11583 : h_IU_cond_out_ave =
11584 0 : this->refrig->getSatEnthalpy(state,
11585 0 : this->refrig->getSatTemperature(state, max(min(Pcond, RefPHigh), RefPLow), RoutineName) - 5.0,
11586 : 0.0,
11587 : RoutineName); // Quality=0
11588 0 : SC_IU_merged = 5;
11589 0 : m_ref_IU_cond = TU_HeatingLoad / (h_IU_cond_in - h_IU_cond_out_ave);
11590 : }
11591 : }
11592 :
11593 : // *Calculate piping loss
11594 13348 : this->VRFOU_PipeLossH(
11595 : state, m_ref_IU_cond, max(min(Pcond, RefPHigh), RefPLow), h_IU_cond_in, OutdoorDryBulb, Pipe_Q_h, Pipe_DeltP_h, h_comp_out);
11596 :
11597 13348 : Pdischarge = max(Pcond + Pipe_DeltP_h, Pcond); // affected by piping loss
11598 13348 : Tdischarge = this->refrig->getSatTemperature(state, max(min(Pdischarge, RefPHigh), RefPLow), RoutineName);
11599 :
11600 : // Evaporative capacity ranges_Min
11601 13348 : CapMinPe = min(Pdischarge - this->CompMaxDeltaP, RefMinPe);
11602 13348 : CapMinTe = this->refrig->getSatTemperature(state, max(min(CapMinPe, RefPHigh), RefPLow), RoutineName);
11603 13348 : CompEvaporatingCAPSpdMin = this->CoffEvapCap * this->RatedEvapCapacity * CurveValue(state, this->OUCoolingCAPFT(1), Tdischarge, CapMinTe);
11604 13348 : CompEvaporatingPWRSpdMin = this->RatedCompPower * CurveValue(state, this->OUCoolingPWRFT(1), Tdischarge, CapMinTe);
11605 :
11606 13348 : Q_h_TU_PL = TU_HeatingLoad + Pipe_Q_h;
11607 13348 : Q_c_OU = max(0.0, Q_h_TU_PL - CompEvaporatingPWRSpdMin);
11608 :
11609 : // *Calculate capacity modification factor
11610 13348 : RefTSat = this->refrig->getSatTemperature(state, max(min(CapMinPe, RefPHigh), RefPLow), RoutineName);
11611 13348 : h_comp_in = this->refrig->getSupHeatEnthalpy(state, max(RefTSat, CapMinTe + this->SH), max(min(CapMinPe, RefPHigh), RefPLow), RoutineName);
11612 13348 : C_cap_operation = this->VRFOU_CapModFactor(state,
11613 : h_comp_in,
11614 : h_IU_cond_out_ave,
11615 : max(min(CapMinPe, RefPHigh), RefPLow),
11616 13348 : CapMinTe + this->SH,
11617 : CapMinTe + 8,
11618 13348 : this->IUCondensingTemp - 5);
11619 :
11620 26696 : Real64 CompEvaporatingCAPSpdMaxCurrentTsuc = this->CoffEvapCap * this->RatedEvapCapacity *
11621 13348 : CurveValue(state, this->OUCoolingCAPFT(NumOfCompSpdInput), Tdischarge, this->EvaporatingTemp);
11622 : Real64 CompEvaporatingPWRSpdMaxCurrentTsuc =
11623 13348 : this->RatedCompPower * CurveValue(state, this->OUCoolingPWRFT(NumOfCompSpdInput), Tdischarge, this->EvaporatingTemp);
11624 13348 : if (CompEvaporatingCAPSpdMin > CompEvaporatingCAPSpdMaxCurrentTsuc) {
11625 0 : if (this->CondenserCapErrIdx == 0) {
11626 0 : ShowSevereMessage(state, format("{} \"{}\":", cVRFTypes(VRF_HeatPump), this->Name));
11627 0 : ShowContinueErrorTimeStamp(state,
11628 0 : format(" Evaporative Capacity at max speed is smaller than evaporative capacity at min speed, "
11629 : "{:.3T} < {:.3T}",
11630 : CompEvaporatingCAPSpdMaxCurrentTsuc,
11631 : CompEvaporatingCAPSpdMin));
11632 : }
11633 0 : ShowRecurringSevereErrorAtEnd(
11634 : state,
11635 0 : format("\"{}\" - Evaporative Capacity at max speed is smaller than evaporative capacity at min speed ", this->Name),
11636 0 : this->CondenserCapErrIdx,
11637 0 : CompEvaporatingCAPSpdMaxCurrentTsuc - CompEvaporatingCAPSpdMin,
11638 0 : CompEvaporatingCAPSpdMaxCurrentTsuc - CompEvaporatingCAPSpdMin);
11639 : }
11640 13348 : if ((Q_c_OU * C_cap_operation) > CompEvaporatingCAPSpdMaxCurrentTsuc) {
11641 : // this branch resolves the issue of supplemental heating coil turning on when compressor speed is not at the highest
11642 2067 : Q_c_OU = CompEvaporatingCAPSpdMaxCurrentTsuc;
11643 2067 : CompSpdActual = this->CompressorSpeed(NumOfCompSpdInput);
11644 2067 : Ncomp = CompEvaporatingPWRSpdMaxCurrentTsuc;
11645 2067 : m_air = this->OUAirFlowRate * RhoAir;
11646 2067 : SH_OU = this->SH;
11647 2067 : this->VRFOU_TeTc(
11648 2067 : state, HXOpMode::EvapMode, Q_c_OU, SH_OU, m_air, OutdoorDryBulb, OutdoorHumRat, OutdoorPressure, Tfs, this->EvaporatingTemp);
11649 11281 : } else if ((Q_c_OU * C_cap_operation) <= CompEvaporatingCAPSpdMin) {
11650 : // Required heating load is smaller than the min heating capacity
11651 :
11652 2768 : if (Q_c_OU == 0) {
11653 : // Q_h_TU_PL is less than or equal to CompEvaporatingPWRSpdMin
11654 2762 : CyclingRatio = Q_h_TU_PL / CompEvaporatingPWRSpdMin;
11655 2762 : this->EvaporatingTemp = OutdoorDryBulb;
11656 : } else {
11657 : // Q_h_TU_PL is greater than CompEvaporatingPWRSpdMin
11658 6 : CyclingRatio = Q_c_OU * C_cap_operation / CompEvaporatingCAPSpdMin;
11659 6 : this->EvaporatingTemp = max(CapMinTe, RefTLow);
11660 : }
11661 :
11662 2768 : double CyclingRatioFrac = 0.85 + 0.15 * CyclingRatio;
11663 2768 : double HPRTF = CyclingRatio / CyclingRatioFrac;
11664 2768 : Ncomp = CompEvaporatingPWRSpdMin * HPRTF;
11665 2768 : CompSpdActual = this->CompressorSpeed(1);
11666 :
11667 : } else {
11668 : // CompEvaporatingCAPSpdMin < (Q_c_OU * C_cap_operation) <= CompEvaporatingCAPSpdMaxCurrentTsuc + CompEvaporatingPWRSpdMaxCurrentTsuc
11669 : // Required heating load is greater than or equal to the min heating capacity
11670 :
11671 : // Iteration_Ncomp: Perform iterations to calculate Ncomp (Label20)
11672 8513 : Counter = 1;
11673 10075 : Label20:;
11674 10075 : Ncomp_new = Ncomp;
11675 10075 : Q_c_OU = max(0.0, Q_h_TU_PL - Ncomp);
11676 :
11677 : // *VRF OU Te calculations
11678 10075 : m_air = this->OUAirFlowRate * RhoAir;
11679 10075 : SH_OU = this->SH;
11680 10075 : this->VRFOU_TeTc(
11681 10075 : state, HXOpMode::EvapMode, Q_c_OU, SH_OU, m_air, OutdoorDryBulb, OutdoorHumRat, OutdoorPressure, Tfs, this->EvaporatingTemp);
11682 10075 : this->SH = SH_OU;
11683 :
11684 : // *VRF OU Compressor Simulation at heating mode: Specify the compressor speed and power consumption
11685 10075 : this->VRFOU_CalcCompH(state,
11686 : TU_HeatingLoad,
11687 : this->EvaporatingTemp,
11688 : Tdischarge,
11689 : h_IU_cond_out_ave,
11690 : this->IUCondensingTemp,
11691 : CapMinTe,
11692 : Tfs,
11693 : Pipe_Q_h,
11694 : Q_c_OU,
11695 : CompSpdActual,
11696 : Ncomp_new);
11697 :
11698 10075 : if ((std::abs(Ncomp_new - Ncomp) > (Tolerance * Ncomp)) && (Counter < 30)) {
11699 1562 : Ncomp = Ncomp_new;
11700 1562 : Counter = Counter + 1;
11701 1562 : goto Label20;
11702 : }
11703 :
11704 : // Update h_comp_out in iteration Label23
11705 8513 : P_comp_in = this->refrig->getSatPressure(state, this->EvaporatingTemp, RoutineName);
11706 8513 : RefTSat = this->refrig->getSatTemperature(state, max(min(P_comp_in, RefPHigh), RefPLow), RoutineName);
11707 17026 : h_comp_in_new = this->refrig->getSupHeatEnthalpy(
11708 8513 : state, max(RefTSat, this->SH + this->EvaporatingTemp), max(min(P_comp_in, RefPHigh), RefPLow), RoutineName);
11709 8513 : h_comp_out_new = Ncomp_new / m_ref_IU_cond + h_comp_in_new;
11710 :
11711 8513 : if ((std::abs(h_comp_out - h_comp_out_new) > Tolerance * h_comp_out) && (h_IU_cond_in < h_IU_cond_in_up)) {
11712 7094 : h_IU_cond_in = h_IU_cond_in + 0.1 * (h_IU_cond_in_up - h_IU_cond_in_low);
11713 7094 : goto Label23;
11714 : }
11715 1419 : if (h_IU_cond_in > h_IU_cond_in_up) {
11716 0 : h_IU_cond_in = 0.5 * (h_IU_cond_in_up + h_IU_cond_in_low);
11717 : }
11718 1419 : Ncomp = Ncomp_new;
11719 : }
11720 :
11721 : // Key outputs of this subroutine
11722 6254 : this->CompActSpeed = max(CompSpdActual, 0.0);
11723 6254 : this->Ncomp = max(Ncomp, 0.0) / this->EffCompInverter;
11724 6254 : this->OUFanPower = this->RatedOUFanPower;
11725 6254 : this->VRFCondCyclingRatio = CyclingRatio;
11726 :
11727 6254 : Tsuction = this->EvaporatingTemp; // Outdoor unit evaporating temperature
11728 6254 : this->HeatingCapacity =
11729 6254 : this->CoffEvapCap * this->RatedEvapCapacity * CurveValue(state, this->OUCoolingCAPFT(NumOfCompSpdInput), Tdischarge, Tsuction) +
11730 18762 : this->RatedCompPower * CurveValue(state,
11731 6254 : this->OUCoolingPWRFT(NumOfCompSpdInput),
11732 : Tdischarge,
11733 : Tsuction); // Include the piping loss, at the highest compressor speed
11734 6254 : this->PipingCorrectionHeating = TU_HeatingLoad / (TU_HeatingLoad + Pipe_Q_h);
11735 6254 : state.dataHVACVarRefFlow->MaxHeatingCapacity(VRFCond) =
11736 6254 : this->HeatingCapacity; // for report, maximum condensing capacity the system can provide
11737 :
11738 6254 : this->CoolingCapacity = 0.0; // Include the piping loss
11739 6254 : this->PipingCorrectionCooling = 0.0;
11740 6254 : state.dataHVACVarRefFlow->MaxCoolingCapacity(VRFCond) = 0.0; // for report
11741 :
11742 6254 : this->OUCondHeatRate = 0;
11743 6254 : this->OUEvapHeatRate = Q_c_OU;
11744 6254 : this->IUCondHeatRate = TU_HeatingLoad;
11745 6254 : this->IUEvapHeatRate = 0;
11746 :
11747 : // 3. VRF-HR Mode_2-5, Simultaneous Heating and Cooling
11748 588 : } else if (this->HeatRecoveryUsed && HRCoolRequestFlag && HRHeatRequestFlag) {
11749 :
11750 0 : this->OperatingMode = ModeCoolingAndHeating;
11751 :
11752 : // Initialization of VRF-FluidTCtrl Model
11753 0 : Q_c_TU_PL = TU_CoolingLoad;
11754 0 : Q_h_TU_PL = TU_HeatingLoad;
11755 :
11756 : // Evaporator (IU side) operational parameters
11757 0 : Pevap = this->refrig->getSatPressure(state, this->IUEvaporatingTemp, RoutineName);
11758 0 : Psuction = Pevap;
11759 0 : this->EvaporatingTemp = this->IUEvaporatingTemp;
11760 :
11761 : // Condenser (OU side) operation ranges
11762 0 : CapMaxPc = min(Psuction + this->CompMaxDeltaP, RefMaxPc);
11763 0 : CapMaxTc = this->refrig->getSatTemperature(state, max(min(CapMaxPc, RefPHigh), RefPLow), RoutineName);
11764 0 : CapMinTc = OutdoorDryBulb + this->SC;
11765 0 : CapMinPc = this->refrig->getSatPressure(state, CapMinTc, RoutineName);
11766 :
11767 : // Evaporator (IU side) operation ranges
11768 0 : CapMinPe = max(CapMinPc - this->CompMaxDeltaP, RefMinPe);
11769 0 : CapMinTe = this->refrig->getSatTemperature(state, max(min(CapMinPe, RefPHigh), RefPLow), RoutineName);
11770 :
11771 : //===**h_comp_out Iteration Starts
11772 :
11773 : // Initialization of h_comp_out iterations (Label230)
11774 : {
11775 0 : Pcond = this->refrig->getSatPressure(state, this->IUCondensingTemp, RoutineName);
11776 0 : Real64 Pcond_temp = this->refrig->getSatPressure(state, 40.0, RoutineName);
11777 0 : RefTSat = this->refrig->getSatTemperature(state, Pcond_temp, RoutineName);
11778 : h_IU_cond_in_up =
11779 0 : this->refrig->getSupHeatEnthalpy(state, max(RefTSat, min(this->IUCondensingTemp + 50, RefTHigh)), Pcond_temp, RoutineName);
11780 0 : h_IU_cond_in_low = this->refrig->getSatEnthalpy(state, this->IUCondensingTemp, 1.0, RoutineName); // Quality=1
11781 0 : h_IU_cond_in = h_IU_cond_in_low;
11782 : }
11783 :
11784 0 : Label230:;
11785 :
11786 : // *PL-h: Calculate total refrigerant flow rate
11787 0 : m_ref_IU_cond = 0;
11788 0 : h_IU_cond_out_ave = 0;
11789 0 : SC_IU_merged = 0;
11790 0 : for (NumTU = 1; NumTU <= NumTUInList; NumTU++) {
11791 0 : if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) > 0) {
11792 0 : TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU);
11793 0 : HeatCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatCoilIndex;
11794 : h_IU_cond_out_i =
11795 0 : this->refrig->getSatEnthalpy(state,
11796 0 : this->refrig->getSatTemperature(state, max(min(Pcond, RefPHigh), RefPLow), RoutineName) -
11797 0 : state.dataDXCoils->DXCoil(HeatCoilIndex).ActualSC,
11798 : 0.0,
11799 : RoutineName); // Quality=0
11800 0 : m_ref_IU_cond_i =
11801 0 : (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) <= 0.0)
11802 0 : ? 0.0
11803 0 : : (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) / (h_IU_cond_in - h_IU_cond_out_i));
11804 0 : m_ref_IU_cond = m_ref_IU_cond + m_ref_IU_cond_i;
11805 0 : h_IU_cond_out_ave = h_IU_cond_out_ave + m_ref_IU_cond_i * h_IU_cond_out_i;
11806 0 : SC_IU_merged = SC_IU_merged + m_ref_IU_cond_i * state.dataDXCoils->DXCoil(HeatCoilIndex).ActualSC;
11807 : }
11808 : }
11809 0 : if (m_ref_IU_cond > 0) {
11810 0 : h_IU_cond_out_ave = h_IU_cond_out_ave / m_ref_IU_cond;
11811 0 : SC_IU_merged = SC_IU_merged / m_ref_IU_cond;
11812 : } else {
11813 : h_IU_cond_out_ave =
11814 0 : this->refrig->getSatEnthalpy(state,
11815 0 : this->refrig->getSatTemperature(state, max(min(Pcond, RefPHigh), RefPLow), RoutineName) - 5.0,
11816 : 0.0,
11817 : RoutineName); // Quality=0
11818 0 : SC_IU_merged = 5;
11819 0 : m_ref_IU_cond = TU_HeatingLoad / (h_IU_cond_in - h_IU_cond_out_ave);
11820 : }
11821 :
11822 : // *PL-h: Calculate piping loss
11823 0 : this->VRFOU_PipeLossH(
11824 : state, m_ref_IU_cond, max(min(Pcond, RefPHigh), RefPLow), h_IU_cond_in, OutdoorDryBulb, Pipe_Q_h, Pipe_DeltP_h, h_comp_out);
11825 0 : Pdischarge = max(Pcond + Pipe_DeltP_h, Pcond); // affected by piping loss
11826 0 : Tdischarge = this->refrig->getSatTemperature(state, max(min(Pdischarge, RefPHigh), RefPLow), RoutineName);
11827 0 : Q_h_TU_PL = TU_HeatingLoad + Pipe_Q_h;
11828 :
11829 : // *PL-c: Calculate total IU refrigerant flow rate and SH_IU_merged
11830 0 : h_IU_evap_in = h_IU_cond_out_ave;
11831 0 : m_ref_IU_evap = 0;
11832 0 : h_IU_evap_out = 0;
11833 0 : SH_IU_merged = 0;
11834 0 : for (NumTU = 1; NumTU <= NumTUInList; NumTU++) { // Calc total refrigerant flow rate
11835 0 : if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) > 0) {
11836 0 : TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU);
11837 0 : CoolCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex;
11838 :
11839 0 : RefTSat = this->refrig->getSatTemperature(state, max(min(Pevap, RefPHigh), RefPLow), RoutineName);
11840 : h_IU_evap_out_i =
11841 0 : this->refrig->getSupHeatEnthalpy(state,
11842 0 : max(RefTSat, this->IUEvaporatingTemp + state.dataDXCoils->DXCoil(CoolCoilIndex).ActualSH),
11843 : max(min(Pevap, RefPHigh), RefPLow),
11844 : RoutineName);
11845 :
11846 0 : if (h_IU_evap_out_i > h_IU_evap_in) {
11847 0 : m_ref_IU_evap_i = (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) <= 0.0)
11848 0 : ? 0.0
11849 0 : : (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) /
11850 0 : (h_IU_evap_out_i - h_IU_evap_in)); // Ref Flow Rate in the IU( kg/s )
11851 0 : m_ref_IU_evap = m_ref_IU_evap + m_ref_IU_evap_i;
11852 0 : h_IU_evap_out = h_IU_evap_out + m_ref_IU_evap_i * h_IU_evap_out_i;
11853 0 : SH_IU_merged = SH_IU_merged + m_ref_IU_evap_i * state.dataDXCoils->DXCoil(CoolCoilIndex).ActualSH;
11854 : }
11855 : }
11856 : }
11857 0 : if (m_ref_IU_evap > 0) {
11858 0 : h_IU_evap_out = h_IU_evap_out / m_ref_IU_evap;
11859 0 : SH_IU_merged = SH_IU_merged / m_ref_IU_evap;
11860 : } else {
11861 0 : RefTSat = this->refrig->getSatTemperature(state, max(min(Pevap, RefPHigh), RefPLow), RoutineName);
11862 : h_IU_evap_out =
11863 0 : this->refrig->getSupHeatEnthalpy(state, max(RefTSat, this->IUEvaporatingTemp + 3), max(min(Pevap, RefPHigh), RefPLow), RoutineName);
11864 0 : SH_IU_merged = 3;
11865 0 : m_ref_IU_evap = TU_CoolingLoad / (h_IU_evap_out - h_IU_evap_in);
11866 : }
11867 :
11868 : // *PL-c: Calculate piping loss
11869 0 : this->VRFOU_PipeLossC(state,
11870 : m_ref_IU_evap,
11871 : max(min(Pevap, RefPHigh), RefPLow),
11872 : h_IU_evap_out,
11873 : SH_IU_merged,
11874 : OutdoorDryBulb,
11875 : Pipe_Q_c,
11876 : Pipe_DeltP_c,
11877 : h_IU_PLc_out);
11878 0 : Psuction = min(Pevap - Pipe_DeltP_c, Pevap); // This Psuction is used for rps > min; will be updated for rps = min
11879 0 : Tsuction = this->refrig->getSatTemperature(state, max(min(Psuction, RefPHigh), RefPLow), RoutineName);
11880 0 : h_comp_in = h_IU_PLc_out;
11881 0 : Q_c_TU_PL = TU_CoolingLoad + Pipe_Q_c;
11882 :
11883 : //**OU operations: Determine VRF-HR OU system operational mode
11884 : // Determine the operational mode of the VRF-HR system, given the terminal unit side load conditions.
11885 : // A number of OU side operational parameters are also calculated here, including:
11886 : // (1) OU evaporator load Q_c_OU, (2) OU condenser load Q_h_OU,
11887 : // (3) m_ref_OU_evap, (4) m_ref_OU_cond
11888 : // Note that Te and Te' may be updated here, and thus IU evaporator side piping loss recalculations.
11889 : // Then a number of operational parameters need to be updated, including:
11890 : // (1) IU evaporating temperature Te (2) OU evaporating temperature Te' etc (3) m_ref_IU_evap
11891 : // (4) Pipe_Q_c (5) h_IU_PLc_out (6) h_comp_in
11892 : //*VRF OU Compressor Simulation at HR mode: Specify the compressor speed and power consumption
11893 : {
11894 0 : Real64 Pipe_Q_c_new = Pipe_Q_c;
11895 0 : Real64 Tsuction_new = Tsuction;
11896 0 : Real64 Te_new = this->IUEvaporatingTemp;
11897 : Real64 N_fan_OU;
11898 :
11899 0 : this->VRFHR_OU_HR_Mode(state,
11900 : h_IU_evap_in,
11901 : h_comp_out,
11902 : Q_c_TU_PL,
11903 : Q_h_TU_PL,
11904 : Tdischarge,
11905 : Tsuction_new,
11906 : Te_new,
11907 : h_comp_in,
11908 : h_IU_PLc_out,
11909 : Pipe_Q_c_new,
11910 : Q_c_OU,
11911 : Q_h_OU,
11912 : m_ref_IU_evap,
11913 : m_ref_OU_evap,
11914 : m_ref_OU_cond,
11915 : N_fan_OU,
11916 : CompSpdActual,
11917 : Ncomp);
11918 :
11919 : // parameter update
11920 0 : Tsuction = Tsuction_new;
11921 0 : Pipe_Q_c = Pipe_Q_c_new;
11922 0 : this->OUFanPower = N_fan_OU;
11923 0 : this->IUEvaporatingTemp = Te_new;
11924 : }
11925 :
11926 : //* Update h_comp_out in iteration (Label230)
11927 0 : h_comp_out_new = Ncomp / (m_ref_IU_evap + m_ref_OU_evap) + h_comp_in;
11928 :
11929 0 : if ((std::abs(h_comp_out - h_comp_out_new) > Tolerance * h_comp_out) && (h_IU_cond_in < h_IU_cond_in_up)) {
11930 0 : h_IU_cond_in = h_IU_cond_in + 0.1 * (h_IU_cond_in_up - h_IU_cond_in_low);
11931 0 : goto Label230;
11932 : }
11933 0 : if (h_IU_cond_in > h_IU_cond_in_up) {
11934 0 : h_IU_cond_in = 0.5 * (h_IU_cond_in_up + h_IU_cond_in_low);
11935 : }
11936 :
11937 : //===**h_comp_out Iteration Ends (Label230)
11938 :
11939 : // Key outputs of this subroutine
11940 0 : this->CompActSpeed = max(CompSpdActual, 0.0);
11941 0 : this->Ncomp = max(Ncomp, 0.0) / this->EffCompInverter;
11942 0 : this->VRFCondCyclingRatio = 1.0;
11943 :
11944 0 : this->HeatingCapacity =
11945 0 : this->CoffEvapCap * this->RatedEvapCapacity * CurveValue(state, this->OUCoolingCAPFT(NumOfCompSpdInput), Tdischarge, Tsuction) +
11946 0 : this->RatedCompPower * CurveValue(state, this->OUCoolingPWRFT(NumOfCompSpdInput), Tdischarge, Tsuction); // Include the piping loss
11947 0 : state.dataHVACVarRefFlow->MaxHeatingCapacity(VRFCond) =
11948 0 : this->HeatingCapacity; // for report, maximum heating capacity of the system, at the highest compressor speed
11949 0 : this->PipingCorrectionHeating = TU_HeatingLoad / Q_h_TU_PL;
11950 :
11951 0 : this->CoolingCapacity =
11952 0 : this->CoffEvapCap * this->RatedEvapCapacity * CurveValue(state, this->OUCoolingCAPFT(NumOfCompSpdInput), Tdischarge, Tsuction);
11953 0 : state.dataHVACVarRefFlow->MaxCoolingCapacity(VRFCond) =
11954 0 : this->CoolingCapacity; // for report, maximum evaporating capacity of the system, at the highest compressor speed
11955 0 : this->PipingCorrectionCooling = TU_CoolingLoad / Q_c_TU_PL;
11956 :
11957 0 : this->CondensingTemp = Tdischarge; // OU condensing temperature
11958 0 : this->EvaporatingTemp = Tsuction; // OU evaporating temperature
11959 :
11960 0 : this->OUCondHeatRate = Q_h_OU;
11961 0 : this->OUEvapHeatRate = Q_c_OU;
11962 0 : this->IUCondHeatRate = TU_HeatingLoad;
11963 0 : this->IUEvapHeatRate = TU_CoolingLoad;
11964 :
11965 : // 4. Stop running
11966 0 : } else {
11967 :
11968 588 : this->OperatingMode = 0;
11969 588 : this->VRFOperationSimPath = 0;
11970 :
11971 588 : this->Ncomp = 0.0;
11972 588 : this->CompActSpeed = 0.0;
11973 588 : this->OUFanPower = 0.0;
11974 588 : this->VRFCondCyclingRatio = 0.0;
11975 :
11976 588 : this->HeatingCapacity = 0.0; // Include the piping loss
11977 588 : this->PipingCorrectionHeating = 1.0; // 1 means no piping loss
11978 588 : state.dataHVACVarRefFlow->MaxHeatingCapacity(VRFCond) = MaxCap; // yujie: default value is MaxCap = 1e+20, not 0
11979 :
11980 588 : this->CoolingCapacity = 0.0; // Include the piping loss
11981 588 : this->PipingCorrectionCooling = 1.0;
11982 588 : state.dataHVACVarRefFlow->MaxCoolingCapacity(VRFCond) = MaxCap; // for report
11983 :
11984 588 : this->CondensingTemp = state.dataEnvrn->OutDryBulbTemp;
11985 588 : this->EvaporatingTemp = state.dataEnvrn->OutDryBulbTemp;
11986 :
11987 588 : this->OUCondHeatRate = 0.0;
11988 588 : this->OUEvapHeatRate = 0.0;
11989 588 : this->IUCondHeatRate = 0.0;
11990 588 : this->IUEvapHeatRate = 0.0;
11991 : }
11992 :
11993 : // calculate capacities and energy use
11994 25888 : if (((!this->HeatRecoveryUsed && state.dataHVACVarRefFlow->CoolingLoad(VRFCond)) || (this->HeatRecoveryUsed && HRCoolRequestFlag)) &&
11995 9523 : state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).CoolingCoilPresent(NumTUInList)) {
11996 9523 : InletAirWetBulbC = SumCoolInletWB;
11997 :
11998 : // From the VRF_FluidTCtrl model
11999 9523 : TotalCondCoolingCapacity = this->CoolingCapacity;
12000 9523 : TotalTUCoolingCapacity = TotalCondCoolingCapacity * this->PipingCorrectionCooling;
12001 :
12002 9523 : if (TotalCondCoolingCapacity > 0.0) {
12003 9523 : CoolingPLR = min(1.0, (this->TUCoolingLoad / this->PipingCorrectionCooling) / TotalCondCoolingCapacity);
12004 : } else {
12005 0 : CoolingPLR = 0.0;
12006 : }
12007 : }
12008 22619 : if (((!this->HeatRecoveryUsed && state.dataHVACVarRefFlow->HeatingLoad(VRFCond)) || (this->HeatRecoveryUsed && HRHeatRequestFlag)) &&
12009 6254 : state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).HeatingCoilPresent(NumTUInList)) {
12010 6254 : InletAirDryBulbC = SumHeatInletDB;
12011 6254 : InletAirWetBulbC = SumHeatInletWB;
12012 :
12013 : // Initializing defrost adjustment factors
12014 6254 : LoadDueToDefrost = 0.0;
12015 6254 : HeatingCapacityMultiplier = 1.0;
12016 6254 : FractionalDefrostTime = 0.0;
12017 6254 : InputPowerMultiplier = 1.0;
12018 :
12019 : // Check outdoor temperature to determine of defrost is active
12020 6254 : if (OutdoorDryBulb <= this->MaxOATDefrost && this->CondenserType != DataHeatBalance::RefrigCondenserType::Water) {
12021 :
12022 : // Calculating adjustment factors for defrost
12023 : // Calculate delta w through outdoor coil by assuming a coil temp of 0.82*DBT-9.7(F) per DOE2.1E
12024 3492 : OutdoorCoilT = 0.82 * OutdoorDryBulb - 8.589;
12025 3492 : OutdoorCoildw = max(1.0e-6, (OutdoorHumRat - PsyWFnTdpPb(state, OutdoorCoilT, OutdoorPressure)));
12026 :
12027 : // Calculate defrost adjustment factors depending on defrost control type
12028 3492 : if (this->DefrostControl == StandardRatings::HPdefrostControl::Timed) {
12029 3492 : FractionalDefrostTime = this->DefrostFraction;
12030 3492 : if (FractionalDefrostTime > 0.0) {
12031 3492 : HeatingCapacityMultiplier = 0.909 - 107.33 * OutdoorCoildw;
12032 3492 : InputPowerMultiplier = 0.90 - 36.45 * OutdoorCoildw;
12033 : }
12034 : } else { // else defrost control is on-demand
12035 0 : FractionalDefrostTime = 1.0 / (1.0 + 0.01446 / OutdoorCoildw);
12036 0 : HeatingCapacityMultiplier = 0.875 * (1.0 - FractionalDefrostTime);
12037 0 : InputPowerMultiplier = 0.954 * (1.0 - FractionalDefrostTime);
12038 : }
12039 :
12040 3492 : if (FractionalDefrostTime > 0.0) {
12041 : // Calculate defrost adjustment factors depending on defrost control strategy
12042 3492 : if (this->DefrostStrategy == StandardRatings::DefrostStrat::ReverseCycle &&
12043 3492 : this->DefrostControl == StandardRatings::HPdefrostControl::OnDemand) {
12044 0 : LoadDueToDefrost = (0.01 * FractionalDefrostTime) * (7.222 - OutdoorDryBulb) * (this->HeatingCapacity / 1.01667);
12045 0 : DefrostEIRTempModFac = CurveValue(state, this->DefrostEIRPtr, max(15.555, InletAirWetBulbC), max(15.555, OutdoorDryBulb));
12046 :
12047 : // Warn user if curve output goes negative
12048 0 : if (DefrostEIRTempModFac < 0.0) {
12049 0 : if (!state.dataGlobal->WarmupFlag) {
12050 0 : if (this->DefrostHeatErrorIndex == 0) {
12051 0 : ShowSevereMessage(state, format("{} \"{}\":", cVRFTypes(VRF_HeatPump), this->Name));
12052 0 : ShowContinueError(
12053 : state,
12054 0 : format(" Defrost Energy Input Ratio Modifier curve (function of temperature) output is negative ({:.3T}).",
12055 : DefrostEIRTempModFac));
12056 0 : ShowContinueError(state,
12057 0 : format(" Negative value occurs using an outdoor air dry-bulb temperature of {:.1T} C and an "
12058 : "average indoor air wet-bulb temperature of {:.1T} C.",
12059 : OutdoorDryBulb,
12060 : InletAirWetBulbC));
12061 0 : ShowContinueErrorTimeStamp(state, " Resetting curve output to zero and continuing simulation.");
12062 : }
12063 0 : ShowRecurringWarningErrorAtEnd(state,
12064 0 : format("{} \"{}\": Defrost Energy Input Ratio Modifier curve (function of temperature) "
12065 : "output is negative warning continues...",
12066 0 : PlantEquipTypeNames[static_cast<int>(PlantEquipmentType::HeatPumpVRF)],
12067 0 : this->Name),
12068 0 : this->DefrostHeatErrorIndex,
12069 : DefrostEIRTempModFac,
12070 : DefrostEIRTempModFac);
12071 0 : DefrostEIRTempModFac = 0.0;
12072 : }
12073 : }
12074 :
12075 0 : this->DefrostPower = DefrostEIRTempModFac * (this->HeatingCapacity / 1.01667) * FractionalDefrostTime;
12076 :
12077 : } else { // Defrost strategy is resistive
12078 3492 : this->DefrostPower = this->DefrostCapacity * FractionalDefrostTime;
12079 : }
12080 : } else { // Defrost is not active because FractionalDefrostTime = 0.0
12081 0 : this->DefrostPower = 0.0;
12082 : }
12083 : }
12084 :
12085 : // From the VRF_FluidTCtrl model
12086 6254 : TotalCondHeatingCapacity = this->HeatingCapacity;
12087 6254 : TotalTUHeatingCapacity = TotalCondHeatingCapacity * this->PipingCorrectionHeating;
12088 :
12089 6254 : if (TotalCondHeatingCapacity > 0.0) {
12090 6254 : HeatingPLR = min(1.0, (this->TUHeatingLoad / this->PipingCorrectionHeating) / TotalCondHeatingCapacity);
12091 6254 : HeatingPLR += (LoadDueToDefrost * HeatingPLR) / TotalCondHeatingCapacity;
12092 : } else {
12093 0 : HeatingPLR = 0.0;
12094 : }
12095 : }
12096 :
12097 16365 : this->VRFCondPLR = max(CoolingPLR, HeatingPLR);
12098 :
12099 : // For VRF-HR Operations
12100 16365 : HRInitialCapFrac = 1.0;
12101 16365 : HRInitialEIRFrac = 1.0;
12102 16365 : HRCapTC = 0.0;
12103 16365 : HREIRTC = 0.0;
12104 16365 : if (!state.dataGlobal->DoingSizing && !state.dataGlobal->WarmupFlag) {
12105 2278 : if (HRHeatRequestFlag && HRCoolRequestFlag) { // Simultaneous Heating and Cooling operations for HR system
12106 : // determine operating mode change: (1) ModeChange (2) HRCoolingActive (3) HRHeatingActive
12107 0 : if (!this->HRCoolingActive && !this->HRHeatingActive) {
12108 0 : this->ModeChange = true;
12109 : }
12110 0 : if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond)) {
12111 0 : if (this->HRHeatingActive && !this->HRCoolingActive) {
12112 0 : this->HRModeChange = true;
12113 : }
12114 0 : this->HRCoolingActive = true;
12115 0 : this->HRHeatingActive = false;
12116 :
12117 0 : HRInitialCapFrac = this->HRInitialCoolCapFrac; // Fractional cooling degradation at the start of heat recovery from cooling mode
12118 0 : HRCapTC = this->HRCoolCapTC; // Time constant used to recover from initial degradation in cooling heat recovery
12119 :
12120 0 : HRInitialEIRFrac = this->HRInitialCoolEIRFrac; // Fractional cooling degradation at the start of heat recovery from cooling mode
12121 0 : HREIRTC = this->HRCoolEIRTC; // Time constant used to recover from initial degradation in cooling heat recovery
12122 :
12123 0 : } else if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond)) {
12124 0 : if (!this->HRHeatingActive && this->HRCoolingActive) {
12125 0 : this->HRModeChange = true;
12126 : }
12127 0 : this->HRCoolingActive = false;
12128 0 : this->HRHeatingActive = true;
12129 :
12130 0 : HRInitialCapFrac = this->HRInitialHeatCapFrac; // Fractional heating degradation at the start of heat recovery from cooling mode
12131 0 : HRCapTC = this->HRHeatCapTC; // Time constant used to recover from initial degradation in heating heat recovery
12132 :
12133 0 : HRInitialEIRFrac = this->HRInitialHeatEIRFrac; // Fractional heating degradation at the start of heat recovery from heating mode
12134 0 : HREIRTC = this->HRHeatEIRTC; // Time constant used to recover from initial degradation in heating heat recovery
12135 :
12136 : } else {
12137 : // zone thermostats satisfied, condenser is off. Set values anyway
12138 : // HRCAPFTConst = 1.0;
12139 0 : HRInitialCapFrac = 1.0;
12140 0 : HRCapTC = 1.0;
12141 : // HREIRFTConst = 1.0;
12142 0 : HRInitialEIRFrac = 1.0;
12143 0 : HREIRTC = 1.0;
12144 0 : if (this->HRHeatingActive || this->HRCoolingActive) {
12145 0 : this->HRModeChange = true;
12146 : }
12147 0 : this->HRCoolingActive = false;
12148 0 : this->HRHeatingActive = false;
12149 : }
12150 :
12151 : } else { // IF(HRHeatRequestFlag .AND. HRCoolRequestFlag)THEN -- Heat recovery turned off
12152 2278 : HRInitialCapFrac = 1.0;
12153 2278 : HRCapTC = 0.0;
12154 2278 : HRInitialEIRFrac = 1.0;
12155 2278 : HREIRTC = 0.0;
12156 2278 : this->HRModeChange = false;
12157 2278 : this->HRCoolingActive = false;
12158 2278 : this->HRHeatingActive = false;
12159 : }
12160 :
12161 : // Calculate the capacity modification factor (SUMultiplier) for the HR mode transition period
12162 : {
12163 2278 : CurrentEndTime = double((state.dataGlobal->DayOfSim - 1) * 24) + state.dataGlobal->CurrentTime - state.dataGlobal->TimeStepZone +
12164 2278 : state.dataHVACGlobal->SysTimeElapsed;
12165 :
12166 2278 : if (this->ModeChange || this->HRModeChange) {
12167 0 : if (this->HRCoolingActive && this->HRTimer == 0.0) {
12168 0 : this->HRTimer = state.dataHVACVarRefFlow->CurrentEndTimeLast;
12169 0 : } else if (this->HRHeatingActive && this->HRTimer == 0.0) {
12170 0 : this->HRTimer = state.dataHVACVarRefFlow->CurrentEndTimeLast;
12171 0 : } else if (!this->HRCoolingActive && !this->HRHeatingActive) {
12172 0 : this->HRTimer = 0.0;
12173 : }
12174 : }
12175 :
12176 2278 : this->HRTime = max(0.0, CurrentEndTime - this->HRTimer);
12177 2278 : if (this->HRTime < (HRCapTC * 5.0)) {
12178 0 : if (HRCapTC > 0.0) {
12179 0 : SUMultiplier = min(1.0, 1.0 - std::exp(-this->HRTime / HRCapTC));
12180 : } else {
12181 0 : SUMultiplier = 1.0;
12182 : }
12183 : } else {
12184 2278 : SUMultiplier = 1.0;
12185 2278 : this->ModeChange = false;
12186 2278 : this->HRModeChange = false;
12187 : }
12188 2278 : this->SUMultiplier = SUMultiplier;
12189 :
12190 2278 : state.dataHVACVarRefFlow->CurrentEndTimeLast = CurrentEndTime;
12191 : }
12192 :
12193 : // Modify HR capacity for the transition period
12194 : {
12195 2278 : if (this->HeatRecoveryUsed && this->HRCoolingActive) {
12196 0 : TotalCondCoolingCapacity =
12197 0 : HRInitialCapFrac * TotalCondCoolingCapacity + (1.0 - HRInitialCapFrac) * TotalCondCoolingCapacity * SUMultiplier;
12198 0 : TotalTUCoolingCapacity = TotalCondCoolingCapacity * this->PipingCorrectionCooling;
12199 0 : if (TotalCondCoolingCapacity > 0.0) {
12200 0 : CoolingPLR = min(1.0, (this->TUCoolingLoad / this->PipingCorrectionCooling) / TotalCondCoolingCapacity);
12201 : } else {
12202 0 : CoolingPLR = 0.0;
12203 : }
12204 0 : this->VRFHeatRec = this->TUHeatingLoad;
12205 2278 : } else if (this->HeatRecoveryUsed && this->HRHeatingActive) {
12206 0 : TotalCondHeatingCapacity =
12207 0 : HRInitialCapFrac * TotalCondHeatingCapacity + (1.0 - HRInitialCapFrac) * TotalCondHeatingCapacity * SUMultiplier;
12208 0 : TotalTUHeatingCapacity = TotalCondHeatingCapacity * this->PipingCorrectionHeating;
12209 0 : if (TotalCondHeatingCapacity > 0.0) {
12210 0 : HeatingPLR = min(1.0, (this->TUHeatingLoad / this->PipingCorrectionHeating) / TotalCondHeatingCapacity);
12211 : } else {
12212 0 : HeatingPLR = 0.0;
12213 : }
12214 0 : this->VRFHeatRec = this->TUCoolingLoad;
12215 : }
12216 :
12217 2278 : this->VRFCondPLR = max(CoolingPLR, HeatingPLR);
12218 : }
12219 : }
12220 :
12221 16365 : this->TotalCoolingCapacity = TotalCondCoolingCapacity * CoolingPLR;
12222 16365 : this->TotalHeatingCapacity = TotalCondHeatingCapacity * HeatingPLR;
12223 :
12224 16365 : if (this->MinPLR > 0.0) {
12225 0 : bool const plrTooLow = this->VRFCondPLR < this->MinPLR;
12226 0 : bool const plrGreaterThanZero = this->VRFCondPLR > 0.0;
12227 0 : if (plrTooLow && plrGreaterThanZero) {
12228 0 : this->VRFCondPLR = this->MinPLR;
12229 : }
12230 : }
12231 :
12232 16365 : VRFRTF = 0.0;
12233 : // VRF Cooling and Heating Electric Power (output variables)
12234 16365 : if (this->OperatingMode == ModeCoolingOnly) {
12235 9523 : PartLoadFraction = 1.0;
12236 9523 : VRFRTF = min(1.0, (CyclingRatio / PartLoadFraction));
12237 :
12238 9523 : this->ElecCoolingPower = state.dataHVACVarRefFlow->VRF(VRFCond).Ncomp + this->OUFanPower;
12239 9523 : this->ElecHeatingPower = 0;
12240 :
12241 6842 : } else if (this->OperatingMode == ModeHeatingOnly) {
12242 6254 : PartLoadFraction = 1.0;
12243 6254 : VRFRTF = min(1.0, (CyclingRatio / PartLoadFraction));
12244 :
12245 6254 : this->ElecCoolingPower = 0;
12246 6254 : this->ElecHeatingPower = this->Ncomp + this->OUFanPower;
12247 :
12248 588 : } else if (this->OperatingMode == ModeCoolingAndHeating) {
12249 0 : PartLoadFraction = 1.0;
12250 0 : VRFRTF = min(1.0, (CyclingRatio / PartLoadFraction));
12251 :
12252 0 : this->ElecCoolingPower = (this->Ncomp + this->OUFanPower) * this->IUEvapHeatRate / (this->IUCondHeatRate + this->IUEvapHeatRate);
12253 0 : this->ElecHeatingPower = (this->Ncomp + this->OUFanPower) * this->IUCondHeatRate / (this->IUCondHeatRate + this->IUEvapHeatRate);
12254 :
12255 : } else {
12256 588 : this->ElecCoolingPower = 0;
12257 588 : this->ElecHeatingPower = 0;
12258 : }
12259 16365 : this->VRFCondRTF = VRFRTF;
12260 :
12261 : // Calculate CrankCaseHeaterPower: VRF Heat Pump Crankcase Heater Electric Power [W]
12262 16365 : if (this->MaxOATCCHeater > OutdoorDryBulb) {
12263 : // calculate crankcase heater power
12264 3494 : this->CrankCaseHeaterPower = this->CCHeaterPower * (1.0 - VRFRTF);
12265 3494 : if (this->NumCompressors > 1) {
12266 0 : UpperStageCompressorRatio = (1.0 - this->CompressorSizeRatio) / (this->NumCompressors - 1);
12267 0 : for (Stage = 1; Stage <= this->NumCompressors - 2; ++Stage) {
12268 0 : if (this->VRFCondPLR < (this->CompressorSizeRatio + Stage * UpperStageCompressorRatio)) {
12269 0 : this->CrankCaseHeaterPower += this->CCHeaterPower;
12270 : }
12271 : }
12272 : }
12273 : } else {
12274 12871 : this->CrankCaseHeaterPower = 0.0;
12275 : }
12276 :
12277 : // Calculate QCondenser: VRF Heat Pump Condenser Heat Transfer Rate [W]
12278 16365 : CondCapacity = max(this->TotalCoolingCapacity, this->TotalHeatingCapacity) * VRFRTF;
12279 16365 : CondPower = max(this->ElecCoolingPower, this->ElecHeatingPower);
12280 16365 : if (this->ElecHeatingPower > 0.0) {
12281 6254 : this->QCondenser = CondCapacity + CondPower - this->TUHeatingLoad / this->PipingCorrectionHeating;
12282 10111 : } else if (this->ElecCoolingPower > 0.0) {
12283 9523 : this->QCondenser = -CondCapacity + CondPower + this->TUCoolingLoad / this->PipingCorrectionCooling;
12284 : } else {
12285 588 : this->QCondenser = 0.0;
12286 : }
12287 : // if ( this->CondenserType == HVAC::EvapCooled )
12288 :
12289 : // Calculate OperatingHeatingCOP & OperatingCoolingCOP: VRF Heat Pump Operating COP []
12290 16365 : if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond) && CoolingPLR > 0.0) {
12291 9523 : if (this->ElecCoolingPower != 0.0) {
12292 : // this calc should use delivered capacity, not condenser capacity, use VRF(VRFCond).TUCoolingLoad
12293 9523 : this->OperatingCoolingCOP = (this->TotalCoolingCapacity) /
12294 9523 : (this->ElecCoolingPower + this->CrankCaseHeaterPower + this->EvapCondPumpElecPower + this->DefrostPower);
12295 : } else {
12296 0 : this->OperatingCoolingCOP = 0.0;
12297 : }
12298 : }
12299 16365 : if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond) && HeatingPLR > 0.0) {
12300 : // this calc should use delivered capacity, not condenser capacity, use VRF(VRFCond).TUHeatingLoad
12301 6254 : if (this->ElecHeatingPower != 0.0) {
12302 6254 : this->OperatingHeatingCOP = (this->TotalHeatingCapacity) /
12303 6254 : (this->ElecHeatingPower + this->CrankCaseHeaterPower + this->EvapCondPumpElecPower + this->DefrostPower);
12304 : } else {
12305 0 : this->OperatingHeatingCOP = 0.0;
12306 : }
12307 : }
12308 :
12309 16365 : TotPower = TUParasiticPower + TUFanPower + this->ElecHeatingPower + this->ElecCoolingPower + this->CrankCaseHeaterPower +
12310 16365 : this->EvapCondPumpElecPower + this->DefrostPower;
12311 16365 : if (TotPower > 0.0) {
12312 16365 : this->OperatingCOP = (this->TUCoolingLoad + this->TUHeatingLoad) / TotPower;
12313 16365 : this->SCHE = this->OperatingCOP * 3.412141633; // see StandardRatings::ConvFromSIToIP
12314 : }
12315 :
12316 : // limit the TU capacity when the condenser is maxed out on capacity
12317 : // I think this next line will make the max cap report variable match the coil objects, will probably change the answer though
12318 : // IF(CoolingLoad(VRFCond) .AND. NumTUInCoolingMode .GT. 0 .AND. MaxCoolingCapacity(VRFCond) == MaxCap)THEN
12319 16365 : if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond) && NumTUInCoolingMode > 0) {
12320 :
12321 : // IF TU capacity is greater than condenser capacity find maximum allowed TU capacity (i.e., conserve energy)
12322 9523 : if (TU_CoolingLoad > TotalTUCoolingCapacity) {
12323 1078 : LimitTUCapacity(state,
12324 : VRFCond,
12325 : NumTUInList,
12326 : TotalTUCoolingCapacity,
12327 1078 : state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad,
12328 1078 : state.dataHVACVarRefFlow->MaxCoolingCapacity(VRFCond),
12329 : TotalTUHeatingCapacity,
12330 1078 : state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad,
12331 1078 : state.dataHVACVarRefFlow->MaxHeatingCapacity(VRFCond));
12332 : }
12333 6842 : } else if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond) && NumTUInHeatingMode > 0) {
12334 : // IF TU capacity is greater than condenser capacity
12335 6254 : if (TU_HeatingLoad > TotalTUHeatingCapacity) {
12336 2025 : LimitTUCapacity(state,
12337 : VRFCond,
12338 : NumTUInList,
12339 : TotalTUHeatingCapacity,
12340 2025 : state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad,
12341 2025 : state.dataHVACVarRefFlow->MaxHeatingCapacity(VRFCond),
12342 : TotalTUCoolingCapacity,
12343 2025 : state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad,
12344 2025 : state.dataHVACVarRefFlow->MaxCoolingCapacity(VRFCond));
12345 : }
12346 : } else {
12347 : }
12348 :
12349 : // Calculate the IU Te/Tc for the next time step
12350 16365 : this->CalcVRFIUTeTc_FluidTCtrl(state);
12351 16365 : }
12352 :
12353 63201 : void VRFTerminalUnitEquipment::ControlVRF_FluidTCtrl(EnergyPlusData &state,
12354 : int const VRFTUNum, // Index to VRF terminal unit
12355 : Real64 const QZnReq, // Index to zone number
12356 : bool const FirstHVACIteration, // flag for 1st HVAC iteration in the time step
12357 : Real64 &PartLoadRatio, // unit part load ratio
12358 : Real64 &OnOffAirFlowRatio, // ratio of compressor ON airflow to AVERAGE airflow over timestep
12359 : Real64 &SuppHeatCoilLoad // supplemental heating coil load (W)
12360 : )
12361 : {
12362 :
12363 : // SUBROUTINE INFORMATION:
12364 : // AUTHOR Rongpeng Zhang
12365 : // DATE WRITTEN Nov 2015
12366 : // MODIFIED na
12367 : // RE-ENGINEERED na
12368 :
12369 : // PURPOSE OF THIS SUBROUTINE:
12370 : // Determine the coil load and part load ratio, given the zone load
12371 : // Determine the air mass flow rate corresponding to the coil load of the heat pump for this time step
12372 :
12373 : // METHODOLOGY EMPLOYED:
12374 : // Use RegulaFalsi technique to iterate on part-load ratio until convergence is achieved.
12375 :
12376 : using General::SolveRoot;
12377 : using ScheduleManager::GetCurrentScheduleValue;
12378 :
12379 63201 : int constexpr MaxIte(500); // maximum number of iterations
12380 63201 : Real64 constexpr MinPLF(0.0); // minimum part load factor allowed
12381 63201 : Real64 constexpr ErrorTol(0.001); // tolerance for RegulaFalsi iterations
12382 :
12383 : Real64 FullOutput; // unit full output when compressor is operating [W]
12384 : Real64 TempOutput; // unit output when iteration limit exceeded [W]
12385 : Real64 NoCompOutput; // output when no active compressor [W]
12386 : Real64 TempMinPLR; // min PLR used in Regula Falsi call
12387 : Real64 TempMaxPLR; // max PLR used in Regula Falsi call
12388 : int VRFCond; // index to VRF condenser
12389 : int IndexToTUInTUList; // index to TU in specific list for the VRF system
12390 : int TUListIndex; // index to TU list for this VRF system
12391 : bool VRFCoolingMode;
12392 : bool VRFHeatingMode;
12393 : bool HRCoolingMode;
12394 : bool HRHeatingMode;
12395 :
12396 63201 : PartLoadRatio = 0.0;
12397 63201 : state.dataHVACVarRefFlow->LoopDXCoolCoilRTF = 0.0;
12398 63201 : state.dataHVACVarRefFlow->LoopDXHeatCoilRTF = 0.0;
12399 63201 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatPartLoadRatio = 0.0;
12400 63201 : VRFCond = this->VRFSysNum;
12401 63201 : IndexToTUInTUList = this->IndexToTUInTUList;
12402 63201 : auto &thisVRFCond = state.dataHVACVarRefFlow->VRF(VRFCond);
12403 63201 : TUListIndex = thisVRFCond.ZoneTUListPtr;
12404 63201 : VRFCoolingMode = state.dataHVACVarRefFlow->CoolingLoad(VRFCond);
12405 63201 : VRFHeatingMode = state.dataHVACVarRefFlow->HeatingLoad(VRFCond);
12406 63201 : HRCoolingMode = state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList);
12407 63201 : HRHeatingMode = state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList);
12408 63201 : auto &thisVRFTU = state.dataHVACVarRefFlow->VRFTU(VRFTUNum);
12409 :
12410 : // The RETURNS here will jump back to SimVRF where the CalcVRF routine will simulate with latest PLR
12411 :
12412 : // do nothing else if TU is scheduled off
12413 71262 : if (GetCurrentScheduleValue(state, this->SchedPtr) == 0.0) return;
12414 :
12415 : // Block the following statement: QZnReq==0 doesn't mean QCoilReq==0 due to possible OA mixer operation. zrp_201511
12416 : // do nothing if TU has no load (TU will be modeled using PLR=0)
12417 : // if ( QZnReq == 0.0 ) return;
12418 :
12419 : // Set EMS value for PLR and return
12420 63201 : if (this->EMSOverridePartLoadFrac) {
12421 0 : PartLoadRatio = this->EMSValueForPartLoadFrac;
12422 0 : return;
12423 : }
12424 :
12425 : // Get result when DX coil is off
12426 63201 : PartLoadRatio = 0.0;
12427 63201 : bool DXCoolingCoilOprCtrl = true;
12428 :
12429 : // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control
12430 63201 : this->CalcVRF_FluidTCtrl(state, VRFTUNum, FirstHVACIteration, 0.0, NoCompOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
12431 :
12432 63201 : if (VRFCoolingMode && HRHeatingMode) {
12433 : // IF the system is in cooling mode, but the terminal unit requests heating (heat recovery)
12434 0 : if (NoCompOutput >= QZnReq) return;
12435 63201 : } else if (VRFHeatingMode && HRCoolingMode) {
12436 : // IF the system is in heating mode, but the terminal unit requests cooling (heat recovery)
12437 0 : if (NoCompOutput <= QZnReq) return;
12438 63201 : } else if (VRFCoolingMode || HRCoolingMode) {
12439 : // IF the system is in cooling mode and/or the terminal unit requests cooling
12440 37391 : if (NoCompOutput <= QZnReq && ((QZnReq <= 0.0) || (QZnReq >= HVAC::SmallLoad && !HRCoolingMode))) {
12441 595 : DXCoolingCoilOprCtrl = false;
12442 595 : if (!this->SuppHeatingCoilPresent) {
12443 0 : return;
12444 : }
12445 : }
12446 25810 : } else if (VRFHeatingMode || HRHeatingMode) {
12447 : // IF the system is in heating mode and/or the terminal unit requests heating
12448 22986 : if (NoCompOutput >= QZnReq) return;
12449 : }
12450 :
12451 : // Otherwise the coil needs to turn on. Get full load result
12452 63201 : PartLoadRatio = 1.0;
12453 63201 : if (!DXCoolingCoilOprCtrl) PartLoadRatio = 0.0;
12454 63201 : this->CalcVRF_FluidTCtrl(state, VRFTUNum, FirstHVACIteration, PartLoadRatio, FullOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
12455 63201 : if (this->CoolingCoilPresent) {
12456 63201 : auto const &thisAirInNode = state.dataLoopNodes->Node(state.dataDXCoils->DXCoil(this->CoolCoilIndex).AirInNode);
12457 63201 : this->coilInNodeT = thisAirInNode.Temp;
12458 63201 : this->coilInNodeW = thisAirInNode.HumRat;
12459 : } else {
12460 0 : auto const &thisAirInNode = state.dataLoopNodes->Node(state.dataDXCoils->DXCoil(this->HeatCoilIndex).AirInNode);
12461 0 : this->coilInNodeT = thisAirInNode.Temp;
12462 0 : this->coilInNodeW = thisAirInNode.HumRat;
12463 : }
12464 :
12465 : // set supplemental heating coil calculation if the condition requires
12466 63201 : if (this->SuppHeatingCoilPresent) {
12467 24541 : auto const &thisSuppHeatCoilAirInletNode = state.dataLoopNodes->Node(this->SuppHeatCoilAirInletNode);
12468 24541 : if (((QZnReq > HVAC::SmallLoad && QZnReq > FullOutput) || (((QZnReq - NoCompOutput) > HVAC::SmallLoad) && QZnReq <= 0.0)) ||
12469 16904 : (this->isSetPointControlled && this->suppTempSetPoint > thisSuppHeatCoilAirInletNode.Temp)) {
12470 7637 : Real64 ZoneLoad = 0.0;
12471 7637 : Real64 LoadToHeatingSP = 0.0;
12472 7637 : Real64 LoadToCoolingSP = 0.0;
12473 7637 : if (this->isSetPointControlled) {
12474 0 : Real64 mDot = thisSuppHeatCoilAirInletNode.MassFlowRate;
12475 0 : Real64 Tin = thisSuppHeatCoilAirInletNode.Temp;
12476 0 : Real64 Win = thisSuppHeatCoilAirInletNode.HumRat;
12477 0 : Real64 CpAirIn = Psychrometrics::PsyCpAirFnW(Win);
12478 0 : SuppHeatCoilLoad = mDot * CpAirIn * (this->suppTempSetPoint - Tin);
12479 0 : this->SuppHeatingCoilLoad = SuppHeatCoilLoad;
12480 0 : if (this->DesignSuppHeatingCapacity > 0.0) {
12481 0 : this->SuppHeatPartLoadRatio = min(1.0, SuppHeatCoilLoad / this->DesignSuppHeatingCapacity);
12482 : }
12483 : } else {
12484 7637 : getVRFTUZoneLoad(state, VRFTUNum, ZoneLoad, LoadToHeatingSP, LoadToCoolingSP, false);
12485 7637 : if (((FullOutput < (LoadToHeatingSP - HVAC::SmallLoad) || ((QZnReq - NoCompOutput) > HVAC::SmallLoad && QZnReq <= 0.0))) &&
12486 7635 : !FirstHVACIteration) {
12487 3813 : if ((QZnReq - NoCompOutput) > HVAC::SmallLoad && QZnReq <= 0.0) {
12488 1530 : if (LoadToHeatingSP < 0.0 && QZnReq == 0.0) {
12489 1465 : SuppHeatCoilLoad = max(0.0, LoadToHeatingSP - FullOutput);
12490 : } else {
12491 65 : SuppHeatCoilLoad = max(0.0, QZnReq - FullOutput);
12492 : }
12493 : } else {
12494 2283 : if (QZnReq > 0.0 && (NoCompOutput - QZnReq) >= HVAC::SmallLoad) {
12495 14 : SuppHeatCoilLoad = 0.0;
12496 : } else {
12497 2269 : SuppHeatCoilLoad = max(0.0, LoadToHeatingSP - FullOutput);
12498 : }
12499 : }
12500 3813 : this->SuppHeatingCoilLoad = SuppHeatCoilLoad;
12501 3813 : if (this->DesignSuppHeatingCapacity > 0.0) {
12502 3813 : this->SuppHeatPartLoadRatio = min(1.0, SuppHeatCoilLoad / this->DesignSuppHeatingCapacity);
12503 : }
12504 : } else {
12505 3824 : SuppHeatCoilLoad = 0.0;
12506 3824 : this->SuppHeatPartLoadRatio = 0.0;
12507 : }
12508 : }
12509 7637 : } else {
12510 16904 : SuppHeatCoilLoad = 0.0;
12511 16904 : this->SuppHeatPartLoadRatio = 0.0;
12512 : }
12513 : } else {
12514 38660 : SuppHeatCoilLoad = 0.0;
12515 38660 : this->SuppHeatPartLoadRatio = 0.0;
12516 : }
12517 :
12518 63201 : if ((VRFCoolingMode && !thisVRFCond.HeatRecoveryUsed) || (thisVRFCond.HeatRecoveryUsed && HRCoolingMode)) {
12519 : // Since we are cooling, we expect FullOutput < NoCompOutput
12520 : // If the QZnReq <= FullOutput the unit needs to run full out
12521 37361 : if (QZnReq <= FullOutput) {
12522 : // if no coil present in terminal unit, no need to reset PLR?
12523 309 : if (thisVRFTU.CoolingCoilPresent) {
12524 309 : PartLoadRatio = 1.0;
12525 : // the zone set point could be exceeded if set point control is used so protect against that
12526 309 : if (this->isSetPointControlled) {
12527 0 : if (state.dataLoopNodes->Node(this->coolCoilAirOutNode).Temp > this->coilTempSetPoint) return;
12528 : } else {
12529 309 : if (QZnReq >= 0.0 && FullOutput >= 0.0) PartLoadRatio = 0.0;
12530 309 : return;
12531 : }
12532 : } else {
12533 0 : PartLoadRatio = 0.0;
12534 0 : return;
12535 : }
12536 : } else {
12537 37052 : if (QZnReq == 0.0 && (FullOutput < 0.0 && NoCompOutput < FullOutput)) {
12538 0 : PartLoadRatio = 0.0;
12539 0 : return;
12540 : }
12541 : }
12542 25840 : } else if ((VRFHeatingMode && !thisVRFCond.HeatRecoveryUsed) || (thisVRFCond.HeatRecoveryUsed && HRHeatingMode)) {
12543 : // Since we are heating, we expect FullOutput > NoCompOutput
12544 : // If the QZnReq >= FullOutput the unit needs to run full out
12545 22617 : if (QZnReq >= FullOutput) {
12546 : // if no coil present in terminal unit, no need reset PLR?
12547 4529 : if (this->HeatingCoilPresent) {
12548 4529 : PartLoadRatio = 1.0;
12549 : // the zone set point could be exceeded if set point control is used so protect against that
12550 4529 : if (this->isSetPointControlled) {
12551 0 : if (state.dataLoopNodes->Node(this->heatCoilAirOutNode).Temp < this->coilTempSetPoint) return;
12552 : } else {
12553 4529 : return;
12554 : }
12555 : } else {
12556 0 : PartLoadRatio = 0.0;
12557 0 : return;
12558 : }
12559 : }
12560 : } else {
12561 : // VRF terminal unit is off
12562 : // shouldn't actually get here
12563 3223 : PartLoadRatio = 0.0;
12564 3223 : return;
12565 : }
12566 :
12567 : // The coil will not operate at PLR=0 or PLR=1, calculate the operating part-load ratio
12568 :
12569 55140 : if ((VRFHeatingMode || HRHeatingMode) || ((VRFCoolingMode && DXCoolingCoilOprCtrl) || HRCoolingMode)) {
12570 : int SolFla; // Flag of RegulaFalsi solver
12571 3492155 : auto f = [&state, VRFTUNum, FirstHVACIteration, QZnReq, OnOffAirFlowRatio](Real64 const PartLoadRatio) {
12572 343761 : Real64 QZnReqTemp = QZnReq; // denominator representing zone load (W)
12573 : Real64 ActualOutput; // delivered capacity of VRF terminal unit
12574 343761 : Real64 SuppHeatCoilLoad = 0.0; // supplemental heating coil load (W)
12575 343761 : bool setPointControlled = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isSetPointControlled;
12576 343761 : Real64 nonConstOnOffAirFlowRatio = OnOffAirFlowRatio;
12577 :
12578 343761 : if (state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).VRFAlgorithmType == AlgorithmType::FluidTCtrl) {
12579 : // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control
12580 343761 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF_FluidTCtrl(
12581 : state, VRFTUNum, FirstHVACIteration, PartLoadRatio, ActualOutput, nonConstOnOffAirFlowRatio, SuppHeatCoilLoad);
12582 : } else {
12583 : // Algorithm Type: VRF model based on system curve
12584 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF(
12585 : state, VRFTUNum, FirstHVACIteration, PartLoadRatio, ActualOutput, nonConstOnOffAirFlowRatio, SuppHeatCoilLoad);
12586 : }
12587 :
12588 343761 : if (setPointControlled) {
12589 0 : Real64 outletNodeT = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum).Temp;
12590 0 : return (outletNodeT - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).coilTempSetPoint);
12591 : } else {
12592 343761 : if (std::abs(QZnReq) < 100.0) QZnReqTemp = sign(100.0, QZnReq);
12593 343761 : return (ActualOutput - QZnReq) / QZnReqTemp;
12594 : }
12595 54545 : };
12596 54545 : SolveRoot(state, ErrorTol, MaxIte, SolFla, PartLoadRatio, f, 0.0, 1.0);
12597 54545 : if (SolFla == -1) {
12598 : // Very low loads may not converge quickly. Tighten PLR boundary and try again.
12599 2459 : TempMaxPLR = -0.1;
12600 2459 : bool ContinueIter = true;
12601 15485 : while (ContinueIter && TempMaxPLR < 1.0) {
12602 13026 : TempMaxPLR += 0.1;
12603 :
12604 13026 : this->CalcVRF_FluidTCtrl(state, VRFTUNum, FirstHVACIteration, TempMaxPLR, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
12605 :
12606 13026 : if (VRFHeatingMode && TempOutput > QZnReq) ContinueIter = false;
12607 13026 : if (VRFCoolingMode && TempOutput < QZnReq) ContinueIter = false;
12608 : }
12609 2459 : TempMinPLR = TempMaxPLR;
12610 2459 : ContinueIter = true;
12611 22953 : while (ContinueIter && TempMinPLR > 0.0) {
12612 20494 : TempMaxPLR = TempMinPLR;
12613 20494 : TempMinPLR -= 0.01;
12614 :
12615 20494 : this->CalcVRF_FluidTCtrl(state, VRFTUNum, FirstHVACIteration, TempMaxPLR, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
12616 :
12617 20494 : if (VRFHeatingMode && TempOutput < QZnReq) ContinueIter = false;
12618 20494 : if (VRFCoolingMode && TempOutput > QZnReq) ContinueIter = false;
12619 : }
12620 :
12621 2459 : SolveRoot(state, ErrorTol, MaxIte, SolFla, PartLoadRatio, f, TempMinPLR, TempMaxPLR);
12622 2459 : if (SolFla == -1) {
12623 0 : if (!FirstHVACIteration && !state.dataGlobal->WarmupFlag) {
12624 0 : if (this->IterLimitExceeded == 0) {
12625 0 : ShowWarningMessage(state, format("{} \"{}\"", tuTypeNames[(int)this->type], this->Name));
12626 0 : ShowContinueError(
12627 0 : state, format(" Iteration limit exceeded calculating terminal unit part-load ratio, maximum iterations = {}", MaxIte));
12628 0 : ShowContinueErrorTimeStamp(state, format(" Part-load ratio returned = {:.3R}", PartLoadRatio));
12629 :
12630 0 : this->CalcVRF_FluidTCtrl(state, VRFTUNum, FirstHVACIteration, TempMinPLR, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad);
12631 :
12632 0 : ShowContinueError(state, format(" Load requested = {:.5T}, Load delivered = {:.5T}", QZnReq, TempOutput));
12633 0 : ShowRecurringWarningErrorAtEnd(state,
12634 0 : format("{} \"{}\" -- Terminal unit Iteration limit exceeded error continues...",
12635 0 : tuTypeNames[(int)this->type],
12636 0 : this->Name),
12637 0 : this->IterLimitExceeded);
12638 : } else {
12639 0 : ShowRecurringWarningErrorAtEnd(state,
12640 0 : format("{} \"{}\" -- Terminal unit Iteration limit exceeded error continues...",
12641 0 : tuTypeNames[(int)this->type],
12642 0 : this->Name),
12643 0 : this->IterLimitExceeded);
12644 : }
12645 : }
12646 2459 : } else if (SolFla == -2) {
12647 2459 : PartLoadRatio = max(MinPLF, std::abs(QZnReq - NoCompOutput) / std::abs(FullOutput - NoCompOutput));
12648 : }
12649 52086 : } else if (SolFla == -2) {
12650 0 : if (FullOutput - NoCompOutput == 0.0) {
12651 0 : PartLoadRatio = 0.0;
12652 : } else {
12653 0 : PartLoadRatio = min(1.0, max(MinPLF, std::abs(QZnReq - NoCompOutput) / std::abs(FullOutput - NoCompOutput)));
12654 : }
12655 : }
12656 : }
12657 : }
12658 :
12659 683976 : void VRFTerminalUnitEquipment::CalcVRF_FluidTCtrl(EnergyPlusData &state,
12660 : int const VRFTUNum, // Index to VRF terminal unit
12661 : bool const FirstHVACIteration, // flag for 1st HVAC iteration in the time step
12662 : Real64 const PartLoadRatio, // compressor part load fraction
12663 : Real64 &LoadMet, // load met by unit (W)
12664 : Real64 &OnOffAirFlowRatio, // ratio of ON air flow to average air flow
12665 : Real64 &SuppHeatCoilLoad, // supplemental heating coil load (W)
12666 : ObjexxFCL::Optional<Real64> LatOutputProvided // delivered latent capacity (W)
12667 : )
12668 : {
12669 :
12670 : // SUBROUTINE INFORMATION:
12671 : // AUTHOR RP Zhang (LBNL), XF Pang (LBNL), Y Yura (Daikin Inc)
12672 : // DATE WRITTEN June 2015
12673 : // MODIFIED na
12674 : // RE-ENGINEERED na
12675 :
12676 : // PURPOSE OF THIS SUBROUTINE:
12677 : // This subroutine is part of the new VRF model based on physics, applicable for Fluid Temperature Control.
12678 : // This is adapted from subroutine CalcVRF, which is part of the VRF model based on system curves.
12679 : // This subroutine simulates the components making up the VRF indoor terminal unit.
12680 :
12681 : // METHODOLOGY EMPLOYED:
12682 : // A new physics based VRF model applicable for Fluid Temperature Control.
12683 : using DXCoils::SimDXCoil;
12684 : using SingleDuct::SimATMixer;
12685 : using SteamCoils::SimulateSteamCoilComponents;
12686 : using WaterCoils::SimulateWaterCoilComponents;
12687 :
12688 : int VRFTUOutletNodeNum; // TU air outlet node
12689 : int VRFTUInletNodeNum; // TU air inlet node
12690 : Real64 AirMassFlow; // total supply air mass flow [m3/s]
12691 : HVAC::FanOp fanOp; // fan operating mode, HVAC::FanOp::Cycling or HVAC::FanOp::Continuous
12692 : int VRFCond; // index to VRF condenser
12693 : Real64 SpecHumOut; // specific humidity ratio at outlet node
12694 : Real64 SpecHumIn; // specific humidity ratio at inlet node
12695 : int TUListIndex; // index to TU list for this VRF system
12696 : int IndexToTUInTUList; // index to TU in specific list for the VRF system
12697 : Real64 EvapTemp; // evaporating temperature
12698 : Real64 CondTemp; // condensing temperature
12699 : int ZoneNode; // Zone node of VRFTU is serving
12700 :
12701 683976 : VRFCond = this->VRFSysNum;
12702 683976 : TUListIndex = state.dataHVACVarRefFlow->VRF(VRFCond).ZoneTUListPtr;
12703 683976 : IndexToTUInTUList = this->IndexToTUInTUList;
12704 683976 : VRFTUOutletNodeNum = this->VRFTUOutletNodeNum;
12705 683976 : VRFTUInletNodeNum = this->VRFTUInletNodeNum;
12706 683976 : fanOp = this->fanOp;
12707 683976 : EvapTemp = state.dataHVACVarRefFlow->VRF(VRFCond).IUEvaporatingTemp;
12708 683976 : CondTemp = state.dataHVACVarRefFlow->VRF(VRFCond).IUCondensingTemp;
12709 683976 : ZoneNode = this->ZoneAirNode;
12710 :
12711 : // Set inlet air mass flow rate based on PLR and compressor on/off air flow rates
12712 683976 : if (PartLoadRatio == 0) {
12713 : // only provide required OA when coil is off
12714 241710 : state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->OACompOnMassFlow;
12715 241710 : state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->OACompOffMassFlow;
12716 : } else {
12717 : // identify the air flow rate corresponding to the coil load
12718 442266 : if (this->HeatingCoilPresent && state.dataHVACVarRefFlow->MaxHeatingCapacity(VRFCond) < MaxCap) {
12719 : // Only fix heating only mode for now
12720 220055 : state.dataHVACVarRefFlow->CompOnMassFlow = CalVRFTUAirFlowRate_FluidTCtrl(
12721 220055 : state, VRFTUNum, PartLoadRatio, FirstHVACIteration, state.dataHVACVarRefFlow->MaxHeatingCapacity(VRFCond));
12722 : } else {
12723 222211 : state.dataHVACVarRefFlow->CompOnMassFlow = CalVRFTUAirFlowRate_FluidTCtrl(state, VRFTUNum, PartLoadRatio, FirstHVACIteration, _);
12724 : }
12725 : }
12726 683976 : SetAverageAirFlow(state, VRFTUNum, PartLoadRatio, OnOffAirFlowRatio);
12727 683976 : AirMassFlow = state.dataLoopNodes->Node(VRFTUInletNodeNum).MassFlowRate;
12728 :
12729 683976 : if (this->ATMixerExists) {
12730 : // There is an air terminal mixer
12731 0 : state.dataHVACVarRefFlow->ATMixOutNode2 = this->ATMixerOutNode;
12732 0 : if (this->ATMixerType == HVAC::MixerType::InletSide) { // if there is an inlet side air terminal mixer
12733 : // set the primary air inlet mass flow rate
12734 0 : state.dataLoopNodes->Node(this->ATMixerPriNode).MassFlowRate =
12735 0 : min(state.dataLoopNodes->Node(this->ATMixerPriNode).MassFlowRateMaxAvail, state.dataLoopNodes->Node(VRFTUInletNodeNum).MassFlowRate);
12736 : // now calculate the the mixer outlet air conditions (and the secondary air inlet flow rate). The mixer outlet flow rate has already
12737 : // been set above (it is the "inlet" node flow rate)
12738 0 : SimATMixer(state, this->ATMixerName, FirstHVACIteration, this->ATMixerIndex);
12739 : }
12740 : } else {
12741 683976 : state.dataHVACVarRefFlow->ATMixOutNode2 = 0;
12742 : // simulate OA Mixer
12743 683976 : if (this->OAMixerUsed) MixedAir::SimOAMixer(state, this->OAMixerName, this->OAMixerIndex);
12744 : }
12745 : // if blow through, simulate fan then coils
12746 683976 : if (this->fanPlace == HVAC::FanPlace::BlowThru) {
12747 0 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType == HVAC::FanType::SystemModel) {
12748 0 : if (OnOffAirFlowRatio > 0.0) {
12749 0 : state.dataFans->fans(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex)->simulate(state, FirstHVACIteration, _, _);
12750 : } else {
12751 0 : state.dataFans->fans(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex)->simulate(state, FirstHVACIteration, _, _, PartLoadRatio);
12752 : }
12753 : } else {
12754 0 : state.dataFans->fans(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex)
12755 0 : ->simulate(state, FirstHVACIteration, state.dataHVACVarRefFlow->FanSpeedRatio);
12756 : }
12757 : }
12758 683976 : if (this->CoolingCoilPresent) {
12759 : // above condition for heat pump mode, below condition for heat recovery mode
12760 1083448 : if ((!state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && state.dataHVACVarRefFlow->CoolingLoad(VRFCond)) ||
12761 399472 : (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed &&
12762 234858 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList))) {
12763 854758 : SimDXCoil(state,
12764 : "",
12765 : HVAC::CompressorOp::On,
12766 : FirstHVACIteration,
12767 427379 : this->CoolCoilIndex,
12768 : fanOp,
12769 : PartLoadRatio,
12770 : _,
12771 : _,
12772 427379 : state.dataHVACVarRefFlow->MaxCoolingCapacity(VRFCond),
12773 427379 : state.dataHVACVarRefFlow->VRF(this->VRFSysNum).VRFCondCyclingRatio);
12774 : } else { // cooling coil is off
12775 256597 : SimDXCoil(state, "", HVAC::CompressorOp::Off, FirstHVACIteration, this->CoolCoilIndex, fanOp, 0.0, _);
12776 : }
12777 683976 : state.dataHVACVarRefFlow->LoopDXCoolCoilRTF = state.dataAirLoop->LoopDXCoilRTF;
12778 : } else {
12779 0 : state.dataHVACVarRefFlow->LoopDXCoolCoilRTF = 0.0;
12780 : }
12781 :
12782 683976 : if (this->HeatingCoilPresent) {
12783 : // above condition for heat pump mode, below condition for heat recovery mode
12784 1253055 : if ((!state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && state.dataHVACVarRefFlow->HeatingLoad(VRFCond)) ||
12785 569079 : (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed &&
12786 234858 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList))) {
12787 606291 : SimDXCoil(state,
12788 : "",
12789 : HVAC::CompressorOp::On,
12790 : FirstHVACIteration,
12791 202097 : this->HeatCoilIndex,
12792 : fanOp,
12793 : PartLoadRatio,
12794 : _,
12795 : _,
12796 202097 : state.dataHVACVarRefFlow->MaxHeatingCapacity(VRFCond));
12797 : } else {
12798 481879 : SimDXCoil(state, "", HVAC::CompressorOp::Off, FirstHVACIteration, this->HeatCoilIndex, fanOp, 0.0, _);
12799 : }
12800 683976 : state.dataHVACVarRefFlow->LoopDXHeatCoilRTF = state.dataAirLoop->LoopDXCoilRTF;
12801 : } else {
12802 0 : state.dataHVACVarRefFlow->LoopDXHeatCoilRTF = 0.0;
12803 : }
12804 :
12805 683976 : Real64 OnOffFanPartLoadFraction = 1.0;
12806 683976 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOp == HVAC::FanOp::Cycling) {
12807 27356 : OnOffFanPartLoadFraction = state.dataHVACGlobal->OnOffFanPartLoadFraction;
12808 : }
12809 : // if draw through, simulate coils then fan
12810 683976 : if (this->fanPlace == HVAC::FanPlace::DrawThru) {
12811 683976 : auto *fan = state.dataFans->fans(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex);
12812 683976 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType == HVAC::FanType::SystemModel) {
12813 683976 : if (OnOffAirFlowRatio > 0.0) {
12814 676618 : fan->simulate(state, FirstHVACIteration, _, _, _, fan->inletAirMassFlowRate, OnOffFanPartLoadFraction, 0, 0, _);
12815 : } else {
12816 7358 : fan->simulate(state, FirstHVACIteration, _, _, PartLoadRatio);
12817 : }
12818 : } else {
12819 0 : fan->simulate(state, FirstHVACIteration, state.dataHVACVarRefFlow->FanSpeedRatio);
12820 : }
12821 : }
12822 :
12823 : // track fan power per terminal unit for calculating COP
12824 683976 : this->FanPower = state.dataFans->fans(this->FanIndex)->totalPower;
12825 :
12826 : // run supplemental heating coil
12827 683976 : if (this->SuppHeatingCoilPresent) {
12828 227163 : Real64 SuppPLR = this->SuppHeatPartLoadRatio;
12829 227163 : this->CalcVRFSuppHeatingCoil(state, VRFTUNum, FirstHVACIteration, SuppPLR, SuppHeatCoilLoad);
12830 227163 : if ((state.dataLoopNodes->Node(this->SuppHeatCoilAirOutletNode).Temp > this->MaxSATFromSuppHeatCoil) && SuppPLR > 0.0) {
12831 : // adjust the heating load to maximum allowed
12832 0 : Real64 MaxHeatCoilLoad = this->HeatingCoilCapacityLimit(state, this->SuppHeatCoilAirInletNode, this->MaxSATFromSuppHeatCoil);
12833 0 : this->CalcVRFSuppHeatingCoil(state, VRFTUNum, FirstHVACIteration, SuppPLR, MaxHeatCoilLoad);
12834 0 : SuppHeatCoilLoad = MaxHeatCoilLoad;
12835 : }
12836 : }
12837 :
12838 683976 : Real64 LatentLoadMet = 0.0;
12839 683976 : Real64 TempOut = 0.0;
12840 683976 : Real64 TempIn = 0.0;
12841 683976 : if (this->ATMixerExists) {
12842 0 : if (this->ATMixerType == HVAC::MixerType::SupplySide) {
12843 : // Air terminal supply side mixer, calculate supply side mixer output
12844 0 : SimATMixer(state, this->ATMixerName, FirstHVACIteration, this->ATMixerIndex);
12845 0 : TempOut = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->ATMixOutNode2).Temp;
12846 0 : SpecHumOut = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->ATMixOutNode2).HumRat;
12847 0 : AirMassFlow = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->ATMixOutNode2).MassFlowRate;
12848 : } else {
12849 : // Air terminal inlet side mixer
12850 0 : TempOut = state.dataLoopNodes->Node(VRFTUOutletNodeNum).Temp;
12851 0 : SpecHumOut = state.dataLoopNodes->Node(VRFTUOutletNodeNum).HumRat;
12852 : }
12853 0 : TempIn = state.dataLoopNodes->Node(ZoneNode).Temp;
12854 0 : SpecHumIn = state.dataLoopNodes->Node(ZoneNode).HumRat;
12855 : } else {
12856 683976 : TempOut = state.dataLoopNodes->Node(VRFTUOutletNodeNum).Temp;
12857 683976 : SpecHumOut = state.dataLoopNodes->Node(VRFTUOutletNodeNum).HumRat;
12858 683976 : if (ZoneNode > 0) {
12859 683976 : TempIn = state.dataLoopNodes->Node(ZoneNode).Temp;
12860 683976 : SpecHumIn = state.dataLoopNodes->Node(ZoneNode).HumRat;
12861 : } else {
12862 0 : TempIn = state.dataLoopNodes->Node(VRFTUInletNodeNum).Temp;
12863 0 : SpecHumIn = state.dataLoopNodes->Node(VRFTUInletNodeNum).HumRat;
12864 : }
12865 : }
12866 : // calculate sensible load met using delta enthalpy
12867 683976 : LoadMet = AirMassFlow * PsyDeltaHSenFnTdb2W2Tdb1W1(TempOut, SpecHumOut, TempIn, SpecHumIn); // sensible {W}
12868 683976 : LatentLoadMet = AirMassFlow * (SpecHumOut - SpecHumIn); // latent {kgWater/s}
12869 683976 : if (present(LatOutputProvided)) {
12870 63201 : LatOutputProvided = LatentLoadMet;
12871 : }
12872 683976 : }
12873 :
12874 442266 : Real64 VRFTerminalUnitEquipment::CalVRFTUAirFlowRate_FluidTCtrl(EnergyPlusData &state,
12875 : int const VRFTUNum, // Index to VRF terminal unit
12876 : Real64 PartLoadRatio, // part load ratio of the coil
12877 : [[maybe_unused]] bool FirstHVACIteration, // FirstHVACIteration flag
12878 : ObjexxFCL::Optional<Real64 const> MaxHeatCap // maximum allowed heating capacity
12879 : )
12880 : {
12881 : // SUBROUTINE INFORMATION:
12882 : // AUTHOR Rongpeng Zhang, LBNL
12883 : // DATE WRITTEN Nov 2015
12884 : // MODIFIED na
12885 : // RE-ENGINEERED na
12886 :
12887 : // PURPOSE OF THIS FUNCTION:
12888 : // This function determines the TU airflow rate corresponding to the coil load.
12889 : // This is used to address the coupling between OA mixer simulation and VRF-FluidTCtrl coil simulation.
12890 :
12891 : // METHODOLOGY EMPLOYED:
12892 : // VRF-FluidTCtrl TU airflow rate is determined by the control logic of VRF-FluidTCtrl coil to match the
12893 : // coil load. This is affected by the coil inlet conditions. However, the airflow rate will affect the
12894 : // OA mixer simulation, which leads to different coil inlet conditions. So, there is a coupling issue here.
12895 :
12896 : using General::SolveRoot;
12897 :
12898 : Real64 AirMassFlowRate; // air mass flow rate of the coil (kg/s)
12899 :
12900 442266 : int constexpr Mode(1); // Performance mode for MultiMode DX coil. Always 1 for other coil types
12901 442266 : int constexpr MaxIte(500); // maximum number of iterations
12902 : int DXCoilNum; // index to DX Coil
12903 : int IndexToTUInTUList; // index to TU in specific list for the VRF system
12904 : int SolFla; // Flag of RegulaFalsi solver
12905 : int TUListIndex; // index to TU list for this VRF system
12906 : int VRFCond; // index to VRF condenser
12907 442266 : Real64 constexpr ErrorTol(0.01); // tolerance for RegulaFalsi iterations
12908 : Real64 FanSpdRatio; // ratio of required and rated air flow rate
12909 : Real64 FanSpdRatioMin; // min fan speed ratio
12910 : Real64 FanSpdRatioMax; // min fan speed ratio
12911 : Real64 QCoilReq; // required coil load (W)
12912 : Real64 QCoilAct; // actual coil load (W)
12913 : Real64 TeTc; // evaporating temperature or condensing temperature for VRF indoor unit(C)
12914 :
12915 442266 : VRFCond = this->VRFSysNum;
12916 442266 : TUListIndex = state.dataHVACVarRefFlow->VRF(VRFCond).ZoneTUListPtr;
12917 442266 : IndexToTUInTUList = this->IndexToTUInTUList;
12918 :
12919 674144 : if ((!state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && state.dataHVACVarRefFlow->CoolingLoad(VRFCond)) ||
12920 231878 : (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed &&
12921 156345 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList))) {
12922 : // VRF terminal unit is on cooling mode
12923 304571 : DXCoilNum = this->CoolCoilIndex;
12924 304571 : QCoilReq = -PartLoadRatio * state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode);
12925 304571 : TeTc = state.dataHVACVarRefFlow->VRF(VRFCond).IUEvaporatingTemp;
12926 :
12927 : // For HR operations, Te is lower than the outdoor air temperature because of outdoor evaporator operations
12928 : // The difference is usually 2-3C according to the engineering experience. 2 is used here for a slightly bigger fan flow rate.
12929 304571 : if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed) TeTc = min(TeTc, state.dataEnvrn->OutDryBulbTemp - 2);
12930 :
12931 202501 : } else if ((!state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && state.dataHVACVarRefFlow->HeatingLoad(VRFCond)) ||
12932 64806 : (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed &&
12933 62162 : state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList))) {
12934 : // VRF terminal unit is on heating mode
12935 134472 : DXCoilNum = this->HeatCoilIndex;
12936 134472 : Real64 RatedCapacity = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode);
12937 134472 : if (present(MaxHeatCap)) {
12938 67300 : RatedCapacity = min(MaxHeatCap, RatedCapacity);
12939 : }
12940 134472 : QCoilReq = PartLoadRatio * RatedCapacity;
12941 134472 : TeTc = state.dataHVACVarRefFlow->VRF(VRFCond).IUCondensingTemp;
12942 :
12943 : } else {
12944 : // VRF terminal unit is off
12945 3223 : QCoilAct = 0.0;
12946 3223 : AirMassFlowRate = max(state.dataHVACVarRefFlow->OACompOnMassFlow, 0.0);
12947 3223 : return AirMassFlowRate;
12948 : }
12949 :
12950 : // minimum airflow rate
12951 439043 : if (state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode) > 0.0) {
12952 439043 : FanSpdRatioMin = min(state.dataHVACVarRefFlow->OACompOnMassFlow / state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode), 1.0);
12953 : } else {
12954 : // VRF terminal unit is off
12955 0 : QCoilAct = 0.0;
12956 0 : AirMassFlowRate = max(state.dataHVACVarRefFlow->OACompOnMassFlow, 0.0);
12957 0 : return AirMassFlowRate;
12958 : }
12959 :
12960 439043 : FanSpdRatioMax = 1.0;
12961 :
12962 39443068 : auto f = [&state, VRFTUNum, DXCoilNum, QCoilReq, TeTc, PartLoadRatio](Real64 const FanSpdRatio) {
12963 : using DXCoils::ControlVRFIUCoil;
12964 : using Psychrometrics::PsyHFnTdbW;
12965 : using SingleDuct::SimATMixer;
12966 :
12967 1408681 : int constexpr Mode(1); // Performance mode for MultiMode DX coil. Always 1 for other coil types
12968 : int VRFCond; // index to VRF condenser
12969 : int VRFInletNode; // VRF inlet node number
12970 : Real64 FanSpdRatioBase; // baseline FanSpdRatio for VRFTUAirFlowResidual
12971 : Real64 FanSpdRatioAct; // calculated FanSpdRatio for VRFTUAirFlowResidual
12972 : Real64 QCoilAct; // actual coil load [W]
12973 : Real64 temp; // for temporary use
12974 : Real64 Tin; // coil inlet air temperature [C]
12975 : Real64 Win; // coil inlet air humidity ratio [kg/kg]
12976 : Real64 Hin; // coil inlet air enthalpy
12977 : Real64 Wout; // coil outlet air humidity ratio
12978 : Real64 Tout; // coil outlet air temperature
12979 : Real64 Hout; // coil outlet air enthalpy
12980 : Real64 SHact; // coil actual SH
12981 : Real64 SCact; // coil actual SC
12982 :
12983 1408681 : VRFCond = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum;
12984 1408681 : VRFInletNode = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum;
12985 :
12986 1408681 : if (std::abs(FanSpdRatio) < 0.01)
12987 0 : FanSpdRatioBase = sign(0.01, FanSpdRatio);
12988 : else
12989 1408681 : FanSpdRatioBase = FanSpdRatio;
12990 :
12991 : // Set inlet air mass flow rate based on PLR and compressor on/off air flow rates
12992 1408681 : state.dataHVACVarRefFlow->CompOnMassFlow = FanSpdRatio * state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode);
12993 1408681 : SetAverageAirFlow(state, VRFTUNum, PartLoadRatio, temp);
12994 1408681 : Tin = state.dataLoopNodes->Node(VRFInletNode).Temp;
12995 1408681 : Win = state.dataLoopNodes->Node(VRFInletNode).HumRat;
12996 :
12997 : // Simulation the OAMixer if there is any
12998 1408681 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) {
12999 1408681 : MixedAir::SimOAMixer(
13000 1408681 : state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerName, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerIndex);
13001 1408681 : int OAMixNode = state.dataMixedAir->OAMixer(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerIndex).MixNode;
13002 1408681 : Tin = state.dataLoopNodes->Node(OAMixNode).Temp;
13003 1408681 : Win = state.dataLoopNodes->Node(OAMixNode).HumRat;
13004 : }
13005 : // Simulate the blow-through fan if there is any
13006 1408681 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanPlace == HVAC::FanPlace::BlowThru) {
13007 0 : auto *fan = state.dataFans->fans(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex);
13008 0 : if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType == HVAC::FanType::SystemModel) {
13009 0 : if (temp > 0) {
13010 0 : fan->simulate(state, false, _, _);
13011 : } else {
13012 0 : fan->simulate(state, false, _, _, PartLoadRatio);
13013 : }
13014 : } else {
13015 0 : fan->simulate(state, false, state.dataHVACVarRefFlow->FanSpeedRatio);
13016 : }
13017 0 : Tin = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOutletNode).Temp;
13018 0 : Win = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOutletNode).HumRat;
13019 : }
13020 :
13021 : // Call the coil control logic to determine the air flow rate to match the given coil load
13022 1408681 : ControlVRFIUCoil(
13023 1408681 : state, DXCoilNum, QCoilReq, Tin, Win, TeTc, state.dataHVACVarRefFlow->OACompOnMassFlow, FanSpdRatioAct, Wout, Tout, Hout, SHact, SCact);
13024 :
13025 1408681 : Hin = PsyHFnTdbW(Tin, Win);
13026 1408681 : QCoilAct = FanSpdRatioAct * state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode) *
13027 1408681 : (Hout - Hin); // positive for heating, negative for cooling
13028 :
13029 1408681 : return (FanSpdRatioAct - FanSpdRatio);
13030 439043 : };
13031 :
13032 439043 : SolveRoot(state, ErrorTol, MaxIte, SolFla, FanSpdRatio, f, FanSpdRatioMin, FanSpdRatioMax);
13033 439043 : if (SolFla < 0) FanSpdRatio = FanSpdRatioMax; // over capacity
13034 :
13035 439043 : AirMassFlowRate = FanSpdRatio * state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode);
13036 :
13037 439043 : return AirMassFlowRate;
13038 : }
13039 :
13040 39834 : Real64 CompResidual_FluidTCtrl(EnergyPlusData &state,
13041 : Real64 T_dis,
13042 : Real64 CondHeat,
13043 : int CAPFT,
13044 : Real64 const T_suc // Compressor suction temperature Te' [C]
13045 : )
13046 : {
13047 : // FUNCTION INFORMATION:
13048 : // AUTHOR Xiufeng Pang (XP)
13049 : // DATE WRITTEN Mar 2013
13050 : // MODIFIED Jul 2015, RP Zhang, LBNL
13051 : // RE-ENGINEERED
13052 : //
13053 : // PURPOSE OF THIS FUNCTION:
13054 : // Calculates residual function ((VRV terminal unit cooling output - Zone sensible cooling load)
13055 : //
13056 : using Curve::CurveValue;
13057 :
13058 : Real64 CAPSpd; // Evaporative capacity of the compressor at a given spd[W]
13059 : Real64 CompResidual;
13060 :
13061 39834 : CAPSpd = CurveValue(state, CAPFT, T_dis, T_suc);
13062 39834 : CompResidual = (CondHeat - CAPSpd) / CAPSpd;
13063 :
13064 39834 : return CompResidual;
13065 : }
13066 :
13067 39183 : void VRFCondenserEquipment::VRFOU_TeTc(EnergyPlusData &state,
13068 : HXOpMode const OperationMode, // Mode 0 for running as condenser, 1 for evaporator
13069 : Real64 const Q_coil, // // OU coil heat release at cooling mode or heat extract at heating mode [W]
13070 : Real64 const SHSC, // SC for OU condenser or SH for OU evaporator [C]
13071 : Real64 const m_air, // OU coil air mass flow rate [kg/s]
13072 : Real64 const T_coil_in, // Temperature of air at OU coil inlet [C]
13073 : Real64 const W_coil_in, // Humidity ratio of air at OU coil inlet [kg/kg]
13074 : Real64 const OutdoorPressure, // Outdoor air pressure [Pa]
13075 : Real64 &T_coil_surf, // Air temperature at coil surface [C]
13076 : Real64 &TeTc // VRF Tc at cooling mode, or Te at heating mode [C]
13077 : )
13078 : {
13079 :
13080 : // SUBROUTINE INFORMATION:
13081 : // AUTHOR Rongpeng Zhang, LBNL
13082 : // DATE WRITTEN Jan 2016
13083 : // MODIFIED na
13084 : //
13085 : // RE-ENGINEERED na
13086 : //
13087 : // PURPOSE OF THIS SUBROUTINE:
13088 : // Calculate the VRF OU refrigerant side temperature, i.e., condensing temperature
13089 : // at cooling mode, or evaporating temperature at heating mode, given the coil heat
13090 : // release/extract amount and air side parameters.
13091 : //
13092 : // METHODOLOGY EMPLOYED:
13093 : // This is part of the physics based VRF model applicable for Fluid Temperature Control.
13094 : //
13095 :
13096 : Real64 BF; // VRF OU bypass [-]
13097 : Real64 deltaT; // Difference between Te/Tc and air temperature at coil surface [C]
13098 : Real64 h_coil_in; // Enthalpy of air at OU coil inlet [C]
13099 : Real64 h_coil_out; // Enthalpy of air at OU coil outlet [C]
13100 : Real64 T_coil_out; // Air temperature at coil outlet [C]
13101 : Real64 T_coil_surf_sat; // Saturated air temperature at coil surface [C]
13102 : Real64 W_coil_surf_sat; // Humidity ratio of saturated air at coil surface [kg/kg]
13103 :
13104 39183 : if (OperationMode == HXOpMode::CondMode) {
13105 : // IU Cooling: OperationMode 0
13106 :
13107 27041 : if (m_air <= 0) {
13108 0 : TeTc = this->CondensingTemp;
13109 0 : ShowSevereMessage(state, format(" Unreasonable outdoor unit airflow rate ({:.3T} ) for \"{}\":", m_air, this->Name));
13110 0 : ShowContinueError(state, " This cannot be used to calculate outdoor unit refrigerant temperature.");
13111 0 : ShowContinueError(state, format(" Default condensing temperature is used: {:.3T}", TeTc));
13112 : }
13113 :
13114 27041 : BF = this->RateBFOUCond; // 0.219;
13115 27041 : T_coil_out = T_coil_in + Q_coil / 1005.0 / m_air;
13116 27041 : T_coil_surf = T_coil_in + (T_coil_out - T_coil_in) / (1 - BF);
13117 :
13118 27041 : deltaT = this->C3Tc * pow_2(SHSC) + this->C2Tc * SHSC + this->C1Tc;
13119 :
13120 27041 : TeTc = T_coil_surf + deltaT;
13121 :
13122 12142 : } else if (OperationMode == HXOpMode::EvapMode) {
13123 : // IU Heating: OperationMode 1
13124 :
13125 12142 : if (m_air <= 0) {
13126 0 : TeTc = this->EvaporatingTemp;
13127 0 : ShowSevereMessage(state, format(" Unreasonable outdoor unit airflow rate ({:.3T} ) for \"{}\":", m_air, this->Name));
13128 0 : ShowContinueError(state, " This cannot be used to calculate outdoor unit refrigerant temperature.");
13129 0 : ShowContinueError(state, format(" Default condensing temperature is used: {:.3T}", TeTc));
13130 : }
13131 :
13132 12142 : BF = this->RateBFOUEvap; // 0.45581;
13133 12142 : h_coil_in = PsyHFnTdbW(T_coil_in, W_coil_in);
13134 12142 : h_coil_out = h_coil_in - Q_coil / m_air / (1 - BF);
13135 12142 : h_coil_out = max(0.01, h_coil_out);
13136 :
13137 12142 : T_coil_surf_sat = PsyTsatFnHPb(state, h_coil_out, OutdoorPressure, "VRFOU_TeTc");
13138 12142 : W_coil_surf_sat = PsyWFnTdbH(state, T_coil_surf_sat, h_coil_out, "VRFOU_TeTc");
13139 :
13140 12142 : if (W_coil_surf_sat < W_coil_in)
13141 : // There is dehumidification
13142 0 : T_coil_surf = T_coil_surf_sat;
13143 : else
13144 : // No dehumidification
13145 12142 : T_coil_surf = PsyTdbFnHW(h_coil_out, W_coil_in);
13146 :
13147 12142 : deltaT = this->C3Te * pow_2(SHSC) + this->C2Te * SHSC + this->C1Te;
13148 :
13149 12142 : TeTc = T_coil_surf - deltaT;
13150 : }
13151 39183 : }
13152 :
13153 0 : Real64 VRFCondenserEquipment::VRFOU_Cap(EnergyPlusData &state,
13154 : HXOpMode const OperationMode, // Mode 0 for running as condenser, 1 for evaporator
13155 : Real64 const TeTc, // VRF Tc at cooling mode, or Te at heating mode [C]
13156 : Real64 const SHSC, // SC for OU condenser or SH for OU evaporator [C]
13157 : Real64 const m_air, // OU coil air mass flow rate [kg/s]
13158 : Real64 const T_coil_in, // Temperature of air at OU coil inlet [C]
13159 : Real64 const W_coil_in // Humidity ratio of air at OU coil inlet [kg/kg]
13160 : )
13161 : {
13162 :
13163 : // SUBROUTINE INFORMATION:
13164 : // AUTHOR Rongpeng Zhang, LBNL
13165 : // DATE WRITTEN Jan 2016
13166 : // MODIFIED na
13167 : //
13168 : // RE-ENGINEERED na
13169 : //
13170 : // PURPOSE OF THIS SUBROUTINE:
13171 : // Calculate the VRF OU load, given refrigerant side temperature, i.e., condensing temperature
13172 : // and SC for condenser, or evaporating temperature and SH for evaporator.
13173 : //
13174 : // METHODOLOGY EMPLOYED:
13175 : // This is part of the physics based VRF model applicable for Fluid Temperature Control.
13176 :
13177 : Real64 BF; // VRF OU bypass [-]
13178 : Real64 deltaT; // Difference between Te/Tc and air temperature at coil surface [C]
13179 : Real64 h_coil_in; // Enthalpy of air at OU coil inlet [C]
13180 : Real64 h_coil_out; // Enthalpy of air at OU coil outlet [C]
13181 : Real64 Q_coil; // OU coil heat release at cooling mode or heat extract at heating mode [W]
13182 : Real64 T_coil_out; // Air temperature at coil outlet [C]
13183 : Real64 T_coil_surf; // Air temperature at coil surface [C]
13184 : Real64 W_coil_surf_sat; // Humidity ratio of saturated air at coil surface [kg/kg]
13185 :
13186 0 : Q_coil = 0.0;
13187 :
13188 0 : if (OperationMode == HXOpMode::CondMode) {
13189 : // IU Cooling: OperationMode 0
13190 0 : if (m_air <= 0) {
13191 0 : ShowSevereMessage(state, format(" Unreasonable outdoor unit airflow rate ({:.3T} ) for \"{}\":", m_air, this->Name));
13192 0 : ShowContinueError(state, " This cannot be used to calculate outdoor unit capacity.");
13193 : }
13194 :
13195 0 : BF = this->RateBFOUCond; // 0.219;
13196 0 : deltaT = this->C3Tc * pow_2(SHSC) + this->C2Tc * SHSC + this->C1Tc;
13197 0 : T_coil_surf = TeTc - deltaT;
13198 0 : T_coil_out = T_coil_in + (T_coil_surf - T_coil_in) * (1 - BF);
13199 0 : Q_coil = (T_coil_out - T_coil_in) * 1005.0 * m_air;
13200 :
13201 0 : } else if (OperationMode == HXOpMode::EvapMode) {
13202 : // IU Heating: OperationMode 1
13203 0 : if (m_air <= 0) {
13204 0 : ShowSevereMessage(state, format(" Unreasonable outdoor unit airflow rate ({:.3T} ) for \"{}\":", m_air, this->Name));
13205 0 : ShowContinueError(state, " This cannot be used to calculate outdoor unit capacity.");
13206 : }
13207 :
13208 0 : BF = this->RateBFOUEvap; // 0.45581;
13209 0 : deltaT = this->C3Te * pow_2(SHSC) + this->C2Te * SHSC + this->C1Te;
13210 0 : T_coil_surf = TeTc + deltaT;
13211 :
13212 : // saturated humidity ratio corresponding to T_coil_surf
13213 0 : W_coil_surf_sat = PsyWFnTdpPb(state, T_coil_surf, state.dataEnvrn->OutBaroPress);
13214 :
13215 0 : if (W_coil_surf_sat < W_coil_in) {
13216 : // There is dehumidification, W_coil_out = W_coil_surf_sat
13217 0 : h_coil_out = PsyHFnTdbW(T_coil_surf, W_coil_surf_sat);
13218 : } else {
13219 : // No dehumidification, W_coil_out = W_coil_in
13220 0 : h_coil_out = PsyHFnTdbW(T_coil_surf, W_coil_in);
13221 : }
13222 0 : h_coil_out = max(0.01, h_coil_out);
13223 0 : h_coil_in = PsyHFnTdbW(T_coil_in, W_coil_in);
13224 0 : Q_coil = (h_coil_in - h_coil_out) * m_air * (1 - BF); // bypass airflow should not be included here
13225 :
13226 : } else {
13227 : // Should not come here
13228 0 : ShowSevereMessage(state, format(" Unreasonable outdoor unit operational mode for \"{}\":", this->Name));
13229 0 : ShowContinueError(state, " The operational mode is not correctly set in the function VRFOU_Cap.");
13230 : }
13231 :
13232 0 : return Q_coil;
13233 : }
13234 :
13235 0 : Real64 VRFCondenserEquipment::VRFOU_FlowRate(EnergyPlusData &state,
13236 : HXOpMode const OperationMode, // Mode 0 for running as condenser, 1 for evaporator
13237 : Real64 const TeTc, // VRF Tc at cooling mode, or Te at heating mode [C]
13238 : Real64 const SHSC, // SC for OU condenser or SH for OU evaporator [C]
13239 : Real64 const Q_coil, // absolute value of OU coil heat release or heat extract [W]
13240 : Real64 const T_coil_in, // Temperature of air at OU coil inlet [C]
13241 : Real64 const W_coil_in // Humidity ratio of air at OU coil inlet [kg/kg]
13242 : ) const
13243 : {
13244 :
13245 : // SUBROUTINE INFORMATION:
13246 : // AUTHOR Rongpeng Zhang, LBNL
13247 : // DATE WRITTEN Mar 2016
13248 : // MODIFIED na
13249 : //
13250 : // RE-ENGINEERED na
13251 : //
13252 : // PURPOSE OF THIS SUBROUTINE:
13253 : // Calculate the outdoor unit fan flow rate, given VRF OU load and refrigerant side temperature, i.e.,
13254 : // condensing temperature and SC for condenser, or evaporating temperature and SH for evaporator.
13255 : //
13256 : // METHODOLOGY EMPLOYED:
13257 : // This is part of the physics based VRF model applicable for Fluid Temperature Control.
13258 :
13259 : Real64 BF; // VRF OU bypass [-]
13260 : Real64 deltaT; // Difference between Te/Tc and air temperature at coil surface [C]
13261 : Real64 h_coil_in; // Enthalpy of air at OU coil inlet [C]
13262 : Real64 h_coil_out; // Enthalpy of air at OU coil outlet [C]
13263 : Real64 m_air; // OU coil air mass flow rate [kg/s]
13264 : Real64 T_coil_out; // Air temperature at coil outlet [C]
13265 : Real64 T_coil_surf; // Air temperature at coil surface [C]
13266 : Real64 W_coil_surf_sat; // Humidity ratio of saturated air at coil surface [kg/kg]
13267 :
13268 0 : m_air = 0.0;
13269 :
13270 0 : if (OperationMode == HXOpMode::CondMode) {
13271 : // IU Cooling: OperationMode 0
13272 :
13273 0 : BF = this->RateBFOUCond; // 0.219;
13274 0 : deltaT = this->C3Tc * pow_2(SHSC) + this->C2Tc * SHSC + this->C1Tc;
13275 0 : T_coil_surf = TeTc - deltaT;
13276 0 : T_coil_out = T_coil_in + (T_coil_surf - T_coil_in) * (1 - BF);
13277 0 : m_air = Q_coil / (T_coil_out - T_coil_in) / 1005.0;
13278 :
13279 0 : } else if (OperationMode == HXOpMode::EvapMode) {
13280 : // IU Heating: OperationMode 1
13281 :
13282 0 : BF = this->RateBFOUEvap; // 0.45581;
13283 0 : deltaT = this->C3Te * pow_2(SHSC) + this->C2Te * SHSC + this->C1Te;
13284 0 : T_coil_surf = TeTc + deltaT;
13285 :
13286 : // saturated humidity ratio corresponding to T_coil_surf
13287 0 : W_coil_surf_sat = PsyWFnTdpPb(state, T_coil_surf, state.dataEnvrn->OutBaroPress);
13288 :
13289 0 : if (W_coil_surf_sat < W_coil_in) {
13290 : // There is dehumidification, W_coil_out = W_coil_surf_sat
13291 0 : h_coil_out = PsyHFnTdbW(T_coil_surf, W_coil_surf_sat);
13292 : } else {
13293 : // No dehumidification, W_coil_out = W_coil_in
13294 0 : h_coil_out = PsyHFnTdbW(T_coil_surf, W_coil_in);
13295 : }
13296 0 : h_coil_out = max(0.01, h_coil_out);
13297 0 : h_coil_in = PsyHFnTdbW(T_coil_in, W_coil_in);
13298 0 : m_air = Q_coil / (h_coil_in - h_coil_out) / (1 - BF);
13299 :
13300 : } else {
13301 : // Should not come here
13302 0 : ShowSevereMessage(state, format(" Unreasonable outdoor unit operational mode for \"{}\":", this->Name));
13303 0 : ShowContinueError(state, " The operational mode is not correctly set in the function VRFOU_Cap.");
13304 : }
13305 :
13306 0 : return m_air;
13307 : }
13308 :
13309 0 : Real64 VRFCondenserEquipment::VRFOU_SCSH(EnergyPlusData &state,
13310 : HXOpMode const OperationMode, // Mode 0 for running as condenser, 1 for evaporator
13311 : Real64 const Q_coil, // // OU coil heat release at cooling mode or heat extract at heating mode [W]
13312 : Real64 const TeTc, // VRF Tc at cooling mode, or Te at heating mode [C]
13313 : Real64 const m_air, // OU coil air mass flow rate [kg/s]
13314 : Real64 const T_coil_in, // Temperature of air at OU coil inlet [C]
13315 : Real64 const W_coil_in, // Humidity ratio of air at OU coil inlet [kg/kg]
13316 : Real64 const OutdoorPressure // Outdoor air pressure [Pa]
13317 : ) const
13318 : {
13319 :
13320 : // SUBROUTINE INFORMATION:
13321 : // AUTHOR Rongpeng Zhang, LBNL
13322 : // DATE WRITTEN Jan 2016
13323 : // MODIFIED na
13324 : //
13325 : // RE-ENGINEERED na
13326 : //
13327 : // PURPOSE OF THIS SUBROUTINE:
13328 : // Calculate the SC for OU condenser, or SH for OU evaporator, given
13329 : // VRF OU load and refrigerant side temperature, i.e., condensing temperature
13330 : // for condenser, or evaporating temperature for evaporator.
13331 : //
13332 : // METHODOLOGY EMPLOYED:
13333 : // This is part of the physics based VRF model applicable for Fluid Temperature Control.
13334 :
13335 : Real64 BF; // VRF OU bypass [-]
13336 : Real64 deltaT; // Difference between Te/Tc and air temperature at coil surface [C]
13337 : Real64 h_coil_in; // Enthalpy of air at OU coil inlet [C]
13338 : Real64 h_coil_out; // Enthalpy of air at OU coil outlet [C]
13339 : Real64 SHSC; // SC for OU condenser, or SH for OU evaporator
13340 : Real64 T_coil_out; // Air temperature at coil outlet [C]
13341 : Real64 T_coil_surf; // Air temperature at coil surface [C]
13342 : Real64 T_coil_surf_sat; // Saturated air temperature at coil surface [C]
13343 : Real64 W_coil_surf_sat; // Humidity ratio of saturated air at coil surface [kg/kg]
13344 :
13345 0 : SHSC = 0.0;
13346 :
13347 0 : if (OperationMode == HXOpMode::CondMode) {
13348 : // Cooling: OperationMode 0
13349 0 : if (m_air <= 0) {
13350 0 : ShowSevereMessage(state, format(" Unreasonable outdoor unit airflow rate ({:.3T} ) for \"{}\":", m_air, this->Name));
13351 0 : ShowContinueError(state, " This cannot be used to calculate outdoor unit subcooling.");
13352 : }
13353 :
13354 0 : BF = this->RateBFOUCond; // 0.219;
13355 0 : T_coil_out = T_coil_in + Q_coil / 1005.0 / m_air;
13356 0 : T_coil_surf = T_coil_in + (T_coil_out - T_coil_in) / (1 - BF);
13357 0 : deltaT = TeTc - T_coil_surf;
13358 :
13359 : // SC_OU
13360 0 : if (this->C3Tc == 0)
13361 0 : SHSC = -(this->C1Tc - deltaT) / this->C2Tc;
13362 : else
13363 0 : SHSC = (-this->C2Tc + std::pow((pow_2(this->C2Tc) - 4 * (this->C1Tc - deltaT) * this->C3Tc), 0.5)) / (2 * this->C3Tc);
13364 :
13365 0 : } else if (OperationMode == HXOpMode::EvapMode) {
13366 : // Heating: OperationMode 1
13367 0 : if (m_air <= 0) {
13368 0 : ShowSevereMessage(state, format(" Unreasonable outdoor unit airflow rate ({:.3T} ) for \"{}\":", m_air, this->Name));
13369 0 : ShowContinueError(state, " This cannot be used to calculate outdoor unit super heating.");
13370 : }
13371 :
13372 0 : BF = this->RateBFOUEvap; // 0.45581;
13373 0 : h_coil_in = PsyHFnTdbW(T_coil_in, W_coil_in);
13374 0 : h_coil_out = h_coil_in - Q_coil / m_air / (1 - BF);
13375 0 : h_coil_out = max(0.01, h_coil_out);
13376 :
13377 0 : T_coil_surf_sat = PsyTsatFnHPb(state, h_coil_out, OutdoorPressure, "VRFOU_TeTc");
13378 0 : W_coil_surf_sat = PsyWFnTdbH(state, T_coil_surf_sat, h_coil_out, "VRFOU_TeTc");
13379 :
13380 0 : if (W_coil_surf_sat < W_coil_in)
13381 : // There is dehumidification
13382 0 : T_coil_surf = T_coil_surf_sat;
13383 : else
13384 : // No dehumidification
13385 0 : T_coil_surf = PsyTdbFnHW(h_coil_out, W_coil_in);
13386 :
13387 0 : deltaT = T_coil_surf - TeTc;
13388 :
13389 : // SH_OU
13390 0 : if (this->C3Te == 0)
13391 0 : SHSC = -(this->C1Te - deltaT) / this->C2Te;
13392 : else
13393 0 : SHSC = (-this->C2Te + std::pow((pow_2(this->C2Te) - 4 * (this->C1Te - deltaT) * this->C3Te), 0.5)) / (2 * this->C3Te);
13394 :
13395 : } else {
13396 : // Should not come here
13397 0 : ShowSevereMessage(state, format(" Unreasonable outdoor unit operational mode for \"{}\":", this->Name));
13398 0 : ShowContinueError(state, " The operational mode is not correctly set in the function VRFOU_Cap.");
13399 : }
13400 :
13401 0 : return SHSC;
13402 : }
13403 :
13404 62655 : Real64 VRFCondenserEquipment::VRFOU_CapModFactor(
13405 : EnergyPlusData &state,
13406 : Real64 const h_comp_in_real, // Enthalpy of refrigerant at the compressor inlet at real conditions [kJ/kg]
13407 : Real64 const h_evap_in_real, // Enthalpy of refrigerant at the evaporator inlet at real conditions [kJ/kg]
13408 : Real64 const P_evap_real, // Evaporative pressure at real conditions [Pa]
13409 : Real64 const T_comp_in_real, // Temperature of the refrigerant at the compressor inlet at real conditions [C]
13410 : Real64 const T_comp_in_rate, // Temperature of the refrigerant at the compressor inlet at rated conditions [C]
13411 : Real64 const T_cond_out_rate // Temperature of the refrigerant at the condenser outlet at rated conditions [C]
13412 : )
13413 : {
13414 :
13415 : // SUBROUTINE INFORMATION:
13416 : // AUTHOR Rongpeng Zhang
13417 : // DATE WRITTEN Nov 2015
13418 : // MODIFIED na
13419 : // RE-ENGINEERED na
13420 :
13421 : // PURPOSE OF THIS SUBROUTINE:
13422 : // Calculate capacity modification factor for the compressors at Outdoor Unit.
13423 : // This factor is used to modify the system evaporative capacity, by describing
13424 : // the difference between rated conditions and real conditions.
13425 :
13426 : // METHODOLOGY EMPLOYED:
13427 : // This is part of the VRF-FluidTCtrl Model.
13428 :
13429 : Real64 C_cap_density; // Compressor capacity modification algorithm_modified flow rate [-]
13430 : Real64 C_cap_enthalpy; // Compressor capacity modification algorithm_modified enthalpy difference [-]
13431 : Real64 C_cap_operation; // Compressor capacity modification algorithm_modified Cap [-]
13432 : Real64 RefTSat; // Saturated temperature of the refrigerant. Used to check whether the refrigerant is in the superheat area [C].
13433 : Real64 h_evap_out_rate; // enthalpy of refrigerant at the evaporator outlet at rated conditions [kJ/kg]
13434 : Real64 h_evap_in_rate; // enthalpy of refrigerant at the evaporator inlet at rated conditions [kJ/kg]
13435 : Real64 density_rate; // density of refrigerant at rated conditions [kg/m3]
13436 : Real64 density_real; // density of refrigerant at rated conditions [kg/m3]
13437 :
13438 : static constexpr std::string_view RoutineName("VRFOU_CapModFactor");
13439 :
13440 : // Saturated temperature at real evaporating pressure
13441 62655 : RefTSat = this->refrig->getSatTemperature(state, P_evap_real, RoutineName);
13442 :
13443 : // Enthalpy at rated conditions
13444 62655 : h_evap_out_rate = this->refrig->getSupHeatEnthalpy(state, max(RefTSat, T_comp_in_rate), P_evap_real, RoutineName);
13445 62655 : h_evap_in_rate = this->refrig->getSatEnthalpy(state, T_cond_out_rate, 0.0, RoutineName);
13446 :
13447 : // Density calculations
13448 62655 : density_rate = this->refrig->getSupHeatDensity(state, T_comp_in_rate, P_evap_real, RoutineName);
13449 62655 : density_real = this->refrig->getSupHeatDensity(state, T_comp_in_real, P_evap_real, RoutineName);
13450 :
13451 : // Modification factor calculations
13452 62655 : if (density_real > 0)
13453 62655 : C_cap_density = density_rate / density_real;
13454 : else
13455 0 : C_cap_density = 1.0;
13456 :
13457 62655 : if ((h_comp_in_real - h_evap_in_real) > 0)
13458 62655 : C_cap_enthalpy = std::abs(h_evap_out_rate - h_evap_in_rate) / std::abs(h_comp_in_real - h_evap_in_real);
13459 : else
13460 0 : C_cap_enthalpy = 1.0;
13461 :
13462 62655 : C_cap_operation = C_cap_density * C_cap_enthalpy;
13463 :
13464 62655 : return C_cap_operation;
13465 : }
13466 :
13467 0 : void VRFCondenserEquipment::VRFOU_TeModification(
13468 : EnergyPlusData &state,
13469 : Real64 const Te_up, // Upper bound of Te during iteration, i.e., Te before reduction [C]
13470 : Real64 const Te_low, // Lower bound of Te during iteration, i.e., the given suction temperature Te' [C]
13471 : Real64 const Pipe_h_IU_in, // Piping Loss Algorithm Parameter: enthalpy of IU at inlet [kJ/kg]
13472 : Real64 const OutdoorDryBulb, // outdoor dry-bulb temperature [C]
13473 : Real64 &Te_update, // Updated Te that can generate the required Tsuction [C]
13474 : Real64 &Pe_update, // Piping Loss Algorithm Parameter: evaporating pressure assumed for iterations [Pa]
13475 : Real64 &Pipe_m_ref, // Piping Loss Algorithm Parameter: Refrigerant mass flow rate [kg/s]
13476 : Real64 &Pipe_h_IU_out, // Piping Loss Algorithm Parameter: enthalpy of IU at outlet [kJ/kg]
13477 : Real64 &Pipe_SH_merged // Piping Loss Algorithm Parameter: Average SH after the indoor units [C]
13478 : )
13479 : {
13480 :
13481 : // SUBROUTINE INFORMATION:
13482 : // AUTHOR Rongpeng Zhang
13483 : // DATE WRITTEN Jan 2016
13484 : // MODIFIED na
13485 : // RE-ENGINEERED na
13486 :
13487 : // PURPOSE OF THIS SUBROUTINE:
13488 : // This is part of the low load modification algorithm for the VRF-FluidTCtrl model. It aims
13489 : // to find a new Te (Te_update) that can generate a new compressor suction temperature (Tsuction) equaling
13490 : // to the given compressor suction temperature (Te_low). This requires the re-calculate of piping loss.
13491 :
13492 : // METHODOLOGY EMPLOYED:
13493 : // This is part of the VRF-FluidTCtrl Model.
13494 :
13495 : int CoolCoilIndex; // index to cooling coil in terminal unit
13496 : int NumTUInList; // number of terminal units is list
13497 : int NumTeIte; // counter for Te calculation iterations [-]
13498 : int TUListNum; // index to TU List
13499 : int TUIndex; // Index to terminal unit
13500 : Real64 MaxNumTeIte; // Piping Loss Algorithm Parameter: max number of iterations for Te [-]
13501 : Real64 Pipe_h_comp_in; // Piping Loss Algorithm Parameter: Enthalpy after piping loss (compressor inlet) [kJ/kg]
13502 : Real64 Pipe_DeltP; // Piping Loss Algorithm Parameter: Pipe pressure drop [Pa]
13503 : Real64 Pipe_Q; // Piping Loss Algorithm Parameter: Heat loss [W]
13504 : Real64 Pipe_m_ref_i; // Piping Loss Algorithm Parameter: Refrigerant mass flow rate for a individual IU[kg/s]
13505 : Real64 Pipe_h_IU_out_i; // Piping Loss Algorithm Parameter: enthalpy of IU at outlet (individual) [kJ/kg]
13506 : Real64 RefTSat; // Saturated temperature of the refrigerant [C]
13507 : Real64 RefPLow; // Low Pressure Value for Ps (>0.0) [Pa]
13508 : Real64 RefPHigh; // High Pressure Value for Ps (max in tables) [Pa]
13509 : Real64 SH_IU_update; // Modified SH for VRF IU [C]
13510 : Real64 Te_ItePreci; // Precision of iterations for Te [C]he superheat area [C]
13511 : Real64 Tfs; // Temperature of the air at the coil surface [C]]
13512 : Real64 Tsuction; // VRF compressor suction refrigerant temperature [Pa]
13513 :
13514 : static constexpr std::string_view RoutineName("VRFOU_TeModification");
13515 :
13516 : // variable initializations
13517 0 : TUListNum = this->ZoneTUListPtr;
13518 0 : RefPLow = this->refrig->PsLowPresValue;
13519 0 : RefPHigh = this->refrig->PsHighPresValue;
13520 0 : NumTUInList = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList;
13521 :
13522 : // Initialization of Te iterations (Label11)
13523 0 : NumTeIte = 1;
13524 0 : Te_ItePreci = 0.1;
13525 0 : MaxNumTeIte = (Te_up - Te_low) / Te_ItePreci + 1; // upper bound and lower bound of Te iterations
13526 0 : Te_update = Te_up - Te_ItePreci;
13527 :
13528 0 : Label11:;
13529 0 : Pipe_m_ref = 0; // Total Ref Flow Rate( kg/s )
13530 0 : Pipe_h_IU_out = 0;
13531 0 : Pipe_h_IU_out_i = 0;
13532 0 : Pipe_m_ref_i = 0;
13533 0 : Pipe_SH_merged = 0;
13534 0 : Pe_update = this->refrig->getSatPressure(state, Te_update, RoutineName);
13535 :
13536 : // Re-calculate total refrigerant flow rate, with updated SH
13537 0 : for (int NumTU = 1; NumTU <= NumTUInList; NumTU++) {
13538 0 : if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) > 0) {
13539 0 : TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU);
13540 0 : CoolCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex;
13541 :
13542 : // The IU coil surface temperature should be the same.
13543 0 : Tfs = Te_up + (this->C3Te * pow_2(state.dataDXCoils->DXCoil(CoolCoilIndex).ActualSH) +
13544 0 : this->C2Te * state.dataDXCoils->DXCoil(CoolCoilIndex).ActualSH + this->C1Te);
13545 :
13546 : // SH_IU_update is the updated SH for a specific IU
13547 0 : if (this->C3Te == 0)
13548 0 : SH_IU_update = -(this->C1Te - Tfs + Te_update) / this->C2Te;
13549 : else
13550 0 : SH_IU_update =
13551 0 : (-this->C2Te + std::pow((pow_2(this->C2Te) - 4 * (this->C1Te - Tfs + Te_update) * this->C3Te), 0.5)) / (2 * this->C3Te);
13552 :
13553 0 : RefTSat = this->refrig->getSatTemperature(state, Pe_update, RoutineName);
13554 0 : Pipe_h_IU_out_i = this->refrig->getSupHeatEnthalpy(state,
13555 0 : max(RefTSat, Te_update + SH_IU_update),
13556 : Pe_update,
13557 : RoutineName); // hB_i for the IU
13558 :
13559 0 : if (Pipe_h_IU_out_i > Pipe_h_IU_in) {
13560 0 : Pipe_m_ref_i = (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) <= 0.0)
13561 0 : ? 0.0
13562 0 : : (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) / (Pipe_h_IU_out_i - Pipe_h_IU_in));
13563 0 : Pipe_m_ref = Pipe_m_ref + Pipe_m_ref_i;
13564 0 : Pipe_SH_merged = Pipe_SH_merged + Pipe_m_ref_i * SH_IU_update;
13565 0 : Pipe_h_IU_out = Pipe_h_IU_out + Pipe_m_ref_i * Pipe_h_IU_out_i;
13566 : }
13567 : }
13568 : }
13569 0 : if (Pipe_m_ref > 0) {
13570 0 : Pipe_h_IU_out = Pipe_h_IU_out / Pipe_m_ref;
13571 0 : Pipe_SH_merged = Pipe_SH_merged / Pipe_m_ref;
13572 : } else {
13573 0 : Pipe_SH_merged = this->SH;
13574 0 : RefTSat = this->refrig->getSatTemperature(state, Pe_update, RoutineName);
13575 0 : Pipe_h_IU_out = this->refrig->getSupHeatEnthalpy(state, max(RefTSat, Te_update + Pipe_SH_merged), Pe_update, RoutineName);
13576 : }
13577 :
13578 : // Re-calculate piping loss
13579 0 : this->VRFOU_PipeLossC(state, Pipe_m_ref, Pe_update, Pipe_h_IU_out, Pipe_SH_merged, OutdoorDryBulb, Pipe_Q, Pipe_DeltP, Pipe_h_comp_in);
13580 :
13581 0 : Tsuction = this->refrig->getSatTemperature(state, max(min(Pe_update - Pipe_DeltP, RefPHigh), RefPLow), RoutineName);
13582 :
13583 0 : if ((std::abs(Tsuction - Te_low) > 0.5) && (Te_update < Te_up) && (Te_update > Te_low) && (NumTeIte < MaxNumTeIte)) {
13584 0 : Te_update = Te_update - 0.1;
13585 0 : NumTeIte = NumTeIte + 1;
13586 0 : goto Label11;
13587 : }
13588 :
13589 0 : if (std::abs(Tsuction - Te_low) > 0.5) {
13590 0 : NumTeIte = 999;
13591 0 : Tsuction = Te_low;
13592 0 : Pipe_SH_merged = 3.0;
13593 0 : Te_update = Te_low + 1;
13594 : }
13595 0 : }
13596 :
13597 0 : void VRFCondenserEquipment::VRFOU_CompSpd(
13598 : EnergyPlusData &state,
13599 : Real64 const Q_req, // Required capacity [W]
13600 : HXOpMode const Q_type, // Required capacity type: 0 for condenser, 1 for evaporator
13601 : Real64 const T_suction, // Compressor suction temperature Te' [C]
13602 : Real64 const T_discharge, // Compressor discharge temperature Tc' [C]
13603 : Real64 const h_IU_evap_in, // Enthalpy of IU at inlet, for C_cap_operation calculation [kJ/kg]
13604 : Real64 const h_comp_in, // Enthalpy after piping loss (compressor inlet), for C_cap_operation calculation [kJ/kg]
13605 : Real64 &CompSpdActual // Actual compressor running speed [rps]
13606 : )
13607 : {
13608 :
13609 : // SUBROUTINE INFORMATION:
13610 : // AUTHOR Rongpeng Zhang, LBNL
13611 : // DATE WRITTEN Feb 2016
13612 : // MODIFIED na
13613 : // RE-ENGINEERED na
13614 :
13615 : // PURPOSE OF THIS SUBROUTINE:
13616 : // This subroutine specifies the compressor speed at given operational conditions to meet the evaporator or condenser capacity provided.
13617 :
13618 : // METHODOLOGY EMPLOYED:
13619 : // This is part of the VRF-FluidTCtrl Model.
13620 :
13621 : using Curve::CurveValue;
13622 :
13623 : // Locals
13624 : // SUBROUTINE ARGUMENT DEFINITIONS:
13625 :
13626 : // SUBROUTINE PARAMETER DEFINITIONS:
13627 : int CounterCompSpdTemp; // Index for the compressor speed level[-]
13628 : int CompSpdLB; // index for Compressor speed low bound [-]
13629 : int CompSpdUB; // index for Compressor speed up bound [-]
13630 : int NumOfCompSpdInput; // Number of compressor speed input by the user [-]
13631 : Real64 C_cap_operation; // Compressor capacity modification algorithm_modified Cap [-]
13632 : Real64 P_suction; // Compressor suction pressure Pe' [Pa]
13633 : Real64 Q_evap_req; // Required evaporative capacity [W]
13634 : Real64 Q_cond_req; // Required evaporative capacity [W]
13635 : Real64 RefPLow; // Low Pressure Value for Ps (>0.0) [Pa]
13636 : Real64 RefPHigh; // High Pressure Value for Ps (max in tables) [Pa]
13637 : Real64 SH_Comp; // Temperature between compressor inlet temperature and evaporative temperature Te' [C]
13638 : Real64 T_comp_in; // Refrigerant temperature at compressor inlet (after piping loss) [C]
13639 0 : Array1D<Real64> CompEvaporatingPWRSpd; // Array for the compressor power at certain speed [W]
13640 0 : Array1D<Real64> CompEvaporatingCAPSpd; // Array for the evaporating capacity at certain speed [W]
13641 :
13642 : static constexpr std::string_view RoutineName("VRFOU_CompSpd");
13643 :
13644 : // variable initializations: component index
13645 0 : RefPLow = this->refrig->PsLowPresValue;
13646 0 : RefPHigh = this->refrig->PsHighPresValue;
13647 :
13648 : // variable initializations: compressor
13649 0 : NumOfCompSpdInput = this->CompressorSpeed.size();
13650 0 : CompEvaporatingPWRSpd.dimension(NumOfCompSpdInput);
13651 0 : CompEvaporatingCAPSpd.dimension(NumOfCompSpdInput);
13652 :
13653 : // variable initializations: system operational parameters
13654 0 : P_suction = this->refrig->getSatPressure(state, T_suction, RoutineName);
13655 0 : T_comp_in = this->refrig->getSupHeatTemp(state, max(min(P_suction, RefPHigh), RefPLow), h_comp_in, T_suction + 3, T_suction + 30, RoutineName);
13656 0 : SH_Comp = T_comp_in - T_suction;
13657 :
13658 : // Calculate capacity modification factor
13659 0 : C_cap_operation = this->VRFOU_CapModFactor(
13660 : state, h_comp_in, h_IU_evap_in, max(min(P_suction, RefPHigh), RefPLow), T_suction + SH_Comp, T_suction + 8, T_discharge - 5);
13661 :
13662 0 : if (Q_type == HXOpMode::EvapMode) {
13663 : // Capacity to meet is for evaporator
13664 :
13665 0 : Q_evap_req = Q_req;
13666 :
13667 0 : for (CounterCompSpdTemp = 1; CounterCompSpdTemp <= NumOfCompSpdInput; CounterCompSpdTemp++) {
13668 : // Iteration to find the VRF speed that can meet the required load, Iteration DoName1
13669 :
13670 0 : CompEvaporatingPWRSpd(CounterCompSpdTemp) =
13671 0 : this->RatedCompPower * CurveValue(state, this->OUCoolingPWRFT(CounterCompSpdTemp), T_discharge, T_suction);
13672 0 : CompEvaporatingCAPSpd(CounterCompSpdTemp) =
13673 0 : this->CoffEvapCap * this->RatedEvapCapacity * CurveValue(state, this->OUCoolingCAPFT(CounterCompSpdTemp), T_discharge, T_suction);
13674 :
13675 0 : if (Q_evap_req * C_cap_operation <= CompEvaporatingCAPSpd(CounterCompSpdTemp)) {
13676 : // Compressor speed stage CounterCompSpdTemp need not to be increased, finish Iteration DoName1
13677 :
13678 0 : if (CounterCompSpdTemp > 1) {
13679 :
13680 0 : CompSpdLB = CounterCompSpdTemp - 1;
13681 0 : CompSpdUB = CounterCompSpdTemp;
13682 :
13683 0 : CompSpdActual = this->CompressorSpeed(CompSpdLB) + (this->CompressorSpeed(CompSpdUB) - this->CompressorSpeed(CompSpdLB)) /
13684 0 : (CompEvaporatingCAPSpd(CompSpdUB) - CompEvaporatingCAPSpd(CompSpdLB)) *
13685 0 : (Q_evap_req * C_cap_operation - CompEvaporatingCAPSpd(CompSpdLB));
13686 :
13687 : } else {
13688 0 : CompSpdActual = this->CompressorSpeed(1) * (Q_evap_req * C_cap_operation) / CompEvaporatingCAPSpd(1);
13689 : }
13690 :
13691 0 : break; // EXIT DoName1
13692 : }
13693 : } // End: Iteration DoName1
13694 :
13695 0 : if (CounterCompSpdTemp > NumOfCompSpdInput) {
13696 0 : CompSpdActual = this->CompressorSpeed(NumOfCompSpdInput);
13697 : }
13698 :
13699 : } else {
13700 : // Capacity to meet is for condenser
13701 :
13702 0 : Q_cond_req = Q_req;
13703 :
13704 0 : for (CounterCompSpdTemp = 1; CounterCompSpdTemp <= NumOfCompSpdInput; CounterCompSpdTemp++) {
13705 : // Iteration to find the VRF speed that can meet the required load, Iteration DoName1
13706 :
13707 0 : CompEvaporatingPWRSpd(CounterCompSpdTemp) =
13708 0 : this->RatedCompPower * CurveValue(state, this->OUCoolingPWRFT(CounterCompSpdTemp), T_discharge, T_suction);
13709 0 : CompEvaporatingCAPSpd(CounterCompSpdTemp) =
13710 0 : this->CoffEvapCap * this->RatedEvapCapacity * CurveValue(state, this->OUCoolingCAPFT(CounterCompSpdTemp), T_discharge, T_suction);
13711 :
13712 0 : Q_evap_req = Q_cond_req - CompEvaporatingPWRSpd(CounterCompSpdTemp);
13713 :
13714 0 : if (Q_evap_req * C_cap_operation <= CompEvaporatingCAPSpd(CounterCompSpdTemp)) {
13715 : // Compressor speed stage CounterCompSpdTemp need not to be increased, finish Iteration DoName1
13716 :
13717 0 : if (CounterCompSpdTemp > 1) {
13718 :
13719 0 : CompSpdLB = CounterCompSpdTemp - 1;
13720 0 : CompSpdUB = CounterCompSpdTemp;
13721 :
13722 0 : CompSpdActual = this->CompressorSpeed(CompSpdLB) + (this->CompressorSpeed(CompSpdUB) - this->CompressorSpeed(CompSpdLB)) /
13723 0 : (CompEvaporatingCAPSpd(CompSpdUB) - CompEvaporatingCAPSpd(CompSpdLB)) *
13724 0 : (Q_evap_req * C_cap_operation - CompEvaporatingCAPSpd(CompSpdLB));
13725 :
13726 : } else {
13727 0 : CompSpdActual = this->CompressorSpeed(1) * (Q_evap_req * C_cap_operation) / CompEvaporatingCAPSpd(1);
13728 : }
13729 :
13730 0 : break; // EXIT DoName1
13731 : }
13732 : } // End: Iteration DoName1
13733 :
13734 0 : if (CounterCompSpdTemp > NumOfCompSpdInput) {
13735 0 : CompSpdActual = this->CompressorSpeed(NumOfCompSpdInput);
13736 : }
13737 : }
13738 0 : }
13739 :
13740 0 : void VRFCondenserEquipment::VRFOU_CompCap(
13741 : EnergyPlusData &state,
13742 : int const CompSpdActual, // Given compressor speed
13743 : Real64 const T_suction, // Compressor suction temperature Te' [C]
13744 : Real64 const T_discharge, // Compressor discharge temperature Tc' [C]
13745 : Real64 const h_IU_evap_in, // Enthalpy of IU at inlet, for C_cap_operation calculation [kJ/kg]
13746 : Real64 const h_comp_in, // Enthalpy after piping loss (compressor inlet), for C_cap_operation calculation [kJ/kg]
13747 : Real64 &Q_c_tot, // Compressor evaporative capacity [W]
13748 : Real64 &Ncomp // Compressor power [W]
13749 : )
13750 : {
13751 :
13752 : // SUBROUTINE INFORMATION:
13753 : // AUTHOR Rongpeng Zhang, LBNL
13754 : // DATE WRITTEN Feb 2016
13755 : // MODIFIED na
13756 : // RE-ENGINEERED na
13757 :
13758 : // PURPOSE OF THIS SUBROUTINE:
13759 : // This subroutine specifies the compressor performance (power and capacity) at given compressor speed and operational conditions.
13760 :
13761 : // METHODOLOGY EMPLOYED:
13762 : // This is part of the VRF-FluidTCtrl Model.
13763 :
13764 : using Curve::CurveValue;
13765 : int CounterCompSpdTemp; // Index for the compressor speed level[-]
13766 : int CompSpdLB; // index for Compressor speed low bound [-]
13767 : int CompSpdUB; // index for Compressor speed up bound [-]
13768 : int NumOfCompSpdInput; // Number of compressor speed input by the user [-]
13769 : Real64 C_cap_operation; // Compressor capacity modification algorithm_modified Cap [-]
13770 : Real64 P_suction; // Compressor suction pressure Pe' [Pa]
13771 : Real64 Q_evap_sys; // evaporative capacity [W]
13772 : Real64 RefPLow; // Low Pressure Value for Ps (>0.0) [Pa]
13773 : Real64 RefPHigh; // High Pressure Value for Ps (max in tables) [Pa]
13774 : Real64 SH_Comp; // Temperature between compressor inlet temperature and evaporative temperature Te' [C]
13775 : Real64 T_comp_in; // Refrigerant temperature at compressor inlet (after piping loss) [C]
13776 0 : Array1D<Real64> CompEvaporatingPWRSpd; // Array for the compressor power at certain speed [W]
13777 0 : Array1D<Real64> CompEvaporatingCAPSpd; // Array for the evaporating capacity at certain speed [W]
13778 :
13779 : static constexpr std::string_view RoutineName("VRFOU_CompCap");
13780 :
13781 : // variable initializations: component index
13782 0 : RefPLow = this->refrig->PsLowPresValue;
13783 0 : RefPHigh = this->refrig->PsHighPresValue;
13784 :
13785 : // variable initializations: compressor
13786 0 : NumOfCompSpdInput = this->CompressorSpeed.size();
13787 0 : CompEvaporatingPWRSpd.dimension(NumOfCompSpdInput);
13788 0 : CompEvaporatingCAPSpd.dimension(NumOfCompSpdInput);
13789 :
13790 0 : for (CounterCompSpdTemp = 1; CounterCompSpdTemp <= NumOfCompSpdInput; CounterCompSpdTemp++) {
13791 :
13792 0 : CompEvaporatingPWRSpd(CounterCompSpdTemp) =
13793 0 : this->RatedCompPower * CurveValue(state, this->OUCoolingPWRFT(CounterCompSpdTemp), T_discharge, T_suction);
13794 0 : CompEvaporatingCAPSpd(CounterCompSpdTemp) =
13795 0 : this->CoffEvapCap * this->RatedEvapCapacity * CurveValue(state, this->OUCoolingCAPFT(CounterCompSpdTemp), T_discharge, T_suction);
13796 :
13797 0 : if (CompSpdActual <= this->CompressorSpeed(CounterCompSpdTemp)) {
13798 : // Compressor speed stage CounterCompSpdTemp need not to be increased, finish Iteration DoName1
13799 :
13800 0 : if (CounterCompSpdTemp > 1) {
13801 :
13802 0 : CompSpdLB = CounterCompSpdTemp - 1;
13803 0 : CompSpdUB = CounterCompSpdTemp;
13804 :
13805 0 : Q_evap_sys = CompEvaporatingCAPSpd(CompSpdLB) + (CompEvaporatingCAPSpd(CompSpdUB) - CompEvaporatingCAPSpd(CompSpdLB)) *
13806 0 : (CompSpdActual - this->CompressorSpeed(CompSpdLB)) /
13807 0 : (this->CompressorSpeed(CompSpdUB) - this->CompressorSpeed(CompSpdLB));
13808 0 : Ncomp = CompEvaporatingPWRSpd(CompSpdLB) + (CompEvaporatingPWRSpd(CompSpdUB) - CompEvaporatingPWRSpd(CompSpdLB)) *
13809 0 : (CompSpdActual - this->CompressorSpeed(CompSpdLB)) /
13810 0 : (this->CompressorSpeed(CompSpdUB) - this->CompressorSpeed(CompSpdLB));
13811 :
13812 : } else {
13813 0 : Q_evap_sys = CompEvaporatingCAPSpd(1) * CompSpdActual / this->CompressorSpeed(1);
13814 0 : Ncomp = CompEvaporatingPWRSpd(1) * CompSpdActual / this->CompressorSpeed(1);
13815 : }
13816 :
13817 0 : break;
13818 : }
13819 : }
13820 :
13821 0 : if (CounterCompSpdTemp > NumOfCompSpdInput) {
13822 0 : Q_evap_sys = CompEvaporatingCAPSpd(NumOfCompSpdInput);
13823 0 : Ncomp = CompEvaporatingPWRSpd(NumOfCompSpdInput);
13824 : }
13825 :
13826 : // variable initializations: system operational parameters
13827 0 : P_suction = this->refrig->getSatPressure(state, T_suction, RoutineName);
13828 0 : T_comp_in = this->refrig->getSupHeatTemp(state, max(min(P_suction, RefPHigh), RefPLow), h_comp_in, T_suction + 3, T_suction + 30, RoutineName);
13829 0 : SH_Comp = T_comp_in - T_suction;
13830 :
13831 : // Calculate capacity modification factor
13832 0 : C_cap_operation = this->VRFOU_CapModFactor(
13833 : state, h_comp_in, h_IU_evap_in, max(min(P_suction, RefPHigh), RefPLow), T_suction + SH_Comp, T_suction + 8, T_discharge - 5);
13834 0 : C_cap_operation = min(1.5, max(0.5, C_cap_operation));
13835 0 : Q_c_tot = Q_evap_sys / C_cap_operation;
13836 0 : }
13837 :
13838 18710 : void VRFCondenserEquipment::VRFOU_CalcCompC(EnergyPlusData &state,
13839 : Real64 TU_load, // Indoor unit cooling load [W]
13840 : Real64 T_suction, // Compressor suction temperature Te' [C]
13841 : Real64 T_discharge, // Compressor discharge temperature Tc' [C]
13842 : Real64 P_suction, // Compressor suction pressure Pe' [Pa]
13843 : Real64 Pipe_T_comp_in, // Refrigerant temperature at compressor inlet (after piping loss) [C]
13844 : Real64 Pipe_h_comp_in, // Enthalpy after piping loss (compressor inlet) [kJ/kg]
13845 : Real64 Pipe_h_IU_in, // Enthalpy of IU at inlet [kJ/kg]
13846 : Real64 Pipe_Q, // Piping Loss Algorithm Parameter: Heat loss [W]
13847 : Real64 MaxOutdoorUnitTc, // The maximum temperature that Tc can be at heating mode [C]
13848 : Real64 &OUCondHeatRelease, // Condenser heat release (cooling mode) [W]
13849 : Real64 &CompSpdActual, // Actual compressor running speed [rps]
13850 : Real64 &Ncomp // Compressor power [W]
13851 : )
13852 : {
13853 :
13854 : // SUBROUTINE INFORMATION:
13855 : // AUTHOR Xiufeng Pang
13856 : // DATE WRITTEN Feb 2014
13857 : // MODIFIED Rongpeng Zhang, Jan 2016
13858 : // RE-ENGINEERED na
13859 :
13860 : // PURPOSE OF THIS SUBROUTINE:
13861 : // This subroutine simulates the compressor performance at given operational conditions (cooling mode). More specifically, it specifies
13862 : // the compressor speed to provide sufficient evaporative capacity, and calculate the power of the compressor running at the specified
13863 : // speed. Note that it may be needed to manipulate the operational conditions to further adjust system capacity at low load conditions.
13864 : // The low load modification logics are different for cooling mode and heating mode.
13865 :
13866 : // METHODOLOGY EMPLOYED:
13867 : // This is part of the VRF-FluidTCtrl Model.
13868 :
13869 : using Curve::CurveValue;
13870 :
13871 : using General::SolveRoot;
13872 :
13873 : int CounterCompSpdTemp; // Index for the compressor speed level[-]
13874 : int CompSpdLB; // index for Compressor speed low bound [-]
13875 : int CompSpdUB; // index for Compressor speed up bound [-]
13876 : int CoolCoilIndex; // index to cooling coil in terminal unit
13877 18710 : int MaxIter(500); // max iteration number allowed [-]
13878 : int NumOfCompSpdInput; // Number of compressor speed input by the user [-]
13879 : int NumIteCcap; // counter for Ccap calculation iterations [-]
13880 : int NumIteTe; // counter for Te calculation iterations [-]
13881 : int NumTUInList; // number of terminal units is list
13882 : int SolFla; // Slove flag for SolveRoot [-]
13883 : int TUListNum; // index to TU List
13884 : int TUIndex; // Index to terminal unit
13885 : Real64 Cap_Eva0; // Evaporating capacity calculated based on physics model, used in the iterations [W]
13886 : Real64 Cap_Eva1; // Evaporating capacity calculated by curves, used in the iterations [W]
13887 : Real64 CapDiff; // Evaporating capacity difference used in the iterations [W]
13888 : Real64 C_cap_operation; // Compressor capacity modification algorithm_modified Cap [-]
13889 : Real64 C_cap_operation0; // Compressor capacity modification algorithm_modified Cap, for temporary use [-]
13890 : Real64 SmallLoadTe; // Updated suction temperature at small load conditions (Te') [C]
13891 : Real64 Modifi_SH; // Temperature between compressor inlet temperature and evaporative temperature Te' [C]
13892 : Real64 MaxNumIteTe; // Piping Loss Algorithm Parameter: max number of iterations for Te [-]
13893 : Real64 MinOutdoorUnitTe; // The minimum temperature that Te can be at cooling mode (only used for calculating Min capacity)
13894 : Real64 MinOutdoorUnitPe; // The minimum pressure that Pe can be at cooling mode (only used for calculating Min capacity)
13895 : Real64 MinRefriPe; // Minimum refrigerant evaporating pressure [Pa]
13896 : Real64 Modifi_SHin; // Compressor power modification algorithm_modified SH for IDU [C]
13897 : Real64 P_discharge; // VRF compressor discharge pressure [Pa]
13898 : Real64 Pipe_m_ref; // Piping Loss Algorithm Parameter: Refrigerant mass flow rate [kg/s]
13899 : Real64 Pipe_DeltP; // Piping Loss Algorithm Parameter: Pipe pressure drop [Pa]
13900 : Real64 Pipe_Q0; // Compressor capacity modification algorithm_modified Pipe_Q, for temporary use [W]
13901 : Real64 Pipe_m_ref_i; // Piping Loss Algorithm Parameter: Refrigerant mass flow rate for a individual IU[kg/s]
13902 : Real64 Pipe_h_IU_out; // Piping Loss Algorithm Parameter: enthalpy of IU at outlet [kJ/kg]
13903 : Real64 Pipe_h_IU_out_i; // Piping Loss Algorithm Parameter: enthalpy of IU at outlet (individual) [kJ/kg]
13904 : Real64 Pipe_Pe_assumed; // Piping Loss Algorithm Parameter: evaporating pressure assumed for iterations[Pa]
13905 : Real64 Pipe_SH_merged; // Piping Loss Algorithm Parameter: average super heating degrees after the indoor units [C]
13906 : Real64 Pipe_Te_assumed; // Piping Loss Algorithm Parameter: evaporating temperature assumed for iterations[C]
13907 : Real64 Q_evap_req; // Required evaporative capacity [W]
13908 : Real64 RefTSat; // Saturated temperature of the refrigerant [C]
13909 : Real64 RefPLow; // Low Pressure Value for Ps (>0.0) [Pa]
13910 : Real64 RefPHigh; // High Pressure Value for Ps (max in tables) [Pa]
13911 : Real64 T_discharge_new; // Condensing temperature, for temporary use in iterations [C]
13912 : Real64 Tfs; // Temperature of the air at the coil surface [C]]
13913 18710 : Real64 Tolerance(0.05); // Tolerance for condensing temperature calculation [C}
13914 18710 : Array1D<Real64> CompEvaporatingPWRSpd; // Array for the compressor power at certain speed [W]
13915 18710 : Array1D<Real64> CompEvaporatingCAPSpd; // Array for the evaporating capacity at certain speed [W]
13916 :
13917 : static constexpr std::string_view RoutineName("VRFOU_CalcCompC");
13918 :
13919 : // variable initializations
13920 18710 : NumOfCompSpdInput = this->CompressorSpeed.size();
13921 18710 : CompEvaporatingPWRSpd.dimension(NumOfCompSpdInput);
13922 18710 : CompEvaporatingCAPSpd.dimension(NumOfCompSpdInput);
13923 18710 : Q_evap_req = TU_load + Pipe_Q;
13924 :
13925 18710 : TUListNum = this->ZoneTUListPtr;
13926 18710 : RefPLow = this->refrig->PsLowPresValue;
13927 18710 : RefPHigh = this->refrig->PsHighPresValue;
13928 18710 : NumTUInList = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList;
13929 :
13930 18710 : Modifi_SH = Pipe_T_comp_in - T_suction;
13931 :
13932 : // set condenser entering air conditions (Outdoor air conditions)
13933 18710 : Real64 OutdoorDryBulb = state.dataEnvrn->OutDryBulbTemp;
13934 18710 : Real64 OutdoorHumRat = state.dataEnvrn->OutHumRat;
13935 18710 : Real64 OutdoorPressure = state.dataEnvrn->OutBaroPress;
13936 18710 : Real64 RhoAir = PsyRhoAirFnPbTdbW(state, OutdoorPressure, OutdoorDryBulb, OutdoorHumRat);
13937 :
13938 : // Calculate capacity modification factor
13939 18710 : C_cap_operation = this->VRFOU_CapModFactor(
13940 : state, Pipe_h_comp_in, Pipe_h_IU_in, max(min(P_suction, RefPHigh), RefPLow), T_suction + Modifi_SH, T_suction + 8, T_discharge - 5);
13941 :
13942 53562 : for (CounterCompSpdTemp = 1; CounterCompSpdTemp <= NumOfCompSpdInput; CounterCompSpdTemp++) {
13943 : // Iteration to find the VRF speed that can meet the required load, Iteration DoName1
13944 :
13945 104658 : CompEvaporatingPWRSpd(CounterCompSpdTemp) =
13946 52329 : this->RatedCompPower * CurveValue(state, this->OUCoolingPWRFT(CounterCompSpdTemp), T_discharge, T_suction);
13947 104658 : CompEvaporatingCAPSpd(CounterCompSpdTemp) =
13948 52329 : this->CoffEvapCap * this->RatedEvapCapacity * CurveValue(state, this->OUCoolingCAPFT(CounterCompSpdTemp), T_discharge, T_suction);
13949 :
13950 52329 : if (Q_evap_req * C_cap_operation <= CompEvaporatingCAPSpd(CounterCompSpdTemp)) {
13951 : // Compressor speed stage CounterCompSpdTemp need not to be increased, finish Iteration DoName1
13952 :
13953 17477 : if (CounterCompSpdTemp > 1) { // Since: if( CounterCompSpdTemp <= 1 )
13954 : // Compressor speed > min
13955 :
13956 14181 : CompSpdLB = CounterCompSpdTemp - 1;
13957 14181 : CompSpdUB = CounterCompSpdTemp;
13958 :
13959 14181 : CompSpdActual = this->CompressorSpeed(CompSpdLB) + (this->CompressorSpeed(CompSpdUB) - this->CompressorSpeed(CompSpdLB)) /
13960 14181 : (CompEvaporatingCAPSpd(CompSpdUB) - CompEvaporatingCAPSpd(CompSpdLB)) *
13961 14181 : (Q_evap_req * C_cap_operation - CompEvaporatingCAPSpd(CompSpdLB));
13962 :
13963 14181 : Ncomp = CompEvaporatingPWRSpd(CompSpdLB) + (CompEvaporatingPWRSpd(CompSpdUB) - CompEvaporatingPWRSpd(CompSpdLB)) /
13964 14181 : (this->CompressorSpeed(CompSpdUB) - this->CompressorSpeed(CompSpdLB)) *
13965 14181 : (CompSpdActual - this->CompressorSpeed(CompSpdLB));
13966 14181 : break; // EXIT DoName1
13967 :
13968 : } else {
13969 : // Compressor runs at the min speed
13970 : // Low Load Modification Algorithm for cooling (IU side modification)
13971 :
13972 : // Initialization of NumIteCcap iterations (Label13)
13973 3296 : Pipe_Q0 = Pipe_Q;
13974 3296 : C_cap_operation0 = C_cap_operation;
13975 3296 : T_discharge_new = T_discharge;
13976 3296 : NumIteCcap = 1;
13977 :
13978 : // Update the C_cap_operation
13979 8331 : Label13:;
13980 8331 : Q_evap_req = TU_load + Pipe_Q0; // Pipe_Q0 is updated during the iteration
13981 8331 : Pipe_h_IU_in = this->refrig->getSatEnthalpy(state, T_discharge_new - this->SC, 0.0, RoutineName);
13982 8331 : CompSpdActual = this->CompressorSpeed(1);
13983 8331 : Real64 CondHeat = Q_evap_req * C_cap_operation0 / this->RatedEvapCapacity; // 150130 To be confirmed
13984 8331 : int CAPFT = this->OUCoolingCAPFT(CounterCompSpdTemp);
13985 :
13986 8331 : P_discharge = this->refrig->getSatPressure(state, T_discharge, RoutineName);
13987 8331 : MinRefriPe = this->refrig->getSatPressure(state, -15, RoutineName);
13988 8331 : MinOutdoorUnitPe = max(P_discharge - this->CompMaxDeltaP, MinRefriPe);
13989 8331 : MinOutdoorUnitTe = this->refrig->getSatTemperature(state, max(min(MinOutdoorUnitPe, RefPHigh), RefPLow), RoutineName);
13990 :
13991 38900 : auto f = [&state, T_discharge_new, CondHeat, CAPFT](Real64 const T_suc) {
13992 38900 : return CompResidual_FluidTCtrl(state, T_discharge_new, CondHeat, CAPFT, T_suc);
13993 8331 : };
13994 :
13995 8331 : General::SolveRoot(state, 1.0e-3, MaxIter, SolFla, SmallLoadTe, f, MinOutdoorUnitTe,
13996 : T_suction); // SmallLoadTe is the updated Te'
13997 8331 : if (SolFla < 0) SmallLoadTe = 6; // MinOutdoorUnitTe; //SmallLoadTe( Te'_new ) is constant during iterations
13998 :
13999 : // Get an updated Te corresponding to the updated Te'
14000 : // VRFOU_TeModification( VRFCond, this->EvaporatingTemp, SmallLoadTe, Pipe_h_IU_in, OutdoorDryBulb, Pipe_Te_assumed,
14001 : // Pipe_Pe_assumed, Pipe_m_ref, Pipe_SH_merged );
14002 : {
14003 : // Initialization of Iteration_Te (Label11)
14004 : // i.e., find a new Te (Pipe_Te_assumed) that can generate a new T_suction equaling to SmallLoadTe.
14005 : // This requires the re-calculate of piping loss.
14006 8331 : NumIteTe = 1;
14007 8331 : MaxNumIteTe = (this->EvaporatingTemp - SmallLoadTe) / 0.1 + 1; // upper bound and lower bound of Te iterations
14008 8331 : Pipe_Te_assumed = this->EvaporatingTemp - 0.1;
14009 :
14010 702503 : Label11:;
14011 702503 : Pipe_m_ref = 0; // Total Ref Flow Rate( kg/s )
14012 :
14013 : // Re-calculate Piping loss due to the Te and SH updates
14014 702503 : Pipe_h_IU_out = 0;
14015 702503 : Pipe_h_IU_out_i = 0;
14016 702503 : Pipe_m_ref_i = 0;
14017 702503 : Pipe_SH_merged = 0;
14018 702503 : Pipe_Pe_assumed = this->refrig->getSatPressure(state, Pipe_Te_assumed, RoutineName);
14019 :
14020 : // Re-calculate total refrigerant flow rate, with updated SH
14021 3676762 : for (int NumTU = 1; NumTU <= NumTUInList; NumTU++) {
14022 2974259 : if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) > 0) {
14023 2844727 : TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU);
14024 2844727 : CoolCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex;
14025 :
14026 2844727 : Tfs = this->EvaporatingTemp + (this->C3Te * pow_2(state.dataDXCoils->DXCoil(CoolCoilIndex).ActualSH) +
14027 2844727 : this->C2Te * state.dataDXCoils->DXCoil(CoolCoilIndex).ActualSH + this->C1Te);
14028 :
14029 : // Modifi_SH is the updated SH for a specific IU
14030 2844727 : if (this->C3Te == 0)
14031 0 : Modifi_SHin = -(this->C1Te - Tfs + Pipe_Te_assumed) / this->C2Te; // 150130 Modifi_SH>Modifi_SHin
14032 : else
14033 2844727 : Modifi_SHin =
14034 2844727 : (-this->C2Te + std::pow((pow_2(this->C2Te) - 4 * (this->C1Te - Tfs + Pipe_Te_assumed) * this->C3Te), 0.5)) /
14035 2844727 : (2 * this->C3Te);
14036 :
14037 2844727 : RefTSat = this->refrig->getSatTemperature(state, max(min(Pipe_Pe_assumed, RefPHigh), RefPLow), RoutineName);
14038 2844727 : Pipe_h_IU_out_i = this->refrig->getSupHeatEnthalpy(
14039 : state, max(RefTSat, Pipe_Te_assumed + Modifi_SHin), max(min(Pipe_Pe_assumed, RefPHigh), RefPLow), RoutineName);
14040 :
14041 2844727 : if (Pipe_h_IU_out_i > Pipe_h_IU_in) {
14042 2844727 : Pipe_m_ref_i = (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) <= 0.0)
14043 2844727 : ? 0.0
14044 2844727 : : (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) /
14045 2844727 : (Pipe_h_IU_out_i - Pipe_h_IU_in));
14046 2844727 : Pipe_m_ref = Pipe_m_ref + Pipe_m_ref_i;
14047 2844727 : Pipe_SH_merged = Pipe_SH_merged + Pipe_m_ref_i * Modifi_SHin;
14048 2844727 : Pipe_h_IU_out = Pipe_h_IU_out + Pipe_m_ref_i * Pipe_h_IU_out_i;
14049 : }
14050 : }
14051 : }
14052 702503 : if (Pipe_m_ref > 0) {
14053 702503 : Pipe_h_IU_out = Pipe_h_IU_out / Pipe_m_ref;
14054 702503 : Pipe_SH_merged = Pipe_SH_merged / Pipe_m_ref;
14055 : } else {
14056 0 : Pipe_SH_merged = this->SH;
14057 0 : RefTSat = this->refrig->getSatTemperature(state, max(min(Pipe_Pe_assumed, RefPHigh), RefPLow), RoutineName);
14058 0 : Pipe_h_IU_out = this->refrig->getSupHeatEnthalpy(
14059 : state, max(RefTSat, Pipe_Te_assumed + Pipe_SH_merged), max(min(Pipe_Pe_assumed, RefPHigh), RefPLow), RoutineName);
14060 : }
14061 :
14062 : // Re-calculate piping loss
14063 702503 : this->VRFOU_PipeLossC(state,
14064 : Pipe_m_ref,
14065 : max(min(Pipe_Pe_assumed, RefPHigh), RefPLow),
14066 : Pipe_h_IU_out,
14067 : Pipe_SH_merged,
14068 : OutdoorDryBulb,
14069 : Pipe_Q,
14070 : Pipe_DeltP,
14071 : Pipe_h_comp_in);
14072 :
14073 702503 : T_suction = this->refrig->getSatTemperature(state, max(min(Pipe_Pe_assumed - Pipe_DeltP, RefPHigh), RefPLow), RoutineName);
14074 :
14075 1396675 : if ((std::abs(T_suction - SmallLoadTe) > 0.5) && (Pipe_Te_assumed < this->EvaporatingTemp) && (Pipe_Te_assumed > SmallLoadTe) &&
14076 694172 : (NumIteTe < MaxNumIteTe)) {
14077 694172 : Pipe_Te_assumed = Pipe_Te_assumed - 0.1;
14078 694172 : NumIteTe = NumIteTe + 1;
14079 694172 : goto Label11;
14080 : }
14081 :
14082 8331 : if (std::abs(T_suction - SmallLoadTe) > 0.5) {
14083 0 : NumIteTe = 999;
14084 0 : T_suction = SmallLoadTe;
14085 0 : Pipe_SH_merged = 3.0;
14086 0 : Pipe_Te_assumed = SmallLoadTe + 1;
14087 : }
14088 : // Iteration_Te End
14089 : }
14090 :
14091 : // Perform iteration to calculate Pipe_T_comp_in( Te'+SH' )
14092 8331 : Pipe_T_comp_in = this->refrig->getSupHeatTemp(
14093 : state, max(min(Pipe_Pe_assumed - Pipe_DeltP, RefPHigh), RefPLow), Pipe_h_comp_in, T_suction + 3, T_suction + 30, RoutineName);
14094 :
14095 8331 : Modifi_SH = Pipe_T_comp_in - T_suction;
14096 8331 : P_suction = Pipe_Pe_assumed - Pipe_DeltP;
14097 8331 : OUCondHeatRelease = TU_load + Pipe_Q + Ncomp; // Pipe_Q is changed when T_suction is changed -> Tc is also changed
14098 :
14099 : // *VRF OU Tc calculations
14100 8331 : this->VRFOU_TeTc(state,
14101 : HXOpMode::CondMode,
14102 : OUCondHeatRelease,
14103 : this->SC,
14104 8331 : this->OUAirFlowRate * RhoAir,
14105 : OutdoorDryBulb,
14106 : OutdoorHumRat,
14107 : OutdoorPressure,
14108 : Tfs,
14109 : T_discharge);
14110 8331 : T_discharge = min(MaxOutdoorUnitTc, T_discharge);
14111 :
14112 : // *Calculate capacity modification factor
14113 8331 : C_cap_operation = this->VRFOU_CapModFactor(state,
14114 : Pipe_h_comp_in,
14115 : Pipe_h_IU_in,
14116 : max(min(P_suction, RefPHigh), RefPLow),
14117 : T_suction + Modifi_SH,
14118 : T_suction + 8,
14119 : T_discharge - 5);
14120 :
14121 8331 : Cap_Eva0 = (TU_load + Pipe_Q) * C_cap_operation; // New Pipe_Q & C_cap_operation
14122 16662 : Cap_Eva1 = this->CoffEvapCap * this->RatedEvapCapacity *
14123 8331 : CurveValue(state, this->OUCoolingCAPFT(CounterCompSpdTemp), T_discharge, T_suction); // New Tc
14124 8331 : CapDiff = std::abs(Cap_Eva1 - Cap_Eva0);
14125 :
14126 8331 : if ((CapDiff > (Tolerance * Cap_Eva0)) && (NumIteCcap < 30)) {
14127 5035 : Pipe_Q0 = Pipe_Q;
14128 5035 : C_cap_operation0 = C_cap_operation;
14129 5035 : T_discharge_new = T_discharge;
14130 5035 : NumIteCcap = NumIteCcap + 1;
14131 5035 : goto Label13;
14132 : }
14133 :
14134 3296 : if (CapDiff > (Tolerance * Cap_Eva0)) NumIteCcap = 999;
14135 :
14136 3296 : Ncomp = this->RatedCompPower * CurveValue(state, this->OUCoolingPWRFT(CounterCompSpdTemp), T_discharge, T_suction);
14137 :
14138 3296 : this->CondensingTemp = T_discharge; // OU Tc' is updated due to OUCondHeatRelease updates, which is caused by IU Te' updates
14139 : // during low load conditions
14140 :
14141 3296 : break; // EXIT DoName1
14142 :
14143 : } // End: if( CounterCompSpdTemp <= 1 ) Low load modification
14144 :
14145 : } // End: if( Q_evap_req <= CompEvaporatingCAPSpd( CounterCompSpdTemp ) )
14146 :
14147 : } // End: Iteration DoName1
14148 :
14149 18710 : if (CounterCompSpdTemp > NumOfCompSpdInput) {
14150 : // Required load is beyond the maximum system capacity
14151 2466 : CompEvaporatingCAPSpd(NumOfCompSpdInput) =
14152 1233 : this->CoffEvapCap * this->RatedEvapCapacity * CurveValue(state, this->OUCoolingCAPFT(NumOfCompSpdInput), T_discharge, T_suction);
14153 1233 : OUCondHeatRelease = Ncomp + CompEvaporatingCAPSpd(NumOfCompSpdInput);
14154 1233 : CompSpdActual = this->CompressorSpeed(NumOfCompSpdInput);
14155 1233 : Ncomp = CompEvaporatingPWRSpd(NumOfCompSpdInput);
14156 : }
14157 18710 : }
14158 :
14159 10075 : void VRFCondenserEquipment::VRFOU_CalcCompH(
14160 : EnergyPlusData &state,
14161 : Real64 TU_load, // Indoor unit heating load [W]
14162 : Real64 T_suction, // Compressor suction temperature Te' [C]
14163 : Real64 T_discharge, // Compressor discharge temperature Tc' [C]
14164 : Real64 Pipe_h_out_ave, // Average Enthalpy of the refrigerant leaving IUs [kJ/kg]
14165 : Real64 IUMaxCondTemp, // VRV IU condensing temperature, max among all indoor units [C]
14166 : Real64 MinOutdoorUnitTe, // The minimum temperature that OU Te can be at cooling mode (only used for calculating Min capacity)
14167 : Real64 Tfs, // Temperature of the air at the OU evaporator coil surface [C]]
14168 : Real64 Pipe_Q, // Piping Loss Algorithm Parameter: Heat loss [W]
14169 : Real64 &OUEvapHeatExtract, // Condenser heat release (cooling mode) [W]
14170 : Real64 &CompSpdActual, // Actual compressor running speed [rps]
14171 : Real64 &Ncomp // Compressor power [W]
14172 : )
14173 : {
14174 :
14175 : // SUBROUTINE INFORMATION:
14176 : // AUTHOR Xiufeng Pang
14177 : // DATE WRITTEN Feb 2014
14178 : // MODIFIED Rongpeng Zhang, Jan 2016
14179 : // RE-ENGINEERED na
14180 :
14181 : // PURPOSE OF THIS SUBROUTINE:
14182 : // This subroutine simulates the compressor performance at given proportional conditions (heating mode). More specifically, it specifies
14183 : // the compressor speed to provide sufficient evaporative capacity, and calculate the power of the compressor running at the specified
14184 : // speed. Note that it may be needed to manipulate the operational conditions to further adjust system capacity at low load conditions.
14185 : // The low load modification logics are different for cooling mode and heating mode.
14186 :
14187 : // METHODOLOGY EMPLOYED:
14188 : // This is part of the VRF-FluidTCtrl Model.
14189 :
14190 : using Curve::CurveValue;
14191 : using General::SolveRoot;
14192 :
14193 : int CounterCompSpdTemp; // Index for the compressor speed level[-]
14194 : int CompSpdLB; // index for Compressor speed low bound [-]
14195 : int CompSpdUB; // index for Compressor speed up bound [-]
14196 10075 : int MaxIter(500); // max iteration number allowed [-]
14197 : int NumOfCompSpdInput; // Number of compressor speed input by the user [-]
14198 : int NumIteCcap; // counter for Ccap calculation iterations [-]
14199 : int NumTUInList; // number of terminal units is list
14200 : int SolFla; // Solve flag for SolveRoot [-]
14201 : int TUListNum; // index to TU List
14202 : Real64 Cap_Eva0; // Evaporating capacity calculated based on physics model, used in the iterations [W]
14203 : Real64 Cap_Eva1; // Evaporating capacity calculated by curves, used in the iterations [W]
14204 : Real64 CapDiff; // Evaporating capacity difference used in the iterations [W]
14205 : Real64 C_cap_operation; // Compressor capacity modification algorithm_modified Cap [-]
14206 : Real64 SmallLoadTe; // Updated suction temperature at small load conditions (Te') [C]
14207 : Real64 Modifi_SH; // Temperature between compressor inlet temperature and evaporative temperature Te' [C]
14208 : Real64 MinOutdoorUnitPe; // The minimum pressure that Pe can be at cooling mode (only used for calculating Min capacity)
14209 : Real64 Modifi_Pe; // Compressor power modification algorithm_modified Pe [Pa]
14210 : Real64 Pipe_h_comp_in; // Piping Loss Algorithm Parameter: Enthalpy after piping loss (compressor inlet) [kJ/kg]
14211 : Real64 Q_evap_req; // Required evaporative capacity [W]
14212 : Real64 RefTSat; // Saturated temperature of the refrigerant [C]
14213 : Real64 RefPLow; // Low Pressure Value for Ps (>0.0) [Pa]
14214 : Real64 RefPHigh; // High Pressure Value for Ps (max in tables) [Pa]
14215 10075 : Real64 Tolerance(0.05); // Tolerance for condensing temperature calculation [C}
14216 10075 : Array1D<Real64> CompEvaporatingPWRSpd; // Array for the compressor power at certain speed [W]
14217 10075 : Array1D<Real64> CompEvaporatingCAPSpd; // Array for the evaporating capacity at certain speed [W]
14218 :
14219 : static constexpr std::string_view RoutineName("VRFOU_CalcCompH");
14220 :
14221 : // variable initializations
14222 10075 : NumOfCompSpdInput = this->CompressorSpeed.size();
14223 10075 : CompEvaporatingPWRSpd.dimension(NumOfCompSpdInput);
14224 10075 : CompEvaporatingCAPSpd.dimension(NumOfCompSpdInput);
14225 10075 : Q_evap_req = TU_load + Pipe_Q - Ncomp;
14226 :
14227 10075 : TUListNum = this->ZoneTUListPtr;
14228 10075 : RefPLow = this->refrig->PsLowPresValue;
14229 10075 : RefPHigh = this->refrig->PsHighPresValue;
14230 10075 : NumTUInList = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList;
14231 :
14232 : // Calculate capacity modification factor
14233 10075 : MinOutdoorUnitPe = this->refrig->getSatPressure(state, T_suction, RoutineName);
14234 10075 : RefTSat = this->refrig->getSatTemperature(state, max(min(MinOutdoorUnitPe, RefPHigh), RefPLow), RoutineName);
14235 : Pipe_h_comp_in =
14236 10075 : this->refrig->getSupHeatEnthalpy(state, max(RefTSat, T_suction + this->SH), max(min(MinOutdoorUnitPe, RefPHigh), RefPLow), RoutineName);
14237 10075 : C_cap_operation = this->VRFOU_CapModFactor(
14238 10075 : state, Pipe_h_comp_in, Pipe_h_out_ave, max(min(MinOutdoorUnitPe, RefPHigh), RefPLow), T_suction + this->SH, T_suction + 8, IUMaxCondTemp - 5);
14239 :
14240 : // Perform iterations to find the compressor speed that can meet the required heating load, Iteration DoName2
14241 29458 : for (CounterCompSpdTemp = 1; CounterCompSpdTemp <= NumOfCompSpdInput; CounterCompSpdTemp++) {
14242 :
14243 58916 : CompEvaporatingPWRSpd(CounterCompSpdTemp) =
14244 29458 : this->RatedCompPower * CurveValue(state, this->OUCoolingPWRFT(CounterCompSpdTemp), T_discharge, T_suction);
14245 58916 : CompEvaporatingCAPSpd(CounterCompSpdTemp) =
14246 29458 : this->CoffEvapCap * this->RatedEvapCapacity * CurveValue(state, this->OUCoolingCAPFT(CounterCompSpdTemp), T_discharge, T_suction);
14247 :
14248 29458 : if ((Q_evap_req * C_cap_operation) <= CompEvaporatingCAPSpd(CounterCompSpdTemp)) {
14249 : // Compressor Capacity is greater than the required, finish Iteration DoName2
14250 :
14251 10075 : if (CounterCompSpdTemp > 1) {
14252 : // Compressor runs at higher speed than min speed
14253 9915 : CompSpdLB = CounterCompSpdTemp - 1;
14254 9915 : CompSpdUB = CounterCompSpdTemp;
14255 :
14256 9915 : CompSpdActual = this->CompressorSpeed(CompSpdLB) + (this->CompressorSpeed(CompSpdUB) - this->CompressorSpeed(CompSpdLB)) /
14257 9915 : (CompEvaporatingCAPSpd(CompSpdUB) - CompEvaporatingCAPSpd(CompSpdLB)) *
14258 9915 : (Q_evap_req * C_cap_operation - CompEvaporatingCAPSpd(CompSpdLB));
14259 9915 : Modifi_SH = this->SH;
14260 9915 : Ncomp = CompEvaporatingPWRSpd(CompSpdLB) + (CompEvaporatingPWRSpd(CompSpdUB) - CompEvaporatingPWRSpd(CompSpdLB)) /
14261 9915 : (this->CompressorSpeed(CompSpdUB) - this->CompressorSpeed(CompSpdLB)) *
14262 9915 : (CompSpdActual - this->CompressorSpeed(CompSpdLB));
14263 :
14264 9915 : break; // EXIT DoName2
14265 :
14266 : } else {
14267 : // Compressor runs at the min speed
14268 : // Low Load Modifications
14269 :
14270 160 : NumIteCcap = 1;
14271 160 : Label19:;
14272 160 : Q_evap_req = max(0.0, TU_load + Pipe_Q - Ncomp);
14273 :
14274 : // Update Te'( SmallLoadTe ) to meet the required evaporator capacity
14275 160 : CompSpdActual = this->CompressorSpeed(1);
14276 160 : Real64 CondHeat = Q_evap_req * C_cap_operation / this->RatedEvapCapacity;
14277 160 : int CAPFT = this->OUCoolingCAPFT(CounterCompSpdTemp);
14278 :
14279 934 : auto f = [&state, T_discharge, CondHeat, CAPFT](Real64 const T_suc) {
14280 934 : return CompResidual_FluidTCtrl(state, T_discharge, CondHeat, CAPFT, T_suc);
14281 160 : };
14282 :
14283 160 : General::SolveRoot(state, 1.0e-3, MaxIter, SolFla, SmallLoadTe, f, MinOutdoorUnitTe, T_suction);
14284 160 : if (SolFla < 0) SmallLoadTe = MinOutdoorUnitTe;
14285 :
14286 160 : T_suction = SmallLoadTe;
14287 :
14288 : // Update SH and Pe to calculate Modification Factor, which is used to update rps to for N_comp calculations
14289 160 : if (this->C3Te == 0)
14290 0 : Modifi_SH = -(this->C1Te - Tfs + T_suction) / this->C2Te;
14291 : else
14292 160 : Modifi_SH =
14293 160 : (-this->C2Te + std::pow((pow_2(this->C2Te) - 4 * (this->C1Te - Tfs + T_suction) * this->C3Te), 0.5)) / (2 * this->C3Te);
14294 :
14295 160 : Modifi_Pe = this->refrig->getSatPressure(state, T_suction, RoutineName);
14296 :
14297 : // Calculate capacity modification factor
14298 160 : RefTSat = this->refrig->getSatTemperature(state, max(min(Modifi_Pe, RefPHigh), RefPLow), RoutineName);
14299 : Pipe_h_comp_in =
14300 160 : this->refrig->getSupHeatEnthalpy(state, max(RefTSat, T_suction + Modifi_SH), max(min(Modifi_Pe, RefPHigh), RefPLow), RoutineName);
14301 160 : C_cap_operation = this->VRFOU_CapModFactor(state,
14302 : Pipe_h_comp_in,
14303 : Pipe_h_out_ave,
14304 : max(min(Modifi_Pe, RefPHigh), RefPLow),
14305 : T_suction + Modifi_SH,
14306 : T_suction + 8,
14307 : IUMaxCondTemp - 5);
14308 :
14309 160 : Cap_Eva0 = Q_evap_req * C_cap_operation;
14310 160 : Cap_Eva1 =
14311 160 : this->CoffEvapCap * this->RatedEvapCapacity * CurveValue(state, this->OUCoolingCAPFT(CounterCompSpdTemp), T_discharge, T_suction);
14312 160 : CapDiff = std::abs(Cap_Eva1 - Cap_Eva0);
14313 :
14314 160 : if ((CapDiff > (Tolerance * Cap_Eva0)) && (NumIteCcap < 30)) {
14315 0 : NumIteCcap = NumIteCcap + 1;
14316 0 : goto Label19;
14317 : }
14318 160 : if (CapDiff > (Tolerance * Cap_Eva0)) NumIteCcap = 999;
14319 :
14320 160 : Ncomp = this->RatedCompPower * CurveValue(state, this->OUCoolingPWRFT(CounterCompSpdTemp), T_discharge, T_suction);
14321 :
14322 160 : break; // EXIT DoName2
14323 :
14324 : } // End: if( CounterCompSpdTemp <= 1 ) Low load modification
14325 :
14326 : } // End: if( Q_evap_req <= CompEvaporatingCAPSpd( CounterCompSpdTemp ) )
14327 :
14328 : } // End: Iteration DoName2
14329 :
14330 10075 : if (CounterCompSpdTemp > NumOfCompSpdInput) {
14331 : // Required heating load is beyond the maximum system capacity
14332 0 : CompEvaporatingCAPSpd(NumOfCompSpdInput) =
14333 0 : this->CoffEvapCap * this->RatedEvapCapacity * CurveValue(state, this->OUCoolingCAPFT(NumOfCompSpdInput), T_discharge, T_suction);
14334 0 : OUEvapHeatExtract = CompEvaporatingCAPSpd(NumOfCompSpdInput);
14335 0 : CompSpdActual = this->CompressorSpeed(NumOfCompSpdInput);
14336 0 : Ncomp = CompEvaporatingPWRSpd(NumOfCompSpdInput);
14337 : }
14338 10075 : }
14339 :
14340 0 : void VRFCondenserEquipment::VRFHR_OU_HR_Mode(EnergyPlusData &state,
14341 : Real64 const h_IU_evap_in, // enthalpy of IU evaporator at inlet [kJ/kg]
14342 : Real64 const h_comp_out, // enthalpy of refrigerant at compressor outlet [kJ/kg]
14343 : Real64 const Q_c_TU_PL, // IU evaporator load, including piping loss [W]
14344 : Real64 const Q_h_TU_PL, // IU condenser load, including piping loss [W]
14345 : Real64 const Tdischarge, // VRF Compressor discharge refrigerant temperature [C]
14346 : Real64 &Tsuction, // VRF compressor suction refrigerant temperature [C]
14347 : Real64 &Te_update, // updated evaporating temperature, only updated when Tsuction is updated [C]
14348 : Real64 &h_comp_in, // enthalpy of refrigerant at compressor inlet [kJ/kg]
14349 : Real64 &h_IU_PLc_out, // enthalpy of refrigerant at the outlet of IU evaporator side main pipe [kJ/kg]
14350 : Real64 &Pipe_Q_c, // IU evaporator side piping loss [W]
14351 : Real64 &Q_c_OU, // OU evaporator load [W]
14352 : Real64 &Q_h_OU, // OU condenser load [W]
14353 : Real64 &m_ref_IU_evap, // mass flow rate of Refrigerant through IU evaporators [kg/s]
14354 : Real64 &m_ref_OU_evap, // mass flow rate of Refrigerant through OU evaporator [kg/s]
14355 : Real64 &m_ref_OU_cond, // mass flow rate of Refrigerant through OU condenser [kg/s]
14356 : Real64 &N_fan_OU, // outdoor unit fan power [W]
14357 : Real64 &CompSpdActual, // Actual compressor running speed [rps]
14358 : Real64 &Ncomp // compressor power [W]
14359 : )
14360 : {
14361 :
14362 : // SUBROUTINE INFORMATION:
14363 : // AUTHOR Rongpeng Zhang, LBNL
14364 : // DATE WRITTEN Jan 2016
14365 : // MODIFIED na
14366 : //
14367 : // RE-ENGINEERED na
14368 : //
14369 : // PURPOSE OF THIS SUBROUTINE:
14370 : // Determine the operational mode of the VRF-HR system, given the terminal unit side load conditions.
14371 : // Compressor and OU hex performance are analyzed for each mode.
14372 : // A number of OU side operational parameters are also calculated here, including:
14373 : // (1) OU evaporator load Q_c_OU (2) OU condenser load Q_h_OU (3) OU fan energy consumption
14374 : // (4) OU compressor speed and energy consumption
14375 : // Note that Te and Te' may be updated here, and thus IU evaporator side piping loss recalculations.
14376 : // Then a number of operational parameters need to be updated, including:
14377 : // (1) IU evaporating temperature Te (2) OU evaporating temperature Te' etc.
14378 : //
14379 : // METHODOLOGY EMPLOYED:
14380 : // This is part of the physics based VRF model applicable for Fluid Temperature Control.
14381 :
14382 : using General::SolveRoot;
14383 :
14384 0 : Real64 constexpr ErrorTol(0.1); // tolerance for RegulaFalsi iterations
14385 0 : int constexpr MaxIte(100); // maximum number of iterations
14386 0 : int HRMode(0); // HR operational mode [W]
14387 0 : int HRMode_sub(0); // HR operational mode (sub) [W]
14388 : int SolFla; // Flag of RegulaFalsi solver
14389 : Real64 C_OU_HexRatio; // capacity ratio between the OU condenser and OU evaporator [-]
14390 : Real64 m_air_rated; // OU coil air mass flow rate [kg/s]
14391 : Real64 m_air_evap; // OU evaporator air mass flow rate [kg/s]
14392 : Real64 m_air_cond; // OU condenser air mass flow rate [kg/s]
14393 : Real64 m_air_evap_rated; // Rated OU evaporator air mass flow rate [kg/s]
14394 0 : Real64 N_fan_OU_evap(0); // OU evaporator air mass flow rate [kg/s]
14395 0 : Real64 N_fan_OU_cond(0); // OU condenser air mass flow rate [kg/s]
14396 : Real64 RhoAir; // outdoor air density [kg/m3]
14397 : Real64 Q_c_tot; // Total evaporator capacity [W]
14398 : Real64 Q_h_tot; // Total condenser capacity [W]
14399 : Real64 Pipe_Q_c_new; // IU evaporator side piping loss (new), updated because of Te update [W]
14400 : Real64 rps1_evap; // compressor speed satisfying IU cooling load
14401 : Real64 rps2_cond; // compressor speed satisfying IU heating load
14402 : Real64 RefPLow; // Low Pressure Value for Ps (>0.0) [Pa]
14403 : Real64 RefPHigh; // High Pressure Value for Ps (max in tables) [Pa]
14404 : Real64 Tfs; // temperature of the air at coil surface [C]
14405 0 : Real64 Tolerance(0.05); // Tolerance for condensing temperature calculation [C}
14406 : Real64 Tsuction_new; // VRF compressor suction refrigerant temperature (new) [C]
14407 :
14408 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
14409 : static constexpr std::string_view RoutineName("VRFHR_OU_Mode");
14410 :
14411 : // Initialization: operational parameters
14412 0 : RhoAir = PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataEnvrn->OutDryBulbTemp, state.dataEnvrn->OutHumRat);
14413 0 : m_air_rated = this->OUAirFlowRate * RhoAir;
14414 0 : C_OU_HexRatio = this->HROUHexRatio;
14415 :
14416 : // Initializations: component index
14417 0 : RefPLow = this->refrig->PsLowPresValue;
14418 0 : RefPHigh = this->refrig->PsHighPresValue;
14419 :
14420 : // **Q_OU: HR mode determination
14421 : // HRMode-1. Cooling Only
14422 : // HRMode-2. Cooling Dominant w/o HR Loss
14423 : // HRMode-3. Cooling Dominant w/ HR Loss
14424 : // HRMode-4. Heating Dominant w/ HR Loss
14425 : // HRMode-5. Heating Dominant w/o HR Loss
14426 : // HRMode-6. Heating Only
14427 : // HRMode-7. OU Hex not running
14428 : {
14429 :
14430 : bool FlagMode5; // true if compressor speed satisfying IU cooling load < that satisfying IU heating load
14431 : bool FlagToLower; // true if To-5 is lower than the Tsuction determined by IU part
14432 : Real64 temp_Tsuction;
14433 :
14434 : // Determine FlagToLower
14435 0 : if (state.dataEnvrn->OutDryBulbTemp - this->DiffOUTeTo < Tsuction) {
14436 0 : temp_Tsuction = state.dataEnvrn->OutDryBulbTemp - this->DiffOUTeTo;
14437 0 : FlagToLower = true;
14438 : } else {
14439 0 : temp_Tsuction = Tsuction;
14440 0 : FlagToLower = false;
14441 : }
14442 :
14443 : // Calculate compressor speed satisfying IU loads: rps1_evap & rps2_cond
14444 0 : this->VRFOU_CompSpd(state, Q_c_TU_PL, HXOpMode::EvapMode, temp_Tsuction, Tdischarge, h_IU_evap_in, h_IU_PLc_out, rps1_evap);
14445 0 : this->VRFOU_CompSpd(state, Q_h_TU_PL, HXOpMode::CondMode, temp_Tsuction, Tdischarge, h_IU_evap_in, h_IU_PLc_out, rps2_cond);
14446 :
14447 : // Determine FlagMode5
14448 0 : if (rps1_evap <= rps2_cond) {
14449 0 : FlagMode5 = true;
14450 : } else {
14451 0 : FlagMode5 = false;
14452 : }
14453 :
14454 : // Determine HR Mode
14455 0 : if (FlagMode5) {
14456 0 : HRMode = 5;
14457 0 : if (FlagToLower)
14458 0 : HRMode_sub = 1;
14459 : else
14460 0 : HRMode_sub = 2;
14461 : } else {
14462 :
14463 0 : if (FlagToLower)
14464 0 : HRMode = 3; // Mode 3&4 share the same logics below
14465 : else
14466 0 : HRMode = 2;
14467 : }
14468 :
14469 0 : this->VRFOperationSimPath = HRMode * 10 + HRMode_sub;
14470 : }
14471 :
14472 : // **Simulate outdoor unit and compressor performance, including
14473 : // (1) compressor spd/power (2) OU hex capacity (3) OU fan flow rate and power
14474 : // Tsuction/Te may also need updates
14475 0 : if (HRMode == 5 && HRMode_sub == 2) {
14476 :
14477 0 : CompSpdActual = rps2_cond; // constant in this mode
14478 : // Tsuction = Te'_iu < OutDryBulbTemp - 5; constant in this mode
14479 :
14480 : // compressor: Ncomp & Q_c_tot
14481 0 : this->VRFOU_CompCap(state, CompSpdActual, Tsuction, Tdischarge, h_IU_evap_in, h_comp_in, Q_c_tot, Ncomp);
14482 :
14483 : // OU hex capacity
14484 0 : Q_c_OU = Q_c_tot - Q_c_TU_PL;
14485 0 : Q_h_OU = 0;
14486 :
14487 : // OU fan flow rate and power
14488 : m_air_evap =
14489 0 : this->VRFOU_FlowRate(state, HXOpMode::EvapMode, Tsuction, this->SH, Q_c_OU, state.dataEnvrn->OutDryBulbTemp, state.dataEnvrn->OutHumRat);
14490 0 : m_air_evap_rated = m_air_rated;
14491 0 : N_fan_OU_evap = this->RatedOUFanPower * m_air_evap / m_air_evap_rated;
14492 0 : N_fan_OU_cond = 0;
14493 :
14494 0 : } else if (HRMode == 5 && HRMode_sub == 1) {
14495 :
14496 : // local parameters
14497 : int Counter_Iter_Ncomp;
14498 0 : bool Flag_Iter_Ncomp(true); // Flag to perform iterations
14499 : Real64 Ncomp_ini;
14500 : Real64 Ncomp_new;
14501 : Real64 Q_c_tot_temp;
14502 : Real64 Q_c_OU_temp;
14503 :
14504 : //===**Ncomp Iterations
14505 :
14506 : // initialization: Ncomp_ini, CompSpdActual
14507 0 : Counter_Iter_Ncomp = 1;
14508 0 : CompSpdActual = rps2_cond;
14509 0 : Tsuction_new = state.dataEnvrn->OutDryBulbTemp - this->DiffOUTeTo;
14510 0 : Pipe_Q_c_new = Pipe_Q_c;
14511 :
14512 0 : this->VRFOU_CompCap(state, CompSpdActual, Tsuction_new, Tdischarge, h_IU_evap_in, h_comp_in, Q_c_tot, Ncomp_ini);
14513 :
14514 0 : while (Flag_Iter_Ncomp) {
14515 :
14516 0 : Q_c_tot_temp = Q_h_TU_PL - Ncomp_ini; // Q_h_OU = 0
14517 0 : Q_c_OU_temp = Q_c_tot_temp - Q_c_TU_PL;
14518 :
14519 : // Tsuction_new updated based on OU evaporator air-side calculations (Tsuction_new < To)
14520 0 : m_air_evap_rated = m_air_rated;
14521 0 : this->VRFOU_TeTc(state,
14522 : HXOpMode::EvapMode,
14523 : Q_c_OU_temp,
14524 : this->SH,
14525 : m_air_evap_rated,
14526 0 : state.dataEnvrn->OutDryBulbTemp,
14527 0 : state.dataEnvrn->OutHumRat,
14528 0 : state.dataEnvrn->OutBaroPress,
14529 : Tfs,
14530 : Tsuction_new);
14531 0 : Tsuction_new = min(Tsuction_new, Tsuction); // should be lower than Tsuction_IU
14532 :
14533 : // Calculate updated rps corresponding to updated Tsuction_new and Q_c_tot_temp
14534 0 : this->VRFOU_CompSpd(state, Q_c_tot_temp, HXOpMode::EvapMode, Tsuction_new, Tdischarge, h_IU_evap_in, h_comp_in, CompSpdActual);
14535 :
14536 : // Calculate Ncomp_new, using updated CompSpdActual and Tsuction_new
14537 0 : this->VRFOU_CompCap(state, CompSpdActual, Tsuction_new, Tdischarge, h_IU_evap_in, h_comp_in, Q_c_tot_temp, Ncomp_new);
14538 :
14539 0 : if ((std::abs(Ncomp_new - Ncomp_ini) > (Tolerance * Ncomp_ini)) && (Counter_Iter_Ncomp < 30)) {
14540 0 : Ncomp_ini = 0.5 * Ncomp_ini + 0.5 * Ncomp_new;
14541 0 : Counter_Iter_Ncomp = Counter_Iter_Ncomp + 1;
14542 0 : continue;
14543 : }
14544 :
14545 0 : Flag_Iter_Ncomp = false;
14546 : }
14547 :
14548 : // Ncomp Iterations Update
14549 0 : Ncomp = Ncomp_new;
14550 0 : Q_c_tot = Q_c_tot_temp;
14551 :
14552 0 : if (Tsuction_new < Tsuction) {
14553 : // Need to update the Tsuction, and thus update Te_update & Pipe_Q_c_new.
14554 : // Iteration continues.
14555 :
14556 : // temporary parameters
14557 : Real64 Pe_update;
14558 : Real64 Pipe_SH_merged;
14559 : Real64 Pipe_DeltP;
14560 : Real64 Pipe_h_IU_out;
14561 :
14562 : // Get an updated Te (Te_update) corresponding to the updated Te' (Tsuction_new). PL_c is re-performed.
14563 0 : this->VRFOU_TeModification(state,
14564 : this->EvaporatingTemp,
14565 : Tsuction_new,
14566 : h_IU_evap_in,
14567 0 : state.dataEnvrn->OutDryBulbTemp,
14568 : Te_update,
14569 : Pe_update,
14570 : m_ref_IU_evap,
14571 : Pipe_h_IU_out,
14572 : Pipe_SH_merged);
14573 :
14574 : // Re-calculate piping loss, update Pipe_Q_c_new
14575 0 : this->VRFOU_PipeLossC(state,
14576 : m_ref_IU_evap,
14577 : Pe_update,
14578 : Pipe_h_IU_out,
14579 : Pipe_SH_merged,
14580 0 : state.dataEnvrn->OutDryBulbTemp,
14581 : Pipe_Q_c_new,
14582 : Pipe_DeltP,
14583 : h_IU_PLc_out);
14584 :
14585 0 : Tsuction = Tsuction_new;
14586 0 : Pipe_Q_c = Pipe_Q_c_new;
14587 : }
14588 :
14589 : // No need to update the Tsuction.
14590 :
14591 : //===**Ncomp Iteration Ends (Label200)
14592 :
14593 : // OU hex capacity
14594 0 : Q_c_OU = Q_c_tot - Q_c_TU_PL;
14595 0 : Q_h_OU = 0;
14596 :
14597 : // OU fan power
14598 0 : N_fan_OU_evap = this->RatedOUFanPower;
14599 0 : N_fan_OU_cond = 0;
14600 :
14601 0 : } else if (HRMode == 3) { // Mode3 & Mode4 share the same algorithm
14602 :
14603 : // local parameters
14604 : Real64 Ncomp_new;
14605 : Real64 Q_c_tot_temp;
14606 : Real64 Q_c_OU_temp;
14607 0 : Real64 Tsuction_LB = state.dataEnvrn->OutDryBulbTemp - this->DiffOUTeTo;
14608 0 : Real64 Tsuction_HB = Tsuction;
14609 :
14610 : // compressor speed is fixed in this mode
14611 0 : CompSpdActual = rps1_evap; // constant in this mode
14612 0 : m_air_evap_rated = m_air_rated * (1 - C_OU_HexRatio);
14613 0 : m_air_evap = m_air_evap_rated; // may be updated
14614 :
14615 : // perform iterations to calculate Te at the given compressor speed and operational conditions
14616 : {
14617 :
14618 0 : auto f = [&state, this, CompSpdActual, Tdischarge, h_IU_evap_in, h_comp_in, Q_c_TU_PL, m_air_evap_rated](Real64 const Te) {
14619 0 : int VRFCond = state.dataHVACVarRefFlow->VRFTU(state.dataHVACVarRefFlow->TerminalUnitList(this->ZoneTUListPtr).ZoneTUPtr(1))
14620 0 : .VRFSysNum; // VRFCond;
14621 :
14622 : Real64 Ncomp_temp; // compressor power [W]
14623 : Real64 Q_c_tot_temp; // total evaporator load, including piping loss [W]
14624 : Real64 Q_c_OU_temp; // OU evaporator load, including piping loss [W]
14625 : Real64 Te_new; // newly calculated OU evaporating temperature
14626 : Real64 Tfs; // OU evaporator coil surface temperature [C]
14627 :
14628 0 : state.dataHVACVarRefFlow->VRF(VRFCond).VRFOU_CompCap(
14629 : state, CompSpdActual, Te, Tdischarge, h_IU_evap_in, h_comp_in, Q_c_tot_temp, Ncomp_temp);
14630 0 : Q_c_OU_temp = Q_c_tot_temp - Q_c_TU_PL;
14631 :
14632 : // Tsuction_new calculated based on OU evaporator air-side calculations (Tsuction_new < To)
14633 0 : state.dataHVACVarRefFlow->VRF(VRFCond).VRFOU_TeTc(state,
14634 : HXOpMode::EvapMode,
14635 : Q_c_OU_temp,
14636 0 : state.dataHVACVarRefFlow->VRF(VRFCond).SH,
14637 : m_air_evap_rated,
14638 0 : state.dataEnvrn->OutDryBulbTemp,
14639 0 : state.dataEnvrn->OutHumRat,
14640 0 : state.dataEnvrn->OutBaroPress,
14641 : Tfs,
14642 : Te_new);
14643 :
14644 0 : return Te_new - Te;
14645 0 : };
14646 :
14647 0 : General::SolveRoot(state, ErrorTol, MaxIte, SolFla, Tsuction_new, f, Tsuction_LB, Tsuction_HB);
14648 0 : if (SolFla < 0) Tsuction_new = Tsuction_LB;
14649 :
14650 : // Update Q_c_tot_temp using updated Tsuction_new
14651 0 : this->VRFOU_CompCap(state, CompSpdActual, Tsuction_new, Tdischarge, h_IU_evap_in, h_comp_in, Q_c_tot_temp, Ncomp_new);
14652 0 : Q_c_OU_temp = Q_c_tot_temp - Q_c_TU_PL;
14653 :
14654 : // Iterations_Te Update
14655 0 : Ncomp = Ncomp_new;
14656 0 : Tsuction = Tsuction_new;
14657 0 : Q_c_tot = Q_c_tot_temp;
14658 0 : Q_c_OU = Q_c_OU_temp;
14659 : }
14660 :
14661 0 : if (Tsuction >= Tsuction_HB) {
14662 : // modify m_air_evap to adjust OU evaporator capacity;
14663 : // update Ncomp, Q_c_OU, m_air_evap
14664 :
14665 0 : Tsuction = Tsuction_HB;
14666 :
14667 : // Q_c_tot
14668 0 : this->VRFOU_CompCap(state, CompSpdActual, Tsuction_new, Tdischarge, h_IU_evap_in, h_comp_in, Q_c_tot, Ncomp);
14669 0 : Q_c_OU = Q_c_tot - Q_c_TU_PL;
14670 :
14671 : // OU evaporator fan flow rate and power
14672 0 : m_air_evap = this->VRFOU_FlowRate(
14673 0 : state, HXOpMode::EvapMode, Tsuction, this->SH, Q_c_OU_temp, state.dataEnvrn->OutDryBulbTemp, state.dataEnvrn->OutHumRat);
14674 :
14675 : } else {
14676 : // Need to update Te_update & Pipe_Q_c_new, corresponding to Tsuction update.
14677 :
14678 : // temporary parameters
14679 : Real64 Pe_update;
14680 : Real64 Pipe_SH_merged;
14681 : Real64 Pipe_DeltP;
14682 : Real64 Pipe_h_IU_out;
14683 :
14684 : // Get an updated Te (Te_update) corresponding to the updated Te' (Tsuction_new). PL_c is re-performed.
14685 0 : this->VRFOU_TeModification(state,
14686 : this->EvaporatingTemp,
14687 : Tsuction_new,
14688 : h_IU_evap_in,
14689 0 : state.dataEnvrn->OutDryBulbTemp,
14690 : Te_update,
14691 : Pe_update,
14692 : m_ref_IU_evap,
14693 : Pipe_h_IU_out,
14694 : Pipe_SH_merged);
14695 :
14696 : // Re-calculate piping loss, update Pipe_Q_c_new
14697 0 : this->VRFOU_PipeLossC(state,
14698 : m_ref_IU_evap,
14699 : Pe_update,
14700 : Pipe_h_IU_out,
14701 : Pipe_SH_merged,
14702 0 : state.dataEnvrn->OutDryBulbTemp,
14703 : Pipe_Q_c_new,
14704 : Pipe_DeltP,
14705 : h_IU_PLc_out);
14706 0 : Pipe_Q_c = Pipe_Q_c_new;
14707 : }
14708 :
14709 : // Q_h_ou
14710 0 : Q_h_tot = Q_c_tot + Ncomp;
14711 0 : Q_h_OU = Q_h_tot - Q_h_TU_PL;
14712 :
14713 : // OU condenser fan flow rate and power
14714 0 : m_air_cond = this->VRFOU_FlowRate(
14715 0 : state, HXOpMode::CondMode, Tdischarge, this->SC, Q_h_OU, state.dataEnvrn->OutDryBulbTemp, state.dataEnvrn->OutHumRat);
14716 :
14717 : // OU fan power
14718 0 : N_fan_OU_evap = this->RatedOUFanPower * m_air_evap / m_air_rated;
14719 0 : N_fan_OU_cond = this->RatedOUFanPower * m_air_cond / m_air_rated;
14720 :
14721 0 : } else if (HRMode == 2) {
14722 :
14723 0 : CompSpdActual = rps1_evap; // constant in this mode
14724 : // Tsuction = Te'_iu < OutDryBulbTemp - 5; constant in this mode
14725 :
14726 : // compressor: Ncomp & Q_c_tot
14727 0 : this->VRFOU_CompCap(state, CompSpdActual, Tsuction, Tdischarge, h_IU_evap_in, h_comp_in, Q_c_tot, Ncomp);
14728 :
14729 : // OU hex capacity
14730 0 : Q_h_tot = Q_c_tot + Ncomp;
14731 0 : Q_h_OU = Q_h_tot - Q_h_TU_PL;
14732 0 : Q_c_OU = 0;
14733 :
14734 : // OU fan flow rate and power
14735 0 : m_air_cond = this->VRFOU_FlowRate(
14736 0 : state, HXOpMode::CondMode, Tdischarge, this->SC, Q_h_OU, state.dataEnvrn->OutDryBulbTemp, state.dataEnvrn->OutHumRat);
14737 0 : N_fan_OU_cond = this->RatedOUFanPower * m_air_cond / m_air_rated;
14738 0 : N_fan_OU_evap = 0;
14739 :
14740 : } else {
14741 0 : Ncomp = 0;
14742 0 : CompSpdActual = 0;
14743 0 : Q_c_OU = 0;
14744 0 : Q_h_OU = 0;
14745 0 : N_fan_OU_evap = 0;
14746 0 : N_fan_OU_cond = 0;
14747 : }
14748 :
14749 : // OU fan power
14750 0 : N_fan_OU = N_fan_OU_evap + N_fan_OU_cond;
14751 :
14752 : // Calculate the m_ref_OU_evap & m_ref_OU_cond, with updated Tsuction
14753 : {
14754 : Real64 h_OU_evap_in; // enthalpy of OU evaporator at inlet [kJ/kg]
14755 : Real64 h_OU_evap_out; // enthalpy of OU evaporator at outlet [kJ/kg]
14756 : Real64 h_OU_cond_in; // enthalpy of OU condenser at inlet [kJ/kg]
14757 : Real64 h_OU_cond_out; // enthalpy of OU condenser at outlet [kJ/kg]
14758 :
14759 0 : Real64 Psuction = this->refrig->getSatPressure(state, Tsuction, RoutineName);
14760 :
14761 : // enthalpy of OU evaporator/condenser inlets and outlets
14762 0 : h_OU_evap_in = h_IU_evap_in;
14763 0 : h_OU_cond_in = h_comp_out;
14764 0 : h_OU_evap_out = this->refrig->getSupHeatEnthalpy(state, Tsuction + this->SH, max(min(Psuction, RefPHigh), RefPLow), RoutineName);
14765 0 : h_OU_cond_out = this->refrig->getSatEnthalpy(state, Tdischarge - this->SC, 0.0, RoutineName);
14766 :
14767 0 : if ((Q_c_OU == 0) || (h_OU_evap_out - h_OU_evap_in) <= 0) {
14768 0 : m_ref_OU_evap = 0;
14769 : } else {
14770 0 : m_ref_OU_evap = Q_c_OU / (h_OU_evap_out - h_OU_evap_in);
14771 : }
14772 :
14773 0 : if ((Q_h_OU == 0) || (h_OU_cond_in - h_OU_cond_out <= 0)) {
14774 0 : m_ref_OU_cond = 0;
14775 : } else {
14776 0 : m_ref_OU_cond = Q_h_OU / (h_OU_cond_in - h_OU_cond_out);
14777 : }
14778 :
14779 : // Calculate the parameters of refrigerant at compressor inlet, which is
14780 : // a combination of refrigerant from IU evaporators and OU evaporator
14781 0 : if ((m_ref_OU_evap + m_ref_IU_evap) > 0) {
14782 0 : h_comp_in = (m_ref_OU_evap * h_OU_evap_out + m_ref_IU_evap * h_IU_PLc_out) / (m_ref_OU_evap + m_ref_IU_evap);
14783 : }
14784 : }
14785 0 : }
14786 :
14787 714534 : void VRFCondenserEquipment::VRFOU_PipeLossC(
14788 : EnergyPlusData &state,
14789 : Real64 const Pipe_m_ref, // Refrigerant mass flow rate [kg/s]
14790 : Real64 const Pevap, // VRF evaporating pressure [Pa]
14791 : Real64 const Pipe_h_IU_out, // Enthalpy of IU at outlet [kJ/kg]
14792 : Real64 const Pipe_SH_merged, // Average super heating degrees after the indoor units [C]
14793 : Real64 const OutdoorDryBulb, // outdoor dry-bulb temperature (C)
14794 : Real64 &Pipe_Q, // unit part load ratio
14795 : Real64 &Pipe_DeltP, // ratio of compressor ON airflow to AVERAGE airflow over timestep
14796 : Real64 &Pipe_h_comp_in // Piping Loss Algorithm Parameter: Enthalpy after piping loss (compressor inlet) [kJ/kg]
14797 : )
14798 : {
14799 :
14800 : // SUBROUTINE INFORMATION:
14801 : // AUTHOR Rongpeng Zhang
14802 : // DATE WRITTEN Nov 2015
14803 : // MODIFIED na
14804 : // RE-ENGINEERED na
14805 :
14806 : // PURPOSE OF THIS SUBROUTINE:
14807 : // Determine the piping loss of the refrigerant, including both the heat loss and pressure drop.
14808 : // This happens at VRF cooling mode, within the Main Pipe connecting Outdoor Unit to Indoor Units.
14809 :
14810 : // METHODOLOGY EMPLOYED:
14811 : // Use a physics based piping loss model.
14812 :
14813 : using General::SolveRoot;
14814 :
14815 : int TUListNum; // index to TU List
14816 : int NumTUInList; // number of terminal units is list
14817 : int NumIUActivated; // number of the used indoor units [-]
14818 :
14819 : Real64 Pipe_v_ref; // Piping Loss Algorithm Parameter: Refrigerant velocity [m/s]
14820 : Real64 Pipe_T_room; // Piping Loss Algorithm Parameter: Average Room Temperature [C]
14821 : Real64 Pipe_Num_Re; // Piping Loss Algorithm Parameter: refrigerant Re Number [-]
14822 : Real64 Pipe_Num_Pr; // Piping Loss Algorithm Parameter: refrigerant Pr Number [-]
14823 : Real64 Pipe_Num_Nu; // Piping Loss Algorithm Parameter: refrigerant Nu Number [-]
14824 : Real64 Pipe_Num_St; // Piping Loss Algorithm Parameter: refrigerant St Number [-]
14825 : Real64 Pipe_Coe_k1; // Piping Loss Algorithm Parameter: coefficients [-]
14826 : Real64 Pipe_Coe_k2; // Piping Loss Algorithm Parameter: coefficients [-]
14827 : Real64 Pipe_Coe_k3; // Piping Loss Algorithm Parameter: coefficients [-]
14828 : Real64 Pipe_cp_ref; // Piping Loss Algorithm_[kJ/kg/K]
14829 : Real64 Pipe_conductivity_ref; // Piping Loss Algorithm: refrigerant conductivity [W/m/K]
14830 : Real64 Pipe_viscosity_ref; // Piping Loss Algorithm Parameter: refrigerant viscosity [MuPa*s]
14831 : Real64 Ref_Coe_v1; // Piping Loss Algorithm Parameter: coefficient to calculate Pipe_viscosity_ref [-]
14832 : Real64 Ref_Coe_v2; // Piping Loss Algorithm Parameter: coefficient to calculate Pipe_viscosity_ref [-]
14833 : Real64 Ref_Coe_v3; // Piping Loss Algorithm Parameter: coefficient to calculate Pipe_viscosity_ref [-]
14834 : Real64 RefPipInsH; // Heat transfer coefficient for calculating piping loss [W/m2K]
14835 :
14836 : static constexpr std::string_view RoutineName("VRFOU_PipeLossC");
14837 :
14838 714534 : TUListNum = this->ZoneTUListPtr;
14839 714534 : NumTUInList = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList;
14840 714534 : Pipe_conductivity_ref = this->RefPipInsCon;
14841 :
14842 714534 : RefPipInsH = 9.3;
14843 714534 : Pipe_cp_ref = 1.6;
14844 :
14845 : // Refrigerant data
14846 714534 : Real64 RefPLow = this->refrig->PsLowPresValue; // Low Pressure Value for Ps (>0.0)
14847 714534 : Real64 RefPHigh = this->refrig->PsHighPresValue; // High Pressure Value for Ps (max in tables)
14848 :
14849 : // Calculate Pipe_T_room
14850 714534 : Pipe_T_room = 0;
14851 714534 : NumIUActivated = 0;
14852 3738764 : for (int NumTU = 1; NumTU <= NumTUInList; ++NumTU) {
14853 3024230 : int TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU);
14854 3024230 : int CoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex;
14855 :
14856 3024230 : if (state.dataDXCoils->DXCoil(CoilIndex).TotalCoolingEnergyRate > 0.0) {
14857 2894033 : Pipe_T_room = Pipe_T_room + state.dataDXCoils->DXCoil(CoilIndex).InletAirTemp;
14858 2894033 : NumIUActivated = NumIUActivated + 1;
14859 : }
14860 : }
14861 714534 : if (NumIUActivated > 0)
14862 714534 : Pipe_T_room = Pipe_T_room / NumIUActivated;
14863 : else
14864 0 : Pipe_T_room = 24;
14865 :
14866 714534 : if (Pipe_m_ref > 0) {
14867 714534 : if (this->RefPipDiaSuc <= 0) this->RefPipDiaSuc = 0.025;
14868 :
14869 714534 : Ref_Coe_v1 = Pevap / 1000000 / 4.926;
14870 714534 : Ref_Coe_v2 = Pipe_h_IU_out / 383.5510343;
14871 714534 : Ref_Coe_v3 = (this->EvaporatingTemp + Pipe_SH_merged + 273.15) / 344.39;
14872 :
14873 714534 : Pipe_viscosity_ref = 4.302 * Ref_Coe_v1 + 0.81622 * pow_2(Ref_Coe_v1) - 120.98 * Ref_Coe_v2 + 139.17 * pow_2(Ref_Coe_v2) +
14874 714534 : 118.76 * Ref_Coe_v3 + 81.04 * pow_2(Ref_Coe_v3) + 5.7858 * Ref_Coe_v1 * Ref_Coe_v2 - 8.3817 * Ref_Coe_v1 * Ref_Coe_v3 -
14875 714534 : 218.48 * Ref_Coe_v2 * Ref_Coe_v3 + 21.58;
14876 714534 : if (Pipe_viscosity_ref <= 0) Pipe_viscosity_ref = 16.26; // default superheated vapor viscosity data (MuPa*s) at T=353.15 K, P=2MPa
14877 :
14878 714534 : Pipe_v_ref = Pipe_m_ref / (Constant::Pi * pow_2(this->RefPipDiaSuc) * 0.25) /
14879 714534 : this->refrig->getSupHeatDensity(state, this->EvaporatingTemp + Pipe_SH_merged, max(min(Pevap, RefPHigh), RefPLow), RoutineName);
14880 714534 : Pipe_Num_Re = Pipe_m_ref / (Constant::Pi * pow_2(this->RefPipDiaSuc) * 0.25) * this->RefPipDiaSuc / Pipe_viscosity_ref * 1000000;
14881 714534 : Pipe_Num_Pr = Pipe_viscosity_ref * Pipe_cp_ref * 0.001 / Pipe_conductivity_ref;
14882 714534 : Pipe_Num_Nu = 0.023 * std::pow(Pipe_Num_Re, 0.8) * std::pow(Pipe_Num_Pr, 0.3);
14883 714534 : Pipe_Num_St = Pipe_Num_Nu / Pipe_Num_Re / Pipe_Num_Pr;
14884 :
14885 1429068 : Pipe_DeltP = max(
14886 : 0.0,
14887 1429068 : 8 * Pipe_Num_St * std::pow(Pipe_Num_Pr, 0.6667) * this->RefPipEquLen / this->RefPipDiaSuc *
14888 714534 : this->refrig->getSupHeatDensity(state, this->EvaporatingTemp + Pipe_SH_merged, max(min(Pevap, RefPHigh), RefPLow), RoutineName) *
14889 714534 : pow_2(Pipe_v_ref) / 2 -
14890 1429068 : this->RefPipHei *
14891 714534 : this->refrig->getSupHeatDensity(state, this->EvaporatingTemp + Pipe_SH_merged, max(min(Pevap, RefPHigh), RefPLow), RoutineName) *
14892 : 9.80665);
14893 :
14894 714534 : Pipe_Coe_k1 = Pipe_Num_Nu * Pipe_viscosity_ref;
14895 714534 : Pipe_Coe_k3 = RefPipInsH * (this->RefPipDiaSuc + 2 * this->RefPipInsThi);
14896 714534 : if (this->RefPipInsThi >= 0.0) {
14897 714534 : Pipe_Coe_k2 = 2 * this->RefPipInsCon / std::log(1.0 + 2 * this->RefPipInsThi / this->RefPipDiaSuc);
14898 : } else {
14899 0 : Pipe_Coe_k2 = 9999.9;
14900 : }
14901 :
14902 1429068 : Pipe_Q = max(0.0,
14903 714534 : (Constant::Pi * this->RefPipLen) * (OutdoorDryBulb / 2 + Pipe_T_room / 2 - this->EvaporatingTemp - Pipe_SH_merged) /
14904 714534 : (1 / Pipe_Coe_k1 + 1 / Pipe_Coe_k2 + 1 / Pipe_Coe_k3));
14905 :
14906 714534 : Pipe_h_comp_in = Pipe_h_IU_out + Pipe_Q / Pipe_m_ref;
14907 :
14908 : } else {
14909 0 : Pipe_DeltP = 0;
14910 0 : Pipe_Q = 0;
14911 0 : Pipe_h_comp_in = Pipe_h_IU_out;
14912 : }
14913 714534 : }
14914 :
14915 13348 : void VRFCondenserEquipment::VRFOU_PipeLossH(
14916 : EnergyPlusData &state,
14917 : Real64 const Pipe_m_ref, // Refrigerant mass flow rate [kg/s]
14918 : Real64 const Pcond, // VRF condensing pressure [Pa]
14919 : Real64 const Pipe_h_IU_in, // Enthalpy of IU at outlet [kJ/kg]
14920 : Real64 const OutdoorDryBulb, // outdoor dry-bulb temperature (C)
14921 : Real64 &Pipe_Q, // unit part load ratio
14922 : Real64 &Pipe_DeltP, // ratio of compressor ON airflow to AVERAGE airflow over timestep
14923 : Real64 &Pipe_h_comp_out // Piping Loss Algorithm Parameter: Enthalpy before piping loss (compressor outlet) [kJ/kg]
14924 : ) const
14925 : {
14926 :
14927 : // SUBROUTINE INFORMATION:
14928 : // AUTHOR Rongpeng Zhang
14929 : // DATE WRITTEN Nov 2015
14930 : // MODIFIED na
14931 : // RE-ENGINEERED na
14932 :
14933 : // PURPOSE OF THIS SUBROUTINE:
14934 : // Determine the piping loss of the refrigerant, including both the heat loss and pressure drop.
14935 : // This happens at VRF cooling mode, within the Main Pipe connecting Outdoor Unit to Indoor Units.
14936 :
14937 : // METHODOLOGY EMPLOYED:
14938 : // Use a physics based piping loss model.
14939 :
14940 : using General::SolveRoot;
14941 :
14942 : int TUListNum; // index to TU List
14943 : int NumTUInList; // number of terminal units is list
14944 : int NumIUActivated; // number of the used indoor units [-]
14945 :
14946 : Real64 Pipe_v_ref; // Piping Loss Algorithm Parameter: Refrigerant velocity [m/s]
14947 : Real64 Pipe_T_room; // Piping Loss Algorithm Parameter: Average Room Temperature [C]
14948 : Real64 Pipe_T_IU_in; // Piping Loss Algorithm Parameter: Average Refrigerant Temperature [C]
14949 : Real64 Pipe_Num_Re; // Piping Loss Algorithm Parameter: refrigerant Re Number [-]
14950 : Real64 Pipe_Num_Pr; // Piping Loss Algorithm Parameter: refrigerant Pr Number [-]
14951 : Real64 Pipe_Num_Nu; // Piping Loss Algorithm Parameter: refrigerant Nu Number [-]
14952 : Real64 Pipe_Num_St; // Piping Loss Algorithm Parameter: refrigerant St Number [-]
14953 : Real64 Pipe_Coe_k1; // Piping Loss Algorithm Parameter: coefficients [-]
14954 : Real64 Pipe_Coe_k2; // Piping Loss Algorithm Parameter: coefficients [-]
14955 : Real64 Pipe_Coe_k3; // Piping Loss Algorithm Parameter: coefficients [-]
14956 : Real64 Pipe_cp_ref; // Piping Loss Algorithm_[kJ/kg/K]
14957 : Real64 Pipe_conductivity_ref; // Piping Loss Algorithm: refrigerant conductivity [W/m/K]
14958 : Real64 Pipe_viscosity_ref; // Piping Loss Algorithm Parameter: refrigerant viscosity [MuPa*s]
14959 : Real64 Ref_Coe_v1; // Piping Loss Algorithm Parameter: coefficient to calculate Pipe_viscosity_ref [-]
14960 : Real64 Ref_Coe_v2; // Piping Loss Algorithm Parameter: coefficient to calculate Pipe_viscosity_ref [-]
14961 : Real64 Ref_Coe_v3; // Piping Loss Algorithm Parameter: coefficient to calculate Pipe_viscosity_ref [-]
14962 : Real64 RefPipInsH; // Heat transfer coefficient for calculating piping loss [W/m2K]
14963 :
14964 : static constexpr std::string_view RoutineName("VRFOU_PipeLossH");
14965 :
14966 13348 : TUListNum = this->ZoneTUListPtr;
14967 13348 : NumTUInList = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList;
14968 13348 : Pipe_conductivity_ref = this->RefPipInsCon;
14969 :
14970 13348 : RefPipInsH = 9.3;
14971 13348 : Pipe_cp_ref = 1.6;
14972 :
14973 : // Refrigerant data
14974 13348 : Real64 RefTHigh = this->refrig->PsHighTempValue; // High Temperature Value for Ps (max in tables)
14975 13348 : Real64 RefPLow = this->refrig->PsLowPresValue; // Low Pressure Value for Ps (>0.0)
14976 13348 : Real64 RefPHigh = this->refrig->PsHighPresValue; // High Pressure Value for Ps (max in tables)
14977 13348 : Real64 RefTSat = this->refrig->getSatTemperature(state, max(min(Pcond, RefPHigh), RefPLow), RoutineName);
14978 :
14979 : // Perform iteration to calculate Pipe_T_IU_in, given P and h
14980 13348 : Pipe_T_IU_in = this->refrig->getSupHeatTemp(state,
14981 : max(min(Pcond, RefPHigh), RefPLow),
14982 : Pipe_h_IU_in,
14983 13348 : max(this->IUCondensingTemp, RefTSat),
14984 13348 : min(this->IUCondensingTemp + 50, RefTHigh),
14985 : RoutineName);
14986 13348 : Pipe_T_IU_in = min(RefTHigh, Pipe_T_IU_in);
14987 :
14988 : // Calculate average room temperature
14989 13348 : Pipe_T_room = 0;
14990 13348 : NumIUActivated = 0;
14991 71668 : for (int NumTU = 1; NumTU <= NumTUInList; ++NumTU) {
14992 58320 : int TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU);
14993 58320 : int CoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatCoilIndex;
14994 :
14995 58320 : if (state.dataDXCoils->DXCoil(CoilIndex).TotalHeatingEnergyRate > 0.0) {
14996 57951 : Pipe_T_room = Pipe_T_room + state.dataDXCoils->DXCoil(CoilIndex).InletAirTemp;
14997 57951 : NumIUActivated = NumIUActivated + 1;
14998 : }
14999 : }
15000 13348 : if (NumIUActivated > 0)
15001 13348 : Pipe_T_room = Pipe_T_room / NumIUActivated;
15002 : else
15003 0 : Pipe_T_room = 18;
15004 :
15005 : // Calculate piping loss
15006 13348 : if (Pipe_m_ref > 0) {
15007 13348 : Ref_Coe_v1 = Pcond / 1000000 / 4.926;
15008 13348 : Ref_Coe_v2 = Pipe_h_IU_in / 383.5510343;
15009 13348 : Ref_Coe_v3 = (Pipe_T_IU_in + 273.15) / 344.39;
15010 13348 : Pipe_viscosity_ref = 4.302 * Ref_Coe_v1 + 0.81622 * pow_2(Ref_Coe_v1) - 120.98 * Ref_Coe_v2 + 139.17 * pow_2(Ref_Coe_v2) +
15011 13348 : 118.76 * Ref_Coe_v3 + 81.04 * pow_2(Ref_Coe_v3) + 5.7858 * Ref_Coe_v1 * Ref_Coe_v2 - 8.3817 * Ref_Coe_v1 * Ref_Coe_v3 -
15012 13348 : 218.48 * Ref_Coe_v2 * Ref_Coe_v3 + 21.58;
15013 13348 : if (Pipe_viscosity_ref <= 0) Pipe_viscosity_ref = 16.26; // default superheated vapor viscosity data (MuPa*s) at T=353.15 K, P=2MPa
15014 :
15015 13348 : Pipe_v_ref = Pipe_m_ref / (Constant::Pi * pow_2(this->RefPipDiaDis) * 0.25) /
15016 13348 : this->refrig->getSupHeatDensity(state, Pipe_T_IU_in, max(min(Pcond, RefPHigh), RefPLow), RoutineName);
15017 13348 : Pipe_Num_Re = Pipe_m_ref / (Constant::Pi * pow_2(this->RefPipDiaDis) * 0.25) * this->RefPipDiaDis / Pipe_viscosity_ref * 1000000;
15018 13348 : Pipe_Num_Pr = Pipe_viscosity_ref * Pipe_cp_ref * 0.001 / Pipe_conductivity_ref;
15019 13348 : Pipe_Num_Nu = 0.023 * std::pow(Pipe_Num_Re, 0.8) * std::pow(Pipe_Num_Pr, 0.4);
15020 13348 : Pipe_Num_St = Pipe_Num_Nu / Pipe_Num_Re / Pipe_Num_Pr;
15021 :
15022 13348 : Pipe_Coe_k1 = Pipe_Num_Nu * Pipe_viscosity_ref;
15023 13348 : Pipe_Coe_k2 = this->RefPipInsCon * (this->RefPipDiaDis + this->RefPipInsThi) / this->RefPipInsThi;
15024 13348 : Pipe_Coe_k3 = RefPipInsH * (this->RefPipDiaDis + 2 * this->RefPipInsThi);
15025 :
15026 26696 : Pipe_Q = max(0.0,
15027 13348 : (Constant::Pi * this->RefPipLen) * (Pipe_T_IU_in - OutdoorDryBulb / 2 - Pipe_T_room / 2) /
15028 13348 : (1 / Pipe_Coe_k1 + 1 / Pipe_Coe_k2 + 1 / Pipe_Coe_k3)); // [W]
15029 26696 : Pipe_DeltP = max(
15030 : 0.0,
15031 26696 : 8 * Pipe_Num_St * std::pow(Pipe_Num_Pr, 0.6667) * this->RefPipEquLen / this->RefPipDiaDis *
15032 13348 : this->refrig->getSupHeatDensity(state, Pipe_T_IU_in, max(min(Pcond, RefPHigh), RefPLow), RoutineName) * pow_2(Pipe_v_ref) / 2 -
15033 13348 : this->RefPipHei * this->refrig->getSupHeatDensity(state, Pipe_T_IU_in, max(min(Pcond, RefPHigh), RefPLow), RoutineName) * 9.80665);
15034 :
15035 13348 : Pipe_h_comp_out = Pipe_h_IU_in + Pipe_Q / Pipe_m_ref;
15036 :
15037 : } else {
15038 0 : Pipe_DeltP = 0;
15039 0 : Pipe_Q = 0;
15040 0 : Pipe_h_comp_out = Pipe_h_IU_in;
15041 : }
15042 13348 : }
15043 0 : void VRFCondenserEquipment::oneTimeInit([[maybe_unused]] EnergyPlusData &state)
15044 : {
15045 0 : }
15046 1 : void VRFCondenserEquipment::oneTimeInit_new([[maybe_unused]] EnergyPlusData &state)
15047 : {
15048 1 : }
15049 :
15050 383635 : void VRFTerminalUnitEquipment::CalcVRFSuppHeatingCoil(EnergyPlusData &state,
15051 : int const VRFTUNum, // index of vrf terminal unit
15052 : bool const FirstHVACIteration, // True when first HVAC iteration
15053 : Real64 const PartLoadRatio, // coil operating part-load ratio
15054 : Real64 &SuppCoilLoad // supp heating coil load max (W)
15055 : )
15056 : {
15057 :
15058 : // PURPOSE OF THIS SUBROUTINE:
15059 : // Manages VRF terminal unit supplemental heaters simulation.
15060 :
15061 : // Locals
15062 : // subroutine parameter definitions:
15063 383635 : int constexpr MaxIte(500); // Maximum number of iterations for solver
15064 383635 : Real64 constexpr Acc(1.e-3); // Accuracy of solver result
15065 :
15066 : // local variable declaration:
15067 : Real64 SuppHeatCoilLoad; // load passed to supplemental heating coil (W)
15068 : Real64 QActual; // actual coil output (W)
15069 : Real64 PartLoadFrac; // temporary PLR variable
15070 :
15071 383635 : QActual = 0.0;
15072 383635 : PartLoadFrac = 0.0;
15073 383635 : SuppHeatCoilLoad = 0.0;
15074 :
15075 : // simulate gas, electric, hot water, and steam heating coils
15076 383635 : if (state.dataEnvrn->OutDryBulbTemp <= this->MaxOATSuppHeatingCoil) {
15077 115583 : SuppHeatCoilLoad = SuppCoilLoad;
15078 : } else {
15079 268052 : SuppHeatCoilLoad = 0.0;
15080 : }
15081 :
15082 383635 : switch (this->SuppHeatCoilType_Num) {
15083 244344 : case HVAC::Coil_HeatingGasOrOtherFuel:
15084 : case HVAC::Coil_HeatingElectric: {
15085 977376 : HeatingCoils::SimulateHeatingCoilComponents(
15086 733032 : state, this->SuppHeatCoilName, FirstHVACIteration, SuppHeatCoilLoad, this->SuppHeatCoilIndex, QActual, true, this->fanOp, PartLoadRatio);
15087 244344 : SuppHeatCoilLoad = QActual;
15088 244344 : } break;
15089 70846 : case HVAC::Coil_HeatingWater: {
15090 70846 : if (SuppHeatCoilLoad > HVAC::SmallLoad) {
15091 : // see if HW coil has enough capacity to meet the load
15092 1342 : Real64 mdot = this->SuppHeatCoilFluidMaxFlow;
15093 1342 : state.dataLoopNodes->Node(this->SuppHeatCoilFluidInletNode).MassFlowRate = mdot;
15094 : // simulate hot water coil to find the full flow operating capacity
15095 4026 : WaterCoils::SimulateWaterCoilComponents(
15096 2684 : state, this->SuppHeatCoilName, FirstHVACIteration, this->SuppHeatCoilIndex, QActual, this->fanOp, PartLoadRatio);
15097 1342 : if (QActual > SuppHeatCoilLoad) {
15098 : int SolFla; // Flag of solver, num iterations if >0, else error index
15099 150304 : auto f = [&state, VRFTUNum, FirstHVACIteration, SuppHeatCoilLoad](Real64 const PartLoadFrac) {
15100 10736 : Real64 QActual = 0.0; // actual heating load delivered [W]
15101 10736 : Real64 mdot = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow * PartLoadFrac;
15102 10736 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode).MassFlowRate = mdot;
15103 32208 : WaterCoils::SimulateWaterCoilComponents(state,
15104 10736 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName,
15105 : FirstHVACIteration,
15106 10736 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilIndex,
15107 : QActual,
15108 10736 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOp,
15109 : PartLoadFrac);
15110 10736 : if (std::abs(SuppHeatCoilLoad) == 0.0) {
15111 0 : return (QActual - SuppHeatCoilLoad) / 100.0;
15112 : } else {
15113 10736 : return (QActual - SuppHeatCoilLoad) / SuppHeatCoilLoad;
15114 : }
15115 1342 : };
15116 1342 : General::SolveRoot(state, Acc, MaxIte, SolFla, PartLoadFrac, f, 0.0, 1.0);
15117 1342 : this->SuppHeatPartLoadRatio = PartLoadFrac;
15118 : } else {
15119 0 : this->SuppHeatPartLoadRatio = 1.0;
15120 0 : SuppHeatCoilLoad = QActual;
15121 : }
15122 : } else {
15123 69504 : this->SuppHeatPartLoadRatio = 0.0;
15124 69504 : Real64 mdot = 0.0;
15125 69504 : SuppHeatCoilLoad = 0.0;
15126 69504 : PlantUtilities::SetComponentFlowRate(
15127 69504 : state, mdot, this->SuppHeatCoilFluidInletNode, this->SuppHeatCoilFluidOutletNode, this->SuppHeatCoilPlantLoc);
15128 : }
15129 : // simulate water heating coil
15130 141692 : WaterCoils::SimulateWaterCoilComponents(
15131 141692 : state, this->SuppHeatCoilName, FirstHVACIteration, this->SuppHeatCoilIndex, SuppHeatCoilLoad, this->fanOp, this->SuppHeatPartLoadRatio);
15132 70846 : } break;
15133 68445 : case HVAC::Coil_HeatingSteam: {
15134 : // simulate steam heating coil
15135 68445 : Real64 mdot = this->SuppHeatCoilFluidMaxFlow * PartLoadRatio;
15136 68445 : state.dataLoopNodes->Node(this->SuppHeatCoilFluidInletNode).MassFlowRate = mdot;
15137 205335 : SteamCoils::SimulateSteamCoilComponents(
15138 136890 : state, this->SuppHeatCoilName, FirstHVACIteration, this->SuppHeatCoilIndex, SuppHeatCoilLoad, QActual, this->fanOp, PartLoadRatio);
15139 68445 : SuppHeatCoilLoad = QActual;
15140 68445 : } break;
15141 0 : default:
15142 0 : break;
15143 : }
15144 :
15145 383635 : SuppCoilLoad = SuppHeatCoilLoad;
15146 383635 : }
15147 :
15148 0 : Real64 VRFTerminalUnitEquipment::HotWaterHeatingCoilResidual(EnergyPlusData &state,
15149 : Real64 const PartLoadFrac, // water heating coil part-load ratio
15150 : std::vector<Real64> const &Par // par(1) = index to current VRF terminal unit
15151 : )
15152 : {
15153 :
15154 : // PURPOSE OF THIS FUNCTION:
15155 : // Calculates supplemental hot water heating coils load fraction residual [(QActual - Load)/Load]
15156 : // hot water Coil output depends on the part load ratio which is being varied to drive the load
15157 : // fraction residual to zero.
15158 :
15159 : // METHODOLOGY EMPLOYED:
15160 : // runs Coil:Heating:Water component object to get the actual heating load delivered [W] at a
15161 : // given part load ratio and calculates the residual as defined above
15162 :
15163 : // Return value
15164 : Real64 Residuum; // Residual to be minimized to zero
15165 :
15166 : // local variables declaration:
15167 0 : int VRFTUNum = int(Par[1]); // index to current terminal unit simulated
15168 0 : bool FirstHVACIteration = Par[2]; // 0 flag if it first HVAC iteration, or else 1
15169 0 : Real64 SuppHeatCoilLoad = Par[3]; // supplemental heating coil load to be met [W]
15170 0 : Real64 QActual = 0.0; // actual heating load delivered [W]
15171 :
15172 : // Real64 mdot = min(state.dataLoopNodes->Node(VRFTU(VRFTUNum).SuppHeatCoilFluidOutletNode).MassFlowRateMaxAvail,
15173 : // VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow * PartLoadFrac);
15174 :
15175 0 : Real64 mdot = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow * PartLoadFrac;
15176 0 : state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode).MassFlowRate = mdot;
15177 0 : WaterCoils::SimulateWaterCoilComponents(state,
15178 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName,
15179 : FirstHVACIteration,
15180 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilIndex,
15181 : QActual,
15182 0 : state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOp,
15183 : PartLoadFrac);
15184 :
15185 0 : if (std::abs(SuppHeatCoilLoad) == 0.0) {
15186 0 : Residuum = (QActual - SuppHeatCoilLoad) / 100.0;
15187 : } else {
15188 0 : Residuum = (QActual - SuppHeatCoilLoad) / SuppHeatCoilLoad;
15189 : }
15190 :
15191 0 : return Residuum;
15192 : }
15193 :
15194 0 : Real64 VRFTerminalUnitEquipment::HeatingCoilCapacityLimit(
15195 : EnergyPlusData &state,
15196 : Real64 const HeatCoilAirInletNode, // supplemental heating coil air inlet node
15197 : Real64 const HeatCoilMaxSATAllowed // supplemental heating coil maximum supply air temperature allowed [C]
15198 : )
15199 : {
15200 : // PURPOSE OF THIS FUNCTION:
15201 : // Calculates supplemental heating coils maximum heating capacity allowed based on the maximum
15202 : // supply air temperature limit specified.
15203 :
15204 : // METHODOLOGY EMPLOYED:
15205 : // ( m_dot_air * Cp_air_avg * DeltaT_air_across_heating_coil) [W]
15206 :
15207 : // Return value
15208 : Real64 HeatCoilCapacityAllowed; // heating coil maximum capacity that can be delivered at current time [W]
15209 :
15210 0 : Real64 MDotAir = state.dataLoopNodes->Node(HeatCoilAirInletNode).MassFlowRate;
15211 0 : Real64 CpAirIn = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(HeatCoilAirInletNode).HumRat);
15212 0 : Real64 HCDeltaT = max(0.0, HeatCoilMaxSATAllowed - state.dataLoopNodes->Node(HeatCoilAirInletNode).Temp);
15213 0 : HeatCoilCapacityAllowed = MDotAir * CpAirIn * HCDeltaT;
15214 :
15215 0 : return HeatCoilCapacityAllowed;
15216 : }
15217 :
15218 : } // namespace EnergyPlus::HVACVariableRefrigerantFlow
|