Line data Source code
1 : // EnergyPlus, Copyright (c) 1996-2023, The Board of Trustees of the University of Illinois,
2 : // The Regents of the University of California, through Lawrence Berkeley National Laboratory
3 : // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
4 : // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
5 : // contributors. All rights reserved.
6 : //
7 : // NOTICE: This Software was developed under funding from the U.S. Department of Energy and the
8 : // U.S. Government consequently retains certain rights. As such, the U.S. Government has been
9 : // granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable,
10 : // worldwide license in the Software to reproduce, distribute copies to the public, prepare
11 : // derivative works, and perform publicly and display publicly, and to permit others to do so.
12 : //
13 : // Redistribution and use in source and binary forms, with or without modification, are permitted
14 : // provided that the following conditions are met:
15 : //
16 : // (1) Redistributions of source code must retain the above copyright notice, this list of
17 : // conditions and the following disclaimer.
18 : //
19 : // (2) Redistributions in binary form must reproduce the above copyright notice, this list of
20 : // conditions and the following disclaimer in the documentation and/or other materials
21 : // provided with the distribution.
22 : //
23 : // (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory,
24 : // the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be
25 : // used to endorse or promote products derived from this software without specific prior
26 : // written permission.
27 : //
28 : // (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form
29 : // without changes from the version obtained under this License, or (ii) Licensee makes a
30 : // reference solely to the software portion of its product, Licensee must refer to the
31 : // software as "EnergyPlus version X" software, where "X" is the version number Licensee
32 : // obtained under this License and may not use a different name for the software. Except as
33 : // specifically required in this Section (4), Licensee shall not use in a company name, a
34 : // product name, in advertising, publicity, or other promotional activities any name, trade
35 : // name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly
36 : // similar designation, without the U.S. Department of Energy's prior written consent.
37 : //
38 : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
39 : // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
40 : // AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
41 : // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
42 : // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
43 : // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
44 : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
45 : // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
46 : // POSSIBILITY OF SUCH DAMAGE.
47 :
48 : // C++ headers
49 : #include <string>
50 :
51 : // EnergyPlus headers
52 : #include <AirflowNetwork/Solver.hpp>
53 : #include <EnergyPlus/Autosizing/All_Simple_Sizing.hh>
54 : #include <EnergyPlus/Autosizing/CoolingAirFlowSizing.hh>
55 : #include <EnergyPlus/Autosizing/CoolingCapacitySizing.hh>
56 : #include <EnergyPlus/Autosizing/HeatingAirFlowSizing.hh>
57 : #include <EnergyPlus/Autosizing/HeatingCapacitySizing.hh>
58 : #include <EnergyPlus/Autosizing/SystemAirFlowSizing.hh>
59 : #include <EnergyPlus/BranchInputManager.hh>
60 : #include <EnergyPlus/BranchNodeConnections.hh>
61 : #include <EnergyPlus/Coils/CoilCoolingDX.hh>
62 : #include <EnergyPlus/DXCoils.hh>
63 : #include <EnergyPlus/Data/EnergyPlusData.hh>
64 : #include <EnergyPlus/DataHVACControllers.hh>
65 : #include <EnergyPlus/DataHVACGlobals.hh>
66 : #include <EnergyPlus/DataHVACSystems.hh>
67 : #include <EnergyPlus/DataHeatBalFanSys.hh>
68 : #include <EnergyPlus/DataHeatBalance.hh>
69 : #include <EnergyPlus/DataSizing.hh>
70 : #include <EnergyPlus/DataZoneControls.hh>
71 : #include <EnergyPlus/DataZoneEnergyDemands.hh>
72 : #include <EnergyPlus/DataZoneEquipment.hh>
73 : #include <EnergyPlus/EMSManager.hh>
74 : #include <EnergyPlus/Fans.hh>
75 : #include <EnergyPlus/FaultsManager.hh>
76 : #include <EnergyPlus/FluidProperties.hh>
77 : #include <EnergyPlus/General.hh>
78 : #include <EnergyPlus/GeneralRoutines.hh>
79 : #include <EnergyPlus/HVACFan.hh>
80 : #include <EnergyPlus/HVACHXAssistedCoolingCoil.hh>
81 : #include <EnergyPlus/HeatingCoils.hh>
82 : #include <EnergyPlus/InputProcessing/InputProcessor.hh>
83 : #include <EnergyPlus/MixedAir.hh>
84 : #include <EnergyPlus/NodeInputManager.hh>
85 : #include <EnergyPlus/PackagedThermalStorageCoil.hh>
86 : #include <EnergyPlus/Plant/DataPlant.hh>
87 : #include <EnergyPlus/PlantUtilities.hh>
88 : #include <EnergyPlus/Psychrometrics.hh>
89 : #include <EnergyPlus/ReportCoilSelection.hh>
90 : #include <EnergyPlus/SZVAVModel.hh>
91 : #include <EnergyPlus/ScheduleManager.hh>
92 : #include <EnergyPlus/SetPointManager.hh>
93 : #include <EnergyPlus/SimAirServingZones.hh>
94 : #include <EnergyPlus/SingleDuct.hh>
95 : #include <EnergyPlus/SteamCoils.hh>
96 : #include <EnergyPlus/UnitarySystem.hh>
97 : #include <EnergyPlus/UserDefinedComponents.hh>
98 : #include <EnergyPlus/UtilityRoutines.hh>
99 : #include <EnergyPlus/VariableSpeedCoils.hh>
100 : #include <EnergyPlus/WaterCoils.hh>
101 : #include <EnergyPlus/WaterToAirHeatPump.hh>
102 : #include <EnergyPlus/WaterToAirHeatPumpSimple.hh>
103 : #include <EnergyPlus/ZonePlenum.hh>
104 : #include <EnergyPlus/ZoneTempPredictorCorrector.hh>
105 :
106 : namespace EnergyPlus {
107 : namespace UnitarySystems {
108 :
109 : // Coil type for SimWater and SimSteamCoil
110 : int constexpr CoolingCoil = 0;
111 : int constexpr HeatingCoil = 1;
112 : int constexpr SuppHeatCoil = 2;
113 :
114 : static constexpr std::string_view fluidNameSteam("STEAM");
115 : static constexpr std::string_view blankString("");
116 771 : static const std::string blankStdString("");
117 :
118 6060022 : void UnitarySys::simulate(EnergyPlusData &state,
119 : std::string_view Name,
120 : bool const FirstHVACIteration,
121 : int const AirLoopNum,
122 : int &CompIndex,
123 : bool &HeatActive,
124 : bool &CoolActive,
125 : int const ZoneOAUnitNum,
126 : Real64 const OAUCoilOutTemp,
127 : bool const ZoneEquipment,
128 : Real64 &sysOutputProvided,
129 : Real64 &latOutputProvided)
130 : {
131 6060022 : DataHVACGlobals::CompressorOperation CompressorOn = DataHVACGlobals::CompressorOperation::Off;
132 :
133 : // Obtains and Allocates unitary system related parameters from input file
134 6060022 : if (this->m_ThisSysInputShouldBeGotten) {
135 479 : getUnitarySystemInput(state, Name, ZoneEquipment, ZoneOAUnitNum);
136 : }
137 6060022 : CompIndex = this->m_EquipCompNum;
138 6060022 : state.dataUnitarySystems->FanSpeedRatio = 1.0;
139 6060022 : this->initUnitarySystems(state, AirLoopNum, FirstHVACIteration, ZoneOAUnitNum, OAUCoilOutTemp);
140 6060022 : if (!this->m_OKToPrintSizing) return;
141 :
142 : // MassFlowRateMaxAvail issues are impeding non-VAV air loop equipment by limiting air flow
143 : // temporarily open up flow limits while simulating, and then set this same value at the INLET after this parent has simulated
144 6060022 : Real64 tempMassFlowRateMaxAvail = state.dataLoopNodes->Node(this->AirInNode).MassFlowRateMaxAvail;
145 : // this is not working for CoilSystem simulated with UnitarySystem. Try to protect when this happens.
146 6060022 : if (AirLoopNum > 0 && this->m_ControlType != UnitarySysCtrlType::Setpoint) {
147 1246944 : state.dataLoopNodes->Node(this->AirInNode).MassFlowRateMaxAvail = this->m_DesignMassFlowRate;
148 : }
149 :
150 6060022 : bool HXUnitOn = false;
151 6060022 : if (this->m_ControlType == UnitarySysCtrlType::Setpoint) {
152 3559166 : this->controlUnitarySystemtoSP(
153 : state, AirLoopNum, FirstHVACIteration, CompressorOn, OAUCoilOutTemp, HXUnitOn, sysOutputProvided, latOutputProvided);
154 : } else {
155 2500856 : this->controlUnitarySystemtoLoad(
156 : state, AirLoopNum, FirstHVACIteration, CompressorOn, OAUCoilOutTemp, HXUnitOn, sysOutputProvided, latOutputProvided);
157 : }
158 :
159 : // Report the current output
160 6060022 : this->reportUnitarySystem(state, AirLoopNum);
161 :
162 : // CoolActive = false; // set in call from ZoneEquipmentManager
163 6060022 : if (this->m_CoolingPartLoadFrac * double(CompressorOn) > 0.0) CoolActive = true;
164 : // HeatActive = false; // set in call from ZoneEquipmentManager
165 6060022 : if (this->m_HeatingPartLoadFrac * double(CompressorOn) > 0.0 || this->m_SuppHeatPartLoadFrac * double(CompressorOn) > 0.0) HeatActive = true;
166 :
167 : // set econo lockout flag
168 : // If the sysem is not an equipment of Outdoor air unit
169 6060022 : if (AirLoopNum > 0 && !state.dataAirLoop->AirLoopControlInfo.empty() && this->m_AirLoopEquipment) {
170 :
171 4730329 : state.dataAirLoop->AirLoopControlInfo(AirLoopNum).ReqstEconoLockoutWithCompressor =
172 5483856 : state.dataAirLoop->AirLoopControlInfo(AirLoopNum).CanLockoutEconoWithCompressor &&
173 919672 : (this->m_HeatCompPartLoadRatio > 0.0 || this->m_SpeedRatio > 0.0 || this->m_CycRatio > 0.0);
174 :
175 4730329 : state.dataAirLoop->AirLoopControlInfo(AirLoopNum).ReqstEconoLockoutWithHeating =
176 5033414 : HeatActive && (state.dataAirLoop->AirLoopControlInfo(AirLoopNum).CanLockoutEconoWithCompressor ||
177 303085 : state.dataAirLoop->AirLoopControlInfo(AirLoopNum).CanLockoutEconoWithHeating);
178 : }
179 :
180 : // Calculate heat recovery
181 6060022 : if (this->m_HeatRecActive) {
182 0 : this->unitarySystemHeatRecovery(state);
183 : }
184 :
185 : // Coils should have been sized by now. Set this flag to false in case other equipment is downstream of Unitary System.
186 : // No, can't do this since there are other checks that need this flag (e.g., HVACManager, SetHeatToReturnAirFlag())
187 : // AirLoopControlInfo(AirLoopNum)%UnitarySys = .FALSE.
188 :
189 6060022 : if (AirLoopNum > 0 && this->m_ControlType != UnitarySysCtrlType::Setpoint) {
190 1246944 : state.dataLoopNodes->Node(this->AirInNode).MassFlowRateMaxAvail = tempMassFlowRateMaxAvail;
191 : }
192 : }
193 :
194 110 : DesignSpecMSHP *DesignSpecMSHP::factory(EnergyPlusData &state, int object_type_of_num, std::string const objectName)
195 : {
196 :
197 110 : if (state.dataUnitarySystems->getMSHPInputOnceFlag) {
198 19 : DesignSpecMSHP::getDesignSpecMSHP(state);
199 19 : state.dataUnitarySystems->getMSHPInputOnceFlag = false;
200 : }
201 316 : for (auto &dSpec : state.dataUnitarySystems->designSpecMSHP) {
202 316 : if (UtilityRoutines::SameString(dSpec.name, objectName) && dSpec.m_DesignSpecMSHPType_Num == object_type_of_num) {
203 110 : return &dSpec;
204 : }
205 : }
206 0 : ShowSevereError(state, "Design Specification MultiSpeed Heat Pump factory: Error getting inputs for system named: " + objectName);
207 0 : return nullptr;
208 : }
209 :
210 19 : void DesignSpecMSHP::getDesignSpecMSHP(EnergyPlusData &state)
211 : {
212 19 : bool errorsFound(false);
213 :
214 19 : DesignSpecMSHP::getDesignSpecMSHPdata(state, errorsFound);
215 :
216 19 : if (errorsFound) {
217 0 : ShowFatalError(state, "Design Specification MultiSpeed Heat Pump: Previous errors cause termination.");
218 : }
219 19 : }
220 :
221 19 : void DesignSpecMSHP::getDesignSpecMSHPdata(EnergyPlusData &state, bool errorsFound)
222 : {
223 38 : std::string cCurrentModuleObject = "UnitarySystemPerformance:Multispeed";
224 :
225 38 : auto const instances = state.dataInputProcessing->inputProcessor->epJSON.find(cCurrentModuleObject);
226 19 : if (instances == state.dataInputProcessing->inputProcessor->epJSON.end()) {
227 0 : errorsFound = true;
228 : } else {
229 19 : int designSpecNum = 0;
230 19 : auto &instancesValue = instances.value();
231 74 : for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) {
232 :
233 : // *************** used only to eliminate unused object warning when using only Json type getInput **********
234 55 : int TotalArgs = 0;
235 55 : int NumAlphas = 0;
236 55 : int NumNumbers = 0;
237 55 : state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, TotalArgs, NumAlphas, NumNumbers);
238 55 : int IOStatus = 0;
239 110 : Array1D_string Alphas(NumAlphas);
240 110 : Array1D<Real64> Numbers(NumNumbers, 0.0);
241 110 : Array1D_bool lNumericBlanks(NumNumbers, true);
242 110 : Array1D_bool lAlphaBlanks(NumAlphas, true);
243 110 : Array1D_string cAlphaFields(NumAlphas);
244 110 : Array1D_string cNumericFields(NumNumbers);
245 55 : state.dataInputProcessing->inputProcessor->getObjectItem(state,
246 : cCurrentModuleObject,
247 : ++designSpecNum,
248 : Alphas,
249 : NumAlphas,
250 : Numbers,
251 : NumNumbers,
252 : IOStatus,
253 : lNumericBlanks,
254 : lAlphaBlanks,
255 : cAlphaFields,
256 : cNumericFields);
257 : // **********************************************************************************************************
258 :
259 55 : auto const &fields = instance.value();
260 55 : auto const &thisObjectName = instance.key();
261 110 : DesignSpecMSHP thisDesignSpec;
262 :
263 55 : thisDesignSpec.name = UtilityRoutines::MakeUPPERCase(thisObjectName);
264 55 : thisDesignSpec.numOfSpeedHeating = fields.at("number_of_speeds_for_heating").get<int>(); // required field
265 55 : thisDesignSpec.numOfSpeedCooling = fields.at("number_of_speeds_for_cooling").get<int>(); // required field
266 55 : int maxSpeeds = max(thisDesignSpec.numOfSpeedHeating, thisDesignSpec.numOfSpeedCooling);
267 55 : thisDesignSpec.m_DesignSpecMSHPType_Num = 1; // add global int value for factory
268 :
269 55 : if (fields.find("single_mode_operation") != fields.end()) { // not required field
270 110 : std::string loc_m_SingleModeOp = UtilityRoutines::MakeUPPERCase(fields.at("single_mode_operation").get<std::string>());
271 55 : if (UtilityRoutines::SameString(loc_m_SingleModeOp, "Yes")) thisDesignSpec.m_SingleModeFlag = true;
272 : }
273 :
274 55 : if (fields.find("no_load_supply_air_flow_rate_ratio") != fields.end()) { // not required field
275 34 : thisDesignSpec.noLoadAirFlowRateRatio = fields.at("no_load_supply_air_flow_rate_ratio").get<Real64>();
276 : }
277 :
278 55 : thisDesignSpec.heatingVolFlowRatio.resize(maxSpeeds + 1);
279 55 : thisDesignSpec.coolingVolFlowRatio.resize(maxSpeeds + 1);
280 :
281 110 : auto speedFlowRatios = fields.find("flow_ratios");
282 55 : if (speedFlowRatios != fields.end()) {
283 110 : auto flowRatioArray = speedFlowRatios.value();
284 55 : int numSpeedInputs = flowRatioArray.size();
285 55 : if (numSpeedInputs >= maxSpeeds) {
286 55 : int speedNum = -1;
287 305 : for (auto flowRatio : flowRatioArray) {
288 250 : speedNum += 1;
289 500 : auto m_CoolingSpeedRatioObject = flowRatio.at("cooling_speed_supply_air_flow_ratio");
290 250 : if (m_CoolingSpeedRatioObject == "Autosize") {
291 170 : if (speedNum < (maxSpeeds + 1)) thisDesignSpec.coolingVolFlowRatio[speedNum] = -99999;
292 : } else {
293 80 : if (speedNum < (maxSpeeds + 1))
294 80 : thisDesignSpec.coolingVolFlowRatio[speedNum] = m_CoolingSpeedRatioObject.get<Real64>();
295 : }
296 500 : auto m_HeatingSpeedRatioObject = flowRatio.at("heating_speed_supply_air_flow_ratio");
297 250 : if (m_HeatingSpeedRatioObject == "Autosize") {
298 170 : if (speedNum < (maxSpeeds + 1)) thisDesignSpec.heatingVolFlowRatio[speedNum] = -99999;
299 : } else {
300 80 : if (speedNum < (maxSpeeds + 1))
301 80 : thisDesignSpec.heatingVolFlowRatio[speedNum] = m_HeatingSpeedRatioObject.get<Real64>();
302 : }
303 : }
304 0 : } else if (numSpeedInputs < maxSpeeds) {
305 0 : ShowSevereError(state, cCurrentModuleObject + ": Error getting inputs for system named: " + thisObjectName);
306 0 : ShowContinueError(state,
307 0 : format("Number of speed inputs ({:.0T} is less than number of speeds ({:.0T}).",
308 0 : Real64(numSpeedInputs),
309 0 : Real64(maxSpeeds)));
310 0 : errorsFound = true;
311 : }
312 : }
313 55 : state.dataUnitarySystems->designSpecMSHP.push_back(thisDesignSpec);
314 : }
315 : }
316 19 : } // namespace UnitarySystems
317 :
318 594 : HVACSystemData *UnitarySys::factory(
319 : EnergyPlusData &state, int const object_type_of_num, std::string const objectName, bool const ZoneEquipment, int const ZoneOAUnitNum)
320 : {
321 594 : if (state.dataUnitarySystems->getInputOnceFlag) {
322 159 : UnitarySys::getUnitarySystemInput(state, objectName, ZoneEquipment, ZoneOAUnitNum);
323 159 : state.dataUnitarySystems->getInputOnceFlag = false;
324 : }
325 594 : int sysNum = -1;
326 4409 : for (auto &sys : state.dataUnitarySystems->unitarySys) {
327 4409 : ++sysNum;
328 4409 : if (UtilityRoutines::SameString(sys.Name, objectName) && object_type_of_num == DataHVACGlobals::UnitarySys_AnyCoilType) {
329 594 : state.dataUnitarySystems->unitarySys[sysNum].m_UnitarySysNum = sysNum;
330 594 : return &sys;
331 : }
332 : }
333 0 : ShowFatalError(state, "UnitarySystem factory: Error getting inputs for system named: " + objectName);
334 0 : return nullptr;
335 : }
336 :
337 110 : int getDesignSpecMSHPIndex(
338 : EnergyPlusData &state, // lookup vector index for design spec object name in object array EnergyPlus::UnitarySystems::designSpecMSHP
339 : std::string_view objectName // IDF name in input
340 : )
341 : {
342 110 : int index = -1;
343 316 : for (std::size_t loop = 0; loop < state.dataUnitarySystems->designSpecMSHP.size(); ++loop) {
344 316 : DesignSpecMSHP *thisDesignSpecMSHPObjec = &state.dataUnitarySystems->designSpecMSHP[loop];
345 316 : if (UtilityRoutines::SameString(objectName, thisDesignSpecMSHPObjec->name)) {
346 110 : index = loop;
347 110 : return index;
348 : }
349 : }
350 0 : ShowSevereError(
351 0 : state, "getDesignSpecMSHPIndex: did not find UnitarySystemPerformance:Multispeed name =" + std::string{objectName} + ". Check inputs");
352 0 : return index;
353 : }
354 :
355 2370 : int getUnitarySystemIndex(
356 : EnergyPlusData &state, // lookup vector index for UnitarySystem object name in object array EnergyPlus::UnitarySystems::unitarySys
357 : std::string_view objectName // IDF name in input
358 : )
359 : {
360 2370 : int index = -1;
361 26444 : for (std::size_t loop = 0; loop < state.dataUnitarySystems->unitarySys.size(); ++loop) {
362 25260 : UnitarySys *thisUnitarySysObjec = &state.dataUnitarySystems->unitarySys[loop];
363 25260 : if (UtilityRoutines::SameString(objectName, thisUnitarySysObjec->Name)) {
364 1186 : index = loop;
365 1186 : break;
366 : }
367 : }
368 2370 : return index;
369 : }
370 :
371 6060022 : void UnitarySys::initUnitarySystems(
372 : EnergyPlusData &state, int const AirLoopNum, bool const FirstHVACIteration, int const ZoneOAUnitNum, Real64 const OAUCoilOutTemp)
373 : {
374 : static constexpr std::string_view routineName("InitUnitarySystems");
375 6060022 : bool errorsFound = false; // error flag for mining functions
376 :
377 : // only access for zone equipment, UnitaySystem does not yet have input for Availability Manager List Name
378 13659879 : if (this->m_IsZoneEquipment &&
379 7768793 : (this->m_sysType == SysType::PackagedAC || this->m_sysType == SysType::PackagedHP || this->m_sysType == SysType::PackagedWSHP) &&
380 1231508 : !state.dataHVACGlobal->ZoneComp.empty()) {
381 : // need to move to better location and save thisObjectIndex and thisObjectType in struct
382 : // this->m_EquipCompNum is by parent type, not total UnitarySystems
383 : // e.g., PTAC = 1,2,3; PTHP = 1,2; PTWSHP = 1,2,3,4; UnitarySystems = 9 total
384 1231508 : DataZoneEquipment::ZoneEquip thisObjectType = DataZoneEquipment::ZoneEquip::Invalid;
385 1231508 : switch (this->m_sysType) {
386 1062572 : case SysType::PackagedAC:
387 1062572 : thisObjectType = DataZoneEquipment::ZoneEquip::PkgTermACAirToAir;
388 1062572 : break;
389 91949 : case SysType::PackagedHP:
390 91949 : thisObjectType = DataZoneEquipment::ZoneEquip::PkgTermHPAirToAir;
391 91949 : break;
392 76987 : case SysType::PackagedWSHP:
393 76987 : thisObjectType = DataZoneEquipment::ZoneEquip::PkgTermHPWaterToAir;
394 76987 : break;
395 0 : default:
396 0 : break;
397 : }
398 1231508 : if (this->m_ZoneCompFlag) {
399 384 : state.dataHVACGlobal->ZoneComp(thisObjectType).ZoneCompAvailMgrs(this->m_EquipCompNum).AvailManagerListName =
400 384 : this->m_AvailManagerListName;
401 192 : state.dataHVACGlobal->ZoneComp(thisObjectType).ZoneCompAvailMgrs(this->m_EquipCompNum).ZoneNum = this->ControlZoneNum;
402 192 : this->m_ZoneCompFlag = false;
403 : }
404 1231508 : this->m_AvailStatus = state.dataHVACGlobal->ZoneComp(thisObjectType).ZoneCompAvailMgrs(this->m_EquipCompNum).AvailStatus;
405 : }
406 :
407 : // sizing does not execute until SysSizing is complete. This means we may not know plant connections for zone equipment.
408 : // when adding ((this->m_IsZoneEquipment && !state.dataGlobal->SysSizingCalc) || ()) here, eio gets out of sorts
409 6060022 : if (!state.dataGlobal->SysSizingCalc && this->m_MySizingCheckFlag && !this->m_ThisSysInputShouldBeGotten) {
410 592 : if (AirLoopNum > 0) {
411 386 : if (this->m_FanExists && (this->m_CoolCoilExists && (this->m_HeatCoilExists || this->m_SuppCoilExists)))
412 102 : state.dataAirLoop->AirLoopControlInfo(AirLoopNum).UnitarySys = true;
413 386 : state.dataAirLoop->AirLoopControlInfo(AirLoopNum).UnitarySysSimulating = true;
414 386 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_CoolingTwoSpeed) {
415 67 : DXCoils::SetCoilSystemCoolingData(state, this->m_CoolingCoilName, this->Name);
416 : }
417 : // associates an air loop fan on main branch with a coil on main branch where parent does not have a fan
418 386 : if (!this->m_FanExists) {
419 284 : if (state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).supFanModelType != DataAirSystems::Invalid) {
420 281 : auto &primaryAirSystems = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum);
421 281 : if (this->m_CoolCoilExists) {
422 1680 : state.dataRptCoilSelection->coilSelectionReportObj->setCoilSupplyFanInfo(
423 : state,
424 : this->m_CoolingCoilName,
425 280 : DataHVACGlobals::cAllCoilTypes(this->m_CoolingCoilType_Num),
426 280 : primaryAirSystems.supFanModelType == DataAirSystems::ObjectVectorOOFanSystemModel
427 8 : ? state.dataHVACFan->fanObjs[primaryAirSystems.supFanVecIndex]->name
428 272 : : state.dataFans->Fan(primaryAirSystems.SupFanNum).FanName,
429 280 : primaryAirSystems.supFanModelType == DataAirSystems::ObjectVectorOOFanSystemModel
430 : ? DataAirSystems::ObjectVectorOOFanSystemModel
431 : : DataAirSystems::StructArrayLegacyFanModels,
432 280 : primaryAirSystems.supFanModelType == DataAirSystems::ObjectVectorOOFanSystemModel ? primaryAirSystems.supFanVecIndex
433 : : primaryAirSystems.SupFanNum);
434 : }
435 281 : if (this->m_HeatCoilExists) {
436 6 : state.dataRptCoilSelection->coilSelectionReportObj->setCoilSupplyFanInfo(
437 : state,
438 : this->m_HeatingCoilName,
439 1 : DataHVACGlobals::cAllCoilTypes(this->m_HeatingCoilType_Num),
440 1 : primaryAirSystems.supFanModelType == DataAirSystems::ObjectVectorOOFanSystemModel
441 1 : ? state.dataHVACFan->fanObjs[primaryAirSystems.supFanVecIndex]->name
442 0 : : state.dataFans->Fan(primaryAirSystems.SupFanNum).FanName,
443 1 : primaryAirSystems.supFanModelType == DataAirSystems::ObjectVectorOOFanSystemModel
444 : ? DataAirSystems::ObjectVectorOOFanSystemModel
445 : : DataAirSystems::StructArrayLegacyFanModels,
446 1 : primaryAirSystems.supFanModelType == DataAirSystems::ObjectVectorOOFanSystemModel ? primaryAirSystems.supFanVecIndex
447 : : primaryAirSystems.SupFanNum);
448 : }
449 281 : if (this->m_SuppCoilExists) {
450 0 : state.dataRptCoilSelection->coilSelectionReportObj->setCoilSupplyFanInfo(
451 : state,
452 : this->m_SuppHeatCoilName,
453 0 : DataHVACGlobals::cAllCoilTypes(this->m_SuppHeatCoilType_Num),
454 0 : primaryAirSystems.supFanModelType == DataAirSystems::ObjectVectorOOFanSystemModel
455 0 : ? state.dataHVACFan->fanObjs[primaryAirSystems.supFanVecIndex]->name
456 0 : : state.dataFans->Fan(primaryAirSystems.SupFanNum).FanName,
457 0 : primaryAirSystems.supFanModelType == DataAirSystems::ObjectVectorOOFanSystemModel
458 : ? DataAirSystems::ObjectVectorOOFanSystemModel
459 : : DataAirSystems::StructArrayLegacyFanModels,
460 0 : primaryAirSystems.supFanModelType == DataAirSystems::ObjectVectorOOFanSystemModel ? primaryAirSystems.supFanVecIndex
461 : : primaryAirSystems.SupFanNum);
462 : }
463 : }
464 : }
465 : }
466 592 : this->sizeSystem(state, FirstHVACIteration, AirLoopNum);
467 592 : this->m_MySizingCheckFlag = false;
468 592 : if (AirLoopNum > 0) {
469 386 : state.dataAirLoop->AirLoopControlInfo(AirLoopNum).FanOpMode = this->m_FanOpMode;
470 386 : state.dataAirLoop->AirLoopControlInfo(AirLoopNum).CycFanSchedPtr = this->m_FanOpModeSchedPtr;
471 206 : } else if (AirLoopNum < 0) {
472 8 : if (this->m_ControlType == UnitarySysCtrlType::CCMASHRAE) {
473 0 : ShowSevereError(state, this->UnitType + ": " + this->Name);
474 0 : ShowContinueError(state, " Invalid application of Control Type = SingleZoneVAV in outdoor air system.");
475 0 : ShowFatalError(state, "InitUnitarySystems: Program terminated for previous conditions.");
476 : }
477 : }
478 : }
479 :
480 6060022 : if (this->m_MyFanFlag) {
481 2340 : std::string FanType = ""; // used in warning messages
482 2340 : std::string FanName = ""; // used in warning messages
483 1170 : if (this->m_ActualFanVolFlowRate != DataSizing::AutoSize) {
484 592 : if (this->m_ActualFanVolFlowRate > 0.0) {
485 592 : this->m_HeatingFanSpeedRatio = this->m_MaxHeatAirVolFlow / this->m_ActualFanVolFlowRate;
486 592 : this->m_CoolingFanSpeedRatio = this->m_MaxCoolAirVolFlow / this->m_ActualFanVolFlowRate;
487 592 : this->m_NoHeatCoolSpeedRatio = this->m_MaxNoCoolHeatAirVolFlow / this->m_ActualFanVolFlowRate;
488 592 : if (this->m_FanExists && !this->m_MultiOrVarSpeedHeatCoil && !this->m_MultiOrVarSpeedCoolCoil) {
489 219 : bool fanHasPowerSpeedRatioCurve = false;
490 219 : if (this->m_FanType_Num == DataHVACGlobals::FanType_SystemModelObject) {
491 15 : if (state.dataHVACFan->fanObjs[this->m_FanIndex]->powerModFuncFlowFractionCurveIndex > 0)
492 2 : fanHasPowerSpeedRatioCurve = true;
493 15 : FanType = "Fan:SystemModel";
494 15 : FanName = this->m_FanName;
495 : } else {
496 204 : if (Fans::GetFanSpeedRatioCurveIndex(state, FanType, FanName, this->m_FanIndex) > 0) fanHasPowerSpeedRatioCurve = true;
497 : }
498 219 : if (fanHasPowerSpeedRatioCurve) {
499 :
500 13 : if (this->m_ActualFanVolFlowRate == this->m_MaxHeatAirVolFlow &&
501 11 : this->m_ActualFanVolFlowRate == this->m_MaxCoolAirVolFlow &&
502 5 : this->m_ActualFanVolFlowRate == this->m_MaxNoCoolHeatAirVolFlow) {
503 1 : ShowWarningError(state, this->UnitType + " \"" + this->Name + "\"");
504 1 : ShowContinueError(state, "...For fan type and name = " + FanType + " \"" + FanName + "\"");
505 1 : ShowContinueError(state,
506 : "...Fan power ratio function of speed ratio curve has no impact if fan volumetric flow rate is the "
507 : "same as the unitary system volumetric flow rate.");
508 3 : ShowContinueError(state,
509 2 : format("...Fan volumetric flow rate = {:.5R} m3/s.", this->m_ActualFanVolFlowRate));
510 1 : ShowContinueError(state, format("...Unitary system volumetric flow rate = {:.5R} m3/s.", this->m_MaxHeatAirVolFlow));
511 : }
512 : }
513 : }
514 592 : if (this->m_MultiOrVarSpeedHeatCoil || this->m_MultiOrVarSpeedCoolCoil) {
515 150 : if (this->m_MultiOrVarSpeedCoolCoil) {
516 150 : int NumSpeeds = this->m_NumOfSpeedCooling;
517 150 : if (this->m_MSCoolingSpeedRatio.empty()) this->m_MSCoolingSpeedRatio.resize(NumSpeeds + 1);
518 150 : if (this->m_CoolVolumeFlowRate.empty()) this->m_CoolVolumeFlowRate.resize(NumSpeeds + 1);
519 548 : for (int Iter = 1; Iter <= NumSpeeds; ++Iter) {
520 398 : this->m_MSCoolingSpeedRatio[Iter] = this->m_CoolVolumeFlowRate[Iter] / this->m_ActualFanVolFlowRate;
521 : }
522 : }
523 150 : if (this->m_MultiOrVarSpeedHeatCoil) {
524 18 : int NumSpeeds = this->m_NumOfSpeedHeating;
525 18 : if (this->m_MSHeatingSpeedRatio.empty()) this->m_MSHeatingSpeedRatio.resize(NumSpeeds + 1);
526 18 : if (this->m_HeatVolumeFlowRate.empty()) this->m_HeatVolumeFlowRate.resize(NumSpeeds + 1);
527 118 : for (int Iter = 1; Iter <= NumSpeeds; ++Iter) {
528 100 : this->m_MSHeatingSpeedRatio[Iter] = this->m_HeatVolumeFlowRate[Iter] / this->m_ActualFanVolFlowRate;
529 : }
530 : }
531 150 : this->m_NoLoadAirFlowRateRatio = this->m_MaxNoCoolHeatAirVolFlow / this->m_ActualFanVolFlowRate;
532 : }
533 : }
534 592 : this->m_MyFanFlag = false;
535 : } else {
536 578 : if (this->m_FanExists) {
537 578 : if (this->m_FanType_Num == DataHVACGlobals::FanType_SystemModelObject) {
538 58 : this->m_ActualFanVolFlowRate = state.dataHVACFan->fanObjs[this->m_FanIndex]->designAirVolFlowRate;
539 : } else {
540 520 : this->m_ActualFanVolFlowRate =
541 1040 : Fans::GetFanDesignVolumeFlowRate(state, blankString, blankString, errorsFound, this->m_FanIndex);
542 : }
543 : }
544 : // do not set false this->m_MyFanFlag so that next pass specific initialization and warning are executed
545 : }
546 : }
547 :
548 : // why is this here, it doesn't do anything
549 6060022 : int OutdoorAirUnitNum = 0;
550 6060022 : int OAUCoilOutletTemp = 0.0;
551 6060022 : if (AirLoopNum == -1) { // This DX system is component of ZoneHVAC:OutdoorAirUnit
552 75781 : OutdoorAirUnitNum = ZoneOAUnitNum;
553 75781 : OAUCoilOutletTemp = OAUCoilOutTemp;
554 : }
555 :
556 : // Scan hot water and steam heating coil plant components for one time initializations
557 6060022 : if (this->m_MyPlantScanFlag && !state.dataPlnt->PlantLoop.empty()) {
558 388 : if (this->m_HeatRecActive) {
559 0 : state.dataUnitarySystems->initUnitarySystemsErrFlag = false;
560 0 : PlantUtilities::ScanPlantLoopsForObject(state,
561 : this->Name,
562 : DataPlant::PlantEquipmentType::UnitarySysRecovery,
563 : this->m_HRPlantLoc,
564 0 : state.dataUnitarySystems->initUnitarySystemsErrFlag,
565 : _,
566 : _,
567 : _,
568 : _,
569 : _);
570 0 : if (state.dataUnitarySystems->initUnitarySystemsErrFlag) {
571 0 : ShowFatalError(state, "InitUnitarySystems: Program terminated for previous conditions.");
572 : }
573 : }
574 388 : DataPlant::PlantEquipmentType TypeOfCoilWaterCooling{DataPlant::PlantEquipmentType::Invalid};
575 776 : std::string CoolingCoilType = "";
576 776 : std::string CoolingCoilName = "";
577 771 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWater ||
578 766 : this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWaterDetailed ||
579 383 : this->m_CoolingCoilType_Num == DataHVACGlobals::CoilWater_CoolingHXAssisted) {
580 5 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWater) {
581 5 : TypeOfCoilWaterCooling = DataPlant::PlantEquipmentType::CoilWaterCooling;
582 5 : CoolingCoilType = "Coil:Cooling:Water";
583 5 : CoolingCoilName = this->m_CoolingCoilName;
584 0 : } else if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWaterDetailed) {
585 0 : TypeOfCoilWaterCooling = DataPlant::PlantEquipmentType::CoilWaterDetailedFlatCooling;
586 0 : CoolingCoilType = "Coil:Cooling:Water:DetailedGeometry";
587 0 : CoolingCoilName = this->m_CoolingCoilName;
588 : } else {
589 0 : TypeOfCoilWaterCooling = static_cast<DataPlant::PlantEquipmentType>(
590 0 : HVACHXAssistedCoolingCoil::GetCoilObjectTypeNum(state,
591 0 : DataHVACGlobals::cAllCoilTypes(this->m_CoolingCoilType_Num),
592 : this->m_CoolingCoilName,
593 0 : state.dataUnitarySystems->initUnitarySystemsErrFlag,
594 : true));
595 0 : if (TypeOfCoilWaterCooling == static_cast<DataPlant::PlantEquipmentType>(DataHVACGlobals::Coil_CoolingWater)) {
596 0 : TypeOfCoilWaterCooling = DataPlant::PlantEquipmentType::CoilWaterCooling;
597 0 : CoolingCoilType = "Coil:Cooling:Water";
598 0 : } else if (TypeOfCoilWaterCooling == static_cast<DataPlant::PlantEquipmentType>(DataHVACGlobals::Coil_CoolingWaterDetailed)) {
599 0 : TypeOfCoilWaterCooling = DataPlant::PlantEquipmentType::CoilWaterDetailedFlatCooling;
600 0 : CoolingCoilType = "Coil:Cooling:Water:DetailedGeometry";
601 : }
602 0 : CoolingCoilName = HVACHXAssistedCoolingCoil::GetHXDXCoilName(state,
603 0 : DataHVACGlobals::cAllCoilTypes(this->m_CoolingCoilType_Num),
604 : this->m_CoolingCoilName,
605 0 : state.dataUnitarySystems->initUnitarySystemsErrFlag);
606 : }
607 5 : state.dataUnitarySystems->initUnitarySystemsErrFlag = false;
608 10 : PlantUtilities::ScanPlantLoopsForObject(state,
609 : CoolingCoilName,
610 : TypeOfCoilWaterCooling,
611 : this->CoolCoilPlantLoc,
612 5 : state.dataUnitarySystems->initUnitarySystemsErrFlag,
613 : _,
614 : _,
615 : _,
616 : _,
617 : _);
618 5 : if (state.dataUnitarySystems->initUnitarySystemsErrFlag) {
619 0 : ShowFatalError(state, "InitUnitarySystem: Program terminated for previous conditions.");
620 : }
621 5 : this->MaxCoolCoilFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(
622 5 : state, CoolingCoilType, CoolingCoilName, state.dataUnitarySystems->initUnitarySystemsErrorsFound);
623 :
624 5 : if (this->MaxCoolCoilFluidFlow > 0.0) {
625 10 : Real64 rho = FluidProperties::GetDensityGlycol(state,
626 5 : state.dataPlnt->PlantLoop(this->CoolCoilPlantLoc.loopNum).FluidName,
627 : DataGlobalConstants::CWInitConvTemp,
628 5 : state.dataPlnt->PlantLoop(this->CoolCoilPlantLoc.loopNum).FluidIndex,
629 5 : routineName);
630 5 : this->MaxCoolCoilFluidFlow *= rho;
631 : }
632 : // fill outlet node for coil
633 5 : this->CoolCoilFluidOutletNodeNum = DataPlant::CompData::getPlantComponent(state, this->CoolCoilPlantLoc).NodeNumOut;
634 : }
635 388 : DataPlant::PlantEquipmentType TypeOfCoilWaterHeating = DataPlant::PlantEquipmentType::Invalid;
636 776 : std::string HeatingCoilType = "";
637 767 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWater ||
638 379 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingSteam) {
639 11 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWater) {
640 9 : TypeOfCoilWaterHeating = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating;
641 9 : HeatingCoilType = "Coil:Heating:Water";
642 : // this doesn't work good here, sizing may not have executed yet
643 : // air loops seem to work OK, zone equipment not so much, this->m_MaxHeatAirVolFlow = -99999.0
644 : // moved to sizing but left this original call
645 18 : WaterCoils::SetCoilDesFlow(state,
646 9 : DataHVACGlobals::cAllCoilTypes(this->m_HeatingCoilType_Num),
647 : this->m_HeatingCoilName,
648 : this->m_MaxHeatAirVolFlow,
649 9 : state.dataUnitarySystems->initUnitarySystemsErrorsFound);
650 : } else {
651 2 : TypeOfCoilWaterHeating = DataPlant::PlantEquipmentType::CoilSteamAirHeating;
652 2 : HeatingCoilType = "Coil:Heating:Steam";
653 : }
654 11 : state.dataUnitarySystems->initUnitarySystemsErrFlag = false;
655 22 : PlantUtilities::ScanPlantLoopsForObject(state,
656 : this->m_HeatingCoilName,
657 : TypeOfCoilWaterHeating,
658 : this->HeatCoilPlantLoc,
659 11 : state.dataUnitarySystems->initUnitarySystemsErrFlag,
660 : _,
661 : _,
662 : _,
663 : _,
664 : _);
665 11 : if (state.dataUnitarySystems->initUnitarySystemsErrFlag) {
666 0 : ShowFatalError(state, "InitUnitarySystem: Program terminated for previous conditions.");
667 : }
668 11 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWater) {
669 9 : this->MaxHeatCoilFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(
670 9 : state, HeatingCoilType, this->m_HeatingCoilName, state.dataUnitarySystems->initUnitarySystemsErrorsFound);
671 :
672 9 : if (this->MaxHeatCoilFluidFlow > 0.0) {
673 4 : Real64 rho = FluidProperties::GetDensityGlycol(state,
674 2 : state.dataPlnt->PlantLoop(this->HeatCoilPlantLoc.loopNum).FluidName,
675 : DataGlobalConstants::HWInitConvTemp,
676 2 : state.dataPlnt->PlantLoop(this->HeatCoilPlantLoc.loopNum).FluidIndex,
677 2 : routineName);
678 2 : this->MaxHeatCoilFluidFlow =
679 2 : WaterCoils::GetCoilMaxWaterFlowRate(
680 4 : state, HeatingCoilType, this->m_HeatingCoilName, state.dataUnitarySystems->initUnitarySystemsErrorsFound) *
681 : rho;
682 : }
683 : } else {
684 2 : this->MaxHeatCoilFluidFlow =
685 2 : SteamCoils::GetCoilMaxSteamFlowRate(state, this->m_HeatingCoilIndex, state.dataUnitarySystems->initUnitarySystemsErrorsFound);
686 2 : if (this->MaxHeatCoilFluidFlow > 0.0) {
687 2 : int SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed
688 2 : Real64 TempSteamIn = 100.0;
689 2 : Real64 SteamDensity = FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, SteamIndex, routineName);
690 2 : this->MaxHeatCoilFluidFlow *= SteamDensity;
691 : }
692 : }
693 : // fill outlet node for coil
694 11 : this->HeatCoilFluidOutletNodeNum = DataPlant::CompData::getPlantComponent(state, this->HeatCoilPlantLoc).NodeNumOut;
695 : }
696 :
697 388 : this->m_MyPlantScanFlag = false;
698 6059634 : } else if (this->m_MyPlantScanFlag && !state.dataGlobal->AnyPlantInModel) {
699 204 : this->m_MyPlantScanFlag = false;
700 : }
701 :
702 : // Scan Supplemental hot water and steam heating coil plant components for one time initializations
703 6060022 : if (this->m_MySuppCoilPlantScanFlag && allocated(state.dataPlnt->PlantLoop)) {
704 592 : if (this->m_SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingWater) {
705 0 : state.dataUnitarySystems->initUnitarySystemsErrFlag = false;
706 0 : PlantUtilities::ScanPlantLoopsForObject(state,
707 : this->m_SuppHeatCoilName,
708 : DataPlant::PlantEquipmentType::CoilWaterSimpleHeating,
709 : this->m_SuppCoilPlantLoc,
710 0 : state.dataUnitarySystems->initUnitarySystemsErrFlag,
711 : _,
712 : _,
713 : _,
714 : _,
715 : _);
716 0 : WaterCoils::SetCoilDesFlow(state,
717 0 : DataHVACGlobals::cAllCoilTypes(this->m_SuppHeatCoilType_Num),
718 : this->m_SuppHeatCoilName,
719 : this->m_MaxHeatAirVolFlow,
720 0 : state.dataUnitarySystems->initUnitarySystemsErrorsFound);
721 :
722 0 : if (state.dataUnitarySystems->initUnitarySystemsErrFlag) {
723 0 : ShowFatalError(state, "InitUnitarySystems: Program terminated for previous conditions.");
724 : }
725 0 : this->m_MaxSuppCoilFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(
726 0 : state, "Coil:Heating:Water", this->m_SuppHeatCoilName, state.dataUnitarySystems->initUnitarySystemsErrorsFound);
727 :
728 0 : if (this->m_MaxSuppCoilFluidFlow > 0.0) {
729 0 : Real64 rho = FluidProperties::GetDensityGlycol(state,
730 0 : state.dataPlnt->PlantLoop(this->m_SuppCoilPlantLoc.loopNum).FluidName,
731 : DataGlobalConstants::CWInitConvTemp,
732 0 : state.dataPlnt->PlantLoop(this->m_SuppCoilPlantLoc.loopNum).FluidIndex,
733 0 : routineName);
734 0 : this->m_MaxSuppCoilFluidFlow =
735 0 : WaterCoils::GetCoilMaxWaterFlowRate(
736 0 : state, "Coil:Heating:Water", this->m_SuppHeatCoilName, state.dataUnitarySystems->initUnitarySystemsErrorsFound) *
737 : rho;
738 : }
739 : // fill outlet node for coil
740 0 : this->m_SuppCoilFluidOutletNodeNum = DataPlant::CompData::getPlantComponent(state, this->m_SuppCoilPlantLoc).NodeNumOut;
741 :
742 592 : } else if (this->m_SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingSteam) {
743 0 : state.dataUnitarySystems->initUnitarySystemsErrFlag = false;
744 0 : PlantUtilities::ScanPlantLoopsForObject(state,
745 : this->m_SuppHeatCoilName,
746 : DataPlant::PlantEquipmentType::CoilSteamAirHeating,
747 : this->m_SuppCoilPlantLoc,
748 0 : state.dataUnitarySystems->initUnitarySystemsErrFlag,
749 : _,
750 : _,
751 : _,
752 : _,
753 : _);
754 0 : if (state.dataUnitarySystems->initUnitarySystemsErrFlag) {
755 0 : ShowFatalError(state, "InitUnitarySystems: Program terminated for previous conditions.");
756 : }
757 0 : this->m_MaxSuppCoilFluidFlow =
758 0 : SteamCoils::GetCoilMaxSteamFlowRate(state, this->m_SuppHeatCoilIndex, state.dataUnitarySystems->initUnitarySystemsErrorsFound);
759 0 : if (this->m_MaxSuppCoilFluidFlow > 0.0) {
760 0 : int SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed
761 0 : Real64 TempSteamIn = 100.0;
762 0 : Real64 SteamDensity = FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, SteamIndex, routineName);
763 0 : this->m_MaxSuppCoilFluidFlow *= SteamDensity;
764 : }
765 :
766 : // fill outlet node for coil
767 0 : this->m_SuppCoilFluidOutletNodeNum = DataPlant::CompData::getPlantComponent(state, this->m_SuppCoilPlantLoc).NodeNumOut;
768 : }
769 :
770 592 : this->m_MySuppCoilPlantScanFlag = false;
771 :
772 6059430 : } else if (this->m_MySuppCoilPlantScanFlag && !state.dataGlobal->AnyPlantInModel) {
773 0 : this->m_MySuppCoilPlantScanFlag = false;
774 : }
775 :
776 : // do the Begin Environment initializations
777 6060022 : if (state.dataGlobal->BeginEnvrnFlag && this->m_MyEnvrnFlag) {
778 3439 : this->m_DesignMassFlowRate = this->m_DesignFanVolFlowRate * state.dataEnvrn->StdRhoAir;
779 3439 : this->MaxCoolAirMassFlow = this->m_MaxCoolAirVolFlow * state.dataEnvrn->StdRhoAir;
780 3439 : this->MaxHeatAirMassFlow = this->m_MaxHeatAirVolFlow * state.dataEnvrn->StdRhoAir;
781 3439 : this->MaxNoCoolHeatAirMassFlow = this->m_MaxNoCoolHeatAirVolFlow * state.dataEnvrn->StdRhoAir;
782 3439 : this->m_CoolOutAirMassFlow = this->m_CoolOutAirVolFlow * state.dataEnvrn->StdRhoAir;
783 3439 : this->m_HeatOutAirMassFlow = this->m_HeatOutAirVolFlow * state.dataEnvrn->StdRhoAir;
784 3439 : this->m_NoCoolHeatOutAirMassFlow = this->m_NoCoolHeatOutAirVolFlow * state.dataEnvrn->StdRhoAir;
785 3439 : if (this->OAMixerExists) {
786 957 : state.dataLoopNodes->Node(this->m_OAMixerNodes[0]).MassFlowRateMax = max(this->m_CoolOutAirMassFlow, this->m_HeatOutAirMassFlow);
787 957 : state.dataLoopNodes->Node(this->m_OAMixerNodes[0]).MassFlowRateMin = 0.0;
788 957 : state.dataLoopNodes->Node(this->m_OAMixerNodes[0]).MassFlowRateMinAvail = 0.0;
789 : }
790 3439 : this->m_WSHPRuntimeFrac = 0.0;
791 3439 : this->m_CompPartLoadRatio = 0.0;
792 3439 : this->m_CoolingCoilSensDemand = 0.0;
793 3439 : this->m_CoolingCoilLatentDemand = 0.0;
794 3439 : this->m_HeatingCoilSensDemand = 0.0;
795 3439 : this->m_SenLoadLoss = 0.0;
796 3439 : if (this->m_Humidistat) {
797 153 : this->m_LatLoadLoss = 0.0;
798 : }
799 :
800 3439 : if ((this->m_HeatRecActive) && (!this->m_MyPlantScanFlag)) {
801 :
802 0 : Real64 rho = FluidProperties::GetDensityGlycol(state,
803 0 : state.dataPlnt->PlantLoop(this->m_HRPlantLoc.loopNum).FluidName,
804 : DataGlobalConstants::HWInitConvTemp,
805 0 : state.dataPlnt->PlantLoop(this->m_HRPlantLoc.loopNum).FluidIndex,
806 0 : routineName);
807 :
808 0 : this->m_DesignHeatRecMassFlowRate = this->m_DesignHRWaterVolumeFlow * rho;
809 :
810 0 : PlantUtilities::InitComponentNodes(
811 : state, 0.0, this->m_DesignHeatRecMassFlowRate, this->m_HeatRecoveryInletNodeNum, this->m_HeatRecoveryOutletNodeNum);
812 : }
813 : // set fluid-side hardware limits
814 3439 : if (this->CoolCoilFluidInletNode > 0) {
815 :
816 34 : if (this->MaxCoolCoilFluidFlow == DataSizing::AutoSize) {
817 : // If water coil max water flow rate is DataSizing::AutoSized, simulate once in order to mine max flow rate
818 0 : std::string CoolingCoilType = "";
819 0 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWater) {
820 0 : CoolingCoilType = "Coil:Cooling:Water";
821 : } else {
822 0 : CoolingCoilType = "Coil:Cooling:Water:DetailedGeometry";
823 : }
824 0 : WaterCoils::SimulateWaterCoilComponents(state, this->m_CoolingCoilName, FirstHVACIteration, this->m_CoolingCoilIndex);
825 0 : Real64 CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(
826 0 : state, CoolingCoilType, this->m_CoolingCoilName, state.dataUnitarySystems->initUnitarySystemsErrorsFound);
827 0 : if (CoilMaxVolFlowRate != DataSizing::AutoSize) {
828 0 : Real64 rho = FluidProperties::GetDensityGlycol(state,
829 0 : state.dataPlnt->PlantLoop(this->CoolCoilPlantLoc.loopNum).FluidName,
830 : DataGlobalConstants::CWInitConvTemp,
831 0 : state.dataPlnt->PlantLoop(this->CoolCoilPlantLoc.loopNum).FluidIndex,
832 0 : routineName);
833 0 : this->MaxCoolCoilFluidFlow = CoilMaxVolFlowRate * rho;
834 : }
835 : }
836 :
837 34 : PlantUtilities::InitComponentNodes(
838 : state, 0.0, this->MaxCoolCoilFluidFlow, this->CoolCoilFluidInletNode, this->CoolCoilFluidOutletNodeNum);
839 : }
840 3439 : if (this->HeatCoilFluidInletNode > 0) {
841 :
842 62 : if (this->MaxHeatCoilFluidFlow == DataSizing::AutoSize) {
843 : // IF water coil max water flow rate is DataSizing::AutoSized, simulate once in order to mine max flow rate
844 7 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWater) {
845 7 : WaterCoils::SimulateWaterCoilComponents(state, this->m_HeatingCoilName, FirstHVACIteration, this->m_HeatingCoilIndex);
846 14 : Real64 CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(
847 14 : state, "Coil:Heating:Water", this->m_HeatingCoilName, state.dataUnitarySystems->initUnitarySystemsErrorsFound);
848 7 : if (CoilMaxVolFlowRate != DataSizing::AutoSize) {
849 14 : Real64 rho = FluidProperties::GetDensityGlycol(state,
850 7 : state.dataPlnt->PlantLoop(this->HeatCoilPlantLoc.loopNum).FluidName,
851 : DataGlobalConstants::CWInitConvTemp,
852 7 : state.dataPlnt->PlantLoop(this->HeatCoilPlantLoc.loopNum).FluidIndex,
853 7 : routineName);
854 7 : this->MaxHeatCoilFluidFlow = CoilMaxVolFlowRate * rho;
855 : }
856 : }
857 : // If steam coil max steam flow rate is DataSizing::AutoSized, simulate once in order to mine max flow rate
858 7 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingSteam) {
859 0 : SteamCoils::SimulateSteamCoilComponents(
860 : state,
861 : this->m_HeatingCoilName,
862 : FirstHVACIteration,
863 : this->m_HeatingCoilIndex,
864 : 1.0,
865 0 : state.dataUnitarySystems->initUnitarySystemsQActual); // QCoilReq, simulate any load > 0 to get max capacity
866 0 : Real64 CoilMaxVolFlowRate = SteamCoils::GetCoilMaxSteamFlowRate(
867 0 : state, this->m_HeatingCoilIndex, state.dataUnitarySystems->initUnitarySystemsErrorsFound);
868 0 : if (CoilMaxVolFlowRate != DataSizing::AutoSize) {
869 0 : int SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed
870 0 : Real64 TempSteamIn = 100.0;
871 : Real64 SteamDensity =
872 0 : FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, SteamIndex, routineName);
873 0 : this->MaxHeatCoilFluidFlow = CoilMaxVolFlowRate * SteamDensity;
874 : }
875 : }
876 : }
877 :
878 62 : PlantUtilities::InitComponentNodes(
879 : state, 0.0, this->MaxHeatCoilFluidFlow, this->HeatCoilFluidInletNode, this->HeatCoilFluidOutletNodeNum);
880 : }
881 3439 : if (this->m_SuppCoilFluidInletNode > 0) {
882 0 : if (this->m_MaxSuppCoilFluidFlow == DataSizing::AutoSize) {
883 0 : if (this->m_SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingWater) {
884 : // If water coil max water flow rate is DataSizing::AutoSized, simulate once in order to mine max flow rate
885 0 : WaterCoils::SimulateWaterCoilComponents(state, this->m_SuppHeatCoilName, FirstHVACIteration, this->m_SuppHeatCoilIndex);
886 0 : Real64 CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(
887 0 : state, "Coil:Heating:Water", this->m_SuppHeatCoilName, state.dataUnitarySystems->initUnitarySystemsErrorsFound);
888 0 : if (CoilMaxVolFlowRate != DataSizing::AutoSize) {
889 0 : Real64 rho = FluidProperties::GetDensityGlycol(state,
890 0 : state.dataPlnt->PlantLoop(this->m_SuppCoilPlantLoc.loopNum).FluidName,
891 : DataGlobalConstants::CWInitConvTemp,
892 0 : state.dataPlnt->PlantLoop(this->m_SuppCoilPlantLoc.loopNum).FluidIndex,
893 0 : routineName);
894 0 : this->m_MaxSuppCoilFluidFlow = CoilMaxVolFlowRate * rho;
895 : }
896 : }
897 0 : if (this->m_SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingSteam) {
898 0 : SteamCoils::SimulateSteamCoilComponents(
899 : state,
900 : this->m_SuppHeatCoilName,
901 : FirstHVACIteration,
902 : this->m_SuppHeatCoilIndex,
903 : 1.0,
904 0 : state.dataUnitarySystems->initUnitarySystemsQActual); // QCoilReq, simulate any load > 0 to get max capacity
905 0 : Real64 CoilMaxVolFlowRate = SteamCoils::GetCoilMaxSteamFlowRate(
906 0 : state, this->m_SuppHeatCoilIndex, state.dataUnitarySystems->initUnitarySystemsErrorsFound);
907 0 : if (CoilMaxVolFlowRate != DataSizing::AutoSize) {
908 0 : int SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed
909 0 : Real64 TempSteamIn = 100.0;
910 : Real64 SteamDensity =
911 0 : FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, SteamIndex, routineName);
912 0 : this->m_MaxSuppCoilFluidFlow = CoilMaxVolFlowRate * SteamDensity;
913 : }
914 : }
915 0 : PlantUtilities::InitComponentNodes(
916 : state, 0.0, this->m_MaxSuppCoilFluidFlow, this->m_SuppCoilFluidInletNode, this->m_SuppCoilFluidOutletNodeNum);
917 : }
918 : }
919 3439 : this->m_MyEnvrnFlag = false;
920 : }
921 :
922 6060022 : if (!state.dataGlobal->BeginEnvrnFlag) {
923 6027238 : this->m_MyEnvrnFlag = true;
924 : }
925 :
926 : // Init maximum available Heat Recovery flow rate
927 6060022 : if ((this->m_HeatRecActive) && (!this->m_MyPlantScanFlag)) {
928 0 : Real64 mdotHR = 0.0;
929 0 : if (ScheduleManager::GetCurrentScheduleValue(state, this->m_SysAvailSchedPtr) > 0.0) {
930 0 : if (FirstHVACIteration) {
931 0 : mdotHR = this->m_DesignHeatRecMassFlowRate;
932 : } else {
933 0 : if (this->m_HeatRecoveryMassFlowRate > 0.0) {
934 0 : mdotHR = this->m_HeatRecoveryMassFlowRate;
935 : } else {
936 0 : mdotHR = this->m_DesignHeatRecMassFlowRate;
937 : }
938 : }
939 : } else {
940 0 : mdotHR = 0.0;
941 : }
942 :
943 0 : mdotHR = min(state.dataLoopNodes->Node(this->m_HeatRecoveryOutletNodeNum).MassFlowRateMaxAvail, mdotHR);
944 0 : state.dataLoopNodes->Node(this->m_HeatRecoveryInletNodeNum).MassFlowRate = mdotHR;
945 : }
946 :
947 : // get operating capacity of water and steam coil
948 6060022 : if (FirstHVACIteration || this->m_DehumidControlType_Num == DehumCtrlType::CoolReheat) {
949 2786375 : if (FirstHVACIteration) {
950 2662136 : this->m_IterationCounter = 0;
951 10648544 : for (auto &val : this->m_IterationMode) {
952 7986408 : val = 0;
953 : }
954 :
955 : // for DX systems, just read the inlet node flow rate and let air loop decide flow
956 2662136 : if (this->m_ControlType == UnitarySysCtrlType::Setpoint && this->m_sysType == SysType::Unitary) {
957 23455 : if (ScheduleManager::GetCurrentScheduleValue(state, this->m_SysAvailSchedPtr) > 0.0) {
958 23440 : if (this->m_LastMode == CoolingMode) {
959 11866 : if (this->m_MultiOrVarSpeedCoolCoil) {
960 5921 : state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = this->m_CoolMassFlowRate[this->m_NumOfSpeedCooling];
961 : } else {
962 5945 : state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = this->MaxCoolAirMassFlow;
963 : }
964 11574 : } else if (this->m_LastMode == HeatingMode) {
965 7476 : if (this->m_MultiOrVarSpeedHeatCoil) {
966 1125 : state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = this->m_HeatMassFlowRate[this->m_NumOfSpeedHeating];
967 : } else {
968 6351 : state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = this->MaxHeatAirMassFlow;
969 : }
970 : } else {
971 4098 : if (this->m_MultiOrVarSpeedCoolCoil) {
972 9 : state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = this->MaxNoCoolHeatAirMassFlow;
973 : } else {
974 4089 : state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = this->MaxNoCoolHeatAirMassFlow;
975 : }
976 : }
977 : } else {
978 15 : state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = 0.0;
979 : }
980 : }
981 2662136 : if (this->m_WaterHRPlantLoopModel) {
982 : // initialize loop water temp on FirstHVACIteration
983 5477 : Real64 airInTemp = state.dataLoopNodes->Node(this->CoolCoilInletNodeNum).Temp;
984 5477 : Real64 companionAirInTemp = state.dataLoopNodes->Node(this->m_HRcoolCoilAirInNode).Temp;
985 5477 : Real64 oneHalfAirDeltaT = (companionAirInTemp - airInTemp) / 2.0;
986 5477 : Real64 initialLoopTemp = airInTemp + oneHalfAirDeltaT;
987 5477 : if (initialLoopTemp > this->m_minWaterLoopTempForHR && std::abs(oneHalfAirDeltaT) > this->m_minAirToWaterTempOffset) {
988 12 : state.dataLoopNodes->Node(this->CoolCoilFluidInletNode).Temp = initialLoopTemp;
989 12 : this->temperatureOffsetControlStatus = 1;
990 : } else {
991 5465 : this->temperatureOffsetControlStatus = 0;
992 : }
993 : }
994 : }
995 5518605 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWater ||
996 2732230 : this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWaterDetailed) {
997 :
998 : // set water-side mass flow rates
999 54145 : Real64 mdot = this->MaxCoolCoilFluidFlow;
1000 54145 : PlantUtilities::SetComponentFlowRate(
1001 : state, mdot, this->CoolCoilFluidInletNode, this->CoolCoilFluidOutletNodeNum, this->CoolCoilPlantLoc);
1002 : // simulate water coil to find operating capacity
1003 108290 : WaterCoils::SimulateWaterCoilComponents(state,
1004 : this->m_CoolingCoilName,
1005 : FirstHVACIteration,
1006 : this->m_CoolingCoilIndex,
1007 54145 : state.dataUnitarySystems->initUnitarySystemsQActual);
1008 54145 : this->m_DesignCoolingCapacity = state.dataUnitarySystems->initUnitarySystemsQActual;
1009 :
1010 : } // from IF(UnitarySystem(UnitarySysNum)%CoolingCoilType_Num == Coil_CoolingWater .OR. Coil_CoolingWaterDetailed
1011 2786375 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWater) {
1012 :
1013 : // set water-side mass flow rates
1014 23619 : Real64 mdot = this->MaxHeatCoilFluidFlow;
1015 23619 : PlantUtilities::SetComponentFlowRate(
1016 : state, mdot, this->HeatCoilFluidInletNode, this->HeatCoilFluidOutletNodeNum, this->HeatCoilPlantLoc);
1017 : // simulate water coil to find operating capacity
1018 47238 : WaterCoils::SimulateWaterCoilComponents(state,
1019 : this->m_HeatingCoilName,
1020 : FirstHVACIteration,
1021 : this->m_HeatingCoilIndex,
1022 23619 : state.dataUnitarySystems->initUnitarySystemsQActual);
1023 23619 : this->m_DesignHeatingCapacity = state.dataUnitarySystems->initUnitarySystemsQActual;
1024 :
1025 : } // from IF(UnitarySystem(UnitarySysNum)%HeatingCoilType_Num == Coil_HeatingWater) THEN
1026 :
1027 2786375 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingSteam) {
1028 :
1029 : // set water-side mass flow rates
1030 2968 : Real64 mdot = this->MaxHeatCoilFluidFlow;
1031 2968 : PlantUtilities::SetComponentFlowRate(
1032 : state, mdot, this->HeatCoilFluidInletNode, this->HeatCoilFluidOutletNodeNum, this->HeatCoilPlantLoc);
1033 : // simulate steam coil to find operating capacity
1034 5936 : SteamCoils::SimulateSteamCoilComponents(
1035 : state,
1036 : this->m_HeatingCoilName,
1037 : FirstHVACIteration,
1038 : this->m_HeatingCoilIndex,
1039 : 1.0,
1040 2968 : state.dataUnitarySystems->initUnitarySystemsQActual); // QCoilReq, simulate any load > 0 to get max capacity of steam coil
1041 5936 : this->m_DesignHeatingCapacity = SteamCoils::GetCoilCapacity(state,
1042 2968 : DataHVACGlobals::cAllCoilTypes(this->m_HeatingCoilType_Num),
1043 : this->m_HeatingCoilName,
1044 2968 : state.dataUnitarySystems->initUnitarySystemsErrorsFound);
1045 :
1046 : } // from IF(UnitarySystem(UnitarySysNum)%HeatingCoilType_Num == Coil_HeatingSteam) THEN
1047 2786375 : if (this->m_SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingWater) {
1048 :
1049 : // set steam-side mass flow rates
1050 0 : Real64 mdot = this->m_MaxSuppCoilFluidFlow;
1051 0 : PlantUtilities::SetComponentFlowRate(
1052 : state, mdot, this->m_SuppCoilFluidInletNode, this->m_SuppCoilFluidOutletNodeNum, this->m_SuppCoilPlantLoc);
1053 : // simulate water coil to find operating capacity
1054 0 : if (mdot > 0.0) { // not sure why this is here and not used for other coil types, wouldn't capacity be 0 if water flow = 0? Maybe a
1055 : // speed issue where coil doesn't need to be simulation if mdot=0.
1056 0 : WaterCoils::SimulateWaterCoilComponents(state,
1057 : this->m_SuppHeatCoilName,
1058 : FirstHVACIteration,
1059 : this->m_SuppHeatCoilIndex,
1060 0 : state.dataUnitarySystems->initUnitarySystemsQActual);
1061 0 : this->m_DesignSuppHeatingCapacity = state.dataUnitarySystems->initUnitarySystemsQActual;
1062 : } else {
1063 0 : this->m_DesignSuppHeatingCapacity = 0.0;
1064 : }
1065 :
1066 : } // from IF(UnitarySystem(UnitarySysNum)%SuppHeatCoilType_Num == Coil_HeatingWater) THEN
1067 :
1068 2786375 : if (this->m_SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingSteam) {
1069 :
1070 : // set air-side and steam-side mass flow rates
1071 0 : Real64 mdot = this->m_MaxSuppCoilFluidFlow;
1072 0 : PlantUtilities::SetComponentFlowRate(
1073 : state, mdot, this->m_SuppCoilFluidInletNode, this->m_SuppCoilFluidOutletNodeNum, this->m_SuppCoilPlantLoc);
1074 : // simulate steam coil to find operating capacity
1075 0 : SteamCoils::SimulateSteamCoilComponents(
1076 : state,
1077 : this->m_SuppHeatCoilName,
1078 : FirstHVACIteration,
1079 : this->m_SuppHeatCoilIndex,
1080 : 1.0,
1081 0 : state.dataUnitarySystems->initUnitarySystemsQActual); // QCoilReq, simulate any load > 0 to get max capacity of steam coil
1082 0 : this->m_DesignSuppHeatingCapacity = SteamCoils::GetCoilCapacity(
1083 0 : state, "Coil:Heating:Steam", this->m_SuppHeatCoilName, state.dataUnitarySystems->initUnitarySystemsErrorsFound);
1084 :
1085 : } // from IF(UnitarySystem(UnitarySysNum)%SuppHeatCoilType_Num == Coil_HeatingSteam) THEN
1086 : } // from IF( FirstHVACIteration ) THEN
1087 :
1088 6060022 : this->m_IterationCounter += 1;
1089 :
1090 6060022 : if (this->m_MySetPointCheckFlag) {
1091 3388 : if (!state.dataGlobal->SysSizingCalc && state.dataHVACGlobal->DoSetPointTest) {
1092 592 : bool e = false;
1093 592 : if (this->m_CoolCoilExists) e = this->checkNodeSetPoint(state, AirLoopNum, this->CoolCtrlNode, CoolingCoil, OAUCoilOutTemp);
1094 592 : if (this->m_HeatCoilExists) e = this->checkNodeSetPoint(state, AirLoopNum, this->HeatCtrlNode, HeatingCoil, OAUCoilOutTemp) || e;
1095 592 : if (this->m_SuppCoilExists) e = this->checkNodeSetPoint(state, AirLoopNum, this->SuppCtrlNode, SuppHeatCoil, OAUCoilOutTemp) || e;
1096 592 : if (e) ShowFatalError(state, "Previous errors cause termination.");
1097 592 : this->m_MySetPointCheckFlag = false;
1098 : }
1099 : }
1100 :
1101 6060022 : if (m_setFaultModelInput) {
1102 1877669 : if ((!state.dataGlobal->WarmupFlag) && (!state.dataGlobal->DoingSizing) && (!state.dataGlobal->KickOffSimulation)) {
1103 :
1104 : // check FaultsManager if connection exists
1105 592 : FaultsManager::SetFaultyCoilSATSensor(state, this->UnitType, this->Name, this->m_FaultyCoilSATFlag, this->m_FaultyCoilSATIndex);
1106 592 : if (this->m_FaultyCoilSATFlag) {
1107 0 : if (this->m_ControlType != UnitarySysCtrlType::Setpoint) {
1108 0 : ShowWarningError(state,
1109 0 : state.dataFaultsMgr->FaultsCoilSATSensor(this->m_FaultyCoilSATIndex).FaultType + ": " +
1110 0 : state.dataFaultsMgr->FaultsCoilSATSensor(this->m_FaultyCoilSATIndex).Name);
1111 0 : ShowContinueError(state, "For : " + this->UnitType + ": " + this->Name);
1112 0 : ShowContinueError(state,
1113 : "The specified unitary system is not controlled on leaving air temperature. The coil SAT sensor "
1114 : "fault model will not be applied.");
1115 0 : this->m_FaultyCoilSATFlag = false;
1116 : }
1117 : }
1118 592 : m_setFaultModelInput = false;
1119 : }
1120 : }
1121 :
1122 : // re-set water-side economizer flags each time step
1123 6060022 : if (this->m_TemperatureOffsetControlActive && !this->m_WaterHRPlantLoopModel) {
1124 82588 : if (state.dataLoopNodes->Node(this->CoolCoilFluidInletNode).Temp >
1125 41294 : (state.dataLoopNodes->Node(this->AirInNode).Temp - this->m_minAirToWaterTempOffset)) {
1126 : // disable coilsystem if entering fluid temp is > entering air temp minus user specified temp offset
1127 40281 : this->temperatureOffsetControlStatus = 0;
1128 : } else {
1129 : // enable coilsystem waterside economizer mode
1130 1013 : this->temperatureOffsetControlStatus = 1;
1131 : }
1132 : }
1133 6060022 : if (AirLoopNum > 0) {
1134 4730329 : if (this->m_sysType == SysType::CoilCoolingWater) {
1135 57526 : if (this->m_waterSideEconomizerFlag) { // CoilSystem:Cooling:Water has an input for economizer lockout
1136 57526 : state.dataUnitarySystems->economizerFlag = state.dataAirLoop->AirLoopControlInfo(AirLoopNum).EconoActive;
1137 57526 : if (state.dataUnitarySystems->economizerFlag) {
1138 : // user input economizer lockout will disable heat recovery loop AND water economizer
1139 54 : this->temperatureOffsetControlStatus = 0;
1140 : }
1141 : } else {
1142 0 : state.dataUnitarySystems->economizerFlag = false;
1143 : }
1144 : } else {
1145 4672803 : state.dataUnitarySystems->economizerFlag = state.dataAirLoop->AirLoopControlInfo(AirLoopNum).EconoActive;
1146 : }
1147 : }
1148 :
1149 6060022 : this->m_CoolingPartLoadFrac = 0.0;
1150 6060022 : this->m_HeatingPartLoadFrac = 0.0;
1151 6060022 : this->m_SuppHeatPartLoadFrac = 0.0;
1152 6060022 : this->m_CoolingCycRatio = 0.0;
1153 6060022 : this->m_CoolingSpeedRatio = 0.0;
1154 6060022 : this->m_CoolingSpeedNum = 0;
1155 6060022 : this->m_HeatingCycRatio = 0.0;
1156 6060022 : this->m_HeatingSpeedRatio = 0.0;
1157 6060022 : this->m_HeatingSpeedNum = 0;
1158 6060022 : this->m_SuppHeatingSpeedNum = 0;
1159 6060022 : this->m_HeatingCoilSensDemand = 0.0;
1160 6060022 : this->m_CoolingCoilSensDemand = 0.0;
1161 6060022 : this->m_CoolingCoilLatentDemand = 0.0;
1162 6060022 : this->m_DehumidInducedHeatingDemandRate = 0.0;
1163 6060022 : this->CoolCoilWaterFlowRatio = 0.0;
1164 6060022 : this->HeatCoilWaterFlowRatio = 0.0;
1165 :
1166 : // water/steam coil initialization
1167 6060022 : if (this->CoolCoilFluidInletNode > 0) {
1168 93332 : Real64 mdot = 0.0;
1169 93332 : PlantUtilities::SetComponentFlowRate(state, mdot, this->CoolCoilFluidInletNode, this->CoolCoilFluidOutletNodeNum, this->CoolCoilPlantLoc);
1170 : }
1171 6060022 : if (this->HeatCoilFluidInletNode > 0) {
1172 74334 : Real64 mdot = 0.0;
1173 74334 : PlantUtilities::SetComponentFlowRate(state, mdot, this->HeatCoilFluidInletNode, this->HeatCoilFluidOutletNodeNum, this->HeatCoilPlantLoc);
1174 : }
1175 6060022 : if (this->m_SuppCoilFluidInletNode > 0) {
1176 0 : Real64 mdot = 0.0;
1177 0 : PlantUtilities::SetComponentFlowRate(
1178 : state, mdot, this->m_SuppCoilFluidInletNode, this->m_SuppCoilFluidOutletNodeNum, this->m_SuppCoilPlantLoc);
1179 : }
1180 :
1181 6060022 : this->m_InitHeatPump = true;
1182 6060022 : state.dataUnitarySystems->m_massFlow1 = 0.0;
1183 6060022 : state.dataUnitarySystems->m_massFlow2 = 0.0;
1184 6060022 : state.dataUnitarySystems->m_runTimeFraction1 = 0.0;
1185 6060022 : state.dataUnitarySystems->m_runTimeFraction2 = 0.0;
1186 6060022 : if (this->m_sysType == SysType::PackagedAC || this->m_sysType == SysType::PackagedHP || this->m_sysType == SysType::PackagedWSHP) {
1187 : // this should be done in the child. DXElecHeatingPower not reset to 0 if coil is off, ZoneSysAvailManager
1188 : // zero the fan and DX coils electricity consumption
1189 1231508 : state.dataHVACGlobal->DXElecCoolingPower = 0.0;
1190 1231508 : state.dataHVACGlobal->DXElecHeatingPower = 0.0;
1191 1231508 : state.dataHVACGlobal->ElecHeatingCoilPower = 0.0;
1192 : }
1193 6060022 : }
1194 :
1195 982 : bool UnitarySys::checkNodeSetPoint(EnergyPlusData &state,
1196 : int const AirLoopNum, // number of the current air loop being simulated
1197 : int const ControlNode, // Node to test for set point
1198 : int const CoilType, // True if cooling coil, then test for HumRatMax set point
1199 : Real64 const OAUCoilOutTemp // the coil inlet temperature of OutdoorAirUnit
1200 : )
1201 : {
1202 :
1203 : // SUBROUTINE INFORMATION:
1204 : // AUTHOR Richard Raustad
1205 : // DATE WRITTEN March 2013
1206 :
1207 : // PURPOSE OF THIS SUBROUTINE:
1208 : // This subroutine checks for proper set point at control node.
1209 : constexpr static std::array<std::string_view, 3> coilTypes = {"cooling", "heating", "supplemental"};
1210 982 : bool SetPointErrorFlag = false;
1211 :
1212 982 : if (ControlNode == 0) {
1213 492 : if (this->m_ControlType == UnitarySysCtrlType::Setpoint) {
1214 0 : int coilOutNode = this->CoolCoilOutletNodeNum;
1215 0 : if (CoilType == HeatingCoil) coilOutNode = this->HeatCoilOutletNodeNum;
1216 0 : if (CoilType == SuppHeatCoil) coilOutNode = this->SuppCoilOutletNodeNum;
1217 :
1218 0 : ShowSevereError(state, format("checkNodeSetPoint: Missing {} set point in {} = {}", coilTypes[CoilType], this->UnitType, this->Name));
1219 0 : ShowContinueError(state,
1220 0 : format("...Setpoint is required at system air outlet node = {} or {} coil air outlet node = {}",
1221 0 : state.dataLoopNodes->NodeID(this->AirOutNode),
1222 0 : coilTypes[CoilType],
1223 0 : state.dataLoopNodes->NodeID(coilOutNode)));
1224 0 : SetPointErrorFlag = true;
1225 : }
1226 492 : return SetPointErrorFlag;
1227 : }
1228 :
1229 490 : if (AirLoopNum == -1) { // Outdoor Air Unit
1230 8 : state.dataLoopNodes->Node(ControlNode).TempSetPoint = OAUCoilOutTemp; // Set the coil outlet temperature
1231 8 : if (this->m_ISHundredPercentDOASDXCoil) {
1232 0 : this->frostControlSetPointLimit(state,
1233 : this->m_DesiredOutletTemp,
1234 0 : state.dataLoopNodes->Node(ControlNode).HumRatMax,
1235 0 : state.dataEnvrn->OutBaroPress,
1236 : this->DesignMinOutletTemp,
1237 : 1);
1238 : }
1239 : } else { // Not an Outdoor air unit
1240 :
1241 482 : if (state.dataLoopNodes->Node(ControlNode).TempSetPoint == DataLoopNode::SensedNodeFlagValue &&
1242 0 : this->m_ControlType == UnitarySysCtrlType::Setpoint) {
1243 0 : if (!state.dataGlobal->AnyEnergyManagementSystemInModel) {
1244 0 : ShowSevereError(state, this->UnitType + ": Missing temperature setpoint for unitary system = " + this->Name);
1245 0 : ShowContinueError(state, " use a Setpoint Manager to establish a setpoint at the coil control node.");
1246 0 : SetPointErrorFlag = true;
1247 : } else {
1248 0 : EMSManager::CheckIfNodeSetPointManagedByEMS(
1249 : state, ControlNode, EMSManager::SPControlType::TemperatureSetPoint, SetPointErrorFlag);
1250 0 : if (SetPointErrorFlag) {
1251 0 : ShowSevereError(state, this->UnitType + ": Missing temperature setpoint for unitary system = " + this->Name);
1252 0 : ShowContinueError(state, " use a Setpoint Manager to establish a setpoint at the coil control node.");
1253 0 : ShowContinueError(state, " or use an EMS actuator to establish a temperature setpoint at the coil control node.");
1254 : }
1255 : }
1256 : }
1257 1008 : if ((this->m_DehumidControlType_Num != DehumCtrlType::None) &&
1258 70 : (state.dataLoopNodes->Node(ControlNode).HumRatMax == DataLoopNode::SensedNodeFlagValue) &&
1259 511 : this->m_ControlType == UnitarySysCtrlType::Setpoint && CoilType == CoolingCoil) {
1260 0 : if (!state.dataGlobal->AnyEnergyManagementSystemInModel &&
1261 0 : state.dataLoopNodes->Node(this->CoolCoilOutletNodeNum).HumRatMax == DataLoopNode::SensedNodeFlagValue) {
1262 0 : ShowSevereError(state, this->UnitType + ": Missing humidity ratio setpoint (HUMRATMAX) for unitary system = " + this->Name);
1263 0 : ShowContinueError(state, " use a Setpoint Manager to establish a setpoint at the coil control node.");
1264 0 : SetPointErrorFlag = true;
1265 0 : } else if (state.dataGlobal->AnyEnergyManagementSystemInModel) {
1266 0 : EMSManager::CheckIfNodeSetPointManagedByEMS(
1267 : state, ControlNode, EMSManager::SPControlType::HumidityRatioMaxSetPoint, SetPointErrorFlag);
1268 0 : if (SetPointErrorFlag) {
1269 0 : ShowSevereError(state,
1270 0 : this->UnitType + ": Missing maximum humidity ratio setpoint (HUMRATMAX) for unitary system = " + this->Name);
1271 0 : ShowContinueError(state, " use a Setpoint Manager to establish a setpoint at the coil control node.");
1272 0 : ShowContinueError(state, " or use an EMS actuator to establish a maximum humidity ratio setpoint.");
1273 : }
1274 : }
1275 : }
1276 : }
1277 490 : return SetPointErrorFlag; // these later errors will also cause a fatal error
1278 : }
1279 :
1280 43624 : void UnitarySys::frostControlSetPointLimit(EnergyPlusData &state,
1281 : Real64 &TempSetPoint, // temperature setpoint of the sensor node
1282 : Real64 &HumRatSetPoint, // humidity ratio setpoint of the sensor node
1283 : Real64 const BaroPress, // baromtric pressure, Pa [N/m^2]
1284 : Real64 const TfrostControl, // minimum temperature limit for forst control
1285 : int const ControlMode // temperature or humidity control mode
1286 : )
1287 : {
1288 :
1289 : // SUBROUTINE INFORMATION:
1290 : // AUTHOR Bereket Nigusse, FSEC
1291 : // DATE WRITTEN January 2013
1292 :
1293 : // PURPOSE OF THIS SUBROUTINE:
1294 : // Controls the forst formation condition based on user specified minimum DX coil outlet
1295 : // air temperature. Resets the cooling setpoint based on the user specified limiting
1296 : // temperature for frost control.
1297 :
1298 : // SUBROUTINE PARAMETER DEFINITIONS:
1299 43624 : int constexpr RunOnSensible(1); // identifier for temperature (sensible load) control
1300 43624 : int constexpr RunOnLatent(2); // identifier for humidity (latent load) control
1301 : static constexpr std::string_view routineName("FrostControlSetPointLimit");
1302 :
1303 43624 : Real64 AirMassFlow = state.dataLoopNodes->Node(this->CoolCoilInletNodeNum).MassFlowRate;
1304 51171 : if (ControlMode == RunOnSensible && AirMassFlow > DataHVACGlobals::SmallAirVolFlow &&
1305 7547 : TempSetPoint < state.dataLoopNodes->Node(this->CoolCoilInletNodeNum).Temp) {
1306 6841 : if (TempSetPoint < TfrostControl) {
1307 0 : TempSetPoint = TfrostControl;
1308 0 : this->m_FrostControlStatus = 1;
1309 : }
1310 42652 : } else if (ControlMode == RunOnLatent && AirMassFlow > DataHVACGlobals::SmallAirVolFlow &&
1311 5869 : HumRatSetPoint < state.dataLoopNodes->Node(this->CoolCoilInletNodeNum).HumRat) {
1312 5869 : Real64 HumRatioSat = Psychrometrics::PsyWFnTdpPb(state, TfrostControl, BaroPress, routineName);
1313 5869 : if (HumRatioSat > HumRatSetPoint) {
1314 346 : HumRatSetPoint = HumRatioSat;
1315 346 : this->m_FrostControlStatus = 2;
1316 : }
1317 : } else {
1318 30914 : this->m_FrostControlStatus = 0;
1319 : }
1320 43624 : }
1321 :
1322 753 : void UnitarySys::getUnitarySystemInput(EnergyPlusData &state, std::string_view objectName, bool const ZoneEquipment, int const ZoneOAUnitNum)
1323 : {
1324 :
1325 753 : bool errorsFound(false);
1326 753 : UnitarySys::allocateUnitarySys(state);
1327 :
1328 753 : UnitarySys::getDXCoilSystemData(state, objectName, ZoneEquipment, ZoneOAUnitNum, errorsFound);
1329 753 : UnitarySys::getCoilWaterSystemInputData(state, objectName, ZoneEquipment, ZoneOAUnitNum, errorsFound);
1330 753 : UnitarySys::getPackagedTerminalUnitData(state, objectName, ZoneEquipment, ZoneOAUnitNum, errorsFound);
1331 753 : UnitarySys::getUnitarySystemInputData(state, objectName, ZoneEquipment, ZoneOAUnitNum, errorsFound);
1332 :
1333 : // all systems should have been processed at this point? I think so, so don't need to if test this call?
1334 1506 : if (int(state.dataUnitarySystems->unitarySys.size()) == state.dataUnitarySystems->numUnitarySystems &&
1335 753 : state.dataZoneEquip->ZoneEquipInputsFilled)
1336 722 : setupAllOutputVars(state, state.dataUnitarySystems->numUnitarySystems);
1337 :
1338 753 : if (errorsFound) {
1339 0 : ShowFatalError(state, "getUnitarySystemInputData: previous errors cause termination. Check inputs");
1340 : }
1341 753 : }
1342 :
1343 592 : void UnitarySys::sizeSystem(EnergyPlusData &state, bool const FirstHVACIteration, int const AirLoopNum)
1344 : {
1345 :
1346 : // SUBROUTINE INFORMATION:
1347 : // AUTHOR Richard Raustad, FSEC
1348 : // DATE WRITTEN February 2013
1349 :
1350 : // PURPOSE OF THIS SUBROUTINE:
1351 : // This subroutine is for sizing unitary system components for which nominal cpacities
1352 : // and flow rates have not been specified in the input. Coil sizing is preformed in the coil module.
1353 : // Future modifications will size coils here and "push" this info to the specific coil.
1354 :
1355 : // METHODOLOGY EMPLOYED:
1356 : // Obtains heating capacities and flow rates from the zone or system sizing arrays.
1357 : // NOTE: In UNITARYSYSTEM:HEATPUMP:AIRTOAIR we are sizing the heating capacity to be
1358 : // equal to the cooling capacity. Thus the cooling and
1359 : // and heating capacities of a DX heat pump system will be identical. In real life the ARI
1360 : // heating and cooling capacities are close but not identical.
1361 :
1362 : // SUBROUTINE PARAMETER DEFINITIONS:
1363 : static constexpr std::string_view RoutineName("SizeUnitarySystem");
1364 :
1365 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
1366 : int Iter; // iteration count
1367 : int MSHPIndex; // Index to design Specification object
1368 : int BranchNum; // Index to branch on air loop
1369 : Real64 SystemFlow; // AirloopHVAC flow rate [m3/s]
1370 : Real64 BranchFanFlow; // branch fan flow rate [m3/s]
1371 : bool ErrFound; // logical error flag
1372 1184 : std::string FanType; // fan type
1373 1184 : std::string m_FanName; // fan name
1374 1184 : std::string SystemType; // type of air loop equipment
1375 1184 : std::string HXCoilName; // cooling coil name in HXAssisted parent
1376 : int ActualCoolCoilType; // cooling coil type in HXAssisted parent
1377 : DataHVACGlobals::AirDuctType SaveCurDuctType; // used during sizing to save the current duct type
1378 : Real64 QActual; // water coil output [W]
1379 : Real64 capacityMultiplier; // used for ASHRAE model sizing
1380 :
1381 : Real64 TempSize; // DataSizing::AutoSized value of input field
1382 592 : int FieldNum = 2; // IDD numeric field number where input field description is found
1383 : int SizingMethod; // Integer representation of sizing method (e.g., DataHVACGlobals::CoolingAirflowSizing, DataSizing::HeatingCapacitySizing,
1384 : // etc.)
1385 : bool PrintFlag; // TRUE when sizing information is reported in the eio file
1386 : bool SizingDesRunThisSys; // checks if sizing was performed
1387 592 : int NumAirLoopZones(0); // number of zone inlet nodes in an air loop
1388 592 : int ZoneInSysIndex(0); // number of zone inlet nodes counter in an airloop
1389 592 : Real64 SumOfMassFlowRateMax(0.0); // the sum of zone inlet mass flow rates
1390 592 : int ZoneInletNodeNum(0); // zone inlet nodes node number
1391 : Real64 minNoLoadFlow; // used for sizing MaxNoCoolHeatVolFlow for SingleZoneVAV method
1392 592 : Real64 dummy(0.0);
1393 : //////////// hoisted into namespace ////////////////////////////////////////////////
1394 : // static int NumUnitarySystemsSized( 0 ); // counter used to delete UnitarySystemNumericFields array after last system is sized
1395 : ////////////////////////////////////////////////////////////////////////////////////
1396 : // References
1397 592 : DataSizing::ZoneEqSizingData *select_EqSizing(nullptr);
1398 :
1399 592 : auto &OASysEqSizing(state.dataSize->OASysEqSizing);
1400 :
1401 : // sweep specific data into one pointer to avoid if statements throughout this subroutine
1402 592 : if (state.dataSize->CurOASysNum > 0) {
1403 2 : select_EqSizing = &OASysEqSizing(state.dataSize->CurOASysNum);
1404 590 : } else if (state.dataSize->CurSysNum > 0) {
1405 384 : select_EqSizing = &state.dataSize->UnitarySysEqSizing(state.dataSize->CurSysNum);
1406 : // this was reseting data set by OutdoorAirUnit when UnitarySystem is child
1407 : // question is then who resets these (#8751 temporary fix)?
1408 : // move here for now and only reset UnitarySystem flags, then find better way to do this
1409 384 : select_EqSizing->AirFlow = false;
1410 384 : select_EqSizing->CoolingAirFlow = false;
1411 384 : select_EqSizing->HeatingAirFlow = false;
1412 384 : select_EqSizing->AirVolFlow = 0.0;
1413 384 : select_EqSizing->CoolingAirVolFlow = 0.0;
1414 384 : select_EqSizing->HeatingAirVolFlow = 0.0;
1415 384 : select_EqSizing->Capacity = false;
1416 384 : select_EqSizing->CoolingCapacity = false;
1417 384 : select_EqSizing->HeatingCapacity = false;
1418 384 : select_EqSizing->DesCoolingLoad = 0.0;
1419 384 : select_EqSizing->DesHeatingLoad = 0.0;
1420 384 : select_EqSizing->OAVolFlow = 0.0; // UnitarySys doesn't have OA
1421 206 : } else if (state.dataSize->CurZoneEqNum > 0) {
1422 206 : select_EqSizing = &state.dataSize->ZoneEqSizing(state.dataSize->CurZoneEqNum);
1423 206 : state.dataSize->ZoneEqUnitarySys = true;
1424 : // UnitarySystem never set this flag. Probably should for zone equipment.
1425 398 : if ((this->m_sysType == SysType::PackagedAC || this->m_sysType == SysType::PackagedHP || this->m_sysType == SysType::PackagedWSHP) &&
1426 192 : this->m_IsDXCoil)
1427 192 : state.dataSize->ZoneEqDXCoil = true;
1428 :
1429 : } else {
1430 0 : assert(false);
1431 : }
1432 : // Object Data, points to specific array
1433 592 : DataSizing::ZoneEqSizingData &EqSizing(*select_EqSizing);
1434 :
1435 : // coil sizing requires this information to check proper flow/capacity limits (#8761)
1436 592 : if (this->m_ISHundredPercentDOASDXCoil) {
1437 5 : state.dataHVACGlobal->DXCT = 2; // uses 100% DX coil flow limits
1438 : } else {
1439 587 : state.dataHVACGlobal->DXCT = 1; // uses normal DX coil flow limits
1440 : }
1441 : // sizing may need to know what type of coil is being sized
1442 592 : state.dataSize->DataCoolCoilType = this->m_CoolingCoilType_Num;
1443 592 : state.dataSize->DataCoolCoilIndex = this->m_CoolingCoilIndex;
1444 :
1445 : bool anyEMSRan;
1446 592 : EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::UnitarySystemSizing, anyEMSRan, ObjexxFCL::Optional_int_const()); // calling point
1447 : bool HardSizeNoDesRun; // Indicator to a hard-sized field with no design sizing data
1448 :
1449 : // Initiate all reporting variables
1450 1390 : if (((state.dataSize->CurOASysNum > 0 || state.dataSize->CurSysNum > 0) && state.dataSize->SysSizingRunDone) ||
1451 466 : (state.dataSize->CurZoneEqNum > 0 && state.dataSize->ZoneSizingRunDone)) {
1452 538 : HardSizeNoDesRun = false;
1453 : } else {
1454 54 : HardSizeNoDesRun = true;
1455 : }
1456 1184 : std::string SizingString;
1457 1184 : std::string CompName = this->Name;
1458 1184 : std::string CompType = this->UnitType;
1459 592 : int CoolingSAFlowMethod = this->m_CoolingSAFMethod;
1460 592 : int HeatingSAFlowMethod = this->m_HeatingSAFMethod;
1461 : // can't reset this to 0 for systems where DX heating coil is in downstream unit and DX cooling coil is in upstream unit
1462 : // DXCoolCap = 0.0;
1463 592 : state.dataSize->UnitaryHeatCap = 0.0;
1464 592 : state.dataSize->SuppHeatCap = 0.0;
1465 592 : bool TempCoolingLoad = state.dataUnitarySystems->CoolingLoad;
1466 592 : bool TempHeatingLoad = state.dataUnitarySystems->HeatingLoad;
1467 592 : state.dataUnitarySystems->CoolingLoad = true;
1468 592 : state.dataUnitarySystems->HeatingLoad = false;
1469 592 : state.dataSize->ZoneCoolingOnlyFan = false;
1470 592 : state.dataSize->ZoneHeatingOnlyFan = false;
1471 592 : bool IsAutoSize = false;
1472 592 : Real64 SysCoolingFlow = 0.0;
1473 592 : Real64 SysHeatingFlow = 0.0;
1474 592 : Real64 CoolCapAtPeak = 0.0;
1475 592 : Real64 HeatCapAtPeak = 0.0;
1476 :
1477 592 : if (state.dataSize->CurSysNum > 0 && state.dataSize->CurOASysNum == 0 && this->m_FanExists) {
1478 102 : if (this->m_FanType_Num == DataHVACGlobals::FanType_SystemModelObject) {
1479 41 : state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).supFanVecIndex = this->m_FanIndex;
1480 41 : state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).supFanModelType = DataAirSystems::ObjectVectorOOFanSystemModel;
1481 41 : state.dataSize->DataFanEnumType = DataAirSystems::ObjectVectorOOFanSystemModel;
1482 41 : state.dataSize->DataFanIndex = this->m_FanIndex;
1483 : } else {
1484 61 : state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).SupFanNum = this->m_FanIndex;
1485 61 : state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).supFanModelType = DataAirSystems::StructArrayLegacyFanModels;
1486 61 : state.dataSize->DataFanEnumType = DataAirSystems::StructArrayLegacyFanModels;
1487 61 : state.dataSize->DataFanIndex = this->m_FanIndex;
1488 : }
1489 102 : if (this->m_FanPlace == FanPlace::BlowThru) {
1490 84 : state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).supFanLocation = DataAirSystems::FanPlacement::BlowThru;
1491 18 : } else if (this->m_FanPlace == FanPlace::DrawThru) {
1492 18 : state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).supFanLocation = DataAirSystems::FanPlacement::DrawThru;
1493 : }
1494 490 : } else if (state.dataSize->CurZoneEqNum > 0 && this->m_FanExists) {
1495 198 : if (this->m_FanType_Num == DataHVACGlobals::FanType_SystemModelObject) {
1496 16 : state.dataSize->DataFanEnumType = DataAirSystems::ObjectVectorOOFanSystemModel;
1497 : } else {
1498 182 : state.dataSize->DataFanEnumType = DataAirSystems::StructArrayLegacyFanModels;
1499 : }
1500 198 : state.dataSize->DataFanIndex = this->m_FanIndex;
1501 198 : if (this->m_FanPlace == FanPlace::BlowThru) {
1502 58 : state.dataSize->DataFanPlacement = DataSizing::ZoneFanPlacement::BlowThru;
1503 140 : } else if (this->m_FanPlace == FanPlace::DrawThru) {
1504 140 : state.dataSize->DataFanPlacement = DataSizing::ZoneFanPlacement::DrawThru;
1505 : }
1506 : }
1507 :
1508 592 : if (this->ATMixerExists && state.dataSize->CurZoneEqNum > 0) { // set up ATMixer conditions for scalable capacity sizing
1509 29 : SingleDuct::setATMixerSizingProperties(state, this->m_ATMixerIndex, this->ControlZoneNum, state.dataSize->CurZoneEqNum);
1510 : }
1511 :
1512 592 : Real64 coolingCapacityMultiplier = 1.0;
1513 592 : Real64 heatingCapacityMultiplier = 1.0;
1514 592 : if (this->m_HVACSizingIndex > 0) {
1515 0 : if (this->m_CoolingCapMethod == DataSizing::FractionOfAutosizedCoolingCapacity) {
1516 0 : coolingCapacityMultiplier = this->m_DesignCoolingCapacity;
1517 0 : this->m_DesignCoolingCapacity = DataSizing::AutoSize;
1518 : }
1519 0 : if (this->m_HeatingCapMethod == DataSizing::FractionOfAutosizedHeatingCapacity) {
1520 0 : heatingCapacityMultiplier = this->m_DesignHeatingCapacity;
1521 0 : this->m_DesignHeatingCapacity = DataSizing::AutoSize;
1522 : }
1523 : }
1524 :
1525 : // zone equipment that have OA mixers will need to know the OA flow rate to size coil inlet conditions
1526 592 : bool SizingDesRunThisZone = false;
1527 592 : if (this->OAMixerExists) {
1528 167 : if (state.dataSize->CurZoneEqNum > 0) {
1529 167 : CheckThisZoneForSizing(state, state.dataSize->CurZoneEqNum, SizingDesRunThisZone);
1530 167 : if (this->m_CoolOutAirVolFlow == DataSizing::AutoSize || this->m_HeatOutAirVolFlow == DataSizing::AutoSize) {
1531 110 : CheckZoneSizing(state, this->UnitType, this->Name);
1532 : }
1533 : // initialize OA flow for sizing other inputs (e.g., capacity)
1534 167 : if (this->m_CoolOutAirVolFlow == DataSizing::AutoSize) {
1535 110 : EqSizing.OAVolFlow = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).MinOA;
1536 : } else {
1537 57 : EqSizing.OAVolFlow = this->m_CoolOutAirVolFlow;
1538 : }
1539 167 : if (this->m_HeatOutAirVolFlow != DataSizing::AutoSize) {
1540 57 : EqSizing.OAVolFlow = max(EqSizing.OAVolFlow, this->m_HeatOutAirVolFlow);
1541 : }
1542 : }
1543 : }
1544 :
1545 592 : PrintFlag = false;
1546 : // STEP 1: find the DataSizing::AutoSized cooling air flow rate and capacity
1547 : // Note: this call will request fan heat and size the fan.
1548 : // Either the few lines above are too early, or there needs to be a way to avoid requesting fan heat from
1549 : // BaseSizerWithFanHeatInputs::initializeWithinEP so the fan doesn't size until the parent wants it to size.
1550 : // see PackagedTerminalHeatPumpVSAS.idf where fan is not sized large enough for cooling coil air flow rate.
1551 :
1552 : // delay fan sizing in case a VS fan is used and air flow needs to be modified above max design flow
1553 : // this may also mean capacity result does not include fan heat? and table diffs?
1554 : // and causes unit test failures, e.g., UnitarySystemModel_MultispeedDXCoilSizing.
1555 : // comment this out until the PTUnit to UnitarySystem #9273 branch is merged, so nothing changes
1556 : // until this is implemented, unbalanced air flow warnings show up in VS coil PTUnits
1557 : // int saveDataFanIndex = state.dataSize->DataFanIndex;
1558 : // state.dataSize->DataFanIndex = -1;
1559 :
1560 592 : bool coolingAirFlowIsAutosized = this->m_MaxCoolAirVolFlow == DataSizing::AutoSize;
1561 592 : bool heatingAirFlowIsAutosized = this->m_MaxHeatAirVolFlow == DataSizing::AutoSize;
1562 592 : if (this->m_CoolCoilExists) {
1563 591 : if (!this->m_HeatCoilExists) state.dataSize->ZoneCoolingOnlyFan = true;
1564 591 : TempSize = this->m_MaxCoolAirVolFlow;
1565 591 : SaveCurDuctType = state.dataSize->CurDuctType;
1566 : // might want to rethink this method. Tries to find the larger of cooling or heating capcity
1567 : // however, if there is no heating coil the cooling air flow rate is used, not the main flow rate
1568 : // this is fine if there are no other systems on the branch. CoilSystem does not do this (#8761).
1569 591 : if (this->m_sysType == SysType::Unitary) state.dataSize->CurDuctType = DataHVACGlobals::AirDuctType::Cooling;
1570 591 : bool errorsFound = false;
1571 591 : if ((CoolingSAFlowMethod == DataSizing::SupplyAirFlowRate) || (CoolingSAFlowMethod == DataSizing::None)) {
1572 1182 : CoolingAirFlowSizer sizingCoolingAirFlow;
1573 591 : sizingCoolingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
1574 1182 : SysCoolingFlow = sizingCoolingAirFlow.size(state, TempSize, errorsFound);
1575 0 : } else if (CoolingSAFlowMethod == DataSizing::FlowPerFloorArea) {
1576 0 : CoolingAirFlowSizer sizingCoolingAirFlow;
1577 0 : sizingCoolingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
1578 0 : SysCoolingFlow = sizingCoolingAirFlow.size(state, TempSize, errorsFound);
1579 0 : this->m_MaxCoolAirVolFlow = DataSizing::AutoSize;
1580 0 : } else if (CoolingSAFlowMethod == DataSizing::FractionOfAutosizedCoolingAirflow) {
1581 0 : TempSize = DataSizing::AutoSize;
1582 0 : CoolingAirFlowSizer sizingCoolingAirFlow;
1583 0 : sizingCoolingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
1584 0 : SysCoolingFlow = sizingCoolingAirFlow.size(state, TempSize, errorsFound);
1585 0 : SysCoolingFlow *= this->m_MaxCoolAirVolFlow;
1586 0 : this->m_MaxCoolAirVolFlow = DataSizing::AutoSize;
1587 0 : } else if (CoolingSAFlowMethod == DataSizing::FlowPerCoolingCapacity) {
1588 0 : if (this->m_DesignCoolingCapacity == DataSizing::AutoSize) {
1589 0 : TempSize = DataSizing::AutoSize;
1590 0 : CoolingAirFlowSizer sizingCoolingAirFlow;
1591 0 : sizingCoolingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
1592 0 : state.dataSize->DataFlowUsedForSizing = sizingCoolingAirFlow.size(state, TempSize, errorsFound);
1593 0 : SizingMethod = DataHVACGlobals::CoolingCapacitySizing;
1594 0 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_Cooling) {
1595 0 : state.dataSize->DataTotCapCurveIndex =
1596 0 : state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].getOpModeCapFTIndex(false);
1597 0 : state.dataSize->DataIsDXCoil = true;
1598 0 : } else if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_CoolingSingleSpeed ||
1599 0 : this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedCooling ||
1600 0 : this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_CoolingTwoSpeed ||
1601 0 : this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_CoolingTwoStageWHumControl) {
1602 0 : state.dataSize->DataTotCapCurveIndex = DXCoils::GetDXCoilCapFTCurveIndex(state, this->m_CoolingCoilIndex, ErrFound);
1603 0 : state.dataSize->DataIsDXCoil = true;
1604 : }
1605 0 : CoolingCapacitySizer sizerCoolingCapacity;
1606 0 : sizerCoolingCapacity.overrideSizingString(SizingString);
1607 0 : sizerCoolingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
1608 0 : CoolCapAtPeak = sizerCoolingCapacity.size(state, TempSize, errorsFound);
1609 0 : SysCoolingFlow = CoolCapAtPeak * this->m_MaxCoolAirVolFlow;
1610 0 : state.dataSize->DataTotCapCurveIndex = 0;
1611 0 : EqSizing.CoolingCapacity = true;
1612 0 : EqSizing.DesCoolingLoad = CoolCapAtPeak;
1613 : } else {
1614 0 : SysCoolingFlow = this->m_DesignCoolingCapacity * this->m_MaxCoolAirVolFlow;
1615 0 : CoolCapAtPeak = this->m_DesignCoolingCapacity;
1616 0 : state.dataSize->DXCoolCap = CoolCapAtPeak;
1617 : }
1618 0 : this->m_MaxCoolAirVolFlow = DataSizing::AutoSize;
1619 : } else {
1620 : // should never happen
1621 0 : ShowSevereError(state, std::string{RoutineName} + ": " + CompType + " = " + std::string{CompName});
1622 0 : ShowContinueError(state, "Illegal entry for Cooling Supply Air Flow Rate Method.");
1623 : }
1624 :
1625 591 : state.dataSize->CurDuctType = SaveCurDuctType;
1626 591 : EqSizing.CoolingAirFlow = true;
1627 591 : EqSizing.CoolingAirVolFlow = SysCoolingFlow;
1628 :
1629 : // Cooling airflow should be known at this point. Now find DataSizing::AutoSized design cooling capacity.
1630 591 : if (CoolingSAFlowMethod != DataSizing::FlowPerCoolingCapacity && this->m_DesignCoolingCapacity < 0.0) {
1631 448 : SizingMethod = DataHVACGlobals::CoolingCapacitySizing;
1632 448 : state.dataSize->DataFlowUsedForSizing = EqSizing.CoolingAirVolFlow;
1633 448 : TempSize = DataSizing::AutoSize;
1634 : // could probably move this up outside the IF and delete then next group below in the else
1635 448 : switch (this->m_CoolingCoilType_Num) {
1636 47 : case DataHVACGlobals::CoilDX_Cooling: {
1637 47 : state.dataSize->DataTotCapCurveIndex =
1638 47 : state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].getOpModeCapFTIndex(false);
1639 47 : state.dataSize->DataIsDXCoil = true;
1640 47 : } break;
1641 360 : case DataHVACGlobals::CoilDX_CoolingSingleSpeed:
1642 : case DataHVACGlobals::CoilDX_MultiSpeedCooling:
1643 : case DataHVACGlobals::CoilDX_CoolingTwoSpeed:
1644 : case DataHVACGlobals::CoilDX_CoolingTwoStageWHumControl: {
1645 360 : state.dataSize->DataTotCapCurveIndex = DXCoils::GetDXCoilCapFTCurveIndex(state, this->m_CoolingCoilIndex, ErrFound);
1646 360 : state.dataSize->DataIsDXCoil = true;
1647 360 : } break;
1648 6 : case DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed: {
1649 6 : state.dataSize->DataTotCapCurveIndex = VariableSpeedCoils::GetVSCoilCapFTCurveIndex(state, this->m_CoolingCoilIndex, ErrFound);
1650 6 : state.dataSize->DataIsDXCoil = true;
1651 6 : } break;
1652 2 : case DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit: {
1653 2 : state.dataSize->DataTotCapCurveIndex = VariableSpeedCoils::GetVSCoilCapFTCurveIndex(state, this->m_CoolingCoilIndex, ErrFound);
1654 : // VS coil model does not check for flow/capacity ratio, this will disable that test in Capacity sizer
1655 : // state.dataSize->DataIsDXCoil = true;
1656 2 : } break;
1657 33 : default: {
1658 33 : } break;
1659 : }
1660 896 : CoolingCapacitySizer sizerCoolingCapacity;
1661 448 : sizerCoolingCapacity.overrideSizingString(SizingString);
1662 448 : state.dataSize->DataFracOfAutosizedCoolingCapacity = coolingCapacityMultiplier;
1663 448 : sizerCoolingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
1664 448 : CoolCapAtPeak = sizerCoolingCapacity.size(state, TempSize, errorsFound);
1665 : // this probably needs to be more specific. Letting heating coil size itself if user has scalable sizing
1666 448 : if (this->m_HVACSizingIndex <= 0) state.dataSize->DXCoolCap = CoolCapAtPeak;
1667 : // CoilSystem does not size the cooling coil (#8761)
1668 448 : if (BITF_TEST_ANY(BITF(this->m_sysType),
1669 : BITF(SysType::Unitary) | BITF(SysType::PackagedAC) | BITF(SysType::PackagedHP) | BITF(SysType::PackagedWSHP))) {
1670 206 : EqSizing.CoolingCapacity = true;
1671 206 : EqSizing.DesCoolingLoad = CoolCapAtPeak;
1672 448 : }
1673 143 : } else if (!HardSizeNoDesRun && (CoolingSAFlowMethod != DataSizing::FlowPerCoolingCapacity && this->m_DesignCoolingCapacity > 0.0)) {
1674 : // corrected code for #8756
1675 133 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_CoolingSingleSpeed ||
1676 52 : this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedCooling ||
1677 11 : this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_CoolingTwoSpeed ||
1678 3 : this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_CoolingTwoStageWHumControl) {
1679 86 : state.dataSize->DataTotCapCurveIndex = DXCoils::GetDXCoilCapFTCurveIndex(state, this->m_CoolingCoilIndex, ErrFound);
1680 86 : state.dataSize->DataIsDXCoil = true;
1681 : }
1682 89 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) {
1683 2 : state.dataSize->DataTotCapCurveIndex = VariableSpeedCoils::GetVSCoilCapFTCurveIndex(state, this->m_CoolingCoilIndex, ErrFound);
1684 2 : state.dataSize->DataIsDXCoil = true;
1685 : }
1686 89 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit) {
1687 0 : state.dataSize->DataTotCapCurveIndex = VariableSpeedCoils::GetVSCoilCapFTCurveIndex(state, this->m_CoolingCoilIndex, ErrFound);
1688 : // VS coil model does not check for flow/capacity ratio, this will disable that test in Capacity sizer
1689 : // state.dataSize->DataIsDXCoil = true;
1690 : }
1691 : // PTUnit does not call CapacitySizer and adjust capacity based on flow per capacity limits
1692 89 : if (this->m_sysType == SysType::PackagedAC || this->m_sysType == SysType::PackagedHP) {
1693 47 : state.dataSize->DataIsDXCoil = false;
1694 : }
1695 89 : SizingMethod = DataHVACGlobals::CoolingCapacitySizing;
1696 89 : state.dataSize->DataFlowUsedForSizing = EqSizing.CoolingAirVolFlow;
1697 178 : if (this->m_CoolingCapMethod == DataSizing::CapacityPerFloorArea ||
1698 89 : (this->m_CoolingCapMethod == DataSizing::CoolingDesignCapacity && this->m_DesignCoolingCapacity > 0.0)) {
1699 0 : TempSize = this->m_DesignCoolingCapacity;
1700 : } else {
1701 89 : TempSize = DataSizing::AutoSize;
1702 : }
1703 178 : CoolingCapacitySizer sizerCoolingCapacity;
1704 89 : sizerCoolingCapacity.overrideSizingString(SizingString);
1705 89 : state.dataSize->DataFracOfAutosizedCoolingCapacity = coolingCapacityMultiplier;
1706 89 : sizerCoolingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
1707 89 : CoolCapAtPeak = sizerCoolingCapacity.size(state, TempSize, errorsFound);
1708 89 : state.dataSize->DXCoolCap = CoolCapAtPeak;
1709 89 : EqSizing.CoolingCapacity = true;
1710 178 : EqSizing.DesCoolingLoad = CoolCapAtPeak;
1711 : } else {
1712 : // something seems missing here based on multiple conditional if above
1713 54 : if (this->m_DesignCoolingCapacity != DataSizing::AutoSize) CoolCapAtPeak = this->m_DesignCoolingCapacity;
1714 : }
1715 591 : state.dataSize->DataIsDXCoil = false;
1716 591 : state.dataSize->DataTotCapCurveIndex = 0;
1717 591 : state.dataSize->DataFlowUsedForSizing = 0.0;
1718 : }
1719 :
1720 : // STEP 2: find the DataSizing::AutoSized heating air flow rate and capacity
1721 592 : if (this->m_HeatCoilExists) {
1722 301 : if (!this->m_CoolCoilExists) state.dataSize->ZoneHeatingOnlyFan = true;
1723 301 : FieldNum = 7; // N7 , \field Heating Supply Air Flow Rate
1724 301 : SizingMethod = DataHVACGlobals::HeatingAirflowSizing;
1725 : // SizingString = UnitarySystemNumericFields(UnitarySysNum).FieldNames(FieldNum) + " [m3/s]";
1726 301 : TempSize = this->m_MaxHeatAirVolFlow;
1727 301 : SaveCurDuctType = state.dataSize->CurDuctType;
1728 301 : state.dataSize->CurDuctType = DataHVACGlobals::AirDuctType::Heating;
1729 301 : if ((HeatingSAFlowMethod == DataSizing::SupplyAirFlowRate) || (HeatingSAFlowMethod == DataSizing::None)) {
1730 301 : bool errorsFound = false;
1731 602 : HeatingAirFlowSizer sizingHeatingAirFlow;
1732 301 : sizingHeatingAirFlow.overrideSizingString(SizingString);
1733 301 : sizingHeatingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
1734 602 : SysHeatingFlow = sizingHeatingAirFlow.size(state, TempSize, errorsFound);
1735 0 : } else if (HeatingSAFlowMethod == DataSizing::FlowPerFloorArea) {
1736 0 : bool errorsFound = false;
1737 0 : HeatingAirFlowSizer sizingHeatingAirFlow;
1738 0 : sizingHeatingAirFlow.overrideSizingString(SizingString);
1739 0 : sizingHeatingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
1740 0 : SysHeatingFlow = sizingHeatingAirFlow.size(state, TempSize, errorsFound);
1741 0 : this->m_MaxHeatAirVolFlow = DataSizing::AutoSize;
1742 0 : } else if (HeatingSAFlowMethod == DataSizing::FractionOfAutosizedHeatingAirflow) {
1743 0 : TempSize = DataSizing::AutoSize;
1744 0 : bool errorsFound = false;
1745 0 : HeatingAirFlowSizer sizingHeatingAirFlow;
1746 0 : sizingHeatingAirFlow.overrideSizingString(SizingString);
1747 0 : sizingHeatingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
1748 0 : SysHeatingFlow = sizingHeatingAirFlow.size(state, TempSize, errorsFound);
1749 0 : SysHeatingFlow *= this->m_MaxHeatAirVolFlow;
1750 0 : this->m_MaxHeatAirVolFlow = DataSizing::AutoSize;
1751 0 : } else if (HeatingSAFlowMethod == DataSizing::FlowPerHeatingCapacity) {
1752 0 : TempSize = DataSizing::AutoSize;
1753 0 : bool errorsFound = false;
1754 0 : HeatingAirFlowSizer sizingHeatingAirFlow;
1755 0 : sizingHeatingAirFlow.overrideSizingString(SizingString);
1756 0 : sizingHeatingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
1757 0 : state.dataSize->DataFlowUsedForSizing = sizingHeatingAirFlow.size(state, TempSize, errorsFound);
1758 0 : SizingMethod = DataHVACGlobals::HeatingCapacitySizing;
1759 0 : state.dataSize->DataFracOfAutosizedCoolingCapacity = 1.0;
1760 0 : state.dataSize->DataHeatSizeRatio = this->m_HeatingSizingRatio;
1761 0 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedHeating ||
1762 0 : this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_HeatingEmpirical) {
1763 0 : state.dataSize->DataTotCapCurveIndex = DXCoils::GetDXCoilCapFTCurveIndex(state, this->m_HeatingCoilIndex, ErrFound);
1764 0 : state.dataSize->DataIsDXCoil = true;
1765 : }
1766 0 : if (state.dataSize->CurSysNum > 0)
1767 0 : state.dataAirLoop->AirLoopControlInfo(AirLoopNum).UnitarySysSimulating =
1768 : false; // set to false to allow calculation of actual heating capacity
1769 0 : HeatingCapacitySizer sizerHeatingCapacity;
1770 0 : sizerHeatingCapacity.overrideSizingString(SizingString);
1771 0 : sizerHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
1772 0 : HeatCapAtPeak = sizerHeatingCapacity.size(state, TempSize, errorsFound);
1773 0 : if (state.dataSize->CurSysNum > 0) state.dataAirLoop->AirLoopControlInfo(AirLoopNum).UnitarySysSimulating = true;
1774 0 : SysHeatingFlow = HeatCapAtPeak * this->m_MaxHeatAirVolFlow;
1775 0 : this->m_MaxHeatAirVolFlow = DataSizing::AutoSize;
1776 0 : EqSizing.HeatingCapacity = true;
1777 0 : EqSizing.DesHeatingLoad = HeatCapAtPeak;
1778 : } else {
1779 : // should never happen
1780 0 : ShowSevereError(state, std::string{RoutineName} + ": " + CompType + " = " + std::string{CompName});
1781 0 : ShowContinueError(state, "Illegal entry for Heating Supply Air Flow Rate Method.");
1782 : }
1783 :
1784 301 : state.dataSize->CurDuctType = SaveCurDuctType;
1785 301 : EqSizing.HeatingAirFlow = true;
1786 301 : EqSizing.HeatingAirVolFlow = SysHeatingFlow;
1787 :
1788 : // Heating airflow should be known at this point. Now find DataSizing::AutoSized design heating capacity.
1789 301 : if (HeatingSAFlowMethod != DataSizing::FlowPerHeatingCapacity && this->m_DesignHeatingCapacity == DataSizing::AutoSize) {
1790 272 : SizingMethod = DataHVACGlobals::HeatingCapacitySizing;
1791 272 : if (m_sysType == SysType::Unitary || m_sysType == SysType::CoilCoolingDX || m_sysType == SysType::CoilCoolingWater) {
1792 95 : state.dataSize->DataFlowUsedForSizing = EqSizing.HeatingAirVolFlow;
1793 : }
1794 272 : TempSize = DataSizing::AutoSize;
1795 272 : state.dataSize->DataHeatSizeRatio = this->m_HeatingSizingRatio;
1796 509 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_HeatingEmpirical ||
1797 237 : this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedHeating) {
1798 43 : state.dataSize->DataTotCapCurveIndex = DXCoils::GetDXCoilCapFTCurveIndex(state, this->m_HeatingCoilIndex, ErrFound);
1799 43 : state.dataSize->DataIsDXCoil = true;
1800 : }
1801 : // should have VS coil capFT here also
1802 294 : if (this->m_sysType == SysType::PackagedWSHP &&
1803 22 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit) {
1804 1 : state.dataSize->DataTotCapCurveIndex = VariableSpeedCoils::GetVSCoilCapFTCurveIndex(state, this->m_CoolingCoilIndex, ErrFound);
1805 : // VS coil model does not check for flow/capacity ratio, this will disable that test in Capacity sizer
1806 : // state.dataSize->DataIsDXCoil = true;
1807 : }
1808 : // PTUnit does not call CapacitySizer and adjust capacity based on flow per capacity limits
1809 272 : if (this->m_sysType == SysType::PackagedHP) {
1810 22 : state.dataSize->DataIsDXCoil = false;
1811 : }
1812 272 : if (state.dataSize->CurSysNum > 0)
1813 89 : state.dataAirLoop->AirLoopControlInfo(AirLoopNum).UnitarySysSimulating =
1814 : false; // set to false to allow calculation of actual heating capacity
1815 272 : bool errorsFound = false;
1816 544 : HeatingCapacitySizer sizerHeatingCapacity;
1817 272 : sizerHeatingCapacity.overrideSizingString(SizingString);
1818 272 : sizerHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
1819 272 : HeatCapAtPeak = sizerHeatingCapacity.size(state, TempSize, errorsFound);
1820 272 : if (state.dataSize->CurSysNum > 0) state.dataAirLoop->AirLoopControlInfo(AirLoopNum).UnitarySysSimulating = true;
1821 272 : EqSizing.HeatingCapacity = true;
1822 544 : EqSizing.DesHeatingLoad = HeatCapAtPeak;
1823 : } else {
1824 29 : if (!HardSizeNoDesRun &&
1825 18 : (HeatingSAFlowMethod != DataSizing::FlowPerHeatingCapacity && this->m_DesignHeatingCapacity != DataSizing::AutoSize)) {
1826 : // should have other DX heating coil types here
1827 18 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedHeating) {
1828 3 : SizingMethod = DataHVACGlobals::HeatingCapacitySizing;
1829 3 : state.dataSize->DataFlowUsedForSizing = EqSizing.HeatingAirVolFlow;
1830 3 : TempSize = DataSizing::AutoSize;
1831 3 : state.dataSize->DataHeatSizeRatio = this->m_HeatingSizingRatio;
1832 3 : state.dataSize->DataTotCapCurveIndex = DXCoils::GetDXCoilCapFTCurveIndex(state, this->m_HeatingCoilIndex, ErrFound);
1833 3 : state.dataSize->DataIsDXCoil = true;
1834 3 : if (state.dataSize->CurSysNum > 0)
1835 3 : state.dataAirLoop->AirLoopControlInfo(AirLoopNum).UnitarySysSimulating =
1836 : false; // set to false to allow calculation of actual heating capacity
1837 3 : bool errorsFound = false;
1838 6 : HeatingCapacitySizer sizerHeatingCapacity;
1839 3 : sizerHeatingCapacity.overrideSizingString(SizingString);
1840 3 : sizerHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
1841 3 : HeatCapAtPeak = sizerHeatingCapacity.size(state, TempSize, errorsFound);
1842 3 : if (state.dataSize->CurSysNum > 0) state.dataAirLoop->AirLoopControlInfo(AirLoopNum).UnitarySysSimulating = true;
1843 3 : EqSizing.HeatingCapacity = true;
1844 3 : EqSizing.DesHeatingLoad = HeatCapAtPeak;
1845 18 : }
1846 : } else {
1847 : // something seems missing here based on multiple conditional if above
1848 11 : if (this->m_DesignHeatingCapacity != DataSizing::AutoSize) HeatCapAtPeak = this->m_DesignHeatingCapacity;
1849 : }
1850 : }
1851 : // if ( ! UnitarySystem( UnitarySysNum ).CoolCoilExists )DXCoolCap = HeatCapAtPeak;
1852 301 : state.dataSize->DataIsDXCoil = false;
1853 301 : state.dataSize->DataTotCapCurveIndex = 0;
1854 301 : state.dataSize->DataFlowUsedForSizing = 0.0;
1855 301 : if (this->m_sysType == SysType::PackagedAC) EqSizing.HeatingCapacity = false;
1856 : }
1857 :
1858 592 : bool isWSVarSpeedCoolCoil = this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit;
1859 592 : bool isWSVarSpeedHeatCoil = this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit;
1860 592 : bool isVarSpeedCoolCoil = this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed;
1861 592 : bool isVarSpeedHeatCoil = this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed;
1862 :
1863 592 : Real64 saveRawHeatingCapacity = HeatCapAtPeak;
1864 :
1865 : // STEP 3A: Find VS cooling coil air flow to capacity ratio and adjust design air flow
1866 798 : if (EqSizing.DesCoolingLoad > 0.0 && state.dataSize->CurZoneEqNum > 0 &&
1867 394 : (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit ||
1868 420 : ((this->m_sysType == SysType::PackagedAC || this->m_sysType == SysType::PackagedHP) &&
1869 170 : this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed))) {
1870 8 : Real64 coolingToHeatingCapRatio = 1.0;
1871 14 : if ((isWSVarSpeedCoolCoil && this->m_MaxCoolAirVolFlow == DataSizing::AutoSize) ||
1872 15 : ((this->m_sysType == SysType::PackagedAC || this->m_sysType == SysType::PackagedHP) &&
1873 6 : this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed)) {
1874 8 : int normSpeed = state.dataVariableSpeedCoils->VarSpeedCoil(this->m_CoolingCoilIndex).NormSpedLevel;
1875 : Real64 coolingAirFlowToCapacityRatio =
1876 8 : state.dataVariableSpeedCoils->VarSpeedCoil(this->m_CoolingCoilIndex).MSRatedAirVolFlowPerRatedTotCap(normSpeed);
1877 8 : EqSizing.CoolingAirVolFlow = EqSizing.DesCoolingLoad * coolingAirFlowToCapacityRatio;
1878 8 : if (EqSizing.DesHeatingLoad > 0.0) coolingToHeatingCapRatio = EqSizing.DesCoolingLoad / EqSizing.DesHeatingLoad;
1879 : }
1880 12 : if (((isWSVarSpeedHeatCoil || isVarSpeedHeatCoil) && this->m_MaxHeatAirVolFlow == DataSizing::AutoSize) ||
1881 9 : ((this->m_sysType == SysType::PackagedAC || this->m_sysType == SysType::PackagedHP) &&
1882 4 : this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed)) {
1883 4 : int normSpeed = state.dataVariableSpeedCoils->VarSpeedCoil(this->m_HeatingCoilIndex).NumOfSpeeds;
1884 : Real64 heatingAirFlowToCapacityRatio =
1885 4 : state.dataVariableSpeedCoils->VarSpeedCoil(this->m_HeatingCoilIndex).MSRatedAirVolFlowPerRatedTotCap(normSpeed);
1886 4 : EqSizing.DesHeatingLoad *= coolingToHeatingCapRatio;
1887 4 : EqSizing.HeatingAirVolFlow = EqSizing.DesHeatingLoad * heatingAirFlowToCapacityRatio;
1888 : }
1889 : }
1890 :
1891 : // STEP 3B: use the greater of cooling and heating air flow rates for system flow
1892 : // previous version of E+ used maximum flow rate for unitary systems. Keep this methodology for now.
1893 : // Delete next 2 lines and uncomment 2 lines inside next if (HeatPump) statement to allow non-heat pump systems to operate at different flow
1894 : // rates (might require additional change to if block logic).
1895 : // UnitarySystem is sizing heating coil size = cooling coil size for 5Zone_Unitary_HXAssistedCoil (not a heat pump)
1896 : // and WaterSideEconomizer_PreCoolCoil (not a heat pump)
1897 : // and 5Zone_Unitary_VSDesuperheatWaterHeater (not a heat pump)
1898 1181 : if ((!isWSVarSpeedHeatCoil &&
1899 1320 : (((this->m_sysType == SysType::PackagedAC && !isVarSpeedCoolCoil) && (this->m_sysType == SysType::PackagedHP && !isVarSpeedHeatCoil)) ||
1900 1257 : (this->m_sysType == SysType::Unitary && this->m_HeatPump))) ||
1901 715 : (this->m_sysType == SysType::Unitary && (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_CoolingHXAssisted ||
1902 124 : this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_Cooling ||
1903 93 : this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed ||
1904 46 : this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedCooling))) {
1905 97 : EqSizing.CoolingAirVolFlow = max(EqSizing.CoolingAirVolFlow, EqSizing.HeatingAirVolFlow);
1906 97 : EqSizing.HeatingAirVolFlow = EqSizing.CoolingAirVolFlow;
1907 : }
1908 :
1909 : // STEP 4: set heat pump coil capacities equal to greater of cooling or heating capacity
1910 : // if a heat pump, use maximum values and set main air flow and capacity variables
1911 592 : if (this->m_sysType == SysType::PackagedHP && !isVarSpeedCoolCoil) {
1912 : // PTPH allows the cooling coil to set DataCoolCoilCap so cooling coil sets capacity
1913 : // This is wrong since a larger heating load should set HP capacity (next else if)
1914 28 : EqSizing.HeatingCapacity = false;
1915 564 : } else if (this->m_HeatPump && (state.dataSize->CurZoneEqNum == 0 || !isWSVarSpeedCoolCoil)) {
1916 54 : EqSizing.AirFlow = true;
1917 54 : EqSizing.AirVolFlow = max(EqSizing.CoolingAirVolFlow, EqSizing.HeatingAirVolFlow);
1918 107 : if (this->m_CoolingCoilType_Num != DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit &&
1919 53 : this->m_HeatingCoilType_Num != DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit) {
1920 53 : EqSizing.Capacity = true;
1921 53 : EqSizing.DesCoolingLoad = max(EqSizing.DesCoolingLoad, EqSizing.DesHeatingLoad);
1922 53 : EqSizing.DesHeatingLoad = EqSizing.DesCoolingLoad;
1923 53 : state.dataSize->DXCoolCap = EqSizing.DesCoolingLoad;
1924 : }
1925 510 : } else if (!this->m_CoolCoilExists && state.dataSize->CurZoneEqNum > 0) {
1926 0 : state.dataSize->DXCoolCap = EqSizing.DesHeatingLoad;
1927 : }
1928 :
1929 : // now size fans as necessary
1930 : // comment this out until the PTUnit to UnitarySystem #9273 branch is merged, so nothing changes
1931 : // until this is implemented, unbalanced air flow warning show up in VS coil PTUnits
1932 : // state.dataSize->DataFanIndex = saveDataFanIndex;
1933 :
1934 : // Some parent objects report sizing, some do not
1935 592 : if (this->m_OKToPrintSizing) {
1936 592 : if (this->m_sysType != SysType::CoilCoolingDX && this->m_sysType != SysType::CoilCoolingWater) {
1937 302 : PrintFlag = true;
1938 : }
1939 : }
1940 : // STEP 5: report system parameters (e.g., air flow rates, capacities, etc.)
1941 592 : if (this->m_FanExists) {
1942 300 : if (this->m_sysType == SysType::PackagedAC || this->m_sysType == SysType::PackagedHP || this->m_sysType == SysType::PackagedWSHP)
1943 192 : PrintFlag = false;
1944 :
1945 300 : EqSizing.SystemAirFlow = true;
1946 300 : EqSizing.AirVolFlow = max(EqSizing.CoolingAirVolFlow, EqSizing.HeatingAirVolFlow);
1947 300 : if (this->m_DesignFanVolFlowRate <= 0.0) { // attempt to catch any missed logic in GetUnitarySystem
1948 237 : this->m_DesignFanVolFlowRate = DataSizing::AutoSize;
1949 : }
1950 300 : state.dataSize->DataEMSOverrideON = this->m_DesignFanVolFlowRateEMSOverrideOn;
1951 300 : state.dataSize->DataEMSOverride = this->m_DesignFanVolFlowRateEMSOverrideValue;
1952 :
1953 300 : bool errorsFound = false;
1954 600 : SystemAirFlowSizer sizerSystemAirFlow;
1955 600 : std::string sizingString = "Supply Air Flow Rate [m3/s]";
1956 300 : sizerSystemAirFlow.overrideSizingString(sizingString);
1957 300 : sizerSystemAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
1958 300 : this->m_DesignFanVolFlowRate = sizerSystemAirFlow.size(state, this->m_DesignFanVolFlowRate, errorsFound);
1959 :
1960 300 : state.dataSize->DataEMSOverrideON = false;
1961 300 : EqSizing.SystemAirFlow = false;
1962 :
1963 300 : if (this->m_sysType == SysType::PackagedAC || this->m_sysType == SysType::PackagedHP || this->m_sysType == SysType::PackagedWSHP)
1964 192 : PrintFlag = true;
1965 : }
1966 :
1967 : // not sure what to do if UnitarySystem has only 1 coil type and flow needs to occur when present coil is off
1968 : // how does constant fan operating mode pertain here?
1969 592 : if (this->m_HeatCoilExists && !this->m_CoolCoilExists) {
1970 1 : if (this->m_MaxCoolAirVolFlow == DataSizing::AutoSize) this->m_MaxCoolAirVolFlow = EqSizing.HeatingAirVolFlow;
1971 591 : } else if (this->m_CoolCoilExists && !this->m_HeatCoilExists) {
1972 291 : if (this->m_MaxHeatAirVolFlow == DataSizing::AutoSize) this->m_MaxHeatAirVolFlow = EqSizing.CoolingAirVolFlow;
1973 291 : state.dataSize->DXCoolCap = CoolCapAtPeak;
1974 : }
1975 :
1976 : // PT Units report sizing for cooling then heating, UnitarySystem reverses that order
1977 : // temporarily reverse reporting for PT units so eio diffs are cleaner, remove later
1978 592 : if (this->m_sysType == SysType::PackagedAC || this->m_sysType == SysType::PackagedHP || this->m_sysType == SysType::PackagedWSHP) {
1979 192 : if (this->m_CoolCoilExists) {
1980 : // allow design size to report
1981 192 : if (this->m_MaxCoolAirVolFlow != DataSizing::AutoSize) EqSizing.CoolingAirFlow = false;
1982 192 : if (this->m_MaxCoolAirVolFlow <= 0.0) { // attempt to catch any missed logic in GetUnitarySystem
1983 145 : this->m_MaxCoolAirVolFlow = DataSizing::AutoSize;
1984 : }
1985 192 : state.dataSize->DataEMSOverrideON = this->m_MaxCoolAirVolFlowEMSOverrideOn;
1986 192 : state.dataSize->DataEMSOverride = this->m_MaxCoolAirVolFlowEMSOverrideValue;
1987 192 : TempSize = this->m_MaxCoolAirVolFlow;
1988 192 : bool errorsFound = false;
1989 384 : CoolingAirFlowSizer sizingCoolingAirFlow;
1990 384 : std::string stringOverride = "Cooling Supply Air Flow Rate [m3/s]";
1991 192 : if (state.dataGlobal->isEpJSON) stringOverride = "cooling_supply_air_flow_rate [m3/s]";
1992 192 : sizingCoolingAirFlow.overrideSizingString(stringOverride);
1993 : // sizingCoolingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex);
1994 192 : sizingCoolingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
1995 192 : this->m_MaxCoolAirVolFlow = sizingCoolingAirFlow.size(state, TempSize, errorsFound);
1996 192 : state.dataSize->DataEMSOverrideON = false;
1997 192 : state.dataSize->DataConstantUsedForSizing = 0.0;
1998 : }
1999 192 : if (this->m_HeatCoilExists) {
2000 : // allow design size to report
2001 192 : if (this->m_MaxHeatAirVolFlow != DataSizing::AutoSize) EqSizing.HeatingAirFlow = false;
2002 192 : SizingMethod = DataHVACGlobals::HeatingAirflowSizing;
2003 192 : if (this->m_MaxHeatAirVolFlow <= 0.0) { // attempt to catch any missed logic in GetUnitarySystem
2004 145 : this->m_MaxHeatAirVolFlow = DataSizing::AutoSize;
2005 : }
2006 192 : bool saveEqSizingAirFlow = EqSizing.AirFlow;
2007 192 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit) {
2008 1 : EqSizing.AirFlow = false;
2009 : }
2010 192 : FieldNum = 7; // N7 , \field Heating Supply Air Flow Rate
2011 192 : state.dataSize->DataEMSOverrideON = this->m_MaxHeatAirVolFlowEMSOverrideOn;
2012 192 : state.dataSize->DataEMSOverride = this->m_MaxHeatAirVolFlowEMSOverrideValue;
2013 192 : TempSize = this->m_MaxHeatAirVolFlow;
2014 : // SizingString = UnitarySystemNumericFields(UnitarySysNum).FieldNames(FieldNum) + " [m3/s]";
2015 192 : SizingString = "Heating Supply Air Flow Rate [m3/s]";
2016 192 : bool errorsFound = false;
2017 384 : HeatingAirFlowSizer sizingHeatingAirFlow;
2018 192 : sizingHeatingAirFlow.overrideSizingString(SizingString);
2019 : // sizingHeatingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex);
2020 192 : sizingHeatingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
2021 192 : this->m_MaxHeatAirVolFlow = sizingHeatingAirFlow.size(state, TempSize, errorsFound);
2022 192 : state.dataSize->DataEMSOverrideON = false;
2023 192 : state.dataSize->DataConstantUsedForSizing = 0.0;
2024 192 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit) {
2025 1 : EqSizing.AirFlow = saveEqSizingAirFlow;
2026 : }
2027 192 : }
2028 :
2029 : } else {
2030 400 : if (this->m_HeatCoilExists) {
2031 :
2032 109 : SizingMethod = DataHVACGlobals::HeatingAirflowSizing;
2033 109 : if (this->m_MaxHeatAirVolFlow <= 0.0) { // attempt to catch any missed logic in GetUnitarySystem
2034 97 : this->m_MaxHeatAirVolFlow = DataSizing::AutoSize;
2035 : }
2036 109 : bool saveEqSizingAirFlow = EqSizing.AirFlow;
2037 109 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit) {
2038 2 : EqSizing.AirFlow = false;
2039 : }
2040 109 : FieldNum = 7; // N7 , \field Heating Supply Air Flow Rate
2041 109 : state.dataSize->DataEMSOverrideON = this->m_MaxHeatAirVolFlowEMSOverrideOn;
2042 109 : state.dataSize->DataEMSOverride = this->m_MaxHeatAirVolFlowEMSOverrideValue;
2043 109 : TempSize = this->m_MaxHeatAirVolFlow;
2044 : // SizingString = UnitarySystemNumericFields(UnitarySysNum).FieldNames(FieldNum) + " [m3/s]";
2045 109 : SizingString = "Heating Supply Air Flow Rate [m3/s]";
2046 109 : bool errorsFound = false;
2047 218 : HeatingAirFlowSizer sizingHeatingAirFlow;
2048 109 : sizingHeatingAirFlow.overrideSizingString(SizingString);
2049 : // sizingHeatingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex);
2050 109 : sizingHeatingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
2051 109 : this->m_MaxHeatAirVolFlow = sizingHeatingAirFlow.size(state, TempSize, errorsFound);
2052 109 : state.dataSize->DataEMSOverrideON = false;
2053 109 : state.dataSize->DataConstantUsedForSizing = 0.0;
2054 109 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit) {
2055 2 : EqSizing.AirFlow = saveEqSizingAirFlow;
2056 : }
2057 : }
2058 :
2059 400 : if (this->m_CoolCoilExists) {
2060 :
2061 399 : if (this->m_MaxCoolAirVolFlow <= 0.0) { // attempt to catch any missed logic in GetUnitarySystem
2062 336 : this->m_MaxCoolAirVolFlow = DataSizing::AutoSize;
2063 : }
2064 399 : state.dataSize->DataEMSOverrideON = this->m_MaxCoolAirVolFlowEMSOverrideOn;
2065 399 : state.dataSize->DataEMSOverride = this->m_MaxCoolAirVolFlowEMSOverrideValue;
2066 399 : TempSize = this->m_MaxCoolAirVolFlow;
2067 399 : bool errorsFound = false;
2068 798 : CoolingAirFlowSizer sizingCoolingAirFlow;
2069 798 : std::string stringOverride = "Cooling Supply Air Flow Rate [m3/s]";
2070 399 : if (state.dataGlobal->isEpJSON) stringOverride = "cooling_supply_air_flow_rate [m3/s]";
2071 399 : sizingCoolingAirFlow.overrideSizingString(stringOverride);
2072 : // sizingCoolingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex);
2073 399 : sizingCoolingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
2074 399 : this->m_MaxCoolAirVolFlow = sizingCoolingAirFlow.size(state, TempSize, errorsFound);
2075 399 : state.dataSize->DataEMSOverrideON = false;
2076 399 : state.dataSize->DataConstantUsedForSizing = 0.0;
2077 : }
2078 : }
2079 :
2080 : // If not set, set DesignFanVolFlowRate as greater of cooling and heating to make sure this value > 0.
2081 : // If fan is hard-sized, use that value, otherwise the fan will size to DesignFanVolFlowRate
2082 592 : if (this->m_DesignFanVolFlowRate <= 0.0) {
2083 244 : this->m_DesignFanVolFlowRate = max(this->m_MaxCoolAirVolFlow, this->m_MaxHeatAirVolFlow);
2084 244 : if (this->m_ActualFanVolFlowRate > 0.0) this->m_DesignFanVolFlowRate = this->m_ActualFanVolFlowRate;
2085 244 : if (this->m_DesignFanVolFlowRate <= 0.0) {
2086 0 : ShowWarningError(state, std::string{RoutineName} + ": " + CompType + " = " + std::string{CompName});
2087 0 : ShowFatalError(state, "Unable to determine fan air flow rate.");
2088 : }
2089 : }
2090 592 : if (!this->m_FanExists) this->m_ActualFanVolFlowRate = this->m_DesignFanVolFlowRate;
2091 :
2092 592 : if (this->m_CoolCoilExists || this->m_HeatCoilExists || this->m_SuppCoilExists) {
2093 592 : MSHPIndex = this->m_DesignSpecMSHPIndex;
2094 : // set no load air flow ratio local var
2095 592 : Real64 NoLoadCoolingAirFlowRateRatio = 1.0;
2096 592 : Real64 NoLoadHeatingAirFlowRateRatio = 1.0;
2097 592 : if (MSHPIndex > -1) {
2098 55 : if (state.dataUnitarySystems->designSpecMSHP[MSHPIndex].coolingVolFlowRatio[0] == DataSizing::AutoSize) {
2099 17 : NoLoadCoolingAirFlowRateRatio =
2100 17 : min(this->m_NoLoadAirFlowRateRatio, 1.0 / double(state.dataUnitarySystems->designSpecMSHP[MSHPIndex].numOfSpeedCooling));
2101 : } else {
2102 38 : NoLoadCoolingAirFlowRateRatio =
2103 38 : min(this->m_NoLoadAirFlowRateRatio, state.dataUnitarySystems->designSpecMSHP[MSHPIndex].coolingVolFlowRatio[0]);
2104 : }
2105 55 : if (state.dataUnitarySystems->designSpecMSHP[MSHPIndex].heatingVolFlowRatio[0] == DataSizing::AutoSize) {
2106 17 : NoLoadHeatingAirFlowRateRatio =
2107 17 : min(this->m_NoLoadAirFlowRateRatio, 1.0 / double(state.dataUnitarySystems->designSpecMSHP[MSHPIndex].numOfSpeedHeating));
2108 : } else {
2109 38 : NoLoadHeatingAirFlowRateRatio =
2110 38 : min(this->m_NoLoadAirFlowRateRatio, state.dataUnitarySystems->designSpecMSHP[MSHPIndex].heatingVolFlowRatio[0]);
2111 : }
2112 55 : this->m_NoLoadAirFlowRateRatio = min(NoLoadCoolingAirFlowRateRatio, NoLoadHeatingAirFlowRateRatio);
2113 : } else {
2114 1065 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed ||
2115 528 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed) {
2116 9 : if (this->m_CoolCoilExists && this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) {
2117 : Real64 MaxSpeedFlowRate =
2118 9 : state.dataVariableSpeedCoils->VarSpeedCoil(this->m_CoolingCoilIndex)
2119 9 : .MSRatedAirVolFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(this->m_CoolingCoilIndex).NumOfSpeeds);
2120 9 : if (MaxSpeedFlowRate > 0.0) {
2121 9 : NoLoadCoolingAirFlowRateRatio =
2122 9 : state.dataVariableSpeedCoils->VarSpeedCoil(this->m_CoolingCoilIndex).MSRatedAirVolFlowRate(1) / MaxSpeedFlowRate;
2123 : }
2124 : }
2125 9 : if (this->m_HeatCoilExists && this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed) {
2126 : Real64 MaxSpeedFlowRate =
2127 3 : state.dataVariableSpeedCoils->VarSpeedCoil(this->m_HeatingCoilIndex)
2128 3 : .MSRatedAirVolFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(this->m_HeatingCoilIndex).NumOfSpeeds);
2129 3 : if (MaxSpeedFlowRate > 0.0) {
2130 3 : NoLoadHeatingAirFlowRateRatio =
2131 3 : state.dataVariableSpeedCoils->VarSpeedCoil(this->m_HeatingCoilIndex).MSRatedAirVolFlowRate(1) / MaxSpeedFlowRate;
2132 : }
2133 : }
2134 9 : this->m_NoLoadAirFlowRateRatio = min(NoLoadCoolingAirFlowRateRatio, NoLoadHeatingAirFlowRateRatio);
2135 : }
2136 : }
2137 592 : if (this->m_NoCoolHeatSAFMethod <= DataSizing::SupplyAirFlowRate && this->m_ControlType == UnitarySysCtrlType::CCMASHRAE) {
2138 0 : if (this->m_MaxNoCoolHeatAirVolFlow == DataSizing::AutoSize) {
2139 0 : state.dataSize->DataConstantUsedForSizing = max(this->m_MaxCoolAirVolFlow, this->m_MaxHeatAirVolFlow);
2140 0 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_CoolingSingleSpeed ||
2141 0 : this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_HeatingEmpirical) {
2142 0 : minNoLoadFlow = 0.6667; // TODO: Should this have a Coil:Cooling:DX block?
2143 : } else {
2144 0 : if (this->m_NoLoadAirFlowRateRatio < 1.0) {
2145 0 : minNoLoadFlow = this->m_NoLoadAirFlowRateRatio;
2146 : } else {
2147 0 : minNoLoadFlow = 0.5;
2148 : }
2149 : }
2150 0 : if (this->m_MaxCoolAirVolFlow >= this->m_MaxHeatAirVolFlow) {
2151 0 : state.dataSize->DataFractionUsedForSizing =
2152 0 : min(minNoLoadFlow, (this->m_MaxHeatAirVolFlow / this->m_MaxCoolAirVolFlow) - 0.01);
2153 : } else {
2154 0 : state.dataSize->DataFractionUsedForSizing =
2155 0 : min(minNoLoadFlow, (this->m_MaxCoolAirVolFlow / this->m_MaxHeatAirVolFlow) - 0.01);
2156 : }
2157 : } else {
2158 0 : state.dataSize->DataConstantUsedForSizing = this->m_MaxNoCoolHeatAirVolFlow;
2159 0 : state.dataSize->DataFractionUsedForSizing = 1.0;
2160 : }
2161 592 : } else if (this->m_NoCoolHeatSAFMethod == DataSizing::FractionOfAutosizedCoolingAirflow) {
2162 0 : this->m_MaxNoCoolHeatAirVolFlow *= EqSizing.CoolingAirVolFlow;
2163 0 : state.dataSize->DataConstantUsedForSizing = this->m_MaxNoCoolHeatAirVolFlow;
2164 0 : state.dataSize->DataFractionUsedForSizing = 1.0;
2165 0 : this->m_MaxNoCoolHeatAirVolFlow = DataSizing::AutoSize;
2166 592 : } else if (this->m_NoCoolHeatSAFMethod == DataSizing::FractionOfAutosizedHeatingAirflow) {
2167 0 : this->m_MaxNoCoolHeatAirVolFlow *= EqSizing.HeatingAirVolFlow;
2168 0 : state.dataSize->DataConstantUsedForSizing = this->m_MaxNoCoolHeatAirVolFlow;
2169 0 : state.dataSize->DataFractionUsedForSizing = 1.0;
2170 0 : this->m_MaxNoCoolHeatAirVolFlow = DataSizing::AutoSize;
2171 592 : } else if (this->m_NoCoolHeatSAFMethod == DataSizing::FlowPerCoolingCapacity) {
2172 0 : if (EqSizing.DesCoolingLoad <= 0.0) {
2173 : // water coils not sizing yet
2174 0 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWater ||
2175 0 : this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWaterDetailed) {
2176 0 : WaterCoils::SimulateWaterCoilComponents(
2177 : state, this->m_CoolingCoilName, FirstHVACIteration, this->m_CoolingCoilIndex, QActual, this->m_FanOpMode, 1.0);
2178 0 : EqSizing.DesCoolingLoad = WaterCoils::GetWaterCoilCapacity(
2179 : state,
2180 0 : UtilityRoutines::MakeUPPERCase(DataHVACGlobals::cAllCoilTypes(this->m_CoolingCoilType_Num)),
2181 : this->m_CoolingCoilName,
2182 : ErrFound);
2183 : }
2184 : }
2185 0 : this->m_MaxNoCoolHeatAirVolFlow *= EqSizing.DesCoolingLoad;
2186 0 : state.dataSize->DataConstantUsedForSizing = this->m_MaxNoCoolHeatAirVolFlow;
2187 0 : state.dataSize->DataFractionUsedForSizing = 1.0;
2188 0 : this->m_MaxNoCoolHeatAirVolFlow = DataSizing::AutoSize;
2189 592 : } else if (this->m_NoCoolHeatSAFMethod == DataSizing::FlowPerHeatingCapacity) {
2190 0 : if (EqSizing.DesHeatingLoad <= 0.0) {
2191 : // water coil not sizing yet
2192 0 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWater) {
2193 0 : WaterCoils::SimulateWaterCoilComponents(
2194 : state, this->m_HeatingCoilName, FirstHVACIteration, this->m_HeatingCoilIndex, QActual, this->m_FanOpMode, 1.0);
2195 0 : EqSizing.DesHeatingLoad = WaterCoils::GetWaterCoilCapacity(
2196 : state,
2197 0 : UtilityRoutines::MakeUPPERCase(DataHVACGlobals::cAllCoilTypes(this->m_HeatingCoilType_Num)),
2198 : this->m_HeatingCoilName,
2199 : ErrFound);
2200 : }
2201 : }
2202 0 : this->m_MaxNoCoolHeatAirVolFlow *= EqSizing.DesHeatingLoad;
2203 0 : state.dataSize->DataConstantUsedForSizing = this->m_MaxNoCoolHeatAirVolFlow;
2204 0 : state.dataSize->DataFractionUsedForSizing = 1.0;
2205 0 : this->m_MaxNoCoolHeatAirVolFlow = DataSizing::AutoSize;
2206 : } else {
2207 592 : state.dataSize->DataFractionUsedForSizing = this->m_NoLoadAirFlowRateRatio;
2208 : }
2209 :
2210 592 : FieldNum = 11; // N11 , \field No Load Supply Air Flow Rate
2211 592 : state.dataSize->DataEMSOverrideON = this->m_MaxNoCoolHeatAirVolFlowEMSOverrideOn;
2212 592 : state.dataSize->DataEMSOverride = this->m_MaxNoCoolHeatAirVolFlowEMSOverrideValue;
2213 592 : TempSize = this->m_MaxNoCoolHeatAirVolFlow;
2214 : // SizingString = UnitarySystemNumericFields(UnitarySysNum).FieldNames(FieldNum) + " [m3/s]";
2215 592 : SizingString = "No Load Supply Air Flow Rate [m3/s]";
2216 592 : bool errorsFound = false;
2217 1184 : SystemAirFlowSizer sizerSystemAirFlow;
2218 592 : sizerSystemAirFlow.overrideSizingString(SizingString);
2219 592 : sizerSystemAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
2220 592 : this->m_MaxNoCoolHeatAirVolFlow = sizerSystemAirFlow.size(state, TempSize, errorsFound);
2221 592 : state.dataSize->DataEMSOverrideON = false;
2222 592 : state.dataSize->DataConstantUsedForSizing = 0.0;
2223 592 : state.dataSize->DataFractionUsedForSizing = 0.0;
2224 : }
2225 :
2226 592 : if (this->m_MaxCoolAirVolFlow > 0.0) {
2227 591 : this->LowSpeedCoolFanRatio = this->m_MaxNoCoolHeatAirVolFlow / this->m_MaxCoolAirVolFlow;
2228 : }
2229 592 : if (this->m_MaxHeatAirVolFlow > 0.0) {
2230 301 : this->LowSpeedHeatFanRatio = this->m_MaxNoCoolHeatAirVolFlow / this->m_MaxHeatAirVolFlow;
2231 : }
2232 :
2233 592 : if (this->ATMixerExists && state.dataSize->CurZoneEqNum > 0) { // set up ATMixer conditions for use in component sizing
2234 29 : SingleDuct::setATMixerSizingProperties(state, this->m_ATMixerIndex, this->ControlZoneNum, state.dataSize->CurZoneEqNum);
2235 : }
2236 :
2237 592 : if (this->OAMixerExists) {
2238 167 : IsAutoSize = false;
2239 167 : if (this->m_CoolOutAirVolFlow == DataSizing::AutoSize) {
2240 110 : IsAutoSize = true;
2241 : }
2242 167 : if (!IsAutoSize && !SizingDesRunThisZone) { // Simulation continue
2243 0 : if (this->m_CoolOutAirVolFlow > 0.0) {
2244 0 : BaseSizer::reportSizerOutput(state,
2245 : this->UnitType,
2246 : this->Name,
2247 : "User-Specified Outdoor Air Flow Rate During Cooling Operation [m3/s]",
2248 0 : this->m_CoolOutAirVolFlow);
2249 : }
2250 : } else {
2251 167 : CheckZoneSizing(state, this->UnitType, this->Name);
2252 167 : Real64 CoolOutAirVolFlowDes = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).MinOA;
2253 167 : if (CoolOutAirVolFlowDes < DataHVACGlobals::SmallAirVolFlow) {
2254 3 : CoolOutAirVolFlowDes = 0.0;
2255 : }
2256 167 : if (IsAutoSize) {
2257 110 : this->m_CoolOutAirVolFlow = CoolOutAirVolFlowDes;
2258 220 : BaseSizer::reportSizerOutput(
2259 110 : state, this->UnitType, this->Name, "Design Size Outdoor Air Flow Rate During Cooling Operation [m3/s]", CoolOutAirVolFlowDes);
2260 : } else {
2261 57 : if (this->m_CoolOutAirVolFlow > 0.0 && CoolOutAirVolFlowDes > 0.0 && SizingDesRunThisZone) {
2262 47 : Real64 CoolOutAirVolFlowUser = this->m_CoolOutAirVolFlow;
2263 94 : BaseSizer::reportSizerOutput(state,
2264 : this->UnitType,
2265 : this->Name,
2266 : "Design Size Outdoor Air Flow Rate During Cooling Operation [m3/s]",
2267 : CoolOutAirVolFlowDes,
2268 : "User-Specified Outdoor Air Flow Rate During Cooling Operation [m3/s]",
2269 47 : CoolOutAirVolFlowUser);
2270 47 : if (state.dataGlobal->DisplayExtraWarnings) {
2271 0 : if ((std::abs(CoolOutAirVolFlowDes - CoolOutAirVolFlowUser) / CoolOutAirVolFlowUser) >
2272 0 : state.dataSize->AutoVsHardSizingThreshold) {
2273 0 : ShowMessage(state, "SizePTUnit: Potential issue with equipment sizing for " + this->UnitType + ' ' + this->Name);
2274 0 : ShowContinueError(
2275 : state,
2276 0 : format("User-Specified Outdoor Air Flow Rate During Cooling Operation of {:.5R} [m3/s]", CoolOutAirVolFlowUser));
2277 0 : ShowContinueError(state,
2278 0 : format("differs from Design Size Outdoor Air Flow Rate During Cooling Operation of {:.5R} [m3/s]",
2279 0 : CoolOutAirVolFlowDes));
2280 0 : ShowContinueError(state, "This may, or may not, indicate mismatched component sizes.");
2281 0 : ShowContinueError(state, "Verify that the value entered is intended and is consistent with other components.");
2282 : }
2283 : }
2284 : }
2285 : }
2286 : }
2287 :
2288 167 : IsAutoSize = false;
2289 167 : if (this->m_HeatOutAirVolFlow == DataSizing::AutoSize) {
2290 110 : IsAutoSize = true;
2291 : }
2292 167 : if (!IsAutoSize && !SizingDesRunThisZone) { // Simulation continue
2293 0 : if (this->m_HeatOutAirVolFlow > 0.0) {
2294 0 : BaseSizer::reportSizerOutput(state,
2295 : this->UnitType,
2296 : this->Name,
2297 : "User-Specified Outdoor Air Flow Rate During Heating Operation [m3/s]",
2298 0 : this->m_HeatOutAirVolFlow);
2299 : }
2300 : } else {
2301 167 : CheckZoneSizing(state, this->UnitType, this->Name);
2302 167 : Real64 HeatOutAirVolFlowDes = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).MinOA;
2303 167 : if (HeatOutAirVolFlowDes < DataHVACGlobals::SmallAirVolFlow) {
2304 3 : HeatOutAirVolFlowDes = 0.0;
2305 : }
2306 167 : if (IsAutoSize) {
2307 110 : this->m_HeatOutAirVolFlow = HeatOutAirVolFlowDes;
2308 220 : BaseSizer::reportSizerOutput(
2309 110 : state, this->UnitType, this->Name, "Design Size Outdoor Air Flow Rate During Heating Operation [m3/s]", HeatOutAirVolFlowDes);
2310 : } else {
2311 57 : if (this->m_HeatOutAirVolFlow > 0.0 && HeatOutAirVolFlowDes > 0.0 && SizingDesRunThisZone) {
2312 47 : Real64 HeatOutAirVolFlowUser = this->m_HeatOutAirVolFlow;
2313 94 : BaseSizer::reportSizerOutput(state,
2314 : this->UnitType,
2315 : this->Name,
2316 : "Design Size Outdoor Air Flow Rate During Heating Operation [m3/s]",
2317 : HeatOutAirVolFlowDes,
2318 : "User-Specified Outdoor Air Flow Rate During Heating Operation [m3/s]",
2319 47 : HeatOutAirVolFlowUser);
2320 47 : if (state.dataGlobal->DisplayExtraWarnings) {
2321 0 : if ((std::abs(HeatOutAirVolFlowDes - HeatOutAirVolFlowUser) / HeatOutAirVolFlowUser) >
2322 0 : state.dataSize->AutoVsHardSizingThreshold) {
2323 0 : ShowMessage(state, "SizePTUnit: Potential issue with equipment sizing for " + this->UnitType + ' ' + this->Name);
2324 0 : ShowContinueError(
2325 : state,
2326 0 : format("User-Specified Outdoor Air Flow Rate During Heating Operation of {:.5R} [m3/s]", HeatOutAirVolFlowUser));
2327 0 : ShowContinueError(state,
2328 0 : format("differs from Design Size Outdoor Air Flow Rate During Heating Operation of {:.5R} [m3/s]",
2329 0 : HeatOutAirVolFlowDes));
2330 0 : ShowContinueError(state, "This may, or may not, indicate mismatched component sizes.");
2331 0 : ShowContinueError(state, "Verify that the value entered is intended and is consistent with other components.");
2332 : }
2333 : }
2334 : }
2335 : }
2336 : }
2337 :
2338 167 : IsAutoSize = false;
2339 167 : if (this->m_NoCoolHeatOutAirVolFlow == DataSizing::AutoSize) {
2340 110 : IsAutoSize = true;
2341 : }
2342 167 : if (!IsAutoSize && !SizingDesRunThisZone) { // Simulation continue
2343 0 : if (this->m_NoCoolHeatOutAirVolFlow > 0.0) {
2344 0 : BaseSizer::reportSizerOutput(state,
2345 : this->UnitType,
2346 : this->Name,
2347 : "User-Specified Outdoor Air Flow Rate When No Cooling or Heating is Needed [m3/s]",
2348 0 : this->m_NoCoolHeatOutAirVolFlow);
2349 : }
2350 : } else {
2351 167 : CheckZoneSizing(state, this->UnitType, this->Name);
2352 : Real64 NoCoolHeatOutAirVolFlowDes =
2353 167 : min(state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).MinOA, this->m_MaxNoCoolHeatAirVolFlow);
2354 167 : if (NoCoolHeatOutAirVolFlowDes < DataHVACGlobals::SmallAirVolFlow) {
2355 37 : NoCoolHeatOutAirVolFlowDes = 0.0;
2356 : }
2357 167 : if (IsAutoSize) {
2358 110 : this->m_NoCoolHeatOutAirVolFlow = NoCoolHeatOutAirVolFlowDes;
2359 220 : BaseSizer::reportSizerOutput(state,
2360 : this->UnitType,
2361 : this->Name,
2362 : "Design Size Outdoor Air Flow Rate When No Cooling or Heating is Needed [m3/s]",
2363 110 : NoCoolHeatOutAirVolFlowDes);
2364 : } else {
2365 57 : if (this->m_NoCoolHeatOutAirVolFlow > 0.0 && NoCoolHeatOutAirVolFlowDes > 0.0 && SizingDesRunThisZone) {
2366 39 : Real64 NoCoolHeatOutAirVolFlowUser = this->m_NoCoolHeatOutAirVolFlow;
2367 78 : BaseSizer::reportSizerOutput(state,
2368 : this->UnitType,
2369 : this->Name,
2370 : "Design Size Outdoor Air Flow Rate When No Cooling or Heating is Needed [m3/s]",
2371 : NoCoolHeatOutAirVolFlowDes,
2372 : "User-Specified Outdoor Air Flow Rate When No Cooling or Heating is Needed [m3/s]",
2373 39 : NoCoolHeatOutAirVolFlowUser);
2374 39 : if (state.dataGlobal->DisplayExtraWarnings) {
2375 0 : if ((std::abs(NoCoolHeatOutAirVolFlowDes - NoCoolHeatOutAirVolFlowUser) / NoCoolHeatOutAirVolFlowUser) >
2376 0 : state.dataSize->AutoVsHardSizingThreshold) {
2377 0 : ShowMessage(state, "SizePTUnit: Potential issue with equipment sizing for " + this->UnitType + ' ' + this->Name);
2378 0 : ShowContinueError(state,
2379 0 : format("User-Specified Outdoor Air Flow Rate When No Cooling or Heating is Needed of {:.5R} [m3/s]",
2380 0 : NoCoolHeatOutAirVolFlowUser));
2381 0 : ShowContinueError(
2382 : state,
2383 0 : format("differs from Design Size Outdoor Air Flow Rate When No Cooling or Heating is Needed of {:.5R} [m3/s]",
2384 0 : NoCoolHeatOutAirVolFlowDes));
2385 0 : ShowContinueError(state, "This may, or may not, indicate mismatched component sizes.");
2386 0 : ShowContinueError(state, "Verify that the value entered is intended and is consistent with other components.");
2387 : }
2388 : }
2389 : }
2390 : }
2391 : }
2392 : }
2393 592 : if (this->m_sysType == SysType::PackagedHP || this->m_sysType == SysType::PackagedWSHP) PrintFlag = false;
2394 :
2395 592 : if (this->m_sysType == SysType::PackagedAC || this->m_sysType == SysType::PackagedHP || this->m_sysType == SysType::PackagedWSHP) {
2396 192 : if (this->m_AirFlowControl == UseCompFlow::On) {
2397 21 : this->m_MaxNoCoolHeatAirVolFlow = min(this->m_MaxCoolAirVolFlow, this->m_MaxHeatAirVolFlow);
2398 : }
2399 378 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed ||
2400 186 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed) {
2401 6 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) {
2402 6 : if (this->m_AirFlowControl == UseCompFlow::On) {
2403 2 : Real64 airFlowAdjustmentRatio = 1.0;
2404 2 : if (!coolingAirFlowIsAutosized) {
2405 2 : airFlowAdjustmentRatio =
2406 2 : this->m_MaxCoolAirVolFlow /
2407 2 : state.dataVariableSpeedCoils->VarSpeedCoil(this->m_CoolingCoilIndex)
2408 2 : .MSRatedAirVolFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(this->m_CoolingCoilIndex).NumOfSpeeds);
2409 : }
2410 2 : this->m_MaxNoCoolHeatAirVolFlow =
2411 2 : airFlowAdjustmentRatio * state.dataVariableSpeedCoils->VarSpeedCoil(this->m_CoolingCoilIndex).MSRatedAirVolFlowRate(1);
2412 : }
2413 : }
2414 6 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed) {
2415 3 : if (this->m_AirFlowControl == UseCompFlow::On) {
2416 1 : Real64 airFlowAdjustmentRatio = 1.0;
2417 1 : if (!heatingAirFlowIsAutosized) {
2418 1 : airFlowAdjustmentRatio =
2419 1 : this->m_MaxHeatAirVolFlow /
2420 1 : state.dataVariableSpeedCoils->VarSpeedCoil(this->m_HeatingCoilIndex)
2421 1 : .MSRatedAirVolFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(this->m_HeatingCoilIndex).NumOfSpeeds);
2422 : }
2423 1 : if (this->m_CoolCoilExists) {
2424 1 : this->m_MaxNoCoolHeatAirVolFlow =
2425 1 : min(this->m_MaxNoCoolHeatAirVolFlow,
2426 : airFlowAdjustmentRatio *
2427 1 : state.dataVariableSpeedCoils->VarSpeedCoil(this->m_CoolingCoilIndex).MSRatedAirVolFlowRate(1));
2428 : } else {
2429 0 : this->m_MaxNoCoolHeatAirVolFlow =
2430 0 : airFlowAdjustmentRatio *
2431 0 : state.dataVariableSpeedCoils->VarSpeedCoil(this->m_HeatingCoilIndex).MSRatedAirVolFlowRate(1);
2432 : }
2433 : }
2434 : }
2435 : }
2436 : }
2437 :
2438 : // Change the Volume Flow Rates to Mass Flow Rates
2439 592 : this->m_DesignMassFlowRate = this->m_DesignFanVolFlowRate * state.dataEnvrn->StdRhoAir;
2440 592 : this->MaxCoolAirMassFlow = this->m_MaxCoolAirVolFlow * state.dataEnvrn->StdRhoAir;
2441 592 : this->MaxHeatAirMassFlow = this->m_MaxHeatAirVolFlow * state.dataEnvrn->StdRhoAir;
2442 592 : this->MaxNoCoolHeatAirMassFlow = this->m_MaxNoCoolHeatAirVolFlow * state.dataEnvrn->StdRhoAir;
2443 592 : this->m_CoolOutAirMassFlow = this->m_CoolOutAirVolFlow * state.dataEnvrn->StdRhoAir;
2444 592 : this->m_HeatOutAirMassFlow = this->m_HeatOutAirVolFlow * state.dataEnvrn->StdRhoAir;
2445 592 : this->m_NoCoolHeatOutAirMassFlow = this->m_NoCoolHeatOutAirVolFlow * state.dataEnvrn->StdRhoAir;
2446 :
2447 : // initialize multi-speed coils
2448 1181 : if ((this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit) ||
2449 589 : (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed)) {
2450 12 : if (this->m_NumOfSpeedCooling > 0) {
2451 12 : if (this->m_CoolVolumeFlowRate.empty()) this->m_CoolVolumeFlowRate.resize(this->m_NumOfSpeedCooling + 1);
2452 12 : if (this->m_CoolMassFlowRate.empty()) this->m_CoolMassFlowRate.resize(this->m_NumOfSpeedCooling + 1);
2453 12 : if (this->m_MSCoolingSpeedRatio.empty()) this->m_MSCoolingSpeedRatio.resize(this->m_NumOfSpeedCooling + 1);
2454 : }
2455 :
2456 12 : MSHPIndex = this->m_DesignSpecMSHPIndex;
2457 12 : if (MSHPIndex > -1) {
2458 0 : for (Iter = state.dataUnitarySystems->designSpecMSHP[MSHPIndex].numOfSpeedCooling; Iter >= 1; --Iter) {
2459 0 : if (state.dataUnitarySystems->designSpecMSHP[MSHPIndex].coolingVolFlowRatio[Iter - 1] == DataSizing::AutoSize) {
2460 0 : state.dataUnitarySystems->designSpecMSHP[MSHPIndex].coolingVolFlowRatio[Iter - 1] =
2461 0 : double(Iter) / double(state.dataUnitarySystems->designSpecMSHP[MSHPIndex].numOfSpeedCooling);
2462 : }
2463 : }
2464 : }
2465 :
2466 12 : VariableSpeedCoils::SimVariableSpeedCoils(state,
2467 : blankString,
2468 : this->m_CoolingCoilIndex,
2469 : 0,
2470 : this->m_MaxONOFFCyclesperHour,
2471 : this->m_HPTimeConstant,
2472 : this->m_FanDelayTime,
2473 : DataHVACGlobals::CompressorOperation::Off,
2474 : 0.0,
2475 : 1,
2476 : 0.0,
2477 : 0.0,
2478 : 0.0,
2479 : 0.0); // conduct the sizing operation in the VS WSHP
2480 12 : if (this->m_NumOfSpeedCooling != state.dataVariableSpeedCoils->VarSpeedCoil(this->m_CoolingCoilIndex).NumOfSpeeds) {
2481 0 : ShowWarningError(state, std::string{RoutineName} + ": " + CompType + " = " + std::string{CompName});
2482 0 : ShowContinueError(state, "Number of cooling speeds does not match coil object.");
2483 0 : ShowFatalError(state,
2484 0 : "Cooling coil = " + state.dataVariableSpeedCoils->VarSpeedCoil(this->m_CoolingCoilIndex).VarSpeedCoilType + ": " +
2485 0 : state.dataVariableSpeedCoils->VarSpeedCoil(this->m_CoolingCoilIndex).Name);
2486 : }
2487 24 : state.dataSize->DXCoolCap = VariableSpeedCoils::GetCoilCapacityVariableSpeed(
2488 12 : state, DataHVACGlobals::cAllCoilTypes(this->m_CoolingCoilType_Num), this->m_CoolingCoilName, ErrFound);
2489 12 : EqSizing.DesCoolingLoad = state.dataSize->DXCoolCap;
2490 12 : if (this->m_DXHeatingCoil) {
2491 6 : EqSizing.DesHeatingLoad = state.dataSize->DXCoolCap;
2492 : }
2493 :
2494 108 : for (Iter = 1; Iter <= this->m_NumOfSpeedCooling; ++Iter) {
2495 : // using only for PTUnit to UnitarySystem conversion for the time being, should use this all the time
2496 96 : if (this->m_sysType == SysType::PackagedAC || this->m_sysType == SysType::PackagedHP || this->m_sysType == SysType::PackagedWSHP) {
2497 70 : this->m_MSCoolingSpeedRatio[Iter] =
2498 140 : state.dataVariableSpeedCoils->VarSpeedCoil(this->m_CoolingCoilIndex).MSRatedAirVolFlowRate(Iter) /
2499 70 : state.dataVariableSpeedCoils->VarSpeedCoil(this->m_CoolingCoilIndex).MSRatedAirVolFlowRate(this->m_NumOfSpeedCooling);
2500 70 : this->m_CoolVolumeFlowRate[Iter] = this->m_MaxCoolAirVolFlow * this->m_MSCoolingSpeedRatio[Iter];
2501 70 : this->m_CoolMassFlowRate[Iter] = this->MaxCoolAirMassFlow * this->m_MSCoolingSpeedRatio[Iter];
2502 : } else {
2503 26 : this->m_CoolVolumeFlowRate[Iter] =
2504 26 : state.dataVariableSpeedCoils->VarSpeedCoil(this->m_CoolingCoilIndex).MSRatedAirVolFlowRate(Iter);
2505 26 : this->m_CoolMassFlowRate[Iter] = this->m_CoolVolumeFlowRate[Iter] * state.dataEnvrn->StdRhoAir;
2506 : // this is divided by the system max air flow, not the cooling coil max air flow, doesn't seem correct
2507 26 : this->m_MSCoolingSpeedRatio[Iter] = this->m_CoolVolumeFlowRate[Iter] / this->m_DesignFanVolFlowRate;
2508 : }
2509 : }
2510 :
2511 24 : if (MSHPIndex > -1) {
2512 0 : this->m_MaxNoCoolHeatAirVolFlow =
2513 0 : this->m_MaxCoolAirVolFlow * state.dataUnitarySystems->designSpecMSHP[MSHPIndex].noLoadAirFlowRateRatio;
2514 0 : this->MaxNoCoolHeatAirMassFlow = this->m_MaxNoCoolHeatAirVolFlow * state.dataEnvrn->StdRhoAir;
2515 0 : this->m_NoLoadAirFlowRateRatio = this->m_MaxNoCoolHeatAirVolFlow / this->m_DesignFanVolFlowRate;
2516 12 : } else if (this->m_CoolVolumeFlowRate.empty()) {
2517 0 : this->m_NoLoadAirFlowRateRatio = this->m_MaxNoCoolHeatAirVolFlow / this->m_DesignFanVolFlowRate;
2518 : }
2519 :
2520 580 : } else if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_CoolingHXAssisted) {
2521 : // mine data from heat exchanger assisted cooling coil
2522 : // Get DX heat exchanger assisted cooling coil index
2523 2 : int childCCType_Num = state.dataHVACAssistedCC->HXAssistedCoil(this->m_CoolingCoilIndex).CoolingCoilType_Num;
2524 2 : if (childCCType_Num == DataHVACGlobals::CoilDX_Cooling) {
2525 0 : int childCCIndex = state.dataHVACAssistedCC->HXAssistedCoil(this->m_CoolingCoilIndex).CoolingCoilIndex;
2526 0 : if (childCCIndex < 0) {
2527 0 : ShowWarningError(state, "Occurs in sizing HeatExchangerAssistedCoolingCoil.");
2528 0 : ShowFatalError(state, "No cooling coil = Coil:Cooling:DX found.");
2529 0 : ErrFound = true;
2530 : }
2531 0 : auto &newCoil = state.dataCoilCooingDX->coilCoolingDXs[childCCIndex];
2532 0 : this->m_NumOfSpeedCooling = newCoil.performance.normalMode.speeds.size();
2533 0 : if (this->m_NumOfSpeedCooling > 0) {
2534 0 : if (this->m_CoolVolumeFlowRate.empty()) this->m_CoolVolumeFlowRate.resize(this->m_NumOfSpeedCooling + 1);
2535 0 : if (this->m_CoolMassFlowRate.empty()) this->m_CoolMassFlowRate.resize(this->m_NumOfSpeedCooling + 1);
2536 0 : if (this->m_MSCoolingSpeedRatio.empty()) this->m_MSCoolingSpeedRatio.resize(this->m_NumOfSpeedCooling + 1);
2537 : }
2538 :
2539 : // it feels like we are jamming the rectangular DXCoil into an oval box here
2540 0 : MSHPIndex = this->m_DesignSpecMSHPIndex;
2541 0 : if (MSHPIndex > -1) {
2542 0 : for (Iter = state.dataUnitarySystems->designSpecMSHP[MSHPIndex].numOfSpeedCooling; Iter >= 1;
2543 : --Iter) { // use reverse order since we divide by HeatVolumeFlowRate(max)
2544 0 : if (state.dataUnitarySystems->designSpecMSHP[MSHPIndex].coolingVolFlowRatio[Iter - 1] == DataSizing::AutoSize) {
2545 0 : state.dataUnitarySystems->designSpecMSHP[MSHPIndex].coolingVolFlowRatio[Iter - 1] =
2546 0 : double(Iter) / double(state.dataUnitarySystems->designSpecMSHP[MSHPIndex].numOfSpeedCooling);
2547 : }
2548 : }
2549 : }
2550 :
2551 : // TODO: Determine operating mode based on dehumdification stuff, using normalMode for now
2552 0 : if (this->m_NumOfSpeedCooling != (int)newCoil.performance.normalMode.speeds.size()) {
2553 0 : ShowWarningError(state, std::string{RoutineName} + ": " + CompType + " = " + std::string{CompName});
2554 0 : ShowContinueError(state, "Number of cooling speeds does not match coil object.");
2555 0 : ShowFatalError(state, "Cooling coil = Coil:Cooling:DX: " + newCoil.name);
2556 : }
2557 :
2558 : // Use discrete/continuous control algorithm regardless of number of speeds
2559 0 : if (newCoil.performance.capControlMethod == CoilCoolingDXCurveFitPerformance::CapControlMethod::DISCRETE) {
2560 0 : this->m_DiscreteSpeedCoolingCoil = true;
2561 0 : } else if (newCoil.performance.capControlMethod == CoilCoolingDXCurveFitPerformance::CapControlMethod::CONTINUOUS) {
2562 0 : this->m_ContSpeedCoolingCoil = true;
2563 : }
2564 :
2565 0 : newCoil.size(state);
2566 0 : if (MSHPIndex == -1) {
2567 0 : for (Iter = 1; Iter <= this->m_NumOfSpeedCooling; ++Iter) {
2568 0 : this->m_CoolVolumeFlowRate[Iter] = newCoil.performance.normalMode.speeds[Iter - 1].evap_air_flow_rate;
2569 0 : this->m_CoolMassFlowRate[Iter] = this->m_CoolVolumeFlowRate[Iter] * state.dataEnvrn->StdRhoAir;
2570 : // it seems the ratio should reference the actual flow rates, not the fan flow ???
2571 0 : if (this->m_DesignFanVolFlowRate > 0.0 && this->m_FanExists) {
2572 0 : this->m_MSCoolingSpeedRatio[Iter] = this->m_CoolVolumeFlowRate[Iter] / this->m_DesignFanVolFlowRate;
2573 : } else {
2574 0 : this->m_MSCoolingSpeedRatio[Iter] =
2575 0 : this->m_CoolVolumeFlowRate[Iter] / this->m_CoolVolumeFlowRate[this->m_NumOfSpeedCooling];
2576 : }
2577 : }
2578 : }
2579 :
2580 0 : state.dataSize->DXCoolCap = newCoil.performance.normalMode.ratedGrossTotalCap;
2581 0 : EqSizing.DesCoolingLoad = state.dataSize->DXCoolCap;
2582 0 : if (this->m_HeatPump) EqSizing.DesHeatingLoad = state.dataSize->DXCoolCap;
2583 :
2584 0 : if (MSHPIndex > -1) {
2585 0 : for (Iter = state.dataUnitarySystems->designSpecMSHP[MSHPIndex].numOfSpeedCooling; Iter > 0; --Iter) {
2586 0 : if (state.dataUnitarySystems->designSpecMSHP[MSHPIndex].coolingVolFlowRatio[Iter - 1] == DataSizing::AutoSize)
2587 0 : state.dataUnitarySystems->designSpecMSHP[MSHPIndex].coolingVolFlowRatio[Iter - 1] =
2588 0 : double(Iter) / double(state.dataUnitarySystems->designSpecMSHP[MSHPIndex].numOfSpeedCooling);
2589 0 : this->m_CoolVolumeFlowRate[Iter] =
2590 0 : this->m_MaxCoolAirVolFlow * state.dataUnitarySystems->designSpecMSHP[MSHPIndex].coolingVolFlowRatio[Iter - 1];
2591 0 : this->m_CoolMassFlowRate[Iter] = this->m_CoolVolumeFlowRate[Iter] * state.dataEnvrn->StdRhoAir;
2592 0 : this->m_MSCoolingSpeedRatio[Iter] = this->m_CoolVolumeFlowRate[Iter] / this->m_DesignFanVolFlowRate;
2593 : }
2594 0 : this->m_MaxNoCoolHeatAirVolFlow =
2595 0 : this->m_MaxCoolAirVolFlow * state.dataUnitarySystems->designSpecMSHP[MSHPIndex].noLoadAirFlowRateRatio;
2596 0 : this->MaxNoCoolHeatAirMassFlow = this->m_MaxNoCoolHeatAirVolFlow * state.dataEnvrn->StdRhoAir;
2597 0 : this->m_NoLoadAirFlowRateRatio = this->m_MaxNoCoolHeatAirVolFlow / this->m_DesignFanVolFlowRate;
2598 0 : } else if (this->m_CoolVolumeFlowRate.empty()) {
2599 0 : this->m_NoLoadAirFlowRateRatio = this->m_MaxNoCoolHeatAirVolFlow / this->m_DesignFanVolFlowRate;
2600 : }
2601 : }
2602 578 : } else if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_Cooling) {
2603 50 : if (this->m_NumOfSpeedCooling > 0) {
2604 50 : if (this->m_CoolVolumeFlowRate.empty()) this->m_CoolVolumeFlowRate.resize(this->m_NumOfSpeedCooling + 1);
2605 50 : if (this->m_CoolMassFlowRate.empty()) this->m_CoolMassFlowRate.resize(this->m_NumOfSpeedCooling + 1);
2606 50 : if (this->m_MSCoolingSpeedRatio.empty()) this->m_MSCoolingSpeedRatio.resize(this->m_NumOfSpeedCooling + 1);
2607 : }
2608 :
2609 : // it feels like we are jamming the rectangular DXCoil into an oval box here
2610 50 : MSHPIndex = this->m_DesignSpecMSHPIndex;
2611 50 : if (MSHPIndex > -1) {
2612 74 : for (Iter = state.dataUnitarySystems->designSpecMSHP[MSHPIndex].numOfSpeedCooling; Iter >= 1;
2613 : --Iter) { // use reverse order since we divide by HeatVolumeFlowRate(max)
2614 57 : if (state.dataUnitarySystems->designSpecMSHP[MSHPIndex].coolingVolFlowRatio[Iter - 1] == DataSizing::AutoSize) {
2615 53 : state.dataUnitarySystems->designSpecMSHP[MSHPIndex].coolingVolFlowRatio[Iter - 1] =
2616 53 : double(Iter) / double(state.dataUnitarySystems->designSpecMSHP[MSHPIndex].numOfSpeedCooling);
2617 : }
2618 : }
2619 : }
2620 :
2621 : // mine capacity from Coil:Cooling:DX object
2622 50 : auto &newCoil = state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex];
2623 : // TODO: Determine operating mode based on dehumdification stuff, using normalMode for now
2624 50 : if (this->m_NumOfSpeedCooling != (int)newCoil.performance.normalMode.speeds.size()) {
2625 0 : ShowWarningError(state, std::string{RoutineName} + ": " + CompType + " = " + std::string{CompName});
2626 0 : ShowContinueError(state, "Number of cooling speeds does not match coil object.");
2627 0 : ShowFatalError(state, "Cooling coil = Coil:Cooling:DX: " + newCoil.name);
2628 : }
2629 :
2630 : // Use discrete/continuous control algorithm regardless of number of speeds
2631 50 : if (newCoil.performance.capControlMethod == CoilCoolingDXCurveFitPerformance::CapControlMethod::DISCRETE) {
2632 48 : this->m_DiscreteSpeedCoolingCoil = true;
2633 2 : } else if (newCoil.performance.capControlMethod == CoilCoolingDXCurveFitPerformance::CapControlMethod::CONTINUOUS) {
2634 2 : this->m_ContSpeedCoolingCoil = true;
2635 : }
2636 :
2637 50 : newCoil.size(state);
2638 50 : if (MSHPIndex == -1) {
2639 82 : for (Iter = 1; Iter <= this->m_NumOfSpeedCooling; ++Iter) {
2640 49 : this->m_CoolVolumeFlowRate[Iter] = newCoil.performance.normalMode.speeds[Iter - 1].evap_air_flow_rate;
2641 49 : this->m_CoolMassFlowRate[Iter] = this->m_CoolVolumeFlowRate[Iter] * state.dataEnvrn->StdRhoAir;
2642 : // it seems the ratio should reference the actual flow rates, not the fan flow ???
2643 49 : if (this->m_DesignFanVolFlowRate > 0.0 && this->m_FanExists) {
2644 47 : this->m_MSCoolingSpeedRatio[Iter] = this->m_CoolVolumeFlowRate[Iter] / this->m_DesignFanVolFlowRate;
2645 : } else {
2646 2 : this->m_MSCoolingSpeedRatio[Iter] = this->m_CoolVolumeFlowRate[Iter] / this->m_CoolVolumeFlowRate[this->m_NumOfSpeedCooling];
2647 : }
2648 : }
2649 : }
2650 :
2651 50 : state.dataSize->DXCoolCap = newCoil.performance.normalMode.ratedGrossTotalCap;
2652 50 : EqSizing.DesCoolingLoad = state.dataSize->DXCoolCap;
2653 50 : if (this->m_HeatPump) EqSizing.DesHeatingLoad = state.dataSize->DXCoolCap;
2654 :
2655 50 : if (MSHPIndex > -1) {
2656 74 : for (Iter = state.dataUnitarySystems->designSpecMSHP[MSHPIndex].numOfSpeedCooling; Iter > 0; --Iter) {
2657 57 : if (state.dataUnitarySystems->designSpecMSHP[MSHPIndex].coolingVolFlowRatio[Iter - 1] == DataSizing::AutoSize)
2658 0 : state.dataUnitarySystems->designSpecMSHP[MSHPIndex].coolingVolFlowRatio[Iter - 1] =
2659 0 : double(Iter) / double(state.dataUnitarySystems->designSpecMSHP[MSHPIndex].numOfSpeedCooling);
2660 57 : this->m_CoolVolumeFlowRate[Iter] =
2661 57 : this->m_MaxCoolAirVolFlow * state.dataUnitarySystems->designSpecMSHP[MSHPIndex].coolingVolFlowRatio[Iter - 1];
2662 57 : this->m_CoolMassFlowRate[Iter] = this->m_CoolVolumeFlowRate[Iter] * state.dataEnvrn->StdRhoAir;
2663 57 : this->m_MSCoolingSpeedRatio[Iter] = this->m_CoolVolumeFlowRate[Iter] / this->m_DesignFanVolFlowRate;
2664 : }
2665 17 : this->m_MaxNoCoolHeatAirVolFlow =
2666 17 : this->m_MaxCoolAirVolFlow * state.dataUnitarySystems->designSpecMSHP[MSHPIndex].noLoadAirFlowRateRatio;
2667 17 : this->MaxNoCoolHeatAirMassFlow = this->m_MaxNoCoolHeatAirVolFlow * state.dataEnvrn->StdRhoAir;
2668 17 : this->m_NoLoadAirFlowRateRatio = this->m_MaxNoCoolHeatAirVolFlow / this->m_DesignFanVolFlowRate;
2669 33 : } else if (this->m_CoolVolumeFlowRate.empty()) {
2670 0 : this->m_NoLoadAirFlowRateRatio = this->m_MaxNoCoolHeatAirVolFlow / this->m_DesignFanVolFlowRate;
2671 : }
2672 :
2673 1019 : } else if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedCooling ||
2674 491 : this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_CoolingTwoSpeed) {
2675 104 : if (this->m_NumOfSpeedCooling > 0) {
2676 104 : if (this->m_CoolVolumeFlowRate.empty()) this->m_CoolVolumeFlowRate.resize(this->m_NumOfSpeedCooling + 1);
2677 104 : if (this->m_CoolMassFlowRate.empty()) this->m_CoolMassFlowRate.resize(this->m_NumOfSpeedCooling + 1);
2678 104 : if (this->m_MSCoolingSpeedRatio.empty()) this->m_MSCoolingSpeedRatio.resize(this->m_NumOfSpeedCooling + 1);
2679 : }
2680 :
2681 : // set the multi-speed high flow rate variable in case a non-zero air flow rate resides on the coil inlet during sizing (e.g., upstream
2682 : // system ran prior to this one)
2683 104 : state.dataHVACGlobal->MSHPMassFlowRateHigh =
2684 208 : EqSizing.CoolingAirVolFlow *
2685 104 : state.dataEnvrn->StdRhoAir; // doesn't matter what this value is since only coil size is needed and CompressorOn = 0 here
2686 104 : DXCoils::SimDXCoilMultiSpeed(state, blankString, 1.0, 1.0, this->m_CoolingCoilIndex, 0, 0, DataHVACGlobals::CompressorOperation::Off);
2687 104 : if (!HardSizeNoDesRun && EqSizing.Capacity) {
2688 : // do nothing, the vars EqSizing.DesCoolingLoad and DataSizing::DXCoolCap are already set earlier and the values could be max of the
2689 : // cooling and heating autosized values. Thus reseting them here to user specified value may not be the design size used else where
2690 : } else {
2691 100 : state.dataSize->DXCoolCap =
2692 100 : DXCoils::GetCoilCapacityByIndexType(state, this->m_CoolingCoilIndex, this->m_CoolingCoilType_Num, ErrFound);
2693 100 : EqSizing.DesCoolingLoad = state.dataSize->DXCoolCap;
2694 : }
2695 104 : MSHPIndex = this->m_DesignSpecMSHPIndex;
2696 :
2697 208 : if (MSHPIndex > -1) {
2698 : // use reverse order since we divide by CoolVolumeFlowRate(max)
2699 112 : for (Iter = state.dataUnitarySystems->designSpecMSHP[MSHPIndex].numOfSpeedCooling; Iter > 0; --Iter) {
2700 75 : if (state.dataUnitarySystems->designSpecMSHP[MSHPIndex].coolingVolFlowRatio[Iter - 1] == DataSizing::AutoSize)
2701 3 : state.dataUnitarySystems->designSpecMSHP[MSHPIndex].coolingVolFlowRatio[Iter - 1] =
2702 3 : double(Iter) / double(state.dataUnitarySystems->designSpecMSHP[MSHPIndex].numOfSpeedCooling);
2703 75 : this->m_CoolVolumeFlowRate[Iter] =
2704 75 : this->m_MaxCoolAirVolFlow * state.dataUnitarySystems->designSpecMSHP[MSHPIndex].coolingVolFlowRatio[Iter - 1];
2705 75 : this->m_CoolMassFlowRate[Iter] = this->m_CoolVolumeFlowRate[Iter] * state.dataEnvrn->StdRhoAir;
2706 75 : this->m_MSCoolingSpeedRatio[Iter] = this->m_CoolVolumeFlowRate[Iter] / this->m_DesignFanVolFlowRate;
2707 : }
2708 37 : this->m_MaxNoCoolHeatAirVolFlow =
2709 37 : this->m_MaxCoolAirVolFlow * state.dataUnitarySystems->designSpecMSHP[MSHPIndex].noLoadAirFlowRateRatio;
2710 37 : this->MaxNoCoolHeatAirMassFlow = this->m_MaxNoCoolHeatAirVolFlow * state.dataEnvrn->StdRhoAir;
2711 37 : this->m_NoLoadAirFlowRateRatio = this->m_MaxNoCoolHeatAirVolFlow / this->m_DesignFanVolFlowRate;
2712 67 : } else if (this->m_CoolVolumeFlowRate.empty()) {
2713 0 : this->m_NoLoadAirFlowRateRatio = this->m_MaxNoCoolHeatAirVolFlow / this->m_DesignFanVolFlowRate;
2714 : } else {
2715 201 : for (Iter = this->m_NumOfSpeedCooling; Iter > 0; --Iter) {
2716 134 : this->m_CoolVolumeFlowRate[Iter] = this->m_MaxCoolAirVolFlow * Iter / this->m_NumOfSpeedCooling;
2717 134 : this->m_CoolMassFlowRate[Iter] = this->m_CoolVolumeFlowRate[Iter] * state.dataEnvrn->StdRhoAir;
2718 134 : this->m_MSCoolingSpeedRatio[Iter] = this->m_CoolVolumeFlowRate[Iter] / this->m_DesignFanVolFlowRate;
2719 : }
2720 67 : this->MaxNoCoolHeatAirMassFlow = this->m_MaxNoCoolHeatAirVolFlow * state.dataEnvrn->StdRhoAir;
2721 67 : this->m_NoLoadAirFlowRateRatio = this->m_MaxNoCoolHeatAirVolFlow / this->m_DesignFanVolFlowRate;
2722 : }
2723 843 : } else if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWater ||
2724 419 : this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWaterDetailed) {
2725 5 : if (this->m_NumOfSpeedCooling > 0) {
2726 1 : if (this->m_CoolVolumeFlowRate.empty()) this->m_CoolVolumeFlowRate.resize(this->m_NumOfSpeedCooling + 1);
2727 1 : if (this->m_CoolMassFlowRate.empty()) this->m_CoolMassFlowRate.resize(this->m_NumOfSpeedCooling + 1);
2728 1 : if (this->m_MSCoolingSpeedRatio.empty()) this->m_MSCoolingSpeedRatio.resize(this->m_NumOfSpeedCooling + 1);
2729 : }
2730 5 : MSHPIndex = this->m_DesignSpecMSHPIndex;
2731 :
2732 5 : if (MSHPIndex > -1) {
2733 5 : for (Iter = state.dataUnitarySystems->designSpecMSHP[MSHPIndex].numOfSpeedCooling; Iter > 0; --Iter) {
2734 4 : if (state.dataUnitarySystems->designSpecMSHP[MSHPIndex].coolingVolFlowRatio[Iter - 1] == DataSizing::AutoSize)
2735 0 : state.dataUnitarySystems->designSpecMSHP[MSHPIndex].coolingVolFlowRatio[Iter - 1] =
2736 0 : double(Iter) / double(state.dataUnitarySystems->designSpecMSHP[MSHPIndex].numOfSpeedCooling);
2737 4 : this->m_CoolVolumeFlowRate[Iter] =
2738 4 : this->m_MaxCoolAirVolFlow * state.dataUnitarySystems->designSpecMSHP[MSHPIndex].coolingVolFlowRatio[Iter - 1];
2739 4 : this->m_CoolMassFlowRate[Iter] = this->m_CoolVolumeFlowRate[Iter] * state.dataEnvrn->StdRhoAir;
2740 4 : this->m_MSCoolingSpeedRatio[Iter] = this->m_CoolVolumeFlowRate[Iter] / this->m_DesignFanVolFlowRate;
2741 : }
2742 1 : this->m_MaxNoCoolHeatAirVolFlow =
2743 1 : this->m_MaxCoolAirVolFlow * state.dataUnitarySystems->designSpecMSHP[MSHPIndex].noLoadAirFlowRateRatio;
2744 1 : this->MaxNoCoolHeatAirMassFlow = this->m_MaxNoCoolHeatAirVolFlow * state.dataEnvrn->StdRhoAir;
2745 1 : this->m_NoLoadAirFlowRateRatio = this->m_MaxNoCoolHeatAirVolFlow / this->m_DesignFanVolFlowRate;
2746 4 : } else if (this->m_CoolVolumeFlowRate.empty()) {
2747 4 : this->m_NoLoadAirFlowRateRatio = this->m_MaxNoCoolHeatAirVolFlow / this->m_DesignFanVolFlowRate;
2748 : }
2749 : }
2750 :
2751 1173 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedHeating ||
2752 1162 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingElectric_MultiStage ||
2753 581 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingGas_MultiStage) {
2754 11 : if (this->m_NumOfSpeedHeating > 0) {
2755 11 : if (this->m_HeatVolumeFlowRate.empty()) this->m_HeatVolumeFlowRate.resize(this->m_NumOfSpeedHeating + 1);
2756 11 : if (this->m_HeatMassFlowRate.empty()) this->m_HeatMassFlowRate.resize(this->m_NumOfSpeedHeating + 1);
2757 11 : if (this->m_MSHeatingSpeedRatio.empty()) this->m_MSHeatingSpeedRatio.resize(this->m_NumOfSpeedHeating + 1);
2758 : }
2759 :
2760 11 : MSHPIndex = this->m_DesignSpecMSHPIndex;
2761 :
2762 22 : if (MSHPIndex > -1) {
2763 : // use reverse order since we divide by HeatVolumeFlowRate(max)
2764 47 : for (Iter = state.dataUnitarySystems->designSpecMSHP[MSHPIndex].numOfSpeedHeating; Iter > 0; --Iter) {
2765 36 : if (state.dataUnitarySystems->designSpecMSHP[MSHPIndex].heatingVolFlowRatio[Iter - 1] == DataSizing::AutoSize) {
2766 24 : if (this->m_ControlType == UnitarySysCtrlType::Setpoint &&
2767 0 : (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingElectric_MultiStage ||
2768 0 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingGas_MultiStage)) {
2769 0 : state.dataUnitarySystems->designSpecMSHP[MSHPIndex].heatingVolFlowRatio[Iter - 1] = 1.0;
2770 : } else {
2771 24 : state.dataUnitarySystems->designSpecMSHP[MSHPIndex].heatingVolFlowRatio[Iter - 1] =
2772 24 : double(Iter) / double(state.dataUnitarySystems->designSpecMSHP[MSHPIndex].numOfSpeedHeating);
2773 : }
2774 : } else {
2775 24 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingElectric_MultiStage ||
2776 12 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingGas_MultiStage) {
2777 0 : if (state.dataUnitarySystems->designSpecMSHP[MSHPIndex].heatingVolFlowRatio[Iter - 1] < 1.0 &&
2778 0 : this->m_ControlType == UnitarySysCtrlType::Setpoint) {
2779 0 : ShowWarningError(state, std::string{RoutineName} + ": " + CompType + " = " + std::string{CompName});
2780 0 : ShowContinueError(state, "Design specification object = " + state.dataUnitarySystems->designSpecMSHP[MSHPIndex].name);
2781 0 : ShowContinueError(state,
2782 : "When control type = SetPointBased the outlet air temperature must change with coil capacity, if "
2783 : "air flow also changes outlet air temperature will be relatively constant.");
2784 0 : ShowContinueError(
2785 : state,
2786 0 : format("Speed {} Supply Air Flow Ratio During Heating Operation will be set = 1.0 and the simulation continues",
2787 0 : Iter));
2788 0 : state.dataUnitarySystems->designSpecMSHP[MSHPIndex].heatingVolFlowRatio[Iter - 1] = 1.0;
2789 : }
2790 : }
2791 : }
2792 36 : this->m_HeatVolumeFlowRate[Iter] =
2793 36 : this->m_MaxHeatAirVolFlow * state.dataUnitarySystems->designSpecMSHP[MSHPIndex].heatingVolFlowRatio[Iter - 1];
2794 36 : this->m_HeatMassFlowRate[Iter] = this->m_HeatVolumeFlowRate[Iter] * state.dataEnvrn->StdRhoAir;
2795 36 : this->m_MSHeatingSpeedRatio[Iter] = this->m_HeatVolumeFlowRate[Iter] / this->m_DesignFanVolFlowRate;
2796 : }
2797 11 : if (this->m_CoolCoilExists) {
2798 11 : if (!this->m_CoolVolumeFlowRate.empty() && MSHPIndex > -1) {
2799 11 : this->m_MaxNoCoolHeatAirVolFlow =
2800 11 : min(this->m_MaxNoCoolHeatAirVolFlow,
2801 11 : this->m_MaxHeatAirVolFlow * state.dataUnitarySystems->designSpecMSHP[MSHPIndex].noLoadAirFlowRateRatio);
2802 11 : this->MaxNoCoolHeatAirMassFlow =
2803 11 : min(this->MaxNoCoolHeatAirMassFlow,
2804 11 : this->MaxHeatAirMassFlow * state.dataUnitarySystems->designSpecMSHP[MSHPIndex].noLoadAirFlowRateRatio);
2805 11 : this->m_NoLoadAirFlowRateRatio =
2806 11 : min(this->m_NoLoadAirFlowRateRatio, this->m_MaxNoCoolHeatAirVolFlow / this->m_DesignFanVolFlowRate);
2807 : } else {
2808 0 : this->m_NoLoadAirFlowRateRatio = this->m_MaxNoCoolHeatAirVolFlow / this->m_DesignFanVolFlowRate;
2809 : }
2810 0 : } else if (MSHPIndex > -1) {
2811 0 : this->m_MaxNoCoolHeatAirVolFlow =
2812 0 : this->m_MaxHeatAirVolFlow * state.dataUnitarySystems->designSpecMSHP[MSHPIndex].noLoadAirFlowRateRatio;
2813 0 : this->MaxNoCoolHeatAirMassFlow = this->m_MaxNoCoolHeatAirVolFlow * state.dataEnvrn->StdRhoAir;
2814 0 : this->m_NoLoadAirFlowRateRatio = this->m_MaxNoCoolHeatAirVolFlow / this->m_DesignFanVolFlowRate;
2815 : } else {
2816 0 : this->m_NoLoadAirFlowRateRatio = this->m_MaxNoCoolHeatAirVolFlow / this->m_DesignFanVolFlowRate;
2817 : }
2818 : }
2819 1159 : } else if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit ||
2820 578 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed) {
2821 6 : MSHPIndex = this->m_DesignSpecMSHPIndex;
2822 6 : if (MSHPIndex > -1) {
2823 0 : for (Iter = state.dataUnitarySystems->designSpecMSHP[MSHPIndex].numOfSpeedHeating; Iter > 0; --Iter) {
2824 0 : if (state.dataUnitarySystems->designSpecMSHP[MSHPIndex].heatingVolFlowRatio[Iter - 1] == DataSizing::AutoSize) {
2825 0 : state.dataUnitarySystems->designSpecMSHP[MSHPIndex].heatingVolFlowRatio[Iter - 1] =
2826 0 : double(Iter) / double(state.dataUnitarySystems->designSpecMSHP[MSHPIndex].numOfSpeedHeating);
2827 : }
2828 : }
2829 : }
2830 :
2831 6 : VariableSpeedCoils::SimVariableSpeedCoils(state,
2832 : blankString,
2833 : this->m_HeatingCoilIndex,
2834 : 0,
2835 : this->m_MaxONOFFCyclesperHour,
2836 : this->m_HPTimeConstant,
2837 : this->m_FanDelayTime,
2838 : DataHVACGlobals::CompressorOperation::Off,
2839 : 0.0,
2840 : 1,
2841 : 0.0,
2842 : 0.0,
2843 : 0.0,
2844 : 0.0); // conduct the sizing operation in the VS WSHP
2845 :
2846 6 : if (this->m_NumOfSpeedHeating != state.dataVariableSpeedCoils->VarSpeedCoil(this->m_HeatingCoilIndex).NumOfSpeeds) {
2847 0 : ShowWarningError(state, std::string{RoutineName} + ": " + CompType + " = " + std::string{CompName});
2848 0 : ShowContinueError(state, "Number of heating speeds does not match coil object.");
2849 0 : ShowFatalError(state,
2850 0 : "Heating coil = " + state.dataVariableSpeedCoils->VarSpeedCoil(this->m_HeatingCoilIndex).VarSpeedCoilType + ": " +
2851 0 : state.dataVariableSpeedCoils->VarSpeedCoil(this->m_HeatingCoilIndex).Name);
2852 : }
2853 :
2854 6 : if (this->m_NumOfSpeedHeating > 0) {
2855 6 : if (this->m_HeatVolumeFlowRate.empty()) this->m_HeatVolumeFlowRate.resize(this->m_NumOfSpeedHeating + 1);
2856 6 : if (this->m_HeatMassFlowRate.empty()) this->m_HeatMassFlowRate.resize(this->m_NumOfSpeedHeating + 1);
2857 6 : if (this->m_MSHeatingSpeedRatio.empty()) this->m_MSHeatingSpeedRatio.resize(this->m_NumOfSpeedHeating + 1);
2858 : }
2859 :
2860 66 : for (Iter = this->m_NumOfSpeedHeating; Iter >= 1; --Iter) {
2861 : // using only for PTUnit to UnitarySystem conversion for the time being, should use this all the time
2862 60 : if (this->m_sysType == SysType::PackagedAC || this->m_sysType == SysType::PackagedHP || this->m_sysType == SysType::PackagedWSHP) {
2863 : // SpeedRatio is only used in OnOff fan and should represent the ratio of flow to fan max flow
2864 40 : this->m_MSHeatingSpeedRatio[Iter] =
2865 80 : state.dataVariableSpeedCoils->VarSpeedCoil(this->m_HeatingCoilIndex).MSRatedAirVolFlowRate(Iter) /
2866 40 : state.dataVariableSpeedCoils->VarSpeedCoil(this->m_HeatingCoilIndex).MSRatedAirVolFlowRate(this->m_NumOfSpeedHeating);
2867 40 : this->m_HeatVolumeFlowRate[Iter] = this->m_MaxHeatAirVolFlow * this->m_MSHeatingSpeedRatio[Iter];
2868 40 : this->m_HeatMassFlowRate[Iter] = this->MaxHeatAirMassFlow * this->m_MSHeatingSpeedRatio[Iter];
2869 : } else {
2870 20 : this->m_HeatVolumeFlowRate[Iter] =
2871 20 : state.dataVariableSpeedCoils->VarSpeedCoil(this->m_HeatingCoilIndex).MSRatedAirVolFlowRate(Iter);
2872 20 : this->m_HeatMassFlowRate[Iter] = this->m_HeatVolumeFlowRate[Iter] * state.dataEnvrn->StdRhoAir;
2873 20 : if (this->m_DesignFanVolFlowRate > 0.0 && this->m_FanExists) {
2874 : // this is divided by the system max air flow, not the heating coil max air flow
2875 20 : this->m_MSHeatingSpeedRatio[Iter] = this->m_HeatVolumeFlowRate[Iter] / this->m_DesignFanVolFlowRate;
2876 : } else {
2877 : // if there is no fan this doesn't matter? Should calculate SpeedRatio in fan model? and get rid of SpeedRatio variable?
2878 0 : this->m_MSHeatingSpeedRatio[Iter] = this->m_HeatVolumeFlowRate[Iter] / this->m_HeatVolumeFlowRate[this->m_NumOfSpeedHeating];
2879 : }
2880 : }
2881 : }
2882 :
2883 6 : if (this->m_CoolCoilExists && this->m_NumOfSpeedHeating > 0) {
2884 12 : if (!this->m_CoolVolumeFlowRate.empty() && MSHPIndex > -1) {
2885 0 : this->m_MaxNoCoolHeatAirVolFlow =
2886 0 : min(this->m_MaxNoCoolHeatAirVolFlow,
2887 0 : this->m_MaxHeatAirVolFlow * state.dataUnitarySystems->designSpecMSHP[MSHPIndex].noLoadAirFlowRateRatio);
2888 0 : this->MaxNoCoolHeatAirMassFlow =
2889 0 : min(this->MaxNoCoolHeatAirMassFlow,
2890 0 : this->MaxHeatAirMassFlow * state.dataUnitarySystems->designSpecMSHP[MSHPIndex].noLoadAirFlowRateRatio);
2891 0 : this->m_NoLoadAirFlowRateRatio =
2892 0 : min(this->m_NoLoadAirFlowRateRatio, this->m_MaxNoCoolHeatAirVolFlow / this->m_DesignFanVolFlowRate);
2893 6 : } else if (this->m_CoolVolumeFlowRate.empty() && MSHPIndex > -1) {
2894 0 : this->m_MaxNoCoolHeatAirVolFlow =
2895 0 : this->m_MaxHeatAirVolFlow * state.dataUnitarySystems->designSpecMSHP[MSHPIndex].noLoadAirFlowRateRatio;
2896 0 : this->MaxNoCoolHeatAirMassFlow =
2897 0 : this->MaxHeatAirMassFlow * state.dataUnitarySystems->designSpecMSHP[MSHPIndex].noLoadAirFlowRateRatio;
2898 0 : this->m_NoLoadAirFlowRateRatio = this->m_MSHeatingSpeedRatio[this->m_NumOfSpeedHeating] *
2899 0 : state.dataUnitarySystems->designSpecMSHP[MSHPIndex].noLoadAirFlowRateRatio;
2900 6 : } else if (!this->m_CoolVolumeFlowRate.empty()) {
2901 : // what the heck is this next line? should be min of min cooling and min heating flow rates?
2902 : // this is calculated above so likely not even needed here, just have to be sure it's always calculated
2903 6 : this->m_MaxNoCoolHeatAirVolFlow = min(this->m_MaxNoCoolHeatAirVolFlow, this->m_MaxNoCoolHeatAirVolFlow);
2904 9 : if (this->m_sysType == SysType::PackagedAC || this->m_sysType == SysType::PackagedHP ||
2905 3 : this->m_sysType == SysType::PackagedWSHP) {
2906 4 : if (!this->m_MultiOrVarSpeedCoolCoil && !this->m_MultiOrVarSpeedHeatCoil) {
2907 0 : this->m_MaxNoCoolHeatAirVolFlow = min(this->m_MaxCoolAirVolFlow, this->m_MaxHeatAirVolFlow);
2908 : }
2909 4 : this->MaxNoCoolHeatAirMassFlow = this->m_MaxNoCoolHeatAirVolFlow * state.dataEnvrn->StdRhoAir;
2910 : } else {
2911 : // this should be min of min cooling and min heating flow rates?
2912 2 : this->MaxNoCoolHeatAirMassFlow = min(this->MaxNoCoolHeatAirMassFlow, this->MaxNoCoolHeatAirMassFlow);
2913 : }
2914 6 : this->m_NoLoadAirFlowRateRatio =
2915 6 : min(this->m_NoLoadAirFlowRateRatio, this->m_MaxNoCoolHeatAirVolFlow / this->m_DesignFanVolFlowRate);
2916 : } else {
2917 0 : this->m_NoLoadAirFlowRateRatio = this->m_MaxNoCoolHeatAirVolFlow / this->m_DesignFanVolFlowRate;
2918 : }
2919 0 : } else if (MSHPIndex > -1) {
2920 0 : this->m_MaxNoCoolHeatAirVolFlow =
2921 0 : this->m_MaxHeatAirVolFlow * state.dataUnitarySystems->designSpecMSHP[MSHPIndex].noLoadAirFlowRateRatio;
2922 0 : this->MaxNoCoolHeatAirMassFlow = this->m_MaxNoCoolHeatAirVolFlow * state.dataEnvrn->StdRhoAir;
2923 0 : this->m_NoLoadAirFlowRateRatio = this->m_MSHeatingSpeedRatio[this->m_NumOfSpeedHeating] *
2924 0 : state.dataUnitarySystems->designSpecMSHP[MSHPIndex].noLoadAirFlowRateRatio;
2925 : } else {
2926 0 : this->m_NoLoadAirFlowRateRatio = this->m_MaxNoCoolHeatAirVolFlow / this->m_DesignFanVolFlowRate;
2927 : }
2928 : }
2929 592 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWater) {
2930 : // pass air flow rate to zone water coil
2931 9 : if (state.dataSize->CurZoneEqNum > 0) {
2932 14 : WaterCoils::SetCoilDesFlow(state,
2933 7 : DataHVACGlobals::cAllCoilTypes(this->m_HeatingCoilType_Num),
2934 : this->m_HeatingCoilName,
2935 : this->m_MaxHeatAirVolFlow,
2936 7 : state.dataUnitarySystems->initUnitarySystemsErrorsFound);
2937 : }
2938 :
2939 9 : if (this->m_NumOfSpeedHeating > 0) {
2940 1 : if (this->m_HeatVolumeFlowRate.empty()) this->m_HeatVolumeFlowRate.resize(this->m_NumOfSpeedHeating + 1);
2941 1 : if (this->m_HeatMassFlowRate.empty()) this->m_HeatMassFlowRate.resize(this->m_NumOfSpeedHeating + 1);
2942 1 : if (this->m_MSHeatingSpeedRatio.empty()) this->m_MSHeatingSpeedRatio.resize(this->m_NumOfSpeedHeating + 1);
2943 : }
2944 :
2945 9 : MSHPIndex = this->m_DesignSpecMSHPIndex;
2946 9 : if (MSHPIndex > -1) {
2947 5 : for (Iter = state.dataUnitarySystems->designSpecMSHP[MSHPIndex].numOfSpeedHeating; Iter > 0; --Iter) {
2948 4 : if (state.dataUnitarySystems->designSpecMSHP[MSHPIndex].heatingVolFlowRatio[Iter - 1] == DataSizing::AutoSize) {
2949 0 : state.dataUnitarySystems->designSpecMSHP[MSHPIndex].heatingVolFlowRatio[Iter - 1] =
2950 0 : double(Iter) / double(state.dataUnitarySystems->designSpecMSHP[MSHPIndex].numOfSpeedHeating);
2951 : }
2952 4 : this->m_HeatVolumeFlowRate[Iter] =
2953 4 : this->m_MaxHeatAirVolFlow * state.dataUnitarySystems->designSpecMSHP[MSHPIndex].heatingVolFlowRatio[Iter - 1];
2954 4 : this->m_HeatMassFlowRate[Iter] = this->m_HeatVolumeFlowRate[Iter] * state.dataEnvrn->StdRhoAir;
2955 4 : this->m_MSHeatingSpeedRatio[Iter] = this->m_HeatVolumeFlowRate[Iter] / this->m_DesignFanVolFlowRate;
2956 : }
2957 1 : if (this->m_CoolCoilExists) {
2958 1 : if (!this->m_CoolVolumeFlowRate.empty() && MSHPIndex > 0) {
2959 0 : this->m_MaxNoCoolHeatAirVolFlow =
2960 0 : min(this->m_MaxNoCoolHeatAirVolFlow,
2961 0 : this->m_MaxHeatAirVolFlow * state.dataUnitarySystems->designSpecMSHP[MSHPIndex].noLoadAirFlowRateRatio);
2962 0 : this->MaxNoCoolHeatAirMassFlow =
2963 0 : min(this->MaxNoCoolHeatAirMassFlow,
2964 0 : this->MaxHeatAirMassFlow * state.dataUnitarySystems->designSpecMSHP[MSHPIndex].noLoadAirFlowRateRatio);
2965 0 : this->m_NoLoadAirFlowRateRatio =
2966 0 : min(this->m_NoLoadAirFlowRateRatio, this->m_MaxNoCoolHeatAirVolFlow / this->m_DesignFanVolFlowRate);
2967 : } else {
2968 1 : this->m_MaxNoCoolHeatAirVolFlow = min(this->m_MaxNoCoolHeatAirVolFlow, this->m_MaxNoCoolHeatAirVolFlow);
2969 1 : this->MaxNoCoolHeatAirMassFlow = min(this->MaxNoCoolHeatAirMassFlow, this->MaxNoCoolHeatAirMassFlow);
2970 1 : this->m_NoLoadAirFlowRateRatio =
2971 1 : min(this->m_NoLoadAirFlowRateRatio, (this->m_MaxNoCoolHeatAirVolFlow / this->m_DesignFanVolFlowRate));
2972 : }
2973 0 : } else if (MSHPIndex > -1) {
2974 0 : this->m_MaxNoCoolHeatAirVolFlow =
2975 0 : this->m_MaxHeatAirVolFlow * state.dataUnitarySystems->designSpecMSHP[MSHPIndex].noLoadAirFlowRateRatio;
2976 0 : this->MaxNoCoolHeatAirMassFlow =
2977 0 : this->MaxHeatAirMassFlow * state.dataUnitarySystems->designSpecMSHP[MSHPIndex].noLoadAirFlowRateRatio;
2978 0 : this->m_NoLoadAirFlowRateRatio = this->m_MSHeatingSpeedRatio[this->m_NumOfSpeedHeating] *
2979 0 : state.dataUnitarySystems->designSpecMSHP[MSHPIndex].noLoadAirFlowRateRatio;
2980 : } else {
2981 0 : this->m_NoLoadAirFlowRateRatio = this->m_MaxNoCoolHeatAirVolFlow / this->m_DesignFanVolFlowRate;
2982 : }
2983 : }
2984 : }
2985 :
2986 : // Not sure if this may be needed for special cases
2987 592 : if (this->m_CoolCoilExists && this->m_MaxCoolAirVolFlow < 0.0) {
2988 0 : if (!state.dataSize->SysSizingRunDone) {
2989 0 : BranchNum = BranchInputManager::GetAirBranchIndex(state, "AirloopHVAC:UnitarySystem", this->Name);
2990 0 : FanType = "";
2991 0 : m_FanName = "";
2992 0 : BranchFanFlow = 0.0;
2993 0 : if (BranchNum > 0.0) BranchInputManager::GetBranchFanTypeName(state, BranchNum, FanType, m_FanName, ErrFound);
2994 0 : if (!ErrFound && BranchNum > 0) {
2995 0 : if (this->m_FanType_Num == DataHVACGlobals::FanType_SystemModelObject) {
2996 0 : BranchFanFlow = state.dataHVACFan->fanObjs[this->m_FanIndex]->designAirVolFlowRate;
2997 : } else {
2998 0 : BranchFanFlow = Fans::GetFanDesignVolumeFlowRate(state, FanType, m_FanName, ErrFound);
2999 : }
3000 : }
3001 0 : if (BranchFanFlow > 0.0) {
3002 0 : this->m_MaxCoolAirVolFlow = BranchFanFlow;
3003 : } else {
3004 0 : SystemFlow = (AirLoopNum > 0) ? state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).DesignVolFlowRate : 0;
3005 0 : if (SystemFlow > 0.0) {
3006 0 : this->m_MaxCoolAirVolFlow = SystemFlow;
3007 : } else {
3008 : // what do I do?
3009 : }
3010 : }
3011 : }
3012 : }
3013 :
3014 : // why is this here?
3015 592 : this->m_SenLoadLoss = 0.0;
3016 592 : if (this->m_Humidistat) {
3017 25 : this->m_LatLoadLoss = 0.0;
3018 : }
3019 :
3020 592 : switch (this->m_sysType) {
3021 170 : case SysType::PackagedAC:
3022 : case SysType::PackagedHP:
3023 170 : PrintFlag = false;
3024 170 : break;
3025 422 : default:
3026 422 : break;
3027 : }
3028 592 : if (this->m_CoolCoilExists) {
3029 591 : SizingMethod = DataHVACGlobals::CoolingCapacitySizing;
3030 : // water coils must report their size to parent objects (or split out sizing routines for water coils so they can be call from here)
3031 1177 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWater ||
3032 586 : this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWaterDetailed) {
3033 5 : WaterCoils::SimulateWaterCoilComponents(
3034 : state, this->m_CoolingCoilName, FirstHVACIteration, this->m_CoolingCoilIndex, QActual, this->m_FanOpMode, 1.0);
3035 5 : state.dataSize->DataConstantUsedForSizing =
3036 10 : WaterCoils::GetWaterCoilCapacity(state,
3037 10 : UtilityRoutines::MakeUPPERCase(DataHVACGlobals::cAllCoilTypes(this->m_CoolingCoilType_Num)),
3038 : this->m_CoolingCoilName,
3039 : ErrFound);
3040 5 : EqSizing.DesCoolingLoad = state.dataSize->DataConstantUsedForSizing;
3041 5 : state.dataSize->DataFractionUsedForSizing = 1.0;
3042 5 : SizingMethod = DataHVACGlobals::AutoCalculateSizing;
3043 5 : this->m_DesignCoolingCapacity = DataSizing::AutoSize;
3044 586 : } else if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilWater_CoolingHXAssisted) {
3045 0 : HXCoilName = HVACHXAssistedCoolingCoil::GetHXDXCoilName(
3046 0 : state, DataHVACGlobals::cAllCoilTypes(this->m_CoolingCoilType_Num), this->m_CoolingCoilName, ErrFound);
3047 0 : ActualCoolCoilType = HVACHXAssistedCoolingCoil::GetCoilObjectTypeNum(
3048 0 : state, DataHVACGlobals::cAllCoilTypes(this->m_CoolingCoilType_Num), this->m_CoolingCoilName, ErrFound, true);
3049 0 : HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil(
3050 : state, blankString, true, DataHVACGlobals::CompressorOperation::On, 1.0, this->m_CoolingCoilIndex, 1, false, 1.0, false);
3051 0 : state.dataSize->DataConstantUsedForSizing = WaterCoils::GetWaterCoilCapacity(
3052 0 : state, UtilityRoutines::MakeUPPERCase(DataHVACGlobals::cAllCoilTypes(ActualCoolCoilType)), HXCoilName, ErrFound);
3053 0 : EqSizing.DesCoolingLoad = state.dataSize->DataConstantUsedForSizing;
3054 0 : state.dataSize->DataFractionUsedForSizing = 1.0;
3055 0 : SizingMethod = DataHVACGlobals::AutoCalculateSizing;
3056 0 : this->m_DesignCoolingCapacity = DataSizing::AutoSize;
3057 586 : } else if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWaterToAirHPSimple) {
3058 22 : WaterToAirHeatPumpSimple::SimWatertoAirHPSimple(state,
3059 : blankString,
3060 : this->m_CoolingCoilIndex,
3061 : this->m_CoolingCoilSensDemand,
3062 : this->m_CoolingCoilLatentDemand,
3063 : 0.0,
3064 : 0.0,
3065 : this->m_MaxONOFFCyclesperHour,
3066 : this->m_HPTimeConstant,
3067 : this->m_FanDelayTime,
3068 : DataHVACGlobals::CompressorOperation::Off,
3069 : 0.0,
3070 : FirstHVACIteration);
3071 44 : state.dataSize->DataConstantUsedForSizing = WaterToAirHeatPumpSimple::GetCoilCapacity(
3072 22 : state, DataHVACGlobals::cAllCoilTypes(this->m_CoolingCoilType_Num), this->m_CoolingCoilName, ErrFound);
3073 22 : EqSizing.DesCoolingLoad = state.dataSize->DataConstantUsedForSizing;
3074 22 : state.dataSize->DataFractionUsedForSizing = 1.0;
3075 22 : SizingMethod = DataHVACGlobals::AutoCalculateSizing;
3076 22 : this->m_DesignCoolingCapacity = DataSizing::AutoSize;
3077 22 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHP)
3078 0 : EqSizing.DesHeatingLoad = state.dataSize->DataConstantUsedForSizing;
3079 564 : } else if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWaterToAirHP) {
3080 5 : WaterToAirHeatPump::SimWatertoAirHP(state,
3081 : blankString,
3082 : this->m_CoolingCoilIndex,
3083 : this->MaxCoolAirMassFlow,
3084 : this->m_FanOpMode,
3085 : FirstHVACIteration,
3086 : 0.0,
3087 : this->m_MaxONOFFCyclesperHour,
3088 : this->m_HPTimeConstant,
3089 : this->m_FanDelayTime,
3090 5 : this->m_InitHeatPump,
3091 : 0.0,
3092 : 0.0,
3093 : DataHVACGlobals::CompressorOperation::Off,
3094 : 0.0);
3095 10 : state.dataSize->DataConstantUsedForSizing = WaterToAirHeatPump::GetCoilCapacity(
3096 5 : state, DataHVACGlobals::cAllCoilTypes(this->m_CoolingCoilType_Num), this->m_CoolingCoilName, ErrFound);
3097 5 : EqSizing.DesCoolingLoad = state.dataSize->DataConstantUsedForSizing;
3098 5 : state.dataSize->DataFractionUsedForSizing = 1.0;
3099 5 : SizingMethod = DataHVACGlobals::AutoCalculateSizing;
3100 5 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHP ||
3101 0 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHPSimple)
3102 5 : EqSizing.DesHeatingLoad = state.dataSize->DataConstantUsedForSizing;
3103 559 : } else if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_PackagedThermalStorageCooling) {
3104 4 : PackagedThermalStorageCoil::SimTESCoil(
3105 : state, this->m_CoolingCoilName, this->m_CoolingCoilIndex, this->m_FanOpMode, this->m_TESOpMode, 0.0);
3106 4 : PackagedThermalStorageCoil::GetTESCoilCoolingCapacity(
3107 4 : state, this->m_CoolingCoilName, state.dataSize->DataConstantUsedForSizing, ErrFound, CompType);
3108 4 : EqSizing.DesCoolingLoad = state.dataSize->DataConstantUsedForSizing;
3109 4 : state.dataSize->DataFractionUsedForSizing = 1.0;
3110 4 : SizingMethod = DataHVACGlobals::AutoCalculateSizing;
3111 : }
3112 :
3113 591 : TempSize = this->m_DesignCoolingCapacity;
3114 591 : state.dataSize->DataFlowUsedForSizing = this->m_MaxCoolAirVolFlow;
3115 591 : SizingString = "Nominal Cooling Capacity [W]";
3116 591 : bool errorsFound = false;
3117 1182 : CoolingCapacitySizer sizerCoolingCapacity;
3118 591 : sizerCoolingCapacity.overrideSizingString(SizingString);
3119 591 : sizerCoolingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
3120 591 : this->m_DesignCoolingCapacity = sizerCoolingCapacity.size(state, TempSize, errorsFound);
3121 591 : state.dataSize->DataConstantUsedForSizing = 0.0;
3122 591 : state.dataSize->DataFractionUsedForSizing = 0.0;
3123 591 : state.dataSize->DataFlowUsedForSizing = 0.0;
3124 : }
3125 :
3126 592 : if (this->m_HeatCoilExists) {
3127 301 : SizingMethod = DataHVACGlobals::HeatingCapacitySizing;
3128 :
3129 : // water coils must report their size to parent objects (or split out sizing routines for water coils so they can be call from here)
3130 301 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWater) {
3131 9 : WaterCoils::SimulateWaterCoilComponents(
3132 : state, this->m_HeatingCoilName, FirstHVACIteration, this->m_HeatingCoilIndex, QActual, this->m_FanOpMode, 1.0);
3133 9 : state.dataSize->DataConstantUsedForSizing =
3134 18 : WaterCoils::GetWaterCoilCapacity(state,
3135 18 : UtilityRoutines::MakeUPPERCase(DataHVACGlobals::cAllCoilTypes(this->m_HeatingCoilType_Num)),
3136 : this->m_HeatingCoilName,
3137 : ErrFound);
3138 9 : EqSizing.DesHeatingLoad = state.dataSize->DataConstantUsedForSizing;
3139 9 : state.dataSize->DataFractionUsedForSizing = 1.0;
3140 9 : SizingMethod = DataHVACGlobals::AutoCalculateSizing;
3141 9 : this->m_DesignHeatingCapacity = DataSizing::AutoSize;
3142 292 : } else if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHPSimple) {
3143 22 : WaterToAirHeatPumpSimple::SimWatertoAirHPSimple(state,
3144 : blankString,
3145 : this->m_HeatingCoilIndex,
3146 : this->m_HeatingCoilSensDemand,
3147 : dummy,
3148 : 0.0,
3149 : 0.0,
3150 : this->m_MaxONOFFCyclesperHour,
3151 : this->m_HPTimeConstant,
3152 : this->m_FanDelayTime,
3153 : DataHVACGlobals::CompressorOperation::Off,
3154 : 0.0,
3155 : FirstHVACIteration);
3156 44 : state.dataSize->DataConstantUsedForSizing = WaterToAirHeatPumpSimple::GetCoilCapacity(
3157 22 : state, DataHVACGlobals::cAllCoilTypes(this->m_HeatingCoilType_Num), this->m_HeatingCoilName, ErrFound);
3158 22 : EqSizing.DesHeatingLoad = state.dataSize->DataConstantUsedForSizing;
3159 22 : state.dataSize->DataFractionUsedForSizing = 1.0;
3160 22 : SizingMethod = DataHVACGlobals::AutoCalculateSizing;
3161 22 : this->m_DesignHeatingCapacity = DataSizing::AutoSize;
3162 22 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWaterToAirHPSimple)
3163 : // adjusted cooling coil capacity
3164 22 : WaterToAirHeatPumpSimple::SimWatertoAirHPSimple(state,
3165 : blankString,
3166 : this->m_CoolingCoilIndex,
3167 : this->m_CoolingCoilSensDemand,
3168 : this->m_CoolingCoilLatentDemand,
3169 : 0.0,
3170 : 0.0,
3171 : this->m_MaxONOFFCyclesperHour,
3172 : this->m_HPTimeConstant,
3173 : this->m_FanDelayTime,
3174 : DataHVACGlobals::CompressorOperation::Off,
3175 : 0.0,
3176 : FirstHVACIteration);
3177 44 : state.dataSize->DataConstantUsedForSizing = WaterToAirHeatPumpSimple::GetCoilCapacity(
3178 22 : state, DataHVACGlobals::cAllCoilTypes(this->m_CoolingCoilType_Num), this->m_CoolingCoilName, ErrFound);
3179 22 : EqSizing.DesCoolingLoad = state.dataSize->DataConstantUsedForSizing;
3180 22 : state.dataSize->DataFractionUsedForSizing = 1.0;
3181 22 : SizingMethod = DataHVACGlobals::AutoCalculateSizing;
3182 22 : this->m_DesignCoolingCapacity = DataSizing::AutoSize;
3183 : }
3184 :
3185 301 : TempSize = this->m_DesignHeatingCapacity;
3186 301 : SizingString = "Nominal Heating Capacity [W]";
3187 301 : if (state.dataSize->CurSysNum > 0)
3188 103 : state.dataAirLoop->AirLoopControlInfo(AirLoopNum).UnitarySysSimulating =
3189 : false; // set to false to allow calculation of parent object heating capacity
3190 301 : bool errorsFound = false;
3191 602 : HeatingCapacitySizer sizerHeatingCapacity;
3192 301 : sizerHeatingCapacity.overrideSizingString(SizingString);
3193 301 : sizerHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
3194 301 : TempSize = sizerHeatingCapacity.size(state, TempSize, errorsFound);
3195 301 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWaterToAirHPSimple) state.dataSize->DXCoolCap = TempSize;
3196 301 : if (state.dataSize->CurSysNum > 0) state.dataAirLoop->AirLoopControlInfo(AirLoopNum).UnitarySysSimulating = true;
3197 301 : this->m_DesignHeatingCapacity = TempSize;
3198 301 : state.dataSize->DataConstantUsedForSizing = 0.0;
3199 301 : state.dataSize->DataFractionUsedForSizing = 0.0;
3200 301 : state.dataSize->DataHeatSizeRatio = 1.0;
3201 : }
3202 :
3203 592 : if (!HardSizeNoDesRun && (EqSizing.Capacity && EqSizing.DesHeatingLoad > 0.0)) {
3204 : // vars EqSizing.DesHeatingLoad is already set earlier and supplemental heating coil should
3205 : // be sized to design value instead of user specified value if HardSizeNoDesRun is false
3206 47 : state.dataSize->UnitaryHeatCap = EqSizing.DesHeatingLoad;
3207 :
3208 : } else {
3209 545 : state.dataSize->UnitaryHeatCap = this->m_DesignHeatingCapacity;
3210 : }
3211 :
3212 592 : if (this->m_sysType == SysType::PackagedWSHP) {
3213 22 : PrintFlag = true;
3214 : }
3215 :
3216 592 : if ((this->m_HeatCoilExists || this->m_SuppCoilExists) && this->m_ControlType != UnitarySysCtrlType::CCMASHRAE) {
3217 301 : TempSize = this->DesignMaxOutletTemp;
3218 602 : MaxHeaterOutletTempSizer sizerMaxHeaterOutTemp;
3219 301 : if (this->m_sysType == SysType::PackagedHP || this->m_sysType == SysType::PackagedWSHP) {
3220 50 : PrintFlag = true;
3221 100 : std::string stringOverride = "Maximum Supply Air Temperature from Supplemental Heater [C]";
3222 50 : sizerMaxHeaterOutTemp.overrideSizingString(stringOverride);
3223 : }
3224 301 : sizerMaxHeaterOutTemp.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
3225 301 : this->DesignMaxOutletTemp = sizerMaxHeaterOutTemp.size(state, TempSize, ErrFound);
3226 : }
3227 :
3228 592 : if (this->m_sysType == SysType::PackagedHP || this->m_sysType == SysType::PackagedWSHP) {
3229 50 : PrintFlag = false;
3230 : }
3231 :
3232 592 : if (this->m_SuppCoilExists) {
3233 90 : switch (this->m_sysType) {
3234 50 : case SysType::PackagedWSHP:
3235 : case SysType::PackagedHP:
3236 50 : if (this->m_HVACSizingIndex <= 0) EqSizing.HeatingCapacity = false; // ensure PTHP supplemental heating coil sizes to load
3237 50 : break;
3238 40 : default:
3239 40 : break;
3240 : }
3241 90 : SizingMethod = DataHVACGlobals::HeatingCapacitySizing;
3242 :
3243 90 : TempSize = this->m_DesignSuppHeatingCapacity;
3244 90 : SizingString = "Supplemental Heating Coil Nominal Capacity [W]";
3245 90 : if (TempSize == DataSizing::AutoSize) {
3246 72 : IsAutoSize = true;
3247 72 : if (this->m_sysType == SysType::Unitary) PrintFlag = false;
3248 72 : bool errorsFound = false;
3249 144 : HeatingCapacitySizer sizerHeatingCapacity;
3250 72 : sizerHeatingCapacity.overrideSizingString(SizingString);
3251 72 : sizerHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
3252 72 : this->m_DesignSuppHeatingCapacity = sizerHeatingCapacity.size(state, TempSize, errorsFound);
3253 : }
3254 : // logic here isn't accurate. Replicating temporarily to minimize diffs in AutoSizingLibrary refactor
3255 90 : TempSize = this->m_DesignSuppHeatingCapacity;
3256 :
3257 90 : if (this->m_Humidistat && this->m_DehumidControlType_Num == DehumCtrlType::CoolReheat && IsAutoSize) {
3258 2 : state.dataSize->DataConstantUsedForSizing = max(this->m_DesignSuppHeatingCapacity, this->m_DesignCoolingCapacity);
3259 2 : state.dataSize->DataFractionUsedForSizing = 1.0;
3260 2 : SizingMethod = DataHVACGlobals::AutoCalculateSizing;
3261 2 : TempSize = DataSizing::AutoSize;
3262 : // pass design size to supplemental heater
3263 2 : state.dataSize->SuppHeatCap = max(this->m_DesignCoolingCapacity, this->m_DesignHeatingCapacity);
3264 88 : } else if (this->m_Humidistat && this->m_DehumidControlType_Num == DehumCtrlType::CoolReheat) {
3265 4 : state.dataSize->SuppHeatCap = max(this->m_DesignCoolingCapacity, this->m_DesignHeatingCapacity);
3266 : } else {
3267 84 : if (state.dataSize->CurZoneEqNum > 0) {
3268 51 : state.dataSize->SuppHeatCap = saveRawHeatingCapacity;
3269 : } else {
3270 33 : state.dataSize->SuppHeatCap = this->m_DesignHeatingCapacity;
3271 : }
3272 : }
3273 :
3274 180 : if (this->m_OKToPrintSizing &&
3275 140 : (this->m_sysType == SysType::Unitary || this->m_sysType == SysType::CoilCoolingDX || this->m_sysType == SysType::CoilCoolingWater))
3276 40 : PrintFlag = true;
3277 90 : state.dataSize->DataCoilIsSuppHeater = true;
3278 90 : bool errorsFound = false;
3279 180 : HeatingCapacitySizer sizerHeatingCapacity;
3280 90 : sizerHeatingCapacity.overrideSizingString(SizingString);
3281 90 : sizerHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
3282 90 : this->m_DesignSuppHeatingCapacity = sizerHeatingCapacity.size(state, TempSize, errorsFound);
3283 90 : IsAutoSize = false;
3284 90 : state.dataSize->DataConstantUsedForSizing = 0.0;
3285 90 : state.dataSize->DataFractionUsedForSizing = 0.0;
3286 90 : state.dataSize->DataCoilIsSuppHeater = false;
3287 : }
3288 :
3289 : // register plant flow rate. Not sure this has ever been tested.
3290 592 : if (this->m_HeatRecActive) {
3291 0 : PlantUtilities::RegisterPlantCompDesignFlow(state, this->m_HeatRecoveryInletNodeNum, this->m_DesignHRWaterVolumeFlow);
3292 : }
3293 :
3294 : // Set flow rate for unitary system with no fan
3295 592 : if (state.dataSize->CurOASysNum == 0 && state.dataSize->CurZoneEqNum == 0 && this->m_DesignFanVolFlowRate <= 0.0) {
3296 0 : SystemFlow = (AirLoopNum > 0) ? state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).DesignVolFlowRate : 0;
3297 0 : if (SystemFlow > 0.0) {
3298 0 : this->m_DesignFanVolFlowRate = SystemFlow;
3299 : } else {
3300 0 : this->m_DesignFanVolFlowRate = max(this->m_MaxCoolAirVolFlow, this->m_MaxHeatAirVolFlow);
3301 : }
3302 0 : this->m_DesignMassFlowRate = this->m_DesignFanVolFlowRate * state.dataEnvrn->StdRhoAir;
3303 : }
3304 :
3305 : // Moved from InitLoadBasedControl
3306 : // Find the number of zones (zone Inlet Nodes) attached to an air loop from the air loop number
3307 592 : if (this->m_AirLoopEquipment && this->m_ControlType != UnitarySysCtrlType::Setpoint) {
3308 96 : if (allocated(state.dataAirLoop->AirToZoneNodeInfo))
3309 96 : NumAirLoopZones =
3310 96 : state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesCooled + state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesHeated;
3311 96 : if (allocated(state.dataAirLoop->AirToZoneNodeInfo)) {
3312 96 : state.dataUnitarySystems->initLoadBasedControlFlowFracFlagReady = true;
3313 210 : for (ZoneInSysIndex = 1; ZoneInSysIndex <= NumAirLoopZones; ++ZoneInSysIndex) {
3314 : // zone inlet nodes for cooling
3315 114 : if (state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesCooled > 0) {
3316 114 : if (state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).TermUnitCoolInletNodes(ZoneInSysIndex) == -999) {
3317 : // the data structure for the zones inlet nodes has not been filled
3318 0 : state.dataUnitarySystems->initLoadBasedControlFlowFracFlagReady = false;
3319 : }
3320 : }
3321 : // zone inlet nodes for heating
3322 114 : if (state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesHeated > 0) {
3323 0 : if (state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).TermUnitHeatInletNodes(ZoneInSysIndex) == -999) {
3324 : // the data structure for the zones inlet nodes has not been filled
3325 0 : state.dataUnitarySystems->initLoadBasedControlFlowFracFlagReady = false;
3326 : }
3327 : }
3328 : }
3329 : }
3330 192 : if (allocated(state.dataAirLoop->AirToZoneNodeInfo) && state.dataUnitarySystems->initLoadBasedControlFlowFracFlagReady) {
3331 96 : SumOfMassFlowRateMax = 0.0; // initialize the sum of the maximum flows
3332 210 : for (ZoneInSysIndex = 1; ZoneInSysIndex <= NumAirLoopZones; ++ZoneInSysIndex) {
3333 114 : ZoneInletNodeNum = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).TermUnitCoolInletNodes(ZoneInSysIndex);
3334 114 : SumOfMassFlowRateMax += state.dataLoopNodes->Node(ZoneInletNodeNum).MassFlowRateMax;
3335 114 : if (state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).CoolCtrlZoneNums(ZoneInSysIndex) == this->ControlZoneNum) {
3336 96 : state.dataUnitarySystems->initLoadBasedControlCntrlZoneTerminalUnitMassFlowRateMax =
3337 96 : state.dataLoopNodes->Node(ZoneInletNodeNum).MassFlowRateMax;
3338 : }
3339 : }
3340 96 : if (SumOfMassFlowRateMax != 0.0) {
3341 96 : if (state.dataUnitarySystems->initLoadBasedControlCntrlZoneTerminalUnitMassFlowRateMax >= DataHVACGlobals::SmallAirVolFlow) {
3342 96 : this->ControlZoneMassFlowFrac =
3343 96 : state.dataUnitarySystems->initLoadBasedControlCntrlZoneTerminalUnitMassFlowRateMax / SumOfMassFlowRateMax;
3344 : } else {
3345 0 : ShowSevereError(state, this->UnitType + " = " + this->Name);
3346 0 : ShowContinueError(state, " The Fraction of Supply Air Flow That Goes Through the Controlling Zone is set to 1.");
3347 0 : this->ControlZoneMassFlowFrac = 1.0;
3348 : }
3349 96 : this->m_SmallLoadTolerance = 5.0 / this->ControlZoneMassFlowFrac; // adjust 5W load tolerance by control zone fraction
3350 192 : BaseSizer::reportSizerOutput(state,
3351 : this->UnitType,
3352 : this->Name,
3353 : "Fraction of Supply Air Flow That Goes Through the Controlling Zone",
3354 96 : this->ControlZoneMassFlowFrac);
3355 : }
3356 : }
3357 : } else {
3358 496 : this->ControlZoneMassFlowFrac = 1.0;
3359 : }
3360 :
3361 : // should only report for those that allow SZVAV inputs, e.g., control type == CCMASHRAE
3362 592 : PrintFlag = true;
3363 :
3364 592 : if (this->m_ControlType == UnitarySysCtrlType::CCMASHRAE) {
3365 0 : SizingDesRunThisSys = false;
3366 0 : state.dataSize->DataZoneUsedForSizing = this->ControlZoneNum;
3367 0 : CheckThisZoneForSizing(state, state.dataSize->DataZoneUsedForSizing, SizingDesRunThisSys);
3368 :
3369 0 : capacityMultiplier = 0.5; // one-half of design zone load
3370 0 : if (SizingDesRunThisSys) {
3371 0 : state.dataSize->DataCapacityUsedForSizing = state.dataSize->FinalZoneSizing(this->ControlZoneNum).DesCoolLoad * capacityMultiplier;
3372 : } else {
3373 0 : state.dataSize->DataCapacityUsedForSizing = this->m_DesignCoolingCapacity * capacityMultiplier;
3374 : }
3375 0 : state.dataSize->DataCapacityUsedForSizing /= this->ControlZoneMassFlowFrac;
3376 0 : state.dataSize->DataFlowUsedForSizing = this->m_MaxNoCoolHeatAirVolFlow;
3377 0 : ASHRAEMinSATCoolingSizer sizerASHRAEMinSATCooling;
3378 0 : std::string stringOverride = "Minimum Supply Air Temperature [C]";
3379 0 : if (state.dataGlobal->isEpJSON) stringOverride = "minimum_supply_air_temperature [C]";
3380 0 : sizerASHRAEMinSATCooling.overrideSizingString(stringOverride);
3381 0 : sizerASHRAEMinSATCooling.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
3382 0 : this->DesignMinOutletTemp = sizerASHRAEMinSATCooling.size(state, this->DesignMinOutletTemp, ErrFound);
3383 :
3384 0 : if (SizingDesRunThisSys) {
3385 0 : state.dataSize->DataCapacityUsedForSizing = state.dataSize->FinalZoneSizing(this->ControlZoneNum).DesHeatLoad * capacityMultiplier;
3386 : } else {
3387 0 : state.dataSize->DataCapacityUsedForSizing = this->m_DesignHeatingCapacity * capacityMultiplier;
3388 : }
3389 0 : state.dataSize->DataCapacityUsedForSizing /= this->ControlZoneMassFlowFrac;
3390 0 : state.dataSize->DataFlowUsedForSizing = this->m_MaxNoCoolHeatAirVolFlow;
3391 0 : ASHRAEMaxSATHeatingSizer sizerASHRAEMaxSATHeating;
3392 0 : stringOverride = "Maximum Supply Air Temperature [C]";
3393 0 : if (state.dataGlobal->isEpJSON) stringOverride = "maximum_supply_air_temperature [C]";
3394 0 : sizerASHRAEMaxSATHeating.overrideSizingString(stringOverride);
3395 0 : sizerASHRAEMaxSATHeating.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
3396 0 : this->DesignMaxOutletTemp = sizerASHRAEMaxSATHeating.size(state, this->DesignMaxOutletTemp, ErrFound);
3397 :
3398 0 : state.dataSize->DataCapacityUsedForSizing = 0.0; // reset so other routines don't use this inadvertently
3399 0 : state.dataSize->DataFlowUsedForSizing = 0.0;
3400 0 : state.dataSize->DataZoneUsedForSizing = 0;
3401 :
3402 : // check that MaxNoCoolHeatAirVolFlow is less than both MaxCoolAirVolFlow and MaxHeatAirVolFlow
3403 0 : if (this->m_ControlType == UnitarySysCtrlType::CCMASHRAE) {
3404 0 : if (this->m_MaxNoCoolHeatAirVolFlow >= this->m_MaxCoolAirVolFlow || this->m_MaxNoCoolHeatAirVolFlow >= this->m_MaxHeatAirVolFlow) {
3405 0 : ShowSevereError(state, this->UnitType + " = " + this->Name);
3406 0 : ShowContinueError(
3407 : state,
3408 : " For SingleZoneVAV control the No Load Supply Air Flow Rate must be less than both the cooling and heating supply "
3409 : "air flow rates.");
3410 0 : this->m_MaxNoCoolHeatAirVolFlow = min(this->m_MaxCoolAirVolFlow, this->m_MaxHeatAirVolFlow) - 0.01;
3411 0 : ShowContinueError(
3412 : state,
3413 0 : format(" The SingleZoneVAV control No Load Supply Air Flow Rate is reset to {:.5T} and the simulation continues.",
3414 0 : this->m_MaxNoCoolHeatAirVolFlow));
3415 : }
3416 : }
3417 : }
3418 :
3419 592 : state.dataUnitarySystems->CoolingLoad = TempCoolingLoad;
3420 592 : state.dataUnitarySystems->HeatingLoad = TempHeatingLoad;
3421 : // if (++NumUnitarySystemsSized == NumUnitarySystem)
3422 : // UnitarySystemNumericFields.deallocate(); // remove temporary array for field names at end of sizing
3423 592 : } // namespace UnitarySystems
3424 :
3425 1184 : void UnitarySys::processInputSpec(EnergyPlusData &state,
3426 : const UnitarySysInputSpec &input_data,
3427 : int sysNum,
3428 : bool &errorsFound,
3429 : bool const ZoneEquipment,
3430 : int const ZoneOAUnitNum)
3431 : {
3432 :
3433 : static constexpr std::string_view unitarySysHeatPumpPerformanceObjectType("UnitarySystemPerformance:Multispeed");
3434 :
3435 1184 : std::string const &cCurrentModuleObject = input_data.system_type;
3436 : DataLoopNode::ConnectionObjectType objType = static_cast<DataLoopNode::ConnectionObjectType>(
3437 1184 : getEnumerationValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, UtilityRoutines::MakeUPPERCase(input_data.system_type)));
3438 1184 : std::string const &thisObjectName = input_data.name;
3439 1184 : this->Name = UtilityRoutines::MakeUPPERCase(thisObjectName);
3440 1184 : sysNum = getUnitarySystemIndex(state, thisObjectName);
3441 1184 : this->m_UnitarySysNum = sysNum;
3442 :
3443 1184 : if (ZoneEquipment) {
3444 425 : this->m_IsZoneEquipment = true;
3445 : }
3446 1184 : if (state.dataUnitarySystems->getInputOnceFlag) {
3447 592 : this->AirInNode = NodeInputManager::GetOnlySingleNode(state,
3448 : input_data.air_inlet_node_name,
3449 : errorsFound,
3450 : objType,
3451 : thisObjectName,
3452 : DataLoopNode::NodeFluidType::Air,
3453 : DataLoopNode::ConnectionType::Inlet,
3454 : NodeInputManager::CompFluidStream::Primary,
3455 592 : DataLoopNode::ObjectIsParent);
3456 : } else {
3457 592 : this->AirInNode = UtilityRoutines::FindItemInList(input_data.air_inlet_node_name, state.dataLoopNodes->NodeID);
3458 : }
3459 :
3460 1184 : if (state.dataUnitarySystems->getInputOnceFlag) {
3461 592 : this->AirOutNode = NodeInputManager::GetOnlySingleNode(state,
3462 : input_data.air_outlet_node_name,
3463 : errorsFound,
3464 : objType,
3465 : thisObjectName,
3466 : DataLoopNode::NodeFluidType::Air,
3467 : DataLoopNode::ConnectionType::Outlet,
3468 : NodeInputManager::CompFluidStream::Primary,
3469 592 : DataLoopNode::ObjectIsParent);
3470 : } else {
3471 592 : this->AirOutNode = UtilityRoutines::FindItemInList(input_data.air_outlet_node_name, state.dataLoopNodes->NodeID);
3472 : }
3473 :
3474 : // need to read in all information needed to SetupOutputVariable in setupAllOutputVars
3475 : // as soon as all systems are read in, regardless if all information is available, reports will be set up.
3476 : // make sure we have all the information needed to process reports (see IF blocks in setupAllOutputVars).
3477 : // all coil types, which comps exist, control type, heat recovery active, cooling coil index.
3478 1184 : bool errFlag = false;
3479 1184 : bool PrintMessage = false;
3480 :
3481 1184 : if (!input_data.design_specification_multispeed_object_type.empty() && !input_data.design_specification_multispeed_object_name.empty()) {
3482 110 : this->m_DesignSpecMultispeedHPType = input_data.design_specification_multispeed_object_type;
3483 110 : this->m_DesignSpecMultispeedHPName = input_data.design_specification_multispeed_object_name;
3484 110 : int designSpecType_Num = 1;
3485 :
3486 220 : DesignSpecMSHP thisDesignSpec;
3487 110 : this->m_CompPointerMSHP = thisDesignSpec.factory(state, designSpecType_Num, this->m_DesignSpecMultispeedHPName);
3488 110 : this->m_DesignSpecMSHPIndex = getDesignSpecMSHPIndex(state, this->m_DesignSpecMultispeedHPName);
3489 : }
3490 :
3491 : // these are needed for call from GetOASysNumHeat(Cool)ingCoils
3492 1184 : this->m_HeatingCoilName = input_data.heating_coil_name;
3493 1184 : this->m_HeatingCoilTypeName = input_data.heating_coil_object_type;
3494 1184 : if (!this->m_HeatingCoilTypeName.empty()) {
3495 602 : this->m_HeatCoilExists = true;
3496 : }
3497 1184 : if (this->m_HeatCoilExists && this->m_HeatingCoilType_Num == 0) {
3498 301 : if (UtilityRoutines::SameString(this->m_HeatingCoilTypeName, "Coil:Heating:DX:VariableSpeed")) {
3499 3 : this->m_HeatingCoilType_Num = DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed;
3500 298 : } else if (UtilityRoutines::SameString(this->m_HeatingCoilTypeName, "Coil:Heating:DX:MultiSpeed")) {
3501 11 : this->m_HeatingCoilType_Num = DataHVACGlobals::CoilDX_MultiSpeedHeating;
3502 287 : } else if (UtilityRoutines::SameString(this->m_HeatingCoilTypeName, "Coil:Heating:Water")) {
3503 9 : this->m_HeatingCoilType_Num = DataHVACGlobals::Coil_HeatingWater;
3504 9 : if (this->m_DesignSpecMSHPIndex > -1) {
3505 1 : this->m_NumOfSpeedHeating = this->m_CompPointerMSHP->numOfSpeedHeating;
3506 1 : if (this->m_NumOfSpeedHeating > 1) {
3507 1 : this->m_MultiSpeedHeatingCoil = true;
3508 1 : this->m_MultiOrVarSpeedHeatCoil = true;
3509 : }
3510 : }
3511 278 : } else if (UtilityRoutines::SameString(this->m_HeatingCoilTypeName, "Coil:Heating:Steam")) {
3512 2 : this->m_HeatingCoilType_Num = DataHVACGlobals::Coil_HeatingSteam;
3513 276 : } else if (UtilityRoutines::SameString(this->m_HeatingCoilTypeName, "Coil:Heating:WaterToAirHeatPump:EquationFit")) {
3514 22 : this->m_HeatingCoilType_Num = DataHVACGlobals::Coil_HeatingWaterToAirHPSimple;
3515 254 : } else if (UtilityRoutines::SameString(this->m_HeatingCoilTypeName, "Coil:Heating:WaterToAirHeatPump:ParameterEstimation")) {
3516 5 : this->m_HeatingCoilType_Num = DataHVACGlobals::Coil_HeatingWaterToAirHP;
3517 249 : } else if (UtilityRoutines::SameString(this->m_HeatingCoilTypeName, "Coil:Heating:WaterToAirHeatPump:VariableSpeedEquationFit")) {
3518 3 : this->m_HeatingCoilType_Num = DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit;
3519 246 : } else if (UtilityRoutines::SameString(this->m_HeatingCoilTypeName, "Coil:Heating:Electric:MultiStage")) {
3520 0 : this->m_HeatingCoilType_Num = DataHVACGlobals::Coil_HeatingElectric_MultiStage;
3521 246 : } else if (UtilityRoutines::SameString(this->m_HeatingCoilTypeName, "Coil:Heating:Gas:MultiStage")) {
3522 0 : this->m_HeatingCoilType_Num = DataHVACGlobals::Coil_HeatingGas_MultiStage;
3523 662 : } else if (UtilityRoutines::SameString(this->m_HeatingCoilTypeName, "Coil:Heating:Fuel") ||
3524 533 : UtilityRoutines::SameString(this->m_HeatingCoilTypeName, "Coil:Heating:Electric") ||
3525 287 : UtilityRoutines::SameString(this->m_HeatingCoilTypeName, "Coil:Heating:Desuperheater")) {
3526 205 : this->m_HeatingCoilType_Num =
3527 205 : HeatingCoils::GetHeatingCoilTypeNum(state, this->m_HeatingCoilTypeName, this->m_HeatingCoilName, errFlag);
3528 41 : } else if (UtilityRoutines::SameString(this->m_HeatingCoilTypeName, "Coil:UserDefined")) {
3529 0 : this->m_HeatingCoilType_Num = DataHVACGlobals::Coil_UserDefined;
3530 41 : } else if (this->m_HeatCoilExists) {
3531 41 : this->m_HeatingCoilType_Num =
3532 82 : DXCoils::GetCoilTypeNum(state, this->m_HeatingCoilTypeName, this->m_HeatingCoilName, errFlag, PrintMessage);
3533 : }
3534 :
3535 591 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedHeating ||
3536 580 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingElectric_MultiStage ||
3537 290 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingGas_MultiStage) {
3538 11 : this->m_MultiSpeedHeatingCoil = true;
3539 577 : } else if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit ||
3540 287 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed) {
3541 6 : this->m_VarSpeedHeatingCoil = true;
3542 : }
3543 : }
3544 :
3545 1184 : this->m_CoolingCoilName = input_data.cooling_coil_name;
3546 1184 : if (!input_data.cooling_coil_object_type.empty()) { // not required field
3547 1182 : this->m_CoolCoilExists = true;
3548 : }
3549 : // Find the type of coil. do not print message since this may not be the correct coil type.
3550 1184 : errFlag = false;
3551 1184 : if (this->m_CoolCoilExists && this->m_CoolingCoilType_Num == 0) {
3552 591 : if (UtilityRoutines::SameString(input_data.cooling_coil_object_type, "Coil:Cooling:DX:VariableSpeed")) {
3553 9 : this->m_CoolingCoilType_Num = DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed;
3554 582 : } else if (UtilityRoutines::SameString(input_data.cooling_coil_object_type, "Coil:Cooling:DX:MultiSpeed")) {
3555 37 : this->m_CoolingCoilType_Num = DataHVACGlobals::CoilDX_MultiSpeedCooling;
3556 545 : } else if (UtilityRoutines::SameString(input_data.cooling_coil_object_type, "Coil:Cooling:Water")) {
3557 5 : this->m_IsDXCoil = false;
3558 5 : this->m_CoolingCoilType_Num = DataHVACGlobals::Coil_CoolingWater;
3559 5 : this->m_CoolingCoilType_Num = DataHVACGlobals::Coil_CoolingWater;
3560 5 : if (this->m_DesignSpecMSHPIndex > -1) {
3561 1 : this->m_NumOfSpeedCooling = this->m_CompPointerMSHP->numOfSpeedCooling;
3562 1 : if (this->m_NumOfSpeedCooling > 1) {
3563 1 : this->m_DiscreteSpeedCoolingCoil = true;
3564 1 : this->m_MultiOrVarSpeedCoolCoil = true;
3565 : }
3566 : }
3567 540 : } else if (UtilityRoutines::SameString(input_data.cooling_coil_object_type, "Coil:Cooling:Water:DetailedGeometry")) {
3568 0 : this->m_IsDXCoil = false;
3569 0 : this->m_CoolingCoilType_Num = DataHVACGlobals::Coil_CoolingWaterDetailed;
3570 0 : if (this->m_DesignSpecMSHPIndex > -1) {
3571 0 : this->m_NumOfSpeedCooling = this->m_CompPointerMSHP->numOfSpeedCooling;
3572 0 : if (this->m_NumOfSpeedCooling > 1) {
3573 0 : this->m_DiscreteSpeedCoolingCoil = true;
3574 0 : this->m_MultiOrVarSpeedCoolCoil = true;
3575 : }
3576 : }
3577 540 : } else if (UtilityRoutines::SameString(input_data.cooling_coil_object_type, "Coil:Cooling:DX:TwoStageWithHumidityControlMode")) {
3578 9 : this->m_CoolingCoilType_Num = DataHVACGlobals::CoilDX_CoolingTwoStageWHumControl;
3579 531 : } else if (UtilityRoutines::SameString(input_data.cooling_coil_object_type, "CoilSystem:Cooling:DX:HeatExchangerAssisted")) {
3580 2 : this->m_CoolingCoilType_Num = HVACHXAssistedCoolingCoil::GetCoilGroupTypeNum(
3581 : state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, errFlag, PrintMessage);
3582 529 : } else if (UtilityRoutines::SameString(input_data.cooling_coil_object_type, "CoilSystem:Cooling:Water:HeatExchangerAssisted")) {
3583 0 : this->m_IsDXCoil = false;
3584 0 : this->m_CoolingCoilType_Num = HVACHXAssistedCoolingCoil::GetCoilGroupTypeNum(
3585 : state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, errFlag, PrintMessage);
3586 529 : } else if (UtilityRoutines::SameString(input_data.cooling_coil_object_type, "Coil:Cooling:WaterToAirHeatPump:EquationFit")) {
3587 22 : this->m_CoolingCoilType_Num = DataHVACGlobals::Coil_CoolingWaterToAirHPSimple;
3588 507 : } else if (UtilityRoutines::SameString(input_data.cooling_coil_object_type, "Coil:Cooling:WaterToAirHeatPump:ParameterEstimation")) {
3589 5 : this->m_CoolingCoilType_Num = DataHVACGlobals::Coil_CoolingWaterToAirHP;
3590 502 : } else if (UtilityRoutines::SameString(input_data.cooling_coil_object_type, "Coil:Cooling:WaterToAirHeatPump:VariableSpeedEquationFit")) {
3591 3 : this->m_CoolingCoilType_Num = DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit;
3592 499 : } else if (UtilityRoutines::SameString(input_data.cooling_coil_object_type, "Coil:Cooling:DX:SingleSpeed")) {
3593 378 : this->m_CoolingCoilType_Num = DataHVACGlobals::CoilDX_CoolingSingleSpeed;
3594 121 : } else if (UtilityRoutines::SameString(input_data.cooling_coil_object_type, "Coil:Cooling:DX:TwoSpeed")) {
3595 67 : this->m_CoolingCoilType_Num = DataHVACGlobals::CoilDX_CoolingTwoSpeed;
3596 54 : } else if (UtilityRoutines::SameString(input_data.cooling_coil_object_type, "Coil:UserDefined")) {
3597 0 : this->m_IsDXCoil = false;
3598 0 : this->m_CoolingCoilType_Num = DataHVACGlobals::Coil_UserDefined;
3599 54 : } else if (UtilityRoutines::SameString(input_data.cooling_coil_object_type, "Coil:Cooling:DX:SingleSpeed:ThermalStorage")) {
3600 4 : this->m_CoolingCoilType_Num = DataHVACGlobals::CoilDX_PackagedThermalStorageCooling;
3601 50 : } else if (UtilityRoutines::SameString(input_data.cooling_coil_object_type, "Coil:Cooling:DX")) { // CoilCoolingDX
3602 50 : this->m_CoolingCoilType_Num = DataHVACGlobals::CoilDX_Cooling;
3603 50 : this->m_CoolingCoilIndex = CoilCoolingDX::factory(state, this->m_CoolingCoilName);
3604 50 : if (this->m_CoolingCoilIndex == -1) {
3605 0 : ShowFatalError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
3606 : } else {
3607 : // set variable speed coil flag as necessary
3608 50 : auto &newCoil = state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex];
3609 50 : this->m_NumOfSpeedCooling = (int)newCoil.performance.normalMode.speeds.size();
3610 50 : if (this->m_NumOfSpeedCooling > 1) {
3611 33 : if (newCoil.performance.capControlMethod == CoilCoolingDXCurveFitPerformance::CapControlMethod::DISCRETE) {
3612 32 : this->m_DiscreteSpeedCoolingCoil = true;
3613 1 : } else if (newCoil.performance.capControlMethod == CoilCoolingDXCurveFitPerformance::CapControlMethod::CONTINUOUS) {
3614 1 : this->m_ContSpeedCoolingCoil = true;
3615 : }
3616 33 : this->m_MultiOrVarSpeedCoolCoil = true;
3617 : }
3618 : }
3619 : }
3620 :
3621 591 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedCooling) {
3622 37 : this->m_DiscreteSpeedCoolingCoil = true;
3623 1105 : } else if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit ||
3624 551 : this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) {
3625 12 : this->m_ContSpeedCoolingCoil = true;
3626 : }
3627 : }
3628 :
3629 1184 : if (!input_data.supplemental_heating_coil_object_type.empty()) {
3630 180 : this->m_SuppCoilExists = true;
3631 : }
3632 :
3633 1184 : if (!input_data.supply_fan_object_type.empty() && !input_data.supply_fan_name.empty()) {
3634 600 : this->m_FanExists = true;
3635 : }
3636 :
3637 : constexpr static std::array<std::string_view, static_cast<int>(UnitarySysCtrlType::Num)> UnitarySysCtrlTypeNamesUC = {
3638 : "NONE", "LOAD", "SETPOINT", "SINGLEZONEVAV"};
3639 1184 : this->m_ControlType =
3640 2368 : static_cast<UnitarySysCtrlType>(getEnumerationValue(UnitarySysCtrlTypeNamesUC, UtilityRoutines::MakeUPPERCase(input_data.control_type)));
3641 1184 : if (this->m_ControlType == UnitarySysCtrlType::CCMASHRAE) {
3642 0 : this->m_ValidASHRAECoolCoil = true;
3643 0 : this->m_ValidASHRAEHeatCoil = true;
3644 : }
3645 :
3646 1184 : this->m_DesignHRWaterVolumeFlow = input_data.design_heat_recovery_water_flow_rate;
3647 1184 : if (this->m_DesignHRWaterVolumeFlow > 0.0) {
3648 0 : this->m_HeatRecActive = true;
3649 : }
3650 :
3651 1184 : errFlag = false;
3652 1184 : if (!input_data.oa_mixer_type.empty() && !input_data.oa_mixer_name.empty()) {
3653 334 : this->OAMixerIndex = MixedAir::GetOAMixerIndex(state, input_data.oa_mixer_name);
3654 334 : ValidateComponent(state, input_data.oa_mixer_type, input_data.oa_mixer_name, errFlag, cCurrentModuleObject);
3655 334 : if (errFlag) {
3656 0 : ShowContinueError(state, "specified in " + cCurrentModuleObject + " = \"" + input_data.oa_mixer_name + "\".");
3657 0 : errorsFound = true;
3658 : } else {
3659 334 : this->OAMixerExists = true;
3660 334 : bool errFlag = false;
3661 : // OANodeNums = outside air mixer node numbers, OANodeNums(4) = outside air mixer mixed air node
3662 668 : Array1D_int OANodeNums = MixedAir::GetOAMixerNodeNumbers(state, input_data.oa_mixer_name, errFlag);
3663 334 : if (errFlag) {
3664 0 : ShowContinueError(state, "that was specified in " + cCurrentModuleObject + " = " + input_data.oa_mixer_name);
3665 0 : ShowContinueError(state, "..OutdoorAir:Mixer is required. Enter an OutdoorAir:Mixer object with this name.");
3666 0 : errorsFound = true;
3667 : } else {
3668 334 : this->m_OAMixerNodes[0] = OANodeNums(1); // inlet
3669 334 : this->m_OAMixerNodes[1] = OANodeNums(2); // relief
3670 334 : this->m_OAMixerNodes[2] = OANodeNums(3); // return
3671 334 : this->m_OAMixerNodes[3] = OANodeNums(4); // mixed
3672 : }
3673 : }
3674 1700 : } else if ((input_data.oa_mixer_type.empty() && !input_data.oa_mixer_name.empty()) ||
3675 850 : (!input_data.oa_mixer_type.empty() && input_data.oa_mixer_name.empty())) {
3676 0 : ShowSevereError(state, "Missing one of " + cCurrentModuleObject + " Outdoor Air Mixer inputs.");
3677 0 : ShowContinueError(state, "..OutdoorAir:Mixer type = " + input_data.oa_mixer_type);
3678 0 : ShowContinueError(state, "..OutdoorAir:Mixer name = " + input_data.oa_mixer_name);
3679 0 : errorsFound = true;
3680 : }
3681 1184 : this->m_HeatConvTol = input_data.heat_conv_tol;
3682 1184 : this->m_CoolConvTol = input_data.cool_conv_tol;
3683 :
3684 : // Early calls to ATMixer don't have enough info to pass GetInput. Need to get the data next time through.
3685 1184 : if (sysNum == -1 || !state.dataZoneEquip->ZoneEquipInputsFilled) {
3686 1184 : return;
3687 : }
3688 :
3689 592 : this->m_CoolOutAirVolFlow = input_data.cooling_oa_flow_rate;
3690 592 : this->m_HeatOutAirVolFlow = input_data.heating_oa_flow_rate;
3691 592 : this->m_NoCoolHeatOutAirVolFlow = input_data.no_load_oa_flow_rate;
3692 :
3693 592 : if (ZoneEquipment) {
3694 198 : this->m_OKToPrintSizing = true;
3695 : }
3696 :
3697 592 : this->m_IterationMode.resize(3);
3698 :
3699 1184 : std::string loc_m_CoolingSAFMethod = input_data.cooling_supply_air_flow_rate_method;
3700 592 : Real64 loc_m_CoolingSAFMethod_SAFlow = input_data.cooling_supply_air_flow_rate;
3701 592 : Real64 loc_m_CoolingSAFMethod_SAFlowPerFloorArea = input_data.cooling_supply_air_flow_rate_per_floor_area;
3702 592 : Real64 loc_m_CoolingSAFMethod_FracOfAutosizedCoolingSAFlow = input_data.cooling_fraction_of_autosized_cooling_supply_air_flow_rate;
3703 592 : Real64 loc_m_CoolingSAFMethod_FlowPerCoolingCapacity = input_data.cooling_supply_air_flow_rate_per_unit_of_capacity;
3704 1184 : std::string loc_m_HeatingSAFMethod = input_data.heating_supply_air_flow_rate_method;
3705 592 : Real64 loc_m_HeatingSAFMethod_SAFlow = input_data.heating_supply_air_flow_rate;
3706 592 : Real64 loc_m_HeatingSAFMethod_SAFlowPerFloorArea = input_data.heating_supply_air_flow_rate_per_floor_area;
3707 592 : Real64 loc_m_HeatingSAFMethod_FracOfAutosizedHeatingSAFlow = input_data.heating_fraction_of_autosized_heating_supply_air_flow_rate;
3708 592 : Real64 loc_m_HeatingSAFMethod_FlowPerHeatingCapacity = input_data.heating_supply_air_flow_rate_per_unit_of_capacity;
3709 1184 : std::string loc_m_NoCoolHeatSAFMethod = input_data.no_load_supply_air_flow_rate_method;
3710 592 : Real64 loc_m_NoCoolHeatSAFMethod_SAFlow = input_data.no_load_supply_air_flow_rate;
3711 592 : Real64 loc_m_NoCoolHeatSAFMethod_SAFlowPerFloorArea = input_data.no_load_supply_air_flow_rate_per_floor_area;
3712 592 : Real64 loc_m_NoCoolHeatSAFMethod_FracOfAutosizedCoolingSAFlow = input_data.no_load_fraction_of_autosized_cooling_supply_air_flow_rate;
3713 592 : Real64 loc_m_NoCoolHeatSAFMethod_FracOfAutosizedHeatingSAFlow = input_data.no_load_fraction_of_autosized_heating_supply_air_flow_rate;
3714 592 : Real64 loc_m_NoCoolHeatSAFMethod_FlowPerCoolingCapacity =
3715 : input_data.no_load_supply_air_flow_rate_per_unit_of_capacity_during_cooling_operation;
3716 592 : Real64 loc_m_NoCoolHeatSAFMethod_FlowPerHeatingCapacity =
3717 : input_data.no_load_supply_air_flow_rate_per_unit_of_capacity_during_heating_operation;
3718 :
3719 592 : int FanInletNode = 0;
3720 592 : int FanOutletNode = 0;
3721 592 : Real64 FanVolFlowRate = 0.0;
3722 592 : int CoolingCoilInletNode = 0;
3723 592 : int CoolingCoilOutletNode = 0;
3724 592 : int HeatingCoilInletNode = 0;
3725 592 : int HeatingCoilOutletNode = 0;
3726 592 : int SupHeatCoilInletNode = 0;
3727 592 : int SupHeatCoilOutletNode = 0;
3728 :
3729 592 : bool isNotOK = false;
3730 :
3731 592 : if (!input_data.availability_schedule_name.empty()) {
3732 517 : this->m_SysAvailSchedPtr = ScheduleManager::GetScheduleIndex(state, input_data.availability_schedule_name);
3733 517 : if (this->m_SysAvailSchedPtr == 0) {
3734 0 : ShowWarningError(state,
3735 0 : format("getUnitarySystemInputData {}=\"{}\", invalid Availability Schedule Name = {}",
3736 : cCurrentModuleObject,
3737 : this->Name,
3738 0 : input_data.availability_schedule_name));
3739 0 : ShowContinueError(state, "Set the default as Always On. Simulation continues.");
3740 0 : this->m_SysAvailSchedPtr = DataGlobalConstants::ScheduleAlwaysOn;
3741 : }
3742 : } else {
3743 75 : this->m_SysAvailSchedPtr = DataGlobalConstants::ScheduleAlwaysOn;
3744 : }
3745 :
3746 592 : if (!input_data.controlling_zone_or_thermostat_location.empty()) { // not required field
3747 102 : this->ControlZoneNum = UtilityRoutines::FindItemInList(input_data.controlling_zone_or_thermostat_location, state.dataHeatBal->Zone);
3748 490 : } else if (this->m_ControlType == UnitarySysCtrlType::Load || this->m_ControlType == UnitarySysCtrlType::CCMASHRAE) {
3749 192 : if (this->m_sysType == SysType::Unitary) {
3750 0 : ShowSevereError(state, format("Input errors for {}:{}", cCurrentModuleObject, thisObjectName));
3751 0 : ShowContinueError(state, "Controlling Zone or Thermostat Location cannot be blank when Control Type = Load or SingleZoneVAV");
3752 0 : errorsFound = true;
3753 : }
3754 : }
3755 :
3756 : // check that control zone name is valid for load based control
3757 592 : if (this->m_ControlType == UnitarySysCtrlType::Load || this->m_ControlType == UnitarySysCtrlType::CCMASHRAE) {
3758 : // bypass this error for PTUnits
3759 486 : if (this->ControlZoneNum == 0 &&
3760 384 : (this->m_sysType == SysType::Unitary || this->m_sysType == SysType::CoilCoolingDX || this->m_sysType == SysType::CoilCoolingWater)) {
3761 0 : ShowSevereError(state, format("Input errors for {}:{}", cCurrentModuleObject, thisObjectName));
3762 0 : ShowContinueError(state, "When Control Type = Load or SingleZoneVAV");
3763 0 : ShowContinueError(state,
3764 0 : format(" Controlling Zone or Thermostat Location must be a valid zone name, zone name = {}",
3765 0 : input_data.controlling_zone_or_thermostat_location));
3766 0 : errorsFound = true;
3767 : }
3768 : }
3769 :
3770 592 : if (UtilityRoutines::SameString(input_data.dehumidification_control_type, "None")) {
3771 568 : this->m_DehumidControlType_Num = DehumCtrlType::None;
3772 568 : this->m_Humidistat = false;
3773 24 : } else if (UtilityRoutines::SameString(input_data.dehumidification_control_type, "CoolReheat")) {
3774 13 : this->m_DehumidControlType_Num = DehumCtrlType::CoolReheat;
3775 13 : this->m_Humidistat = true;
3776 11 : } else if (UtilityRoutines::SameString(input_data.dehumidification_control_type, "Multimode")) {
3777 11 : this->m_DehumidControlType_Num = DehumCtrlType::Multimode;
3778 11 : this->m_Humidistat = true;
3779 : }
3780 592 : if (this->m_Humidistat && this->m_ControlType == UnitarySysCtrlType::Load) {
3781 9 : bool AirNodeFound = false;
3782 42 : for (int HStatZoneNum = 1; HStatZoneNum <= state.dataZoneCtrls->NumHumidityControlZones; ++HStatZoneNum) {
3783 33 : if (state.dataZoneCtrls->HumidityControlZone(HStatZoneNum).ActualZoneNum != this->ControlZoneNum) continue;
3784 9 : AirNodeFound = true;
3785 : }
3786 9 : if (!AirNodeFound && this->ControlZoneNum > 0) {
3787 0 : ShowSevereError(state, format("Input errors for {}:{}", cCurrentModuleObject, thisObjectName));
3788 0 : ShowContinueError(state, "Did not find Air Node (Zone with Humidistat).");
3789 0 : ShowContinueError(
3790 0 : state, format("specified Controlling Zone or Thermostat Location name = {}", input_data.controlling_zone_or_thermostat_location));
3791 0 : errorsFound = true;
3792 : }
3793 : }
3794 :
3795 592 : Real64 TotalFloorAreaOnAirLoop = 0.0;
3796 592 : int AirLoopNumber = 0;
3797 592 : bool AirNodeFound = false;
3798 592 : bool AirLoopFound = false;
3799 592 : bool OASysFound = false;
3800 592 : bool ZoneEquipmentFound = false;
3801 592 : bool ZoneInletNodeFound = false;
3802 592 : bool ZoneExhaustNodeFound = false;
3803 592 : bool InducedNodeFound = false;
3804 :
3805 : // Get AirTerminal mixer data
3806 592 : SingleDuct::GetATMixer(state,
3807 : thisObjectName,
3808 : this->m_ATMixerName,
3809 : this->m_ATMixerIndex,
3810 : this->ATMixerType,
3811 : this->m_ATMixerPriNode,
3812 : this->m_ATMixerSecNode,
3813 : this->ATMixerOutNode,
3814 : this->AirOutNode);
3815 592 : if (this->ATMixerType == DataHVACGlobals::ATMixer_InletSide || this->ATMixerType == DataHVACGlobals::ATMixer_SupplySide) {
3816 29 : this->ATMixerExists = true;
3817 : }
3818 : // check that heat pump doesn't have local outside air and DOA
3819 592 : if (this->ATMixerExists && this->m_OAMixerNodes[0] > 0 &&
3820 0 : (input_data.cooling_oa_flow_rate != 0.0 || input_data.heating_oa_flow_rate != 0.0 || input_data.no_load_oa_flow_rate != 0.0)) {
3821 0 : ShowSevereError(state,
3822 0 : format("{} = \"{}\". System has local as well as central outdoor air specified", cCurrentModuleObject, this->Name));
3823 0 : errorsFound = true;
3824 : }
3825 :
3826 : // if part of ZoneHVAC:OutdoorAirUnit bypass most checks for connection to air loop or OASystem
3827 592 : if (ZoneOAUnitNum > 0) OASysFound = true;
3828 :
3829 592 : if (ZoneEquipment) {
3830 198 : int ControlledZoneNum = 0;
3831 198 : int ZoneExhNum = 0;
3832 :
3833 198 : if (!this->ATMixerExists) {
3834 169 : ZoneExhaustNodeFound = searchExhaustNodes(state, this->AirInNode, ControlledZoneNum, ZoneExhNum);
3835 169 : if (ZoneExhaustNodeFound) {
3836 168 : ZoneEquipmentFound = true;
3837 : // The Node was found among the exhaust nodes, now check that a matching inlet node exists
3838 : // this should be zoneExhaustNode
3839 168 : this->m_ZoneInletNode = state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).ExhaustNode(ZoneExhNum);
3840 168 : this->ControlZoneNum = ControlledZoneNum;
3841 168 : this->setSystemParams(state, TotalFloorAreaOnAirLoop, thisObjectName);
3842 168 : ZoneInletNodeFound = searchZoneInletNodesByEquipmentIndex(state, this->AirOutNode, this->ControlZoneNum);
3843 : } else { // find if the inlet node is an induced node from zone plenum
3844 1 : int ZoneInletNum = 0;
3845 1 : ZoneInletNodeFound = searchZoneInletNodes(state, this->AirOutNode, this->ControlZoneNum, ZoneInletNum);
3846 1 : if (ZoneInletNodeFound) {
3847 2 : InducedNodeFound = ZonePlenum::ValidateInducedNode(state,
3848 : this->AirInNode,
3849 1 : state.dataZoneEquip->ZoneEquipConfig(this->ControlZoneNum).NumReturnNodes,
3850 1 : state.dataZoneEquip->ZoneEquipConfig(this->ControlZoneNum).ReturnNode);
3851 1 : if (InducedNodeFound) {
3852 1 : this->m_ZoneInletNode = this->AirOutNode;
3853 1 : ZoneEquipmentFound = true;
3854 1 : this->setSystemParams(state, TotalFloorAreaOnAirLoop, thisObjectName);
3855 : }
3856 : }
3857 : }
3858 29 : } else if (this->ATMixerType == DataHVACGlobals::ATMixer_InletSide) {
3859 16 : ZoneExhaustNodeFound = searchExhaustNodes(state, this->m_ATMixerSecNode, ControlledZoneNum, ZoneExhNum);
3860 16 : if (ZoneExhaustNodeFound) {
3861 15 : ZoneEquipmentFound = true;
3862 15 : this->m_ZoneInletNode = this->AirOutNode;
3863 15 : this->ControlZoneNum = ControlledZoneNum;
3864 15 : this->setSystemParams(state, TotalFloorAreaOnAirLoop, thisObjectName);
3865 : // The Node was found among the exhaust nodes, now check that a matching inlet node exists
3866 15 : ZoneInletNodeFound = searchZoneInletNodesByEquipmentIndex(state, this->AirOutNode, this->ControlZoneNum);
3867 : } else {
3868 1 : int ZoneInletNum = 0;
3869 1 : ZoneInletNodeFound = searchZoneInletNodes(state, this->AirOutNode, this->ControlZoneNum, ZoneInletNum);
3870 1 : if (ZoneInletNodeFound) {
3871 2 : InducedNodeFound = ZonePlenum::ValidateInducedNode(state,
3872 : this->m_ATMixerSecNode,
3873 1 : state.dataZoneEquip->ZoneEquipConfig(this->ControlZoneNum).NumReturnNodes,
3874 1 : state.dataZoneEquip->ZoneEquipConfig(this->ControlZoneNum).ReturnNode);
3875 1 : if (InducedNodeFound) {
3876 1 : this->m_ZoneInletNode = this->AirOutNode;
3877 1 : ZoneEquipmentFound = true;
3878 1 : this->setSystemParams(state, TotalFloorAreaOnAirLoop, thisObjectName);
3879 : }
3880 : }
3881 : }
3882 13 : } else if (this->ATMixerType == DataHVACGlobals::ATMixer_SupplySide) {
3883 13 : ZoneExhaustNodeFound = searchExhaustNodes(state, this->AirInNode, ControlledZoneNum, ZoneExhNum);
3884 13 : if (ZoneExhaustNodeFound) {
3885 12 : ZoneEquipmentFound = true;
3886 12 : this->m_ZoneInletNode = this->ATMixerOutNode;
3887 12 : this->ControlZoneNum = ControlledZoneNum;
3888 12 : this->setSystemParams(state, TotalFloorAreaOnAirLoop, thisObjectName);
3889 : // The Node was found among the exhaust nodes, now check that a matching inlet node exists
3890 12 : ZoneInletNodeFound = searchZoneInletNodesByEquipmentIndex(state, this->ATMixerOutNode, this->ControlZoneNum);
3891 : } else {
3892 1 : int ZoneInletNum = 0;
3893 1 : ZoneInletNodeFound = searchZoneInletNodes(state, this->ATMixerOutNode, this->ControlZoneNum, ZoneInletNum);
3894 1 : if (ZoneInletNodeFound) {
3895 2 : InducedNodeFound = ZonePlenum::ValidateInducedNode(state,
3896 : this->AirInNode,
3897 1 : state.dataZoneEquip->ZoneEquipConfig(this->ControlZoneNum).NumReturnNodes,
3898 1 : state.dataZoneEquip->ZoneEquipConfig(this->ControlZoneNum).ReturnNode);
3899 1 : if (InducedNodeFound) {
3900 1 : this->m_ZoneInletNode = this->ATMixerOutNode;
3901 1 : ZoneEquipmentFound = true;
3902 1 : this->setSystemParams(state, TotalFloorAreaOnAirLoop, thisObjectName);
3903 : }
3904 : }
3905 : }
3906 : }
3907 198 : if (!ZoneExhaustNodeFound && !InducedNodeFound) {
3908 : // Exhaust Node was not found
3909 0 : ShowSevereError(state, format("Input errors for {}:{}", cCurrentModuleObject, thisObjectName));
3910 0 : ShowContinueError(state,
3911 0 : format("Incorrect or misspelled Air Inlet Node Name or Exhaust Node Name or Induced Node Name. = {}",
3912 0 : input_data.air_inlet_node_name));
3913 0 : ShowContinueError(
3914 : state,
3915 0 : format("Air Inlet Node {} name does not match any controlled zone exhaust node name. Check ZoneHVAC:EquipmentConnections "
3916 : "object inputs.",
3917 0 : input_data.air_inlet_node_name));
3918 0 : ShowContinueError(state, "or Induced Air Outlet Node Name specified in AirLoopHVAC:ReturnPlenum object.");
3919 0 : errorsFound = true;
3920 198 : } else if (!ZoneInletNodeFound) {
3921 0 : bool ZoneInletNodeExists = false;
3922 0 : int InletControlledZoneNum = 0;
3923 0 : int ZoneInletNum = 0;
3924 0 : ZoneInletNodeExists = searchZoneInletNodes(state, this->AirOutNode, InletControlledZoneNum, ZoneInletNum);
3925 0 : if (!ZoneInletNodeExists) {
3926 0 : ShowSevereError(state, format("Input errors for {}:{}", cCurrentModuleObject, thisObjectName));
3927 0 : ShowContinueError(state, format("Incorrect or misspelled Air Outlet Node Name = {}", input_data.air_outlet_node_name));
3928 0 : ShowContinueError(state,
3929 : "Node name does not match any controlled zone inlet node name. Check ZoneHVAC:EquipmentConnections "
3930 : "object inputs.");
3931 0 : errorsFound = true;
3932 : }
3933 : }
3934 : } else {
3935 : // check if the UnitarySystem is connected to an air loop
3936 :
3937 : int compIndex;
3938 : int branchIndex;
3939 394 : AirLoopFound = searchTotalComponents(state, this->AirloopEqType, thisObjectName, compIndex, branchIndex, AirLoopNumber);
3940 394 : if (AirLoopFound && (this->ControlZoneNum > 0)) {
3941 : // Find the controlled zone number for the specified thermostat location
3942 96 : this->NodeNumOfControlledZone = state.dataZoneEquip->ZoneEquipConfig(this->ControlZoneNum).ZoneNode;
3943 :
3944 : // Determine if system is on air loop served by the thermostat location specified
3945 96 : ZoneInletNodeFound = false;
3946 96 : int ZoneInletNum = 0;
3947 96 : ZoneInletNodeFound = searchZoneInletNodeAirLoopNum(state, AirLoopNumber, this->ControlZoneNum, ZoneInletNum);
3948 96 : if (ZoneInletNodeFound) {
3949 96 : this->m_ZoneInletNode = state.dataZoneEquip->ZoneEquipConfig(this->ControlZoneNum).InletNode(ZoneInletNum);
3950 96 : TotalFloorAreaOnAirLoop += state.dataHeatBal->Zone(this->ControlZoneNum).FloorArea;
3951 : }
3952 :
3953 : // if (this->m_ZoneInletNode == 0) AirLoopFound = false;
3954 1029 : for (int TstatZoneNum = 1; TstatZoneNum <= state.dataZoneCtrls->NumTempControlledZones; ++TstatZoneNum) {
3955 933 : if (state.dataZoneCtrls->TempControlledZone(TstatZoneNum).ActualZoneNum != this->ControlZoneNum) continue;
3956 96 : AirNodeFound = true;
3957 : }
3958 96 : for (int TstatZoneNum = 1; TstatZoneNum <= state.dataZoneCtrls->NumComfortControlledZones; ++TstatZoneNum) {
3959 0 : if (state.dataZoneCtrls->ComfortControlledZone(TstatZoneNum).ActualZoneNum != this->ControlZoneNum) continue;
3960 0 : AirNodeFound = true;
3961 : }
3962 96 : if (!AirNodeFound && this->ControlZoneNum > 0) {
3963 0 : ShowSevereError(state, format("Input errors for {}:{}", cCurrentModuleObject, thisObjectName));
3964 0 : ShowContinueError(state, "Did not find Air Node (Zone with Thermostat or Thermal Comfort Thermostat).");
3965 0 : ShowContinueError(
3966 : state,
3967 0 : format("specified Controlling Zone or Thermostat Location name = {}", input_data.controlling_zone_or_thermostat_location));
3968 0 : errorsFound = true;
3969 : }
3970 :
3971 96 : if (this->ControlZoneNum > 0) {
3972 : // Find the controlled zone number for the specified thermostat location
3973 96 : this->NodeNumOfControlledZone = state.dataZoneEquip->ZoneEquipConfig(this->ControlZoneNum).ZoneNode;
3974 :
3975 : // Determine if system is on air loop served by the thermostat location specified
3976 96 : ZoneInletNodeFound = false;
3977 96 : int ZoneInletNum = 0;
3978 96 : ZoneInletNodeFound = searchZoneInletNodeAirLoopNum(state, AirLoopNumber, this->ControlZoneNum, ZoneInletNum);
3979 96 : if (ZoneInletNodeFound) {
3980 96 : this->m_ZoneInletNode = state.dataZoneEquip->ZoneEquipConfig(this->ControlZoneNum).InletNode(ZoneInletNum);
3981 96 : TotalFloorAreaOnAirLoop += state.dataHeatBal->Zone(this->ControlZoneNum).FloorArea;
3982 : }
3983 :
3984 : // if (this->m_ZoneInletNode == 0) AirLoopFound = false;
3985 1029 : for (int TstatZoneNum = 1; TstatZoneNum <= state.dataZoneCtrls->NumTempControlledZones; ++TstatZoneNum) {
3986 933 : if (state.dataZoneCtrls->TempControlledZone(TstatZoneNum).ActualZoneNum != this->ControlZoneNum) continue;
3987 96 : AirNodeFound = true;
3988 : }
3989 96 : for (int TstatZoneNum = 1; TstatZoneNum <= state.dataZoneCtrls->NumComfortControlledZones; ++TstatZoneNum) {
3990 0 : if (state.dataZoneCtrls->ComfortControlledZone(TstatZoneNum).ActualZoneNum != this->ControlZoneNum) continue;
3991 0 : AirNodeFound = true;
3992 : }
3993 96 : if (!AirNodeFound && this->ControlZoneNum > 0) {
3994 0 : ShowSevereError(state, format("Input errors for {}:{}", cCurrentModuleObject, thisObjectName));
3995 0 : ShowContinueError(state, "Did not find Air Node (Zone with Thermostat or Thermal Comfort Thermostat).");
3996 0 : ShowContinueError(state,
3997 0 : format("specified Controlling Zone or Thermostat Location name = {}",
3998 0 : input_data.controlling_zone_or_thermostat_location));
3999 0 : errorsFound = true;
4000 : }
4001 : }
4002 : }
4003 :
4004 : // check if the UnitarySystem is connected to an outside air system
4005 394 : if (!AirLoopFound && state.dataAirLoop->NumOASystems > 0) {
4006 4 : for (int OASysNum = 1; OASysNum <= state.dataAirLoop->NumOASystems; ++OASysNum) {
4007 2 : for (int OACompNum = 1; OACompNum <= state.dataAirLoop->OutsideAirSys(OASysNum).NumComponents; ++OACompNum) {
4008 4 : if (!UtilityRoutines::SameString(state.dataAirLoop->OutsideAirSys(OASysNum).ComponentName(OACompNum), thisObjectName) ||
4009 2 : !UtilityRoutines::SameString(state.dataAirLoop->OutsideAirSys(OASysNum).ComponentType(OACompNum), cCurrentModuleObject))
4010 0 : continue;
4011 2 : AirLoopNumber = OASysNum;
4012 2 : OASysFound = true;
4013 2 : break;
4014 : }
4015 : }
4016 : }
4017 : }
4018 :
4019 600 : if (AirLoopNumber == 0 && !ZoneEquipmentFound &&
4020 16 : (this->m_ControlType == UnitarySysCtrlType::Load || this->m_ControlType == UnitarySysCtrlType::CCMASHRAE)) {
4021 0 : std::string_view zoneName = input_data.controlling_zone_or_thermostat_location;
4022 0 : if (zoneName.empty() && this->ControlZoneNum > 0) {
4023 0 : zoneName = state.dataHeatBal->Zone(this->ControlZoneNum).Name;
4024 : }
4025 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
4026 0 : ShowContinueError(state, "Did not find proper connections for AirLoopHVAC or ZoneHVAC system.");
4027 0 : ShowContinueError(state, format("specified Controlling Zone or Thermostat Location name = {}", zoneName));
4028 0 : if (!AirNodeFound && !ZoneEquipmentFound) {
4029 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
4030 0 : ShowContinueError(state, "Did not find air node (zone with thermostat).");
4031 : // ShowContinueError(state, "specified " + cAlphaFields(iControlZoneAlphaNum) + " = " + Alphas(iControlZoneAlphaNum));
4032 0 : ShowContinueError(state,
4033 : "Both a ZoneHVAC:EquipmentConnections object and a ZoneControl:Thermostat object must be specified for this zone.");
4034 : }
4035 0 : errorsFound = true;
4036 : }
4037 :
4038 592 : if (!AirLoopFound && !ZoneEquipmentFound && !OASysFound) {
4039 : // Unsucessful attempt to get all input data.
4040 0 : return;
4041 592 : } else if (ZoneEquipmentFound || OASysFound ||
4042 384 : (AirLoopFound && (this->m_ZoneInletNode > 0 || this->m_ControlType == UnitarySysCtrlType::Setpoint))) {
4043 592 : this->m_OKToPrintSizing = true;
4044 592 : this->m_ThisSysInputShouldBeGotten = false;
4045 : }
4046 :
4047 592 : this->m_AvailManagerListName = input_data.avail_manager_list_name;
4048 :
4049 592 : if (!input_data.design_spec_zonehvac_sizing_object_name.empty()) {
4050 0 : this->m_HVACSizingIndex =
4051 0 : UtilityRoutines::FindItemInList(input_data.design_spec_zonehvac_sizing_object_name, state.dataSize->ZoneHVACSizing);
4052 0 : if (this->m_HVACSizingIndex == 0) {
4053 0 : ShowSevereError(state,
4054 0 : "Design Specification ZoneHVAC Sizing Object Name = " + input_data.design_spec_zonehvac_sizing_object_name +
4055 : " not found.");
4056 0 : ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + this->Name);
4057 0 : errorsFound = true;
4058 : }
4059 : }
4060 :
4061 592 : if (!ZoneEquipment)
4062 1182 : BranchNodeConnections::TestCompSet(state,
4063 : cCurrentModuleObject,
4064 788 : UtilityRoutines::MakeUPPERCase(thisObjectName),
4065 : input_data.air_inlet_node_name,
4066 : input_data.air_outlet_node_name,
4067 : "Air Nodes");
4068 :
4069 592 : std::string const &loc_fanType = input_data.supply_fan_object_type;
4070 592 : std::string const &loc_m_FanName = input_data.supply_fan_name;
4071 :
4072 592 : if (!loc_m_FanName.empty() && !loc_fanType.empty()) {
4073 300 : if (UtilityRoutines::SameString(loc_fanType, "Fan:SystemModel")) {
4074 57 : if (!HVACFan::checkIfFanNameIsAFanSystem(state, loc_m_FanName)) {
4075 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4076 0 : errorsFound = true;
4077 : } else {
4078 57 : this->m_FanType_Num = DataHVACGlobals::FanType_SystemModelObject;
4079 57 : isNotOK = false;
4080 57 : ValidateComponent(state, loc_fanType, loc_m_FanName, isNotOK, cCurrentModuleObject);
4081 57 : if (isNotOK) {
4082 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4083 0 : errorsFound = true;
4084 : } else { // mine data from fan object
4085 57 : if (HVACFan::getFanObjectVectorIndex(state, loc_m_FanName, false) < 0) {
4086 56 : state.dataHVACFan->fanObjs.emplace_back(new HVACFan::FanSystem(state, loc_m_FanName)); // call constructor
4087 : }
4088 57 : this->m_FanIndex = HVACFan::getFanObjectVectorIndex(state, loc_m_FanName);
4089 57 : if (this->m_FanIndex > -1) {
4090 57 : FanInletNode = state.dataHVACFan->fanObjs[this->m_FanIndex]->inletNodeNum;
4091 57 : FanOutletNode = state.dataHVACFan->fanObjs[this->m_FanIndex]->outletNodeNum;
4092 57 : this->m_FanAvailSchedPtr = state.dataHVACFan->fanObjs[this->m_FanIndex]->availSchedIndex;
4093 57 : FanVolFlowRate = state.dataHVACFan->fanObjs[this->m_FanIndex]->designAirVolFlowRate;
4094 : } else {
4095 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
4096 0 : ShowContinueError(state, "Unable to access fan data.");
4097 0 : ShowContinueError(state, format("Fan Type = {}, Fan name = {}", loc_fanType, loc_m_FanName));
4098 0 : errorsFound = true;
4099 : }
4100 57 : if (FanVolFlowRate == DataSizing::AutoSize) this->m_RequestAutoSize = true;
4101 57 : this->m_ActualFanVolFlowRate = FanVolFlowRate;
4102 57 : this->m_DesignFanVolFlowRate = FanVolFlowRate;
4103 : }
4104 : }
4105 : } else {
4106 243 : Fans::GetFanType(state, loc_m_FanName, this->m_FanType_Num, isNotOK, cCurrentModuleObject, loc_m_FanName);
4107 243 : if (isNotOK) {
4108 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4109 0 : errorsFound = true;
4110 : } else {
4111 243 : isNotOK = false;
4112 243 : ValidateComponent(state, loc_fanType, loc_m_FanName, isNotOK, cCurrentModuleObject);
4113 243 : if (isNotOK) {
4114 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4115 0 : errorsFound = true;
4116 : } else { // mine data from fan object
4117 243 : Fans::GetFanIndex(state, loc_m_FanName, this->m_FanIndex, errFlag);
4118 243 : if (errFlag) {
4119 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4120 0 : errorsFound = true;
4121 : } else {
4122 243 : auto &fans = state.dataFans->Fan(this->m_FanIndex);
4123 243 : FanVolFlowRate = fans.MaxAirFlowRate;
4124 243 : if (FanVolFlowRate == DataSizing::AutoSize) this->m_RequestAutoSize = true;
4125 243 : this->m_ActualFanVolFlowRate = FanVolFlowRate;
4126 243 : this->m_DesignFanVolFlowRate = FanVolFlowRate;
4127 243 : FanInletNode = fans.InletNodeNum;
4128 243 : FanOutletNode = fans.OutletNodeNum;
4129 243 : this->m_FanAvailSchedPtr = fans.AvailSchedPtrNum;
4130 : }
4131 : } // IF (IsNotOK) THEN
4132 : }
4133 : }
4134 300 : this->m_FanExists = true;
4135 300 : this->m_FanName = loc_m_FanName;
4136 : } else {
4137 292 : if ((loc_m_FanName.empty() && !loc_fanType.empty()) || (!loc_m_FanName.empty() && loc_fanType.empty())) {
4138 0 : ShowSevereError(state, format("Input errors for {}:{}", cCurrentModuleObject, thisObjectName));
4139 0 : ShowContinueError(state, format("Invalid Fan Type or Name: Fan Name = {}, Fan Type = {}", loc_m_FanName, loc_fanType));
4140 0 : errorsFound = true;
4141 : }
4142 : }
4143 :
4144 : // Add fan to component sets array
4145 592 : if (this->m_FanExists && this->m_FanCompNotSetYet) {
4146 600 : BranchNodeConnections::SetUpCompSets(state,
4147 : cCurrentModuleObject,
4148 : thisObjectName,
4149 : loc_fanType,
4150 : loc_m_FanName,
4151 300 : state.dataLoopNodes->NodeID(FanInletNode),
4152 300 : state.dataLoopNodes->NodeID(FanOutletNode));
4153 300 : this->m_FanCompNotSetYet = false;
4154 : }
4155 :
4156 : constexpr static std::array<std::string_view, static_cast<int>(FanPlace::Num)> FanPlaceNamesUC = {"NOTYETSET", "BLOWTHROUGH", "DRAWTHROUGH"};
4157 592 : this->m_FanPlace = static_cast<FanPlace>(getEnumerationValue(FanPlaceNamesUC, UtilityRoutines::MakeUPPERCase(input_data.fan_placement)));
4158 592 : if ((this->m_FanPlace == FanPlace::NotYetSet || this->m_FanPlace == FanPlace::Invalid) && this->m_FanExists) {
4159 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
4160 0 : ShowContinueError(state, format("Illegal Fan Placement = {}", input_data.fan_placement));
4161 0 : errorsFound = true;
4162 : }
4163 :
4164 592 : this->m_FanOpModeSchedPtr = ScheduleManager::GetScheduleIndex(state, input_data.supply_air_fan_operating_mode_schedule_name);
4165 592 : if (!input_data.supply_air_fan_operating_mode_schedule_name.empty() && this->m_FanOpModeSchedPtr == 0) {
4166 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
4167 0 : ShowContinueError(state, format("Illegal Fan Operating Mode Schedule Name = {}", input_data.supply_air_fan_operating_mode_schedule_name));
4168 : // ShowContinueError(state, "Illegal " + cAlphaFields(iFanSchedAlphaNum) + " = " + Alphas(iFanSchedAlphaNum));
4169 0 : errorsFound = true;
4170 592 : } else if (this->m_FanOpModeSchedPtr == 0) {
4171 298 : if (this->m_ControlType == UnitarySysCtrlType::Setpoint) {
4172 : // Fan operating mode must be constant fan so that the coil outlet temp is proportional to PLR
4173 : // Cycling fan always outputs the full load outlet air temp so should not be used with set point based control
4174 297 : this->m_FanOpMode = DataHVACGlobals::ContFanCycCoil;
4175 : } else {
4176 1 : this->m_FanOpMode = DataHVACGlobals::CycFanCycCoil;
4177 1 : if (this->m_FanType_Num != DataHVACGlobals::FanType_SimpleOnOff &&
4178 0 : this->m_FanType_Num != DataHVACGlobals::FanType_SystemModelObject && this->m_FanExists) {
4179 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
4180 : // ShowContinueError(state, cAlphaFields(iFanTypeAlphaNum) + " = " + Alphas(iFanTypeAlphaNum));
4181 : // ShowContinueError(state, "Fan type must be Fan:OnOff of Fan:SystemModel when " + cAlphaFields(iFanSchedAlphaNum) + " =
4182 : // Blank.");
4183 0 : ShowContinueError(state,
4184 : "Fan type must be Fan:OnOff or Fan:SystemModel when Supply Air Fan Operating Mode Schedule Name is blank.");
4185 0 : errorsFound = true;
4186 : }
4187 : }
4188 294 : } else if (this->m_FanOpModeSchedPtr > 0 && this->m_ControlType == UnitarySysCtrlType::Setpoint) {
4189 1 : if (!ScheduleManager::CheckScheduleValueMinMax(state, this->m_FanOpModeSchedPtr, ">", 0.0, "<=", 1.0)) {
4190 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
4191 0 : ShowContinueError(state, format("For {} = {}", loc_fanType, loc_m_FanName));
4192 0 : ShowContinueError(state, "Fan operating mode must be continuous (fan operating mode schedule values > 0).");
4193 0 : ShowContinueError(
4194 : state,
4195 0 : format("Error found in Supply Air Fan Operating Mode Schedule Name {}", input_data.supply_air_fan_operating_mode_schedule_name));
4196 0 : ShowContinueError(state, "...schedule values must be (>0., <=1.)");
4197 0 : errorsFound = true;
4198 : }
4199 : }
4200 :
4201 : // Check fan's schedule for cycling fan operation IF constant volume fan is used
4202 592 : if (this->m_FanOpModeSchedPtr > 0 && this->m_FanType_Num == DataHVACGlobals::FanType_SimpleConstVolume) {
4203 3 : if (!ScheduleManager::CheckScheduleValueMinMax(state, this->m_FanOpModeSchedPtr, ">", 0.0, "<=", 1.0)) {
4204 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
4205 0 : ShowContinueError(state, "Fan operating mode must be continuous (fan operating mode schedule values > 0).");
4206 0 : ShowContinueError(
4207 : state,
4208 0 : format("Error found in Supply Air Fan Operating Mode Schedule Name {}", input_data.supply_air_fan_operating_mode_schedule_name));
4209 0 : ShowContinueError(state, "...schedule values must be (>0., <=1.)");
4210 0 : errorsFound = true;
4211 : }
4212 : }
4213 :
4214 592 : PrintMessage = true;
4215 : // Get coil data
4216 592 : this->m_HeatingSizingRatio = input_data.dx_heating_coil_sizing_ratio;
4217 592 : int HeatingCoilPLFCurveIndex = 0;
4218 592 : if (!this->m_HeatingCoilTypeName.empty()) {
4219 301 : PrintMessage = false;
4220 : } else {
4221 291 : this->m_ValidASHRAEHeatCoil = false;
4222 : }
4223 :
4224 592 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_HeatingEmpirical) {
4225 :
4226 41 : this->m_DXHeatingCoil = true;
4227 41 : errFlag = false;
4228 :
4229 41 : ValidateComponent(state, this->m_HeatingCoilTypeName, this->m_HeatingCoilName, isNotOK, cCurrentModuleObject);
4230 41 : if (isNotOK) {
4231 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4232 0 : errorsFound = true;
4233 :
4234 : } else { // mine data from DX heating coil
4235 :
4236 : // Get DX heating coil index
4237 41 : DXCoils::GetDXCoilIndex(state, this->m_HeatingCoilName, this->m_HeatingCoilIndex, errFlag);
4238 41 : if (errFlag) {
4239 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4240 0 : errorsFound = true;
4241 0 : errFlag = false;
4242 : } else {
4243 41 : auto &thisHeatCoil = state.dataDXCoils->DXCoil(this->m_HeatingCoilIndex);
4244 41 : this->m_HeatingCoilAvailSchPtr = thisHeatCoil.SchedPtr;
4245 41 : this->m_DesignHeatingCapacity = thisHeatCoil.RatedTotCap(1);
4246 41 : if (this->m_DesignHeatingCapacity == DataSizing::AutoSize) this->m_RequestAutoSize = true;
4247 41 : this->m_MaxHeatAirVolFlow = thisHeatCoil.RatedAirVolFlowRate(1);
4248 41 : if (this->m_MaxHeatAirVolFlow == DataSizing::AutoSize) this->m_RequestAutoSize = true;
4249 41 : HeatingCoilInletNode = thisHeatCoil.AirInNode;
4250 41 : HeatingCoilOutletNode = thisHeatCoil.AirOutNode;
4251 41 : thisHeatCoil.HeatSizeRatio = this->m_HeatingSizingRatio;
4252 : }
4253 : }
4254 :
4255 1099 : } else if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed ||
4256 548 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit) {
4257 :
4258 6 : this->m_DXHeatingCoil = true;
4259 6 : errFlag = false;
4260 :
4261 6 : ValidateComponent(state, this->m_HeatingCoilTypeName, this->m_HeatingCoilName, isNotOK, cCurrentModuleObject);
4262 6 : if (isNotOK) {
4263 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4264 0 : errorsFound = true;
4265 : } else {
4266 6 : this->m_HeatingCoilIndex =
4267 6 : VariableSpeedCoils::GetCoilIndexVariableSpeed(state, this->m_HeatingCoilTypeName, this->m_HeatingCoilName, errFlag);
4268 6 : if (errFlag) {
4269 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4270 0 : errorsFound = true;
4271 0 : errFlag = false;
4272 : } else {
4273 6 : auto &thisHeatCoil = state.dataVariableSpeedCoils->VarSpeedCoil(this->m_HeatingCoilIndex);
4274 6 : this->m_NumOfSpeedHeating = thisHeatCoil.NumOfSpeeds;
4275 6 : this->m_HeatingCoilAvailSchPtr = DataGlobalConstants::ScheduleAlwaysOn;
4276 6 : this->m_MaxHeatAirVolFlow = thisHeatCoil.RatedAirVolFlowRate;
4277 6 : if (this->m_MaxHeatAirVolFlow == DataSizing::AutoSize) {
4278 4 : this->m_RequestAutoSize = true;
4279 : } else {
4280 6 : this->m_MaxHeatAirVolFlow = thisHeatCoil.MSRatedAirVolFlowRate(thisHeatCoil.NumOfSpeeds) /
4281 4 : thisHeatCoil.MSRatedAirVolFlowRate(thisHeatCoil.NormSpedLevel) * thisHeatCoil.RatedAirVolFlowRate;
4282 : }
4283 6 : HeatingCoilInletNode = thisHeatCoil.AirInletNodeNum;
4284 6 : HeatingCoilOutletNode = thisHeatCoil.AirOutletNodeNum;
4285 6 : this->m_DesignHeatingCapacity = thisHeatCoil.RatedCapHeat;
4286 6 : if (this->m_DesignHeatingCapacity == DataSizing::AutoSize) this->m_RequestAutoSize = true;
4287 : }
4288 6 : }
4289 545 : } else if (this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedHeating) {
4290 11 : this->m_DXHeatingCoil = true;
4291 11 : errFlag = false;
4292 11 : ValidateComponent(state, this->m_HeatingCoilTypeName, this->m_HeatingCoilName, isNotOK, cCurrentModuleObject);
4293 11 : if (isNotOK) {
4294 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4295 0 : errorsFound = true;
4296 : } else {
4297 11 : DXCoils::GetDXCoilIndex(state, this->m_HeatingCoilName, this->m_HeatingCoilIndex, errFlag, this->m_HeatingCoilTypeName);
4298 11 : if (errFlag) {
4299 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4300 0 : errorsFound = true;
4301 0 : errFlag = false;
4302 : } else {
4303 11 : auto &thisHeatCoil = state.dataDXCoils->DXCoil(this->m_HeatingCoilIndex);
4304 11 : this->m_HeatingCoilAvailSchPtr = thisHeatCoil.SchedPtr;
4305 11 : this->m_MaxHeatAirVolFlow = thisHeatCoil.MSRatedAirVolFlowRate(1);
4306 11 : if (this->m_MaxHeatAirVolFlow == DataSizing::AutoSize) this->m_RequestAutoSize = true;
4307 11 : HeatingCoilInletNode = thisHeatCoil.AirInNode;
4308 11 : HeatingCoilOutletNode = thisHeatCoil.AirOutNode;
4309 11 : this->m_DesignHeatingCapacity = thisHeatCoil.MSRatedTotCap(thisHeatCoil.NumOfSpeeds);
4310 : }
4311 : }
4312 1068 : } else if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingElectric_MultiStage ||
4313 534 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingGas_MultiStage) {
4314 0 : errFlag = false;
4315 0 : ValidateComponent(state, this->m_HeatingCoilTypeName, this->m_HeatingCoilName, isNotOK, cCurrentModuleObject);
4316 0 : if (isNotOK) {
4317 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4318 0 : errorsFound = true;
4319 : } else {
4320 0 : HeatingCoils::GetCoilIndex(state, this->m_HeatingCoilName, this->m_HeatingCoilIndex, errFlag);
4321 0 : if (errFlag) {
4322 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4323 0 : errorsFound = true;
4324 0 : errFlag = false;
4325 : } else {
4326 0 : auto &thisHeatCoil = state.dataHeatingCoils->HeatingCoil(this->m_HeatingCoilIndex);
4327 0 : HeatingCoilInletNode = thisHeatCoil.AirInletNodeNum;
4328 0 : HeatingCoilOutletNode = thisHeatCoil.AirOutletNodeNum;
4329 0 : this->m_HeatingCoilAvailSchPtr = thisHeatCoil.SchedPtr;
4330 0 : this->m_DesignHeatingCapacity = thisHeatCoil.MSNominalCapacity(thisHeatCoil.NumOfStages);
4331 0 : if (this->m_DesignHeatingCapacity == DataSizing::AutoSize) this->m_RequestAutoSize = true;
4332 : }
4333 0 : }
4334 992 : } else if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingGasOrOtherFuel ||
4335 787 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingElectric ||
4336 329 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingDesuperheater) {
4337 205 : ValidateComponent(state, this->m_HeatingCoilTypeName, this->m_HeatingCoilName, isNotOK, cCurrentModuleObject);
4338 205 : if (isNotOK) {
4339 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4340 0 : errorsFound = true;
4341 : } else { // mine data from heating coil
4342 205 : errFlag = false;
4343 205 : HeatingCoils::GetCoilIndex(state, this->m_HeatingCoilName, this->m_HeatingCoilIndex, errFlag);
4344 205 : if (errFlag) {
4345 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4346 0 : errorsFound = true;
4347 0 : errFlag = false;
4348 : } else {
4349 205 : auto &thisHeatCoil = state.dataHeatingCoils->HeatingCoil(this->m_HeatingCoilIndex);
4350 205 : this->m_DesignHeatingCapacity = thisHeatCoil.NominalCapacity;
4351 205 : if (this->m_DesignHeatingCapacity == DataSizing::AutoSize) this->m_RequestAutoSize = true;
4352 205 : this->m_HeatingCoilAvailSchPtr = thisHeatCoil.SchedPtr;
4353 205 : HeatingCoilInletNode = thisHeatCoil.AirInletNodeNum;
4354 205 : HeatingCoilOutletNode = thisHeatCoil.AirOutletNodeNum;
4355 205 : HeatingCoilPLFCurveIndex = thisHeatCoil.PLFCurveIndex;
4356 : // These heating coil types do not have an air flow input field
4357 205 : if (this->m_RequestAutoSize) {
4358 201 : this->m_MaxHeatAirVolFlow = DataSizing::AutoSize;
4359 : }
4360 : }
4361 205 : } // IF (IsNotOK) THEN
4362 :
4363 329 : } else if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWater) {
4364 9 : ValidateComponent(state, this->m_HeatingCoilTypeName, this->m_HeatingCoilName, isNotOK, cCurrentModuleObject);
4365 9 : if (isNotOK) {
4366 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4367 0 : errorsFound = true;
4368 : } else { // mine data from heating coil object
4369 9 : errFlag = false;
4370 9 : this->m_HeatingCoilIndex = WaterCoils::GetWaterCoilIndex(state, "COIL:HEATING:WATER", this->m_HeatingCoilName, errFlag);
4371 9 : if (errFlag) {
4372 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4373 0 : errorsFound = true;
4374 0 : errFlag = false;
4375 : } else {
4376 9 : auto &thisHeatCoil = state.dataWaterCoils->WaterCoil(this->m_HeatingCoilIndex);
4377 9 : this->m_HeatingCoilAvailSchPtr = thisHeatCoil.SchedPtr;
4378 9 : this->HeatCoilFluidInletNode = thisHeatCoil.WaterInletNodeNum;
4379 9 : this->MaxHeatCoilFluidFlow = thisHeatCoil.MaxWaterVolFlowRate;
4380 9 : if (this->MaxHeatCoilFluidFlow == DataSizing::AutoSize) {
4381 9 : this->m_RequestAutoSize = true;
4382 9 : this->m_DesignHeatingCapacity = DataSizing::AutoSize;
4383 : }
4384 9 : HeatingCoilInletNode = thisHeatCoil.AirInletNodeNum;
4385 9 : HeatingCoilOutletNode = thisHeatCoil.AirOutletNodeNum;
4386 : }
4387 : }
4388 :
4389 320 : } else if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingSteam) {
4390 2 : ValidateComponent(state, this->m_HeatingCoilTypeName, this->m_HeatingCoilName, isNotOK, cCurrentModuleObject);
4391 2 : if (isNotOK) {
4392 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4393 0 : errorsFound = true;
4394 : } else { // mine data from heating coil object
4395 2 : errFlag = false;
4396 2 : this->m_HeatingCoilIndex = SteamCoils::GetSteamCoilIndex(state, "COIL:HEATING:STEAM", this->m_HeatingCoilName, errFlag);
4397 2 : if (errFlag) {
4398 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
4399 0 : ShowContinueError(state, "Illegal Heating Coil Name = " + this->m_HeatingCoilName);
4400 0 : errorsFound = true;
4401 0 : errFlag = false;
4402 : } else {
4403 2 : auto &thisHeatCoil = state.dataSteamCoils->SteamCoil(this->m_HeatingCoilIndex);
4404 2 : this->m_HeatingCoilAvailSchPtr = thisHeatCoil.SchedPtr;
4405 2 : this->HeatCoilFluidInletNode = thisHeatCoil.SteamInletNodeNum;
4406 2 : this->MaxHeatCoilFluidFlow = thisHeatCoil.MaxSteamVolFlowRate;
4407 2 : if (this->MaxHeatCoilFluidFlow == DataSizing::AutoSize) {
4408 0 : this->m_RequestAutoSize = true;
4409 0 : this->m_DesignHeatingCapacity = DataSizing::AutoSize;
4410 : }
4411 2 : if (this->MaxHeatCoilFluidFlow > 0.0) {
4412 2 : int SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed
4413 2 : Real64 TempSteamIn = 100.0;
4414 : Real64 SteamDensity =
4415 2 : FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, SteamIndex, "getUnitarySystemInputData");
4416 2 : this->MaxHeatCoilFluidFlow *= SteamDensity;
4417 2 : errFlag = false;
4418 : }
4419 2 : HeatingCoilInletNode = thisHeatCoil.AirInletNodeNum;
4420 2 : HeatingCoilOutletNode = thisHeatCoil.AirOutletNodeNum;
4421 2 : if (this->m_RequestAutoSize) {
4422 2 : this->m_MaxHeatAirVolFlow = DataSizing::AutoSize;
4423 : }
4424 : }
4425 : }
4426 :
4427 318 : } else if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHPSimple) {
4428 22 : this->m_DXHeatingCoil = true;
4429 22 : ValidateComponent(state, this->m_HeatingCoilTypeName, this->m_HeatingCoilName, isNotOK, cCurrentModuleObject);
4430 22 : if (isNotOK) {
4431 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4432 0 : errorsFound = true;
4433 : } else { // mine data from heating coil object
4434 22 : errFlag = false;
4435 22 : this->m_HeatingCoilIndex =
4436 22 : WaterToAirHeatPumpSimple::GetCoilIndex(state, this->m_HeatingCoilTypeName, this->m_HeatingCoilName, errFlag);
4437 22 : if (errFlag) {
4438 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
4439 0 : ShowContinueError(state, "Illegal Heating Coil Name = " + this->m_HeatingCoilName);
4440 0 : errorsFound = true;
4441 0 : errFlag = false;
4442 : } else {
4443 22 : auto &thisHeatCoil = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(this->m_HeatingCoilIndex);
4444 22 : this->m_HeatingCoilAvailSchPtr = DataGlobalConstants::ScheduleAlwaysOn;
4445 22 : this->m_DesignHeatingCapacity = thisHeatCoil.RatedCapHeat;
4446 22 : this->m_MaxHeatAirVolFlow = thisHeatCoil.RatedAirVolFlowRate;
4447 22 : if (this->m_MaxHeatAirVolFlow == DataSizing::AutoSize) this->m_RequestAutoSize = true;
4448 22 : HeatingCoilInletNode = thisHeatCoil.AirInletNodeNum;
4449 22 : HeatingCoilOutletNode = thisHeatCoil.AirOutletNodeNum;
4450 : }
4451 : }
4452 :
4453 296 : } else if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHP) {
4454 5 : this->m_DXHeatingCoil = true;
4455 5 : ValidateComponent(state, this->m_HeatingCoilTypeName, this->m_HeatingCoilName, isNotOK, cCurrentModuleObject);
4456 5 : if (isNotOK) {
4457 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4458 0 : errorsFound = true;
4459 : } else { // mine data from heating coil object
4460 5 : errFlag = false;
4461 5 : this->m_HeatingCoilIndex = WaterToAirHeatPump::GetCoilIndex(state, this->m_HeatingCoilTypeName, this->m_HeatingCoilName, errFlag);
4462 5 : if (errFlag) {
4463 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
4464 0 : ShowContinueError(state, "Illegal Heating Coil Name = " + this->m_HeatingCoilName);
4465 0 : errorsFound = true;
4466 0 : errFlag = false;
4467 : } else {
4468 5 : auto &thisHeatCoil = state.dataWaterToAirHeatPump->WatertoAirHP(this->m_HeatingCoilIndex);
4469 5 : this->m_HeatingCoilAvailSchPtr = DataGlobalConstants::ScheduleAlwaysOn;
4470 5 : this->m_DesignHeatingCapacity = thisHeatCoil.HeatingCapacity;
4471 5 : HeatingCoilInletNode = thisHeatCoil.AirInletNodeNum;
4472 5 : HeatingCoilOutletNode = thisHeatCoil.AirOutletNodeNum;
4473 : }
4474 : }
4475 :
4476 291 : } else if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_UserDefined) {
4477 0 : ValidateComponent(state, this->m_HeatingCoilTypeName, this->m_HeatingCoilName, isNotOK, cCurrentModuleObject);
4478 0 : if (isNotOK) {
4479 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4480 0 : errorsFound = true;
4481 : } else { // mine data from Heating coil object
4482 0 : errFlag = false;
4483 0 : UserDefinedComponents::GetUserDefinedCoilIndex(
4484 : state, this->m_HeatingCoilName, this->m_HeatingCoilIndex, errFlag, cCurrentModuleObject);
4485 0 : if (errFlag) {
4486 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
4487 0 : ShowContinueError(state, "Illegal Heating Coil Name = " + this->m_HeatingCoilName);
4488 0 : errorsFound = true;
4489 0 : errFlag = false;
4490 : } else {
4491 0 : auto &thisHeatCoil = state.dataUserDefinedComponents->UserCoil(this->m_HeatingCoilIndex);
4492 0 : this->m_HeatingCoilAvailSchPtr = DataGlobalConstants::ScheduleAlwaysOn;
4493 : // **** How to get this info ****
4494 : // UnitarySystem( UnitarySysNum ).DesignHeatingCapacity =
4495 : // GetWtoAHPCoilCapacity(CoolingCoilType, this->m_CoolingCoilName, errFlag );
4496 0 : HeatingCoilInletNode = thisHeatCoil.Air(1).InletNodeNum;
4497 0 : HeatingCoilOutletNode = thisHeatCoil.Air(1).OutletNodeNum;
4498 : }
4499 : }
4500 :
4501 291 : } else if (this->m_HeatCoilExists) {
4502 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
4503 0 : ShowContinueError(state, format("Illegal Heating Coil Object Type = {}", this->m_HeatingCoilTypeName));
4504 0 : errorsFound = true;
4505 : } // IF (this->m_HeatingCoilType_Num == Coil_HeatingGasOrOtherFuel .OR. &, etc.
4506 :
4507 : // coil outlet node set point has priority, IF not exist, then use system outlet node
4508 592 : if (SetPointManager::NodeHasSPMCtrlVarType(state, this->AirOutNode, SetPointManager::CtrlVarType::Temp))
4509 323 : this->HeatCtrlNode = this->AirOutNode;
4510 592 : if (SetPointManager::NodeHasSPMCtrlVarType(state, HeatingCoilOutletNode, SetPointManager::CtrlVarType::Temp))
4511 58 : this->HeatCtrlNode = HeatingCoilOutletNode;
4512 :
4513 592 : this->HeatCoilInletNodeNum = HeatingCoilInletNode;
4514 592 : this->HeatCoilOutletNodeNum = HeatingCoilOutletNode;
4515 :
4516 : // Add heating coil to component sets array
4517 592 : if (this->m_HeatCoilExists && this->m_HeatCompNotSetYet) {
4518 301 : if (this->m_HeatingCoilType_Num != DataHVACGlobals::CoilDX_MultiSpeedHeating) {
4519 580 : BranchNodeConnections::SetUpCompSets(state,
4520 : cCurrentModuleObject,
4521 : thisObjectName,
4522 : this->m_HeatingCoilTypeName,
4523 : this->m_HeatingCoilName,
4524 290 : state.dataLoopNodes->NodeID(HeatingCoilInletNode),
4525 290 : state.dataLoopNodes->NodeID(HeatingCoilOutletNode));
4526 : } else {
4527 11 : BranchNodeConnections::SetUpCompSets(
4528 11 : state, cCurrentModuleObject, thisObjectName, this->m_HeatingCoilTypeName, this->m_HeatingCoilName, "UNDEFINED", "UNDEFINED");
4529 : }
4530 301 : this->m_HeatCompNotSetYet = false;
4531 : }
4532 :
4533 : // Get Cooling Coil Information IF available
4534 592 : if (!input_data.cooling_coil_object_type.empty() && !this->m_CoolingCoilName.empty()) {
4535 :
4536 804 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_CoolingSingleSpeed ||
4537 213 : this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_CoolingTwoSpeed) {
4538 445 : ValidateComponent(state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, isNotOK, cCurrentModuleObject);
4539 445 : if (isNotOK) {
4540 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4541 0 : errorsFound = true;
4542 :
4543 : } else { // mine data from DX cooling coil
4544 :
4545 445 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_CoolingTwoSpeed) {
4546 67 : this->m_NumOfSpeedCooling = 2;
4547 67 : this->m_MultiOrVarSpeedCoolCoil = true;
4548 : } else {
4549 378 : this->m_NumOfSpeedCooling = 1;
4550 378 : this->m_MultiOrVarSpeedCoolCoil = false;
4551 : }
4552 :
4553 : // Get DX cooling coil index
4554 445 : DXCoils::GetDXCoilIndex(state, this->m_CoolingCoilName, this->m_CoolingCoilIndex, isNotOK);
4555 445 : if (isNotOK) {
4556 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4557 0 : errorsFound = true;
4558 : } else {
4559 445 : if (state.dataGlobal->DoCoilDirectSolutions && this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_CoolingSingleSpeed) {
4560 0 : DXCoils::DisableLatentDegradation(state, this->m_CoolingCoilIndex);
4561 : }
4562 445 : auto &thisCoolCoil = state.dataDXCoils->DXCoil(this->m_CoolingCoilIndex);
4563 445 : this->m_CoolingCoilAvailSchPtr = thisCoolCoil.SchedPtr;
4564 445 : this->m_DesignCoolingCapacity = thisCoolCoil.RatedTotCap(1);
4565 445 : if (this->m_DesignCoolingCapacity == DataSizing::AutoSize) this->m_RequestAutoSize = true;
4566 445 : this->m_MaxCoolAirVolFlow = thisCoolCoil.RatedAirVolFlowRate(1);
4567 445 : if (this->m_MaxCoolAirVolFlow == DataSizing::AutoSize) this->m_RequestAutoSize = true;
4568 445 : CoolingCoilInletNode = thisCoolCoil.AirInNode;
4569 445 : CoolingCoilOutletNode = thisCoolCoil.AirOutNode;
4570 445 : this->m_CondenserNodeNum = thisCoolCoil.CondenserInletNodeNum(1);
4571 :
4572 445 : if (this->m_FanExists) {
4573 174 : thisCoolCoil.SupplyFanName = loc_m_FanName;
4574 174 : thisCoolCoil.SupplyFanIndex = this->m_FanIndex;
4575 174 : thisCoolCoil.SupplyFan_TypeNum = this->m_FanType_Num;
4576 174 : if (this->m_FanType_Num > -1) {
4577 696 : state.dataRptCoilSelection->coilSelectionReportObj->setCoilSupplyFanInfo(
4578 : state,
4579 : thisCoolCoil.Name,
4580 : thisCoolCoil.DXCoilType,
4581 174 : (this->m_FanType_Num == DataHVACGlobals::FanType_SystemModelObject)
4582 10 : ? state.dataHVACFan->fanObjs[thisCoolCoil.SupplyFanIndex]->name
4583 164 : : state.dataFans->Fan(thisCoolCoil.SupplyFanIndex).FanName,
4584 174 : (this->m_FanType_Num == DataHVACGlobals::FanType_SystemModelObject) ? DataAirSystems::ObjectVectorOOFanSystemModel
4585 : : DataAirSystems::StructArrayLegacyFanModels,
4586 : thisCoolCoil.SupplyFanIndex);
4587 : }
4588 : }
4589 445 : if (this->m_HeatCoilExists) {
4590 348 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed ||
4591 348 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit ||
4592 348 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHP ||
4593 348 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHPSimple ||
4594 348 : this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedHeating ||
4595 174 : this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_HeatingEmpirical) {
4596 28 : this->m_HeatPump = true;
4597 : }
4598 : }
4599 :
4600 : // Push heating coil PLF curve index to DX coil
4601 445 : if (HeatingCoilPLFCurveIndex > 0) {
4602 2 : thisCoolCoil.HeatingCoilPLFCurvePTR = HeatingCoilPLFCurveIndex;
4603 : }
4604 : }
4605 445 : } // IF (IsNotOK) THEN
4606 :
4607 146 : } else if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_Cooling) {
4608 50 : ValidateComponent(state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, isNotOK, cCurrentModuleObject);
4609 50 : if (isNotOK) {
4610 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4611 0 : errorsFound = true;
4612 :
4613 : } else {
4614 : // // call CoilCoolingDX constructor
4615 50 : this->m_CoolingCoilIndex = CoilCoolingDX::factory(state, this->m_CoolingCoilName);
4616 50 : if (this->m_CoolingCoilIndex == -1) {
4617 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4618 0 : errorsFound = true;
4619 : } else {
4620 :
4621 : // mine data from coil object
4622 : // TODO: Need to check for autosize on these I guess
4623 50 : auto &newCoil = state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex];
4624 50 : this->m_DesignCoolingCapacity = newCoil.performance.normalMode.ratedGrossTotalCap;
4625 50 : this->m_MaxCoolAirVolFlow = newCoil.performance.normalMode.ratedEvapAirFlowRate;
4626 50 : if (this->m_DesignCoolingCapacity == DataSizing::AutoSize) this->m_RequestAutoSize = true;
4627 50 : if (this->m_MaxCoolAirVolFlow == DataSizing::AutoSize) this->m_RequestAutoSize = true;
4628 50 : this->m_CoolingCoilAvailSchPtr = newCoil.availScheduleIndex;
4629 50 : CoolingCoilInletNode = newCoil.evapInletNodeIndex;
4630 50 : CoolingCoilOutletNode = newCoil.evapOutletNodeIndex;
4631 50 : this->m_CondenserNodeNum = newCoil.condInletNodeIndex;
4632 50 : this->m_NumOfSpeedCooling = (int)newCoil.performance.normalMode.speeds.size();
4633 50 : this->m_MinOATCompressorCooling = newCoil.performance.minOutdoorDrybulb;
4634 50 : newCoil.supplyFanName = this->m_FanName;
4635 50 : newCoil.supplyFanIndex = this->m_FanIndex;
4636 50 : newCoil.supplyFanType = this->m_FanType_Num;
4637 50 : if (newCoil.SubcoolReheatFlag) {
4638 1 : this->m_Humidistat = true;
4639 1 : if (this->m_NumOfSpeedCooling > 1) {
4640 0 : this->FullOutput.resize(this->m_NumOfSpeedCooling + 1);
4641 0 : this->FullLatOutput.resize(this->m_NumOfSpeedCooling + 1);
4642 0 : this->SpeedSHR.resize(this->m_NumOfSpeedCooling + 1);
4643 : }
4644 1 : if (this->m_ControlType == UnitarySysCtrlType::Setpoint) {
4645 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
4646 0 : ShowContinueError(state,
4647 : "Setpoint control is not available for SubcoolReheat cooling coil. Load control is forced. "
4648 : "Simulation continues.");
4649 0 : this->m_ControlType = UnitarySysCtrlType::Load;
4650 : }
4651 : }
4652 50 : newCoil.setData(this->m_FanIndex, this->m_FanType_Num, this->m_FanName, this->m_SuppCoilPlantLoc.loopNum);
4653 :
4654 : // Push heating coil PLF curve index to DX coil
4655 : // if ( HeatingCoilPLFCurveIndex > 0 ) {
4656 : // SetDXCoolingCoilData( UnitarySystem( UnitarySysNum ).CoolingCoilIndex, ErrorsFound,
4657 : // HeatingCoilPLFCurveIndex );
4658 : // }
4659 : }
4660 :
4661 50 : if (state.dataGlobal->DoCoilDirectSolutions && this->m_NumOfSpeedCooling > 1) {
4662 0 : this->FullOutput.resize(this->m_NumOfSpeedCooling + 1);
4663 : }
4664 :
4665 50 : if (this->m_HeatCoilExists) {
4666 96 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed ||
4667 96 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit ||
4668 96 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHP ||
4669 96 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHPSimple ||
4670 89 : this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedHeating ||
4671 41 : this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_HeatingEmpirical) {
4672 19 : this->m_HeatPump = true;
4673 : }
4674 : }
4675 : }
4676 :
4677 96 : } else if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_CoolingTwoStageWHumControl) {
4678 9 : ValidateComponent(state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, isNotOK, cCurrentModuleObject);
4679 9 : if (isNotOK) {
4680 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4681 0 : errorsFound = true;
4682 :
4683 : } else { // mine data from DX cooling coil
4684 :
4685 : // Get DX cooling coil index
4686 9 : DXCoils::GetDXCoilIndex(state, this->m_CoolingCoilName, this->m_CoolingCoilIndex, isNotOK);
4687 9 : if (isNotOK) {
4688 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4689 0 : errorsFound = true;
4690 : } else {
4691 9 : auto &thisCoolCoil = state.dataDXCoils->DXCoil(this->m_CoolingCoilIndex);
4692 9 : this->m_CoolingCoilAvailSchPtr = thisCoolCoil.SchedPtr;
4693 9 : this->m_DesignCoolingCapacity = thisCoolCoil.RatedTotCap(thisCoolCoil.NumCapacityStages);
4694 9 : if (this->m_DesignCoolingCapacity == DataSizing::AutoSize) this->m_RequestAutoSize = true;
4695 9 : this->m_MaxCoolAirVolFlow = thisCoolCoil.RatedAirVolFlowRate(1);
4696 9 : if (this->m_MaxCoolAirVolFlow == DataSizing::AutoSize) this->m_RequestAutoSize = true;
4697 9 : CoolingCoilInletNode = thisCoolCoil.AirInNode;
4698 9 : CoolingCoilOutletNode = thisCoolCoil.AirOutNode;
4699 9 : this->m_CondenserNodeNum = thisCoolCoil.CondenserInletNodeNum(1);
4700 :
4701 : // Push heating coil PLF curve index to DX coil
4702 9 : if (HeatingCoilPLFCurveIndex > 0) {
4703 0 : thisCoolCoil.HeatingCoilPLFCurvePTR = HeatingCoilPLFCurveIndex;
4704 : }
4705 :
4706 9 : if (this->m_HeatCoilExists) {
4707 0 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed ||
4708 0 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit ||
4709 0 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHP ||
4710 0 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHPSimple ||
4711 0 : this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedHeating ||
4712 0 : this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_HeatingEmpirical) {
4713 0 : this->m_HeatPump = true;
4714 : }
4715 : }
4716 : }
4717 : } // IF (IsNotOK) THEN
4718 :
4719 87 : } else if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_CoolingHXAssisted) {
4720 2 : ValidateComponent(state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, isNotOK, cCurrentModuleObject);
4721 2 : if (isNotOK) {
4722 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4723 0 : errorsFound = true;
4724 :
4725 : } else { // mine data from heat exchanger assisted cooling coil
4726 :
4727 : // Get DX heat exchanger assisted cooling coil index
4728 2 : errFlag = false;
4729 2 : HVACHXAssistedCoolingCoil::GetHXDXCoilIndex(state, this->m_CoolingCoilName, this->m_CoolingCoilIndex, isNotOK);
4730 2 : if (isNotOK) {
4731 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4732 0 : errorsFound = true;
4733 : }
4734 :
4735 2 : errFlag = false;
4736 : std::string ChildCoolingCoilName =
4737 4 : HVACHXAssistedCoolingCoil::GetHXDXCoilName(state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, isNotOK);
4738 : std::string ChildCoolingCoilType =
4739 4 : HVACHXAssistedCoolingCoil::GetHXDXCoilType(state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, isNotOK);
4740 2 : if (isNotOK) {
4741 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4742 0 : errorsFound = true;
4743 : }
4744 :
4745 2 : if (UtilityRoutines::SameString(ChildCoolingCoilType, "COIL:COOLING:DX")) {
4746 :
4747 0 : errFlag = false;
4748 0 : int childCCIndex = CoilCoolingDX::factory(state, ChildCoolingCoilName);
4749 0 : if (childCCIndex < 0) {
4750 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4751 0 : errFlag = true;
4752 0 : errorsFound = true;
4753 : }
4754 :
4755 0 : auto &newCoil = state.dataCoilCooingDX->coilCoolingDXs[childCCIndex];
4756 0 : this->m_CoolingCoilAvailSchPtr = newCoil.availScheduleIndex;
4757 :
4758 : // thisSys.m_DesignCoolingCapacity = newCoil.performance.normalMode.ratedGrossTotalCap;
4759 : // Get Coil:Cooling:DX coil air flow rate. Later fields will overwrite this IF input field is present
4760 0 : this->m_MaxCoolAirVolFlow = newCoil.performance.normalMode.ratedEvapAirFlowRate;
4761 : // if (thisSys.m_DesignCoolingCapacity == DataSizing::AutoSize) thisSys.m_RequestAutoSize = true;
4762 0 : if (this->m_MaxCoolAirVolFlow == DataSizing::AutoSize) this->m_RequestAutoSize = true;
4763 :
4764 : // Get Outdoor condenser node from heat exchanger assisted DX coil object
4765 0 : errFlag = false;
4766 0 : this->m_CondenserNodeNum = newCoil.condInletNodeIndex;
4767 :
4768 2 : } else if (UtilityRoutines::SameString(ChildCoolingCoilType, "COIL:COOLING:DX:SINGLESPEED")) {
4769 :
4770 1 : errFlag = false;
4771 1 : this->m_CoolingCoilAvailSchPtr = DXCoils::GetDXCoilAvailSchPtr(state, ChildCoolingCoilType, ChildCoolingCoilName, errFlag);
4772 1 : if (isNotOK) {
4773 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4774 0 : errorsFound = true;
4775 : }
4776 :
4777 : // Get DX coil air flow rate. Later fields will overwrite this IF input field is present
4778 1 : errFlag = false;
4779 1 : this->m_MaxCoolAirVolFlow = DXCoils::GetDXCoilAirFlow(state, ChildCoolingCoilType, ChildCoolingCoilName, errFlag);
4780 1 : if (this->m_MaxCoolAirVolFlow == DataSizing::AutoSize) this->m_RequestAutoSize = true;
4781 1 : if (errFlag) {
4782 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4783 0 : errorsFound = true;
4784 : }
4785 :
4786 : // Get Outdoor condenser node from heat exchanger assisted DX coil object
4787 1 : errFlag = false;
4788 1 : this->m_CondenserNodeNum = DXCoils::GetCoilCondenserInletNode(
4789 : state,
4790 : "COIL:COOLING:DX:SINGLESPEED",
4791 2 : HVACHXAssistedCoolingCoil::GetHXDXCoilName(state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, errFlag),
4792 : errFlag);
4793 :
4794 1 : if (errFlag) {
4795 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4796 0 : errorsFound = true;
4797 : }
4798 :
4799 1 : } else if (UtilityRoutines::SameString(ChildCoolingCoilType, "COIL:COOLING:DX:VARIABLESPEED")) {
4800 1 : this->m_CoolingCoilAvailSchPtr = DataGlobalConstants::ScheduleAlwaysOn;
4801 1 : errFlag = false;
4802 1 : this->m_MaxCoolAirVolFlow =
4803 1 : VariableSpeedCoils::GetCoilAirFlowRateVariableSpeed(state, ChildCoolingCoilType, ChildCoolingCoilName, errFlag);
4804 1 : if (errFlag) {
4805 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4806 0 : errorsFound = true;
4807 : }
4808 1 : this->m_CondenserNodeNum = VariableSpeedCoils::GetVSCoilCondenserInletNode(state, ChildCoolingCoilName, errFlag);
4809 1 : if (errFlag) {
4810 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4811 0 : errorsFound = true;
4812 : }
4813 : }
4814 :
4815 : // Get DX cooling coil capacity
4816 2 : errFlag = false;
4817 2 : this->m_DesignCoolingCapacity =
4818 2 : HVACHXAssistedCoolingCoil::GetCoilCapacity(state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, errFlag);
4819 2 : if (this->m_DesignCoolingCapacity == DataSizing::AutoSize) this->m_RequestAutoSize = true;
4820 2 : if (errFlag) {
4821 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4822 0 : errorsFound = true;
4823 : }
4824 :
4825 : // Get the Cooling Coil Nodes
4826 2 : errFlag = false;
4827 2 : CoolingCoilInletNode =
4828 2 : HVACHXAssistedCoolingCoil::GetCoilInletNode(state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, errFlag);
4829 2 : CoolingCoilOutletNode =
4830 2 : HVACHXAssistedCoolingCoil::GetCoilOutletNode(state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, errFlag);
4831 2 : if (errFlag) {
4832 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4833 0 : errorsFound = true;
4834 : }
4835 :
4836 : // Push heating coil PLF curve index to DX coil
4837 2 : if (HeatingCoilPLFCurveIndex > 0) {
4838 : // get the actual index to the DX cooling coil object
4839 0 : int DXCoilIndex = HVACHXAssistedCoolingCoil::GetActualDXCoilIndex(
4840 0 : state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, errorsFound);
4841 0 : this->m_ActualDXCoilIndexForHXAssisted = DXCoilIndex;
4842 0 : int ActualCoolCoilType = HVACHXAssistedCoolingCoil::GetCoilObjectTypeNum(
4843 0 : state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, errFlag, true);
4844 0 : if (ActualCoolCoilType == DataHVACGlobals::CoilDX_CoolingSingleSpeed) {
4845 0 : DXCoils::SetDXCoolingCoilData(state, DXCoilIndex, errorsFound, HeatingCoilPLFCurveIndex);
4846 : }
4847 : // what could we do for VS coil here? odd thing here
4848 : }
4849 :
4850 2 : if (this->m_HeatCoilExists) {
4851 4 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed ||
4852 4 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit ||
4853 4 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHP ||
4854 4 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHPSimple ||
4855 4 : this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedHeating ||
4856 2 : this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_HeatingEmpirical) {
4857 0 : this->m_HeatPump = true;
4858 : }
4859 : }
4860 :
4861 : } // IF (IsNotOK) THEN
4862 85 : } else if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilWater_CoolingHXAssisted) {
4863 0 : ValidateComponent(state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, isNotOK, cCurrentModuleObject);
4864 0 : if (isNotOK) {
4865 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4866 0 : errorsFound = true;
4867 :
4868 : } else { // mine data from heat exchanger assisted cooling coil
4869 :
4870 0 : errFlag = false;
4871 0 : int ActualCoolCoilType = HVACHXAssistedCoolingCoil::GetCoilObjectTypeNum(
4872 0 : state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, errFlag, true);
4873 : std::string HXCoilName =
4874 0 : HVACHXAssistedCoolingCoil::GetHXDXCoilName(state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, errFlag);
4875 :
4876 0 : if (errFlag) {
4877 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4878 0 : errorsFound = true;
4879 : }
4880 :
4881 : // Get DX heat exchanger assisted cooling coil index
4882 0 : errFlag = false;
4883 0 : HVACHXAssistedCoolingCoil::GetHXDXCoilIndex(state, this->m_CoolingCoilName, this->m_CoolingCoilIndex, errFlag);
4884 0 : if (errFlag) {
4885 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4886 0 : errorsFound = true;
4887 : }
4888 :
4889 0 : errFlag = false;
4890 0 : this->m_CoolingCoilAvailSchPtr =
4891 0 : WaterCoils::GetWaterCoilAvailScheduleIndex(state, DataHVACGlobals::cAllCoilTypes(ActualCoolCoilType), HXCoilName, errFlag);
4892 0 : this->MaxCoolCoilFluidFlow =
4893 0 : WaterCoils::GetCoilMaxWaterFlowRate(state, DataHVACGlobals::cAllCoilTypes(ActualCoolCoilType), HXCoilName, errFlag);
4894 : // Get the Cooling Coil water Inlet Node number
4895 0 : this->CoolCoilFluidInletNode =
4896 0 : WaterCoils::GetCoilWaterInletNode(state, DataHVACGlobals::cAllCoilTypes(ActualCoolCoilType), HXCoilName, errFlag);
4897 0 : if (errFlag) {
4898 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4899 0 : errorsFound = true;
4900 : }
4901 :
4902 : // Get the Cooling Coil Nodes
4903 0 : errFlag = false;
4904 0 : CoolingCoilInletNode =
4905 0 : HVACHXAssistedCoolingCoil::GetCoilInletNode(state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, errFlag);
4906 0 : CoolingCoilOutletNode =
4907 0 : HVACHXAssistedCoolingCoil::GetCoilOutletNode(state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, errFlag);
4908 0 : if (errFlag) {
4909 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4910 0 : errorsFound = true;
4911 : }
4912 :
4913 0 : errFlag = false;
4914 0 : this->m_MaxCoolAirVolFlow =
4915 0 : HVACHXAssistedCoolingCoil::GetHXCoilAirFlowRate(state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, errFlag);
4916 0 : if (this->m_MaxCoolAirVolFlow == DataSizing::AutoSize) {
4917 0 : this->m_RequestAutoSize = true;
4918 0 : this->m_DesignCoolingCapacity = DataSizing::AutoSize;
4919 : }
4920 0 : if (errFlag) {
4921 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4922 0 : errorsFound = true;
4923 : }
4924 :
4925 0 : this->m_CondenserNodeNum = 0;
4926 :
4927 : // Push heating coil PLF curve index to DX coil
4928 0 : if (HeatingCoilPLFCurveIndex > 0) {
4929 : // get the actual index to the DX cooling coil object
4930 0 : int DXCoilIndex = HVACHXAssistedCoolingCoil::GetActualDXCoilIndex(
4931 0 : state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, errorsFound);
4932 0 : this->m_ActualDXCoilIndexForHXAssisted = DXCoilIndex;
4933 0 : int ActualCoolCoilType = HVACHXAssistedCoolingCoil::GetCoilObjectTypeNum(
4934 0 : state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, errFlag, true);
4935 0 : if (ActualCoolCoilType == DataHVACGlobals::CoilDX_CoolingSingleSpeed) {
4936 0 : DXCoils::SetDXCoolingCoilData(state, DXCoilIndex, errorsFound, HeatingCoilPLFCurveIndex);
4937 : }
4938 : // VS coil issue here
4939 : }
4940 :
4941 : } // IF (IsNotOK) THEN
4942 161 : } else if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed ||
4943 76 : this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit) {
4944 12 : ValidateComponent(state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, isNotOK, cCurrentModuleObject);
4945 12 : if (isNotOK) {
4946 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4947 0 : errorsFound = true;
4948 : } else {
4949 12 : errFlag = false;
4950 12 : this->m_CoolingCoilIndex =
4951 12 : VariableSpeedCoils::GetCoilIndexVariableSpeed(state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, errFlag);
4952 12 : if (errFlag) {
4953 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4954 0 : errorsFound = true;
4955 0 : errFlag = false;
4956 : } else {
4957 12 : auto &thisCoolCoil = state.dataVariableSpeedCoils->VarSpeedCoil(this->m_CoolingCoilIndex);
4958 12 : CoolingCoilInletNode = thisCoolCoil.AirInletNodeNum;
4959 12 : CoolingCoilOutletNode = thisCoolCoil.AirOutletNodeNum;
4960 12 : this->m_CondenserNodeNum = thisCoolCoil.CondenserInletNodeNum;
4961 12 : this->m_CoolingCoilAvailSchPtr = DataGlobalConstants::ScheduleAlwaysOn;
4962 12 : this->m_NumOfSpeedCooling = thisCoolCoil.NumOfSpeeds;
4963 12 : if (this->m_NumOfSpeedCooling > 1) {
4964 10 : this->m_MultiOrVarSpeedCoolCoil = true;
4965 : }
4966 12 : this->m_DesignCoolingCapacity = thisCoolCoil.RatedCapCoolTotal;
4967 12 : if (this->m_DesignCoolingCapacity == DataSizing::AutoSize) this->m_RequestAutoSize = true;
4968 12 : this->m_MaxCoolAirVolFlow = thisCoolCoil.RatedAirVolFlowRate;
4969 12 : if (this->m_MaxCoolAirVolFlow == DataSizing::AutoSize) {
4970 8 : this->m_RequestAutoSize = true;
4971 : } else {
4972 12 : this->m_MaxCoolAirVolFlow = thisCoolCoil.MSRatedAirVolFlowRate(thisCoolCoil.NumOfSpeeds) /
4973 8 : thisCoolCoil.MSRatedAirVolFlowRate(thisCoolCoil.NormSpedLevel) *
4974 4 : thisCoolCoil.RatedAirVolFlowRate;
4975 : }
4976 12 : if (this->m_FanExists) { // Set fan info
4977 10 : thisCoolCoil.SupplyFanIndex = this->m_FanIndex;
4978 10 : thisCoolCoil.SupplyFan_TypeNum = this->m_FanType_Num;
4979 10 : thisCoolCoil.SupplyFanName = loc_m_FanName;
4980 : }
4981 : }
4982 : }
4983 :
4984 12 : if (this->m_HeatCoilExists) {
4985 17 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed ||
4986 11 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit ||
4987 8 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHP ||
4988 8 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHPSimple ||
4989 8 : this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedHeating ||
4990 4 : this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_HeatingEmpirical) {
4991 6 : this->m_HeatPump = true;
4992 : }
4993 12 : }
4994 :
4995 73 : } else if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedCooling) {
4996 37 : ValidateComponent(state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, isNotOK, cCurrentModuleObject);
4997 37 : if (isNotOK) {
4998 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
4999 0 : errorsFound = true;
5000 : } else {
5001 37 : errFlag = false;
5002 37 : DXCoils::GetDXCoilIndex(state, this->m_CoolingCoilName, this->m_CoolingCoilIndex, errFlag, input_data.cooling_coil_object_type);
5003 37 : if (errFlag) {
5004 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
5005 0 : errorsFound = true;
5006 0 : errFlag = false;
5007 : } else {
5008 37 : auto &thisCoolCoil = state.dataDXCoils->DXCoil(this->m_CoolingCoilIndex);
5009 37 : this->m_CoolingCoilAvailSchPtr = thisCoolCoil.SchedPtr;
5010 37 : CoolingCoilInletNode = thisCoolCoil.AirInNode;
5011 37 : CoolingCoilOutletNode = thisCoolCoil.AirOutNode;
5012 37 : this->m_DesignCoolingCapacity = thisCoolCoil.MSRatedTotCap(thisCoolCoil.NumOfSpeeds);
5013 37 : if (this->m_DesignCoolingCapacity == DataSizing::AutoSize) this->m_RequestAutoSize = true;
5014 37 : this->m_MaxCoolAirVolFlow = thisCoolCoil.MSRatedAirVolFlowRate(1);
5015 37 : if (this->m_MaxCoolAirVolFlow == DataSizing::AutoSize) this->m_RequestAutoSize = true;
5016 : }
5017 : }
5018 :
5019 37 : if (this->m_HeatCoilExists) {
5020 74 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed ||
5021 74 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit ||
5022 74 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHP ||
5023 74 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHPSimple ||
5024 70 : this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedHeating ||
5025 33 : this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_HeatingEmpirical) {
5026 4 : this->m_HeatPump = true;
5027 : }
5028 : }
5029 :
5030 67 : } else if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWater ||
5031 31 : this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWaterDetailed) {
5032 :
5033 5 : ValidateComponent(state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, isNotOK, cCurrentModuleObject);
5034 5 : if (isNotOK) {
5035 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
5036 0 : errorsFound = true;
5037 : } else { // mine data from Cooling coil object
5038 5 : errFlag = false;
5039 5 : this->m_CoolingCoilIndex =
5040 5 : WaterCoils::GetWaterCoilIndex(state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, errFlag);
5041 5 : if (errFlag) {
5042 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5043 0 : ShowContinueError(state, format("Illegal Cooling Coil Name = {}", this->m_CoolingCoilName));
5044 0 : errorsFound = true;
5045 0 : errFlag = false;
5046 : } else {
5047 5 : auto &thisCoolCoil = state.dataWaterCoils->WaterCoil(this->m_CoolingCoilIndex);
5048 5 : this->m_CoolingCoilAvailSchPtr = thisCoolCoil.SchedPtr;
5049 5 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWater) {
5050 5 : this->m_MaxCoolAirVolFlow = thisCoolCoil.DesAirVolFlowRate;
5051 : }
5052 5 : this->CoolCoilFluidInletNode = thisCoolCoil.WaterInletNodeNum;
5053 5 : bool InletNodeNotControlled = true;
5054 : // CALL CheckCoilWaterInletNode(this->CoolCoilFluidInletNode,InletNodeNotControlled)
5055 5 : if (!InletNodeNotControlled) {
5056 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5057 0 : ShowContinueError(state,
5058 0 : format("{} found for {} = \"{}.\"",
5059 0 : state.dataHVACCtrl->ControllerTypes(DataHVACControllers::ControllerSimple_Type),
5060 : input_data.cooling_coil_object_type,
5061 0 : this->m_CoolingCoilName));
5062 0 : ShowContinueError(state, "...water coil controllers are not used with " + this->UnitType);
5063 0 : errorsFound = true;
5064 : }
5065 5 : this->MaxCoolCoilFluidFlow = thisCoolCoil.MaxWaterVolFlowRate;
5066 5 : if (this->MaxCoolCoilFluidFlow == DataSizing::AutoSize) {
5067 5 : this->m_RequestAutoSize = true;
5068 5 : this->m_DesignCoolingCapacity = DataSizing::AutoSize; // water coils don't have a capacity field, need other logic?
5069 : }
5070 5 : CoolingCoilInletNode = thisCoolCoil.AirInletNodeNum;
5071 5 : CoolingCoilOutletNode = thisCoolCoil.AirOutletNodeNum;
5072 : }
5073 5 : }
5074 31 : } else if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWaterToAirHPSimple) {
5075 22 : ValidateComponent(state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, isNotOK, cCurrentModuleObject);
5076 22 : if (isNotOK) {
5077 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
5078 0 : errorsFound = true;
5079 : } else { // mine data from Cooling coil object
5080 22 : errFlag = false;
5081 22 : this->m_CoolingCoilIndex =
5082 22 : WaterToAirHeatPumpSimple::GetCoilIndex(state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, errFlag);
5083 22 : if (errFlag) {
5084 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5085 0 : ShowContinueError(state, format("Illegal Cooling Coil Name = {}", this->m_CoolingCoilName));
5086 0 : errorsFound = true;
5087 0 : errFlag = false;
5088 : } else {
5089 22 : auto &thisCoolCoil = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(this->m_CoolingCoilIndex);
5090 22 : this->m_CoolingCoilAvailSchPtr = DataGlobalConstants::ScheduleAlwaysOn;
5091 22 : this->m_DesignCoolingCapacity = thisCoolCoil.RatedCapCoolTotal;
5092 :
5093 : // this isn't likely to work on getInput calls but is what happened before
5094 22 : int CompanionHeatingCoil = thisCoolCoil.CompanionHeatingCoilNum;
5095 22 : if (CompanionHeatingCoil > 0) {
5096 0 : if (this->m_DesignCoolingCapacity == DataSizing::AutoSize &&
5097 0 : state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(CompanionHeatingCoil).WAHPPlantType ==
5098 0 : DataPlant::PlantEquipmentType::CoilWAHPHeatingEquationFit &&
5099 0 : state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(CompanionHeatingCoil).RatedCapHeat == DataSizing::AutoSize &&
5100 0 : state.dataSize->DXCoolCap > 0) {
5101 : // Heating coil has not yet been sized, returning the temporary cooling capacity
5102 0 : this->m_DesignCoolingCapacity = state.dataSize->DXCoolCap;
5103 : }
5104 : }
5105 :
5106 : // Get DX coil air flow rate. Later fields will overwrite this IF input field is present
5107 22 : this->m_MaxCoolAirVolFlow = thisCoolCoil.RatedAirVolFlowRate;
5108 22 : if (this->m_MaxCoolAirVolFlow == DataSizing::AutoSize) this->m_RequestAutoSize = true;
5109 22 : CoolingCoilInletNode = thisCoolCoil.AirInletNodeNum;
5110 22 : CoolingCoilOutletNode = thisCoolCoil.AirOutletNodeNum;
5111 : }
5112 : }
5113 :
5114 22 : if (this->m_HeatCoilExists) {
5115 44 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed ||
5116 44 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit ||
5117 44 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHP ||
5118 22 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHPSimple ||
5119 0 : this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedHeating ||
5120 0 : this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_HeatingEmpirical) {
5121 22 : this->m_HeatPump = true;
5122 : }
5123 : }
5124 :
5125 9 : } else if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWaterToAirHP) {
5126 5 : ValidateComponent(state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, isNotOK, cCurrentModuleObject);
5127 5 : if (isNotOK) {
5128 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
5129 0 : errorsFound = true;
5130 : } else { // mine data from Cooling coil object
5131 5 : errFlag = false;
5132 5 : this->m_CoolingCoilIndex =
5133 5 : WaterToAirHeatPump::GetCoilIndex(state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, errFlag);
5134 5 : if (this->m_CoolingCoilIndex == 0) {
5135 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5136 0 : ShowContinueError(state, format("Illegal Cooling Coil Name = {}", this->m_CoolingCoilName));
5137 0 : errorsFound = true;
5138 0 : errFlag = false;
5139 : } else {
5140 5 : auto &thisCoolCoil = state.dataWaterToAirHeatPump->WatertoAirHP(this->m_CoolingCoilIndex);
5141 5 : this->m_CoolingCoilAvailSchPtr = DataGlobalConstants::ScheduleAlwaysOn;
5142 5 : this->m_DesignCoolingCapacity = thisCoolCoil.CoolingCapacity;
5143 5 : CoolingCoilInletNode = thisCoolCoil.AirInletNodeNum;
5144 5 : CoolingCoilOutletNode = thisCoolCoil.AirOutletNodeNum;
5145 : }
5146 : }
5147 :
5148 5 : if (this->m_HeatCoilExists) {
5149 10 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed ||
5150 10 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit ||
5151 5 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHP ||
5152 0 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHPSimple ||
5153 0 : this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedHeating ||
5154 0 : this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_HeatingEmpirical) {
5155 5 : this->m_HeatPump = true;
5156 : }
5157 : }
5158 :
5159 4 : } else if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_UserDefined) {
5160 0 : ValidateComponent(state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, isNotOK, cCurrentModuleObject);
5161 0 : if (isNotOK) {
5162 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
5163 0 : errorsFound = true;
5164 : } else { // mine data from Cooling coil object
5165 0 : errFlag = false;
5166 0 : UserDefinedComponents::GetUserDefinedCoilIndex(
5167 : state, this->m_CoolingCoilName, this->m_CoolingCoilIndex, errFlag, cCurrentModuleObject);
5168 0 : if (errFlag) {
5169 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5170 0 : ShowContinueError(state, format("Illegal Cooling Coil Name = {}", this->m_CoolingCoilName));
5171 0 : errorsFound = true;
5172 0 : errFlag = false;
5173 : } else {
5174 0 : auto &thisCoolCoil = state.dataUserDefinedComponents->UserCoil(this->m_CoolingCoilIndex);
5175 0 : this->m_CoolingCoilAvailSchPtr = DataGlobalConstants::ScheduleAlwaysOn;
5176 : // **** How to get this info ****
5177 : // UnitarySystem( UnitarySysNum ).DesignCoolingCapacity =
5178 : // GetWtoAHPCoilCapacity(CoolingCoilType, this->m_CoolingCoilName, errFlag );
5179 0 : CoolingCoilInletNode = thisCoolCoil.Air(1).InletNodeNum;
5180 0 : CoolingCoilOutletNode = thisCoolCoil.Air(1).OutletNodeNum;
5181 : }
5182 : }
5183 :
5184 4 : } else if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_PackagedThermalStorageCooling) {
5185 4 : ValidateComponent(state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, isNotOK, cCurrentModuleObject);
5186 4 : if (isNotOK) {
5187 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
5188 0 : errorsFound = true;
5189 : } else { // mine data from Cooling coil object
5190 4 : errFlag = false;
5191 4 : PackagedThermalStorageCoil::GetTESCoilIndex(
5192 : state, this->m_CoolingCoilName, this->m_CoolingCoilIndex, errFlag, cCurrentModuleObject);
5193 4 : if (errFlag) {
5194 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5195 0 : ShowContinueError(state, format("Illegal Cooling Coil Name = {}", this->m_CoolingCoilName));
5196 0 : errorsFound = true;
5197 0 : errFlag = false;
5198 : } else {
5199 4 : auto &thisCoolCoil = state.dataPackagedThermalStorageCoil->TESCoil(this->m_CoolingCoilIndex);
5200 4 : this->m_CoolingCoilAvailSchPtr = DataGlobalConstants::ScheduleAlwaysOn;
5201 4 : this->m_MaxCoolAirVolFlow = thisCoolCoil.RatedEvapAirVolFlowRate;
5202 4 : if (thisCoolCoil.CoolingOnlyModeIsAvailable) {
5203 4 : this->m_DesignCoolingCapacity = thisCoolCoil.CoolingOnlyRatedTotCap;
5204 0 : } else if (thisCoolCoil.CoolingAndChargeModeAvailable) {
5205 0 : this->m_DesignCoolingCapacity = thisCoolCoil.CoolingAndChargeRatedTotCap;
5206 0 : } else if (thisCoolCoil.CoolingAndDischargeModeAvailable) {
5207 0 : this->m_DesignCoolingCapacity = thisCoolCoil.CoolingAndDischargeRatedTotCap;
5208 : } else {
5209 0 : this->m_DesignCoolingCapacity = 0.0;
5210 : }
5211 4 : CoolingCoilInletNode = thisCoolCoil.EvapAirInletNodeNum;
5212 4 : CoolingCoilOutletNode = thisCoolCoil.EvapAirOutletNodeNum;
5213 : }
5214 : }
5215 :
5216 : } else { // IF(.NOT. lAlphaBlanks(16))THEN
5217 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5218 : // ShowContinueError(state, "Illegal " + cAlphaFields(iCoolingCoilTypeAlphaNum) + " = " + Alphas(iCoolingCoilTypeAlphaNum));
5219 0 : errorsFound = true;
5220 : }
5221 :
5222 591 : if (!input_data.dx_cooling_coil_system_sensor_node_name.empty()) { // used by CoilSystem:Cooling:DX
5223 287 : this->CoolCtrlNode = NodeInputManager::GetOnlySingleNode(state,
5224 : input_data.dx_cooling_coil_system_sensor_node_name,
5225 : errFlag,
5226 : objType,
5227 : thisObjectName,
5228 : DataLoopNode::NodeFluidType::Air,
5229 : DataLoopNode::ConnectionType::Sensor,
5230 : NodeInputManager::CompFluidStream::Primary,
5231 287 : DataLoopNode::ObjectIsParent);
5232 : } else {
5233 304 : if (SetPointManager::NodeHasSPMCtrlVarType(state, this->AirOutNode, SetPointManager::CtrlVarType::Temp))
5234 90 : this->CoolCtrlNode = this->AirOutNode;
5235 304 : if (SetPointManager::NodeHasSPMCtrlVarType(state, CoolingCoilOutletNode, SetPointManager::CtrlVarType::Temp))
5236 43 : this->CoolCtrlNode = CoolingCoilOutletNode;
5237 : }
5238 :
5239 591 : this->CoolCoilInletNodeNum = CoolingCoilInletNode;
5240 591 : this->CoolCoilOutletNodeNum = CoolingCoilOutletNode;
5241 :
5242 : } else {
5243 1 : this->m_ValidASHRAECoolCoil = false;
5244 : }
5245 :
5246 614 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHPSimple &&
5247 22 : this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWaterToAirHPSimple) {
5248 22 : if (!input_data.heat_pump_coil_water_flow_mode.empty()) {
5249 21 : if (UtilityRoutines::SameString(input_data.heat_pump_coil_water_flow_mode, "Constant")) {
5250 0 : this->m_WaterCyclingMode = DataHVACGlobals::WaterConstant;
5251 21 : } else if (UtilityRoutines::SameString(input_data.heat_pump_coil_water_flow_mode, "Cycling")) {
5252 21 : this->m_WaterCyclingMode = DataHVACGlobals::WaterCycling;
5253 0 : } else if (UtilityRoutines::SameString(input_data.heat_pump_coil_water_flow_mode, "ConstantOnDemand")) {
5254 0 : this->m_WaterCyclingMode = DataHVACGlobals::WaterConstantOnDemand;
5255 : }
5256 : } else {
5257 1 : this->m_WaterCyclingMode = DataHVACGlobals::WaterCycling;
5258 : }
5259 22 : WaterToAirHeatPumpSimple::SetSimpleWSHPData(
5260 : state, this->m_CoolingCoilIndex, errorsFound, this->m_WaterCyclingMode, _, this->m_HeatingCoilIndex);
5261 : }
5262 :
5263 595 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit &&
5264 3 : this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit) {
5265 3 : VariableSpeedCoils::SetVarSpeedCoilData(state, this->m_CoolingCoilIndex, errorsFound, _, this->m_HeatingCoilIndex);
5266 : }
5267 :
5268 : // Add cooling coil to component sets array
5269 592 : if (this->m_CoolCoilExists && this->m_CoolCompNotSetYet) {
5270 591 : if (this->m_CoolingCoilType_Num != DataHVACGlobals::CoilDX_MultiSpeedCooling) {
5271 1108 : BranchNodeConnections::SetUpCompSets(state,
5272 : cCurrentModuleObject,
5273 : thisObjectName,
5274 : input_data.cooling_coil_object_type,
5275 : this->m_CoolingCoilName,
5276 554 : state.dataLoopNodes->NodeID(CoolingCoilInletNode),
5277 554 : state.dataLoopNodes->NodeID(CoolingCoilOutletNode));
5278 : } else {
5279 37 : BranchNodeConnections::SetUpCompSets(state,
5280 : cCurrentModuleObject,
5281 : thisObjectName,
5282 : input_data.cooling_coil_object_type,
5283 : this->m_CoolingCoilName,
5284 : "UNDEFINED",
5285 37 : "UNDEFINED");
5286 : }
5287 591 : this->m_CoolCompNotSetYet = false;
5288 : }
5289 : // Run as 100% DOAS DX coil
5290 592 : if (!UtilityRoutines::SameString(input_data.use_doas_dx_cooling_coil, "Yes")) {
5291 587 : this->m_ISHundredPercentDOASDXCoil = false;
5292 : } else {
5293 5 : if (UtilityRoutines::SameString(input_data.use_doas_dx_cooling_coil, "Yes")) {
5294 5 : this->m_ISHundredPercentDOASDXCoil = true;
5295 5 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) {
5296 0 : ShowWarningError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5297 0 : ShowContinueError(state, "Variable DX Cooling Coil is not supported as 100% DOAS DX coil.");
5298 0 : ShowContinueError(state, "Variable DX Cooling Coil resets Use DOAS DX Cooling Coil = No and the simulation continues.");
5299 0 : this->m_ISHundredPercentDOASDXCoil = false;
5300 : }
5301 0 : } else if (UtilityRoutines::SameString(input_data.use_doas_dx_cooling_coil, "")) {
5302 0 : this->m_ISHundredPercentDOASDXCoil = false;
5303 0 : } else if (UtilityRoutines::SameString(input_data.use_doas_dx_cooling_coil, "No")) {
5304 0 : this->m_ISHundredPercentDOASDXCoil = false;
5305 : }
5306 : }
5307 :
5308 : // considered as as 100% DOAS DX cooling coil
5309 592 : if (this->m_ISHundredPercentDOASDXCoil) {
5310 : // set the system DX Coil application type to the child DX coil
5311 10 : if (!(this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed ||
5312 5 : this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit)) {
5313 5 : DXCoils::SetDXCoilTypeData(state, this->m_CoolingCoilName);
5314 0 : } else if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_Cooling) {
5315 0 : state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].setToHundredPercentDOAS();
5316 : }
5317 : }
5318 : // DOAS DX Cooling Coil Leaving Minimum Air Temperature
5319 592 : this->DesignMinOutletTemp = input_data.minimum_supply_air_temperature;
5320 592 : if (this->m_ControlType != UnitarySysCtrlType::CCMASHRAE && this->DesignMinOutletTemp == DataSizing::AutoSize) {
5321 : // skip error for PTUnits
5322 170 : if (this->m_sysType == SysType::Unitary || this->m_sysType == SysType::CoilCoolingDX || this->m_sysType == SysType::CoilCoolingWater) {
5323 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5324 0 : ShowContinueError(state, "Invalid entry for Minimum Supply Air Temperature = AutoSize.");
5325 0 : ShowContinueError(state, "AutoSizing not allowed when Control Type = Load or Setpoint");
5326 0 : errorsFound = true;
5327 : }
5328 : }
5329 592 : if (this->m_ControlType != UnitarySysCtrlType::CCMASHRAE && this->DesignMinOutletTemp > 7.5) {
5330 0 : ShowWarningError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5331 0 : ShowContinueError(state, format("Invalid entry for Minimum Supply Air Temperature = {:.4R}", this->DesignMinOutletTemp));
5332 0 : ShowContinueError(state, "The minimum supply air temperature will be limited to 7.5C and the simulation continues.");
5333 0 : this->DesignMinOutletTemp = 7.5;
5334 : }
5335 :
5336 : // Get Latent Load Control flag
5337 592 : if (!input_data.latent_load_control.empty()) {
5338 592 : if (UtilityRoutines::SameString(input_data.latent_load_control, "SensibleOnlyLoadControl")) {
5339 574 : this->m_RunOnSensibleLoad = true;
5340 574 : this->m_RunOnLatentLoad = false;
5341 18 : } else if (UtilityRoutines::SameString(input_data.latent_load_control, "LatentOnlyLoadControl")) {
5342 0 : this->m_RunOnSensibleLoad = false;
5343 0 : this->m_RunOnLatentLoad = true;
5344 18 : } else if (UtilityRoutines::SameString(input_data.latent_load_control, "LatentOrSensibleLoadControl")) {
5345 9 : this->m_RunOnSensibleLoad = true;
5346 9 : this->m_RunOnLatentLoad = true;
5347 9 : } else if (UtilityRoutines::SameString(input_data.latent_load_control, "LatentWithSensibleLoadControl")) {
5348 9 : this->m_RunOnSensibleLoad = true;
5349 9 : this->m_RunOnLatentLoad = true;
5350 9 : this->m_RunOnLatentOnlyWithSensible = true;
5351 : }
5352 : }
5353 592 : if (this->m_DehumidControlType_Num == DehumCtrlType::CoolReheat || this->m_DehumidControlType_Num == DehumCtrlType::Multimode) {
5354 48 : if (!this->m_RunOnLatentLoad && !this->m_RunOnLatentOnlyWithSensible && this->m_ControlType == UnitarySysCtrlType::Load) {
5355 0 : ShowWarningError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5356 0 : ShowContinueError(state, "Inconsistent moisture control inputs.");
5357 0 : ShowContinueError(state, format("Dehumidification Control Type = {}", input_data.dehumidification_control_type));
5358 0 : ShowContinueError(state, format("Latent Load Control = {}", input_data.latent_load_control));
5359 0 : ShowContinueError(state, "Humidity/Moisture may not be controlled with these settings.");
5360 : }
5361 : } else {
5362 568 : if ((this->m_RunOnLatentLoad || this->m_RunOnLatentOnlyWithSensible) && this->m_ControlType == UnitarySysCtrlType::Load) {
5363 0 : ShowWarningError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5364 0 : ShowContinueError(state, "Inconsistent moisture control inputs.");
5365 0 : ShowContinueError(state, format("Dehumidification Control Type = {}", input_data.dehumidification_control_type));
5366 0 : ShowContinueError(state, format("Latent Load Control = {}", input_data.latent_load_control));
5367 0 : ShowContinueError(state, "Humidity/Moisture will not be controlled with these settings.");
5368 0 : this->m_RunOnLatentLoad = false;
5369 0 : this->m_RunOnLatentOnlyWithSensible = false;
5370 : }
5371 : }
5372 : // Get reheat coil data if humidistat is used
5373 592 : this->m_SuppHeatCoilName = input_data.supplemental_heating_coil_name;
5374 592 : this->m_SuppHeatCoilTypeName = input_data.supplemental_heating_coil_object_type;
5375 592 : errFlag = false;
5376 :
5377 592 : if (UtilityRoutines::SameString(this->m_SuppHeatCoilTypeName, "Coil:Heating:Water")) {
5378 0 : this->m_SuppHeatCoilType_Num = DataHVACGlobals::Coil_HeatingWater;
5379 592 : } else if (UtilityRoutines::SameString(this->m_SuppHeatCoilTypeName, "Coil:Heating:Steam")) {
5380 0 : this->m_SuppHeatCoilType_Num = DataHVACGlobals::Coil_HeatingSteam;
5381 1737 : } else if (UtilityRoutines::SameString(this->m_SuppHeatCoilTypeName, "Coil:Heating:Fuel") ||
5382 1652 : UtilityRoutines::SameString(this->m_SuppHeatCoilTypeName, "Coil:Heating:Electric") ||
5383 2194 : UtilityRoutines::SameString(this->m_SuppHeatCoilTypeName, "Coil:Heating:Electric:MultiStage") ||
5384 1095 : UtilityRoutines::SameString(this->m_SuppHeatCoilTypeName, "Coil:Heating:DesuperHeater")) {
5385 90 : this->m_SuppHeatCoilType_Num =
5386 90 : HeatingCoils::GetHeatingCoilTypeNum(state, this->m_SuppHeatCoilTypeName, this->m_SuppHeatCoilName, errFlag);
5387 502 : } else if (UtilityRoutines::SameString(this->m_SuppHeatCoilTypeName, "Coil:UserDefined")) {
5388 0 : this->m_SuppHeatCoilType_Num = DataHVACGlobals::Coil_UserDefined;
5389 : }
5390 :
5391 592 : if (!this->m_SuppHeatCoilTypeName.empty() && !this->m_SuppHeatCoilName.empty()) {
5392 :
5393 141 : if (this->m_SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingGasOrOtherFuel ||
5394 56 : this->m_SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingElectric ||
5395 6 : this->m_SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingElectric_MultiStage ||
5396 1 : this->m_SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingDesuperheater) {
5397 :
5398 90 : ValidateComponent(state, this->m_SuppHeatCoilTypeName, this->m_SuppHeatCoilName, isNotOK, cCurrentModuleObject);
5399 90 : if (isNotOK) {
5400 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
5401 0 : errorsFound = true;
5402 :
5403 : } else { // mine data from reheat coil
5404 90 : errFlag = false;
5405 90 : this->m_SuppHeatCoilIndex =
5406 90 : HeatingCoils::GetHeatingCoilIndex(state, this->m_SuppHeatCoilTypeName, this->m_SuppHeatCoilName, errFlag);
5407 90 : if (errFlag) {
5408 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
5409 0 : errorsFound = true;
5410 0 : errFlag = false;
5411 : } else {
5412 90 : auto &thisSuppCoil = state.dataHeatingCoils->HeatingCoil(this->m_SuppHeatCoilIndex);
5413 90 : if (this->m_SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingElectric_MultiStage) {
5414 4 : this->m_DesignSuppHeatingCapacity = thisSuppCoil.MSNominalCapacity(thisSuppCoil.NumOfStages);
5415 4 : this->m_NumOfSpeedSuppHeating = thisSuppCoil.NumOfStages;
5416 : } else {
5417 86 : this->m_DesignSuppHeatingCapacity = thisSuppCoil.NominalCapacity;
5418 : }
5419 90 : if (this->m_DesignSuppHeatingCapacity == DataSizing::AutoSize) this->m_RequestAutoSize = true;
5420 90 : SupHeatCoilInletNode = thisSuppCoil.AirInletNodeNum;
5421 90 : SupHeatCoilOutletNode = thisSuppCoil.AirOutletNodeNum;
5422 : }
5423 : } // IF (IsNotOK) THEN
5424 :
5425 90 : this->m_SuppCoilAirInletNode = SupHeatCoilInletNode;
5426 90 : this->SuppCoilOutletNodeNum = SupHeatCoilOutletNode;
5427 :
5428 0 : } else if (this->m_SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingWater) {
5429 :
5430 0 : ValidateComponent(state, this->m_SuppHeatCoilTypeName, this->m_SuppHeatCoilName, isNotOK, cCurrentModuleObject);
5431 0 : if (isNotOK) {
5432 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
5433 0 : errorsFound = true;
5434 : } else { // mine data from heating coil object
5435 0 : errFlag = false;
5436 0 : this->m_SuppHeatCoilIndex = WaterCoils::GetWaterCoilIndex(state, "COIL:HEATING:WATER", this->m_SuppHeatCoilName, errFlag);
5437 0 : if (errFlag) {
5438 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
5439 0 : errorsFound = true;
5440 0 : errFlag = false;
5441 : } else {
5442 0 : auto &thisSuppCoil = state.dataWaterCoils->WaterCoil(this->m_SuppHeatCoilIndex);
5443 0 : this->m_SuppCoilFluidInletNode = thisSuppCoil.WaterInletNodeNum;
5444 0 : this->m_MaxSuppCoilFluidFlow = thisSuppCoil.MaxWaterVolFlowRate;
5445 0 : if (this->m_MaxSuppCoilFluidFlow == DataSizing::AutoSize) {
5446 0 : this->m_RequestAutoSize = true;
5447 0 : this->m_DesignSuppHeatingCapacity = DataSizing::AutoSize;
5448 : }
5449 0 : SupHeatCoilInletNode = thisSuppCoil.AirInletNodeNum;
5450 0 : this->m_SuppCoilAirInletNode = SupHeatCoilInletNode;
5451 0 : SupHeatCoilOutletNode = thisSuppCoil.AirOutletNodeNum;
5452 0 : this->SuppCoilOutletNodeNum = SupHeatCoilOutletNode;
5453 : }
5454 : }
5455 :
5456 0 : } else if (this->m_SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingSteam) {
5457 :
5458 0 : ValidateComponent(state, this->m_SuppHeatCoilTypeName, this->m_SuppHeatCoilName, isNotOK, cCurrentModuleObject);
5459 0 : if (isNotOK) {
5460 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
5461 0 : errorsFound = true;
5462 : } else { // mine data from heating coil object
5463 0 : errFlag = false;
5464 0 : this->m_SuppHeatCoilIndex = SteamCoils::GetSteamCoilIndex(state, "COIL:HEATING:STEAM", this->m_SuppHeatCoilName, errFlag);
5465 0 : if (errFlag) {
5466 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5467 0 : ShowSevereError(state, format("Illegal Supplemental Heating Coil Name = {}", this->m_SuppHeatCoilName));
5468 0 : errorsFound = true;
5469 0 : errFlag = false;
5470 : } else {
5471 0 : auto &thisSuppCoil = state.dataSteamCoils->SteamCoil(this->m_SuppHeatCoilIndex);
5472 0 : this->m_SuppCoilFluidInletNode = thisSuppCoil.SteamInletNodeNum;
5473 0 : this->m_MaxSuppCoilFluidFlow = thisSuppCoil.MaxSteamVolFlowRate;
5474 0 : if (this->m_MaxSuppCoilFluidFlow == DataSizing::AutoSize) {
5475 0 : this->m_RequestAutoSize = true;
5476 0 : this->m_DesignSuppHeatingCapacity = DataSizing::AutoSize; // not sure if steam coil needs this
5477 : }
5478 0 : if (this->m_MaxSuppCoilFluidFlow > 0.0) {
5479 0 : int SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed
5480 0 : Real64 TempSteamIn = 100.0;
5481 0 : Real64 SteamDensity = FluidProperties::GetSatDensityRefrig(
5482 0 : state, fluidNameSteam, TempSteamIn, 1.0, SteamIndex, "getUnitarySystemInputData");
5483 0 : this->m_MaxSuppCoilFluidFlow = this->m_MaxSuppCoilFluidFlow * SteamDensity;
5484 : }
5485 0 : SupHeatCoilInletNode = thisSuppCoil.AirInletNodeNum;
5486 0 : this->m_SuppCoilAirInletNode = SupHeatCoilInletNode;
5487 0 : SupHeatCoilOutletNode = thisSuppCoil.AirOutletNodeNum;
5488 0 : this->SuppCoilOutletNodeNum = SupHeatCoilOutletNode;
5489 : }
5490 : }
5491 :
5492 0 : } else if (this->m_SuppHeatCoilType_Num == DataHVACGlobals::Coil_UserDefined) {
5493 0 : ValidateComponent(state, this->m_SuppHeatCoilTypeName, this->m_SuppHeatCoilName, isNotOK, cCurrentModuleObject);
5494 0 : if (isNotOK) {
5495 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
5496 0 : errorsFound = true;
5497 : } else { // mine data from Heating coil object
5498 0 : errFlag = false;
5499 0 : UserDefinedComponents::GetUserDefinedCoilIndex(
5500 : state, this->m_SuppHeatCoilName, this->m_SuppHeatCoilIndex, errFlag, cCurrentModuleObject);
5501 0 : if (errFlag) {
5502 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5503 0 : ShowSevereError(state, format("Illegal Supplemental Heating Coil Name = {}", this->m_SuppHeatCoilName));
5504 0 : errorsFound = true;
5505 0 : errFlag = false;
5506 : } else {
5507 0 : auto &thisSuppCoil = state.dataUserDefinedComponents->UserCoil(this->m_SuppHeatCoilIndex);
5508 0 : SupHeatCoilInletNode = thisSuppCoil.Air(1).InletNodeNum;
5509 0 : this->m_SuppCoilAirInletNode = SupHeatCoilInletNode;
5510 0 : SupHeatCoilOutletNode = thisSuppCoil.Air(1).OutletNodeNum;
5511 0 : this->SuppCoilOutletNodeNum = SupHeatCoilOutletNode;
5512 : }
5513 : }
5514 :
5515 : } else { // Illegal reheating coil type
5516 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5517 0 : ShowSevereError(state, format("Illegal Supplemental Heating Coil Type = {}", this->m_SuppHeatCoilTypeName));
5518 0 : errorsFound = true;
5519 : } // IF (this->SuppHeatCoilType_Num == Coil_HeatingGasOrOtherFuel .OR. &, etc.
5520 :
5521 : } // IF(.NOT. lAlphaBlanks(iSuppHeatCoilTypeAlphaNum))THEN
5522 :
5523 592 : if (SetPointManager::NodeHasSPMCtrlVarType(state, this->AirOutNode, SetPointManager::CtrlVarType::Temp))
5524 323 : this->SuppCtrlNode = this->AirOutNode;
5525 592 : if (SetPointManager::NodeHasSPMCtrlVarType(state, SupHeatCoilOutletNode, SetPointManager::CtrlVarType::Temp))
5526 26 : this->SuppCtrlNode = SupHeatCoilOutletNode;
5527 :
5528 : // Add supplemental heating coil to component sets array
5529 592 : if (this->m_SuppCoilExists && this->m_SuppCompNotSetYet) {
5530 180 : BranchNodeConnections::SetUpCompSets(state,
5531 : cCurrentModuleObject,
5532 : thisObjectName,
5533 : this->m_SuppHeatCoilTypeName,
5534 : this->m_SuppHeatCoilName,
5535 90 : state.dataLoopNodes->NodeID(SupHeatCoilInletNode),
5536 90 : state.dataLoopNodes->NodeID(SupHeatCoilOutletNode));
5537 90 : this->m_SuppCompNotSetYet = false;
5538 : }
5539 :
5540 592 : if (this->OAMixerExists) {
5541 : // Set up component set for OA mixer - use OA node and Mixed air node
5542 334 : BranchNodeConnections::SetUpCompSets(state,
5543 : this->UnitType,
5544 : this->Name,
5545 : input_data.oa_mixer_type,
5546 : input_data.oa_mixer_name,
5547 167 : state.dataLoopNodes->NodeID(this->m_OAMixerNodes[0]),
5548 167 : state.dataLoopNodes->NodeID(this->m_OAMixerNodes[3]));
5549 : }
5550 :
5551 : // set fan info for supplemental heating coils
5552 592 : if (this->m_SuppCoilExists && this->m_FanExists) {
5553 180 : state.dataRptCoilSelection->coilSelectionReportObj->setCoilSupplyFanInfo(state,
5554 : this->m_SuppHeatCoilName,
5555 : this->m_SuppHeatCoilTypeName,
5556 : this->m_FanName,
5557 90 : this->m_FanType_Num == DataHVACGlobals::FanType_SystemModelObject
5558 : ? DataAirSystems::ObjectVectorOOFanSystemModel
5559 : : DataAirSystems::StructArrayLegacyFanModels,
5560 : this->m_FanIndex);
5561 : }
5562 :
5563 : // Users may not provide SA flow input fields (below) and leave them blank. Check if other coil is AutoSized first to
5564 : // alieviate input requirements. check if coil has no air flow input (VolFlow = 0) and other coil isDataSizing::AutoSized. If so,
5565 : // use AutoSize for coil with 0 air flow rate. This means that the coils MUST mine the air flow rate if it exists
5566 592 : if (this->m_CoolCoilExists && this->m_HeatCoilExists) {
5567 300 : if (this->m_MaxCoolAirVolFlow == DataSizing::AutoSize && this->m_MaxHeatAirVolFlow == 0 && loc_m_HeatingSAFMethod == "") {
5568 0 : this->m_MaxHeatAirVolFlow = DataSizing::AutoSize;
5569 300 : } else if (this->m_MaxCoolAirVolFlow == 0 && this->m_MaxHeatAirVolFlow == DataSizing::AutoSize && loc_m_CoolingSAFMethod == "") {
5570 0 : this->m_MaxCoolAirVolFlow = DataSizing::AutoSize;
5571 : }
5572 : }
5573 :
5574 : // translate DesignSpecification:ZoneHVAC:Sizing inputs
5575 : // UnitarySystem already has air flow scalable sizing, update locals
5576 : // UnitarySystem does not have capacity sizing, set inputs accordingly
5577 592 : if (this->m_HVACSizingIndex > 0) {
5578 0 : int zoneHVACIndex = this->m_HVACSizingIndex;
5579 0 : auto &zoneHVACSizing = state.dataSize->ZoneHVACSizing(zoneHVACIndex);
5580 0 : switch (zoneHVACSizing.CoolingSAFMethod) {
5581 0 : case DataSizing::None:
5582 0 : break; // do nothing?
5583 0 : case DataSizing::SupplyAirFlowRate:
5584 0 : loc_m_CoolingSAFMethod = "SupplyAirFlowRate";
5585 0 : loc_m_CoolingSAFMethod_SAFlow = zoneHVACSizing.MaxCoolAirVolFlow;
5586 0 : break;
5587 0 : case DataSizing::FlowPerFloorArea:
5588 0 : loc_m_CoolingSAFMethod = "FlowPerFloorArea";
5589 0 : loc_m_CoolingSAFMethod_SAFlowPerFloorArea = zoneHVACSizing.MaxCoolAirVolFlow;
5590 0 : break;
5591 0 : case DataSizing::FractionOfAutosizedCoolingAirflow:
5592 0 : loc_m_CoolingSAFMethod = "FractionOfAutosizedCoolingValue";
5593 0 : loc_m_CoolingSAFMethod_FracOfAutosizedCoolingSAFlow = zoneHVACSizing.MaxCoolAirVolFlow;
5594 0 : break;
5595 0 : case DataSizing::FlowPerCoolingCapacity:
5596 0 : loc_m_CoolingSAFMethod = "FractionOfAutosizedCoolingValue";
5597 0 : loc_m_CoolingSAFMethod_FracOfAutosizedCoolingSAFlow = zoneHVACSizing.MaxCoolAirVolFlow;
5598 0 : break;
5599 0 : default:
5600 : assert(true);
5601 : }
5602 :
5603 0 : switch (zoneHVACSizing.HeatingSAFMethod) {
5604 0 : case DataSizing::None:
5605 0 : break; // do nothing?
5606 0 : case DataSizing::SupplyAirFlowRate:
5607 0 : loc_m_HeatingSAFMethod = "SupplyAirFlowRate";
5608 0 : loc_m_HeatingSAFMethod_SAFlow = zoneHVACSizing.MaxHeatAirVolFlow;
5609 0 : break;
5610 0 : case DataSizing::FlowPerFloorArea:
5611 0 : loc_m_HeatingSAFMethod = "FlowPerFloorArea";
5612 0 : loc_m_HeatingSAFMethod_SAFlowPerFloorArea = zoneHVACSizing.MaxHeatAirVolFlow;
5613 0 : break;
5614 0 : case DataSizing::FractionOfAutosizedHeatingAirflow:
5615 0 : loc_m_HeatingSAFMethod = "FractionOfAutosizedHeatingValue";
5616 0 : loc_m_HeatingSAFMethod_FracOfAutosizedHeatingSAFlow = zoneHVACSizing.MaxHeatAirVolFlow;
5617 0 : break;
5618 0 : case DataSizing::FlowPerHeatingCapacity:
5619 0 : loc_m_HeatingSAFMethod = "FractionOfAutosizedHeatingValue";
5620 0 : loc_m_HeatingSAFMethod_FracOfAutosizedHeatingSAFlow = zoneHVACSizing.MaxHeatAirVolFlow;
5621 0 : break;
5622 0 : default:
5623 : assert(true);
5624 : }
5625 :
5626 0 : switch (zoneHVACSizing.NoCoolHeatSAFMethod) {
5627 0 : case DataSizing::None:
5628 0 : break; // do nothing?
5629 0 : case DataSizing::SupplyAirFlowRate:
5630 0 : loc_m_NoCoolHeatSAFMethod = "SupplyAirFlowRate";
5631 0 : loc_m_NoCoolHeatSAFMethod_SAFlow = zoneHVACSizing.MaxNoCoolHeatAirVolFlow;
5632 0 : break;
5633 0 : case DataSizing::FlowPerFloorArea:
5634 0 : loc_m_NoCoolHeatSAFMethod = "FlowPerFloorArea";
5635 0 : loc_m_NoCoolHeatSAFMethod_SAFlowPerFloorArea = zoneHVACSizing.MaxNoCoolHeatAirVolFlow;
5636 0 : break;
5637 0 : case DataSizing::FractionOfAutosizedCoolingAirflow:
5638 0 : loc_m_NoCoolHeatSAFMethod = "FractionOfAutosizedHeatingValue";
5639 0 : loc_m_NoCoolHeatSAFMethod_FracOfAutosizedHeatingSAFlow = zoneHVACSizing.MaxNoCoolHeatAirVolFlow;
5640 0 : break;
5641 0 : case DataSizing::FractionOfAutosizedHeatingAirflow:
5642 0 : loc_m_NoCoolHeatSAFMethod = "FractionOfAutosizedHeatingValue";
5643 0 : loc_m_NoCoolHeatSAFMethod_FracOfAutosizedHeatingSAFlow = zoneHVACSizing.MaxNoCoolHeatAirVolFlow;
5644 0 : break;
5645 0 : default:
5646 : assert(true);
5647 : }
5648 :
5649 0 : switch (zoneHVACSizing.CoolingCapMethod) {
5650 0 : case DataSizing::CoolingDesignCapacity:
5651 0 : this->m_CoolingCapMethod = DataSizing::CoolingDesignCapacity;
5652 0 : this->m_DesignCoolingCapacity = zoneHVACSizing.ScaledCoolingCapacity;
5653 0 : break;
5654 0 : case DataSizing::CapacityPerFloorArea:
5655 0 : this->m_CoolingCapMethod = DataSizing::CapacityPerFloorArea;
5656 0 : this->m_DesignCoolingCapacity = zoneHVACSizing.ScaledCoolingCapacity * TotalFloorAreaOnAirLoop;
5657 0 : break;
5658 0 : case DataSizing::FractionOfAutosizedCoolingCapacity:
5659 0 : this->m_CoolingCapMethod = DataSizing::FractionOfAutosizedCoolingCapacity;
5660 0 : this->m_DesignCoolingCapacity = zoneHVACSizing.ScaledCoolingCapacity;
5661 0 : break;
5662 0 : default:
5663 : assert(true);
5664 : }
5665 :
5666 0 : switch (zoneHVACSizing.HeatingCapMethod) {
5667 0 : case DataSizing::HeatingDesignCapacity:
5668 0 : this->m_HeatingCapMethod = DataSizing::HeatingDesignCapacity;
5669 0 : this->m_DesignHeatingCapacity = zoneHVACSizing.ScaledHeatingCapacity;
5670 0 : break;
5671 0 : case DataSizing::CapacityPerFloorArea:
5672 0 : this->m_HeatingCapMethod = DataSizing::CapacityPerFloorArea;
5673 0 : this->m_DesignHeatingCapacity = zoneHVACSizing.ScaledHeatingCapacity * TotalFloorAreaOnAirLoop;
5674 0 : break;
5675 0 : case DataSizing::FractionOfAutosizedHeatingCapacity:
5676 0 : this->m_HeatingCapMethod = DataSizing::FractionOfAutosizedHeatingCapacity;
5677 0 : this->m_DesignHeatingCapacity = zoneHVACSizing.ScaledHeatingCapacity;
5678 0 : break;
5679 0 : default:
5680 : assert(true);
5681 : }
5682 : }
5683 :
5684 : // Determine supply air flow rate sizing method for cooling mode
5685 592 : if (UtilityRoutines::SameString(loc_m_CoolingSAFMethod, "SupplyAirFlowRate")) {
5686 300 : this->m_CoolingSAFMethod = DataSizing::SupplyAirFlowRate;
5687 :
5688 300 : if (loc_m_CoolingSAFMethod_SAFlow != -999.0) {
5689 300 : this->m_MaxCoolAirVolFlow = loc_m_CoolingSAFMethod_SAFlow;
5690 300 : if (this->m_MaxCoolAirVolFlow == DataSizing::AutoSize) {
5691 241 : this->m_RequestAutoSize = true;
5692 : } else {
5693 59 : if (this->m_MaxCoolAirVolFlow <= DataHVACGlobals::SmallAirVolFlow && this->m_CoolCoilExists) {
5694 0 : ShowWarningError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5695 0 : ShowContinueError(state, "Input for Cooling Supply Air Flow Rate Method = SupplyAirFlowRate.");
5696 0 : ShowContinueError(
5697 : state,
5698 0 : format("Suspicious Cooling Supply Air Flow Rate = {:.7R} when cooling coil is present.", this->m_MaxCoolAirVolFlow));
5699 : }
5700 59 : if (this->m_MaxCoolAirVolFlow < 0.0) errorsFound = true;
5701 : }
5702 :
5703 : } else {
5704 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5705 0 : ShowContinueError(state, "Input for Cooling Supply Air Flow Rate Method = SupplyAirFlowRate.");
5706 0 : ShowContinueError(state, "Blank field not allowed for Cooling Supply Air Flow Rate.");
5707 0 : errorsFound = true;
5708 : }
5709 292 : } else if (UtilityRoutines::SameString(loc_m_CoolingSAFMethod, "FlowPerFloorArea")) {
5710 :
5711 0 : this->m_CoolingSAFMethod = DataSizing::FlowPerFloorArea;
5712 0 : if (loc_m_CoolingSAFMethod_SAFlowPerFloorArea != -999.0) {
5713 0 : this->m_MaxCoolAirVolFlow = loc_m_CoolingSAFMethod_SAFlowPerFloorArea;
5714 0 : if (this->m_MaxCoolAirVolFlow != DataSizing::AutoSize) {
5715 0 : if (this->m_MaxCoolAirVolFlow <= 0.0001 && this->m_CoolCoilExists) {
5716 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5717 0 : ShowContinueError(state, "Input for Cooling Supply Air Flow Rate Method = FlowPerFloorArea.");
5718 0 : ShowContinueError(
5719 : state,
5720 0 : format("Suspicious Cooling Supply Air Flow Rate Per Floor Area = {:.7R} [m3/s/m2] when cooling coil is present.",
5721 0 : this->m_MaxCoolAirVolFlow));
5722 0 : if (this->m_MaxCoolAirVolFlow < 0.0) errorsFound = true;
5723 : }
5724 0 : this->m_MaxCoolAirVolFlow *= TotalFloorAreaOnAirLoop;
5725 0 : this->m_RequestAutoSize = true;
5726 : // AutoSized input is not allowed
5727 : } else {
5728 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5729 0 : ShowContinueError(state, "Input for Cooling Supply Air Flow Rate Method = FlowPerFloorArea.");
5730 0 : ShowContinueError(state, "Illegal Cooling Supply Air Flow Rate Per Floor Area = Autosize");
5731 0 : errorsFound = true;
5732 : }
5733 : } else {
5734 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5735 0 : ShowContinueError(state, "Input for Cooling Supply Air Flow Rate Method = FlowPerFloorArea.");
5736 0 : ShowContinueError(state, "Blank field not allowed for Cooling Supply Air Flow Rate Per Floor Area.");
5737 0 : errorsFound = true;
5738 : }
5739 292 : } else if (UtilityRoutines::SameString(loc_m_CoolingSAFMethod, "FractionOfAutosizedCoolingValue")) {
5740 :
5741 0 : this->m_CoolingSAFMethod = DataSizing::FractionOfAutosizedCoolingAirflow;
5742 0 : if (loc_m_CoolingSAFMethod_FracOfAutosizedCoolingSAFlow != -999.0) {
5743 0 : this->m_MaxCoolAirVolFlow = loc_m_CoolingSAFMethod_FracOfAutosizedCoolingSAFlow;
5744 0 : if (this->m_MaxCoolAirVolFlow != DataSizing::AutoSize) {
5745 0 : if (this->m_MaxCoolAirVolFlow <= DataHVACGlobals::SmallAirVolFlow && this->m_CoolCoilExists) {
5746 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5747 0 : ShowContinueError(state, "Input for Cooling Supply Air Flow Rate Method = FractionOfAutosizedCoolingValue.");
5748 0 : ShowContinueError(state,
5749 0 : format("Suspicious Cooling Fraction of Autosized Cooling Supply Air Flow Rate = {:.7R} [m3/s/m3] "
5750 : "when cooling coil is present.",
5751 0 : this->m_MaxCoolAirVolFlow));
5752 0 : if (this->m_MaxCoolAirVolFlow < 0.0) errorsFound = true;
5753 : }
5754 0 : this->m_RequestAutoSize = true;
5755 : // AutoSized input is not allowed
5756 : } else {
5757 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5758 0 : ShowContinueError(state, "Input for Cooling Supply Air Flow Rate Method = FractionOfAutosizedCoolingValue.");
5759 0 : ShowContinueError(state, "Illegal Cooling Fraction of Autosized Cooling Supply Air Flow Rate = Autosize");
5760 0 : errorsFound = true;
5761 : }
5762 : } else {
5763 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5764 0 : ShowContinueError(state, "Input for Cooling Supply Air Flow Rate Method = FractionOfAutosizedCoolingValue.");
5765 0 : ShowContinueError(state, "Blank field not allowed for Cooling Fraction of Autosized Cooling Supply Air Flow Rate.");
5766 0 : errorsFound = true;
5767 : }
5768 292 : } else if (UtilityRoutines::SameString(loc_m_CoolingSAFMethod, "FlowPerCoolingCapacity")) {
5769 :
5770 0 : this->m_CoolingSAFMethod = DataSizing::FlowPerCoolingCapacity;
5771 0 : if (loc_m_CoolingSAFMethod_FlowPerCoolingCapacity != -999.0) {
5772 0 : this->m_MaxCoolAirVolFlow = loc_m_CoolingSAFMethod_FlowPerCoolingCapacity;
5773 0 : if (this->m_MaxCoolAirVolFlow != DataSizing::AutoSize) {
5774 0 : if (this->m_MaxCoolAirVolFlow <= 0.00001 && this->m_CoolCoilExists) {
5775 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5776 0 : ShowContinueError(state, "Input for Cooling Supply Air Flow Rate Method = FlowPerCoolingCapacity.");
5777 0 : ShowContinueError(state,
5778 0 : format("Suspicious Cooling Supply Air Flow Rate Per Unit of Capacity = {:.7R} [m3/s/W] when "
5779 : "cooling coil is present.",
5780 0 : this->m_MaxCoolAirVolFlow));
5781 0 : if (this->m_MaxCoolAirVolFlow < 0.0) errorsFound = true;
5782 : }
5783 0 : this->m_RequestAutoSize = true;
5784 : // AutoSized input is not allowed
5785 : } else {
5786 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5787 0 : ShowContinueError(state, "Input for Cooling Supply Air Flow Rate Method = FlowPerCoolingCapacity.");
5788 0 : ShowContinueError(state, "Illegal Cooling Supply Air Flow Rate Per Unit of Capacity = Autosize");
5789 0 : errorsFound = true;
5790 : }
5791 : } else {
5792 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5793 0 : ShowContinueError(state, "Input for Cooling Supply Air Flow Rate Method = FlowPerCoolingCapacity.");
5794 0 : ShowContinueError(state, "Blank field not allowed for Cooling Supply Air Flow Rate Per Unit of Capacity.");
5795 0 : errorsFound = true;
5796 : }
5797 :
5798 292 : } else if (UtilityRoutines::SameString(loc_m_CoolingSAFMethod, "None") || loc_m_CoolingSAFMethod == "") {
5799 292 : this->m_CoolingSAFMethod = DataSizing::None;
5800 292 : if (this->m_CoolCoilExists && this->m_MaxCoolAirVolFlow == 0) {
5801 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5802 0 : if (this->m_HeatCoilExists) {
5803 0 : ShowContinueError(state, "Blank field not allowed for this coil type when heating coil air flow rate is not AutoSized.");
5804 : } else {
5805 0 : ShowContinueError(state, "Blank field not allowed for this type of cooling coil.");
5806 : }
5807 0 : errorsFound = true;
5808 : }
5809 : }
5810 :
5811 : // Determine supply air flow rate sizing method for heating mode
5812 592 : if (UtilityRoutines::SameString(loc_m_HeatingSAFMethod, "SupplyAirFlowRate")) {
5813 300 : this->m_HeatingSAFMethod = DataSizing::SupplyAirFlowRate;
5814 300 : if (loc_m_HeatingSAFMethod_SAFlow != -999.0) {
5815 300 : this->m_MaxHeatAirVolFlow = loc_m_HeatingSAFMethod_SAFlow;
5816 300 : if (this->m_MaxHeatAirVolFlow == DataSizing::AutoSize) {
5817 241 : this->m_RequestAutoSize = true;
5818 : } else {
5819 59 : if (this->m_MaxHeatAirVolFlow <= DataHVACGlobals::SmallAirVolFlow && this->m_HeatCoilExists) {
5820 0 : ShowWarningError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5821 0 : ShowContinueError(state, "Input for Heating Supply Air Flow Rate Method = SupplyAirFlowRate.");
5822 0 : ShowContinueError(
5823 : state,
5824 0 : format("Suspicious Heating Supply Air Flow Rate = {:.7R} when heating coil is present.", this->m_MaxHeatAirVolFlow));
5825 : }
5826 59 : if (this->m_MaxHeatAirVolFlow < 0.0) errorsFound = true;
5827 : }
5828 : } else {
5829 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5830 0 : ShowContinueError(state, "Input for Heating Supply Air Flow Rate Method = SupplyAirFlowRate.");
5831 0 : ShowContinueError(state, "Blank field not allowed for Heating Supply Air Flow Rate.");
5832 0 : errorsFound = true;
5833 : }
5834 292 : } else if (UtilityRoutines::SameString(loc_m_HeatingSAFMethod, "FlowPerFloorArea")) {
5835 0 : this->m_HeatingSAFMethod = DataSizing::FlowPerFloorArea;
5836 0 : if (loc_m_HeatingSAFMethod_SAFlowPerFloorArea != -999.0) {
5837 0 : this->m_MaxHeatAirVolFlow = loc_m_HeatingSAFMethod_SAFlowPerFloorArea;
5838 0 : if (this->m_MaxHeatAirVolFlow != DataSizing::AutoSize) {
5839 0 : if (this->m_MaxHeatAirVolFlow <= 0.0001 && this->m_HeatCoilExists) {
5840 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5841 0 : ShowContinueError(state, "Input for Heating Supply Air Flow Rate Method = FlowPerFloorArea.");
5842 0 : ShowContinueError(
5843 : state,
5844 0 : format("Suspicious Heating Supply Air Flow Rate Per Floor Area = {:.7R} [m3/s/m2] when heating coil is present.",
5845 0 : this->m_MaxHeatAirVolFlow));
5846 : }
5847 0 : if (this->m_MaxHeatAirVolFlow < 0.0) errorsFound = true;
5848 0 : this->m_MaxHeatAirVolFlow *= TotalFloorAreaOnAirLoop;
5849 0 : this->m_RequestAutoSize = true;
5850 : } else {
5851 : // AutoSized input is not allowed
5852 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5853 0 : ShowContinueError(state, "Input for Heating Supply Air Flow Rate Method = FlowPerFloorArea.");
5854 0 : ShowContinueError(state, "Illegal Heating Supply Air Flow Rate Per Floor Area = Autosize");
5855 0 : errorsFound = true;
5856 : }
5857 : } else {
5858 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5859 0 : ShowContinueError(state, "Input for Heating Supply Air Flow Rate Method = FlowPerFloorArea.");
5860 0 : ShowContinueError(state, "Blank field not allowed for Heating Supply Air Flow Rate Per Floor Area.");
5861 0 : errorsFound = true;
5862 : }
5863 292 : } else if (UtilityRoutines::SameString(loc_m_HeatingSAFMethod, "FractionOfAutosizedHeatingValue")) {
5864 0 : this->m_HeatingSAFMethod = DataSizing::FractionOfAutosizedHeatingAirflow;
5865 0 : if (loc_m_HeatingSAFMethod_FracOfAutosizedHeatingSAFlow != -999.0) {
5866 0 : this->m_MaxHeatAirVolFlow = loc_m_HeatingSAFMethod_FracOfAutosizedHeatingSAFlow;
5867 0 : if (this->m_MaxHeatAirVolFlow != DataSizing::AutoSize) {
5868 0 : if (this->m_MaxHeatAirVolFlow <= DataHVACGlobals::SmallAirVolFlow && this->m_HeatCoilExists) {
5869 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5870 0 : ShowContinueError(state, "Input for Heating Supply Air Flow Rate Method = FractionOfAutosizedHeatingValue.");
5871 0 : ShowContinueError(state,
5872 0 : format("Suspicious Heating Fraction of Autosized Heating Supply Air Flow Rate = {:.7R} [m3/s/m3] "
5873 : "when heating coil is present.",
5874 0 : this->m_MaxHeatAirVolFlow));
5875 0 : if (this->m_MaxHeatAirVolFlow < 0.0) errorsFound = true;
5876 : }
5877 0 : this->m_RequestAutoSize = true;
5878 : // AutoSized input is not allowed
5879 : } else {
5880 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5881 0 : ShowContinueError(state, "Input for Heating Supply Air Flow Rate Method = FractionOfAutosizedHeatingValue");
5882 0 : ShowContinueError(state, "Illegal input for Heating Fraction of Autosized Heating Supply Air Flow Rate = Autosize");
5883 0 : errorsFound = true;
5884 : }
5885 : } else {
5886 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5887 0 : ShowContinueError(state, "Input for Heating Supply Air Flow Rate Method = FractionOfAutosizedHeatingValue");
5888 0 : ShowContinueError(state, "Blank field not allowed for Heating Fraction of Autosized Heating Supply Air Flow Rate");
5889 0 : errorsFound = true;
5890 : }
5891 292 : } else if (UtilityRoutines::SameString(loc_m_HeatingSAFMethod, "FlowPerHeatingCapacity")) {
5892 0 : this->m_HeatingSAFMethod = DataSizing::FlowPerHeatingCapacity;
5893 0 : if (loc_m_HeatingSAFMethod_FlowPerHeatingCapacity != -999.0) {
5894 0 : this->m_MaxHeatAirVolFlow = loc_m_HeatingSAFMethod_FlowPerHeatingCapacity;
5895 0 : if (this->m_MaxHeatAirVolFlow != DataSizing::AutoSize) {
5896 0 : if (this->m_MaxHeatAirVolFlow <= 0.00001 && this->m_HeatCoilExists) {
5897 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5898 0 : ShowContinueError(state, "Input for Heating Supply Air Flow Rate Method = FlowPerHeatingCapacity.");
5899 0 : ShowContinueError(state,
5900 0 : format("Suspicious Heating Supply Air Flow Rate Per Unit of Capacity = {:.7R} [m3/s/W] when "
5901 : "heating coil is present.",
5902 0 : this->m_MaxHeatAirVolFlow));
5903 0 : if (this->m_MaxHeatAirVolFlow < 0.0) errorsFound = true;
5904 : }
5905 0 : this->m_RequestAutoSize = true;
5906 : // AutoSized input is not allowed
5907 : } else {
5908 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5909 0 : ShowContinueError(state, "Input for Heating Supply Air Flow Rate Method = FlowPerHeatingCapacity.");
5910 0 : ShowContinueError(state, "Illegal Heating Supply Air Flow Rate Per Unit of Capacity = Autosize");
5911 0 : errorsFound = true;
5912 : }
5913 : } else {
5914 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5915 0 : ShowContinueError(state, "Input for Heating Supply Air Flow Rate Method = FlowPerHeatingCapacity");
5916 0 : ShowContinueError(state, "Blank field not allowed for Heating Supply Air Flow Rate Per Unit of Capacity");
5917 0 : errorsFound = true;
5918 : }
5919 292 : } else if (UtilityRoutines::SameString(loc_m_HeatingSAFMethod, "None") || loc_m_HeatingSAFMethod == "") {
5920 292 : this->m_HeatingSAFMethod = DataSizing::None;
5921 292 : if (this->m_HeatCoilExists && this->m_MaxHeatAirVolFlow == 0) {
5922 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5923 0 : if (loc_m_HeatingSAFMethod == "") {
5924 0 : ShowContinueError(state, "Input for Heating Supply Air Flow Rate Method is blank.");
5925 : } else {
5926 0 : ShowContinueError(state, "Input for Heating Supply Air Flow Rate Method = None.");
5927 : }
5928 0 : if (this->m_CoolCoilExists) {
5929 0 : ShowContinueError(state, "Blank field not allowed for this coil type when cooling coil air flow rate is not AutoSized.");
5930 : } else {
5931 0 : ShowContinueError(state, "Blank field not allowed for this type of heating coil.");
5932 : }
5933 0 : errorsFound = true;
5934 : }
5935 : }
5936 :
5937 : // Determine supply air flow rate sizing method when cooling or heating is not needed
5938 592 : if (UtilityRoutines::SameString(loc_m_NoCoolHeatSAFMethod, "SupplyAirFlowRate")) {
5939 295 : this->m_NoCoolHeatSAFMethod = DataSizing::SupplyAirFlowRate;
5940 295 : if (loc_m_NoCoolHeatSAFMethod_SAFlow != -999.0) {
5941 295 : this->m_MaxNoCoolHeatAirVolFlow = loc_m_NoCoolHeatSAFMethod_SAFlow;
5942 295 : if (this->m_MaxNoCoolHeatAirVolFlow == DataSizing::AutoSize) {
5943 183 : this->m_RequestAutoSize = true;
5944 : } else {
5945 112 : if (this->m_MaxNoCoolHeatAirVolFlow < 0.0) {
5946 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5947 0 : ShowContinueError(state, "Input for No Load Supply Air Flow Rate Method = SupplyAirFlowRate");
5948 0 : ShowContinueError(state, format("Illegal No Load Supply Air Flow Rate = {:.7R}", this->m_MaxNoCoolHeatAirVolFlow));
5949 0 : errorsFound = true;
5950 : }
5951 : }
5952 :
5953 : } else {
5954 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5955 0 : ShowContinueError(state, "Input for No Load Supply Air Flow Rate Method = SupplyAirFlowRate");
5956 0 : ShowContinueError(state, "Blank field not allowed for No Load Supply Air Flow Rate");
5957 0 : errorsFound = true;
5958 : }
5959 297 : } else if (UtilityRoutines::SameString(loc_m_NoCoolHeatSAFMethod, "FlowPerFloorArea")) {
5960 0 : this->m_NoCoolHeatSAFMethod = DataSizing::FlowPerFloorArea;
5961 0 : if (loc_m_NoCoolHeatSAFMethod_SAFlowPerFloorArea != -999.0) {
5962 0 : this->m_MaxNoCoolHeatAirVolFlow = loc_m_NoCoolHeatSAFMethod_SAFlowPerFloorArea;
5963 0 : if (this->m_MaxNoCoolHeatAirVolFlow != DataSizing::AutoSize) {
5964 0 : if (this->m_MaxNoCoolHeatAirVolFlow <= 0.0001) {
5965 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5966 0 : ShowContinueError(state, "Input for No Load Supply Air Flow Rate Method = FlowPerFloorArea.");
5967 0 : ShowContinueError(
5968 : state,
5969 0 : format("Suspicious No Load Supply Air Flow Rate Per Floor Area = {:.7R} [m3/s/m2]", this->m_MaxNoCoolHeatAirVolFlow));
5970 : }
5971 0 : if (this->m_MaxNoCoolHeatAirVolFlow < 0.0) errorsFound = true;
5972 0 : this->m_MaxNoCoolHeatAirVolFlow *= TotalFloorAreaOnAirLoop;
5973 0 : this->m_RequestAutoSize = true;
5974 : } else {
5975 : // AutoSized input is not allowed
5976 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5977 0 : ShowContinueError(state, "Input for No Load Supply Air Flow Rate Method = FlowPerFloorArea.");
5978 0 : ShowContinueError(state, "Illegal No Load Supply Air Flow Rate Per Floor Area = Autosize");
5979 0 : errorsFound = true;
5980 : }
5981 : } else {
5982 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5983 0 : ShowContinueError(state, "Input for No Load Supply Air Flow Rate Method = FlowPerFloorArea.");
5984 0 : ShowContinueError(state, "Blank field not allowed for No Load Supply Air Flow Rate Per Floor Area");
5985 0 : errorsFound = true;
5986 : }
5987 297 : } else if (UtilityRoutines::SameString(loc_m_NoCoolHeatSAFMethod, "FractionOfAutosizedCoolingValue")) {
5988 0 : this->m_NoCoolHeatSAFMethod = DataSizing::FractionOfAutosizedCoolingAirflow;
5989 0 : if (loc_m_NoCoolHeatSAFMethod_FracOfAutosizedCoolingSAFlow != -999.0) {
5990 0 : this->m_MaxNoCoolHeatAirVolFlow = loc_m_NoCoolHeatSAFMethod_FracOfAutosizedCoolingSAFlow;
5991 0 : if (this->m_MaxNoCoolHeatAirVolFlow != DataSizing::AutoSize) {
5992 0 : if (this->m_MaxNoCoolHeatAirVolFlow <= DataHVACGlobals::SmallAirVolFlow) {
5993 0 : ShowWarningError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
5994 0 : ShowContinueError(state, "Input for No Load Supply Air Flow Rate Method = FractionOfAutosizedCoolingValue.");
5995 0 : ShowContinueError(
5996 : state,
5997 0 : format("Suspicious No Load Supply Air Flow Rate Per Unit of Capacity During Cooling Operation = {:.7R} [m3/s/m3].",
5998 0 : this->m_MaxNoCoolHeatAirVolFlow));
5999 0 : if (this->m_MaxNoCoolHeatAirVolFlow < 0.0) errorsFound = true;
6000 : }
6001 0 : this->m_RequestAutoSize = true;
6002 : // AutoSized input is not allowed
6003 : } else {
6004 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6005 0 : ShowContinueError(state, "Input for No Load Supply Air Flow Rate Method = FractionOfAutosizedCoolingValue");
6006 0 : ShowContinueError(state,
6007 : "Illegal input for No Load Supply Air Flow Rate Per Unit of Capacity During Cooling Operation = Autosize");
6008 0 : errorsFound = true;
6009 : }
6010 : } else {
6011 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6012 0 : ShowContinueError(state, "Input for No Load Supply Air Flow Rate Method = FractionOfAutosizedCoolingValue.");
6013 0 : ShowContinueError(state, "Blank field not allowed for No Load Supply Air Flow Rate Per Unit of Capacity During Cooling Operation");
6014 0 : errorsFound = true;
6015 : }
6016 297 : } else if (UtilityRoutines::SameString(loc_m_NoCoolHeatSAFMethod, "FractionOfAutosizedHeatingValue")) {
6017 0 : this->m_NoCoolHeatSAFMethod = DataSizing::FractionOfAutosizedHeatingAirflow;
6018 0 : if (loc_m_NoCoolHeatSAFMethod_FracOfAutosizedHeatingSAFlow != -999.0) {
6019 0 : this->m_MaxNoCoolHeatAirVolFlow = loc_m_NoCoolHeatSAFMethod_FracOfAutosizedHeatingSAFlow;
6020 0 : if (this->m_MaxNoCoolHeatAirVolFlow != DataSizing::AutoSize) {
6021 0 : if (this->m_MaxNoCoolHeatAirVolFlow <= DataHVACGlobals::SmallAirVolFlow) {
6022 0 : ShowWarningError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6023 0 : ShowContinueError(state, "Input for No Load Supply Air Flow Rate Method = FractionOfAutosizedHeatingValue.");
6024 0 : ShowContinueError(
6025 : state,
6026 0 : format("Suspicious No Load Supply Air Flow Rate Per Unit of Capacity During Heating Operation = {:.7R} [m3/s/m3].",
6027 0 : this->m_MaxNoCoolHeatAirVolFlow));
6028 0 : if (this->m_MaxNoCoolHeatAirVolFlow < 0.0) errorsFound = true;
6029 : }
6030 0 : this->m_RequestAutoSize = true;
6031 : // AutoSized input is not allowed
6032 : } else {
6033 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6034 0 : ShowContinueError(state, "Input for No Load Supply Air Flow Rate Method = FractionOfAutosizedHeatingValue");
6035 0 : ShowContinueError(state,
6036 : "Illegal input for No Load Supply Air Flow Rate Per Unit of Capacity During Heating Operation = Autosize");
6037 0 : errorsFound = true;
6038 : }
6039 : } else {
6040 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6041 0 : ShowContinueError(state, "Input for No Load Supply Air Flow Rate Method = FractionOfAutosizedHeatingValue.");
6042 0 : ShowContinueError(state, "Blank field not allowed for No Load Supply Air Flow Rate Per Unit of Capacity During Heating Operation");
6043 0 : errorsFound = true;
6044 : }
6045 297 : } else if (UtilityRoutines::SameString(loc_m_NoCoolHeatSAFMethod, "FlowPerCoolingCapacity")) {
6046 0 : this->m_NoCoolHeatSAFMethod = DataSizing::FlowPerCoolingCapacity;
6047 0 : if (loc_m_NoCoolHeatSAFMethod_FlowPerCoolingCapacity != -999.0) {
6048 0 : this->m_MaxNoCoolHeatAirVolFlow = loc_m_NoCoolHeatSAFMethod_FlowPerCoolingCapacity;
6049 0 : if (this->m_MaxNoCoolHeatAirVolFlow != DataSizing::AutoSize) {
6050 0 : if (this->m_MaxNoCoolHeatAirVolFlow <= 0.00001 && this->m_CoolCoilExists) {
6051 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6052 0 : ShowContinueError(state, "Input for No Load Supply Air Flow Rate Method = FlowPerCoolingCapacity.");
6053 0 : ShowContinueError(
6054 : state,
6055 0 : format("Suspicious No Load Supply Air Flow Rate Per Unit of Capacity During Cooling Operation = {:.7R} [m3/s/W].",
6056 0 : this->m_MaxNoCoolHeatAirVolFlow));
6057 0 : if (this->m_MaxNoCoolHeatAirVolFlow < 0.0) errorsFound = true;
6058 : }
6059 0 : this->m_RequestAutoSize = true;
6060 : // AutoSized input is not allowed
6061 : } else {
6062 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6063 0 : ShowContinueError(state, "Input for No Load Supply Air Flow Rate Method = FlowPerCoolingCapacity.");
6064 0 : ShowContinueError(state, "Illegal No Load Supply Air Flow Rate Per Unit of Capacity During Cooling Operation = Autosize");
6065 0 : errorsFound = true;
6066 : }
6067 : } else {
6068 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6069 0 : ShowContinueError(state, "Input for No Load Supply Air Flow Rate Method = FlowPerCoolingCapacity.");
6070 0 : ShowContinueError(state, "Blank field not allowed for No Load Supply Air Flow Rate Per Unit of Capacity During Cooling Operation");
6071 0 : errorsFound = true;
6072 : }
6073 297 : } else if (UtilityRoutines::SameString(loc_m_NoCoolHeatSAFMethod, "FlowPerHeatingCapacity")) {
6074 0 : this->m_NoCoolHeatSAFMethod = DataSizing::FlowPerHeatingCapacity;
6075 0 : if (loc_m_NoCoolHeatSAFMethod_FlowPerHeatingCapacity != -999.0) {
6076 0 : this->m_MaxNoCoolHeatAirVolFlow = loc_m_NoCoolHeatSAFMethod_FlowPerHeatingCapacity;
6077 0 : if (this->m_MaxNoCoolHeatAirVolFlow != DataSizing::AutoSize) {
6078 0 : if (this->m_MaxNoCoolHeatAirVolFlow <= 0.00001 && this->m_HeatCoilExists) {
6079 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6080 0 : ShowContinueError(state, "Input for No Load Supply Air Flow Rate Method = FlowPerHeatingCapacity.");
6081 0 : ShowContinueError(
6082 : state,
6083 0 : format("Suspicious No Load Supply Air Flow Rate Per Unit of Capacity During Heating Operation = {:.7R} [m3/s/W].",
6084 0 : this->m_MaxNoCoolHeatAirVolFlow));
6085 0 : if (this->m_MaxNoCoolHeatAirVolFlow < 0.0) errorsFound = true;
6086 : }
6087 0 : this->m_RequestAutoSize = true;
6088 : // AutoSized input is not allowed
6089 : } else {
6090 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6091 0 : ShowContinueError(state, "Input for No Load Supply Air Flow Rate Method = FlowPerHeatingCapacity.");
6092 0 : ShowContinueError(state, "Illegal No Load Supply Air Flow Rate Per Unit of Capacity During Heating Operation = Autosize");
6093 0 : errorsFound = true;
6094 : }
6095 : } else {
6096 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6097 0 : ShowContinueError(state, "Input for No Load Supply Air Flow Rate Method = FlowPerHeatingCapacity.");
6098 0 : ShowContinueError(state, "Blank field not allowed for No Load Supply Air Flow Rate Per Unit of Capacity During Heating Operation");
6099 0 : errorsFound = true;
6100 : }
6101 297 : } else if (UtilityRoutines::SameString(loc_m_NoCoolHeatSAFMethod, "None") || loc_m_NoCoolHeatSAFMethod == "") {
6102 297 : this->m_NoCoolHeatSAFMethod = DataSizing::None;
6103 297 : if (this->m_ControlType == UnitarySysCtrlType::CCMASHRAE) {
6104 0 : if (loc_m_NoCoolHeatSAFMethod_SAFlow == -99999.0) { // no load air flow is autosized
6105 0 : this->m_MaxNoCoolHeatAirVolFlow = DataSizing::AutoSize;
6106 0 : this->m_RequestAutoSize = true;
6107 0 : } else if (loc_m_NoCoolHeatSAFMethod_SAFlow == -999.0) { // no load air flow is blank
6108 0 : this->m_MaxNoCoolHeatAirVolFlow = DataSizing::AutoSize;
6109 0 : this->m_RequestAutoSize = true;
6110 0 : ShowWarningError(state, format("Input errors for {}:{}", cCurrentModuleObject, thisObjectName));
6111 0 : ShowContinueError(state, "Control Type = " + input_data.control_type);
6112 0 : ShowContinueError(state, "Input for No Load Supply Air Flow Rate cannot be blank.");
6113 0 : ShowContinueError(state, "Input for No Load Supply Air Flow Rate has been set to AutoSize and the simulation continues.");
6114 0 : } else if (loc_m_NoCoolHeatSAFMethod_SAFlow == 0.0) { // no load air flow for SZVAV cannot be 0
6115 0 : ShowSevereError(state, format("Input errors for {}:{}", cCurrentModuleObject, thisObjectName));
6116 0 : ShowContinueError(state, "Control Type = " + input_data.control_type);
6117 0 : ShowContinueError(state, "Input for No Load Supply Air Flow Rate cannot be 0.");
6118 0 : errorsFound = true;
6119 : }
6120 : }
6121 : }
6122 :
6123 : // check supply air flow calculation method
6124 592 : if (this->m_FanExists) {
6125 300 : if (this->m_CoolCoilExists) {
6126 300 : if (loc_m_CoolingSAFMethod.empty()) {
6127 0 : ShowWarningError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6128 0 : ShowContinueError(state,
6129 : "Method used to determine the cooling supply air flow rate is not specified when cooling coil is present.");
6130 : // check if all cooling flow calc method fields are blank
6131 0 : if (((loc_m_CoolingSAFMethod_SAFlow == -999.0) && (loc_m_CoolingSAFMethod_SAFlowPerFloorArea == -999.0) &&
6132 0 : (loc_m_CoolingSAFMethod_FracOfAutosizedCoolingSAFlow == -999.0) &&
6133 : (loc_m_CoolingSAFMethod_FlowPerCoolingCapacity == -999.0))) {
6134 0 : ShowContinueError(state, "Cooling Supply Air Flow Rate field is blank.");
6135 0 : ShowContinueError(state, "Cooling Supply Air Flow Rate Per Floor Area field is blank.");
6136 0 : ShowContinueError(state, "Cooling Fraction of Autosized Cooling Supply Air Flow Rate field is blank.");
6137 0 : ShowContinueError(state, "Cooling Supply Air Flow Rate Per Unit of Capacity field is blank.");
6138 0 : ShowContinueError(state,
6139 : "Blank field not allowed for all four cooling supply air flow rate calculation methods when "
6140 : "cooling coil is present.");
6141 : }
6142 : }
6143 : // set fan info for cooling coils
6144 600 : state.dataRptCoilSelection->coilSelectionReportObj->setCoilSupplyFanInfo(
6145 : state,
6146 : this->m_CoolingCoilName,
6147 : input_data.cooling_coil_object_type,
6148 : this->m_FanName,
6149 300 : this->m_FanType_Num == DataHVACGlobals::FanType_SystemModelObject ? DataAirSystems::ObjectVectorOOFanSystemModel
6150 : : DataAirSystems::StructArrayLegacyFanModels,
6151 : this->m_FanIndex);
6152 : }
6153 300 : if (this->m_HeatCoilExists) {
6154 300 : if (loc_m_HeatingSAFMethod.empty()) {
6155 0 : ShowWarningError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6156 0 : ShowContinueError(state,
6157 : "Method used to determine the heating supply air flow rate is not specified when heating coil is present.");
6158 : // check if all heating flow calc method fields are blank
6159 0 : if (((loc_m_HeatingSAFMethod_SAFlow == -999.0) && (loc_m_HeatingSAFMethod_SAFlowPerFloorArea == -999.0) &&
6160 0 : (loc_m_HeatingSAFMethod_FracOfAutosizedHeatingSAFlow == -999.0) &&
6161 : (loc_m_HeatingSAFMethod_FlowPerHeatingCapacity == -999.0))) {
6162 0 : ShowContinueError(state, "Heating Supply Air Flow Rate field is blank.");
6163 0 : ShowContinueError(state, "Heating Supply Air Flow Rate Per Floor Area field is blank.");
6164 0 : ShowContinueError(state, "Heating Fraction of Autosized Heating Supply Air Flow Rate field is blank.");
6165 0 : ShowContinueError(state, "Heating Supply Air Flow Rate Per Unit of Capacity field is blank.");
6166 0 : ShowContinueError(state,
6167 : "Blank field not allowed for all four heating supply air flow rate calculation methods when heating "
6168 : "coil is present.");
6169 : }
6170 : }
6171 : // set fan info for heating coils
6172 600 : state.dataRptCoilSelection->coilSelectionReportObj->setCoilSupplyFanInfo(
6173 : state,
6174 : this->m_HeatingCoilName,
6175 : this->m_HeatingCoilTypeName,
6176 : this->m_FanName,
6177 300 : this->m_FanType_Num == DataHVACGlobals::FanType_SystemModelObject ? DataAirSystems::ObjectVectorOOFanSystemModel
6178 : : DataAirSystems::StructArrayLegacyFanModels,
6179 : this->m_FanIndex);
6180 : }
6181 : }
6182 :
6183 : // Fan operating mode (cycling or constant) schedule. IF constant fan, then set AirFlowControl
6184 592 : if (this->m_FanOpModeSchedPtr > 0) {
6185 294 : if (!ScheduleManager::CheckScheduleValueMinMax(state, this->m_FanOpModeSchedPtr, ">=", 0.0, "<=", 0.0)) {
6186 : // set fan operating mode to continuous so sizing can set VS coil data
6187 153 : this->m_FanOpMode = DataHVACGlobals::ContFanCycCoil;
6188 : // set air flow control mode:
6189 : // UseCompressorOnFlow = operate at last cooling or heating air flow requested when compressor is off
6190 : // UseCompressorOffFlow = operate at value specified by user
6191 : // AirFlowControl only valid if fan opmode = ContFanCycComp
6192 153 : if (this->m_MaxNoCoolHeatAirVolFlow == 0.0) {
6193 24 : this->m_AirFlowControl = UseCompFlow::On;
6194 : } else {
6195 129 : this->m_AirFlowControl = UseCompFlow::Off;
6196 : }
6197 : }
6198 : }
6199 :
6200 592 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_Cooling && this->m_DehumidControlType_Num == DehumCtrlType::Multimode) {
6201 4 : int numCoolingCoilModes = state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].getNumModes();
6202 4 : if (numCoolingCoilModes == 1) {
6203 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6204 0 : ShowContinueError(state, format("Illegal Dehumidification Control Type = {}", input_data.dehumidification_control_type));
6205 0 : ShowContinueError(state, "Multimode control must be used with a Heat Exchanger Assisted or Multimode Cooling Coil.");
6206 0 : ShowContinueError(
6207 0 : state, format("Cooling coil named: {} has only one mode", state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].name));
6208 0 : ShowFatalError(state, "Multimode cooling coil error causes program termination");
6209 4 : }
6210 1174 : } else if (this->m_CoolingCoilType_Num != DataHVACGlobals::CoilDX_CoolingHXAssisted &&
6211 1163 : this->m_CoolingCoilType_Num != DataHVACGlobals::CoilDX_CoolingTwoStageWHumControl &&
6212 1154 : this->m_CoolingCoilType_Num != DataHVACGlobals::CoilWater_CoolingHXAssisted &&
6213 577 : this->m_DehumidControlType_Num == DehumCtrlType::Multimode) {
6214 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6215 0 : ShowContinueError(state, format("Illegal Dehumidification Control Type = {}", input_data.dehumidification_control_type));
6216 0 : ShowContinueError(state, "Multimode control must be used with a Heat Exchanger Assisted or Multimode Cooling Coil.");
6217 0 : if (this->m_SuppHeatCoilName == "" && this->m_SuppHeatCoilTypeName == "") {
6218 : } else {
6219 0 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_UserDefined) {
6220 0 : ShowContinueError(state, "Dehumidification control type is assumed to be None and the simulation continues.");
6221 0 : this->m_DehumidControlType_Num = DehumCtrlType::None;
6222 : } else {
6223 0 : ShowContinueError(state, "Dehumidification control type is assumed to be CoolReheat and the simulation continues.");
6224 0 : this->m_DehumidControlType_Num = DehumCtrlType::CoolReheat;
6225 : }
6226 : }
6227 : }
6228 :
6229 : // Check placement of cooling coil with respect to fan placement and dehumidification control type
6230 :
6231 592 : if (this->m_FanExists) {
6232 300 : if (this->m_FanPlace == FanPlace::BlowThru) {
6233 142 : if (FanOutletNode == HeatingCoilInletNode && this->m_DehumidControlType_Num != DehumCtrlType::CoolReheat) {
6234 23 : this->m_CoolingCoilUpstream = false;
6235 : }
6236 158 : } else if (this->m_FanPlace == FanPlace::DrawThru) {
6237 158 : if (HeatingCoilOutletNode == CoolingCoilInletNode && this->m_DehumidControlType_Num != DehumCtrlType::CoolReheat) {
6238 0 : this->m_CoolingCoilUpstream = false;
6239 : }
6240 : }
6241 : } else {
6242 292 : if (HeatingCoilOutletNode == CoolingCoilInletNode && this->m_DehumidControlType_Num != DehumCtrlType::CoolReheat) {
6243 0 : this->m_CoolingCoilUpstream = false;
6244 : }
6245 292 : if (ZoneEquipmentFound) {
6246 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6247 0 : ShowContinueError(state, "ZoneHVAC equipment must contain a fan object.");
6248 0 : ShowContinueError(state, format("specified Supply Fan Object Type = {}", loc_fanType));
6249 0 : ShowContinueError(state, format("specified Supply Fan Name = {}", loc_m_FanName));
6250 0 : errorsFound = true;
6251 : }
6252 : }
6253 :
6254 : // check node connections
6255 592 : if (this->m_FanPlace == FanPlace::BlowThru) {
6256 :
6257 142 : int tmpAirInletNode = this->AirInNode;
6258 142 : if (this->OAMixerExists) {
6259 27 : tmpAirInletNode = this->m_OAMixerNodes[3]; // mixed air node
6260 : }
6261 142 : if (FanInletNode != tmpAirInletNode) {
6262 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6263 0 : if (this->OAMixerExists) {
6264 0 : ShowContinueError(state,
6265 : "When a blow through fan is specified, the fan inlet node name must be the same as the outdoor "
6266 : "air mixer mixed air node name.");
6267 0 : ShowContinueError(state, format("...Fan inlet node name = {}", state.dataLoopNodes->NodeID(FanInletNode)));
6268 0 : ShowContinueError(state, format("...UnitarySystem mixed air node name = {}", state.dataLoopNodes->NodeID(tmpAirInletNode)));
6269 : } else {
6270 0 : ShowContinueError(state,
6271 : "When a blow through fan is specified, the fan inlet node name must be the same as the unitary system "
6272 : "inlet node name.");
6273 0 : ShowContinueError(state, format("...Fan inlet node name = {}", state.dataLoopNodes->NodeID(FanInletNode)));
6274 0 : ShowContinueError(state, format("...UnitarySystem inlet node name = {}", state.dataLoopNodes->NodeID(this->AirInNode)));
6275 : }
6276 0 : errorsFound = true;
6277 : }
6278 142 : if (this->m_CoolingCoilUpstream) {
6279 119 : if (FanOutletNode != CoolingCoilInletNode && this->m_CoolCoilExists && this->m_FanExists) {
6280 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6281 0 : ShowContinueError(state,
6282 : "When a blow through fan is specified, the fan outlet node name must be the same as the cooling coil "
6283 : "inlet node name.");
6284 0 : ShowContinueError(state, format("...Fan outlet node name = {}", state.dataLoopNodes->NodeID(FanOutletNode)));
6285 0 : ShowContinueError(state, format("...Cooling coil inlet node name = {}", state.dataLoopNodes->NodeID(CoolingCoilInletNode)));
6286 0 : errorsFound = true;
6287 : }
6288 119 : if (CoolingCoilOutletNode != HeatingCoilInletNode && this->m_CoolCoilExists && this->m_HeatCoilExists) {
6289 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6290 0 : ShowContinueError(state, "The cooling coil outlet node name must be the same as the heating coil inlet node name.");
6291 0 : ShowContinueError(state, format("...Cooling coil outlet node name = {}", state.dataLoopNodes->NodeID(CoolingCoilOutletNode)));
6292 0 : ShowContinueError(state, format("...Heating coil inlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilInletNode)));
6293 0 : errorsFound = true;
6294 : }
6295 119 : if (this->m_SuppCoilExists) {
6296 74 : if (SupHeatCoilOutletNode != this->AirOutNode) {
6297 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6298 0 : ShowContinueError(state, "The reheat coil outlet node name must be the same as the unitary system outlet node name.");
6299 0 : ShowContinueError(state,
6300 0 : format("...Reheat coil outlet node name = {}" + state.dataLoopNodes->NodeID(SupHeatCoilOutletNode)));
6301 0 : ShowContinueError(state, format("...UnitarySystem outlet node name = {}" + state.dataLoopNodes->NodeID(this->AirOutNode)));
6302 0 : errorsFound = true;
6303 : }
6304 : } else { // IF((this->m_Humidistat ...
6305 : // Heating coil outlet node name must be the same as the Unitary system outlet node name
6306 45 : if (this->m_HeatCoilExists && HeatingCoilOutletNode != this->AirOutNode) {
6307 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6308 0 : ShowContinueError(state,
6309 : "When a blow through fan is specified, the heating coil outlet node name must be the same as the "
6310 : "unitary system outlet node name.");
6311 0 : ShowContinueError(state,
6312 0 : format("...Heating coil outlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilOutletNode)));
6313 0 : ShowContinueError(state, format("...Unitary system outlet node name = {}", state.dataLoopNodes->NodeID(this->AirOutNode)));
6314 0 : errorsFound = true;
6315 : }
6316 : }
6317 : } else { // IF(this->CoolingCoilUpstream)THEN
6318 23 : if (FanOutletNode != HeatingCoilInletNode && this->m_FanExists && this->m_HeatCoilExists) {
6319 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6320 0 : ShowContinueError(state,
6321 : "When a blow through fan is specified, the fan outlet node name must be the same as the heating coil "
6322 : "inlet node name.");
6323 0 : ShowContinueError(state, format("...Fan outlet node name = {}", state.dataLoopNodes->NodeID(FanOutletNode)));
6324 0 : ShowContinueError(state, format("...Heating coil inlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilInletNode)));
6325 0 : errorsFound = true;
6326 : }
6327 23 : if (HeatingCoilOutletNode != CoolingCoilInletNode && this->m_CoolCoilExists && this->m_HeatCoilExists) {
6328 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6329 0 : ShowContinueError(state, "The heating coil outlet node name must be the same as the cooling coil inlet node name.");
6330 0 : ShowContinueError(state, format("...Heating coil outlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilOutletNode)));
6331 0 : ShowContinueError(state, format("...Cooling coil inlet node name = {}", state.dataLoopNodes->NodeID(CoolingCoilInletNode)));
6332 0 : errorsFound = true;
6333 : }
6334 23 : if (CoolingCoilOutletNode != this->AirOutNode && this->m_CoolCoilExists) {
6335 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6336 0 : ShowContinueError(state,
6337 : "When a blow through fan is specified, the cooling coil outlet node name must be the same as the unitary "
6338 : "system outlet node name.");
6339 0 : ShowContinueError(state, format("...Cooling coil outlet node name = {}", state.dataLoopNodes->NodeID(CoolingCoilOutletNode)));
6340 0 : ShowContinueError(state, format("...UnitarySystem outlet node name = {}", state.dataLoopNodes->NodeID(this->AirOutNode)));
6341 0 : errorsFound = true;
6342 : }
6343 : }
6344 :
6345 450 : } else if (this->m_FanPlace == FanPlace::DrawThru) { // ELSE from IF(this->FanPlace .EQ. BlowThru)THEN
6346 :
6347 158 : int tmpAirInletNode = this->AirInNode;
6348 158 : if (this->OAMixerExists) {
6349 140 : tmpAirInletNode = this->m_OAMixerNodes[3]; // mixed air node
6350 : }
6351 158 : if (this->m_CoolingCoilUpstream) {
6352 158 : if (CoolingCoilInletNode != tmpAirInletNode && CoolingCoilInletNode != 0 && this->m_FanExists) {
6353 0 : if (this->OAMixerExists) {
6354 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6355 0 : ShowContinueError(state,
6356 : "When a draw through fan is specified, the cooling coil inlet node name must be the same as the outdoor "
6357 : "air mixer mixed air node name.");
6358 0 : ShowContinueError(state,
6359 0 : format("...Cooling coil inlet node name = {}", state.dataLoopNodes->NodeID(CoolingCoilInletNode)));
6360 0 : ShowContinueError(state, format("...UnitarySystem mixed air node name = {}", state.dataLoopNodes->NodeID(tmpAirInletNode)));
6361 : } else {
6362 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6363 0 : ShowContinueError(state,
6364 : "When a draw through fan is specified, the cooling coil inlet node name must be the same as the unitary "
6365 : "system inlet node name.");
6366 0 : ShowContinueError(state, format("...Cooling coil inlet node name = {}", state.dataLoopNodes->NodeID(CoolingCoilInletNode)));
6367 0 : ShowContinueError(state, format("...UnitarySystem inlet node name = {}", state.dataLoopNodes->NodeID(this->AirInNode)));
6368 : }
6369 0 : errorsFound = true;
6370 : }
6371 158 : if (CoolingCoilOutletNode != HeatingCoilInletNode && this->m_CoolCoilExists && this->m_HeatCoilExists) {
6372 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6373 0 : ShowContinueError(state, "The cooling coil outlet node name must be the same as the heating coil inlet node name.");
6374 0 : ShowContinueError(state, format("...Cooling coil outlet node name = {}", state.dataLoopNodes->NodeID(CoolingCoilOutletNode)));
6375 0 : ShowContinueError(state, format("...Heating coil inlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilInletNode)));
6376 0 : errorsFound = true;
6377 : }
6378 158 : if (HeatingCoilOutletNode != FanInletNode && this->m_HeatCoilExists && this->m_FanExists) {
6379 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6380 0 : ShowContinueError(state,
6381 : "When a draw through fan is specified, the heating coil outlet node name must be the same as the fan "
6382 : "inlet node name.");
6383 0 : ShowContinueError(state, format("...Heating coil outlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilOutletNode)));
6384 0 : ShowContinueError(state, format("...Fan inlet node name = {}", state.dataLoopNodes->NodeID(FanInletNode)));
6385 0 : errorsFound = true;
6386 : }
6387 158 : if (this->m_SuppCoilExists) {
6388 16 : if (FanOutletNode != SupHeatCoilInletNode && this->m_FanExists) {
6389 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6390 0 : ShowContinueError(state,
6391 : "When a draw through fan is specified, the fan outlet node name must be the same as the reheat coil "
6392 : "inlet node name.");
6393 0 : ShowContinueError(state, format("...Fan outlet node name = {}", state.dataLoopNodes->NodeID(FanOutletNode)));
6394 0 : ShowContinueError(state, format("...Reheat coil inlet node name = {}", state.dataLoopNodes->NodeID(SupHeatCoilInletNode)));
6395 0 : errorsFound = true;
6396 : }
6397 16 : if (SupHeatCoilOutletNode != this->AirOutNode) {
6398 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6399 0 : ShowContinueError(state, "The reheat coil outlet node name must be the same as the unitary system outlet node name.");
6400 0 : ShowContinueError(state,
6401 0 : format("...Reheat coil outlet node name = {}", state.dataLoopNodes->NodeID(SupHeatCoilOutletNode)));
6402 0 : ShowContinueError(state, format("...UnitarySystem outlet node name = {}", state.dataLoopNodes->NodeID(this->AirOutNode)));
6403 0 : errorsFound = true;
6404 : }
6405 : } else {
6406 142 : if (FanOutletNode != this->AirOutNode && this->m_FanExists) {
6407 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6408 0 : ShowContinueError(state,
6409 : "When a draw through fan is specified, the fan outlet node name must be the same as the unitary system "
6410 : "outlet node name.");
6411 0 : ShowContinueError(state, format("...Fan outlet node name = {}", state.dataLoopNodes->NodeID(FanOutletNode)));
6412 0 : ShowContinueError(state, format("...Unitary system outlet node name = {}", state.dataLoopNodes->NodeID(this->AirOutNode)));
6413 0 : errorsFound = true;
6414 : }
6415 : }
6416 : } else { // IF(this->CoolingCoilUpstream)THEN
6417 0 : if (HeatingCoilInletNode != tmpAirInletNode && HeatingCoilInletNode != 0 && this->m_FanExists) {
6418 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6419 0 : if (this->OAMixerExists) {
6420 0 : ShowContinueError(state,
6421 : "When a draw through fan is specified, the heating coil inlet node name must be the same as the unitary "
6422 : "system mixer mixed air node name.");
6423 0 : ShowContinueError(state,
6424 0 : format("...Heating coil inlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilInletNode)));
6425 0 : ShowContinueError(state, format("...UnitarySystem mixed air node name = {}", state.dataLoopNodes->NodeID(tmpAirInletNode)));
6426 : } else {
6427 0 : ShowContinueError(state,
6428 : "When a draw through fan is specified, the heating coil inlet node name must be the same as the unitary "
6429 : "system inlet node name.");
6430 0 : ShowContinueError(state, format("...Heating coil inlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilInletNode)));
6431 0 : ShowContinueError(state, format("...UnitarySystem inlet node name = {}", state.dataLoopNodes->NodeID(this->AirInNode)));
6432 : }
6433 0 : errorsFound = true;
6434 : }
6435 0 : if (HeatingCoilOutletNode != CoolingCoilInletNode && this->m_HeatCoilExists && this->m_CoolCoilExists) {
6436 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6437 0 : ShowContinueError(state, "The heating coil outlet node name must be the same as the cooling coil inlet node name.");
6438 0 : ShowContinueError(state, format("...Heating coil outlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilOutletNode)));
6439 0 : ShowContinueError(state, format("...Cooling coil inlet node name = {}", state.dataLoopNodes->NodeID(CoolingCoilInletNode)));
6440 0 : errorsFound = true;
6441 : }
6442 0 : if (CoolingCoilOutletNode != FanInletNode && this->m_CoolCoilExists && this->m_FanExists) {
6443 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6444 0 : ShowContinueError(state,
6445 : "When a draw through fan is specified, the cooling coil outlet node name must be the same as the fan "
6446 : "inlet node name.");
6447 0 : ShowContinueError(state, format("...Cooling coil outlet node name = {}", state.dataLoopNodes->NodeID(CoolingCoilOutletNode)));
6448 0 : ShowContinueError(state, format("...Fan inlet node name = {}", state.dataLoopNodes->NodeID(FanInletNode)));
6449 0 : errorsFound = true;
6450 : }
6451 0 : if (FanOutletNode != this->AirOutNode && this->m_FanExists) {
6452 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6453 0 : ShowContinueError(state,
6454 : "When a draw through fan is specified, the fan outlet node name must be the same as the unitary system "
6455 : "outlet node name.");
6456 0 : ShowContinueError(state, format("...Fan outlet node name = {}", state.dataLoopNodes->NodeID(FanOutletNode)));
6457 0 : ShowContinueError(state, format("...UnitarySystem outlet node name = {}", state.dataLoopNodes->NodeID(this->AirOutNode)));
6458 0 : errorsFound = true;
6459 : }
6460 : }
6461 : } // ELSE from IF(this->FanPlace .EQ. BlowThru)THEN
6462 :
6463 : // Set the unitary system supplemental heater max outlet temperature
6464 : // this field will be 0 if the input is not specified (included) in the input file
6465 : // someone may use a default other than what we intended, allow it to be used
6466 : // so if this field is blank, and the input field is included, read the default, otherwise use 80
6467 : // if (!lNumericBlanks(iDesignMaxOutletTempNumericNum) && NumNumbers > (iDesignMaxOutletTempNumericNum - 1)) {
6468 592 : if (this->m_sysType == SysType::Unitary) {
6469 : // UnitarySystem has a single field for max outlet temp
6470 110 : this->DesignMaxOutletTemp = input_data.maximum_supply_air_temperature;
6471 : } else {
6472 : // PTHP has a field for max outlet temp for supplmental heater and max outlet temp for SZVAV
6473 482 : if (this->m_ControlType == UnitarySysCtrlType::CCMASHRAE) {
6474 0 : this->DesignMaxOutletTemp = input_data.maximum_supply_air_temperature;
6475 : } else {
6476 482 : this->DesignMaxOutletTemp = input_data.maximum_supply_air_temperature_from_supplemental_heater;
6477 : }
6478 : }
6479 592 : if (this->DesignMaxOutletTemp == DataSizing::AutoSize) this->m_RequestAutoSize = true;
6480 : //}
6481 :
6482 : // Set maximum Outdoor air temperature for supplemental heating coil operation
6483 : // this field will be 0 if the input is not specified (included) in the input file
6484 : // someone may use a default other than what we intended, allow it to be used
6485 : // so if this field is blank, and the input field is included, read the default, otherwise use 9999
6486 : // if (!lNumericBlanks(iMaxOATSuppHeatNumericNum) && NumNumbers > (iMaxOATSuppHeatNumericNum - 1)) {
6487 592 : this->m_MaxOATSuppHeat = input_data.maximum_outdoor_dry_bulb_temperature_for_supplemental_heater_operation;
6488 : // Can't let MaxOATSuppHeat default to 21C if using cool reheat since it would shut off supp heater when dehumidifying
6489 : // this may also allow supplemental heater to operate when in heating mode when it should not
6490 592 : if (this->m_MaxOATSuppHeat == 21.0 && this->m_DehumidControlType_Num == DehumCtrlType::CoolReheat) {
6491 13 : this->m_MaxOATSuppHeat = 999.0;
6492 : }
6493 :
6494 651 : if (this->m_MaxCoolAirVolFlow > 0.0 && this->m_MaxHeatAirVolFlow > 0.0 && this->m_MaxNoCoolHeatAirVolFlow >= 0.0 &&
6495 59 : !this->m_RequestAutoSize) {
6496 12 : this->m_DesignFanVolFlowRate = max(this->m_MaxCoolAirVolFlow, this->m_MaxHeatAirVolFlow, this->m_MaxNoCoolHeatAirVolFlow);
6497 580 : } else if (this->m_MaxCoolAirVolFlow > 0.0 && this->m_MaxNoCoolHeatAirVolFlow >= 0.0 && !this->m_RequestAutoSize) {
6498 48 : this->m_DesignFanVolFlowRate = max(this->m_MaxCoolAirVolFlow, this->m_MaxNoCoolHeatAirVolFlow);
6499 532 : } else if (this->m_MaxHeatAirVolFlow > 0.0 && this->m_MaxNoCoolHeatAirVolFlow >= 0.0 && !this->m_RequestAutoSize) {
6500 0 : this->m_DesignFanVolFlowRate = max(this->m_MaxHeatAirVolFlow, this->m_MaxNoCoolHeatAirVolFlow);
6501 : } else {
6502 532 : if (this->m_FanExists && this->m_DesignFanVolFlowRate == 0.0) {
6503 0 : this->m_DesignFanVolFlowRate = DataSizing::AutoSize;
6504 : }
6505 : // need more of this type of warning when flow cannot be determined
6506 532 : if (this->m_MaxHeatAirVolFlow == 0.0 && this->m_HeatCoilExists) {
6507 0 : if (this->m_FanExists) {
6508 0 : if (this->m_CoolCoilExists && this->m_MaxCoolAirVolFlow != DataSizing::AutoSize) {
6509 0 : if (this->m_MaxCoolAirVolFlow == 0.0) {
6510 0 : this->m_MaxHeatAirVolFlow = this->m_DesignFanVolFlowRate;
6511 : }
6512 : }
6513 0 : } else if (this->m_CoolCoilExists) {
6514 0 : this->m_MaxHeatAirVolFlow = this->m_MaxCoolAirVolFlow;
6515 : } else {
6516 0 : if (this->m_HeatingCoilType_Num != DataHVACGlobals::CoilDX_HeatingEmpirical &&
6517 0 : this->m_HeatingCoilType_Num != DataHVACGlobals::CoilDX_MultiSpeedHeating &&
6518 0 : this->m_HeatingCoilType_Num != DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed) {
6519 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6520 0 : ShowContinueError(state,
6521 : "When non-DX heating coils are specified, the heating air flow rate must be entered in Heating "
6522 : "Supply Air Flow Rate Method");
6523 0 : errorsFound = true;
6524 : }
6525 : }
6526 532 : } else if (this->m_MaxHeatAirVolFlow == 0.0 && !this->m_FanExists && !this->m_CoolCoilExists) {
6527 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6528 0 : ShowContinueError(state,
6529 : "When non-DX heating coils are specified, the heating air flow rate must be entered in Heating "
6530 : "Supply Air Flow Rate Method");
6531 : }
6532 : }
6533 :
6534 592 : if (FanVolFlowRate != DataSizing::AutoSize && this->m_FanExists) {
6535 63 : if (FanVolFlowRate < this->m_MaxCoolAirVolFlow && this->m_MaxCoolAirVolFlow != DataSizing::AutoSize && this->m_CoolCoilExists) {
6536 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6537 0 : ShowContinueError(
6538 : state,
6539 0 : format("... air flow rate = {:.7T} in fan object {} is less than the maximum HVAC system air flow rate in cooling mode.",
6540 : FanVolFlowRate,
6541 0 : this->m_FanName));
6542 0 : ShowContinueError(state, " The Cooling Supply Air Flow Rate is reset to the fan flow rate and the simulation continues.");
6543 0 : this->m_MaxCoolAirVolFlow = FanVolFlowRate;
6544 0 : this->m_DesignFanVolFlowRate = FanVolFlowRate;
6545 : }
6546 63 : if (FanVolFlowRate < this->m_MaxHeatAirVolFlow && this->m_MaxHeatAirVolFlow != DataSizing::AutoSize && this->m_HeatCoilExists) {
6547 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6548 0 : ShowContinueError(
6549 : state,
6550 0 : format("... air flow rate = {:.7T} in fan object {} is less than the maximum HVAC system air flow rate in heating mode.",
6551 : FanVolFlowRate,
6552 0 : this->m_FanName));
6553 0 : ShowContinueError(state, " The Heating Supply Air Flow Rate is reset to the fan flow rate and the simulation continues.");
6554 0 : this->m_MaxHeatAirVolFlow = FanVolFlowRate;
6555 0 : this->m_DesignFanVolFlowRate = FanVolFlowRate;
6556 : }
6557 : }
6558 :
6559 592 : if (this->m_FanOpModeSchedPtr > 0) {
6560 294 : if (!ScheduleManager::CheckScheduleValueMinMax(state, this->m_FanOpModeSchedPtr, ">=", 0.0, "<=", 0.0)) {
6561 : // set air flow control mode:
6562 : // UseCompressorOnFlow = operate at last cooling or heating air flow requested when compressor is off
6563 : // UseCompressorOffFlow = operate at value specified by user
6564 : // AirFlowControl only valid IF fan opmode = ContFanCycComp
6565 153 : if (this->m_MaxNoCoolHeatAirVolFlow == 0.0) {
6566 24 : this->m_AirFlowControl = UseCompFlow::On;
6567 : } else {
6568 129 : this->m_AirFlowControl = UseCompFlow::Off;
6569 : }
6570 : }
6571 : }
6572 :
6573 : // Set minimum OAT for heat pump compressor operation in cooling mode
6574 : // get from coil module
6575 592 : errFlag = false;
6576 592 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_CoolingSingleSpeed) {
6577 378 : this->m_MinOATCompressorCooling = DXCoils::GetMinOATCompressor(state, this->m_CoolingCoilIndex, errFlag);
6578 214 : } else if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_CoolingTwoSpeed) {
6579 67 : this->m_MinOATCompressorCooling = DXCoils::GetMinOATCompressor(state, this->m_CoolingCoilIndex, errFlag);
6580 147 : } else if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedCooling) {
6581 37 : this->m_MinOATCompressorCooling = DXCoils::GetMinOATCompressor(state, this->m_CoolingCoilIndex, errFlag);
6582 110 : } else if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_CoolingTwoStageWHumControl) {
6583 9 : this->m_MinOATCompressorCooling = DXCoils::GetMinOATCompressor(state, this->m_CoolingCoilIndex, errFlag);
6584 101 : } else if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) {
6585 9 : this->m_MinOATCompressorCooling = VariableSpeedCoils::GetVSCoilMinOATCompressor(state, this->m_CoolingCoilIndex, errFlag);
6586 92 : } else if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_Cooling) {
6587 : // already found in getInput
6588 : } else {
6589 42 : this->m_MinOATCompressorCooling = -1000.0;
6590 : }
6591 592 : if (errFlag) {
6592 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
6593 0 : errorsFound = true;
6594 : }
6595 :
6596 : // Set minimum OAT for heat pump compressor operation in heating mode
6597 : // get from coil module
6598 592 : errFlag = false;
6599 592 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed) {
6600 3 : this->m_MinOATCompressorHeating = VariableSpeedCoils::GetVSCoilMinOATCompressor(state, this->m_HeatingCoilIndex, errFlag);
6601 1137 : } else if (this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_HeatingEmpirical ||
6602 548 : this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedHeating) {
6603 52 : this->m_MinOATCompressorHeating = DXCoils::GetMinOATCompressor(state, this->m_HeatingCoilIndex, errFlag);
6604 : } else {
6605 537 : this->m_MinOATCompressorHeating = -1000.0;
6606 : }
6607 592 : if (errFlag) {
6608 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
6609 0 : errorsFound = true;
6610 : }
6611 :
6612 : // Mine heatpump Outdoor condenser node from DX coil object
6613 592 : errFlag = false;
6614 592 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_CoolingSingleSpeed) {
6615 378 : this->m_CondenserNodeNum =
6616 378 : DXCoils::GetCoilCondenserInletNode(state, input_data.cooling_coil_object_type, this->m_CoolingCoilName, errFlag);
6617 : // TODO: Should we add a block for the new DX Coil?
6618 214 : } else if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) {
6619 9 : this->m_CondenserNodeNum = VariableSpeedCoils::GetVSCoilCondenserInletNode(state, this->m_CoolingCoilName, errFlag);
6620 205 : } else if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_CoolingHXAssisted) {
6621 : // already filled
6622 : // UnitarySystem( UnitarySysNum ).CondenserNodeNum = GetDXCoilCondenserInletNode( "Coil:Cooling:DX:SingleSpeed",
6623 : // GetHXDXCoilName(state, CoolingCoilType, this->m_CoolingCoilName, errFlag ), errFlag );
6624 :
6625 : } else {
6626 203 : if (input_data.outdoor_dry_bulb_temperature_sensor_node_name != "") {
6627 18 : this->m_CondenserNodeNum = NodeInputManager::GetOnlySingleNode(state,
6628 : input_data.outdoor_dry_bulb_temperature_sensor_node_name,
6629 : errFlag,
6630 : objType,
6631 : thisObjectName,
6632 : DataLoopNode::NodeFluidType::Air,
6633 : DataLoopNode::ConnectionType::Inlet,
6634 : NodeInputManager::CompFluidStream::Primary,
6635 18 : DataLoopNode::ObjectIsParent);
6636 : } else {
6637 : // do nothing?
6638 : }
6639 : }
6640 592 : if (errFlag) {
6641 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
6642 0 : errorsFound = true;
6643 : }
6644 :
6645 592 : this->m_MaxONOFFCyclesperHour = input_data.maximum_cycling_rate; // Set the heatpump cycling rate
6646 592 : this->m_HPTimeConstant = input_data.heat_pump_time_constant; // Set the heat pump time constant
6647 592 : this->m_OnCyclePowerFraction = input_data.fraction_of_on_cycle_power_use; // Set the heat pump on-cycle power use fraction
6648 592 : this->m_FanDelayTime = input_data.heat_pump_fan_delay_time; // Set the heat pump fan delay time
6649 592 : this->m_AncillaryOnPower = input_data.ancillary_on_cycle_electric_power;
6650 592 : this->m_AncillaryOffPower = input_data.ancillary_off_cycle_electric_power;
6651 592 : this->m_MaxHROutletWaterTemp = input_data.maximum_temperature_for_heat_recovery;
6652 :
6653 592 : if (this->m_DesignHRWaterVolumeFlow > 0.0) {
6654 0 : this->m_HeatRecActive = true;
6655 0 : errFlag = false;
6656 0 : if (input_data.heat_recovery_water_inlet_node_name != "" && input_data.heat_recovery_water_outlet_node_name != "") {
6657 0 : this->m_HeatRecoveryInletNodeNum = NodeInputManager::GetOnlySingleNode(state,
6658 : input_data.heat_recovery_water_inlet_node_name,
6659 : errFlag,
6660 : objType,
6661 : thisObjectName,
6662 : DataLoopNode::NodeFluidType::Water,
6663 : DataLoopNode::ConnectionType::Inlet,
6664 : NodeInputManager::CompFluidStream::Tertiary,
6665 0 : DataLoopNode::ObjectIsNotParent);
6666 0 : this->m_HeatRecoveryOutletNodeNum = NodeInputManager::GetOnlySingleNode(state,
6667 : input_data.heat_recovery_water_outlet_node_name,
6668 : errFlag,
6669 : objType,
6670 : thisObjectName,
6671 : DataLoopNode::NodeFluidType::Water,
6672 : DataLoopNode::ConnectionType::Outlet,
6673 : NodeInputManager::CompFluidStream::Tertiary,
6674 0 : DataLoopNode::ObjectIsNotParent);
6675 :
6676 0 : BranchNodeConnections::TestCompSet(state,
6677 : cCurrentModuleObject,
6678 : thisObjectName,
6679 : input_data.heat_recovery_water_inlet_node_name,
6680 : input_data.heat_recovery_water_outlet_node_name,
6681 : "Unitary System Heat Recovery Nodes");
6682 :
6683 0 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedCooling) {
6684 0 : DXCoils::SetMSHPDXCoilHeatRecoveryFlag(state, this->m_CoolingCoilIndex);
6685 : }
6686 0 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedHeating) {
6687 0 : DXCoils::SetMSHPDXCoilHeatRecoveryFlag(state, this->m_HeatingCoilIndex);
6688 : }
6689 0 : if (errFlag) {
6690 0 : ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName));
6691 0 : errorsFound = true;
6692 : }
6693 : } else {
6694 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6695 0 : ShowContinueError(state, format("Illegal Heat Recovery Water Inlet Node Name = {}", input_data.heat_recovery_water_inlet_node_name));
6696 0 : ShowContinueError(state,
6697 0 : format("Illegal Heat Recovery Water Outlet Node Name = {}", input_data.heat_recovery_water_outlet_node_name));
6698 0 : ShowContinueError(state,
6699 : "... heat recovery nodes must be specified when Design Heat Recovery Water Flow Rate"
6700 : " is greater than 0.");
6701 0 : ShowContinueError(state, format("... Design Heat Recovery Water Flow Rate = {:.7R}", this->m_DesignHRWaterVolumeFlow));
6702 0 : errorsFound = true;
6703 : }
6704 : }
6705 :
6706 592 : if (!this->m_DesignSpecMultispeedHPType.empty() && !this->m_DesignSpecMultispeedHPName.empty()) {
6707 :
6708 55 : if (this->m_DesignSpecMSHPIndex > -1) {
6709 :
6710 55 : this->m_NoLoadAirFlowRateRatio = this->m_CompPointerMSHP->noLoadAirFlowRateRatio;
6711 :
6712 99 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedHeating ||
6713 88 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingElectric_MultiStage ||
6714 44 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingGas_MultiStage) {
6715 11 : this->m_NumOfSpeedHeating = this->m_CompPointerMSHP->numOfSpeedHeating;
6716 11 : this->m_HeatMassFlowRate.resize(this->m_NumOfSpeedHeating + 1);
6717 11 : this->m_HeatVolumeFlowRate.resize(this->m_NumOfSpeedHeating + 1);
6718 11 : this->m_MSHeatingSpeedRatio.resize(this->m_NumOfSpeedHeating + 1);
6719 11 : if (state.dataGlobal->DoCoilDirectSolutions && this->m_NumOfSpeedCooling < this->m_NumOfSpeedHeating) {
6720 0 : this->FullOutput.resize(this->m_NumOfSpeedHeating + 1);
6721 : }
6722 47 : for (int i = 1; i <= this->m_NumOfSpeedHeating; ++i) {
6723 36 : this->m_HeatMassFlowRate[i] = 0.0;
6724 36 : this->m_HeatVolumeFlowRate[i] = 0.0;
6725 36 : this->m_MSHeatingSpeedRatio[i] = 1.0;
6726 : }
6727 : }
6728 :
6729 55 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedCooling) {
6730 37 : this->m_NumOfSpeedCooling = this->m_CompPointerMSHP->numOfSpeedCooling;
6731 37 : this->m_CoolMassFlowRate.resize(this->m_NumOfSpeedCooling + 1);
6732 37 : this->m_CoolVolumeFlowRate.resize(this->m_NumOfSpeedCooling + 1);
6733 37 : this->m_MSCoolingSpeedRatio.resize(this->m_NumOfSpeedCooling + 1);
6734 37 : if (state.dataGlobal->DoCoilDirectSolutions && this->m_NumOfSpeedCooling > this->m_NumOfSpeedHeating) {
6735 0 : this->FullOutput.resize(this->m_NumOfSpeedCooling + 1);
6736 0 : DXCoils::DisableLatentDegradation(state, this->m_CoolingCoilIndex);
6737 : }
6738 112 : for (int i = 1; i <= this->m_NumOfSpeedCooling; ++i) {
6739 75 : this->m_CoolMassFlowRate[i] = 0.0;
6740 75 : this->m_CoolVolumeFlowRate[i] = 0.0;
6741 75 : this->m_MSCoolingSpeedRatio[i] = 1.0;
6742 : }
6743 : }
6744 : } else {
6745 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6746 0 : ShowContinueError(state, "... one or both of the following inputs are invalid.");
6747 0 : ShowContinueError(state, format("Field Design Specification Multispeed Object Type = {}", this->m_DesignSpecMultispeedHPType));
6748 0 : ShowContinueError(state, format("Field Design Specification Multispeed Object Name = {}", this->m_DesignSpecMultispeedHPName));
6749 0 : errorsFound = true;
6750 : }
6751 1074 : } else if ((this->m_DesignSpecMultispeedHPType.empty() && !this->m_DesignSpecMultispeedHPName.empty()) ||
6752 537 : (!this->m_DesignSpecMultispeedHPType.empty() && this->m_DesignSpecMultispeedHPName.empty())) {
6753 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6754 0 : ShowContinueError(state, "... one or both of the following inputs are invalid.");
6755 0 : ShowContinueError(state, format("Field Design Specification Multispeed Object Type = {}", this->m_DesignSpecMultispeedHPType));
6756 0 : ShowContinueError(state, format("Field Design Specification Multispeed Object Name = {}", this->m_DesignSpecMultispeedHPName));
6757 0 : errorsFound = true;
6758 : }
6759 :
6760 592 : if (this->m_DiscreteSpeedCoolingCoil) {
6761 :
6762 70 : if (this->m_NumOfSpeedCooling == 0) {
6763 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6764 0 : ShowContinueError(state,
6765 0 : "... Cooling coil object type requires valid " + std::string{unitarySysHeatPumpPerformanceObjectType} +
6766 : " for cooling to be specified with number of speeds > 0");
6767 0 : errorsFound = true;
6768 : }
6769 : }
6770 592 : if (this->m_MultiSpeedHeatingCoil) {
6771 :
6772 12 : if (this->m_DesignSpecMSHPIndex > -1) this->m_NumOfSpeedHeating = this->m_CompPointerMSHP->numOfSpeedHeating;
6773 :
6774 12 : if (this->m_NumOfSpeedHeating == 0) {
6775 0 : ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6776 0 : ShowContinueError(state,
6777 0 : "... Heating coil object type requires valid " + std::string{unitarySysHeatPumpPerformanceObjectType} +
6778 : " for heating to be specified with number of speeds > 0");
6779 0 : errorsFound = true;
6780 : }
6781 : }
6782 :
6783 603 : if ((this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedHeating &&
6784 18 : (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedCooling ||
6785 588 : this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_Cooling)) ||
6786 657 : (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingGasOrOtherFuel &&
6787 120 : (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedCooling ||
6788 44 : this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_Cooling))) {
6789 128 : if (this->m_DesignSpecMSHPIndex > -1) {
6790 50 : if (this->m_CompPointerMSHP->m_SingleModeFlag) {
6791 1 : this->m_SingleMode = 1;
6792 : }
6793 : }
6794 : } else {
6795 528 : if (this->m_DesignSpecMSHPIndex > -1) {
6796 5 : if (this->m_CompPointerMSHP->m_SingleModeFlag) {
6797 0 : ShowSevereError(state, format("{}: {}", cCurrentModuleObject, thisObjectName));
6798 0 : ShowContinueError(state,
6799 : "In order to perform Single Mode Operation, the valid cooling coil type is Coil:Cooling:DX:MultiSpeed "
6800 : "or Coil:Cooling:DX and the valid heating is Coil:Heating:DX:MultiSpeed or Coil:Heating:Fuel.");
6801 0 : ShowContinueError(state,
6802 0 : format("The input cooling coil type = {} and the input heating coil type = {}",
6803 : input_data.cooling_coil_object_type,
6804 0 : this->m_HeatingCoilTypeName));
6805 : }
6806 : }
6807 : }
6808 :
6809 592 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) {
6810 9 : VariableSpeedCoils::SetVarSpeedCoilData(state, this->m_CoolingCoilIndex, errorsFound, _, _, this->m_DesignSpecMSHPIndex);
6811 : }
6812 :
6813 592 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed) {
6814 3 : VariableSpeedCoils::SetVarSpeedCoilData(state, this->m_HeatingCoilIndex, errorsFound, _, _, this->m_DesignSpecMSHPIndex);
6815 : }
6816 :
6817 : // set global logicals that denote coil type
6818 592 : if (this->m_MultiSpeedHeatingCoil || this->m_VarSpeedHeatingCoil) {
6819 18 : this->m_MultiOrVarSpeedHeatCoil = true;
6820 : }
6821 592 : if (this->m_DiscreteSpeedCoolingCoil || this->m_ContSpeedCoolingCoil) {
6822 83 : this->m_MultiOrVarSpeedCoolCoil = true;
6823 : }
6824 :
6825 : // set global variables for multi-stage chilled and hot water coils
6826 1179 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWater ||
6827 587 : this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWaterDetailed) {
6828 5 : if (this->m_DesignSpecMSHPIndex > -1) {
6829 1 : this->m_NumOfSpeedCooling = this->m_CompPointerMSHP->numOfSpeedCooling;
6830 1 : if (this->m_NumOfSpeedCooling > 1) {
6831 1 : this->m_DiscreteSpeedCoolingCoil = true;
6832 1 : this->m_MultiOrVarSpeedCoolCoil = true;
6833 : }
6834 : }
6835 : }
6836 592 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWater) {
6837 : // designSpecIndex = this->m_DesignSpecMSHPIndex;
6838 9 : if (this->m_DesignSpecMSHPIndex > -1) {
6839 1 : this->m_NumOfSpeedHeating = this->m_CompPointerMSHP->numOfSpeedHeating;
6840 1 : if (this->m_NumOfSpeedHeating > 1) {
6841 1 : this->m_MultiSpeedHeatingCoil = true;
6842 1 : this->m_MultiOrVarSpeedHeatCoil = true;
6843 : }
6844 : }
6845 : }
6846 : // zone coils are now simulated before sizing is complete, data will not be available but array is allocated
6847 592 : if (this->m_MultiOrVarSpeedCoolCoil) {
6848 150 : this->m_CoolVolumeFlowRate.resize(this->m_NumOfSpeedCooling + 1);
6849 150 : this->m_CoolMassFlowRate.resize(this->m_NumOfSpeedCooling + 1);
6850 150 : this->m_MSCoolingSpeedRatio.resize(this->m_NumOfSpeedCooling + 1);
6851 : }
6852 592 : if (this->m_MultiOrVarSpeedHeatCoil) {
6853 18 : this->m_HeatVolumeFlowRate.resize(this->m_NumOfSpeedHeating + 1);
6854 18 : this->m_HeatMassFlowRate.resize(this->m_NumOfSpeedHeating + 1);
6855 18 : this->m_MSHeatingSpeedRatio.resize(this->m_NumOfSpeedHeating + 1);
6856 : }
6857 :
6858 : // check for specific input requirements for ASHRAE90.1 model
6859 592 : if (this->m_ControlType == UnitarySysCtrlType::CCMASHRAE) {
6860 :
6861 : // only allowed for water and DX cooling coils at this time
6862 0 : if (this->m_CoolCoilExists && this->m_CoolingCoilType_Num != DataHVACGlobals::Coil_CoolingWater &&
6863 0 : this->m_CoolingCoilType_Num != DataHVACGlobals::Coil_CoolingWaterDetailed &&
6864 0 : this->m_CoolingCoilType_Num != DataHVACGlobals::CoilDX_CoolingSingleSpeed) {
6865 0 : if (state.dataGlobal->DisplayExtraWarnings) {
6866 0 : ShowWarningError(state, format("{}: {}", cCurrentModuleObject, thisObjectName));
6867 0 : ShowContinueError(state, "ASHRAE90.1 control method requires specific cooling coil types.");
6868 0 : ShowContinueError(state,
6869 : "Valid cooling coil types are Coil:Cooling:Water, Coil:Cooling:Water:DetailedGeometry and "
6870 : "Coil:Cooling:DX:SingleSpeed.");
6871 0 : ShowContinueError(state,
6872 0 : format("The input cooling coil type = {}. This coil will not be modeled using the ASHRAE 90.1 algorithm.",
6873 0 : input_data.cooling_coil_object_type));
6874 : }
6875 : // mark this coil as non-ASHRAE90 type
6876 0 : this->m_ValidASHRAECoolCoil = false;
6877 : }
6878 : // only allow for water, fuel, or electric at this time
6879 0 : if (this->m_HeatCoilExists && this->m_HeatingCoilType_Num != DataHVACGlobals::Coil_HeatingWater &&
6880 0 : this->m_HeatingCoilType_Num != DataHVACGlobals::Coil_HeatingGasOrOtherFuel &&
6881 0 : this->m_HeatingCoilType_Num != DataHVACGlobals::Coil_HeatingElectric &&
6882 0 : this->m_HeatingCoilType_Num != DataHVACGlobals::CoilDX_HeatingEmpirical) {
6883 0 : if (state.dataGlobal->DisplayExtraWarnings) {
6884 0 : ShowWarningError(state, format("{}: {}", cCurrentModuleObject, thisObjectName));
6885 0 : ShowContinueError(state, "ASHRAE90.1 control method requires specific heating coil types.");
6886 0 : ShowContinueError(state,
6887 : "Valid heating coil types are Coil:Heating:Water, Coil:Heating:Fuel, Coil:Heating:Electric and "
6888 : "Coil:Heating:DX:SingleSpeed.");
6889 0 : ShowContinueError(state,
6890 0 : format("The input heating coil type = {}. This coil will not be modeled using the ASHRAE 90.1 algorithm.",
6891 0 : this->m_HeatingCoilTypeName));
6892 : }
6893 : // mark this coil as non-ASHRAE90 type
6894 0 : this->m_ValidASHRAEHeatCoil = false;
6895 : }
6896 0 : if (this->m_DehumidControlType_Num == DehumCtrlType::Multimode || this->m_DehumidControlType_Num == DehumCtrlType::CoolReheat) {
6897 0 : ShowWarningError(state, format("{}: {}", cCurrentModuleObject, thisObjectName));
6898 0 : ShowContinueError(state, "Invalid entry for Dehumidification Control Type = " + input_data.dehumidification_control_type);
6899 0 : ShowContinueError(state,
6900 : "ASHRAE90.1 control method does not support dehumidification at this time. Dehumidification control type is "
6901 : "assumed to be None.");
6902 0 : this->m_DehumidControlType_Num = DehumCtrlType::None;
6903 : }
6904 0 : if (this->m_RunOnLatentLoad) {
6905 0 : ShowWarningError(state, format("{} = {}", cCurrentModuleObject, thisObjectName));
6906 0 : ShowContinueError(state, format("Invalid entry for Latent Load Control: {}", input_data.latent_load_control));
6907 0 : ShowContinueError(state,
6908 : "ASHRAE90.1 control method does not support latent load control at this time. This input must be selected as "
6909 : "SensibleOnlyLoadControl.");
6910 0 : this->m_RunOnSensibleLoad = true;
6911 0 : this->m_RunOnLatentLoad = false;
6912 0 : this->m_RunOnLatentOnlyWithSensible = false;
6913 : }
6914 0 : if (this->m_MaxNoCoolHeatAirVolFlow == 0.0) { // 0 min air flow not allowed for SZVAV
6915 0 : ShowSevereError(state, format("Input errors for {}:{}", cCurrentModuleObject, thisObjectName));
6916 0 : ShowContinueError(state, format("Control Type = {}", input_data.control_type));
6917 0 : ShowContinueError(state, "Input for No Load Supply Air Flow Rate cannot be 0.");
6918 0 : errorsFound = true;
6919 : }
6920 : }
6921 : }
6922 :
6923 753 : void UnitarySys::getDXCoilSystemData(
6924 : EnergyPlusData &state, std::string_view objectName, bool const ZoneEquipment, int const ZoneOAUnitNum, bool &errorsFound)
6925 : {
6926 1506 : std::string cCurrentModuleObject = "CoilSystem:Cooling:DX";
6927 753 : int numCoilSystemDX = 0;
6928 1506 : auto const instances = state.dataInputProcessing->inputProcessor->epJSON.find(cCurrentModuleObject);
6929 753 : if (instances != state.dataInputProcessing->inputProcessor->epJSON.end()) {
6930 462 : auto &instancesValue = instances.value();
6931 3012 : for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) {
6932 :
6933 3124 : auto const &thisObjectName = UtilityRoutines::MakeUPPERCase(instance.key());
6934 :
6935 : // only get the current data once all data has been read in and vector unitarySys has been initialized
6936 : // when UnitarySystems::getInputOnceFlag is true read all unitary systems, otherwise read just the curren object
6937 2550 : if (!UtilityRoutines::SameString(objectName, thisObjectName) && !state.dataUnitarySystems->getInputOnceFlag) continue;
6938 :
6939 574 : int sysNum = getUnitarySystemIndex(state, thisObjectName);
6940 1148 : UnitarySys thisSys;
6941 574 : if (sysNum == -1) {
6942 287 : ++state.dataUnitarySystems->numUnitarySystems;
6943 287 : auto const &thisObjName = instance.key();
6944 287 : state.dataInputProcessing->inputProcessor->markObjectAsUsed(cCurrentModuleObject, thisObjName);
6945 : } else {
6946 287 : thisSys = state.dataUnitarySystems->unitarySys[sysNum];
6947 : }
6948 :
6949 : // get CoilSystem:Cooling:DX object inputs
6950 574 : auto const &fields = instance.value();
6951 574 : thisSys.input_specs.name = thisObjectName;
6952 574 : thisSys.input_specs.system_type = cCurrentModuleObject;
6953 574 : if (fields.find("availability_schedule_name") != fields.end()) { // not required field
6954 562 : thisSys.input_specs.availability_schedule_name =
6955 1124 : UtilityRoutines::MakeUPPERCase(fields.at("availability_schedule_name").get<std::string>());
6956 : }
6957 574 : thisSys.input_specs.air_inlet_node_name =
6958 1148 : UtilityRoutines::MakeUPPERCase(fields.at("dx_cooling_coil_system_inlet_node_name").get<std::string>()); // required field
6959 574 : thisSys.input_specs.air_outlet_node_name =
6960 1148 : UtilityRoutines::MakeUPPERCase(fields.at("dx_cooling_coil_system_outlet_node_name").get<std::string>()); // required field
6961 :
6962 574 : thisSys.input_specs.dx_cooling_coil_system_sensor_node_name =
6963 1148 : UtilityRoutines::MakeUPPERCase(fields.at("dx_cooling_coil_system_sensor_node_name").get<std::string>()); // required field
6964 :
6965 574 : thisSys.input_specs.cooling_coil_object_type =
6966 1148 : UtilityRoutines::MakeUPPERCase(fields.at("cooling_coil_object_type").get<std::string>()); // required field
6967 574 : thisSys.input_specs.cooling_coil_name =
6968 1148 : UtilityRoutines::MakeUPPERCase(fields.at("cooling_coil_name").get<std::string>()); // required field
6969 : // min-fields = 7, begin optional inputs
6970 574 : if (fields.find("dehumidification_control_type") != fields.end()) { // not required field
6971 36 : thisSys.input_specs.dehumidification_control_type =
6972 72 : UtilityRoutines::MakeUPPERCase(fields.at("dehumidification_control_type").get<std::string>());
6973 : } else {
6974 : // find default value
6975 538 : thisSys.input_specs.dehumidification_control_type = "None";
6976 : }
6977 1148 : std::string loc_RunOnSensLoad("");
6978 574 : if (fields.find("run_on_sensible_load") != fields.end()) { // not required field
6979 34 : loc_RunOnSensLoad = UtilityRoutines::MakeUPPERCase(fields.at("run_on_sensible_load").get<std::string>());
6980 : } else {
6981 : // find default value
6982 540 : loc_RunOnSensLoad = "YES";
6983 : }
6984 1148 : std::string loc_RunOnLatLoad("");
6985 574 : if (fields.find("run_on_latent_load") != fields.end()) { // not required field
6986 34 : loc_RunOnLatLoad = UtilityRoutines::MakeUPPERCase(fields.at("run_on_latent_load").get<std::string>());
6987 : } else {
6988 : // find default value
6989 540 : loc_RunOnLatLoad = "NO";
6990 : }
6991 574 : if (loc_RunOnSensLoad == "YES" && loc_RunOnLatLoad == "NO") {
6992 560 : thisSys.input_specs.latent_load_control = "SensibleOnlyLoadControl";
6993 14 : } else if (loc_RunOnSensLoad == "NO" && loc_RunOnLatLoad == "YES") {
6994 0 : thisSys.input_specs.latent_load_control = "LatentOnlyLoadControl";
6995 14 : } else if (loc_RunOnSensLoad == "YES" && loc_RunOnLatLoad == "YES") {
6996 : // does DX system control on LatentOrSensibleLoadControl or LatentWithSensibleLoadControl?
6997 14 : thisSys.input_specs.latent_load_control = "LatentOrSensibleLoadControl";
6998 : }
6999 :
7000 574 : if (fields.find("use_outdoor_air_dx_cooling_coil") != fields.end()) { // not required field
7001 10 : thisSys.input_specs.use_doas_dx_cooling_coil =
7002 20 : UtilityRoutines::MakeUPPERCase(fields.at("use_outdoor_air_dx_cooling_coil").get<std::string>());
7003 : } else {
7004 : // find default value
7005 564 : thisSys.input_specs.use_doas_dx_cooling_coil = "NO";
7006 : }
7007 574 : if (fields.find("outdoor_air_dx_cooling_coil_leaving_minimum_air_temperature") != fields.end()) { // not required field
7008 8 : thisSys.input_specs.minimum_supply_air_temperature =
7009 16 : fields.at("outdoor_air_dx_cooling_coil_leaving_minimum_air_temperature").get<Real64>();
7010 : }
7011 : // set UnitarySystem specific inputs
7012 574 : thisSys.input_specs.control_type = "SETPOINT";
7013 :
7014 : // now translate to UnitarySystem
7015 574 : thisSys.UnitType = cCurrentModuleObject;
7016 574 : thisSys.m_sysType = SysType::CoilCoolingDX;
7017 574 : thisSys.AirloopEqType = SimAirServingZones::CompType::DXSystem;
7018 :
7019 : // TODO: figure out another way to set this next variable
7020 : // Unitary System will not turn on unless this mode is set OR a different method is used to set air flow rate
7021 574 : thisSys.m_LastMode = CoolingMode;
7022 574 : thisSys.processInputSpec(state, thisSys.input_specs, sysNum, errorsFound, ZoneEquipment, ZoneOAUnitNum);
7023 :
7024 574 : if (sysNum == -1) {
7025 287 : int thisSysNum = state.dataUnitarySystems->numUnitarySystems - 1;
7026 287 : state.dataUnitarySystems->unitarySys[thisSysNum] = thisSys;
7027 : // zone equipment require a 1-n index for access to zone availability managers
7028 : // although not zone equipment, use same methodology
7029 287 : ++numCoilSystemDX;
7030 287 : thisSys.m_EquipCompNum = numCoilSystemDX;
7031 : } else {
7032 287 : state.dataUnitarySystems->unitarySys[sysNum] = thisSys;
7033 : }
7034 : }
7035 : }
7036 753 : }
7037 :
7038 753 : void UnitarySys::getPackagedTerminalUnitData(
7039 : EnergyPlusData &state, std::string_view objectName, bool const ZoneEquipment, int const ZoneOAUnitNum, bool &errorsFound)
7040 : {
7041 1506 : std::string cCurrentModuleObject = "ZoneHVAC:PackagedTerminalAirConditioner";
7042 753 : SysType sysTypeNum = SysType::PackagedAC;
7043 753 : DataZoneEquipment::ZoneEquip zoneEqType = DataZoneEquipment::ZoneEquip::Invalid;
7044 753 : int numPTAC = 0;
7045 753 : int numPTHP = 0;
7046 753 : int numPTWSHP = 0;
7047 753 : auto &ip = state.dataInputProcessing->inputProcessor;
7048 3012 : for (int getPTUnitType = 1; getPTUnitType <= 3; ++getPTUnitType) {
7049 2259 : if (getPTUnitType == 2) {
7050 753 : sysTypeNum = SysType::PackagedHP;
7051 753 : zoneEqType = DataZoneEquipment::ZoneEquip::PkgTermACAirToAir;
7052 753 : cCurrentModuleObject = "ZoneHVAC:PackagedTerminalHeatPump";
7053 1506 : } else if (getPTUnitType == 3) {
7054 753 : sysTypeNum = SysType::PackagedWSHP;
7055 753 : zoneEqType = DataZoneEquipment::ZoneEquip::PkgTermACAirToAir;
7056 753 : cCurrentModuleObject = "ZoneHVAC:WaterToAirHeatPump";
7057 : }
7058 4518 : auto const instances = state.dataInputProcessing->inputProcessor->epJSON.find(cCurrentModuleObject);
7059 2259 : if (instances != state.dataInputProcessing->inputProcessor->epJSON.end()) {
7060 250 : auto &instancesValue = instances.value();
7061 250 : auto const &objectSchemaProps = ip->getObjectSchemaProps(state, cCurrentModuleObject);
7062 5747 : for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) {
7063 :
7064 5881 : auto const &thisObjectName = UtilityRoutines::MakeUPPERCase(instance.key());
7065 :
7066 : // only get the current data once all data has been read in and vector unitarySys has been initialized
7067 : // when UnitarySystems::getInputOnceFlag is true read all unitary systems, otherwise read just the curren object
7068 5497 : if (!UtilityRoutines::SameString(objectName, thisObjectName) && !state.dataUnitarySystems->getInputOnceFlag) continue;
7069 :
7070 384 : int sysNum = getUnitarySystemIndex(state, thisObjectName);
7071 768 : UnitarySys thisSys;
7072 384 : if (sysNum == -1) {
7073 192 : ++state.dataUnitarySystems->numUnitarySystems;
7074 192 : auto const &thisObjName = instance.key();
7075 192 : state.dataInputProcessing->inputProcessor->markObjectAsUsed(cCurrentModuleObject, thisObjName);
7076 : } else {
7077 192 : thisSys = state.dataUnitarySystems->unitarySys[sysNum];
7078 : }
7079 :
7080 : // get PackagedTerminal unit object inputs
7081 384 : auto const &fields = instance.value();
7082 384 : thisSys.input_specs.name = thisObjectName;
7083 384 : thisSys.input_specs.system_type = cCurrentModuleObject;
7084 384 : thisSys.input_specs.availability_schedule_name = ip->getAlphaFieldValue(fields, objectSchemaProps, "availability_schedule_name");
7085 384 : thisSys.input_specs.air_inlet_node_name = ip->getAlphaFieldValue(fields, objectSchemaProps, "air_inlet_node_name");
7086 384 : thisSys.input_specs.air_outlet_node_name = ip->getAlphaFieldValue(fields, objectSchemaProps, "air_outlet_node_name");
7087 :
7088 384 : thisSys.input_specs.oa_mixer_type = ip->getAlphaFieldValue(fields, objectSchemaProps, "outdoor_air_mixer_object_type");
7089 384 : thisSys.input_specs.oa_mixer_name = ip->getAlphaFieldValue(fields, objectSchemaProps, "outdoor_air_mixer_name");
7090 :
7091 384 : thisSys.input_specs.cooling_supply_air_flow_rate =
7092 768 : ip->getRealFieldValue(fields, objectSchemaProps, "cooling_supply_air_flow_rate");
7093 384 : thisSys.input_specs.heating_supply_air_flow_rate =
7094 768 : ip->getRealFieldValue(fields, objectSchemaProps, "heating_supply_air_flow_rate");
7095 384 : thisSys.input_specs.no_load_supply_air_flow_rate =
7096 768 : ip->getRealFieldValue(fields, objectSchemaProps, "no_load_supply_air_flow_rate");
7097 384 : thisSys.input_specs.cooling_oa_flow_rate = ip->getRealFieldValue(fields, objectSchemaProps, "cooling_outdoor_air_flow_rate");
7098 384 : thisSys.input_specs.heating_oa_flow_rate = ip->getRealFieldValue(fields, objectSchemaProps, "heating_outdoor_air_flow_rate");
7099 384 : thisSys.input_specs.no_load_oa_flow_rate = ip->getRealFieldValue(fields, objectSchemaProps, "no_load_outdoor_air_flow_rate");
7100 :
7101 384 : thisSys.input_specs.supply_fan_object_type = ip->getAlphaFieldValue(fields, objectSchemaProps, "supply_air_fan_object_type");
7102 384 : thisSys.input_specs.supply_fan_name = ip->getAlphaFieldValue(fields, objectSchemaProps, "supply_air_fan_name");
7103 384 : thisSys.input_specs.heating_coil_object_type = ip->getAlphaFieldValue(fields, objectSchemaProps, "heating_coil_object_type");
7104 384 : thisSys.input_specs.heating_coil_name = ip->getAlphaFieldValue(fields, objectSchemaProps, "heating_coil_name");
7105 384 : thisSys.input_specs.cooling_coil_object_type = ip->getAlphaFieldValue(fields, objectSchemaProps, "cooling_coil_object_type");
7106 384 : thisSys.input_specs.cooling_coil_name = ip->getAlphaFieldValue(fields, objectSchemaProps, "cooling_coil_name");
7107 :
7108 384 : thisSys.input_specs.fan_placement = ip->getAlphaFieldValue(fields, objectSchemaProps, "fan_placement");
7109 384 : thisSys.input_specs.supply_air_fan_operating_mode_schedule_name =
7110 768 : ip->getAlphaFieldValue(fields, objectSchemaProps, "supply_air_fan_operating_mode_schedule_name");
7111 384 : if (getPTUnitType > 1) {
7112 100 : thisSys.input_specs.maximum_supply_air_temperature_from_supplemental_heater =
7113 200 : ip->getRealFieldValue(fields, objectSchemaProps, "maximum_supply_air_temperature_from_supplemental_heater");
7114 100 : thisSys.input_specs.supplemental_heating_coil_object_type =
7115 200 : ip->getAlphaFieldValue(fields, objectSchemaProps, "supplemental_heating_coil_object_type");
7116 100 : thisSys.input_specs.supplemental_heating_coil_name =
7117 200 : ip->getAlphaFieldValue(fields, objectSchemaProps, "supplemental_heating_coil_name");
7118 100 : thisSys.input_specs.maximum_outdoor_dry_bulb_temperature_for_supplemental_heater_operation = ip->getRealFieldValue(
7119 : fields, objectSchemaProps, "maximum_outdoor_dry_bulb_temperature_for_supplemental_heater_operation");
7120 100 : if (getPTUnitType == 2) {
7121 56 : thisSys.input_specs.heat_conv_tol = ip->getRealFieldValue(fields, objectSchemaProps, "heating_convergence_tolerance");
7122 56 : thisSys.input_specs.cool_conv_tol = ip->getRealFieldValue(fields, objectSchemaProps, "cooling_convergence_tolerance");
7123 44 : } else if (getPTUnitType == 3) {
7124 44 : thisSys.input_specs.maximum_cycling_rate = ip->getRealFieldValue(fields, objectSchemaProps, "maximum_cycling_rate");
7125 44 : thisSys.input_specs.heat_pump_time_constant = ip->getRealFieldValue(fields, objectSchemaProps, "heat_pump_time_constant");
7126 44 : thisSys.input_specs.fraction_of_on_cycle_power_use =
7127 88 : ip->getRealFieldValue(fields, objectSchemaProps, "fraction_of_on_cycle_power_use");
7128 44 : thisSys.input_specs.heat_pump_fan_delay_time =
7129 88 : ip->getRealFieldValue(fields, objectSchemaProps, "heat_pump_fan_delay_time");
7130 44 : thisSys.input_specs.outdoor_dry_bulb_temperature_sensor_node_name =
7131 88 : ip->getAlphaFieldValue(fields, objectSchemaProps, "outdoor_dry_bulb_temperature_sensor_node_name");
7132 44 : thisSys.input_specs.heat_pump_coil_water_flow_mode =
7133 88 : ip->getAlphaFieldValue(fields, objectSchemaProps, "heat_pump_coil_water_flow_mode");
7134 44 : thisSys.input_specs.control_type = "LOAD";
7135 : }
7136 : }
7137 384 : if (getPTUnitType < 3) {
7138 340 : thisSys.input_specs.control_type = ip->getAlphaFieldValue(fields, objectSchemaProps, "capacity_control_method");
7139 340 : if (thisSys.input_specs.control_type.empty() || thisSys.input_specs.control_type == "NONE") {
7140 340 : thisSys.input_specs.control_type = "LOAD";
7141 : }
7142 340 : thisSys.input_specs.minimum_supply_air_temperature =
7143 680 : ip->getRealFieldValue(fields, objectSchemaProps, "minimum_supply_air_temperature_in_cooling_mode");
7144 340 : thisSys.input_specs.maximum_supply_air_temperature =
7145 680 : ip->getRealFieldValue(fields, objectSchemaProps, "maximum_supply_air_temperature_in_heating_mode");
7146 : }
7147 :
7148 384 : thisSys.input_specs.avail_manager_list_name = ip->getAlphaFieldValue(fields, objectSchemaProps, "availability_manager_list_name");
7149 384 : thisSys.input_specs.design_spec_zonehvac_sizing_object_name =
7150 768 : ip->getAlphaFieldValue(fields, objectSchemaProps, "design_specification_zonehvac_sizing_object_name");
7151 :
7152 : // set UnitarySystem specific inputs
7153 384 : thisSys.input_specs.dehumidification_control_type = "None";
7154 384 : thisSys.input_specs.latent_load_control = "SensibleOnlyLoadControl";
7155 384 : thisSys.input_specs.cooling_supply_air_flow_rate_method = "SupplyAirFlowRate";
7156 384 : thisSys.input_specs.heating_supply_air_flow_rate_method = "SupplyAirFlowRate";
7157 384 : thisSys.input_specs.no_load_supply_air_flow_rate_method = "SupplyAirFlowRate";
7158 :
7159 384 : thisSys.UnitType = cCurrentModuleObject;
7160 384 : thisSys.m_sysType = sysTypeNum;
7161 384 : thisSys.ZoneEqType = zoneEqType;
7162 :
7163 : // TODO: figure out another way to set this next variable
7164 : // Unitary System will not turn on unless this mode is set OR a different method is used to set air flow rate
7165 384 : thisSys.m_LastMode = HeatingMode;
7166 384 : thisSys.processInputSpec(state, thisSys.input_specs, sysNum, errorsFound, ZoneEquipment, ZoneOAUnitNum);
7167 :
7168 384 : if (sysNum == -1) {
7169 : // zone equipment require a 1-n index for access to zone availability managers
7170 192 : switch (getPTUnitType) {
7171 142 : case 1:
7172 142 : ++numPTAC;
7173 142 : thisSys.m_EquipCompNum = numPTAC;
7174 142 : break;
7175 28 : case 2:
7176 28 : ++numPTHP;
7177 28 : thisSys.m_EquipCompNum = numPTHP;
7178 28 : break;
7179 22 : case 3:
7180 22 : ++numPTWSHP;
7181 22 : thisSys.m_EquipCompNum = numPTWSHP;
7182 22 : break;
7183 192 : default:
7184 : assert(true);
7185 : }
7186 192 : int thisSysNum = state.dataUnitarySystems->numUnitarySystems - 1;
7187 192 : state.dataUnitarySystems->unitarySys[thisSysNum] = thisSys;
7188 : } else {
7189 192 : state.dataUnitarySystems->unitarySys[sysNum] = thisSys;
7190 : }
7191 : }
7192 : }
7193 : }
7194 753 : }
7195 :
7196 753 : void UnitarySys::allocateUnitarySys(EnergyPlusData &state)
7197 : {
7198 753 : if (!state.dataUnitarySystems->unitarySys.empty()) return;
7199 161 : int numUnitarySystems = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "AirLoopHVAC:UnitarySystem");
7200 161 : int numCoilSystems = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "CoilSystem:Cooling:DX");
7201 161 : int numCoilSystemsWater = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "CoilSystem:Cooling:Water");
7202 161 : int numPackagedAC = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "ZoneHVAC:PackagedTerminalAirConditioner");
7203 161 : int numPackagedHP = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "ZoneHVAC:PackagedTerminalHeatPump");
7204 161 : int numPackagedWSHP = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "ZoneHVAC:WaterToAirHeatPump");
7205 161 : int numAllSystemTypes = numUnitarySystems + numCoilSystems + numCoilSystemsWater + numPackagedAC + numPackagedHP + numPackagedWSHP;
7206 753 : for (int sysCount = 0; sysCount < numAllSystemTypes; ++sysCount) {
7207 1184 : UnitarySys thisSys;
7208 592 : state.dataUnitarySystems->unitarySys.push_back(thisSys);
7209 : }
7210 : }
7211 :
7212 753 : void UnitarySys::getCoilWaterSystemInputData(
7213 : EnergyPlusData &state, std::string_view CoilSysName, bool const ZoneEquipment, int const ZoneOAUnitNum, bool &errorsFound)
7214 : {
7215 :
7216 1506 : std::string cCurrentModuleObject("CoilSystem:Cooling:Water");
7217 753 : int numCoilSystemWater = 0;
7218 753 : static const std::string routineName("getCoilWaterSystemInputData: ");
7219 1506 : auto const instances = state.dataInputProcessing->inputProcessor->epJSON.find(cCurrentModuleObject);
7220 753 : if (instances != state.dataInputProcessing->inputProcessor->epJSON.end()) {
7221 8 : auto &instancesValue = instances.value();
7222 16 : for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) {
7223 :
7224 8 : auto const &fields = instance.value();
7225 14 : auto const &thisObjectName = UtilityRoutines::MakeUPPERCase(instance.key());
7226 :
7227 8 : if (!UtilityRoutines::SameString(CoilSysName, thisObjectName) && !state.dataUnitarySystems->getInputOnceFlag) continue;
7228 :
7229 6 : int sysNum = getUnitarySystemIndex(state, thisObjectName);
7230 12 : UnitarySys thisSys;
7231 6 : if (sysNum == -1) {
7232 3 : ++state.dataUnitarySystems->numUnitarySystems;
7233 3 : auto const &thisObjName = instance.key();
7234 3 : state.dataInputProcessing->inputProcessor->markObjectAsUsed(cCurrentModuleObject, thisObjName);
7235 : } else {
7236 3 : thisSys = state.dataUnitarySystems->unitarySys[sysNum];
7237 : }
7238 :
7239 6 : thisSys.input_specs.name = thisObjectName;
7240 6 : thisSys.input_specs.system_type = cCurrentModuleObject;
7241 6 : thisSys.input_specs.control_type = "Setpoint";
7242 6 : thisSys.input_specs.air_inlet_node_name = UtilityRoutines::MakeUPPERCase(fields.at("air_inlet_node_name").get<std::string>());
7243 6 : thisSys.input_specs.air_outlet_node_name = UtilityRoutines::MakeUPPERCase(fields.at("air_outlet_node_name").get<std::string>());
7244 12 : std::string availScheduleName("");
7245 6 : if (fields.find("availability_schedule_name") != fields.end()) { // not required field, has default value of Always On
7246 2 : availScheduleName = UtilityRoutines::MakeUPPERCase(fields.at("availability_schedule_name").get<std::string>());
7247 : }
7248 6 : thisSys.input_specs.availability_schedule_name = availScheduleName;
7249 6 : thisSys.input_specs.cooling_coil_object_type =
7250 12 : UtilityRoutines::MakeUPPERCase(fields.at("cooling_coil_object_type").get<std::string>());
7251 6 : thisSys.input_specs.cooling_coil_name = UtilityRoutines::MakeUPPERCase(fields.at("cooling_coil_name").get<std::string>());
7252 : // why is this cooling coil does not have a field for Design Air Vol Flow Rate
7253 : // set it "SupplyAirFlowRate" to avoid blank, which lead to fatal out during get input
7254 : static constexpr std::string_view loc_cooling_coil_object_type("COIL:COOLING:WATER:DETAILEDGEOMETRY");
7255 6 : if (UtilityRoutines::SameString(loc_cooling_coil_object_type, thisSys.input_specs.cooling_coil_object_type)) {
7256 0 : thisSys.input_specs.cooling_supply_air_flow_rate_method = UtilityRoutines::MakeUPPERCase("SupplyAirFlowRate");
7257 0 : thisSys.input_specs.cooling_supply_air_flow_rate = DataSizing::AutoSize;
7258 : }
7259 : // optional input fields
7260 6 : if (fields.find("minimum_air_to_water_temperature_offset") != fields.end()) { // not required field, has default value of 0.0
7261 6 : thisSys.m_minAirToWaterTempOffset = fields.at("minimum_air_to_water_temperature_offset").get<Real64>();
7262 : }
7263 6 : if (fields.find("dehumidification_control_type") != fields.end()) {
7264 4 : thisSys.input_specs.dehumidification_control_type =
7265 8 : UtilityRoutines::MakeUPPERCase(fields.at("dehumidification_control_type").get<std::string>());
7266 : } else {
7267 2 : thisSys.input_specs.dehumidification_control_type = "None";
7268 : }
7269 :
7270 6 : bool runOnSensibleLoad = true;
7271 6 : if (fields.find("run_on_sensible_load") != fields.end()) {
7272 4 : runOnSensibleLoad = UtilityRoutines::SameString(fields.at("run_on_sensible_load").get<std::string>(), "YES");
7273 : }
7274 6 : bool runOnLatentLoad = false;
7275 6 : if (fields.find("run_on_latent_load") != fields.end()) {
7276 4 : runOnLatentLoad = UtilityRoutines::SameString(fields.at("run_on_latent_load").get<std::string>(), "YES");
7277 : }
7278 :
7279 6 : if (runOnSensibleLoad && !runOnLatentLoad) {
7280 2 : thisSys.input_specs.latent_load_control = "SensibleOnlyLoadControl";
7281 4 : } else if (!runOnSensibleLoad && runOnLatentLoad) {
7282 0 : thisSys.input_specs.latent_load_control = "LatentOnlyLoadControl";
7283 4 : } else if (runOnSensibleLoad && runOnLatentLoad) {
7284 4 : thisSys.input_specs.latent_load_control = "LatentOrSensibleLoadControl";
7285 : }
7286 :
7287 : // now translate to UnitarySystem
7288 6 : thisSys.UnitType = cCurrentModuleObject;
7289 6 : thisSys.m_sysType = SysType::CoilCoolingWater;
7290 6 : thisSys.AirloopEqType = SimAirServingZones::CompType::CoilSystemWater;
7291 6 : thisSys.input_specs.control_type = "Setpoint";
7292 6 : thisSys.m_CoolCoilExists = true; // is always true
7293 6 : thisSys.m_LastMode = CoolingMode;
7294 : // set water-side economizer flag
7295 6 : if (thisSys.m_minAirToWaterTempOffset > 0.0) thisSys.m_TemperatureOffsetControlActive = true;
7296 :
7297 : // heat recovery loop inputs
7298 6 : if (fields.find("minimum_water_loop_temperature_for_heat_recovery") != fields.end()) {
7299 2 : thisSys.m_minWaterLoopTempForHR = fields.at("minimum_water_loop_temperature_for_heat_recovery").get<Real64>();
7300 : }
7301 6 : if (fields.find("economizer_lockout") != fields.end()) { // duplicate above as default
7302 0 : bool econoFlag = UtilityRoutines::SameString(fields.at("economizer_lockout").get<std::string>(), "YES");
7303 0 : if (econoFlag) {
7304 0 : thisSys.m_waterSideEconomizerFlag = true;
7305 : }
7306 : } else {
7307 6 : thisSys.m_waterSideEconomizerFlag = true;
7308 : }
7309 12 : std::string HRWaterCoolingCoilName;
7310 6 : if (fields.find("companion_coil_used_for_heat_recovery") != fields.end()) {
7311 2 : HRWaterCoolingCoilName = UtilityRoutines::MakeUPPERCase(fields.at("companion_coil_used_for_heat_recovery").get<std::string>());
7312 2 : thisSys.m_WaterHRPlantLoopModel = true;
7313 : }
7314 6 : if (thisSys.m_WaterHRPlantLoopModel) {
7315 4 : std::string const HRcoolingCoilType("COIL:COOLING:WATER");
7316 2 : bool errFound = false;
7317 2 : thisSys.m_HRcoolCoilAirInNode = WaterCoils::GetCoilInletNode(state, HRcoolingCoilType, HRWaterCoolingCoilName, errFound);
7318 2 : thisSys.m_HRcoolCoilFluidInletNode =
7319 2 : WaterCoils::GetCoilWaterInletNode(state, HRcoolingCoilType, HRWaterCoolingCoilName, errFound);
7320 : int HRCoilIndex =
7321 2 : WaterCoils::GetWaterCoilIndex(state, UtilityRoutines::MakeUPPERCase(HRcoolingCoilType), HRWaterCoolingCoilName, errFound);
7322 2 : bool heatRecoveryCoil = true; // use local here to highlight where this parameter is set
7323 2 : WaterCoils::SetWaterCoilData(state, HRCoilIndex, errFound, _, _, heatRecoveryCoil);
7324 2 : if (errFound) {
7325 0 : if (HRCoilIndex == 0) {
7326 0 : ShowContinueError(state, format("...cooling coil {} must be of type Coil:Cooling:Water.", HRWaterCoolingCoilName));
7327 : }
7328 0 : ShowContinueError(state, format("...occurs in {} = {}", cCurrentModuleObject, thisObjectName));
7329 : }
7330 2 : errorsFound = errorsFound || errFound;
7331 : }
7332 : // end heat recovery loop inputs
7333 :
7334 6 : thisSys.processInputSpec(state, thisSys.input_specs, sysNum, errorsFound, ZoneEquipment, ZoneOAUnitNum);
7335 :
7336 6 : if (sysNum == -1) {
7337 3 : int thisSysNum = state.dataUnitarySystems->numUnitarySystems - 1;
7338 3 : state.dataUnitarySystems->unitarySys[thisSysNum] = thisSys;
7339 : // zone equipment require a 1-n index for access to zone availability managers
7340 : // although not zone equipment, use same methodology
7341 3 : ++numCoilSystemWater;
7342 3 : thisSys.m_EquipCompNum = numCoilSystemWater;
7343 : } else {
7344 3 : state.dataUnitarySystems->unitarySys[sysNum] = thisSys;
7345 : }
7346 : }
7347 :
7348 8 : if (errorsFound) {
7349 0 : ShowFatalError(
7350 0 : state, routineName + "Errors found in getting " + cCurrentModuleObject + " input. Preceding condition(s) causes termination.");
7351 : }
7352 : }
7353 753 : }
7354 :
7355 753 : void UnitarySys::getUnitarySystemInputData(
7356 : EnergyPlusData &state, std::string_view objectName, bool const ZoneEquipment, int const ZoneOAUnitNum, bool &errorsFound)
7357 : {
7358 :
7359 1506 : std::string cCurrentModuleObject = "AirLoopHVAC:UnitarySystem";
7360 753 : static std::string const getUnitarySystemInput("getUnitarySystemInputData");
7361 753 : int zoneUnitaryNum = 0;
7362 753 : int airloopUnitaryNum = 0;
7363 :
7364 1506 : auto const instances = state.dataInputProcessing->inputProcessor->epJSON.find(cCurrentModuleObject);
7365 753 : if (instances == state.dataInputProcessing->inputProcessor->epJSON.end() && state.dataUnitarySystems->numUnitarySystems == 0) {
7366 0 : ShowSevereError(state, "getUnitarySystemInputData: did not find AirLoopHVAC:UnitarySystem object in input file. Check inputs");
7367 0 : errorsFound = true;
7368 753 : } else if (instances != state.dataInputProcessing->inputProcessor->epJSON.end()) {
7369 197 : auto &instancesValue = instances.value();
7370 956 : for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) {
7371 :
7372 979 : auto const &thisObjectName = UtilityRoutines::MakeUPPERCase(instance.key());
7373 : // only get the current data once all data has been read in and vector unitarySys has been initialized
7374 : // when UnitarySystems::getInputOnceFlag is true read all unitary systems, otherwise read just the curren object
7375 759 : if (!UtilityRoutines::SameString(objectName, thisObjectName) && !state.dataUnitarySystems->getInputOnceFlag) continue;
7376 :
7377 220 : int sysNum = getUnitarySystemIndex(state, thisObjectName);
7378 440 : UnitarySys thisSys;
7379 220 : if (sysNum == -1) {
7380 110 : ++state.dataUnitarySystems->numUnitarySystems;
7381 110 : auto const &thisObjName = instance.key();
7382 110 : state.dataInputProcessing->inputProcessor->markObjectAsUsed(cCurrentModuleObject, thisObjName);
7383 : } else {
7384 110 : thisSys = state.dataUnitarySystems->unitarySys[sysNum];
7385 : }
7386 :
7387 220 : auto const &fields = instance.value();
7388 220 : thisSys.UnitType = cCurrentModuleObject;
7389 220 : thisSys.m_sysType = SysType::Unitary;
7390 220 : thisSys.AirloopEqType = SimAirServingZones::CompType::UnitarySystemModel;
7391 :
7392 220 : thisSys.input_specs.name = thisObjectName;
7393 220 : thisSys.input_specs.system_type = cCurrentModuleObject;
7394 220 : thisSys.input_specs.control_type = fields.at("control_type").get<std::string>();
7395 220 : if (fields.find("controlling_zone_or_thermostat_location") != fields.end()) { // not required field
7396 204 : thisSys.input_specs.controlling_zone_or_thermostat_location =
7397 408 : UtilityRoutines::MakeUPPERCase(fields.at("controlling_zone_or_thermostat_location").get<std::string>());
7398 : }
7399 220 : if (fields.find("dehumidification_control_type") != fields.end()) { // not required field, has default
7400 192 : thisSys.input_specs.dehumidification_control_type =
7401 384 : UtilityRoutines::MakeUPPERCase(fields.at("dehumidification_control_type").get<std::string>());
7402 : } else {
7403 28 : thisSys.input_specs.dehumidification_control_type = "NONE"; // default value
7404 : }
7405 220 : if (fields.find("availability_schedule_name") != fields.end()) { // not required field
7406 130 : thisSys.input_specs.availability_schedule_name =
7407 260 : UtilityRoutines::MakeUPPERCase(fields.at("availability_schedule_name").get<std::string>());
7408 : }
7409 220 : thisSys.input_specs.air_inlet_node_name =
7410 440 : UtilityRoutines::MakeUPPERCase(fields.at("air_inlet_node_name").get<std::string>()); // required
7411 220 : thisSys.input_specs.air_outlet_node_name =
7412 440 : UtilityRoutines::MakeUPPERCase(fields.at("air_outlet_node_name").get<std::string>()); // required
7413 220 : if (fields.find("supply_fan_object_type") != fields.end()) { // not required field
7414 216 : thisSys.input_specs.supply_fan_object_type =
7415 432 : UtilityRoutines::MakeUPPERCase(fields.at("supply_fan_object_type").get<std::string>());
7416 : }
7417 :
7418 220 : if (fields.find("supply_fan_name") != fields.end()) { // not required field
7419 216 : thisSys.input_specs.supply_fan_name = UtilityRoutines::MakeUPPERCase(fields.at("supply_fan_name").get<std::string>());
7420 : }
7421 220 : if (fields.find("fan_placement") != fields.end()) { // not required field
7422 216 : thisSys.input_specs.fan_placement = UtilityRoutines::MakeUPPERCase(fields.at("fan_placement").get<std::string>());
7423 : }
7424 220 : if (fields.find("supply_air_fan_operating_mode_schedule_name") != fields.end()) { // not required field
7425 206 : thisSys.input_specs.supply_air_fan_operating_mode_schedule_name =
7426 412 : UtilityRoutines::MakeUPPERCase(fields.at("supply_air_fan_operating_mode_schedule_name").get<std::string>());
7427 : }
7428 220 : if (fields.find("heating_coil_object_type") != fields.end()) { // not required field
7429 218 : thisSys.input_specs.heating_coil_object_type =
7430 436 : UtilityRoutines::MakeUPPERCase(fields.at("heating_coil_object_type").get<std::string>());
7431 218 : thisSys.m_HeatCoilExists = true;
7432 : }
7433 220 : if (fields.find("heating_coil_name") != fields.end()) { // not required field
7434 218 : thisSys.input_specs.heating_coil_name = UtilityRoutines::MakeUPPERCase(fields.at("heating_coil_name").get<std::string>());
7435 : }
7436 220 : if (fields.find("dx_heating_coil_sizing_ratio") != fields.end()) { // not required field, has default
7437 166 : thisSys.input_specs.dx_heating_coil_sizing_ratio = fields.at("dx_heating_coil_sizing_ratio").get<Real64>();
7438 : }
7439 220 : if (fields.find("cooling_coil_object_type") != fields.end()) { // not required field
7440 218 : thisSys.input_specs.cooling_coil_object_type =
7441 436 : UtilityRoutines::MakeUPPERCase(fields.at("cooling_coil_object_type").get<std::string>());
7442 218 : thisSys.m_CoolCoilExists = true;
7443 : }
7444 220 : if (fields.find("cooling_coil_name") != fields.end()) { // not required field
7445 218 : thisSys.input_specs.cooling_coil_name = UtilityRoutines::MakeUPPERCase(fields.at("cooling_coil_name").get<std::string>());
7446 : }
7447 220 : if (fields.find("use_doas_dx_cooling_coil") != fields.end()) { // not required field, has default
7448 74 : thisSys.input_specs.use_doas_dx_cooling_coil =
7449 148 : UtilityRoutines::MakeUPPERCase(fields.at("use_doas_dx_cooling_coil").get<std::string>());
7450 : } else {
7451 146 : thisSys.input_specs.use_doas_dx_cooling_coil = "No";
7452 : }
7453 220 : if (fields.find("minimum_supply_air_temperature") != fields.end()) { // not required field, has default (2C), and autosizable
7454 148 : auto tempFieldVal = fields.at("minimum_supply_air_temperature");
7455 74 : if (tempFieldVal == "Autosize") {
7456 0 : thisSys.input_specs.minimum_supply_air_temperature = DataSizing::AutoSize;
7457 : } else {
7458 74 : thisSys.input_specs.minimum_supply_air_temperature = fields.at("minimum_supply_air_temperature").get<Real64>();
7459 : }
7460 : }
7461 220 : if (fields.find("latent_load_control") != fields.end()) { // not required field, has default
7462 102 : thisSys.input_specs.latent_load_control = UtilityRoutines::MakeUPPERCase(fields.at("latent_load_control").get<std::string>());
7463 : } else {
7464 118 : thisSys.input_specs.latent_load_control = "SensibleOnlyLoadControl";
7465 : }
7466 220 : if (fields.find("supplemental_heating_coil_object_type") != fields.end()) { // not required field
7467 80 : thisSys.input_specs.supplemental_heating_coil_object_type =
7468 160 : UtilityRoutines::MakeUPPERCase(fields.at("supplemental_heating_coil_object_type").get<std::string>());
7469 : }
7470 220 : if (fields.find("supplemental_heating_coil_name") != fields.end()) { // not required field
7471 80 : thisSys.input_specs.supplemental_heating_coil_name =
7472 160 : UtilityRoutines::MakeUPPERCase(fields.at("supplemental_heating_coil_name").get<std::string>());
7473 : }
7474 220 : if (fields.find("cooling_supply_air_flow_rate_method") != fields.end()) { // not required field
7475 216 : thisSys.input_specs.cooling_supply_air_flow_rate_method =
7476 432 : UtilityRoutines::MakeUPPERCase(fields.at("cooling_supply_air_flow_rate_method").get<std::string>());
7477 : }
7478 220 : if (fields.find("cooling_supply_air_flow_rate") != fields.end()) { // not required field, autosizable
7479 432 : auto tempFieldVal = fields.at("cooling_supply_air_flow_rate");
7480 216 : if (tempFieldVal == "Autosize") {
7481 192 : thisSys.input_specs.cooling_supply_air_flow_rate = DataSizing::AutoSize;
7482 : } else {
7483 24 : thisSys.input_specs.cooling_supply_air_flow_rate = fields.at("cooling_supply_air_flow_rate").get<Real64>();
7484 : }
7485 : }
7486 220 : if (fields.find("cooling_supply_air_flow_rate_per_floor_area") != fields.end()) { // not required field
7487 0 : thisSys.input_specs.cooling_supply_air_flow_rate_per_floor_area =
7488 0 : fields.at("cooling_supply_air_flow_rate_per_floor_area").get<Real64>();
7489 : }
7490 220 : if (fields.find("cooling_fraction_of_autosized_cooling_supply_air_flow_rate") != fields.end()) { // not required field
7491 0 : thisSys.input_specs.cooling_fraction_of_autosized_cooling_supply_air_flow_rate =
7492 0 : fields.at("cooling_fraction_of_autosized_cooling_supply_air_flow_rate").get<Real64>();
7493 : }
7494 220 : if (fields.find("cooling_supply_air_flow_rate_per_unit_of_capacity") != fields.end()) { // not required field
7495 0 : thisSys.input_specs.cooling_supply_air_flow_rate_per_unit_of_capacity =
7496 0 : fields.at("cooling_supply_air_flow_rate_per_unit_of_capacity").get<Real64>();
7497 : }
7498 220 : if (fields.find("heating_supply_air_flow_rate_method") != fields.end()) { // not required field
7499 216 : thisSys.input_specs.heating_supply_air_flow_rate_method =
7500 432 : UtilityRoutines::MakeUPPERCase(fields.at("heating_supply_air_flow_rate_method").get<std::string>());
7501 : }
7502 220 : if (fields.find("heating_supply_air_flow_rate") != fields.end()) { // not required field
7503 432 : auto tempFieldVal = fields.at("heating_supply_air_flow_rate");
7504 216 : if (tempFieldVal == "Autosize") {
7505 192 : thisSys.input_specs.heating_supply_air_flow_rate = DataSizing::AutoSize;
7506 : } else {
7507 24 : thisSys.input_specs.heating_supply_air_flow_rate = fields.at("heating_supply_air_flow_rate").get<Real64>();
7508 : }
7509 : }
7510 220 : if (fields.find("heating_supply_air_flow_rate_per_floor_area") != fields.end()) { // not required field
7511 0 : thisSys.input_specs.heating_supply_air_flow_rate_per_floor_area =
7512 0 : fields.at("heating_supply_air_flow_rate_per_floor_area").get<Real64>();
7513 : }
7514 220 : if (fields.find("heating_fraction_of_autosized_heating_supply_air_flow_rate") != fields.end()) { // not required field
7515 0 : thisSys.input_specs.heating_fraction_of_autosized_heating_supply_air_flow_rate =
7516 0 : fields.at("heating_fraction_of_autosized_heating_supply_air_flow_rate").get<Real64>();
7517 : }
7518 220 : if (fields.find("heating_supply_air_flow_rate_per_unit_of_capacity") != fields.end()) { // not required field
7519 0 : thisSys.input_specs.heating_supply_air_flow_rate_per_unit_of_capacity =
7520 0 : fields.at("heating_supply_air_flow_rate_per_unit_of_capacity").get<Real64>();
7521 : }
7522 220 : if (fields.find("no_load_supply_air_flow_rate_method") != fields.end()) { // not required field
7523 206 : thisSys.input_specs.no_load_supply_air_flow_rate_method =
7524 412 : UtilityRoutines::MakeUPPERCase(fields.at("no_load_supply_air_flow_rate_method").get<std::string>());
7525 : }
7526 220 : if (fields.find("no_load_supply_air_flow_rate") != fields.end()) { // not required field
7527 432 : auto tempFieldVal = fields.at("no_load_supply_air_flow_rate");
7528 216 : if (tempFieldVal == "Autosize") {
7529 182 : thisSys.input_specs.no_load_supply_air_flow_rate = DataSizing::AutoSize;
7530 : } else {
7531 34 : thisSys.input_specs.no_load_supply_air_flow_rate = fields.at("no_load_supply_air_flow_rate").get<Real64>();
7532 : }
7533 : }
7534 220 : if (fields.find("no_load_supply_air_flow_rate_per_floor_area") != fields.end()) { // not required field
7535 0 : thisSys.input_specs.no_load_supply_air_flow_rate_per_floor_area =
7536 0 : fields.at("no_load_supply_air_flow_rate_per_floor_area").get<Real64>();
7537 : }
7538 220 : if (fields.find("no_load_fraction_of_autosized_cooling_supply_air_flow_rate") != fields.end()) { // not required field
7539 0 : thisSys.input_specs.no_load_fraction_of_autosized_cooling_supply_air_flow_rate =
7540 0 : fields.at("no_load_fraction_of_autosized_cooling_supply_air_flow_rate").get<Real64>();
7541 : }
7542 220 : if (fields.find("no_load_fraction_of_autosized_heating_supply_air_flow_rate") != fields.end()) { // not required field
7543 0 : thisSys.input_specs.no_load_fraction_of_autosized_heating_supply_air_flow_rate =
7544 0 : fields.at("no_load_fraction_of_autosized_heating_supply_air_flow_rate").get<Real64>();
7545 : }
7546 220 : if (fields.find("no_load_supply_air_flow_rate_per_unit_of_capacity_during_cooling_operation") != fields.end()) { // not required field
7547 0 : thisSys.input_specs.no_load_supply_air_flow_rate_per_unit_of_capacity_during_cooling_operation =
7548 0 : fields.at("no_load_supply_air_flow_rate_per_unit_of_capacity_during_cooling_operation").get<Real64>();
7549 : }
7550 220 : if (fields.find("no_load_supply_air_flow_rate_per_unit_of_capacity_during_heating_operation") != fields.end()) { // not required field
7551 0 : thisSys.input_specs.no_load_supply_air_flow_rate_per_unit_of_capacity_during_heating_operation =
7552 0 : fields.at("no_load_supply_air_flow_rate_per_unit_of_capacity_during_heating_operation").get<Real64>();
7553 : }
7554 220 : if (fields.find("maximum_supply_air_temperature") != fields.end()) { // not required field, has default of 80 C
7555 428 : auto tempFieldVal = fields.at("maximum_supply_air_temperature");
7556 214 : if (tempFieldVal == "Autosize") {
7557 170 : thisSys.input_specs.maximum_supply_air_temperature = DataSizing::AutoSize;
7558 : } else {
7559 44 : thisSys.input_specs.maximum_supply_air_temperature = fields.at("maximum_supply_air_temperature").get<Real64>();
7560 : }
7561 : }
7562 440 : if (fields.find("maximum_outdoor_dry_bulb_temperature_for_supplemental_heater_operation") !=
7563 440 : fields.end()) { // not required field, has default
7564 120 : thisSys.input_specs.maximum_outdoor_dry_bulb_temperature_for_supplemental_heater_operation =
7565 240 : fields.at("maximum_outdoor_dry_bulb_temperature_for_supplemental_heater_operation").get<Real64>();
7566 : }
7567 220 : if (fields.find("outdoor_dry_bulb_temperature_sensor_node_name") != fields.end()) { // not required field
7568 12 : thisSys.input_specs.outdoor_dry_bulb_temperature_sensor_node_name =
7569 24 : UtilityRoutines::MakeUPPERCase(fields.at("outdoor_dry_bulb_temperature_sensor_node_name").get<std::string>());
7570 : }
7571 220 : if (fields.find("maximum_cycling_rate") != fields.end()) { // not required field, has default
7572 22 : thisSys.input_specs.maximum_cycling_rate = fields.at("maximum_cycling_rate").get<Real64>();
7573 : }
7574 220 : if (fields.find("heat_pump_time_constant") != fields.end()) { // not required field, has default
7575 22 : thisSys.input_specs.heat_pump_time_constant = fields.at("heat_pump_time_constant").get<Real64>();
7576 : }
7577 220 : if (fields.find("fraction_of_on_cycle_power_use") != fields.end()) { // not required field, has default
7578 22 : thisSys.input_specs.fraction_of_on_cycle_power_use = fields.at("fraction_of_on_cycle_power_use").get<Real64>();
7579 : }
7580 220 : if (fields.find("heat_pump_fan_delay_time") != fields.end()) { // not required field, has default
7581 22 : thisSys.input_specs.heat_pump_fan_delay_time = fields.at("heat_pump_fan_delay_time").get<Real64>();
7582 : }
7583 220 : if (fields.find("ancillary_on_cycle_electric_power") != fields.end()) { // not required field, has default
7584 10 : thisSys.input_specs.ancillary_on_cycle_electric_power = fields.at("ancillary_on_cycle_electric_power").get<Real64>();
7585 : }
7586 220 : if (fields.find("ancillary_off_cycle_electric_power") != fields.end()) { // not required field, has default
7587 10 : thisSys.input_specs.ancillary_off_cycle_electric_power = fields.at("ancillary_off_cycle_electric_power").get<Real64>();
7588 : }
7589 220 : if (fields.find("design_heat_recovery_water_flow_rate") != fields.end()) { // not required field, has default
7590 0 : thisSys.input_specs.design_heat_recovery_water_flow_rate = fields.at("design_heat_recovery_water_flow_rate").get<Real64>();
7591 : }
7592 220 : if (fields.find("maximum_temperature_for_heat_recovery") != fields.end()) { // not required field, has default
7593 0 : thisSys.input_specs.maximum_temperature_for_heat_recovery = fields.at("maximum_temperature_for_heat_recovery").get<Real64>();
7594 : }
7595 220 : if (fields.find("heat_recovery_water_inlet_node_name") != fields.end()) { // not required field
7596 0 : thisSys.input_specs.heat_recovery_water_inlet_node_name =
7597 0 : UtilityRoutines::MakeUPPERCase(fields.at("heat_recovery_water_inlet_node_name").get<std::string>());
7598 : }
7599 220 : if (fields.find("heat_recovery_water_outlet_node_name") != fields.end()) { // not required field
7600 0 : thisSys.input_specs.heat_recovery_water_outlet_node_name =
7601 0 : UtilityRoutines::MakeUPPERCase(fields.at("heat_recovery_water_outlet_node_name").get<std::string>());
7602 : }
7603 220 : if (fields.find("design_specification_multispeed_object_type") != fields.end()) { // not required field
7604 110 : thisSys.input_specs.design_specification_multispeed_object_type =
7605 220 : UtilityRoutines::MakeUPPERCase(fields.at("design_specification_multispeed_object_type").get<std::string>());
7606 : }
7607 220 : if (fields.find("design_specification_multispeed_object_name") != fields.end()) { // not required field
7608 110 : thisSys.input_specs.design_specification_multispeed_object_name =
7609 220 : UtilityRoutines::MakeUPPERCase(fields.at("design_specification_multispeed_object_name").get<std::string>());
7610 : }
7611 :
7612 220 : thisSys.processInputSpec(state, thisSys.input_specs, sysNum, errorsFound, ZoneEquipment, ZoneOAUnitNum);
7613 :
7614 220 : if (sysNum == -1) {
7615 110 : ++thisSys.m_UnitarySysNum;
7616 110 : if (ZoneEquipment) {
7617 : // zone equipment require a 1-n index for access to zone availability managers
7618 10 : ++zoneUnitaryNum;
7619 10 : thisSys.m_EquipCompNum = zoneUnitaryNum;
7620 : } else {
7621 : // zone equipment require a 1-n index for access to zone availability managers
7622 : // although not zone equipment, use same methodology
7623 : // keep OA system unitary equipment indexes separate?
7624 100 : ++airloopUnitaryNum;
7625 100 : thisSys.m_EquipCompNum = airloopUnitaryNum;
7626 : }
7627 110 : int thisSysNum = state.dataUnitarySystems->numUnitarySystems - 1;
7628 110 : state.dataUnitarySystems->unitarySys[thisSysNum] = thisSys;
7629 : } else {
7630 110 : state.dataUnitarySystems->unitarySys[sysNum] = thisSys;
7631 : }
7632 : }
7633 : }
7634 753 : }
7635 :
7636 109368 : void UnitarySys::calcUnitarySuppSystemToSP(EnergyPlusData &state, bool const FirstHVACIteration // True when first HVAC iteration
7637 : )
7638 : {
7639 :
7640 : // SUBROUTINE INFORMATION:
7641 : // AUTHOR Richard Raustad, FSEC
7642 : // DATE WRITTEN February 2013
7643 :
7644 : // PURPOSE OF THIS SUBROUTINE:
7645 : // This subroutine manages supplemental heater component simulation for setpoint based operation scheme.
7646 :
7647 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
7648 : Real64 QActual;
7649 :
7650 218736 : std::string CompName = this->m_SuppHeatCoilName;
7651 109368 : int CoilType_Num = this->m_SuppHeatCoilType_Num;
7652 :
7653 109368 : if ((CoilType_Num == DataHVACGlobals::Coil_HeatingGasOrOtherFuel) || (CoilType_Num == DataHVACGlobals::Coil_HeatingElectric)) {
7654 70986 : HeatingCoils::SimulateHeatingCoilComponents(
7655 : state, CompName, FirstHVACIteration, _, this->m_SuppHeatCoilIndex, _, true, this->m_FanOpMode, this->m_SuppHeatPartLoadFrac);
7656 :
7657 38382 : } else if (CoilType_Num == DataHVACGlobals::Coil_HeatingElectric_MultiStage) {
7658 29930 : HeatingCoils::SimulateHeatingCoilComponents(state,
7659 : CompName,
7660 : FirstHVACIteration,
7661 : _,
7662 : this->m_SuppHeatCoilIndex,
7663 : _,
7664 : _,
7665 : this->m_FanOpMode,
7666 : this->m_SuppHeatPartLoadFrac,
7667 : this->m_SuppHeatingSpeedNum,
7668 : this->m_SuppHeatingSpeedRatio);
7669 :
7670 8452 : } else if (CoilType_Num == DataHVACGlobals::Coil_HeatingDesuperheater) {
7671 8452 : HeatingCoils::SimulateHeatingCoilComponents(
7672 : state, CompName, FirstHVACIteration, _, this->m_SuppHeatCoilIndex, _, _, this->m_FanOpMode, this->m_SuppHeatPartLoadFrac);
7673 :
7674 0 : } else if (CoilType_Num == DataHVACGlobals::Coil_HeatingWater) {
7675 0 : WaterCoils::SimulateWaterCoilComponents(
7676 : state, CompName, FirstHVACIteration, this->m_SuppHeatCoilIndex, QActual, this->m_FanOpMode, this->m_SuppHeatPartLoadFrac);
7677 :
7678 0 : } else if (CoilType_Num == DataHVACGlobals::Coil_HeatingSteam) {
7679 0 : SteamCoils::SimulateSteamCoilComponents(state,
7680 : CompName,
7681 : FirstHVACIteration,
7682 : this->m_SuppHeatCoilIndex,
7683 0 : this->m_DesignSuppHeatingCapacity * this->m_SuppHeatPartLoadFrac,
7684 : _,
7685 : this->m_FanOpMode,
7686 : this->m_SuppHeatPartLoadFrac);
7687 : }
7688 109368 : }
7689 :
7690 2500856 : void UnitarySys::controlUnitarySystemtoLoad(EnergyPlusData &state,
7691 : int const AirLoopNum, // Primary air loop number
7692 : bool const FirstHVACIteration, // True when first HVAC iteration
7693 : DataHVACGlobals::CompressorOperation &CompressorOn, // Determines if compressor is on or off
7694 : Real64 const OAUCoilOutTemp, // the coil inlet temperature of OutdoorAirUnit
7695 : bool HXUnitOn, // Flag to control HX for HXAssisted Cooling Coil
7696 : Real64 &sysOutputProvided, // system sensible output at supply air node
7697 : Real64 &latOutputProvided // sytsem latent output at supply air node
7698 : )
7699 : {
7700 :
7701 : // SUBROUTINE INFORMATION:
7702 : // AUTHOR Richard Raustad, FSEC
7703 : // DATE WRITTEN February 2013
7704 2500856 : Real64 ZoneLoad = 0.0; // zone load (W)
7705 2500856 : Real64 SupHeaterLoad = 0.0; // additional heating required by supplemental heater (W)
7706 2500856 : Real64 OnOffAirFlowRatio = 1.0;
7707 2500856 : this->updateUnitarySystemControl(state,
7708 : AirLoopNum,
7709 : this->CoolCoilOutletNodeNum,
7710 : this->CoolCtrlNode,
7711 : OnOffAirFlowRatio,
7712 : FirstHVACIteration,
7713 : OAUCoilOutTemp,
7714 : ZoneLoad,
7715 : this->DesignMaxOutletTemp);
7716 :
7717 : // will not be running supplemental heater on this CALL (simulate with supplemental heater off)
7718 2500856 : Real64 FullSensibleOutput = 0.0;
7719 : // using furnace module logic
7720 : // first check to see if cycling fan with economizer can meet the load
7721 2500856 : if (AirLoopNum > 0) {
7722 4987776 : if (this->m_CoolCoilExists && this->m_HeatCoilExists &&
7723 2493888 : this->m_CoolingCoilType_Num != DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed &&
7724 3451961 : this->m_HeatingCoilType_Num != DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed && !FirstHVACIteration &&
7725 2636619 : this->m_FanOpMode == DataHVACGlobals::CycFanCycCoil && state.dataUnitarySystems->CoolingLoad &&
7726 121829 : state.dataAirLoop->AirLoopControlInfo(AirLoopNum).EconoActive) {
7727 5212 : CompressorOn = DataHVACGlobals::CompressorOperation::Off;
7728 5212 : this->controlUnitarySystemOutput(
7729 : state, AirLoopNum, FirstHVACIteration, OnOffAirFlowRatio, ZoneLoad, FullSensibleOutput, HXUnitOn, CompressorOn);
7730 7547 : if (this->m_CoolingPartLoadFrac >= 1.0 || this->m_HeatingPartLoadFrac >= 1.0 ||
7731 2805 : (this->m_CoolingPartLoadFrac <= 0.0 && this->m_HeatingPartLoadFrac <= 0.0)) {
7732 3347 : CompressorOn = DataHVACGlobals::CompressorOperation::On;
7733 3347 : this->controlUnitarySystemOutput(
7734 : state, AirLoopNum, FirstHVACIteration, OnOffAirFlowRatio, ZoneLoad, FullSensibleOutput, HXUnitOn, CompressorOn);
7735 : }
7736 : } else {
7737 1241732 : CompressorOn = DataHVACGlobals::CompressorOperation::On;
7738 1241732 : this->controlUnitarySystemOutput(
7739 : state, AirLoopNum, FirstHVACIteration, OnOffAirFlowRatio, ZoneLoad, FullSensibleOutput, HXUnitOn, CompressorOn);
7740 : }
7741 : } else {
7742 1253912 : CompressorOn = DataHVACGlobals::CompressorOperation::On;
7743 1253912 : this->controlUnitarySystemOutput(
7744 : state, AirLoopNum, FirstHVACIteration, OnOffAirFlowRatio, ZoneLoad, FullSensibleOutput, HXUnitOn, CompressorOn);
7745 : }
7746 5312359 : if (state.dataLoopNodes->Node(this->AirOutNode).MassFlowRate < DataHVACGlobals::SmallMassFlow && this->m_sysType != SysType::PackagedAC &&
7747 2789817 : this->m_sysType != SysType::PackagedHP && this->m_sysType != SysType::PackagedWSHP) {
7748 127351 : state.dataUnitarySystems->CoolingLoad = false;
7749 127351 : state.dataUnitarySystems->HeatingLoad = false;
7750 127351 : state.dataUnitarySystems->MoistureLoad = 0.0;
7751 127351 : this->m_CoolingPartLoadFrac = 0.0;
7752 127351 : this->m_HeatingPartLoadFrac = 0.0;
7753 127351 : if (this->CoolCoilFluidInletNode > 0) state.dataLoopNodes->Node(this->CoolCoilFluidInletNode).MassFlowRate = 0.0;
7754 127351 : if (this->HeatCoilFluidInletNode > 0) state.dataLoopNodes->Node(this->HeatCoilFluidInletNode).MassFlowRate = 0.0;
7755 127351 : this->setAverageAirFlow(state, this->m_CoolingPartLoadFrac, OnOffAirFlowRatio);
7756 : // anything else need to be reset here when system is shut down on low flow?
7757 : }
7758 2500856 : Real64 CoolPLR = this->m_CoolingPartLoadFrac;
7759 2500856 : Real64 HeatPLR = this->m_HeatingPartLoadFrac;
7760 2500856 : Real64 HeatCoilLoad = HeatPLR * this->m_DesignHeatingCapacity;
7761 :
7762 2500856 : if (this->CoolCoilFluidInletNode > 0) {
7763 71612 : PlantUtilities::SetComponentFlowRate(state,
7764 35806 : state.dataLoopNodes->Node(this->CoolCoilFluidInletNode).MassFlowRate,
7765 : this->CoolCoilFluidInletNode,
7766 : this->CoolCoilFluidOutletNodeNum,
7767 : this->CoolCoilPlantLoc);
7768 : }
7769 2500856 : if (this->HeatCoilFluidInletNode > 0) {
7770 148668 : PlantUtilities::SetComponentFlowRate(state,
7771 74334 : state.dataLoopNodes->Node(this->HeatCoilFluidInletNode).MassFlowRate,
7772 : this->HeatCoilFluidInletNode,
7773 : this->HeatCoilFluidOutletNodeNum,
7774 : this->HeatCoilPlantLoc);
7775 : }
7776 :
7777 3850465 : if (this->m_SuppCoilExists &&
7778 1243700 : (state.dataUnitarySystems->HeatingLoad || state.dataUnitarySystems->CoolingLoad || state.dataUnitarySystems->MoistureLoad < 0.0)) {
7779 602134 : if ((FullSensibleOutput < (state.dataUnitarySystems->QToHeatSetPt - DataHVACGlobals::SmallLoad)) && !FirstHVACIteration) {
7780 112704 : SupHeaterLoad = max(0.0, state.dataUnitarySystems->QToHeatSetPt - FullSensibleOutput);
7781 112704 : this->m_SupHeaterLoad = 0.0;
7782 : // what does this line even do? I know we want the supplemental heater on only if there is a dehum load,
7783 : // but for HP's the supp heater should also run if the heating coil can't turn on
7784 : // (i.e., this line calc's a supp heater load, then next line also calc's it?)
7785 112704 : if (state.dataUnitarySystems->MoistureLoad < 0.0) this->m_SupHeaterLoad = SupHeaterLoad;
7786 : // so it look's like this next line should only be valid for HP's.
7787 112704 : if (this->m_DesignSuppHeatingCapacity > 0.0) {
7788 112704 : this->m_SuppHeatPartLoadFrac = min(1.0, SupHeaterLoad / this->m_DesignSuppHeatingCapacity);
7789 : }
7790 : } else {
7791 489430 : SupHeaterLoad = 0.0;
7792 489430 : this->m_SuppHeatPartLoadFrac = 0.0;
7793 : }
7794 : } else {
7795 1898722 : SupHeaterLoad = 0.0;
7796 1898722 : this->m_SuppHeatPartLoadFrac = 0.0;
7797 : }
7798 :
7799 2500856 : this->calcUnitarySystemToLoad(state,
7800 : AirLoopNum,
7801 : FirstHVACIteration,
7802 : CoolPLR,
7803 : HeatPLR,
7804 : OnOffAirFlowRatio,
7805 : sysOutputProvided,
7806 : latOutputProvided,
7807 : HXUnitOn,
7808 : HeatCoilLoad,
7809 : SupHeaterLoad,
7810 : CompressorOn);
7811 : // Why need this second run?
7812 : // check supplemental heating coil outlet temp based on maximum allowed
7813 2500856 : if (this->m_SuppCoilExists) {
7814 : // only need to test for high supply air temp if supplemental coil is operating
7815 747475 : if (this->m_SuppHeatPartLoadFrac > 0.0) {
7816 112696 : this->calcUnitarySystemToLoad(state,
7817 : AirLoopNum,
7818 : FirstHVACIteration,
7819 : CoolPLR,
7820 : HeatPLR,
7821 : OnOffAirFlowRatio,
7822 : sysOutputProvided,
7823 : latOutputProvided,
7824 : HXUnitOn,
7825 : HeatCoilLoad,
7826 : SupHeaterLoad,
7827 : CompressorOn);
7828 112696 : if (this->m_DesignSuppHeatingCapacity > 0.0) {
7829 : // multistage coil part load fraction already set in the calcUnitarySystemToLoad
7830 112696 : if (this->m_NumOfSpeedSuppHeating <= 1) {
7831 63634 : this->m_SuppHeatPartLoadFrac = SupHeaterLoad / this->m_DesignSuppHeatingCapacity;
7832 : }
7833 : } else {
7834 0 : this->m_SuppHeatPartLoadFrac = 0.0;
7835 : }
7836 : }
7837 : }
7838 :
7839 2500856 : if (this->m_SuppCoilFluidInletNode > 0) {
7840 0 : PlantUtilities::SetComponentFlowRate(state,
7841 0 : state.dataLoopNodes->Node(this->m_SuppCoilFluidInletNode).MassFlowRate,
7842 : this->m_SuppCoilFluidInletNode,
7843 : this->m_SuppCoilFluidOutletNodeNum,
7844 : this->m_SuppCoilPlantLoc);
7845 : }
7846 :
7847 2500856 : if (this->m_HeatRecActive) {
7848 0 : PlantUtilities::SetComponentFlowRate(state,
7849 0 : state.dataLoopNodes->Node(this->m_HeatRecoveryInletNodeNum).MassFlowRate,
7850 : this->m_HeatRecoveryInletNodeNum,
7851 : this->m_HeatRecoveryOutletNodeNum,
7852 : this->m_HRPlantLoc);
7853 : }
7854 2500856 : }
7855 :
7856 3559166 : void UnitarySys::controlUnitarySystemtoSP(EnergyPlusData &state,
7857 : int const AirLoopNum, // Primary air loop number
7858 : bool const FirstHVACIteration, // True when first HVAC iteration
7859 : DataHVACGlobals::CompressorOperation &CompressorOn, // compressor on/off control
7860 : Real64 const OAUCoilOutTemp, // the coil inlet temperature of OutdoorAirUnit
7861 : bool HXUnitOn, // Flag to control HX for HXAssisted Cooling Coil
7862 : Real64 &sysOutputProvided, // sensible output at supply air node
7863 : Real64 &latOutputProvided // latent output at supply air node
7864 : )
7865 : {
7866 :
7867 : // SUBROUTINE INFORMATION:
7868 : // AUTHOR Richard Raustad, FSEC
7869 : // DATE WRITTEN February 2013
7870 :
7871 : // PURPOSE OF THIS SUBROUTINE:
7872 : // This subroutine manages component simulation.
7873 :
7874 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
7875 3559166 : Real64 PartLoadRatio = 0.0; // coil operating part-load ratio
7876 3559166 : Real64 OnOffAirFlowRatio = 1.0; // Setpoint based coil control does not use this variable
7877 3559166 : Real64 CoilCoolHeatRat = 1.0; // ratio of cooling to heating PLR for cycling fan RH control
7878 3559166 : Real64 ZoneLoad = 0.0;
7879 3559166 : Real64 HeatCoilLoad = -999.0;
7880 :
7881 : // CALL the series of components that simulate a Unitary System
7882 3559166 : if (this->ATMixerExists) {
7883 : // There is an air terminal mixer
7884 0 : if (this->ATMixerType == DataHVACGlobals::ATMixer_InletSide) { // if there is an inlet side air terminal mixer
7885 : // set the primary air inlet mass flow rate
7886 0 : state.dataLoopNodes->Node(this->m_ATMixerPriNode).MassFlowRate = min(
7887 0 : state.dataLoopNodes->Node(this->m_ATMixerPriNode).MassFlowRateMaxAvail, state.dataLoopNodes->Node(this->AirInNode).MassFlowRate);
7888 : // now calculate the the mixer outlet conditions (and the secondary air inlet flow rate)
7889 : // the mixer outlet flow rate has already been set above (it is the "inlet" node flow rate)
7890 0 : SingleDuct::SimATMixer(state, this->m_ATMixerName, FirstHVACIteration, this->m_ATMixerIndex);
7891 : }
7892 : }
7893 3559166 : if (this->OAMixerExists) {
7894 : // the PTHP does one or the other, but why can't an OA Mixer exist with the AT Mixer?
7895 0 : MixedAir::SimOAMixer(state, blankStdString, FirstHVACIteration, this->OAMixerIndex);
7896 : }
7897 3559166 : if (this->m_FanExists && this->m_FanPlace == FanPlace::BlowThru) {
7898 80088 : if (this->m_FanType_Num == DataHVACGlobals::FanType_SystemModelObject) {
7899 41294 : state.dataHVACFan->fanObjs[this->m_FanIndex]->simulate(state, _, _, _, _);
7900 : } else {
7901 38794 : if (this->m_IsZoneEquipment) {
7902 0 : Fans::SimulateFanComponents(state,
7903 : blankString,
7904 : FirstHVACIteration,
7905 : this->m_FanIndex,
7906 0 : state.dataUnitarySystems->FanSpeedRatio,
7907 0 : state.dataHVACGlobal->ZoneCompTurnFansOn,
7908 0 : state.dataHVACGlobal->ZoneCompTurnFansOff);
7909 : } else {
7910 38794 : Fans::SimulateFanComponents(state, blankString, FirstHVACIteration, this->m_FanIndex, state.dataUnitarySystems->FanSpeedRatio);
7911 : }
7912 : }
7913 : }
7914 :
7915 3559166 : if (this->m_CoolingCoilUpstream) {
7916 :
7917 3559166 : if (this->m_CoolCoilExists) {
7918 3553043 : this->updateUnitarySystemControl(state,
7919 : AirLoopNum,
7920 : this->CoolCoilOutletNodeNum,
7921 : this->CoolCtrlNode,
7922 : OnOffAirFlowRatio,
7923 : FirstHVACIteration,
7924 : OAUCoilOutTemp,
7925 : ZoneLoad,
7926 : this->DesignMaxOutletTemp);
7927 3553043 : this->controlCoolingSystemToSP(state, AirLoopNum, FirstHVACIteration, HXUnitOn, CompressorOn);
7928 3553043 : PartLoadRatio = this->m_CoolingPartLoadFrac;
7929 3553043 : CompressorOn = DataHVACGlobals::CompressorOperation::Off;
7930 3553043 : if (PartLoadRatio > 0.0) {
7931 1195651 : CompressorOn = DataHVACGlobals::CompressorOperation::On;
7932 1195651 : this->m_LastMode = CoolingMode;
7933 : }
7934 3553043 : this->calcUnitaryCoolingSystem(
7935 : state, AirLoopNum, FirstHVACIteration, PartLoadRatio, CompressorOn, OnOffAirFlowRatio, CoilCoolHeatRat, HXUnitOn);
7936 : }
7937 3559166 : if (this->m_HeatCoilExists) {
7938 86211 : this->updateUnitarySystemControl(state,
7939 : AirLoopNum,
7940 : this->HeatCoilOutletNodeNum,
7941 : this->HeatCtrlNode,
7942 : OnOffAirFlowRatio,
7943 : FirstHVACIteration,
7944 : OAUCoilOutTemp,
7945 : ZoneLoad,
7946 : this->DesignMaxOutletTemp);
7947 86211 : this->controlHeatingSystemToSP(state, AirLoopNum, FirstHVACIteration, CompressorOn, HeatCoilLoad);
7948 86211 : PartLoadRatio = this->m_HeatingPartLoadFrac;
7949 86211 : DataHVACGlobals::CompressorOperation CompressOn = DataHVACGlobals::CompressorOperation::Off;
7950 86211 : if (PartLoadRatio > 0.0) {
7951 25735 : CompressOn = DataHVACGlobals::CompressorOperation::On;
7952 25735 : this->m_LastMode = HeatingMode;
7953 : }
7954 86211 : this->calcUnitaryHeatingSystem(state, AirLoopNum, FirstHVACIteration, PartLoadRatio, CompressOn, OnOffAirFlowRatio, HeatCoilLoad);
7955 : }
7956 :
7957 : } else {
7958 :
7959 0 : if (this->m_HeatCoilExists) {
7960 0 : this->updateUnitarySystemControl(state,
7961 : AirLoopNum,
7962 : this->HeatCoilOutletNodeNum,
7963 : this->HeatCtrlNode,
7964 : OnOffAirFlowRatio,
7965 : FirstHVACIteration,
7966 : OAUCoilOutTemp,
7967 : ZoneLoad,
7968 : this->DesignMaxOutletTemp);
7969 0 : this->controlHeatingSystemToSP(state, AirLoopNum, FirstHVACIteration, CompressorOn, HeatCoilLoad);
7970 0 : PartLoadRatio = this->m_HeatingPartLoadFrac;
7971 0 : CompressorOn = DataHVACGlobals::CompressorOperation::Off;
7972 0 : if (PartLoadRatio > 0.0) {
7973 0 : CompressorOn = DataHVACGlobals::CompressorOperation::On;
7974 0 : this->m_LastMode = HeatingMode;
7975 : }
7976 0 : this->calcUnitaryHeatingSystem(state, AirLoopNum, FirstHVACIteration, PartLoadRatio, CompressorOn, OnOffAirFlowRatio, HeatCoilLoad);
7977 : }
7978 0 : if (this->m_CoolCoilExists) {
7979 0 : this->updateUnitarySystemControl(state,
7980 : AirLoopNum,
7981 : this->CoolCoilOutletNodeNum,
7982 : this->CoolCtrlNode,
7983 : OnOffAirFlowRatio,
7984 : FirstHVACIteration,
7985 : OAUCoilOutTemp,
7986 : ZoneLoad,
7987 : this->DesignMaxOutletTemp);
7988 0 : this->controlCoolingSystemToSP(state, AirLoopNum, FirstHVACIteration, HXUnitOn, CompressorOn);
7989 0 : PartLoadRatio = this->m_CoolingPartLoadFrac;
7990 0 : CompressorOn = DataHVACGlobals::CompressorOperation::Off;
7991 0 : if (PartLoadRatio > 0.0) {
7992 0 : CompressorOn = DataHVACGlobals::CompressorOperation::On;
7993 0 : this->m_LastMode = CoolingMode;
7994 : }
7995 0 : this->calcUnitaryCoolingSystem(
7996 : state, AirLoopNum, FirstHVACIteration, PartLoadRatio, CompressorOn, OnOffAirFlowRatio, CoilCoolHeatRat, HXUnitOn);
7997 : }
7998 : }
7999 :
8000 3559166 : if (this->m_FanExists && this->m_FanPlace == FanPlace::DrawThru) {
8001 0 : if (this->m_FanType_Num == DataHVACGlobals::FanType_SystemModelObject) {
8002 0 : state.dataHVACFan->fanObjs[this->m_FanIndex]->simulate(state, _, _, _, _);
8003 : } else {
8004 0 : if (this->m_IsZoneEquipment) {
8005 0 : Fans::SimulateFanComponents(state,
8006 : blankString,
8007 : FirstHVACIteration,
8008 : this->m_FanIndex,
8009 0 : state.dataUnitarySystems->FanSpeedRatio,
8010 0 : state.dataHVACGlobal->ZoneCompTurnFansOn,
8011 0 : state.dataHVACGlobal->ZoneCompTurnFansOff);
8012 : } else {
8013 0 : Fans::SimulateFanComponents(state, blankString, FirstHVACIteration, this->m_FanIndex, state.dataUnitarySystems->FanSpeedRatio);
8014 : }
8015 : }
8016 : }
8017 :
8018 3559166 : if (this->m_SuppCoilExists) {
8019 80088 : state.dataUnitarySystems->SuppHeatingCoilFlag = true;
8020 80088 : this->updateUnitarySystemControl(state,
8021 : AirLoopNum,
8022 : this->SuppCoilOutletNodeNum,
8023 : this->SuppCtrlNode,
8024 : OnOffAirFlowRatio,
8025 : FirstHVACIteration,
8026 : OAUCoilOutTemp,
8027 : ZoneLoad,
8028 : this->DesignMaxOutletTemp);
8029 80088 : this->controlSuppHeatSystemToSP(state, AirLoopNum, FirstHVACIteration);
8030 80088 : this->calcUnitarySuppSystemToSP(state, FirstHVACIteration);
8031 80088 : state.dataUnitarySystems->SuppHeatingCoilFlag = false;
8032 : }
8033 :
8034 : // If there is a supply side air terminal mixer, calculate its output
8035 3559166 : if (this->ATMixerExists) {
8036 0 : if (this->ATMixerType == DataHVACGlobals::ATMixer_SupplySide) {
8037 0 : SingleDuct::SimATMixer(state, this->m_ATMixerName, FirstHVACIteration, this->m_ATMixerIndex);
8038 : }
8039 : }
8040 :
8041 3559166 : calculateCapacity(state, sysOutputProvided, latOutputProvided);
8042 3559166 : this->m_InitHeatPump = false;
8043 3559166 : }
8044 :
8045 6220198 : void UnitarySys::updateUnitarySystemControl(EnergyPlusData &state,
8046 : int const AirLoopNum, // number of the current air loop being simulated
8047 : int const OutNode, // coil outlet node number
8048 : int const ControlNode, // control node number
8049 : Real64 &OnOffAirFlowRatio,
8050 : bool const FirstHVACIteration,
8051 : Real64 const OAUCoilOutletTemp, // "ONLY" for zoneHVAC:OutdoorAirUnit
8052 : Real64 &ZoneLoad,
8053 : Real64 const MaxOutletTemp // limits heating coil outlet temp [C]
8054 : )
8055 : {
8056 :
8057 : // SUBROUTINE INFORMATION:
8058 : // AUTHOR Richard Raustad, FSEC
8059 : // DATE WRITTEN February 2013
8060 :
8061 : // PURPOSE OF THIS SUBROUTINE:
8062 : // This subroutine is for sizing unitary systems.
8063 :
8064 : // METHODOLOGY EMPLOYED:
8065 : // Either CALL the coil model to get the size or size coil.
8066 : // Current method is to use same methodology as is used in coil objects.
8067 : // Future changes will include a common sizing algorithm and push the calculated
8068 : // size to the coil object prior to first call (so the coil will not DataSizing::AutoSize).
8069 :
8070 : // These initializations are done every iteration
8071 :
8072 : {
8073 6220198 : state.dataUnitarySystems->MoistureLoad = 0.0;
8074 6220198 : this->LoadSHR = 0.0;
8075 6220198 : this->CoilSHR = 0.0;
8076 6220198 : switch (this->m_ControlType) {
8077 2500856 : case UnitarySysCtrlType::Load:
8078 : case UnitarySysCtrlType::CCMASHRAE: {
8079 2500856 : if (AirLoopNum == -1) { // This IF-THEN routine is just for ZoneHVAC:OutdoorAirUnit
8080 0 : ShowWarningError(state, this->UnitType + " \"" + this->Name + "\"");
8081 0 : ShowFatalError(state, "...Load based control is not allowed when used with ZoneHVAC:OutdoorAirUnit");
8082 : }
8083 :
8084 : // here we need to deal with sequenced zone equip
8085 2500856 : state.dataUnitarySystems->HeatingLoad = false;
8086 2500856 : state.dataUnitarySystems->CoolingLoad = false;
8087 2500856 : if (this->m_ZoneSequenceCoolingNum > 0 && this->m_ZoneSequenceHeatingNum > 0 && this->m_AirLoopEquipment) {
8088 : // air loop equipment uses sequenced variables
8089 2493696 : state.dataUnitarySystems->QToCoolSetPt = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(this->ControlZoneNum)
8090 1246848 : .SequencedOutputRequiredToCoolingSP(this->m_ZoneSequenceCoolingNum);
8091 2493696 : state.dataUnitarySystems->QToHeatSetPt = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(this->ControlZoneNum)
8092 1246848 : .SequencedOutputRequiredToHeatingSP(this->m_ZoneSequenceHeatingNum);
8093 1665957 : if (state.dataUnitarySystems->QToHeatSetPt > 0.0 && state.dataUnitarySystems->QToCoolSetPt > 0.0 &&
8094 419109 : state.dataHeatBalFanSys->TempControlType(this->ControlZoneNum) != DataHVACGlobals::ThermostatType::SingleCooling) {
8095 414651 : ZoneLoad = state.dataUnitarySystems->QToHeatSetPt;
8096 414651 : state.dataUnitarySystems->HeatingLoad = true;
8097 836655 : } else if (state.dataUnitarySystems->QToHeatSetPt > 0.0 && state.dataUnitarySystems->QToCoolSetPt > 0.0 &&
8098 4458 : state.dataHeatBalFanSys->TempControlType(this->ControlZoneNum) == DataHVACGlobals::ThermostatType::SingleCooling) {
8099 4458 : ZoneLoad = 0.0;
8100 1395589 : } else if (state.dataUnitarySystems->QToHeatSetPt < 0.0 && state.dataUnitarySystems->QToCoolSetPt < 0.0 &&
8101 567850 : state.dataHeatBalFanSys->TempControlType(this->ControlZoneNum) != DataHVACGlobals::ThermostatType::SingleHeating) {
8102 562969 : ZoneLoad = state.dataUnitarySystems->QToCoolSetPt;
8103 562969 : state.dataUnitarySystems->CoolingLoad = true;
8104 269651 : } else if (state.dataUnitarySystems->QToHeatSetPt < 0.0 && state.dataUnitarySystems->QToCoolSetPt < 0.0 &&
8105 4881 : state.dataHeatBalFanSys->TempControlType(this->ControlZoneNum) == DataHVACGlobals::ThermostatType::SingleHeating) {
8106 4881 : ZoneLoad = 0.0;
8107 259889 : } else if (state.dataUnitarySystems->QToHeatSetPt <= 0.0 && state.dataUnitarySystems->QToCoolSetPt >= 0.0) {
8108 259889 : ZoneLoad = 0.0;
8109 : }
8110 2493696 : state.dataUnitarySystems->MoistureLoad = state.dataZoneEnergyDemand->ZoneSysMoistureDemand(this->ControlZoneNum)
8111 1246848 : .SequencedOutputRequiredToDehumidSP(this->m_ZoneSequenceCoolingNum);
8112 : } else {
8113 : // zone equipment uses Remaining* variables
8114 1254008 : ZoneLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(this->ControlZoneNum).RemainingOutputRequired;
8115 1254008 : state.dataUnitarySystems->QToCoolSetPt =
8116 1254008 : state.dataZoneEnergyDemand->ZoneSysEnergyDemand(this->ControlZoneNum).RemainingOutputReqToCoolSP;
8117 1254008 : state.dataUnitarySystems->QToHeatSetPt =
8118 1254008 : state.dataZoneEnergyDemand->ZoneSysEnergyDemand(this->ControlZoneNum).RemainingOutputReqToHeatSP;
8119 1254008 : state.dataUnitarySystems->MoistureLoad =
8120 1254008 : state.dataZoneEnergyDemand->ZoneSysMoistureDemand(this->ControlZoneNum).RemainingOutputReqToDehumidSP;
8121 1353495 : if (this->m_sysType == SysType::PackagedAC || this->m_sysType == SysType::PackagedHP ||
8122 99487 : this->m_sysType == SysType::PackagedWSHP) {
8123 : // ZoneSysAvailManager is turning on sooner than PTUnit in UnitarySystem. Mimic PTUnit logic.
8124 1825760 : if (state.dataUnitarySystems->QToCoolSetPt < 0.0 &&
8125 594252 : state.dataHeatBalFanSys->TempControlType(this->ControlZoneNum) != DataHVACGlobals::ThermostatType::SingleHeating) {
8126 589239 : ZoneLoad = state.dataUnitarySystems->QToCoolSetPt;
8127 1235994 : } else if (state.dataUnitarySystems->QToHeatSetPt > 0.0 &&
8128 593725 : state.dataHeatBalFanSys->TempControlType(this->ControlZoneNum) != DataHVACGlobals::ThermostatType::SingleCooling) {
8129 593385 : ZoneLoad = state.dataUnitarySystems->QToHeatSetPt;
8130 : } else {
8131 48884 : ZoneLoad = 0.0;
8132 : }
8133 : }
8134 : }
8135 :
8136 3598047 : if (ZoneLoad < 0.0 && state.dataUnitarySystems->MoistureLoad <= 0.0 &&
8137 1316021 : (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_Cooling &&
8138 219954 : state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].SubcoolReheatFlag)) {
8139 1124 : this->LoadSHR =
8140 2248 : ZoneLoad / (ZoneLoad + state.dataUnitarySystems->MoistureLoad *
8141 2248 : Psychrometrics::PsyHgAirFnWTdb(
8142 1124 : state.dataZoneTempPredictorCorrector->zoneHeatBalance(this->ControlZoneNum).ZoneAirHumRat,
8143 1124 : state.dataZoneTempPredictorCorrector->zoneHeatBalance(this->ControlZoneNum).MAT));
8144 1124 : if (this->LoadSHR < 0.0) {
8145 0 : this->LoadSHR = 0.0;
8146 : }
8147 1124 : this->CoilSHR = this->LoadSHR;
8148 : }
8149 :
8150 2500856 : if (this->m_DehumidControlType_Num != DehumCtrlType::None) {
8151 162314 : Real64 H2OHtOfVap = Psychrometrics::PsyHfgAirFnWTdb(state.dataLoopNodes->Node(this->NodeNumOfControlledZone).HumRat,
8152 324628 : state.dataLoopNodes->Node(this->NodeNumOfControlledZone).Temp);
8153 :
8154 : // positive MoistureLoad means no dehumidification load
8155 162314 : state.dataUnitarySystems->MoistureLoad = min(0.0, state.dataUnitarySystems->MoistureLoad * H2OHtOfVap);
8156 : } else {
8157 2338542 : state.dataUnitarySystems->MoistureLoad = 0.0;
8158 : }
8159 :
8160 2500856 : this->initLoadBasedControl(state, AirLoopNum, FirstHVACIteration, OnOffAirFlowRatio, ZoneLoad);
8161 :
8162 : // *** the location of this EMS override looks suspect. If EMS is active the load will be changed but the CoolingLoad and HeatingLoad
8163 : // flags are not updated. suggest this be moved up above InitLoadBasedControl function on previous line so the EMS loads are used in
8164 : // that routine EMS override point
8165 2500856 : if (this->m_EMSOverrideSensZoneLoadRequest) ZoneLoad = this->m_EMSSensibleZoneLoadValue;
8166 2500856 : if (this->m_EMSOverrideMoistZoneLoadRequest) state.dataUnitarySystems->MoistureLoad = this->m_EMSMoistureZoneLoadValue;
8167 :
8168 2500856 : this->m_SimASHRAEModel = false; // flag used to envoke ASHRAE 90.1 model calculations
8169 : // allows non-ASHSRAE compliant coil types to be modeled using non-ASHAR90 method. Constant fan operating mode is required.
8170 2500856 : if (this->m_FanOpMode == DataHVACGlobals::ContFanCycCoil) {
8171 1136906 : if (state.dataUnitarySystems->CoolingLoad) {
8172 534482 : if (this->m_ValidASHRAECoolCoil) this->m_SimASHRAEModel = true;
8173 602424 : } else if (state.dataUnitarySystems->HeatingLoad) {
8174 453368 : if (this->m_ValidASHRAEHeatCoil) this->m_SimASHRAEModel = true;
8175 : }
8176 : }
8177 2500856 : } break;
8178 3719342 : case UnitarySysCtrlType::Setpoint: {
8179 3719342 : if (AirLoopNum == -1) { // This IF-THEN routine is just for ZoneHVAC:OutdoorAIRUNIT
8180 :
8181 75781 : if (ControlNode == 0) {
8182 0 : this->m_DesiredOutletTemp = OAUCoilOutletTemp;
8183 75781 : } else if (ControlNode == OutNode) {
8184 75781 : this->m_DesiredOutletTemp = OAUCoilOutletTemp;
8185 : }
8186 : // If the unitary system is an Outdoor Air Unit, the desired coil outlet humidity level is set to 1.0 (no dehum)
8187 75781 : this->m_DesiredOutletHumRat = 1.0;
8188 :
8189 : } else { // Not Outdoor Air Unit. Either airloop or zone equipment
8190 3643561 : Real64 humRatMaxSP = 1.0;
8191 3643561 : this->m_DesiredOutletHumRat = humRatMaxSP;
8192 3643561 : if (ControlNode == 0) {
8193 0 : this->m_DesiredOutletTemp = 0.0;
8194 0 : if (OutNode > 0) {
8195 0 : if (state.dataLoopNodes->Node(OutNode).HumRatMax > 0.0) {
8196 0 : this->m_DesiredOutletHumRat = state.dataLoopNodes->Node(OutNode).HumRatMax;
8197 : }
8198 : }
8199 3643561 : } else if (ControlNode == OutNode) {
8200 3372260 : if (this->m_ISHundredPercentDOASDXCoil && this->m_RunOnSensibleLoad) {
8201 23669 : if (state.dataLoopNodes->Node(ControlNode).HumRatMax > 0.0)
8202 19955 : humRatMaxSP = state.dataLoopNodes->Node(ControlNode).HumRatMax;
8203 71007 : this->frostControlSetPointLimit(state,
8204 23669 : state.dataLoopNodes->Node(ControlNode).TempSetPoint,
8205 : humRatMaxSP,
8206 23669 : state.dataEnvrn->OutBaroPress,
8207 : this->DesignMinOutletTemp,
8208 : 1);
8209 : }
8210 3372260 : this->m_DesiredOutletTemp = state.dataLoopNodes->Node(ControlNode).TempSetPoint;
8211 : // IF HumRatMax is zero, then there is no request from SetpointManager:SingleZone:Humidity:Maximum
8212 : // user might place temp SP at system outlet and HumRat set point at coil outlet
8213 3372260 : if (this->m_DehumidControlType_Num != DehumCtrlType::None) {
8214 189821 : if (state.dataLoopNodes->Node(this->AirOutNode).HumRatMax > 0.0)
8215 185290 : humRatMaxSP = state.dataLoopNodes->Node(this->AirOutNode).HumRatMax;
8216 189821 : if (state.dataLoopNodes->Node(ControlNode).HumRatMax > 0.0)
8217 153954 : humRatMaxSP = state.dataLoopNodes->Node(ControlNode).HumRatMax;
8218 189821 : if (this->m_ISHundredPercentDOASDXCoil && this->m_RunOnLatentLoad) {
8219 79820 : this->frostControlSetPointLimit(state,
8220 19955 : state.dataLoopNodes->Node(ControlNode).TempSetPoint,
8221 19955 : state.dataLoopNodes->Node(ControlNode).HumRatMax,
8222 19955 : state.dataEnvrn->OutBaroPress,
8223 : this->DesignMinOutletTemp,
8224 : 2);
8225 19955 : humRatMaxSP = state.dataLoopNodes->Node(ControlNode).HumRatMax;
8226 : }
8227 189821 : this->m_DesiredOutletHumRat = humRatMaxSP; // should this be outside so as to capture humrat for 100%DOASDXCoil ?
8228 : }
8229 : } else {
8230 271301 : if (state.dataLoopNodes->Node(ControlNode).HumRatMax > 0.0) humRatMaxSP = state.dataLoopNodes->Node(ControlNode).HumRatMax;
8231 271301 : if (state.dataLoopNodes->Node(OutNode).HumRatMax > 0.0) humRatMaxSP = state.dataLoopNodes->Node(OutNode).HumRatMax;
8232 271301 : if (this->m_ISHundredPercentDOASDXCoil && this->m_RunOnSensibleLoad) {
8233 0 : this->frostControlSetPointLimit(state,
8234 0 : state.dataLoopNodes->Node(ControlNode).TempSetPoint,
8235 : humRatMaxSP,
8236 0 : state.dataEnvrn->OutBaroPress,
8237 : this->DesignMinOutletTemp,
8238 : 1);
8239 : }
8240 542602 : this->m_DesiredOutletTemp = state.dataLoopNodes->Node(ControlNode).TempSetPoint -
8241 271301 : (state.dataLoopNodes->Node(ControlNode).Temp - state.dataLoopNodes->Node(OutNode).Temp);
8242 271301 : if (this->m_DehumidControlType_Num != DehumCtrlType::None) {
8243 0 : if (this->m_ISHundredPercentDOASDXCoil && this->m_RunOnLatentLoad) {
8244 0 : this->frostControlSetPointLimit(state,
8245 0 : state.dataLoopNodes->Node(ControlNode).TempSetPoint,
8246 0 : state.dataLoopNodes->Node(ControlNode).HumRatMax,
8247 0 : state.dataEnvrn->OutBaroPress,
8248 : this->DesignMinOutletTemp,
8249 : 2);
8250 0 : humRatMaxSP = state.dataLoopNodes->Node(ControlNode).HumRatMax;
8251 : }
8252 0 : this->m_DesiredOutletHumRat = humRatMaxSP; // should this be outside so as to capture humrat for 100%DOASDXCoil ?
8253 : }
8254 : }
8255 : }
8256 3719342 : this->m_DesiredOutletTemp = min(this->m_DesiredOutletTemp, MaxOutletTemp);
8257 3719342 : } break;
8258 0 : default: {
8259 : // should never get here, only 3 control types
8260 0 : } break;
8261 : }
8262 : }
8263 6220198 : }
8264 20486 : void UnitarySys::controlUnitarySystemOutputEMS(EnergyPlusData &state,
8265 : int const AirLoopNum, // Index to air loop
8266 : bool const FirstHVACIteration, // True when first HVAC iteration
8267 : Real64 &OnOffAirFlowRatio, // ratio of heating PLR to cooling PLR (is this correct?)
8268 : Real64 const ZoneLoad,
8269 : Real64 &FullSensibleOutput,
8270 : bool &HXUnitOn, // Flag to control HX for HXAssisted Cooling Coil
8271 : DataHVACGlobals::CompressorOperation CompressorOn)
8272 : {
8273 20486 : Real64 PartLoadRatio = 1.0;
8274 20486 : Real64 CoolPLR = 0.0;
8275 20486 : Real64 HeatPLR = 0.0;
8276 20486 : DataHVACGlobals::CompressorOperation CompressorONFlag = CompressorOn;
8277 20486 : Real64 HeatCoilLoad = 0.0;
8278 20486 : Real64 SupHeaterLoad = 0.0;
8279 : Real64 SensOutput; // sensible output
8280 : Real64 LatOutput; // latent output
8281 20486 : this->FanPartLoadRatio = 0.0;
8282 20486 : this->setOnOffMassFlowRate(state, OnOffAirFlowRatio, PartLoadRatio);
8283 :
8284 21477 : if (!state.dataUnitarySystems->HeatingLoad && !state.dataUnitarySystems->CoolingLoad && state.dataUnitarySystems->MoistureLoad >= 0.0) return;
8285 19495 : int SpeedNumEMS = ceil(this->m_EMSOverrideCoilSpeedNumValue);
8286 19495 : bool useMaxedSpeed = false;
8287 38990 : std::string useMaxedSpeedCoilName;
8288 19495 : if (state.dataUnitarySystems->HeatingLoad) {
8289 0 : if (SpeedNumEMS > this->m_NumOfSpeedHeating) {
8290 0 : SpeedNumEMS = this->m_NumOfSpeedHeating;
8291 0 : useMaxedSpeed = true;
8292 0 : useMaxedSpeedCoilName = this->m_HeatingCoilName;
8293 : }
8294 0 : this->m_HeatingSpeedNum = SpeedNumEMS;
8295 : } else {
8296 19495 : if (SpeedNumEMS > this->m_NumOfSpeedCooling) {
8297 0 : SpeedNumEMS = this->m_NumOfSpeedCooling;
8298 0 : useMaxedSpeed = true;
8299 0 : useMaxedSpeedCoilName = this->m_CoolingCoilName;
8300 : }
8301 19495 : this->m_CoolingSpeedNum = SpeedNumEMS;
8302 : }
8303 19495 : if (useMaxedSpeed) {
8304 0 : this->m_CoilSpeedErrIdx++;
8305 0 : ShowRecurringWarningErrorAtEnd(state,
8306 0 : "Wrong coil speed EMS override value, for unit=\"" + useMaxedSpeedCoilName +
8307 : "\". Exceeding maximum coil speed level. Speed level is set to the maximum coil speed level allowed.",
8308 : this->m_CoilSpeedErrIdx,
8309 : this->m_EMSOverrideCoilSpeedNumValue,
8310 : this->m_EMSOverrideCoilSpeedNumValue,
8311 : _,
8312 : "",
8313 : "");
8314 : }
8315 :
8316 19495 : if (state.dataUnitarySystems->HeatingLoad) {
8317 0 : CoolPLR = 0.0;
8318 0 : HeatPLR = 1.0;
8319 0 : this->m_HeatingCoilSensDemand = ZoneLoad;
8320 :
8321 0 : if (this->m_HeatingSpeedNum == 1) {
8322 0 : this->m_HeatingSpeedRatio = 0.0;
8323 0 : this->m_HeatingCycRatio = this->m_EMSOverrideCoilSpeedNumValue - floor(this->m_EMSOverrideCoilSpeedNumValue);
8324 0 : if (useMaxedSpeed || this->m_HeatingCycRatio == 0) {
8325 0 : this->m_HeatingCycRatio = 1;
8326 : }
8327 : } else {
8328 0 : this->m_HeatingCycRatio = 1.0;
8329 0 : this->m_HeatingSpeedRatio = this->m_EMSOverrideCoilSpeedNumValue - floor(this->m_EMSOverrideCoilSpeedNumValue);
8330 0 : if (useMaxedSpeed || this->m_HeatingSpeedRatio == 0) {
8331 0 : this->m_HeatingSpeedRatio = 1;
8332 : }
8333 : }
8334 0 : this->m_WSHPRuntimeFrac = HeatPLR;
8335 : } else { // Cooling or moisture load
8336 19495 : HeatPLR = 0.0;
8337 19495 : CoolPLR = 1.0;
8338 19495 : if (state.dataUnitarySystems->CoolingLoad) {
8339 19495 : this->m_CoolingCoilSensDemand = std::abs(ZoneLoad);
8340 : } else {
8341 0 : this->m_CoolingCoilSensDemand = 0.0;
8342 : }
8343 19495 : this->m_CoolingCoilLatentDemand = std::abs(state.dataUnitarySystems->MoistureLoad);
8344 :
8345 19495 : if (this->m_CoolingSpeedNum == 1) {
8346 518 : this->m_CoolingSpeedRatio = 0.0;
8347 518 : this->m_CoolingCycRatio = this->m_EMSOverrideCoilSpeedNumValue - floor(this->m_EMSOverrideCoilSpeedNumValue);
8348 518 : if (useMaxedSpeed || this->m_CoolingCycRatio == 0) {
8349 518 : this->m_CoolingCycRatio = 1;
8350 : }
8351 : } else {
8352 18977 : this->m_CoolingCycRatio = 1.0;
8353 18977 : this->m_CoolingSpeedRatio = this->m_EMSOverrideCoilSpeedNumValue - floor(this->m_EMSOverrideCoilSpeedNumValue);
8354 18977 : if (useMaxedSpeed || this->m_CoolingSpeedRatio == 0) {
8355 0 : this->m_CoolingSpeedRatio = 1;
8356 : }
8357 : }
8358 19495 : this->m_WSHPRuntimeFrac = CoolPLR;
8359 : }
8360 19495 : this->calcUnitarySystemToLoad(state,
8361 : AirLoopNum,
8362 : FirstHVACIteration,
8363 : CoolPLR,
8364 : HeatPLR,
8365 : OnOffAirFlowRatio,
8366 : SensOutput,
8367 : LatOutput,
8368 19495 : HXUnitOn,
8369 : HeatCoilLoad,
8370 : SupHeaterLoad,
8371 : CompressorONFlag);
8372 :
8373 19495 : FullSensibleOutput = SensOutput;
8374 :
8375 19495 : if (!state.dataUnitarySystems->HeatingLoad && !state.dataUnitarySystems->CoolingLoad) {
8376 : // no load
8377 0 : if (state.dataUnitarySystems->MoistureLoad > LatOutput) return;
8378 : // Dehumcontrol_Multimode only controls RH if there is a sensible load
8379 0 : if (this->m_DehumidControlType_Num == DehumCtrlType::Multimode) return;
8380 : }
8381 19495 : HXUnitOn = true;
8382 19495 : this->calcUnitarySystemToLoad(state,
8383 : AirLoopNum,
8384 : FirstHVACIteration,
8385 : CoolPLR,
8386 : HeatPLR,
8387 : OnOffAirFlowRatio,
8388 : SensOutput,
8389 : LatOutput,
8390 19495 : HXUnitOn,
8391 : HeatCoilLoad,
8392 : SupHeaterLoad,
8393 : CompressorONFlag);
8394 19495 : Real64 CpAir = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(this->CoolCoilInletNodeNum).HumRat);
8395 : Real64 CoolingOnlySensibleOutput =
8396 19495 : state.dataLoopNodes->Node(this->CoolCoilInletNodeNum).MassFlowRate * CpAir *
8397 38990 : ((state.dataLoopNodes->Node(this->NodeNumOfControlledZone).Temp - state.dataLoopNodes->Node(this->CoolCoilOutletNodeNum).Temp) -
8398 38990 : (state.dataLoopNodes->Node(this->HeatCoilOutletNodeNum).Temp - state.dataLoopNodes->Node(this->HeatCoilInletNodeNum).Temp));
8399 19495 : if (state.dataUnitarySystems->QToHeatSetPt < 0.0) {
8400 : // Calculate the reheat coil load wrt the heating setpoint temperature. Reheat coil picks up
8401 : // the entire excess sensible cooling (DX cooling coil and impact of outdoor air).
8402 19495 : this->m_DehumidInducedHeatingDemandRate = max(0.0, (CoolingOnlySensibleOutput + state.dataUnitarySystems->QToHeatSetPt));
8403 : // Heating mode and dehumidification is required
8404 0 : } else if (state.dataUnitarySystems->QToHeatSetPt >= 0.0) {
8405 : // Calculate the reheat coil load as the sensible capacity of the DX cooling coil only. Let
8406 : // the heating coil pick up the load due to outdoor air.
8407 0 : this->m_DehumidInducedHeatingDemandRate = max(0.0, CoolingOnlySensibleOutput);
8408 : }
8409 : }
8410 :
8411 2504203 : void UnitarySys::controlUnitarySystemOutput(EnergyPlusData &state,
8412 : int const AirLoopNum, // Index to air loop
8413 : bool const FirstHVACIteration, // True when first HVAC iteration
8414 : Real64 &OnOffAirFlowRatio, // ratio of heating PLR to cooling PLR (is this correct?)
8415 : Real64 const ZoneLoad,
8416 : Real64 &FullSensibleOutput,
8417 : bool &HXUnitOn, // Flag to control HX for HXAssisted Cooling Coil
8418 : DataHVACGlobals::CompressorOperation CompressorOn)
8419 : {
8420 :
8421 : // SUBROUTINE INFORMATION:
8422 : // AUTHOR Richard Raustad, FSEC
8423 : // DATE WRITTEN February 2013
8424 :
8425 : // PURPOSE OF THIS SUBROUTINE:
8426 : // This subroutine determines operating PLR and calculates the load based system output.
8427 :
8428 : // SUBROUTINE PARAMETER DEFINITIONS:
8429 2504203 : int constexpr MaxIter(100); // maximum number of iterations
8430 :
8431 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
8432 : int SpeedNum; // multi-speed coil speed number
8433 : Real64 SensOutputOn; // sensible output at PLR = 1 [W]
8434 : Real64 LatOutputOn; // latent output at PLR = 1 [W]
8435 : Real64 TempLoad; // represents either a sensible or latent load [W]
8436 : Real64 TempSysOutput; // represents either a sensible or latent capacity [W]
8437 : Real64 TempSensOutput; // iterative sensible capacity [W]
8438 : Real64 TempLatOutput; // iterative latent capacity [W]
8439 : Real64 TempMinPLR; // iterative minimum PLR
8440 : Real64 TempMaxPLR; // iterative maximum PLR
8441 : Real64 CoolingOnlySensibleOutput; // use to calculate dehumidification induced heating [W]
8442 : Real64 CpAir; // specific heat of air [J/kg_C]
8443 : Real64 FullLoadAirOutletTemp; // saved full load outlet air temperature [C]
8444 : Real64 FullLoadAirOutletHumRat; // saved full load outlet air humidity ratio [kg/kg]
8445 : Real64 NoLoadOutletTemp; // outlet temp of system with coils off [C]
8446 :
8447 2519180 : std::string CompName = this->Name;
8448 2504203 : int OutletNode = this->AirOutNode;
8449 :
8450 2504203 : if (ScheduleManager::GetCurrentScheduleValue(state, this->m_SysAvailSchedPtr) <= 0.0) {
8451 4596 : return;
8452 : }
8453 2499607 : if (this->m_EMSOverrideCoilSpeedNumOn) {
8454 20486 : this->controlUnitarySystemOutputEMS(
8455 : state, AirLoopNum, FirstHVACIteration, OnOffAirFlowRatio, ZoneLoad, FullSensibleOutput, HXUnitOn, CompressorOn);
8456 20486 : return;
8457 : }
8458 :
8459 2479121 : Real64 PartLoadRatio = 0.0; // Get no load result
8460 : // fan and coil PLR are disconnected when using ASHRAE model, don't confuse these for other models
8461 2479121 : this->FanPartLoadRatio = 0.0;
8462 2479121 : int SolFlag = 0; // # of iterations IF positive, -1 means failed to converge, -2 means bounds are incorrect
8463 2479121 : int SolFlagLat = 0; // # of iterations IF positive, -1 means failed to converge, -2 means bounds are incorrect
8464 :
8465 2479121 : Real64 SensOutputOff = 0.0;
8466 2479121 : Real64 LatOutputOff = 0.0;
8467 2479121 : Real64 CoolPLR = 0.0;
8468 2479121 : Real64 HeatPLR = 0.0;
8469 2479121 : DataHVACGlobals::CompressorOperation CompressorONFlag = DataHVACGlobals::CompressorOperation::Off;
8470 2479121 : Real64 HeatCoilLoad = 0.0;
8471 2479121 : Real64 SupHeaterLoad = 0.0;
8472 :
8473 2479121 : this->m_WSHPRuntimeFrac = 0.0;
8474 :
8475 2479121 : this->setOnOffMassFlowRate(state, OnOffAirFlowRatio, PartLoadRatio);
8476 :
8477 2479121 : if (!state.dataUnitarySystems->HeatingLoad && !state.dataUnitarySystems->CoolingLoad && state.dataUnitarySystems->MoistureLoad >= 0.0) return;
8478 :
8479 2183408 : this->calcUnitarySystemToLoad(state,
8480 : AirLoopNum,
8481 : FirstHVACIteration,
8482 : CoolPLR,
8483 : HeatPLR,
8484 : OnOffAirFlowRatio,
8485 : SensOutputOff,
8486 : LatOutputOff,
8487 2183408 : HXUnitOn,
8488 : HeatCoilLoad,
8489 : SupHeaterLoad,
8490 : CompressorONFlag);
8491 2183408 : FullSensibleOutput = SensOutputOff;
8492 2183408 : NoLoadOutletTemp = state.dataLoopNodes->Node(OutletNode).Temp;
8493 :
8494 2183408 : if (!state.dataUnitarySystems->HeatingLoad && !state.dataUnitarySystems->CoolingLoad) {
8495 : // no load
8496 0 : if (state.dataUnitarySystems->MoistureLoad > LatOutputOff) return;
8497 : // Dehumcontrol_Multimode only controls RH if there is a sensible load
8498 0 : if (this->m_DehumidControlType_Num == DehumCtrlType::Multimode) return;
8499 : }
8500 :
8501 : // determine if PLR=0 meets the load
8502 2183408 : switch (state.dataHeatBalFanSys->TempControlType(this->ControlZoneNum)) {
8503 48923 : case DataHVACGlobals::ThermostatType::SingleHeating: {
8504 48923 : if (state.dataUnitarySystems->HeatingLoad && SensOutputOff > ZoneLoad &&
8505 0 : (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad > LatOutputOff))
8506 0 : return;
8507 48923 : if (!state.dataUnitarySystems->HeatingLoad &&
8508 0 : (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad > LatOutputOff))
8509 0 : return;
8510 48923 : } break;
8511 53795 : case DataHVACGlobals::ThermostatType::SingleCooling: {
8512 53799 : if (state.dataUnitarySystems->CoolingLoad && SensOutputOff < ZoneLoad &&
8513 2 : (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad > LatOutputOff))
8514 2 : return;
8515 53793 : if (!state.dataUnitarySystems->CoolingLoad &&
8516 0 : (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad > LatOutputOff))
8517 0 : return;
8518 53793 : } break;
8519 2080690 : case DataHVACGlobals::ThermostatType::SingleHeatCool:
8520 : case DataHVACGlobals::ThermostatType::DualSetPointWithDeadBand: {
8521 2080702 : if (state.dataUnitarySystems->HeatingLoad && SensOutputOff > ZoneLoad &&
8522 6 : (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad > LatOutputOff))
8523 6 : return;
8524 2084534 : if (state.dataUnitarySystems->CoolingLoad && SensOutputOff < ZoneLoad &&
8525 1925 : (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad > LatOutputOff))
8526 1925 : return;
8527 2078759 : if (!state.dataUnitarySystems->HeatingLoad && !state.dataUnitarySystems->CoolingLoad &&
8528 0 : (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad > LatOutputOff))
8529 0 : return;
8530 2078759 : } break;
8531 0 : default: {
8532 : // should never get here
8533 0 : } break;
8534 : }
8535 :
8536 : // if a variable speed unit, the SensOutputOff at SpeedNum=1 must be checked to see if it exceeds the ZoneLoad
8537 : // This is still no load but at the first speed above idle
8538 5444334 : if ((state.dataUnitarySystems->HeatingLoad && this->m_NumOfSpeedHeating > 0) ||
8539 3221611 : (state.dataUnitarySystems->CoolingLoad && this->m_NumOfSpeedCooling > 0)) {
8540 1181278 : if (this->m_Staged) {
8541 0 : if (state.dataUnitarySystems->HeatingLoad) {
8542 0 : this->m_HeatingSpeedNum = this->m_StageNum;
8543 : } else {
8544 0 : this->m_CoolingSpeedNum = std::abs(this->m_StageNum);
8545 : }
8546 : } else {
8547 1181278 : if (state.dataUnitarySystems->HeatingLoad) {
8548 99894 : this->m_HeatingSpeedNum = 1;
8549 : } else {
8550 1081384 : this->m_CoolingSpeedNum = 1;
8551 : }
8552 : }
8553 : // calcUnitarySystemToLoad calls setOnOffMassFlowRate so probably no need to call this here
8554 1181278 : this->setOnOffMassFlowRate(state, OnOffAirFlowRatio, PartLoadRatio);
8555 1181278 : this->calcUnitarySystemToLoad(state,
8556 : AirLoopNum,
8557 : FirstHVACIteration,
8558 : CoolPLR,
8559 : HeatPLR,
8560 : OnOffAirFlowRatio,
8561 : SensOutputOff,
8562 : LatOutputOff,
8563 1181278 : HXUnitOn,
8564 : HeatCoilLoad,
8565 : SupHeaterLoad,
8566 : CompressorONFlag);
8567 1181278 : FullSensibleOutput = SensOutputOff;
8568 :
8569 1181278 : switch (state.dataHeatBalFanSys->TempControlType(this->ControlZoneNum)) {
8570 4498 : case DataHVACGlobals::ThermostatType::SingleHeating: {
8571 4498 : if (state.dataUnitarySystems->HeatingLoad && SensOutputOff > ZoneLoad &&
8572 0 : (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad > LatOutputOff))
8573 0 : return;
8574 4498 : if (!state.dataUnitarySystems->HeatingLoad &&
8575 0 : (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad > LatOutputOff))
8576 0 : return;
8577 4498 : } break;
8578 39933 : case DataHVACGlobals::ThermostatType::SingleCooling: {
8579 39933 : if (state.dataUnitarySystems->CoolingLoad && SensOutputOff < ZoneLoad && this->m_DehumidControlType_Num != DehumCtrlType::CoolReheat)
8580 0 : return;
8581 39933 : if (state.dataUnitarySystems->CoolingLoad && SensOutputOff < ZoneLoad &&
8582 0 : (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad > LatOutputOff))
8583 0 : return;
8584 39933 : if (!state.dataUnitarySystems->CoolingLoad &&
8585 0 : (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad > LatOutputOff))
8586 0 : return;
8587 39933 : } break;
8588 1136847 : case DataHVACGlobals::ThermostatType::SingleHeatCool:
8589 : case DataHVACGlobals::ThermostatType::DualSetPointWithDeadBand: {
8590 1136889 : if (state.dataUnitarySystems->HeatingLoad && SensOutputOff > ZoneLoad &&
8591 21 : (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad > LatOutputOff))
8592 21 : return;
8593 1136826 : if (state.dataUnitarySystems->CoolingLoad && SensOutputOff < ZoneLoad && this->m_DehumidControlType_Num != DehumCtrlType::CoolReheat)
8594 4985 : return;
8595 1132467 : if (state.dataUnitarySystems->CoolingLoad && SensOutputOff < ZoneLoad &&
8596 1252 : (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad > LatOutputOff))
8597 0 : return;
8598 1131841 : if (!state.dataUnitarySystems->HeatingLoad && !state.dataUnitarySystems->CoolingLoad &&
8599 0 : (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad > LatOutputOff))
8600 0 : return;
8601 1131841 : } break;
8602 0 : default: {
8603 : // should never get here
8604 0 : } break;
8605 : }
8606 : }
8607 :
8608 2176469 : PartLoadRatio = 1.0; // Get full load result
8609 2176469 : this->FanPartLoadRatio = 1.0;
8610 2176469 : CompressorONFlag = CompressorOn;
8611 :
8612 2176469 : if (state.dataUnitarySystems->HeatingLoad) {
8613 1041424 : CoolPLR = 0.0;
8614 1041424 : HeatPLR = 1.0;
8615 1041424 : this->m_HeatingCoilSensDemand = ZoneLoad;
8616 1041424 : this->m_WSHPRuntimeFrac = HeatPLR;
8617 1041424 : if (this->m_NumOfSpeedHeating > 0) {
8618 99873 : this->m_HeatingSpeedRatio = 1.0;
8619 99873 : this->m_HeatingCycRatio = 1.0;
8620 99873 : this->m_HeatingSpeedNum = this->m_NumOfSpeedHeating;
8621 : }
8622 1041424 : if (this->m_Staged && this->m_StageNum > 0) {
8623 0 : if (this->m_NumOfSpeedHeating > 0) {
8624 0 : this->m_HeatingSpeedNum = min(this->m_StageNum, this->m_NumOfSpeedHeating);
8625 0 : this->m_HeatingSpeedRatio = 0.0;
8626 : }
8627 : // calcUnitarySystemToLoad calls setOnOffMassFlowRate so probably no need to call this here
8628 0 : this->setOnOffMassFlowRate(state, OnOffAirFlowRatio, PartLoadRatio);
8629 0 : this->calcUnitarySystemToLoad(state,
8630 : AirLoopNum,
8631 : FirstHVACIteration,
8632 : CoolPLR,
8633 : HeatPLR,
8634 : OnOffAirFlowRatio,
8635 : SensOutputOff,
8636 : LatOutputOff,
8637 0 : HXUnitOn,
8638 : HeatCoilLoad,
8639 : SupHeaterLoad,
8640 : CompressorONFlag);
8641 0 : if (SensOutputOff > ZoneLoad) return;
8642 0 : if (this->m_NumOfSpeedHeating > 0) this->m_HeatingSpeedRatio = 1.0;
8643 : }
8644 1135045 : } else if (state.dataUnitarySystems->CoolingLoad || state.dataUnitarySystems->MoistureLoad < LatOutputOff) {
8645 1135045 : CoolPLR = 1.0;
8646 1135045 : HeatPLR = 0.0;
8647 1135045 : if (state.dataUnitarySystems->CoolingLoad) {
8648 1135045 : this->m_CoolingCoilSensDemand = std::abs(ZoneLoad);
8649 : } else {
8650 0 : this->m_CoolingCoilSensDemand = 0.0;
8651 : }
8652 1135045 : this->m_CoolingCoilLatentDemand = std::abs(state.dataUnitarySystems->MoistureLoad);
8653 1135045 : this->m_WSHPRuntimeFrac = CoolPLR;
8654 1135045 : if (this->m_NumOfSpeedCooling > 0) {
8655 1076399 : this->m_CoolingSpeedRatio = 1.0;
8656 1076399 : this->m_CoolingCycRatio = 1.0;
8657 1076399 : this->m_CoolingSpeedNum = this->m_NumOfSpeedCooling;
8658 : }
8659 1135045 : if (this->m_Staged && this->m_StageNum < 0) {
8660 0 : if (this->m_NumOfSpeedCooling > 0) this->m_CoolingSpeedNum = min(std::abs(this->m_StageNum), this->m_NumOfSpeedCooling);
8661 0 : this->setOnOffMassFlowRate(state, OnOffAirFlowRatio, PartLoadRatio);
8662 0 : this->m_CoolingSpeedRatio = 0.0;
8663 0 : this->calcUnitarySystemToLoad(state,
8664 : AirLoopNum,
8665 : FirstHVACIteration,
8666 : CoolPLR,
8667 : HeatPLR,
8668 : OnOffAirFlowRatio,
8669 : SensOutputOff,
8670 : LatOutputOff,
8671 0 : HXUnitOn,
8672 : HeatCoilLoad,
8673 : SupHeaterLoad,
8674 : CompressorONFlag);
8675 0 : if (SensOutputOff < ZoneLoad) return;
8676 0 : if (this->m_NumOfSpeedCooling > 0) this->m_CoolingSpeedRatio = 1.0;
8677 : }
8678 : } else {
8679 : // will return here when no cooling or heating load and MoistureLoad > LatOutputOff (i.e., PLR=0)
8680 0 : return;
8681 : }
8682 :
8683 2176469 : this->setOnOffMassFlowRate(state, OnOffAirFlowRatio, PartLoadRatio);
8684 :
8685 2176469 : this->calcUnitarySystemToLoad(state,
8686 : AirLoopNum,
8687 : FirstHVACIteration,
8688 : CoolPLR,
8689 : HeatPLR,
8690 : OnOffAirFlowRatio,
8691 : SensOutputOn,
8692 : LatOutputOn,
8693 2176469 : HXUnitOn,
8694 : HeatCoilLoad,
8695 : SupHeaterLoad,
8696 : CompressorONFlag);
8697 2176469 : FullSensibleOutput = SensOutputOn;
8698 2176469 : FullLoadAirOutletTemp = state.dataLoopNodes->Node(OutletNode).Temp;
8699 2176469 : FullLoadAirOutletHumRat = state.dataLoopNodes->Node(OutletNode).HumRat;
8700 :
8701 : // turn on HX if dehumidm_ControlType::Multimode
8702 4427644 : if (this->m_DehumidControlType_Num == DehumCtrlType::Multimode && state.dataUnitarySystems->MoistureLoad < 0.0 &&
8703 2202631 : state.dataUnitarySystems->MoistureLoad < LatOutputOn && state.dataUnitarySystems->CoolingLoad) {
8704 10314 : HXUnitOn = true;
8705 10314 : this->calcUnitarySystemToLoad(state,
8706 : AirLoopNum,
8707 : FirstHVACIteration,
8708 : CoolPLR,
8709 : HeatPLR,
8710 : OnOffAirFlowRatio,
8711 : SensOutputOn,
8712 : LatOutputOn,
8713 10314 : HXUnitOn,
8714 : HeatCoilLoad,
8715 : SupHeaterLoad,
8716 : CompressorONFlag);
8717 10314 : FullSensibleOutput = SensOutputOn;
8718 : }
8719 :
8720 : // test to see if full capacity is less than load, if so set to PLR=1 and RETURN if no moisture load
8721 5046970 : if ((state.dataUnitarySystems->HeatingLoad && this->m_NumOfSpeedHeating <= 1) ||
8722 2369963 : (state.dataUnitarySystems->CoolingLoad && this->m_NumOfSpeedCooling <= 1)) {
8723 1635583 : switch (state.dataHeatBalFanSys->TempControlType(this->ControlZoneNum)) {
8724 44425 : case DataHVACGlobals::ThermostatType::SingleHeating: {
8725 44425 : if (state.dataUnitarySystems->HeatingLoad && SensOutputOn < ZoneLoad) {
8726 8096 : this->m_HeatingPartLoadFrac = 1.0;
8727 8096 : this->m_WSHPRuntimeFrac = 1.0;
8728 8096 : if (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad < LatOutputOn) return;
8729 : }
8730 36329 : if (!state.dataUnitarySystems->HeatingLoad &&
8731 0 : (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad < LatOutputOn))
8732 0 : return;
8733 36329 : } break;
8734 42289 : case DataHVACGlobals::ThermostatType::SingleCooling: {
8735 42289 : if (state.dataUnitarySystems->CoolingLoad && SensOutputOn > ZoneLoad) {
8736 5041 : this->m_CoolingPartLoadFrac = 1.0;
8737 5041 : this->m_WSHPRuntimeFrac = 1.0;
8738 5041 : if (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad < LatOutputOn) return;
8739 : }
8740 37248 : if (!state.dataUnitarySystems->CoolingLoad &&
8741 0 : (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad < LatOutputOn))
8742 0 : return;
8743 37248 : } break;
8744 1548869 : case DataHVACGlobals::ThermostatType::SingleHeatCool:
8745 : case DataHVACGlobals::ThermostatType::DualSetPointWithDeadBand: {
8746 1548869 : if (state.dataUnitarySystems->HeatingLoad && SensOutputOn < ZoneLoad) {
8747 85629 : this->m_HeatingPartLoadFrac = 1.0;
8748 85629 : this->m_WSHPRuntimeFrac = 1.0;
8749 85629 : if (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad > LatOutputOn) return;
8750 : }
8751 1463240 : if (state.dataUnitarySystems->CoolingLoad && SensOutputOn > ZoneLoad) {
8752 15479 : this->m_CoolingPartLoadFrac = 1.0;
8753 15479 : this->m_WSHPRuntimeFrac = 1.0;
8754 15479 : return;
8755 : }
8756 1447761 : if (!state.dataUnitarySystems->HeatingLoad && !state.dataUnitarySystems->CoolingLoad &&
8757 0 : (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad < LatOutputOn)) {
8758 0 : return;
8759 : }
8760 1447761 : } break;
8761 0 : default: {
8762 : // no other choices for thermostat control
8763 0 : } break;
8764 : }
8765 : }
8766 : // will find speed for multispeed coils here and then RegulaFalsi on PLR at a fixed speed
8767 :
8768 : // Do the non-variable or non-multispeed coils have a NumOfSpeed = 0 ? We don't need to do this for single speed coils.
8769 : // Check to see which speed to meet the load
8770 2062224 : this->m_HeatingSpeedNum = 0;
8771 2062224 : this->m_CoolingSpeedNum = 0;
8772 2062224 : if (!this->m_Staged) {
8773 2062224 : if (state.dataUnitarySystems->HeatingLoad) {
8774 1191436 : for (SpeedNum = 1; SpeedNum <= this->m_NumOfSpeedHeating; ++SpeedNum) {
8775 263684 : CoolPLR = 0.0;
8776 263684 : HeatPLR = 1.0;
8777 263684 : if (SpeedNum == 1) {
8778 99873 : this->m_HeatingSpeedRatio = 0.0;
8779 : } else {
8780 163811 : this->m_HeatingSpeedRatio = 1.0;
8781 : }
8782 263684 : this->m_HeatingCycRatio = 1.0;
8783 263684 : this->m_HeatingSpeedNum = SpeedNum;
8784 263684 : this->calcUnitarySystemToLoad(state,
8785 : AirLoopNum,
8786 : FirstHVACIteration,
8787 : CoolPLR,
8788 : HeatPLR,
8789 : OnOffAirFlowRatio,
8790 : SensOutputOn,
8791 : LatOutputOn,
8792 263684 : HXUnitOn,
8793 : HeatCoilLoad,
8794 : SupHeaterLoad,
8795 : CompressorONFlag);
8796 263684 : if (state.dataGlobal->DoCoilDirectSolutions && this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedHeating) {
8797 0 : this->FullOutput[SpeedNum] = SensOutputOn;
8798 : }
8799 484573 : if (this->m_HeatingCoilType_Num != DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit &&
8800 238899 : (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWater && !this->m_MultiSpeedHeatingCoil)) {
8801 0 : this->m_HeatingSpeedRatio = 0.0;
8802 0 : this->m_HeatingSpeedNum = SpeedNum - 1;
8803 0 : if (this->m_HeatingSpeedNum == 0) {
8804 0 : this->m_HeatingCycRatio = 0.0;
8805 0 : HeatPLR = 0.0;
8806 : } else {
8807 0 : this->m_HeatingCycRatio = 1.0;
8808 0 : HeatPLR = 1.0;
8809 : }
8810 0 : this->calcUnitarySystemToLoad(state,
8811 : AirLoopNum,
8812 : FirstHVACIteration,
8813 : CoolPLR,
8814 : HeatPLR,
8815 : OnOffAirFlowRatio,
8816 : SensOutputOff,
8817 : LatOutputOff,
8818 0 : HXUnitOn,
8819 : HeatCoilLoad,
8820 : SupHeaterLoad,
8821 : CompressorONFlag);
8822 0 : this->m_HeatingSpeedNum = SpeedNum;
8823 : }
8824 263684 : if (ZoneLoad <= SensOutputOn) {
8825 19947 : break;
8826 : }
8827 : }
8828 : } else { // Cooling or moisture load
8829 1541313 : for (SpeedNum = 1; SpeedNum <= this->m_NumOfSpeedCooling; ++SpeedNum) {
8830 1420301 : CoolPLR = 1.0;
8831 1420301 : HeatPLR = 0.0;
8832 1420301 : if (SpeedNum == 1) {
8833 1057345 : this->m_CoolingSpeedRatio = 0.0;
8834 : } else {
8835 362956 : this->m_CoolingSpeedRatio = 1.0;
8836 : }
8837 1420301 : this->m_CoolingCycRatio = 1.0;
8838 1420301 : this->m_CoolingSpeedNum = SpeedNum;
8839 1420301 : this->calcUnitarySystemToLoad(state,
8840 : AirLoopNum,
8841 : FirstHVACIteration,
8842 : CoolPLR,
8843 : HeatPLR,
8844 : OnOffAirFlowRatio,
8845 : SensOutputOn,
8846 : LatOutputOn,
8847 1420301 : HXUnitOn,
8848 : HeatCoilLoad,
8849 : SupHeaterLoad,
8850 : CompressorONFlag);
8851 1420301 : if (state.dataGlobal->DoCoilDirectSolutions &&
8852 0 : (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedCooling ||
8853 0 : (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_Cooling && this->m_NumOfSpeedCooling > 1))) {
8854 0 : this->FullOutput[SpeedNum] = SensOutputOn;
8855 : }
8856 : // over specified logic? it has to be a water coil? what about other VS coil models?
8857 2836952 : if ((this->m_CoolingCoilType_Num != DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit) &&
8858 2823086 : ((this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWater ||
8859 1416651 : this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWaterDetailed) &&
8860 10216 : !this->m_DiscreteSpeedCoolingCoil)) {
8861 0 : this->m_CoolingSpeedRatio = 0.0;
8862 0 : this->m_CoolingSpeedNum = SpeedNum - 1;
8863 0 : if (this->m_CoolingSpeedNum == 0) {
8864 0 : this->m_CoolingCycRatio = 0.0;
8865 0 : CoolPLR = 0.0;
8866 : } else {
8867 0 : this->m_CoolingCycRatio = 1.0;
8868 0 : this->m_CoolingSpeedRatio = 0.0;
8869 0 : if (this->m_SingleMode == 1) {
8870 0 : CoolPLR = 1.0;
8871 : }
8872 : }
8873 :
8874 0 : this->calcUnitarySystemToLoad(state,
8875 : AirLoopNum,
8876 : FirstHVACIteration,
8877 : CoolPLR,
8878 : HeatPLR,
8879 : OnOffAirFlowRatio,
8880 : SensOutputOff,
8881 : LatOutputOff,
8882 0 : HXUnitOn,
8883 : HeatCoilLoad,
8884 : SupHeaterLoad,
8885 : CompressorONFlag);
8886 0 : this->m_CoolingSpeedNum = SpeedNum;
8887 : }
8888 1420301 : if (ZoneLoad >= SensOutputOn) {
8889 993513 : break;
8890 : }
8891 : }
8892 : }
8893 : } else { // IF (.NOT. UnitarySystem(UnitarySysNum)%Staged) THEN
8894 : // Staged control
8895 0 : if (state.dataUnitarySystems->HeatingLoad) {
8896 0 : CoolPLR = 0.0;
8897 0 : HeatPLR = 1.0;
8898 0 : SpeedNum = this->m_StageNum;
8899 0 : if (SpeedNum == 1) {
8900 0 : this->m_HeatingSpeedRatio = 0.0;
8901 : } else {
8902 0 : this->m_HeatingSpeedRatio = 1.0;
8903 0 : SpeedNum = min(this->m_StageNum, this->m_NumOfSpeedHeating);
8904 : }
8905 0 : this->m_HeatingCycRatio = 1.0;
8906 0 : this->m_HeatingSpeedNum = SpeedNum;
8907 0 : this->calcUnitarySystemToLoad(state,
8908 : AirLoopNum,
8909 : FirstHVACIteration,
8910 : CoolPLR,
8911 : HeatPLR,
8912 : OnOffAirFlowRatio,
8913 : SensOutputOn,
8914 : LatOutputOn,
8915 0 : HXUnitOn,
8916 : HeatCoilLoad,
8917 : SupHeaterLoad,
8918 : CompressorONFlag);
8919 0 : if (this->m_HeatingCoilType_Num != DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit) {
8920 0 : this->m_HeatingSpeedRatio = 0.0;
8921 0 : this->m_HeatingSpeedNum = SpeedNum - 1;
8922 0 : if (this->m_HeatingSpeedNum == 0) {
8923 0 : this->m_HeatingCycRatio = 0.0;
8924 0 : HeatPLR = 0.0;
8925 : } else {
8926 0 : this->m_HeatingCycRatio = 1.0;
8927 0 : HeatPLR = 1.0;
8928 : }
8929 0 : this->calcUnitarySystemToLoad(state,
8930 : AirLoopNum,
8931 : FirstHVACIteration,
8932 : CoolPLR,
8933 : HeatPLR,
8934 : OnOffAirFlowRatio,
8935 : SensOutputOff,
8936 : LatOutputOff,
8937 0 : HXUnitOn,
8938 : HeatCoilLoad,
8939 : SupHeaterLoad,
8940 : CompressorONFlag);
8941 0 : this->m_HeatingSpeedNum = SpeedNum;
8942 : }
8943 0 : if (ZoneLoad <= SensOutputOn) {
8944 : // EXIT ????????????
8945 : }
8946 : } else { // Cooling or moisture load
8947 0 : CoolPLR = 1.0;
8948 0 : HeatPLR = 0.0;
8949 0 : SpeedNum = std::abs(this->m_StageNum);
8950 0 : if (SpeedNum == 1) {
8951 0 : this->m_CoolingSpeedRatio = 0.0;
8952 : } else {
8953 0 : this->m_CoolingSpeedRatio = 1.0;
8954 0 : SpeedNum = min(std::abs(this->m_StageNum), this->m_NumOfSpeedCooling);
8955 : }
8956 0 : this->m_CoolingCycRatio = 1.0;
8957 0 : this->m_CoolingSpeedNum = SpeedNum;
8958 0 : this->calcUnitarySystemToLoad(state,
8959 : AirLoopNum,
8960 : FirstHVACIteration,
8961 : CoolPLR,
8962 : HeatPLR,
8963 : OnOffAirFlowRatio,
8964 : SensOutputOn,
8965 : LatOutputOn,
8966 0 : HXUnitOn,
8967 : HeatCoilLoad,
8968 : SupHeaterLoad,
8969 : CompressorONFlag);
8970 :
8971 0 : if (this->m_CoolingCoilType_Num != DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit) {
8972 0 : this->m_CoolingSpeedRatio = 0.0;
8973 0 : this->m_CoolingSpeedNum = SpeedNum - 1;
8974 0 : if (this->m_CoolingSpeedNum == 0) {
8975 0 : this->m_CoolingCycRatio = 0.0;
8976 0 : CoolPLR = 0.0;
8977 : } else {
8978 0 : this->m_CoolingCycRatio = 1.0;
8979 0 : CoolPLR = 1.0;
8980 : }
8981 0 : this->calcUnitarySystemToLoad(state,
8982 : AirLoopNum,
8983 : FirstHVACIteration,
8984 : CoolPLR,
8985 : HeatPLR,
8986 : OnOffAirFlowRatio,
8987 : SensOutputOff,
8988 : LatOutputOff,
8989 0 : HXUnitOn,
8990 : HeatCoilLoad,
8991 : SupHeaterLoad,
8992 : CompressorONFlag);
8993 0 : this->m_CoolingSpeedNum = SpeedNum;
8994 : }
8995 0 : if (ZoneLoad >= SensOutputOn) {
8996 : // EXIT ???????????
8997 : }
8998 : }
8999 : } // IF (.NOT. UnitarySystem(UnitarySysNum)%Staged) THEN
9000 :
9001 2062224 : FullSensibleOutput = SensOutputOn;
9002 :
9003 2062224 : if (!state.dataUnitarySystems->HeatingLoad && !state.dataUnitarySystems->CoolingLoad &&
9004 0 : (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad < LatOutputOn)) {
9005 : // if no load, or only a moisture load which can't be met at PLR=1, RETURN
9006 0 : return;
9007 : }
9008 :
9009 : // use the ASHRAE 90.1 method of reduced fan speed at low loads
9010 2062224 : if (this->m_SimASHRAEModel) {
9011 :
9012 : // check to make sure unit has the capacity to meet the load
9013 0 : if ((state.dataUnitarySystems->HeatingLoad && ZoneLoad < SensOutputOn) ||
9014 0 : (state.dataUnitarySystems->CoolingLoad && ZoneLoad > SensOutputOn)) {
9015 0 : UnitarySys &SZVAVModel(state.dataUnitarySystems->unitarySys[this->m_UnitarySysNum]);
9016 0 : SZVAVModel::calcSZVAVModel(state,
9017 : SZVAVModel,
9018 : this->m_UnitarySysNum,
9019 : FirstHVACIteration,
9020 0 : state.dataUnitarySystems->CoolingLoad,
9021 0 : state.dataUnitarySystems->HeatingLoad,
9022 : ZoneLoad,
9023 : OnOffAirFlowRatio,
9024 0 : HXUnitOn,
9025 : AirLoopNum,
9026 : PartLoadRatio,
9027 : CompressorONFlag);
9028 : }
9029 :
9030 : } else { // not ASHRAE model
9031 :
9032 : // must test to see if load is bounded by capacity before calling RegulaFalsi
9033 5175141 : if ((state.dataUnitarySystems->HeatingLoad && ZoneLoad < SensOutputOn) ||
9034 2308976 : (state.dataUnitarySystems->CoolingLoad && ZoneLoad > SensOutputOn)) {
9035 4886999 : if ((state.dataUnitarySystems->HeatingLoad && ZoneLoad > SensOutputOff) ||
9036 2101386 : (state.dataUnitarySystems->CoolingLoad && ZoneLoad < SensOutputOff)) {
9037 : Real64 SensOutput;
9038 : Real64 LatOutput;
9039 2249542 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_Cooling &&
9040 331702 : state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].SubcoolReheatFlag) {
9041 7760 : if (state.dataUnitarySystems->CoolingLoad && this->LoadSHR > 0.0) {
9042 1092 : int CoilInletNode = state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].evapInletNodeIndex;
9043 1092 : this->CoilSHR = 0.0;
9044 : Real64 LowSpeedCoilSen;
9045 : Real64 LowSpeedCoilLat;
9046 1092 : CoolPLR = 0.0;
9047 1092 : HeatPLR = 0.0;
9048 1092 : this->m_CoolingSpeedNum = 1;
9049 1092 : this->calcUnitarySystemToLoad(state,
9050 : AirLoopNum,
9051 : FirstHVACIteration,
9052 : CoolPLR,
9053 : HeatPLR,
9054 : OnOffAirFlowRatio,
9055 : SensOutputOff,
9056 : LatOutputOff,
9057 1092 : HXUnitOn,
9058 : HeatCoilLoad,
9059 : SupHeaterLoad,
9060 : CompressorONFlag);
9061 1092 : CoolPLR = 1.0;
9062 1092 : HeatPLR = 0.0;
9063 1092 : this->m_CoolingCycRatio = 1.0;
9064 1092 : this->m_CoolingSpeedRatio = 0.0;
9065 : // this->m_CoolingSpeedNum = this->m_NumOfSpeedCooling;
9066 1092 : this->calcUnitarySystemToLoad(state,
9067 : AirLoopNum,
9068 : FirstHVACIteration,
9069 : CoolPLR,
9070 : HeatPLR,
9071 : OnOffAirFlowRatio,
9072 : SensOutputOn,
9073 : LatOutputOn,
9074 1092 : HXUnitOn,
9075 : HeatCoilLoad,
9076 : SupHeaterLoad,
9077 : CompressorONFlag);
9078 1092 : Real64 ZoneLatLoad = ZoneLoad * (1.0 / this->LoadSHR - 1.0);
9079 1092 : Real64 SenPLR = (ZoneLoad - SensOutputOff) / (SensOutputOn - SensOutputOff);
9080 1092 : Real64 LatPLR = (ZoneLatLoad - LatOutputOff) / (LatOutputOn - LatOutputOff);
9081 1092 : Real64 totalRate = 0.0;
9082 1092 : Real64 sensRate = 0.0;
9083 1092 : Real64 latRate = 0.0;
9084 4368 : CalcComponentSensibleLatentOutput(state.dataLoopNodes->Node(this->AirOutNode).MassFlowRate,
9085 1092 : state.dataLoopNodes->Node(CoilInletNode).Temp,
9086 1092 : state.dataLoopNodes->Node(CoilInletNode).HumRat,
9087 1092 : state.dataLoopNodes->Node(this->AirOutNode).Temp,
9088 1092 : state.dataLoopNodes->Node(this->AirOutNode).HumRat,
9089 : sensRate,
9090 : latRate,
9091 : totalRate);
9092 1092 : if (LatPLR > 1.0 || LatPLR < 0.0) {
9093 24 : this->CoilSHR = this->LoadSHR;
9094 : } else {
9095 1068 : Real64 coilSens = sensRate * SenPLR;
9096 1068 : Real64 coilLat = latRate * LatPLR;
9097 1068 : this->CoilSHR = coilSens / (coilSens + coilLat);
9098 : }
9099 1092 : if (this->m_NumOfSpeedCooling > 1) {
9100 0 : this->SpeedSHR[1] = this->CoilSHR;
9101 0 : LowSpeedCoilSen = sensRate;
9102 0 : LowSpeedCoilLat = latRate;
9103 0 : for (SpeedNum = 2; SpeedNum <= this->m_NumOfSpeedCooling; ++SpeedNum) {
9104 0 : this->SpeedSHR[SpeedNum] = this->LoadSHR;
9105 : }
9106 : }
9107 1092 : if (this->CoilSHR < 0.0) {
9108 0 : this->CoilSHR = this->LoadSHR;
9109 : }
9110 1092 : if (this->m_NumOfSpeedCooling > 1 && ZoneLoad < SensOutputOn) {
9111 : Real64 SenSPR;
9112 : Real64 LatSPR;
9113 0 : this->FullOutput[1] = SensOutputOn;
9114 0 : this->FullLatOutput[1] = LatOutputOn;
9115 0 : for (SpeedNum = 2; SpeedNum <= this->m_NumOfSpeedCooling; ++SpeedNum) {
9116 0 : this->CoilSHR = 0.0;
9117 0 : CoolPLR = 1.0;
9118 0 : HeatPLR = 0.0;
9119 0 : this->m_CoolingSpeedRatio = 1.0;
9120 0 : this->m_CoolingCycRatio = 1.0;
9121 0 : this->m_CoolingSpeedNum = SpeedNum;
9122 0 : this->calcUnitarySystemToLoad(state,
9123 : AirLoopNum,
9124 : FirstHVACIteration,
9125 : CoolPLR,
9126 : HeatPLR,
9127 : OnOffAirFlowRatio,
9128 0 : this->FullOutput[SpeedNum],
9129 0 : this->FullLatOutput[SpeedNum],
9130 0 : HXUnitOn,
9131 : HeatCoilLoad,
9132 : SupHeaterLoad,
9133 : CompressorONFlag);
9134 0 : CalcComponentSensibleLatentOutput(state.dataLoopNodes->Node(this->AirOutNode).MassFlowRate,
9135 0 : state.dataLoopNodes->Node(CoilInletNode).Temp,
9136 0 : state.dataLoopNodes->Node(CoilInletNode).HumRat,
9137 0 : state.dataLoopNodes->Node(this->AirOutNode).Temp,
9138 0 : state.dataLoopNodes->Node(this->AirOutNode).HumRat,
9139 : sensRate,
9140 : latRate,
9141 : totalRate);
9142 0 : SenSPR =
9143 0 : (ZoneLoad - this->FullOutput[SpeedNum - 1]) / (this->FullOutput[SpeedNum] - this->FullOutput[SpeedNum - 1]);
9144 0 : LatSPR = (ZoneLatLoad - this->FullLatOutput[SpeedNum - 1]) /
9145 0 : (this->FullLatOutput[SpeedNum] - this->FullLatOutput[SpeedNum - 1]);
9146 0 : if (LatSPR > 1.0 || LatSPR < 0.0) {
9147 0 : this->CoilSHR = this->LoadSHR;
9148 : } else {
9149 0 : Real64 coilSens = sensRate * SenSPR + (1.0 - SenSPR) * LowSpeedCoilSen;
9150 0 : Real64 coilLat = latRate * LatSPR + (1.0 - LatSPR) * LowSpeedCoilLat;
9151 0 : this->CoilSHR = coilSens / (coilSens + coilLat);
9152 : }
9153 0 : this->SpeedSHR[SpeedNum] = this->CoilSHR;
9154 0 : LowSpeedCoilSen = sensRate;
9155 0 : LowSpeedCoilLat = latRate;
9156 : }
9157 0 : for (SpeedNum = 1; SpeedNum <= this->m_NumOfSpeedCooling; ++SpeedNum) {
9158 0 : CoolPLR = 1.0;
9159 0 : HeatPLR = 0.0;
9160 0 : if (SpeedNum == 1) {
9161 0 : this->m_CoolingSpeedRatio = 0.0;
9162 : } else {
9163 0 : this->m_CoolingSpeedRatio = 1.0;
9164 : }
9165 0 : this->m_CoolingCycRatio = 1.0;
9166 0 : this->m_CoolingSpeedNum = SpeedNum;
9167 0 : this->calcUnitarySystemToLoad(state,
9168 : AirLoopNum,
9169 : FirstHVACIteration,
9170 : CoolPLR,
9171 : HeatPLR,
9172 : OnOffAirFlowRatio,
9173 : SensOutputOn,
9174 : LatOutputOn,
9175 0 : HXUnitOn,
9176 : HeatCoilLoad,
9177 : SupHeaterLoad,
9178 : CompressorONFlag);
9179 0 : if (ZoneLoad >= SensOutputOn) {
9180 0 : this->CoilSHR = this->SpeedSHR[SpeedNum];
9181 0 : break;
9182 : }
9183 : }
9184 : }
9185 : }
9186 : }
9187 1917840 : if (state.dataGlobal->DoCoilDirectSolutions && state.dataUnitarySystems->CoolingLoad &&
9188 0 : this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_CoolingSingleSpeed) {
9189 0 : CoolPLR = (ZoneLoad - SensOutputOff) / (SensOutputOn - SensOutputOff);
9190 0 : HeatPLR = 0.0;
9191 0 : this->calcUnitarySystemToLoad(state,
9192 : AirLoopNum,
9193 : FirstHVACIteration,
9194 : CoolPLR,
9195 : HeatPLR,
9196 : OnOffAirFlowRatio,
9197 : SensOutput,
9198 : LatOutput,
9199 0 : HXUnitOn,
9200 : HeatCoilLoad,
9201 : SupHeaterLoad,
9202 : CompressorONFlag);
9203 0 : PartLoadRatio = CoolPLR;
9204 3835680 : } else if (state.dataGlobal->DoCoilDirectSolutions && state.dataUnitarySystems->CoolingLoad &&
9205 1917840 : this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_Cooling && this->m_NumOfSpeedCooling == 1 &&
9206 0 : state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].SubcoolReheatFlag) {
9207 0 : HeatPLR = 0.0;
9208 0 : this->calcUnitarySystemToLoad(state,
9209 : AirLoopNum,
9210 : FirstHVACIteration,
9211 : 1.0,
9212 : HeatPLR,
9213 : OnOffAirFlowRatio,
9214 : SensOutputOn,
9215 : LatOutputOn,
9216 0 : HXUnitOn,
9217 : HeatCoilLoad,
9218 : SupHeaterLoad,
9219 : CompressorONFlag);
9220 0 : CoolPLR = (ZoneLoad - SensOutputOff) / (SensOutputOn - SensOutputOff);
9221 0 : this->calcUnitarySystemToLoad(state,
9222 : AirLoopNum,
9223 : FirstHVACIteration,
9224 : CoolPLR,
9225 : HeatPLR,
9226 : OnOffAirFlowRatio,
9227 : SensOutput,
9228 : LatOutput,
9229 0 : HXUnitOn,
9230 : HeatCoilLoad,
9231 : SupHeaterLoad,
9232 : CompressorONFlag);
9233 0 : PartLoadRatio = CoolPLR;
9234 3835680 : } else if (state.dataGlobal->DoCoilDirectSolutions && state.dataUnitarySystems->CoolingLoad &&
9235 1917840 : this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_Cooling && this->m_NumOfSpeedCooling == 1) {
9236 0 : CoolPLR = (ZoneLoad - SensOutputOff) / (SensOutputOn - SensOutputOff);
9237 0 : HeatPLR = 0.0;
9238 0 : this->calcUnitarySystemToLoad(state,
9239 : AirLoopNum,
9240 : FirstHVACIteration,
9241 : CoolPLR,
9242 : HeatPLR,
9243 : OnOffAirFlowRatio,
9244 : SensOutput,
9245 : LatOutput,
9246 0 : HXUnitOn,
9247 : HeatCoilLoad,
9248 : SupHeaterLoad,
9249 : CompressorONFlag);
9250 0 : PartLoadRatio = CoolPLR;
9251 1917840 : } else if (state.dataGlobal->DoCoilDirectSolutions && state.dataUnitarySystems->HeatingLoad &&
9252 0 : (this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_HeatingEmpirical ||
9253 0 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingElectric ||
9254 0 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingGasOrOtherFuel)) {
9255 0 : CoolPLR = 0.0;
9256 0 : HeatPLR = (ZoneLoad - SensOutputOff) / (SensOutputOn - SensOutputOff);
9257 0 : this->calcUnitarySystemToLoad(state,
9258 : AirLoopNum,
9259 : FirstHVACIteration,
9260 : CoolPLR,
9261 : HeatPLR,
9262 : OnOffAirFlowRatio,
9263 : SensOutput,
9264 : LatOutput,
9265 0 : HXUnitOn,
9266 : HeatCoilLoad,
9267 : SupHeaterLoad,
9268 : CompressorONFlag);
9269 0 : PartLoadRatio = HeatPLR;
9270 1917840 : } else if (state.dataGlobal->DoCoilDirectSolutions && state.dataUnitarySystems->HeatingLoad &&
9271 0 : this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedHeating) {
9272 0 : CoolPLR = 0.0;
9273 0 : if (this->m_HeatingSpeedNum == 1) {
9274 0 : this->m_HeatingCycRatio = (ZoneLoad - SensOutputOff) / (this->FullOutput[this->m_HeatingSpeedNum] - SensOutputOff);
9275 0 : HeatPLR = this->m_HeatingCycRatio;
9276 0 : this->m_HeatingSpeedRatio = 0.0;
9277 : } else {
9278 0 : this->m_HeatingCycRatio = 1.0;
9279 0 : this->m_HeatingSpeedRatio = (ZoneLoad - this->FullOutput[this->m_HeatingSpeedNum - 1]) /
9280 0 : (this->FullOutput[this->m_HeatingSpeedNum] - this->FullOutput[this->m_HeatingSpeedNum - 1]);
9281 0 : HeatPLR = this->m_HeatingSpeedRatio;
9282 : }
9283 0 : this->calcUnitarySystemToLoad(state,
9284 : AirLoopNum,
9285 : FirstHVACIteration,
9286 : CoolPLR,
9287 : HeatPLR,
9288 : OnOffAirFlowRatio,
9289 : SensOutput,
9290 : LatOutput,
9291 0 : HXUnitOn,
9292 : HeatCoilLoad,
9293 : SupHeaterLoad,
9294 : CompressorONFlag);
9295 0 : PartLoadRatio = HeatPLR;
9296 3835680 : } else if (state.dataGlobal->DoCoilDirectSolutions && state.dataUnitarySystems->CoolingLoad &&
9297 1917840 : this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_Cooling && this->m_NumOfSpeedCooling > 1) {
9298 0 : HeatPLR = 0.0;
9299 0 : if (this->m_CoolingSpeedNum == 1) {
9300 0 : this->m_CoolingCycRatio = (ZoneLoad - SensOutputOff) / (this->FullOutput[this->m_CoolingSpeedNum] - SensOutputOff);
9301 0 : CoolPLR = this->m_CoolingCycRatio;
9302 0 : this->m_CoolingSpeedRatio = 0.0;
9303 : } else {
9304 0 : this->m_CoolingCycRatio = 1.0;
9305 0 : this->m_CoolingSpeedRatio = (ZoneLoad - this->FullOutput[this->m_CoolingSpeedNum - 1]) /
9306 0 : (this->FullOutput[this->m_CoolingSpeedNum] - this->FullOutput[this->m_CoolingSpeedNum - 1]);
9307 0 : CoolPLR = this->m_CoolingSpeedRatio;
9308 : }
9309 0 : this->calcUnitarySystemToLoad(state,
9310 : AirLoopNum,
9311 : FirstHVACIteration,
9312 : CoolPLR,
9313 : HeatPLR,
9314 : OnOffAirFlowRatio,
9315 : SensOutput,
9316 : LatOutput,
9317 0 : HXUnitOn,
9318 : HeatCoilLoad,
9319 : SupHeaterLoad,
9320 : CompressorONFlag);
9321 0 : PartLoadRatio = CoolPLR;
9322 : } else {
9323 :
9324 1917840 : Real64 par6 = state.dataUnitarySystems->CoolingLoad ? 1.0 : 0.0;
9325 : auto f = [&state, this, FirstHVACIteration, CompressorONFlag, ZoneLoad, par6, OnOffAirFlowRatio, HXUnitOn, AirLoopNum](
9326 28210148 : Real64 const PartLoadRatio) {
9327 21157611 : return UnitarySys::calcUnitarySystemLoadResidual(state,
9328 : PartLoadRatio,
9329 : this->m_UnitarySysNum,
9330 : FirstHVACIteration,
9331 : // par 3 not used?
9332 : CompressorONFlag,
9333 : ZoneLoad,
9334 : par6,
9335 : 1.0,
9336 : OnOffAirFlowRatio,
9337 : HXUnitOn,
9338 : // par 10 not used
9339 : AirLoopNum);
9340 8970377 : };
9341 : // Tolerance is in fraction of load, MaxIter = 30, SolFalg = # of iterations or error as appropriate
9342 1917840 : General::SolveRoot(state, this->m_CoolConvTol, MaxIter, SolFlag, PartLoadRatio, f, 0.0, 1.0);
9343 :
9344 1917840 : if (SolFlag == -1) {
9345 1584 : if (state.dataUnitarySystems->HeatingLoad) {
9346 : // IF iteration limit is exceeded, find tighter boundary of solution and repeat RegulaFalsi
9347 : // This does cause a problem when coil cannot turn on when OAT < min allowed or scheduled off
9348 : // If max iteration limit is exceeded, how do we know if the heating coil is operating?
9349 0 : TempMaxPLR = -0.1;
9350 0 : TempSensOutput = SensOutputOff;
9351 0 : while ((TempSensOutput - ZoneLoad) < 0.0 && TempMaxPLR < 1.0) {
9352 : // find upper limit of HeatingPLR
9353 0 : TempMaxPLR += 0.1;
9354 :
9355 : // SUBROUTINE SetSpeedVariables(UnitarySysNum, SensibleLoad, PartLoadRatio)
9356 0 : this->setSpeedVariables(state, true, TempMaxPLR);
9357 0 : this->calcUnitarySystemToLoad(state,
9358 : AirLoopNum,
9359 : FirstHVACIteration,
9360 : CoolPLR,
9361 : TempMaxPLR,
9362 : OnOffAirFlowRatio,
9363 : TempSensOutput,
9364 : TempLatOutput,
9365 0 : HXUnitOn,
9366 : HeatCoilLoad,
9367 : SupHeaterLoad,
9368 : CompressorONFlag);
9369 : }
9370 0 : TempMinPLR = TempMaxPLR;
9371 0 : while ((TempSensOutput - ZoneLoad) > 0.0 && TempMinPLR > 0.0) {
9372 : // pull upper limit of HeatingPLR down to last valid limit (i.e. heat output still exceeds SystemSensibleLoad)
9373 0 : TempMaxPLR = TempMinPLR;
9374 : // find minimum limit of HeatingPLR
9375 0 : TempMinPLR -= 0.01;
9376 0 : this->setSpeedVariables(state, true, TempMinPLR);
9377 0 : this->calcUnitarySystemToLoad(state,
9378 : AirLoopNum,
9379 : FirstHVACIteration,
9380 : CoolPLR,
9381 : TempMinPLR,
9382 : OnOffAirFlowRatio,
9383 : TempSensOutput,
9384 : TempLatOutput,
9385 0 : HXUnitOn,
9386 : HeatCoilLoad,
9387 : SupHeaterLoad,
9388 : CompressorONFlag);
9389 : }
9390 : // Now solve again with tighter PLR limits
9391 : auto f2 =
9392 : [&state, this, FirstHVACIteration, CompressorONFlag, ZoneLoad, par6, OnOffAirFlowRatio, HXUnitOn, AirLoopNum](
9393 0 : Real64 const PartLoadRatio) {
9394 0 : return UnitarySys::calcUnitarySystemLoadResidual(state,
9395 : PartLoadRatio,
9396 : this->m_UnitarySysNum,
9397 : FirstHVACIteration,
9398 : // par 3 not used?
9399 : CompressorONFlag,
9400 : ZoneLoad,
9401 : par6,
9402 : 1.0,
9403 : OnOffAirFlowRatio,
9404 : HXUnitOn,
9405 : // par 10 not used
9406 : AirLoopNum);
9407 0 : };
9408 0 : General::SolveRoot(state, this->m_HeatConvTol, MaxIter, SolFlag, HeatPLR, f2, TempMinPLR, TempMaxPLR);
9409 0 : this->calcUnitarySystemToLoad(state,
9410 : AirLoopNum,
9411 : FirstHVACIteration,
9412 : CoolPLR,
9413 : HeatPLR,
9414 : OnOffAirFlowRatio,
9415 : TempSensOutput,
9416 : TempLatOutput,
9417 0 : HXUnitOn,
9418 : HeatCoilLoad,
9419 : SupHeaterLoad,
9420 : CompressorONFlag);
9421 1584 : } else if (state.dataUnitarySystems->CoolingLoad) {
9422 : // RegulaFalsi may not find cooling PLR when the latent degradation model is used.
9423 : // IF iteration limit is exceeded (SolFlag = -1), find tighter boundary of solution and repeat RegulaFalsi
9424 1584 : TempMaxPLR = -0.1;
9425 1584 : TempSysOutput = SensOutputOff;
9426 1584 : TempLoad = ZoneLoad;
9427 11946 : while ((TempSysOutput - TempLoad) > 0.0 &&
9428 3454 : TempMaxPLR < 0.95) { // avoid PLR > 1 by limiting TempMaxPLR to 1 (i.e., TempMaxPLR += 0.1)
9429 : // find upper limit of HeatingPLR
9430 3454 : TempMaxPLR += 0.1;
9431 3454 : if (TempMaxPLR > 0.95 && TempMaxPLR < 1.05) {
9432 0 : TempMaxPLR = 1.0; // enforce a perfect 1.0 at the top end
9433 : }
9434 3454 : this->setSpeedVariables(state, true, TempMaxPLR);
9435 3454 : this->calcUnitarySystemToLoad(state,
9436 : AirLoopNum,
9437 : FirstHVACIteration,
9438 : TempMaxPLR,
9439 : HeatPLR,
9440 : OnOffAirFlowRatio,
9441 : TempSensOutput,
9442 : TempLatOutput,
9443 3454 : HXUnitOn,
9444 : HeatCoilLoad,
9445 : SupHeaterLoad,
9446 : CompressorONFlag);
9447 3454 : TempSysOutput = TempSensOutput;
9448 : }
9449 1584 : TempMinPLR = TempMaxPLR;
9450 20440 : while ((TempSysOutput - TempLoad) < 0.0 && TempMinPLR > 0.05) {
9451 : // pull upper limit of HeatingPLR down to last valid limit (i.e. heat output still exceeds SystemSensibleLoad)
9452 9428 : TempMaxPLR = TempMinPLR;
9453 : // find minimum limit of HeatingPLR
9454 9428 : TempMinPLR -= 0.01;
9455 9428 : this->setSpeedVariables(state, true, TempMinPLR);
9456 9428 : this->calcUnitarySystemToLoad(state,
9457 : AirLoopNum,
9458 : FirstHVACIteration,
9459 : TempMinPLR,
9460 : HeatPLR,
9461 : OnOffAirFlowRatio,
9462 : TempSensOutput,
9463 : TempLatOutput,
9464 9428 : HXUnitOn,
9465 : HeatCoilLoad,
9466 : SupHeaterLoad,
9467 : CompressorONFlag);
9468 9428 : TempSysOutput = TempSensOutput;
9469 : }
9470 : // Now solve again with tighter PLR limits
9471 : auto f2 =
9472 : [&state, this, FirstHVACIteration, CompressorONFlag, ZoneLoad, par6, OnOffAirFlowRatio, HXUnitOn, AirLoopNum](
9473 16316 : Real64 const PartLoadRatio) {
9474 12237 : return UnitarySys::calcUnitarySystemLoadResidual(state,
9475 : PartLoadRatio,
9476 : this->m_UnitarySysNum,
9477 : FirstHVACIteration,
9478 : // par 3 not used?
9479 : CompressorONFlag,
9480 : ZoneLoad,
9481 : par6,
9482 : 1.0,
9483 : OnOffAirFlowRatio,
9484 : HXUnitOn,
9485 : // par 10 not used
9486 : AirLoopNum);
9487 5663 : };
9488 1584 : General::SolveRoot(state, this->m_CoolConvTol, MaxIter, SolFlag, CoolPLR, f2, TempMinPLR, TempMaxPLR);
9489 1584 : this->calcUnitarySystemToLoad(state,
9490 : AirLoopNum,
9491 : FirstHVACIteration,
9492 : CoolPLR,
9493 : HeatPLR,
9494 : OnOffAirFlowRatio,
9495 : TempSensOutput,
9496 : TempLatOutput,
9497 1584 : HXUnitOn,
9498 : HeatCoilLoad,
9499 : SupHeaterLoad,
9500 : CompressorONFlag);
9501 : } // IF(HeatingLoad)THEN
9502 1584 : if (SolFlag == -1) {
9503 27 : if (std::abs(ZoneLoad - TempSensOutput) > DataHVACGlobals::SmallLoad) {
9504 27 : if (this->MaxIterIndex == 0) {
9505 5 : ShowWarningMessage(state, "Coil control failed to converge for " + this->UnitType + ':' + this->Name);
9506 5 : ShowContinueError(state, " Iteration limit exceeded in calculating system sensible part-load ratio.");
9507 15 : ShowContinueErrorTimeStamp(state,
9508 10 : format("Sensible load to be met = {:.2T} (watts), sensible output = {:.2T} "
9509 : "(watts), and the simulation continues.",
9510 : ZoneLoad,
9511 5 : TempSensOutput));
9512 : }
9513 81 : ShowRecurringWarningErrorAtEnd(state,
9514 54 : this->UnitType + " \"" + this->Name +
9515 : "\" - Iteration limit exceeded in calculating sensible part-load ratio error "
9516 : "continues. Sensible load statistics:",
9517 : this->MaxIterIndex,
9518 : ZoneLoad,
9519 : ZoneLoad);
9520 : }
9521 1557 : } else if (SolFlag == -2) {
9522 1501 : if (this->RegulaFalsiFailedIndex == 0) {
9523 4 : ShowWarningMessage(state, "Coil control failed for " + this->UnitType + ':' + this->Name);
9524 4 : ShowContinueError(state, " sensible part-load ratio determined to be outside the range of 0-1.");
9525 12 : ShowContinueErrorTimeStamp(
9526 8 : state, format("Sensible load to be met = {:.2T} (watts), and the simulation continues.", ZoneLoad));
9527 : }
9528 4503 : ShowRecurringWarningErrorAtEnd(
9529 : state,
9530 3002 : this->UnitType + " \"" + this->Name +
9531 : "\" - sensible part-load ratio out of range error continues. Sensible load statistics:",
9532 : this->RegulaFalsiFailedIndex,
9533 : ZoneLoad,
9534 : ZoneLoad);
9535 : }
9536 1916256 : } else if (SolFlag == -2) {
9537 470 : if (this->RegulaFalsiFailedIndex == 0) {
9538 6 : ShowWarningMessage(state, "Coil control failed for " + this->UnitType + ':' + this->Name);
9539 6 : ShowContinueError(state, " sensible part-load ratio determined to be outside the range of 0-1.");
9540 18 : ShowContinueErrorTimeStamp(
9541 12 : state, format("Sensible load to be met = {:.2T} (watts), and the simulation continues.", ZoneLoad));
9542 : }
9543 1410 : ShowRecurringWarningErrorAtEnd(
9544 : state,
9545 940 : this->UnitType + " \"" + this->Name +
9546 : "\" - sensible part-load ratio out of range error continues. Sensible load statistics:",
9547 : this->RegulaFalsiFailedIndex,
9548 : ZoneLoad,
9549 : ZoneLoad);
9550 : } // IF (SolFlag == -1) THEN
9551 : }
9552 : } else { // load is not bounded by capacity. Leave PLR=1 or turn off unit?
9553 626 : this->m_CoolingPartLoadFrac = 0.0;
9554 626 : this->m_HeatingPartLoadFrac = 0.0;
9555 626 : CoolPLR = 0.0;
9556 626 : HeatPLR = 0.0;
9557 626 : PartLoadRatio = 0.0;
9558 : } // IF((HeatingLoad .AND. ZoneLoad > SensOutputOff) .OR. (CoolingLoad .AND. ZoneLoad < SensOutputOff))THEN
9559 : } // IF((HeatingLoad .AND. ZoneLoad < SensOutputOn) .OR. (CoolingLoad .AND. ZoneLoad > SensOutputOn))THEN
9560 : }
9561 :
9562 2062224 : if (state.dataUnitarySystems->HeatingLoad && (this->m_MultiSpeedHeatingCoil || this->m_VarSpeedHeatingCoil)) {
9563 99873 : if (this->m_HeatingSpeedNum == 1) {
9564 4876 : this->m_HeatingCycRatio = PartLoadRatio;
9565 4876 : this->m_HeatingSpeedRatio = 0.0;
9566 : } else {
9567 94997 : if (this->m_SingleMode == 0) {
9568 92985 : this->m_HeatingCycRatio = 1.0;
9569 92985 : this->m_HeatingSpeedRatio = PartLoadRatio;
9570 : } else {
9571 2012 : this->m_HeatingCycRatio = PartLoadRatio;
9572 2012 : this->m_HeatingSpeedRatio = 1.0;
9573 : }
9574 : }
9575 99873 : HeatPLR = PartLoadRatio;
9576 99873 : CoolPLR = 0.0;
9577 99873 : this->m_CoolingCycRatio = 0.0;
9578 99873 : this->m_CoolingSpeedRatio = 0.0;
9579 1962351 : } else if (state.dataUnitarySystems->CoolingLoad && (this->m_DiscreteSpeedCoolingCoil || this->m_ContSpeedCoolingCoil)) {
9580 482065 : if (this->m_CoolingSpeedNum == 1) {
9581 201280 : this->m_CoolingCycRatio = PartLoadRatio;
9582 201280 : this->m_CoolingSpeedRatio = 0.0;
9583 : } else {
9584 280785 : if (this->m_SingleMode == 0) {
9585 277737 : this->m_CoolingCycRatio = 1.0;
9586 277737 : this->m_CoolingSpeedRatio = PartLoadRatio;
9587 : } else {
9588 3048 : this->m_CoolingCycRatio = PartLoadRatio;
9589 3048 : this->m_CoolingSpeedRatio = 1.0;
9590 : }
9591 : }
9592 482065 : this->m_HeatingCycRatio = 0.0;
9593 482065 : this->m_HeatingSpeedRatio = 0.0;
9594 482065 : HeatPLR = 0.0;
9595 482065 : CoolPLR = PartLoadRatio;
9596 : } else {
9597 1480286 : HeatPLR = this->m_HeatingPartLoadFrac;
9598 1480286 : CoolPLR = this->m_CoolingPartLoadFrac;
9599 : }
9600 :
9601 2062224 : this->calcUnitarySystemToLoad(state,
9602 : AirLoopNum,
9603 : FirstHVACIteration,
9604 : CoolPLR,
9605 : HeatPLR,
9606 : OnOffAirFlowRatio,
9607 : TempSensOutput,
9608 : TempLatOutput,
9609 2062224 : HXUnitOn,
9610 : HeatCoilLoad,
9611 : SupHeaterLoad,
9612 : CompressorONFlag);
9613 :
9614 : // FullSensibleOutput is used to set supplemental heater PLR in calling routine
9615 : // OnOffAirFlowRatio is used to average air flow between ON and OFF state
9616 2062224 : FullSensibleOutput = TempSensOutput;
9617 2062224 : LatOutputOn = TempLatOutput;
9618 :
9619 : // RETURN if the moisture load is met
9620 2062224 : if (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad >= TempLatOutput) return;
9621 : // Multimode does not meet the latent load, only the sensible load with or without HX active
9622 : // what if there is a heating load for a system using Multimode?
9623 25291 : if (!state.dataUnitarySystems->CoolingLoad && this->m_DehumidControlType_Num == DehumCtrlType::Multimode) return;
9624 : // if HX was previously turned on return since sensible load is already met
9625 25291 : if (state.dataUnitarySystems->CoolingLoad && this->m_DehumidControlType_Num == DehumCtrlType::Multimode && HXUnitOn) return;
9626 : // IF(HeatingLoad .AND. UnitarySystem(UnitarySysNum)%m_DehumidControlType_Num .EQ. dehumidm_ControlType::CoolReheat)RETURN
9627 :
9628 14977 : if ((this->m_DehumidControlType_Num == DehumCtrlType::CoolReheat || this->m_DehumidControlType_Num == DehumCtrlType::Multimode)) {
9629 :
9630 : // find maximum latent output IF not already calculated
9631 14977 : if (state.dataUnitarySystems->HeatingLoad) {
9632 721 : CoolPLR = 1.0;
9633 721 : this->m_CoolingPartLoadFrac = 1.0;
9634 721 : this->m_CoolingSpeedNum = this->m_NumOfSpeedCooling;
9635 721 : this->m_CoolingSpeedRatio = 1.0;
9636 721 : this->m_CoolingCycRatio = 1.0;
9637 721 : this->m_WSHPRuntimeFrac = CoolPLR;
9638 721 : if (this->m_CoolingSpeedNum > 0) {
9639 721 : this->m_HeatingPartLoadFrac = 0.0;
9640 721 : this->m_HeatingSpeedNum = 0;
9641 721 : HeatPLR = 0.0;
9642 721 : state.dataUnitarySystems->CoolingLoad = true;
9643 721 : state.dataUnitarySystems->HeatingLoad = false;
9644 721 : this->m_HeatingCoilSensDemand = 0.0;
9645 721 : this->m_CoolingCoilLatentDemand = state.dataUnitarySystems->MoistureLoad;
9646 721 : this->calcUnitarySystemToLoad(state,
9647 : AirLoopNum,
9648 : FirstHVACIteration,
9649 : 0.0,
9650 : 0.0,
9651 : OnOffAirFlowRatio,
9652 : TempSensOutput,
9653 : TempLatOutput,
9654 721 : HXUnitOn,
9655 : HeatCoilLoad,
9656 : SupHeaterLoad,
9657 : CompressorONFlag);
9658 721 : this->calcUnitarySystemToLoad(state,
9659 : AirLoopNum,
9660 : FirstHVACIteration,
9661 : CoolPLR,
9662 : HeatPLR,
9663 : OnOffAirFlowRatio,
9664 : TempSensOutput,
9665 : LatOutputOn,
9666 721 : HXUnitOn,
9667 : HeatCoilLoad,
9668 : SupHeaterLoad,
9669 : CompressorONFlag);
9670 : } else {
9671 0 : this->m_HeatingCoilSensDemand = 0.0;
9672 0 : this->m_CoolingCoilLatentDemand = 0.0;
9673 0 : this->calcUnitarySystemToLoad(state,
9674 : AirLoopNum,
9675 : FirstHVACIteration,
9676 : 0.0,
9677 : 0.0,
9678 : OnOffAirFlowRatio,
9679 : TempSensOutput,
9680 : TempLatOutput,
9681 0 : HXUnitOn,
9682 : HeatCoilLoad,
9683 : SupHeaterLoad,
9684 : CompressorONFlag);
9685 0 : this->m_CoolingCoilLatentDemand = state.dataUnitarySystems->MoistureLoad;
9686 0 : this->calcUnitarySystemToLoad(state,
9687 : AirLoopNum,
9688 : FirstHVACIteration,
9689 : CoolPLR,
9690 : HeatPLR,
9691 : OnOffAirFlowRatio,
9692 : TempSensOutput,
9693 : LatOutputOn,
9694 0 : HXUnitOn,
9695 : HeatCoilLoad,
9696 : SupHeaterLoad,
9697 : CompressorONFlag);
9698 : }
9699 : }
9700 :
9701 14977 : if (this->m_DehumidControlType_Num == DehumCtrlType::Multimode && state.dataUnitarySystems->MoistureLoad < LatOutputOn) {
9702 4828 : HXUnitOn = true;
9703 4828 : CoolPLR = 1.0;
9704 4828 : this->m_CoolingPartLoadFrac = 1.0;
9705 4828 : this->calcUnitarySystemToLoad(state,
9706 : AirLoopNum,
9707 : FirstHVACIteration,
9708 : CoolPLR,
9709 : HeatPLR,
9710 : OnOffAirFlowRatio,
9711 : TempSensOutput,
9712 : LatOutputOn,
9713 4828 : HXUnitOn,
9714 : HeatCoilLoad,
9715 : SupHeaterLoad,
9716 : CompressorONFlag);
9717 4828 : FullSensibleOutput = TempSensOutput;
9718 : }
9719 :
9720 14977 : if (state.dataUnitarySystems->MoistureLoad < LatOutputOn && this->m_DehumidControlType_Num == DehumCtrlType::CoolReheat) {
9721 9428 : HXUnitOn = true; // HX is needed to meet moisture load
9722 9428 : if (this->m_NumOfSpeedCooling > 0) {
9723 20672 : for (SpeedNum = this->m_CoolingSpeedNum; SpeedNum <= this->m_NumOfSpeedCooling; ++SpeedNum) {
9724 15406 : CoolPLR = 1.0;
9725 15406 : this->m_CoolingPartLoadFrac = CoolPLR;
9726 15406 : this->m_CoolingSpeedRatio = 1.0;
9727 15406 : this->m_CoolingCycRatio = 1.0;
9728 15406 : this->m_CoolingSpeedNum = SpeedNum;
9729 15406 : this->calcUnitarySystemToLoad(state,
9730 : AirLoopNum,
9731 : FirstHVACIteration,
9732 : CoolPLR,
9733 : HeatPLR,
9734 : OnOffAirFlowRatio,
9735 : SensOutputOn,
9736 : LatOutputOn,
9737 15406 : HXUnitOn,
9738 : HeatCoilLoad,
9739 : SupHeaterLoad,
9740 : CompressorONFlag);
9741 15406 : if (state.dataGlobal->DoCoilDirectSolutions && this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedCooling) {
9742 0 : this->FullOutput[SpeedNum] = SensOutputOn;
9743 : }
9744 : // over specified logic? it has to be a water coil? what about other VS coil models?
9745 30812 : if ((this->m_CoolingCoilType_Num != DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit) &&
9746 30812 : ((this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWater ||
9747 15406 : this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWaterDetailed) &&
9748 0 : !this->m_DiscreteSpeedCoolingCoil)) {
9749 0 : this->m_CoolingSpeedRatio = 0.0;
9750 0 : this->m_CoolingSpeedNum = SpeedNum - 1;
9751 0 : if (this->m_CoolingSpeedNum == 0) {
9752 0 : this->m_CoolingCycRatio = 0.0;
9753 0 : CoolPLR = 0.0;
9754 : } else {
9755 0 : this->m_CoolingCycRatio = 1.0;
9756 0 : this->m_CoolingSpeedRatio = 0.0;
9757 0 : if (this->m_SingleMode == 1) {
9758 0 : CoolPLR = 1.0;
9759 : }
9760 : }
9761 :
9762 0 : this->calcUnitarySystemToLoad(state,
9763 : AirLoopNum,
9764 : FirstHVACIteration,
9765 : CoolPLR,
9766 : HeatPLR,
9767 : OnOffAirFlowRatio,
9768 : SensOutputOn,
9769 : LatOutputOn,
9770 0 : HXUnitOn,
9771 : HeatCoilLoad,
9772 : SupHeaterLoad,
9773 : CompressorONFlag);
9774 0 : this->m_CoolingSpeedNum = SpeedNum;
9775 : }
9776 15406 : if (state.dataUnitarySystems->MoistureLoad >= LatOutputOn) {
9777 4162 : break;
9778 : }
9779 : }
9780 : } else {
9781 0 : CoolPLR = 1.0;
9782 0 : this->calcUnitarySystemToLoad(state,
9783 : AirLoopNum,
9784 : FirstHVACIteration,
9785 : CoolPLR,
9786 : HeatPLR,
9787 : OnOffAirFlowRatio,
9788 : SensOutputOn,
9789 : LatOutputOn,
9790 0 : HXUnitOn,
9791 : HeatCoilLoad,
9792 : SupHeaterLoad,
9793 : CompressorONFlag);
9794 0 : this->m_CoolingPartLoadFrac = CoolPLR;
9795 : }
9796 : }
9797 :
9798 29954 : if ((state.dataUnitarySystems->MoistureLoad < TempLatOutput) &&
9799 14977 : (state.dataUnitarySystems->MoistureLoad > LatOutputOn)) { // bounds check for RegulaFalsi
9800 :
9801 : // save heating PLR
9802 6877 : HeatPLR = this->m_HeatingPartLoadFrac;
9803 : Real64 par5;
9804 : Real64 par7;
9805 6877 : if (this->m_DehumidControlType_Num == DehumCtrlType::Multimode) {
9806 1994 : par5 = ZoneLoad;
9807 1994 : par7 = 1.0;
9808 : } else {
9809 4883 : par5 = state.dataUnitarySystems->MoistureLoad;
9810 4883 : par7 = 0.0;
9811 : }
9812 : // Tolerance is fraction of load, MaxIter = 30, SolFalg = # of iterations or error as appropriate
9813 : auto f = [&state, this, FirstHVACIteration, CompressorONFlag, par5, par7, OnOffAirFlowRatio, HXUnitOn, AirLoopNum](
9814 102524 : Real64 const PartLoadRatio) {
9815 76893 : return UnitarySys::calcUnitarySystemLoadResidual(state,
9816 : PartLoadRatio,
9817 : this->m_UnitarySysNum,
9818 : FirstHVACIteration,
9819 : // par 3 not used?
9820 : CompressorONFlag,
9821 : par5,
9822 : 1.0,
9823 : par7,
9824 : OnOffAirFlowRatio,
9825 : HXUnitOn,
9826 : // par 10 not used
9827 : AirLoopNum);
9828 32508 : };
9829 6877 : General::SolveRoot(state, 0.001, MaxIter, SolFlagLat, PartLoadRatio, f, 0.0, 1.0);
9830 6877 : this->m_CoolingPartLoadFrac = PartLoadRatio;
9831 6877 : this->m_HeatingPartLoadFrac = HeatPLR;
9832 8100 : } else if (state.dataUnitarySystems->MoistureLoad < LatOutputOn && state.dataUnitarySystems->CoolingLoad) {
9833 : // Logic below needs further look...what to do if the bounds check for RegulaFalsi fail?
9834 : // I'm not even sure if this should be done.
9835 : // It's wrong anyway, since there won't be a cooling load if multimode (see RETURN about 80 lines up).
9836 8100 : if (this->m_DehumidControlType_Num != DehumCtrlType::Multimode) {
9837 5266 : this->m_CoolingPartLoadFrac = 1.0;
9838 : }
9839 : }
9840 : }
9841 :
9842 14977 : CoolPLR = this->m_CoolingPartLoadFrac;
9843 14977 : HeatPLR = this->m_HeatingPartLoadFrac;
9844 :
9845 14977 : this->calcUnitarySystemToLoad(state,
9846 : AirLoopNum,
9847 : FirstHVACIteration,
9848 : CoolPLR,
9849 : HeatPLR,
9850 : OnOffAirFlowRatio,
9851 : TempSensOutput,
9852 : TempLatOutput,
9853 14977 : HXUnitOn,
9854 : HeatCoilLoad,
9855 : SupHeaterLoad,
9856 : CompressorONFlag);
9857 :
9858 14977 : if (SolFlagLat == -1) {
9859 : // RegulaFalsi may not find cooling PLR when the latent degradation model is used.
9860 : // IF iteration limit is exceeded, find tighter boundary of solution and repeat RegulaFalsi
9861 0 : TempMaxPLR = -0.1;
9862 0 : TempLatOutput = LatOutputOff;
9863 0 : while ((TempLatOutput - state.dataUnitarySystems->MoistureLoad) > 0.0 && TempMaxPLR < 1.0) {
9864 : // find upper limit of HeatingPLR
9865 0 : TempMaxPLR += 0.1;
9866 0 : this->calcUnitarySystemToLoad(state,
9867 : AirLoopNum,
9868 : FirstHVACIteration,
9869 : TempMaxPLR,
9870 : HeatPLR,
9871 : OnOffAirFlowRatio,
9872 : TempSensOutput,
9873 : TempLatOutput,
9874 0 : HXUnitOn,
9875 : HeatCoilLoad,
9876 : SupHeaterLoad,
9877 : CompressorONFlag);
9878 : }
9879 0 : TempMinPLR = TempMaxPLR;
9880 0 : while ((TempLatOutput - state.dataUnitarySystems->MoistureLoad) < 0.0 && TempMinPLR > 0.0) {
9881 : // pull upper limit of HeatingPLR DOwn to last valid limit (i.e. heat output still exceeds SystemSensibleLoad)
9882 0 : TempMaxPLR = TempMinPLR;
9883 : // find minimum limit of HeatingPLR
9884 0 : TempMinPLR -= 0.01;
9885 0 : this->calcUnitarySystemToLoad(state,
9886 : AirLoopNum,
9887 : FirstHVACIteration,
9888 : TempMinPLR,
9889 : HeatPLR,
9890 : OnOffAirFlowRatio,
9891 : TempSensOutput,
9892 : TempLatOutput,
9893 0 : HXUnitOn,
9894 : HeatCoilLoad,
9895 : SupHeaterLoad,
9896 : CompressorONFlag);
9897 : }
9898 : // Now solve again with tighter PLR limits
9899 : Real64 par5;
9900 : Real64 par7;
9901 0 : if (this->m_DehumidControlType_Num == DehumCtrlType::Multimode) {
9902 0 : par5 = ZoneLoad;
9903 0 : par7 = 1.0;
9904 : } else {
9905 0 : par5 = state.dataUnitarySystems->MoistureLoad;
9906 0 : par7 = 0.0;
9907 : }
9908 : // // Tolerance is fraction of load, M
9909 : auto f = [&state, this, FirstHVACIteration, CompressorONFlag, OnOffAirFlowRatio, HXUnitOn, AirLoopNum, par5, par7](
9910 0 : Real64 const PartLoadRatio) {
9911 : // TODO: The actual Par array being used here may have been altered through any of the sections above, and this line is not covered by
9912 : // a unit or integration test
9913 : // TODO: So I made some assumptions about the arguments. I'm not sure if ultimately this is even accessible, so maybe it doesn't
9914 : // matter.
9915 0 : return UnitarySys::calcUnitarySystemLoadResidual(state,
9916 : PartLoadRatio,
9917 : this->m_UnitarySysNum,
9918 : FirstHVACIteration,
9919 : // par 3 not used?
9920 : CompressorONFlag,
9921 : par5,
9922 : 1.0,
9923 : par7,
9924 : OnOffAirFlowRatio,
9925 : HXUnitOn,
9926 : // par 10 not used
9927 : AirLoopNum);
9928 0 : };
9929 0 : General::SolveRoot(state, 0.001, MaxIter, SolFlagLat, CoolPLR, f, TempMinPLR, TempMaxPLR);
9930 0 : this->calcUnitarySystemToLoad(state,
9931 : AirLoopNum,
9932 : FirstHVACIteration,
9933 : CoolPLR,
9934 : HeatPLR,
9935 : OnOffAirFlowRatio,
9936 : TempSensOutput,
9937 : TempLatOutput,
9938 0 : HXUnitOn,
9939 : HeatCoilLoad,
9940 : SupHeaterLoad,
9941 : CompressorONFlag);
9942 0 : if (SolFlagLat == -1) {
9943 0 : if (std::abs(state.dataUnitarySystems->MoistureLoad - TempLatOutput) > DataHVACGlobals::SmallLoad) {
9944 0 : if (this->warnIndex.m_LatMaxIterIndex == 0) {
9945 0 : ShowWarningMessage(state, "Coil control failed to converge for " + this->UnitType + ':' + this->Name);
9946 0 : ShowContinueError(state, " Iteration limit exceeded in calculating system Latent part-load ratio.");
9947 0 : ShowContinueErrorTimeStamp(
9948 : state,
9949 0 : format("Latent load to be met = {:.2T} (watts), Latent output = {:.2T} (watts), and the simulation continues.",
9950 0 : state.dataUnitarySystems->MoistureLoad,
9951 0 : TempLatOutput));
9952 : }
9953 0 : ShowRecurringWarningErrorAtEnd(
9954 : state,
9955 0 : this->UnitType + " \"" + this->Name +
9956 : "\" - Iteration limit exceeded in calculating Latent part-load ratio error continues. Latent load statistics:",
9957 : this->warnIndex.m_LatMaxIterIndex,
9958 0 : state.dataUnitarySystems->MoistureLoad,
9959 0 : state.dataUnitarySystems->MoistureLoad);
9960 : }
9961 0 : } else if (SolFlagLat == -2) {
9962 0 : if (this->warnIndex.m_LatRegulaFalsiFailedIndex == 0) {
9963 0 : ShowWarningMessage(state, "Coil control failed for " + this->UnitType + ':' + this->Name);
9964 0 : ShowContinueError(state, " Latent part-load ratio determined to be outside the range of 0-1.");
9965 0 : ShowContinueErrorTimeStamp(
9966 : state,
9967 0 : format("Latent load to be met = {:.2T} (watts), and the simulation continues.", state.dataUnitarySystems->MoistureLoad));
9968 : }
9969 0 : ShowRecurringWarningErrorAtEnd(state,
9970 0 : this->UnitType + " \"" + this->Name +
9971 : "\" - Latent part-load ratio out of range error continues. Latent load statistics:",
9972 : this->warnIndex.m_LatRegulaFalsiFailedIndex,
9973 0 : state.dataUnitarySystems->MoistureLoad,
9974 0 : state.dataUnitarySystems->MoistureLoad);
9975 : }
9976 14977 : } else if (SolFlagLat == -2) {
9977 0 : if (this->warnIndex.m_LatRegulaFalsiFailedIndex == 0) {
9978 0 : ShowWarningMessage(state, "Coil control failed for " + this->UnitType + ':' + this->Name);
9979 0 : ShowContinueError(state, " Latent part-load ratio determined to be outside the range of 0-1.");
9980 0 : ShowContinueErrorTimeStamp(
9981 0 : state, format("Latent load to be met = {:.2T} (watts), and the simulation continues.", state.dataUnitarySystems->MoistureLoad));
9982 : }
9983 0 : ShowRecurringWarningErrorAtEnd(state,
9984 0 : this->UnitType + " \"" + this->Name +
9985 : "\" - Latent part-load ratio out of range error continues. Latent load statistics:",
9986 : this->warnIndex.m_LatRegulaFalsiFailedIndex,
9987 0 : state.dataUnitarySystems->MoistureLoad,
9988 0 : state.dataUnitarySystems->MoistureLoad);
9989 : }
9990 :
9991 14977 : FullSensibleOutput = TempSensOutput;
9992 :
9993 14977 : CpAir = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(this->CoolCoilInletNodeNum).HumRat);
9994 14977 : CoolingOnlySensibleOutput =
9995 14977 : state.dataLoopNodes->Node(this->CoolCoilInletNodeNum).MassFlowRate * CpAir *
9996 29954 : ((state.dataLoopNodes->Node(this->NodeNumOfControlledZone).Temp - state.dataLoopNodes->Node(this->CoolCoilOutletNodeNum).Temp) -
9997 14977 : (state.dataLoopNodes->Node(this->HeatCoilOutletNodeNum).Temp - state.dataLoopNodes->Node(this->HeatCoilInletNodeNum).Temp));
9998 14977 : if (state.dataUnitarySystems->QToHeatSetPt < 0.0) {
9999 : // Calculate the reheat coil load wrt the heating setpoint temperature. Reheat coil picks up
10000 : // the entire excess sensible cooling (DX cooling coil and impact of outdoor air).
10001 14256 : this->m_DehumidInducedHeatingDemandRate = max(0.0, (CoolingOnlySensibleOutput + state.dataUnitarySystems->QToHeatSetPt));
10002 : // Heating mode and dehumidification is required
10003 721 : } else if (state.dataUnitarySystems->QToHeatSetPt >= 0.0) {
10004 : // Calculate the reheat coil load as the sensible capacity of the DX cooling coil only. Let
10005 : // the heating coil pick up the load due to outdoor air.
10006 721 : this->m_DehumidInducedHeatingDemandRate = max(0.0, CoolingOnlySensibleOutput);
10007 : }
10008 : }
10009 :
10010 2500856 : void UnitarySys::initLoadBasedControl(EnergyPlusData &state,
10011 : int const AirLoopNum, // number of the current air loop being simulated
10012 : bool const FirstHVACIteration,
10013 : Real64 &OnOffAirFlowRatio,
10014 : Real64 &ZoneLoad)
10015 : {
10016 :
10017 : // SUBROUTINE INFORMATION:
10018 : // AUTHOR Richard Raustad, FSEC
10019 : // DATE WRITTEN February 2013
10020 :
10021 : // PURPOSE OF THIS SUBROUTINE:
10022 : // This subroutine is for initializations of the load controlled Unitary Systems.
10023 :
10024 : // METHODOLOGY EMPLOYED:
10025 : // Initialize mass flow rates and speed ratios. Calculate loads and adjust if necessary when using constant fan.
10026 :
10027 : // SUBROUTINE PARAMETER DEFINITIONS:
10028 : static constexpr std::string_view routineName("InitUnitarySystems");
10029 2500856 : Real64 QZnReq = 0.0;
10030 2500856 : Real64 QActual = 0.0;
10031 2500856 : Real64 SensOutputOff = 0.0;
10032 2500856 : Real64 LatOutputOff = 0.0;
10033 2500856 : Real64 HeatCoilLoad = 0.0;
10034 2500856 : Real64 SupHeaterLoad = 0.0;
10035 2500856 : DataHVACGlobals::CompressorOperation CompressorOn = DataHVACGlobals::CompressorOperation::Off;
10036 :
10037 : // error flag for mining functions
10038 2500856 : bool errorsFound = false;
10039 :
10040 : // do the Begin Environment initializations
10041 2500856 : if (state.dataGlobal->BeginEnvrnFlag && this->m_MyEnvrnFlag2) {
10042 :
10043 : // set fluid-side hardware limits
10044 1750 : if (this->HeatCoilFluidInletNode > 0) {
10045 :
10046 62 : if (this->MaxHeatCoilFluidFlow == DataSizing::AutoSize) {
10047 : // IF water coil max water flow rate is DataSizing::AutoSized, simulate once in order to mine max flow rate
10048 0 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWater) {
10049 0 : WaterCoils::SimulateWaterCoilComponents(state, this->m_HeatingCoilName, FirstHVACIteration, this->m_HeatingCoilIndex);
10050 : Real64 CoilMaxVolFlowRate =
10051 0 : WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", this->m_HeatingCoilName, errorsFound);
10052 0 : if (CoilMaxVolFlowRate != DataSizing::AutoSize) {
10053 0 : Real64 rho = FluidProperties::GetDensityGlycol(state,
10054 0 : state.dataPlnt->PlantLoop(this->HeatCoilPlantLoc.loopNum).FluidName,
10055 : DataGlobalConstants::CWInitConvTemp,
10056 0 : state.dataPlnt->PlantLoop(this->HeatCoilPlantLoc.loopNum).FluidIndex,
10057 0 : routineName);
10058 0 : this->MaxHeatCoilFluidFlow = CoilMaxVolFlowRate * rho;
10059 : }
10060 : }
10061 : // IF steam coil max steam flow rate is DataSizing::AutoSized, simulate once in order to mine max flow rate
10062 0 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingSteam) {
10063 0 : SteamCoils::SimulateSteamCoilComponents(state,
10064 : this->m_HeatingCoilName,
10065 : FirstHVACIteration,
10066 : this->m_HeatingCoilIndex,
10067 : 1.0,
10068 : QActual); // QCoilReq, simulate any load > 0 to get max capacity
10069 0 : Real64 CoilMaxVolFlowRate = SteamCoils::GetCoilMaxSteamFlowRate(state, this->m_HeatingCoilIndex, errorsFound);
10070 0 : if (CoilMaxVolFlowRate != DataSizing::AutoSize) {
10071 0 : int SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed
10072 0 : Real64 TempSteamIn = 100.0;
10073 : Real64 SteamDensity =
10074 0 : FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, SteamIndex, routineName);
10075 0 : this->MaxHeatCoilFluidFlow = CoilMaxVolFlowRate * SteamDensity;
10076 : }
10077 : }
10078 : }
10079 :
10080 62 : PlantUtilities::InitComponentNodes(
10081 : state, 0.0, this->MaxHeatCoilFluidFlow, this->HeatCoilFluidInletNode, this->HeatCoilFluidOutletNodeNum);
10082 : }
10083 1750 : if (this->m_SuppCoilFluidInletNode > 0) {
10084 0 : if (this->m_MaxSuppCoilFluidFlow == DataSizing::AutoSize) {
10085 0 : if (this->m_SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingWater) {
10086 : // IF water coil max water flow rate is DataSizing::AutoSized, simulate once in order to mine max flow rate
10087 0 : WaterCoils::SimulateWaterCoilComponents(state, this->m_SuppHeatCoilName, FirstHVACIteration, this->m_SuppHeatCoilIndex);
10088 : Real64 CoilMaxVolFlowRate =
10089 0 : WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", this->m_SuppHeatCoilName, errorsFound);
10090 0 : if (CoilMaxVolFlowRate != DataSizing::AutoSize) {
10091 0 : Real64 rho = FluidProperties::GetDensityGlycol(state,
10092 0 : state.dataPlnt->PlantLoop(this->m_SuppCoilPlantLoc.loopNum).FluidName,
10093 : DataGlobalConstants::CWInitConvTemp,
10094 0 : state.dataPlnt->PlantLoop(this->m_SuppCoilPlantLoc.loopNum).FluidIndex,
10095 0 : routineName);
10096 0 : this->m_MaxSuppCoilFluidFlow = CoilMaxVolFlowRate * rho;
10097 : }
10098 : }
10099 0 : if (this->m_SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingSteam) {
10100 0 : SteamCoils::SimulateSteamCoilComponents(state,
10101 : this->m_SuppHeatCoilName,
10102 : FirstHVACIteration,
10103 : this->m_SuppHeatCoilIndex,
10104 : 1.0,
10105 : QActual); // QCoilReq, simulate any load > 0 to get max capacity
10106 0 : Real64 CoilMaxVolFlowRate = SteamCoils::GetCoilMaxSteamFlowRate(state, this->m_SuppHeatCoilIndex, errorsFound);
10107 0 : if (CoilMaxVolFlowRate != DataSizing::AutoSize) {
10108 0 : int SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed
10109 0 : Real64 TempSteamIn = 100.0;
10110 : Real64 SteamDensity =
10111 0 : FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, SteamIndex, routineName);
10112 0 : this->m_MaxSuppCoilFluidFlow = CoilMaxVolFlowRate * SteamDensity;
10113 : }
10114 : }
10115 0 : PlantUtilities::InitComponentNodes(
10116 : state, 0.0, this->m_MaxSuppCoilFluidFlow, this->m_SuppCoilFluidInletNode, this->m_SuppCoilFluidOutletNodeNum);
10117 : }
10118 : }
10119 1750 : this->m_MyEnvrnFlag2 = false;
10120 : }
10121 :
10122 2500856 : if (allocated(state.dataZoneEquip->ZoneEquipConfig) && this->m_MyCheckFlag) {
10123 1254008 : if (this->m_AirLoopEquipment) {
10124 96 : int zoneInlet = this->m_ZoneInletNode;
10125 96 : if (zoneInlet == 0) {
10126 0 : this->m_ThisSysInputShouldBeGotten = true; // need to find zone inlet node once data is available
10127 0 : this->m_MySizingCheckFlag = true; // need to resize after getInput is read in again
10128 0 : this->m_OKToPrintSizing = true; // hope first time back through finds the data, else multiple prints to the eio
10129 0 : this->m_airLoopReturnCounter += 1;
10130 0 : if (this->m_airLoopReturnCounter < 3) return;
10131 : }
10132 96 : int coolingPriority = 0;
10133 96 : int heatingPriority = 0;
10134 : // setup zone equipment sequence information based on finding matching air terminal
10135 96 : if (state.dataZoneEquip->ZoneEquipConfig(this->ControlZoneNum).EquipListIndex > 0) {
10136 96 : state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(this->ControlZoneNum).EquipListIndex)
10137 96 : .getPrioritiesForInletNode(state, zoneInlet, coolingPriority, heatingPriority);
10138 96 : this->m_ZoneSequenceCoolingNum = coolingPriority;
10139 96 : this->m_ZoneSequenceHeatingNum = heatingPriority;
10140 : }
10141 96 : this->m_MyCheckFlag = false;
10142 96 : if (this->m_ZoneSequenceCoolingNum == 0 || this->m_ZoneSequenceHeatingNum == 0) {
10143 0 : ShowSevereError(state,
10144 0 : this->UnitType + " \"" + this->Name + "\": Airloop air terminal in the zone equipment list for zone = " +
10145 0 : state.dataHeatBal->Zone(this->ControlZoneNum).Name +
10146 : " not found or is not allowed Zone Equipment Cooling or Heating Sequence = 0.");
10147 0 : ShowFatalError(state,
10148 0 : "Subroutine InitLoadBasedControl: Errors found in getting " + this->UnitType +
10149 : " input. Preceding condition(s) causes termination.");
10150 : }
10151 : }
10152 1254008 : if (this->m_ZoneInletNode == 0) {
10153 0 : ShowSevereError(state,
10154 0 : this->UnitType + " \"" + this->Name + "\": The zone inlet node in the controlled zone (" +
10155 0 : state.dataHeatBal->Zone(this->ControlZoneNum).Name + ") is not found.");
10156 0 : ShowFatalError(state,
10157 0 : "Subroutine InitLoadBasedControl: Errors found in getting " + this->UnitType +
10158 : " input. Preceding condition(s) causes termination.");
10159 : }
10160 : }
10161 :
10162 : // What type of logic is this? Is the point to go through the main IF once? or every other time?
10163 : // RR: This was used with AirflowNetwork to calculate duct losses.
10164 : // RR: AFN counts the number of passes through airloop equipment (same logic in Furnaces and other modules) and resets the counter to 0 on
10165 : // BeginEnvrnFlag. RR: This has been changed in this module and AFN to use AirflowNetworkFanActivated if AirflowNetworkUnitarySystem is seen
10166 : // by AFN. RR: Search for AirflowNetworkFanActivated in this module to see usage. The following lines of code can probably be removed although
10167 : // it would require a AFN input file to test.
10168 2500856 : if (state.dataGlobal->BeginEnvrnFlag && m_initLoadBasedControlAirLoopPass) {
10169 1654 : m_airLoopPassCounter = 0;
10170 1654 : m_initLoadBasedControlAirLoopPass = false;
10171 : }
10172 2500856 : if (!state.dataGlobal->BeginEnvrnFlag) {
10173 2486346 : this->m_MyEnvrnFlag2 = true; // this does not appear to be needed, only initializes autosized coil fluid flow rates
10174 2486346 : m_initLoadBasedControlAirLoopPass = true;
10175 : }
10176 :
10177 2500856 : ++m_airLoopPassCounter;
10178 2500856 : if (m_airLoopPassCounter > 2) m_airLoopPassCounter = 1;
10179 :
10180 : // reset duct losses from previous iteration
10181 2500856 : if (FirstHVACIteration) {
10182 878666 : this->m_SenLoadLoss = 0.0;
10183 878666 : this->m_LatLoadLoss = 0.0;
10184 : }
10185 :
10186 : // Calcuate air distribution losses
10187 2500856 : if (!FirstHVACIteration && state.afn->AirflowNetworkFanActivated) {
10188 10014 : Real64 DeltaMassRate = 0.0;
10189 10014 : Real64 TotalOutput = 0.0; // total output rate, {W}
10190 10014 : Real64 SensibleOutputDelta = 0.0; // delta sensible output rate, {W}
10191 10014 : Real64 LatentOutputDelta = 0.0; // delta latent output rate, {W}
10192 10014 : Real64 TotalOutputDelta = 0.0; // delta total output rate, {W}
10193 10014 : int ZoneInNode = this->m_ZoneInletNode;
10194 10014 : Real64 MassFlowRate = state.dataLoopNodes->Node(ZoneInNode).MassFlowRate / this->ControlZoneMassFlowFrac;
10195 10014 : if (state.afn->distribution_simulated) {
10196 20028 : DeltaMassRate = state.dataLoopNodes->Node(this->AirOutNode).MassFlowRate -
10197 10014 : state.dataLoopNodes->Node(ZoneInNode).MassFlowRate / this->ControlZoneMassFlowFrac;
10198 10014 : if (DeltaMassRate < 0.0) DeltaMassRate = 0.0;
10199 : } else {
10200 0 : MassFlowRate = state.dataLoopNodes->Node(this->AirOutNode).MassFlowRate;
10201 0 : DeltaMassRate = 0.0;
10202 : }
10203 50070 : CalcComponentSensibleLatentOutput(MassFlowRate,
10204 10014 : state.dataLoopNodes->Node(this->AirOutNode).Temp,
10205 10014 : state.dataLoopNodes->Node(this->AirOutNode).HumRat,
10206 10014 : state.dataLoopNodes->Node(ZoneInNode).Temp,
10207 10014 : state.dataLoopNodes->Node(ZoneInNode).HumRat,
10208 : this->m_SenLoadLoss,
10209 : this->m_LatLoadLoss,
10210 : TotalOutput);
10211 40056 : CalcComponentSensibleLatentOutput(DeltaMassRate,
10212 10014 : state.dataLoopNodes->Node(this->AirOutNode).Temp,
10213 10014 : state.dataLoopNodes->Node(this->AirOutNode).HumRat,
10214 10014 : state.dataLoopNodes->Node(this->NodeNumOfControlledZone).Temp,
10215 10014 : state.dataLoopNodes->Node(this->NodeNumOfControlledZone).HumRat,
10216 : SensibleOutputDelta,
10217 : LatentOutputDelta,
10218 : TotalOutputDelta);
10219 10014 : this->m_SenLoadLoss = this->m_SenLoadLoss + SensibleOutputDelta;
10220 10014 : if (std::abs(this->m_SensibleLoadMet) > 0.0) {
10221 10014 : if (std::abs(this->m_SenLoadLoss / this->m_SensibleLoadMet) < 0.001) this->m_SenLoadLoss = 0.0;
10222 : }
10223 10014 : if (this->m_Humidistat) {
10224 0 : this->m_LatLoadLoss = this->m_LatLoadLoss + LatentOutputDelta;
10225 0 : if (std::abs(this->m_LatentLoadMet) > 0.0) {
10226 0 : if (std::abs(this->m_LatLoadLoss / this->m_LatentLoadMet) < 0.001) this->m_LatLoadLoss = 0.0;
10227 : }
10228 : }
10229 : }
10230 :
10231 2500856 : if (this->m_FanOpModeSchedPtr > 0) {
10232 2498342 : if (ScheduleManager::GetCurrentScheduleValue(state, this->m_FanOpModeSchedPtr) == 0.0) {
10233 1361436 : this->m_FanOpMode = DataHVACGlobals::CycFanCycCoil;
10234 : } else {
10235 1136906 : this->m_FanOpMode = DataHVACGlobals::ContFanCycCoil;
10236 1136906 : state.dataHVACGlobal->OnOffFanPartLoadFraction = 1.0;
10237 : }
10238 : }
10239 :
10240 : // System load calculation for cycling fan systems
10241 2500856 : if (this->ControlZoneMassFlowFrac > 0.0) {
10242 2500658 : QZnReq = ZoneLoad / this->ControlZoneMassFlowFrac;
10243 2500658 : state.dataUnitarySystems->MoistureLoad /= this->ControlZoneMassFlowFrac;
10244 2500658 : state.dataUnitarySystems->QToCoolSetPt /= this->ControlZoneMassFlowFrac;
10245 2500658 : state.dataUnitarySystems->QToHeatSetPt /= this->ControlZoneMassFlowFrac;
10246 2500658 : ZoneLoad = QZnReq;
10247 : } else {
10248 198 : QZnReq = ZoneLoad;
10249 198 : this->ControlZoneMassFlowFrac = 1.0;
10250 : }
10251 :
10252 2500856 : state.dataUnitarySystems->CoolingLoad = false;
10253 2500856 : state.dataUnitarySystems->HeatingLoad = false;
10254 2500856 : Real64 smallLoadTolerance = this->m_SmallLoadTolerance;
10255 2500856 : if (this->m_sysType == SysType::PackagedAC || this->m_sysType == SysType::PackagedHP || this->m_sysType == SysType::PackagedWSHP) {
10256 1231508 : smallLoadTolerance = DataHVACGlobals::SmallLoad;
10257 : }
10258 2500856 : if (QZnReq > smallLoadTolerance) { // no need to check deadband flag, QZnReq is correct.
10259 1017037 : if (state.dataHeatBalFanSys->TempControlType(this->ControlZoneNum) != DataHVACGlobals::ThermostatType::SingleCooling) {
10260 1017037 : state.dataUnitarySystems->HeatingLoad = true;
10261 : }
10262 1483819 : } else if (QZnReq < -smallLoadTolerance) {
10263 1163527 : if (state.dataHeatBalFanSys->TempControlType(this->ControlZoneNum) != DataHVACGlobals::ThermostatType::SingleHeating) {
10264 1163516 : state.dataUnitarySystems->CoolingLoad = true;
10265 : }
10266 : }
10267 :
10268 : // System load calculation for constant fan systems
10269 2500856 : if (this->m_FanOpMode == DataHVACGlobals::ContFanCycCoil) {
10270 1136906 : bool HXUnitOn = false;
10271 1136906 : this->FanPartLoadRatio = 0.0; // sets fan to minimum for ASHRAE model
10272 1136906 : if (this->m_sysType == SysType::PackagedAC || this->m_sysType == SysType::PackagedHP || this->m_sysType == SysType::PackagedWSHP) {
10273 : // the SpeedNum is set for PTUnits, might need to set this for all multi/var speed coils?
10274 291191 : if (state.dataUnitarySystems->CoolingLoad && this->m_MultiOrVarSpeedCoolCoil) {
10275 5987 : m_CoolingSpeedNum = 1;
10276 285204 : } else if (state.dataUnitarySystems->HeatingLoad && this->m_MultiOrVarSpeedHeatCoil) {
10277 1726 : m_HeatingSpeedNum = 1;
10278 : }
10279 : }
10280 1136906 : this->setOnOffMassFlowRate(state, OnOffAirFlowRatio,
10281 : 0.0); // CompOnMassFlow and CompOffMassFlow are scalar, reset to this system's values
10282 1136906 : this->calcUnitarySystemToLoad(state,
10283 : AirLoopNum,
10284 : FirstHVACIteration,
10285 : 0.0,
10286 : 0.0,
10287 : OnOffAirFlowRatio,
10288 : SensOutputOff,
10289 : LatOutputOff,
10290 : HXUnitOn,
10291 : HeatCoilLoad,
10292 : SupHeaterLoad,
10293 : CompressorOn);
10294 :
10295 1136906 : switch (state.dataHeatBalFanSys->TempControlType(this->ControlZoneNum)) {
10296 9143 : case DataHVACGlobals::ThermostatType::SingleHeating:
10297 9143 : state.dataUnitarySystems->CoolingLoad = false;
10298 : // No heating load and constant fan pushes zone below heating set point
10299 13881 : if (SensOutputOff < 0.0 && state.dataUnitarySystems->QToHeatSetPt <= 0.0 &&
10300 4738 : SensOutputOff - state.dataUnitarySystems->QToHeatSetPt < -DataHVACGlobals::SmallLoad) {
10301 164 : state.dataUnitarySystems->HeatingLoad = true;
10302 164 : state.dataUnitarySystems->CoolingLoad = false;
10303 164 : ZoneLoad = state.dataUnitarySystems->QToHeatSetPt;
10304 : }
10305 9143 : break;
10306 8994 : case DataHVACGlobals::ThermostatType::SingleCooling:
10307 8994 : state.dataUnitarySystems->HeatingLoad = false;
10308 : // No heating load and constant fan pushes zone above cooling set point
10309 9121 : if (SensOutputOff > 0.0 && state.dataUnitarySystems->QToCoolSetPt > 0.0 &&
10310 127 : SensOutputOff - state.dataUnitarySystems->QToCoolSetPt > DataHVACGlobals::SmallLoad) {
10311 80 : state.dataUnitarySystems->HeatingLoad = false;
10312 80 : state.dataUnitarySystems->CoolingLoad = true;
10313 80 : ZoneLoad = state.dataUnitarySystems->QToCoolSetPt;
10314 : }
10315 8994 : break;
10316 0 : case DataHVACGlobals::ThermostatType::SingleHeatCool:
10317 : // zone temp above cooling and heating set point temps
10318 0 : if (state.dataUnitarySystems->QToHeatSetPt < 0.0 && state.dataUnitarySystems->QToCoolSetPt < 0.0) {
10319 : // zone pushed below heating set point
10320 0 : if (SensOutputOff < 0.0 && state.dataUnitarySystems->QToHeatSetPt - SensOutputOff > DataHVACGlobals::SmallLoad) {
10321 0 : state.dataUnitarySystems->HeatingLoad = true;
10322 0 : state.dataUnitarySystems->CoolingLoad = false;
10323 0 : ZoneLoad = state.dataUnitarySystems->QToHeatSetPt;
10324 : }
10325 : // zone temp below heating set point temp
10326 0 : } else if (state.dataUnitarySystems->QToHeatSetPt > 0.0 && state.dataUnitarySystems->QToCoolSetPt > 0.0) {
10327 : // zone pushed above cooling set point
10328 0 : if (SensOutputOff > 0.0 && state.dataUnitarySystems->QToCoolSetPt - SensOutputOff > DataHVACGlobals::SmallLoad) {
10329 0 : state.dataUnitarySystems->HeatingLoad = false;
10330 0 : state.dataUnitarySystems->CoolingLoad = true;
10331 0 : ZoneLoad = state.dataUnitarySystems->QToCoolSetPt;
10332 : }
10333 : }
10334 0 : break;
10335 1118769 : case DataHVACGlobals::ThermostatType::DualSetPointWithDeadBand:
10336 : // zone temp above cooling and heating set point temps
10337 1118769 : if (state.dataUnitarySystems->QToHeatSetPt < 0.0 && state.dataUnitarySystems->QToCoolSetPt < 0.0) {
10338 : // zone pushed into deadband
10339 527533 : if (SensOutputOff < 0.0 && state.dataUnitarySystems->QToCoolSetPt - SensOutputOff > DataHVACGlobals::SmallLoad) {
10340 15644 : state.dataUnitarySystems->HeatingLoad = false;
10341 15644 : state.dataUnitarySystems->CoolingLoad = false;
10342 15644 : ZoneLoad = 0.0;
10343 : }
10344 : // zone pushed below heating set point
10345 527533 : if (SensOutputOff < 0.0 && state.dataUnitarySystems->QToHeatSetPt - SensOutputOff > DataHVACGlobals::SmallLoad) {
10346 3538 : state.dataUnitarySystems->HeatingLoad = true;
10347 3538 : state.dataUnitarySystems->CoolingLoad = false;
10348 3538 : ZoneLoad = state.dataUnitarySystems->QToHeatSetPt;
10349 : }
10350 : // zone temp below heating set point temp
10351 591236 : } else if (state.dataUnitarySystems->QToHeatSetPt > 0.0 && state.dataUnitarySystems->QToCoolSetPt > 0.0) {
10352 : // zone pushed into deadband
10353 424589 : if (SensOutputOff > 0.0 && SensOutputOff - state.dataUnitarySystems->QToHeatSetPt > DataHVACGlobals::SmallLoad) {
10354 434 : state.dataUnitarySystems->HeatingLoad = false;
10355 434 : state.dataUnitarySystems->CoolingLoad = false;
10356 434 : ZoneLoad = 0.0;
10357 : }
10358 : // zone pushed above cooling set point
10359 424589 : if (SensOutputOff > 0.0 && SensOutputOff - state.dataUnitarySystems->QToCoolSetPt > DataHVACGlobals::SmallLoad) {
10360 42 : state.dataUnitarySystems->HeatingLoad = false;
10361 42 : state.dataUnitarySystems->CoolingLoad = true;
10362 42 : ZoneLoad = state.dataUnitarySystems->QToCoolSetPt;
10363 : }
10364 : // zone temp between set point temps
10365 166647 : } else if (state.dataUnitarySystems->QToHeatSetPt < 0.0 && state.dataUnitarySystems->QToCoolSetPt > 0.0) {
10366 : // zone pushed below heating set point
10367 166647 : if (SensOutputOff < 0.0 && SensOutputOff - state.dataUnitarySystems->QToHeatSetPt < -DataHVACGlobals::SmallLoad) {
10368 21179 : state.dataUnitarySystems->HeatingLoad = true;
10369 21179 : state.dataUnitarySystems->CoolingLoad = false;
10370 21179 : ZoneLoad = state.dataUnitarySystems->QToHeatSetPt;
10371 : // zone pushed above cooling set point
10372 145468 : } else if (SensOutputOff > 0.0 && SensOutputOff - state.dataUnitarySystems->QToCoolSetPt > DataHVACGlobals::SmallLoad) {
10373 14165 : state.dataUnitarySystems->HeatingLoad = false;
10374 14165 : state.dataUnitarySystems->CoolingLoad = true;
10375 14165 : ZoneLoad = state.dataUnitarySystems->QToCoolSetPt;
10376 : }
10377 : }
10378 1118769 : break;
10379 0 : default:
10380 0 : break;
10381 : }
10382 :
10383 : // push iteration mode stack and set current mode
10384 1136906 : this->m_IterationMode[2] = this->m_IterationMode[1];
10385 1136906 : this->m_IterationMode[1] = this->m_IterationMode[0];
10386 1136906 : if (state.dataUnitarySystems->CoolingLoad) {
10387 534865 : this->m_IterationMode[0] = CoolingMode;
10388 602041 : } else if (state.dataUnitarySystems->HeatingLoad) {
10389 453403 : this->m_IterationMode[0] = HeatingMode;
10390 : } else {
10391 148638 : this->m_IterationMode[0] = NoCoolHeat;
10392 : }
10393 : // IF small loads to meet or not converging, just shut down unit
10394 1136906 : if (std::abs(ZoneLoad) < smallLoadTolerance) {
10395 149021 : ZoneLoad = 0.0;
10396 149021 : state.dataUnitarySystems->CoolingLoad = false;
10397 149021 : state.dataUnitarySystems->HeatingLoad = false;
10398 987885 : } else if (this->m_IterationCounter > (state.dataHVACGlobal->MinAirLoopIterationsAfterFirst + 6)) {
10399 : // attempt to lock output (air flow) if oscillations are detected
10400 83791 : int OperatingMode = this->m_IterationMode[0]; // VS systems can take a few more iterations than single-speed systems
10401 83791 : int OperatingModeMinusOne = this->m_IterationMode[1];
10402 83791 : int OperatingModeMinusTwo = this->m_IterationMode[2];
10403 83791 : bool Oscillate = true;
10404 83791 : if (OperatingMode == OperatingModeMinusOne && OperatingMode == OperatingModeMinusTwo) Oscillate = false;
10405 83791 : if (Oscillate) {
10406 10325 : if (state.dataUnitarySystems->QToCoolSetPt < 0.0) {
10407 10290 : state.dataUnitarySystems->HeatingLoad = false;
10408 10290 : state.dataUnitarySystems->CoolingLoad = true;
10409 10290 : ZoneLoad = state.dataUnitarySystems->QToCoolSetPt;
10410 35 : } else if (state.dataUnitarySystems->QToHeatSetPt > 0.0) {
10411 0 : state.dataUnitarySystems->HeatingLoad = true;
10412 0 : state.dataUnitarySystems->CoolingLoad = false;
10413 0 : ZoneLoad = state.dataUnitarySystems->QToHeatSetPt;
10414 : } else {
10415 35 : state.dataUnitarySystems->HeatingLoad = false;
10416 35 : state.dataUnitarySystems->CoolingLoad = false;
10417 35 : ZoneLoad = 0.0;
10418 : }
10419 : }
10420 : }
10421 : }
10422 :
10423 : // Determine the m_Staged status
10424 2500856 : if (allocated(state.dataZoneCtrls->StageZoneLogic) && this->m_DesignSpecMSHPIndex > -1) {
10425 0 : if (state.dataZoneCtrls->StageZoneLogic(this->ControlZoneNum)) {
10426 0 : this->m_Staged = true;
10427 0 : this->m_StageNum = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(this->ControlZoneNum).StageNum;
10428 : } else {
10429 0 : if (this->m_MyStagedFlag) {
10430 0 : ShowWarningError(state,
10431 : "ZoneControl:Thermostat:StagedDualSetpoint is found, but is not applied to this UnitarySystem "
10432 : "object with UnitarySystemPerformance:Multispeed type = ");
10433 0 : ShowContinueError(state, this->Name + ". Please make correction. Simulation continues...");
10434 0 : this->m_MyStagedFlag = false;
10435 : }
10436 : }
10437 : }
10438 :
10439 : // Staged control
10440 2500856 : if (this->m_Staged) {
10441 0 : if (this->m_StageNum == 0) {
10442 0 : state.dataUnitarySystems->HeatingLoad = false;
10443 0 : state.dataUnitarySystems->CoolingLoad = false;
10444 0 : QZnReq = 0.0;
10445 : } else {
10446 0 : QZnReq =
10447 0 : state.dataZoneEnergyDemand->ZoneSysEnergyDemand(this->ControlZoneNum).RemainingOutputRequired / this->ControlZoneMassFlowFrac;
10448 0 : if (QZnReq > 0.0) {
10449 0 : state.dataUnitarySystems->HeatingLoad = true;
10450 0 : state.dataUnitarySystems->CoolingLoad = false;
10451 : } else {
10452 0 : state.dataUnitarySystems->HeatingLoad = false;
10453 0 : state.dataUnitarySystems->CoolingLoad = true;
10454 : }
10455 : }
10456 : }
10457 :
10458 2500856 : if (this->m_DehumidControlType_Num == DehumCtrlType::Multimode) {
10459 84088 : if (state.dataUnitarySystems->HeatingLoad) state.dataUnitarySystems->MoistureLoad = 0.0;
10460 : }
10461 :
10462 : // Check load control
10463 2500856 : if (this->m_RunOnLatentOnlyWithSensible && ZoneLoad == 0.0) state.dataUnitarySystems->MoistureLoad = 0.0;
10464 2500856 : if (!this->m_RunOnSensibleLoad) {
10465 0 : ZoneLoad = 0.0;
10466 0 : state.dataUnitarySystems->CoolingLoad = false;
10467 0 : state.dataUnitarySystems->HeatingLoad = false;
10468 : }
10469 2500856 : if (!this->m_RunOnLatentLoad) state.dataUnitarySystems->MoistureLoad = 0.0;
10470 :
10471 : // Testing heat pump air to air with RH control with CoolReheat dehumidifaction control showed that when there was heating
10472 : // and moisture load, the cooling coil was turning on to meet the moisture load and reheat was then turning on to meet both
10473 : // heating load and excess cooling load caused by cooling coil. Adding the logic below caused the zone temperature,
10474 : // relative humidity, cooling/heating rate to line up for both the orignal and new file with unitary system object.
10475 :
10476 2500856 : if (this->m_SuppCoilExists) {
10477 747475 : if (this->m_DehumidControlType_Num == DehumCtrlType::CoolReheat) {
10478 40970 : if (state.dataUnitarySystems->MoistureLoad < 0.0 && this->m_HeatPump) {
10479 4590 : state.dataUnitarySystems->HeatingLoad = false;
10480 4590 : state.dataUnitarySystems->CoolingLoad = true;
10481 : }
10482 : }
10483 : }
10484 :
10485 : // set report variables for predicted sensible and latent load
10486 2500856 : this->m_SensibleLoadPredicted = ZoneLoad;
10487 2500856 : this->m_MoistureLoadPredicted = state.dataUnitarySystems->MoistureLoad;
10488 : }
10489 :
10490 25975524 : void UnitarySys::setOnOffMassFlowRate(EnergyPlusData &state,
10491 : Real64 &OnOffAirFlowRatio, // ratio of coil on to coil off air flow rate
10492 : Real64 const PartLoadRatio // coil part-load ratio
10493 : )
10494 : {
10495 :
10496 : // SUBROUTINE INFORMATION:
10497 : // AUTHOR Chandan Sharma
10498 : // DATE WRITTEN May 2013
10499 :
10500 : // PURPOSE OF THIS SUBROUTINE:
10501 : // This subroutine is for initializations of the components.
10502 :
10503 : // METHODOLOGY EMPLOYED:
10504 : // The unitarysystem may have alternate air flow rates
10505 : // in cooling, heating, and when no cooling or heating is needed. Set up the coil (comp) ON and OFF
10506 : // air flow rates. Use these flow rates during the Calc routines to set the average mass flow rates
10507 : // based on PLR.
10508 :
10509 : // REFERENCES:
10510 : // Based on SetOnOffMassFlowRate by Richard Raustad
10511 :
10512 25975524 : int HeatSpeedNum = 0;
10513 25975524 : int CoolSpeedNum = 0;
10514 :
10515 25975524 : state.dataUnitarySystems->CompOffMassFlow = 0.0;
10516 25975524 : state.dataUnitarySystems->CompOffFlowRatio = 0.0;
10517 25975524 : state.dataUnitarySystems->m_massFlow1 = 0.0;
10518 25975524 : state.dataUnitarySystems->m_massFlow2 = 0.0;
10519 25975524 : state.dataUnitarySystems->OACompOnMassFlow = 0.0;
10520 25975524 : state.dataUnitarySystems->OACompOffMassFlow = 0.0;
10521 :
10522 : // Set the compressor or coil ON mass flow rate
10523 25975524 : if (state.dataUnitarySystems->HeatingLoad) {
10524 :
10525 9933372 : this->m_LastMode = HeatingMode;
10526 :
10527 9933372 : if (this->m_MultiOrVarSpeedHeatCoil) {
10528 :
10529 1317603 : HeatSpeedNum = this->m_HeatingSpeedNum;
10530 :
10531 1317603 : if (HeatSpeedNum == 0) {
10532 256025 : state.dataUnitarySystems->CompOnMassFlow = this->MaxNoCoolHeatAirMassFlow;
10533 256025 : state.dataUnitarySystems->CompOnFlowRatio = this->m_NoLoadAirFlowRateRatio;
10534 1061578 : } else if (HeatSpeedNum == 1) {
10535 338442 : state.dataUnitarySystems->CompOnMassFlow = this->m_HeatMassFlowRate[1];
10536 338442 : state.dataUnitarySystems->CompOnFlowRatio = this->m_MSHeatingSpeedRatio[1];
10537 723136 : } else if (HeatSpeedNum > 1) {
10538 723136 : state.dataUnitarySystems->CompOnMassFlow = this->m_HeatMassFlowRate[HeatSpeedNum];
10539 723136 : state.dataUnitarySystems->CompOnFlowRatio = this->m_MSHeatingSpeedRatio[HeatSpeedNum];
10540 : }
10541 : // Set the compressor or coil OFF mass flow rate based on LOGICAL flag
10542 : // UseCompressorOnFlow is used when the user does not enter a value for no cooling or heating flow rate
10543 1317603 : if (this->m_FanOpMode == DataHVACGlobals::ContFanCycCoil) {
10544 541127 : if (state.dataUnitarySystems->MoistureLoad < 0.0 && this->m_Humidistat &&
10545 0 : this->m_DehumidControlType_Num == DehumCtrlType::CoolReheat) {
10546 0 : if (this->m_MultiOrVarSpeedCoolCoil) {
10547 0 : CoolSpeedNum = this->m_CoolingSpeedNum;
10548 0 : if (CoolSpeedNum < 1) {
10549 0 : state.dataUnitarySystems->CompOnMassFlow = this->MaxNoCoolHeatAirMassFlow;
10550 0 : state.dataUnitarySystems->CompOffMassFlow = this->MaxNoCoolHeatAirMassFlow;
10551 0 : state.dataUnitarySystems->CompOffFlowRatio = this->m_NoLoadAirFlowRateRatio;
10552 0 : } else if (CoolSpeedNum == 1) {
10553 0 : state.dataUnitarySystems->CompOnMassFlow = this->m_CoolMassFlowRate[1];
10554 0 : state.dataUnitarySystems->CompOffMassFlow = this->m_CoolMassFlowRate[1];
10555 0 : state.dataUnitarySystems->CompOffFlowRatio = this->m_MSCoolingSpeedRatio[1];
10556 0 : } else if (CoolSpeedNum > 1) {
10557 0 : state.dataUnitarySystems->CompOnMassFlow = this->m_CoolMassFlowRate[CoolSpeedNum];
10558 0 : state.dataUnitarySystems->CompOffMassFlow = this->m_CoolMassFlowRate[CoolSpeedNum - 1];
10559 0 : state.dataUnitarySystems->CompOffFlowRatio = this->m_MSCoolingSpeedRatio[CoolSpeedNum - 1];
10560 : }
10561 : } else {
10562 0 : state.dataUnitarySystems->CompOffMassFlow = this->MaxCoolAirMassFlow;
10563 0 : state.dataUnitarySystems->CompOffFlowRatio = this->m_CoolingFanSpeedRatio;
10564 : }
10565 0 : state.dataUnitarySystems->OACompOnMassFlow = this->m_CoolOutAirMassFlow;
10566 : } else {
10567 541127 : if (HeatSpeedNum == 0) {
10568 117303 : state.dataUnitarySystems->CompOffMassFlow = this->MaxNoCoolHeatAirMassFlow;
10569 117303 : state.dataUnitarySystems->CompOffFlowRatio = this->m_NoLoadAirFlowRateRatio;
10570 423824 : } else if (HeatSpeedNum == 1) {
10571 114578 : state.dataUnitarySystems->CompOffMassFlow = this->m_HeatMassFlowRate[HeatSpeedNum];
10572 114578 : state.dataUnitarySystems->CompOffFlowRatio = this->m_HeatMassFlowRate[HeatSpeedNum];
10573 : } else {
10574 309246 : state.dataUnitarySystems->CompOffMassFlow = this->m_HeatMassFlowRate[HeatSpeedNum - 1];
10575 309246 : state.dataUnitarySystems->CompOffFlowRatio = this->m_MSHeatingSpeedRatio[HeatSpeedNum - 1];
10576 : }
10577 541127 : state.dataUnitarySystems->OACompOnMassFlow = this->m_HeatOutAirMassFlow;
10578 : // only used for PTUnit to UnitarySystem conversion, should use all the time
10579 1055720 : if (this->m_sysType == SysType::PackagedAC || this->m_sysType == SysType::PackagedHP ||
10580 514593 : this->m_sysType == SysType::PackagedWSHP) {
10581 26534 : state.dataUnitarySystems->OACompOffMassFlow = this->m_HeatOutAirMassFlow;
10582 : }
10583 : }
10584 : } else { // cycling fan mode
10585 776476 : if (HeatSpeedNum <= 1) {
10586 362586 : state.dataUnitarySystems->CompOffMassFlow = 0.0; // #5518
10587 362586 : state.dataUnitarySystems->CompOffFlowRatio = 0.0;
10588 : } else {
10589 413890 : state.dataUnitarySystems->CompOffMassFlow = this->m_HeatMassFlowRate[HeatSpeedNum - 1];
10590 413890 : state.dataUnitarySystems->CompOffFlowRatio = this->m_MSHeatingSpeedRatio[HeatSpeedNum - 1];
10591 : }
10592 : // only used for PTUnit to UnitarySystem conversion, should use all the time
10593 1529972 : if (this->m_sysType == SysType::PackagedAC || this->m_sysType == SysType::PackagedHP ||
10594 753496 : this->m_sysType == SysType::PackagedWSHP) {
10595 49230 : state.dataUnitarySystems->OACompOnMassFlow = this->m_HeatOutAirMassFlow;
10596 : // does this assume OA flow <= min speed flow? wihtout this there are SolveRoot failures.
10597 49230 : if (HeatSpeedNum > 1) {
10598 25720 : state.dataUnitarySystems->OACompOffMassFlow = this->m_HeatOutAirMassFlow;
10599 : }
10600 : }
10601 : }
10602 : } else { // IF(MultiOrVarSpeedHeatCoil) THEN
10603 : // If a heating and moisture load exists, operate at the cooling mass flow rate ELSE operate at the heating flow rate
10604 17246042 : if (state.dataUnitarySystems->MoistureLoad < 0.0 && this->m_Humidistat &&
10605 8630273 : this->m_DehumidControlType_Num == DehumCtrlType::CoolReheat && !this->m_DXHeatingCoil) {
10606 7252 : if (this->m_MultiOrVarSpeedCoolCoil) {
10607 0 : CoolSpeedNum = this->m_CoolingSpeedNum;
10608 0 : if (CoolSpeedNum < 1) {
10609 0 : state.dataUnitarySystems->CompOnMassFlow = this->MaxNoCoolHeatAirMassFlow;
10610 0 : state.dataUnitarySystems->CompOnFlowRatio = this->m_NoLoadAirFlowRateRatio;
10611 0 : } else if (CoolSpeedNum == 1) {
10612 0 : state.dataUnitarySystems->CompOnMassFlow = this->m_CoolMassFlowRate[1];
10613 0 : state.dataUnitarySystems->CompOnFlowRatio = this->m_MSCoolingSpeedRatio[1];
10614 : } else {
10615 0 : state.dataUnitarySystems->CompOnMassFlow = this->m_CoolMassFlowRate[CoolSpeedNum];
10616 0 : state.dataUnitarySystems->CompOnFlowRatio = this->m_MSCoolingSpeedRatio[CoolSpeedNum];
10617 : }
10618 : } else { // IF (MultiOrVarSpeedCoolCoil) THEN
10619 7252 : state.dataUnitarySystems->CompOnMassFlow = this->MaxCoolAirMassFlow;
10620 7252 : state.dataUnitarySystems->CompOnFlowRatio = this->m_CoolingFanSpeedRatio;
10621 7252 : if (this->m_FanOpMode == DataHVACGlobals::ContFanCycCoil) {
10622 7252 : state.dataUnitarySystems->CompOffMassFlow = this->MaxNoCoolHeatAirMassFlow;
10623 7252 : state.dataUnitarySystems->CompOffFlowRatio = this->m_CoolingFanSpeedRatio;
10624 : }
10625 : }
10626 7252 : state.dataUnitarySystems->OACompOnMassFlow = this->m_CoolOutAirMassFlow;
10627 : } else { // Heating load but no moisture load
10628 11726061 : if (this->m_sysType == SysType::PackagedAC || this->m_sysType == SysType::PackagedHP ||
10629 3117544 : this->m_sysType == SysType::PackagedWSHP) {
10630 : // this was missing for heating mode where multi speed coils are used
10631 5555925 : if (this->m_MultiOrVarSpeedHeatCoil) {
10632 0 : if (HeatSpeedNum == 0) {
10633 0 : state.dataUnitarySystems->CompOnMassFlow = this->MaxNoCoolHeatAirMassFlow;
10634 0 : state.dataUnitarySystems->CompOnFlowRatio = this->m_NoLoadAirFlowRateRatio;
10635 0 : } else if (HeatSpeedNum == 1) {
10636 0 : state.dataUnitarySystems->CompOnMassFlow = this->m_HeatMassFlowRate[1];
10637 0 : state.dataUnitarySystems->CompOnFlowRatio = this->m_MSHeatingSpeedRatio[1];
10638 0 : } else if (HeatSpeedNum > 1) {
10639 0 : state.dataUnitarySystems->CompOnMassFlow = this->m_HeatMassFlowRate[HeatSpeedNum];
10640 0 : state.dataUnitarySystems->CompOnFlowRatio = this->m_MSHeatingSpeedRatio[HeatSpeedNum];
10641 : }
10642 : } else {
10643 5555925 : state.dataUnitarySystems->CompOnMassFlow = this->MaxHeatAirMassFlow;
10644 5555925 : state.dataUnitarySystems->CompOnFlowRatio = this->m_HeatingFanSpeedRatio;
10645 5555925 : state.dataUnitarySystems->OACompOnMassFlow = this->m_HeatOutAirMassFlow;
10646 : }
10647 11111850 : if (this->m_FanOpMode == DataHVACGlobals::ContFanCycCoil) {
10648 1611326 : state.dataUnitarySystems->CompOffMassFlow = this->MaxNoCoolHeatAirMassFlow;
10649 1611326 : state.dataUnitarySystems->CompOffFlowRatio = this->m_NoLoadAirFlowRateRatio;
10650 1611326 : state.dataUnitarySystems->OACompOffMassFlow = this->m_HeatOutAirMassFlow;
10651 : }
10652 : } else {
10653 3052592 : state.dataUnitarySystems->CompOnMassFlow = this->MaxHeatAirMassFlow;
10654 3052592 : state.dataUnitarySystems->CompOnFlowRatio = this->m_HeatingFanSpeedRatio;
10655 3052592 : state.dataUnitarySystems->OACompOnMassFlow = this->m_HeatOutAirMassFlow;
10656 3052592 : if (this->m_FanOpMode == DataHVACGlobals::ContFanCycCoil) {
10657 2623182 : if (this->m_AirFlowControl == UseCompFlow::On) {
10658 34134 : state.dataUnitarySystems->CompOffMassFlow = this->MaxHeatAirMassFlow;
10659 34134 : state.dataUnitarySystems->CompOffFlowRatio = this->m_HeatingFanSpeedRatio;
10660 34134 : state.dataUnitarySystems->OACompOffMassFlow = this->m_HeatOutAirMassFlow;
10661 : } else {
10662 2589048 : state.dataUnitarySystems->CompOffMassFlow = this->MaxNoCoolHeatAirMassFlow;
10663 2589048 : state.dataUnitarySystems->CompOffFlowRatio = this->m_HeatingFanSpeedRatio;
10664 2589048 : state.dataUnitarySystems->OACompOffMassFlow = this->m_NoCoolHeatOutAirMassFlow;
10665 : }
10666 : }
10667 : }
10668 : }
10669 : }
10670 :
10671 : // If a cooling load exists, operate at the cooling mass flow rate
10672 16042152 : } else if (state.dataUnitarySystems->CoolingLoad) {
10673 :
10674 15108889 : this->m_LastMode = CoolingMode;
10675 :
10676 15108889 : if (this->m_MultiOrVarSpeedCoolCoil) {
10677 :
10678 6563780 : CoolSpeedNum = this->m_CoolingSpeedNum;
10679 :
10680 6563780 : if (CoolSpeedNum == 0) {
10681 1549913 : state.dataUnitarySystems->CompOnMassFlow = this->MaxNoCoolHeatAirMassFlow;
10682 1549913 : state.dataUnitarySystems->CompOnFlowRatio = this->m_NoLoadAirFlowRateRatio;
10683 1549913 : state.dataUnitarySystems->OACompOnMassFlow = this->m_NoCoolHeatOutAirMassFlow;
10684 5013867 : } else if (CoolSpeedNum == 1) {
10685 2332843 : state.dataUnitarySystems->CompOnMassFlow = this->m_CoolMassFlowRate[1];
10686 2332843 : state.dataUnitarySystems->CompOnFlowRatio = this->m_MSCoolingSpeedRatio[1];
10687 2332843 : state.dataUnitarySystems->OACompOnMassFlow = this->m_CoolOutAirMassFlow;
10688 2681024 : } else if (CoolSpeedNum > 1) {
10689 2681024 : state.dataUnitarySystems->CompOnMassFlow = this->m_CoolMassFlowRate[CoolSpeedNum];
10690 2681024 : state.dataUnitarySystems->CompOnFlowRatio = this->m_MSCoolingSpeedRatio[CoolSpeedNum];
10691 2681024 : state.dataUnitarySystems->OACompOnMassFlow = this->m_CoolOutAirMassFlow;
10692 : }
10693 : // Set the compressor or coil OFF mass flow rate based on LOGICAL flag
10694 : // UseCompressorOnFlow is used when the user does not enter a value for no cooling or heating flow rate
10695 : // IF(UnitarySystem(UnitarySysNum)%FanOpMode == DataHVACGlobals::ContFanCycCoil)THEN
10696 : // IF (UnitarySystem(UnitarySysNum)%AirFlowControl .EQ. UseCompressorOnFlow) THEN
10697 6563780 : if (this->m_FanOpMode == DataHVACGlobals::ContFanCycCoil) {
10698 4854378 : if (CoolSpeedNum == 0) {
10699 1268224 : state.dataUnitarySystems->CompOffMassFlow = this->MaxNoCoolHeatAirMassFlow;
10700 1268224 : state.dataUnitarySystems->CompOffFlowRatio = this->m_NoLoadAirFlowRateRatio;
10701 1268224 : state.dataUnitarySystems->OACompOffMassFlow = this->m_NoCoolHeatOutAirMassFlow;
10702 3586154 : } else if (CoolSpeedNum == 1) {
10703 1510240 : state.dataUnitarySystems->CompOffMassFlow = this->m_CoolMassFlowRate[CoolSpeedNum];
10704 1510240 : state.dataUnitarySystems->CompOffFlowRatio = this->m_CoolMassFlowRate[CoolSpeedNum];
10705 1510240 : state.dataUnitarySystems->OACompOffMassFlow = this->m_CoolOutAirMassFlow;
10706 : } else {
10707 2075914 : state.dataUnitarySystems->CompOffMassFlow = this->m_CoolMassFlowRate[CoolSpeedNum - 1];
10708 2075914 : state.dataUnitarySystems->CompOffFlowRatio = this->m_MSCoolingSpeedRatio[CoolSpeedNum - 1];
10709 2075914 : state.dataUnitarySystems->OACompOffMassFlow = this->m_CoolOutAirMassFlow;
10710 : }
10711 : } else { // cycling fan mode
10712 1709402 : if (CoolSpeedNum <= 1) {
10713 1104292 : state.dataUnitarySystems->CompOffMassFlow = 0.0; // #5518
10714 1104292 : state.dataUnitarySystems->CompOffFlowRatio = 0.0;
10715 : } else {
10716 605110 : state.dataUnitarySystems->CompOffMassFlow = this->m_CoolMassFlowRate[CoolSpeedNum - 1];
10717 605110 : state.dataUnitarySystems->CompOffFlowRatio = this->m_MSCoolingSpeedRatio[CoolSpeedNum - 1];
10718 605110 : state.dataUnitarySystems->OACompOffMassFlow = this->m_CoolOutAirMassFlow;
10719 : }
10720 : }
10721 : } else { // IF(MultiOrVarSpeedCoolCoil(UnitarySysNum)) THEN
10722 8545109 : state.dataUnitarySystems->CompOnMassFlow = this->MaxCoolAirMassFlow;
10723 8545109 : state.dataUnitarySystems->CompOnFlowRatio = this->m_CoolingFanSpeedRatio;
10724 8545109 : state.dataUnitarySystems->OACompOnMassFlow = this->m_CoolOutAirMassFlow;
10725 8545109 : if (this->m_FanOpMode == DataHVACGlobals::ContFanCycCoil) {
10726 2791051 : if (this->m_AirFlowControl == UseCompFlow::On) {
10727 620538 : state.dataUnitarySystems->CompOffMassFlow = this->MaxCoolAirMassFlow;
10728 620538 : state.dataUnitarySystems->CompOffFlowRatio = this->m_CoolingFanSpeedRatio;
10729 620538 : state.dataUnitarySystems->OACompOffMassFlow = this->m_CoolOutAirMassFlow;
10730 : } else {
10731 2170513 : state.dataUnitarySystems->CompOffMassFlow = this->MaxNoCoolHeatAirMassFlow;
10732 2170513 : state.dataUnitarySystems->CompOffFlowRatio = this->m_CoolingFanSpeedRatio;
10733 2170513 : state.dataUnitarySystems->OACompOffMassFlow = this->m_NoCoolHeatOutAirMassFlow;
10734 : }
10735 : }
10736 : }
10737 :
10738 : } else { // No load
10739 : // If no load exists, set the compressor on mass flow rate.
10740 : // Set equal the mass flow rate when no heating or cooling is needed If no moisture load exists.
10741 : // If the user has set the off mass flow rate to 0, set according to the last operating mode.
10742 :
10743 933263 : if (state.dataUnitarySystems->MoistureLoad < 0.0 && this->m_Humidistat && this->m_DehumidControlType_Num == DehumCtrlType::CoolReheat) {
10744 43716 : if (this->m_MultiOrVarSpeedCoolCoil) {
10745 43128 : CoolSpeedNum = this->m_CoolingSpeedNum;
10746 43128 : if (CoolSpeedNum < 1) {
10747 43128 : state.dataUnitarySystems->CompOnMassFlow = this->MaxNoCoolHeatAirMassFlow;
10748 43128 : state.dataUnitarySystems->CompOnFlowRatio = this->m_NoLoadAirFlowRateRatio;
10749 43128 : state.dataUnitarySystems->OACompOnMassFlow = this->m_NoCoolHeatOutAirMassFlow;
10750 0 : } else if (CoolSpeedNum == 1) {
10751 0 : state.dataUnitarySystems->CompOnMassFlow = this->m_CoolMassFlowRate[1];
10752 0 : state.dataUnitarySystems->CompOnFlowRatio = this->m_MSCoolingSpeedRatio[1];
10753 0 : state.dataUnitarySystems->OACompOnMassFlow = this->m_CoolOutAirMassFlow;
10754 : } else {
10755 0 : state.dataUnitarySystems->CompOnMassFlow = this->m_CoolMassFlowRate[CoolSpeedNum];
10756 0 : state.dataUnitarySystems->CompOnFlowRatio = this->m_MSCoolingSpeedRatio[CoolSpeedNum];
10757 0 : state.dataUnitarySystems->OACompOnMassFlow = this->m_CoolOutAirMassFlow;
10758 : }
10759 :
10760 43128 : if (this->m_FanOpMode == DataHVACGlobals::ContFanCycCoil) {
10761 43128 : if (this->m_AirFlowControl == UseCompFlow::On) {
10762 0 : if (CoolSpeedNum <= 1) {
10763 0 : state.dataUnitarySystems->CompOffMassFlow = this->MaxNoCoolHeatAirMassFlow;
10764 0 : state.dataUnitarySystems->CompOffFlowRatio = this->m_NoLoadAirFlowRateRatio;
10765 0 : state.dataUnitarySystems->OACompOffMassFlow = this->m_NoCoolHeatOutAirMassFlow;
10766 : } else {
10767 0 : state.dataUnitarySystems->CompOffMassFlow = this->m_CoolMassFlowRate[CoolSpeedNum - 1];
10768 0 : state.dataUnitarySystems->CompOffFlowRatio = this->m_MSCoolingSpeedRatio[CoolSpeedNum - 1];
10769 0 : state.dataUnitarySystems->OACompOffMassFlow = this->m_CoolOutAirMassFlow;
10770 : }
10771 : } else {
10772 43128 : state.dataUnitarySystems->CompOffMassFlow = this->MaxNoCoolHeatAirMassFlow;
10773 43128 : state.dataUnitarySystems->CompOffFlowRatio = this->m_NoLoadAirFlowRateRatio;
10774 43128 : state.dataUnitarySystems->OACompOffMassFlow = this->m_CoolOutAirMassFlow;
10775 : }
10776 : }
10777 :
10778 : } else { // IF (MultiOrVarSpeedCoolCoil(UnitarySysNum)) THEN
10779 588 : state.dataUnitarySystems->CompOnMassFlow = this->MaxCoolAirMassFlow;
10780 588 : state.dataUnitarySystems->CompOnFlowRatio = this->m_CoolingFanSpeedRatio;
10781 588 : state.dataUnitarySystems->OACompOnMassFlow = this->m_CoolOutAirMassFlow;
10782 588 : if (this->m_FanOpMode == DataHVACGlobals::ContFanCycCoil) {
10783 588 : if (this->m_AirFlowControl == UseCompFlow::On) {
10784 0 : state.dataUnitarySystems->CompOffMassFlow = this->MaxCoolAirMassFlow;
10785 0 : state.dataUnitarySystems->CompOffFlowRatio = this->m_CoolingFanSpeedRatio;
10786 0 : state.dataUnitarySystems->OACompOffMassFlow = this->m_CoolOutAirMassFlow;
10787 : } else {
10788 588 : state.dataUnitarySystems->CompOffMassFlow = this->MaxNoCoolHeatAirMassFlow;
10789 588 : state.dataUnitarySystems->CompOffFlowRatio = this->m_CoolingFanSpeedRatio;
10790 588 : state.dataUnitarySystems->OACompOffMassFlow = this->m_NoCoolHeatOutAirMassFlow;
10791 : }
10792 : }
10793 : }
10794 :
10795 : } else { // No Moisture Load
10796 :
10797 889547 : if (this->m_LastMode == HeatingMode) {
10798 : // this needs to be corrected to include UseCompressorOnFlow
10799 203764 : if (this->m_MultiOrVarSpeedHeatCoil) {
10800 12044 : state.dataUnitarySystems->CompOnMassFlow = this->MaxNoCoolHeatAirMassFlow;
10801 12044 : state.dataUnitarySystems->CompOnFlowRatio = this->m_NoLoadAirFlowRateRatio;
10802 : } else {
10803 191720 : state.dataUnitarySystems->CompOnMassFlow = this->MaxNoCoolHeatAirMassFlow;
10804 191720 : state.dataUnitarySystems->CompOnFlowRatio = 1.0;
10805 : }
10806 : // this needs to happen regardless of system except maybe the CoilSystem objects
10807 : // do this only for PTUnit for the time being to reduce diffs for the PTUnit to UnitarySystem conversion
10808 370426 : if (this->m_sysType == SysType::PackagedAC || this->m_sysType == SysType::PackagedHP ||
10809 166662 : this->m_sysType == SysType::PackagedWSHP) {
10810 42555 : if (this->m_FanOpMode == DataHVACGlobals::ContFanCycCoil) {
10811 27108 : if (this->m_AirFlowControl == UseCompFlow::On) {
10812 5804 : state.dataUnitarySystems->CompOffMassFlow = this->MaxNoCoolHeatAirMassFlow;
10813 5804 : state.dataUnitarySystems->CompOffFlowRatio = this->m_HeatingFanSpeedRatio;
10814 5804 : state.dataUnitarySystems->OACompOffMassFlow = this->m_HeatOutAirMassFlow;
10815 : }
10816 : }
10817 : }
10818 : } else {
10819 : // this needs to be corrected to include UseCompressorOnFlow
10820 685783 : if (this->m_MultiOrVarSpeedCoolCoil) {
10821 548196 : state.dataUnitarySystems->CompOnMassFlow = this->MaxNoCoolHeatAirMassFlow;
10822 548196 : state.dataUnitarySystems->CompOnFlowRatio = this->m_NoLoadAirFlowRateRatio;
10823 : } else {
10824 137587 : state.dataUnitarySystems->CompOnMassFlow = this->MaxNoCoolHeatAirMassFlow;
10825 137587 : state.dataUnitarySystems->CompOnFlowRatio = 1.0;
10826 : }
10827 : }
10828 889547 : state.dataUnitarySystems->OACompOnMassFlow = this->m_NoCoolHeatOutAirMassFlow;
10829 889547 : if (state.dataUnitarySystems->CompOnMassFlow == 0.0) {
10830 66453 : if (this->m_LastMode == HeatingMode) {
10831 21037 : if (this->m_MultiOrVarSpeedHeatCoil) {
10832 2918 : HeatSpeedNum = this->m_HeatingSpeedNum;
10833 2918 : if (HeatSpeedNum == 0) {
10834 2908 : state.dataUnitarySystems->CompOnMassFlow = this->MaxNoCoolHeatAirMassFlow;
10835 2908 : state.dataUnitarySystems->CompOnFlowRatio = this->m_NoLoadAirFlowRateRatio;
10836 10 : } else if (HeatSpeedNum == 1) {
10837 10 : state.dataUnitarySystems->CompOnMassFlow = this->m_HeatMassFlowRate[1];
10838 10 : state.dataUnitarySystems->CompOnFlowRatio = this->m_MSHeatingSpeedRatio[1];
10839 0 : } else if (HeatSpeedNum > 1) {
10840 0 : state.dataUnitarySystems->CompOnMassFlow = this->m_HeatMassFlowRate[HeatSpeedNum];
10841 0 : state.dataUnitarySystems->CompOnFlowRatio = this->m_MSHeatingSpeedRatio[HeatSpeedNum];
10842 : }
10843 : } else { // IF(MultiOrVarSpeedHeatCoil) THEN
10844 18119 : state.dataUnitarySystems->CompOnMassFlow = this->MaxHeatAirMassFlow;
10845 18119 : state.dataUnitarySystems->CompOnFlowRatio = this->m_HeatingFanSpeedRatio;
10846 : }
10847 : } else { // IF(UnitarySystem(UnitarySysNum)%LastMode .EQ. HeatingMode)THEN
10848 45416 : if (this->m_MultiOrVarSpeedCoolCoil) {
10849 7270 : CoolSpeedNum = this->m_CoolingSpeedNum;
10850 7270 : if (CoolSpeedNum == 0) {
10851 7270 : state.dataUnitarySystems->CompOnMassFlow = this->MaxNoCoolHeatAirMassFlow;
10852 7270 : state.dataUnitarySystems->CompOnFlowRatio = this->m_NoLoadAirFlowRateRatio;
10853 0 : } else if (CoolSpeedNum == 1) {
10854 0 : state.dataUnitarySystems->CompOnMassFlow = this->m_CoolMassFlowRate[1];
10855 0 : state.dataUnitarySystems->CompOnFlowRatio = this->m_MSCoolingSpeedRatio[1];
10856 0 : } else if (CoolSpeedNum > 1) {
10857 0 : state.dataUnitarySystems->CompOnMassFlow = this->m_CoolMassFlowRate[CoolSpeedNum];
10858 0 : state.dataUnitarySystems->CompOnFlowRatio = this->m_MSCoolingSpeedRatio[CoolSpeedNum];
10859 : }
10860 : } else { // IF(MultiOrVarSpeedCoolCoil) THEN
10861 38146 : state.dataUnitarySystems->CompOnMassFlow = this->MaxCoolAirMassFlow;
10862 38146 : state.dataUnitarySystems->CompOnFlowRatio = this->m_CoolingFanSpeedRatio;
10863 : } // IF(MultiOrVarSpeedCoolCoil) THEN
10864 : } // IF(UnitarySystem(UnitarySysNum)%LastMode .EQ. HeatingMode)THEN
10865 : } // IF(CompOnMassFlow .EQ. 0.0d0)THEN
10866 :
10867 889547 : if (this->m_FanOpMode == DataHVACGlobals::ContFanCycCoil) {
10868 591491 : if (this->m_AirFlowControl == UseCompFlow::On) {
10869 32746 : if (this->m_LastMode == HeatingMode) {
10870 8910 : if (this->m_MultiOrVarSpeedHeatCoil) {
10871 1710 : HeatSpeedNum = this->m_HeatingSpeedNum;
10872 1710 : if (HeatSpeedNum < 1) {
10873 1710 : state.dataUnitarySystems->CompOffMassFlow = this->MaxNoCoolHeatAirMassFlow;
10874 1710 : state.dataUnitarySystems->CompOffFlowRatio = this->m_NoLoadAirFlowRateRatio;
10875 1710 : state.dataUnitarySystems->OACompOffMassFlow = this->m_NoCoolHeatOutAirMassFlow;
10876 0 : } else if (HeatSpeedNum == 1) {
10877 0 : state.dataUnitarySystems->CompOffMassFlow = this->m_HeatMassFlowRate[1];
10878 0 : state.dataUnitarySystems->CompOffFlowRatio = this->m_MSHeatingSpeedRatio[1];
10879 0 : state.dataUnitarySystems->OACompOffMassFlow = this->m_HeatOutAirMassFlow;
10880 : } else {
10881 0 : state.dataUnitarySystems->CompOffMassFlow = this->m_HeatMassFlowRate[HeatSpeedNum - 1];
10882 0 : state.dataUnitarySystems->CompOffFlowRatio = this->m_MSHeatingSpeedRatio[HeatSpeedNum - 1];
10883 0 : state.dataUnitarySystems->OACompOffMassFlow = this->m_HeatOutAirMassFlow;
10884 : }
10885 : } else {
10886 : // this is a no load case, added if for PTUnit to correct this for PTUnit to UnitarySystem conversion
10887 : // the else is incorrect?
10888 8794 : if (this->m_sysType == SysType::PackagedAC || this->m_sysType == SysType::PackagedHP ||
10889 1594 : this->m_sysType == SysType::PackagedWSHP) {
10890 11212 : if (this->m_FanOpMode == DataHVACGlobals::ContFanCycCoil) {
10891 5606 : if (this->m_AirFlowControl == UseCompFlow::On) {
10892 5606 : state.dataUnitarySystems->CompOffMassFlow = this->MaxNoCoolHeatAirMassFlow;
10893 5606 : state.dataUnitarySystems->CompOffFlowRatio = this->m_HeatingFanSpeedRatio;
10894 5606 : state.dataUnitarySystems->OACompOffMassFlow = this->m_HeatOutAirMassFlow;
10895 : }
10896 : }
10897 : } else {
10898 1594 : state.dataUnitarySystems->CompOffMassFlow = this->MaxHeatAirMassFlow;
10899 1594 : state.dataUnitarySystems->CompOffFlowRatio = this->m_HeatingFanSpeedRatio;
10900 1594 : state.dataUnitarySystems->OACompOffMassFlow = this->m_HeatOutAirMassFlow;
10901 : }
10902 : }
10903 : } else { // IF(UnitarySystem(UnitarySysNum)%LastMode .EQ. HeatingMode)THEN
10904 23836 : if (this->m_MultiOrVarSpeedCoolCoil) {
10905 5926 : CoolSpeedNum = this->m_CoolingSpeedNum;
10906 5926 : if (CoolSpeedNum < 1) {
10907 5906 : state.dataUnitarySystems->CompOffMassFlow = this->MaxNoCoolHeatAirMassFlow;
10908 5906 : state.dataUnitarySystems->CompOffFlowRatio = this->m_NoLoadAirFlowRateRatio;
10909 5906 : state.dataUnitarySystems->OACompOffMassFlow = this->m_NoCoolHeatOutAirMassFlow;
10910 20 : } else if (CoolSpeedNum == 1) {
10911 20 : state.dataUnitarySystems->CompOffMassFlow = this->m_CoolMassFlowRate[1];
10912 20 : state.dataUnitarySystems->CompOffFlowRatio = this->m_MSCoolingSpeedRatio[1];
10913 20 : state.dataUnitarySystems->OACompOffMassFlow = this->m_CoolOutAirMassFlow;
10914 : } else {
10915 0 : state.dataUnitarySystems->CompOffMassFlow = this->m_CoolMassFlowRate[CoolSpeedNum - 1];
10916 0 : state.dataUnitarySystems->CompOffFlowRatio = this->m_MSCoolingSpeedRatio[CoolSpeedNum - 1];
10917 0 : state.dataUnitarySystems->OACompOffMassFlow = this->m_CoolOutAirMassFlow;
10918 : }
10919 : } else {
10920 17910 : state.dataUnitarySystems->CompOffMassFlow = this->MaxCoolAirMassFlow;
10921 17910 : state.dataUnitarySystems->CompOffFlowRatio = this->m_CoolingFanSpeedRatio;
10922 17910 : state.dataUnitarySystems->OACompOffMassFlow = this->m_CoolOutAirMassFlow;
10923 : }
10924 : } // IF(UnitarySystem(UnitarySysNum)%LastMode .EQ. HeatingMode)THEN
10925 : } else { // IF (UnitarySystem(UnitarySysNum)%AirFlowControl .EQ. UseCompressorOnFlow) THEN
10926 558745 : if (this->m_LastMode == HeatingMode) {
10927 108833 : if (this->m_MultiOrVarSpeedHeatCoil) {
10928 6148 : state.dataUnitarySystems->CompOffMassFlow = this->MaxNoCoolHeatAirMassFlow;
10929 6148 : state.dataUnitarySystems->CompOffFlowRatio = this->m_NoLoadAirFlowRateRatio;
10930 : } else {
10931 102685 : state.dataUnitarySystems->CompOffMassFlow = this->MaxNoCoolHeatAirMassFlow;
10932 102685 : state.dataUnitarySystems->CompOffFlowRatio = this->m_HeatingFanSpeedRatio;
10933 : }
10934 : } else {
10935 449912 : if (this->m_MultiOrVarSpeedCoolCoil) {
10936 382342 : state.dataUnitarySystems->CompOffMassFlow = this->MaxNoCoolHeatAirMassFlow;
10937 382342 : state.dataUnitarySystems->CompOffFlowRatio = this->m_NoLoadAirFlowRateRatio;
10938 : } else {
10939 67570 : state.dataUnitarySystems->CompOffMassFlow = this->MaxNoCoolHeatAirMassFlow;
10940 67570 : state.dataUnitarySystems->CompOffFlowRatio = this->m_CoolingFanSpeedRatio;
10941 : }
10942 : }
10943 558745 : state.dataUnitarySystems->OACompOffMassFlow = this->m_NoCoolHeatOutAirMassFlow;
10944 : } // IF (UnitarySystem(UnitarySysNum)%AirFlowControl .EQ. UseCompressorOnFlow) THEN
10945 : } // IF(UnitarySystem(UnitarySysNum)%FanOpMode == DataHVACGlobals::ContFanCycCoil)THEN
10946 : } // ELSE ! No Moisture Load
10947 : } // No Heating/Cooling Load
10948 :
10949 25975524 : if (this->m_FanOpMode == DataHVACGlobals::ContFanCycCoil) {
10950 14248276 : if (this->m_AirFlowControl == UseCompFlow::On &&
10951 1955909 : (this->m_sysType == SysType::PackagedAC || this->m_sysType == SysType::PackagedHP || this->m_sysType == SysType::PackagedWSHP)) {
10952 872015 : if (this->m_LastMode == HeatingMode) {
10953 286061 : state.dataUnitarySystems->OACompOffMassFlow = this->m_HeatOutAirMassFlow;
10954 : } else {
10955 585954 : state.dataUnitarySystems->OACompOffMassFlow = this->m_CoolOutAirMassFlow;
10956 : }
10957 : }
10958 : }
10959 :
10960 25975524 : if (this->m_MultiSpeedHeatingCoil && (state.dataUnitarySystems->HeatingLoad && HeatSpeedNum == 1)) {
10961 267171 : state.dataHVACGlobal->MSHPMassFlowRateLow = state.dataUnitarySystems->CompOnMassFlow;
10962 25708353 : } else if (this->m_DiscreteSpeedCoolingCoil && (state.dataUnitarySystems->CoolingLoad && CoolSpeedNum == 1)) {
10963 2223390 : state.dataHVACGlobal->MSHPMassFlowRateLow = state.dataUnitarySystems->CompOnMassFlow;
10964 : } else {
10965 23484963 : state.dataHVACGlobal->MSHPMassFlowRateLow = state.dataUnitarySystems->CompOffMassFlow; // these need to be set for multi-speed coils
10966 : }
10967 25975524 : state.dataHVACGlobal->MSHPMassFlowRateHigh =
10968 25975524 : state.dataUnitarySystems->CompOnMassFlow; // doesn't hurt to set these if multi-speed coils are not used
10969 :
10970 25975524 : state.dataUnitarySystems->m_massFlow1 = state.dataUnitarySystems->CompOnMassFlow;
10971 25975524 : state.dataUnitarySystems->m_massFlow2 = state.dataUnitarySystems->CompOffMassFlow;
10972 :
10973 : // Set the system mass flow rates
10974 25975524 : this->setAverageAirFlow(state, PartLoadRatio, OnOffAirFlowRatio);
10975 25975524 : }
10976 :
10977 34461894 : void UnitarySys::setAverageAirFlow(EnergyPlusData &state,
10978 : Real64 const PartLoadRatio, // unit part load ratio
10979 : Real64 &OnOffAirFlowRatio // ratio of compressor ON airflow to AVERAGE airflow over timestep
10980 : )
10981 : {
10982 :
10983 : // SUBROUTINE INFORMATION:
10984 : // AUTHOR Richard Raustad
10985 : // DATE WRITTEN July 2005
10986 :
10987 : // PURPOSE OF THIS SUBROUTINE:
10988 : // Set the average air mass flow rates using the part-load fraction of the HVAC system for this time step
10989 : // Set OnOffAirFlowRatio to be used by DX coils
10990 :
10991 : // METHODOLOGY EMPLOYED:
10992 : // The air flow rate in cooling, heating, and no cooling or heating can be dIFferent.
10993 : // Calculate the air flow rate based on initializations.
10994 :
10995 34461894 : Real64 AverageUnitMassFlow = 0.0; // average supply air mass flow rate over time step
10996 34461894 : bool FanOn = false;
10997 :
10998 34461894 : state.dataUnitarySystems->m_runTimeFraction1 = 0.0;
10999 34461894 : state.dataUnitarySystems->m_runTimeFraction2 = 0.0;
11000 :
11001 34461894 : Real64 FanPartLoadRatio = PartLoadRatio;
11002 34461894 : if (this->m_SimASHRAEModel) FanPartLoadRatio = this->FanPartLoadRatio;
11003 34461894 : int SpeedNum = max(this->m_CoolingSpeedNum, this->m_HeatingSpeedNum);
11004 34461894 : int InletNode = this->AirInNode;
11005 :
11006 34461894 : if (SpeedNum > 1) {
11007 9442163 : if ((state.dataUnitarySystems->CoolingLoad && this->m_MultiOrVarSpeedCoolCoil) ||
11008 1671698 : (state.dataUnitarySystems->HeatingLoad && this->m_MultiOrVarSpeedHeatCoil)) {
11009 8585320 : AverageUnitMassFlow = FanPartLoadRatio * state.dataUnitarySystems->CompOnMassFlow +
11010 4292660 : (1.0 - FanPartLoadRatio) * state.dataUnitarySystems->CompOffMassFlow;
11011 : } else {
11012 13996 : AverageUnitMassFlow = state.dataUnitarySystems->CompOnMassFlow;
11013 : }
11014 : } else {
11015 60310476 : AverageUnitMassFlow = (FanPartLoadRatio * state.dataUnitarySystems->CompOnMassFlow) +
11016 30155238 : ((1.0 - FanPartLoadRatio) * state.dataUnitarySystems->CompOffMassFlow);
11017 : }
11018 :
11019 34461894 : if (state.dataUnitarySystems->CompOffFlowRatio > 0.0) {
11020 17912900 : if (SpeedNum > 1) {
11021 9428121 : if ((state.dataUnitarySystems->CoolingLoad && this->m_MultiOrVarSpeedCoolCoil) ||
11022 1664742 : (state.dataUnitarySystems->HeatingLoad && this->m_MultiOrVarSpeedHeatCoil)) {
11023 8585190 : state.dataUnitarySystems->FanSpeedRatio = FanPartLoadRatio * state.dataUnitarySystems->CompOnFlowRatio +
11024 4292595 : (1.0 - FanPartLoadRatio) * state.dataUnitarySystems->CompOffFlowRatio;
11025 4292595 : state.dataUnitarySystems->m_runTimeFraction1 = FanPartLoadRatio;
11026 4292595 : state.dataUnitarySystems->m_runTimeFraction2 = 1.0 - FanPartLoadRatio;
11027 : } else {
11028 7040 : state.dataUnitarySystems->FanSpeedRatio = state.dataUnitarySystems->CompOnFlowRatio;
11029 7040 : state.dataUnitarySystems->m_runTimeFraction1 = FanPartLoadRatio;
11030 7040 : state.dataUnitarySystems->m_runTimeFraction2 = 0.0;
11031 : }
11032 : } else {
11033 27226530 : state.dataUnitarySystems->FanSpeedRatio = (FanPartLoadRatio * state.dataUnitarySystems->CompOnFlowRatio) +
11034 13613265 : ((1.0 - FanPartLoadRatio) * state.dataUnitarySystems->CompOffFlowRatio);
11035 13613265 : state.dataUnitarySystems->m_runTimeFraction1 = FanPartLoadRatio;
11036 13613265 : state.dataUnitarySystems->m_runTimeFraction2 = 1.0 - FanPartLoadRatio;
11037 : }
11038 : } else {
11039 16548994 : state.dataUnitarySystems->FanSpeedRatio = state.dataUnitarySystems->CompOnFlowRatio;
11040 16548994 : state.dataUnitarySystems->m_runTimeFraction1 = FanPartLoadRatio;
11041 16548994 : state.dataUnitarySystems->m_runTimeFraction2 = 0.0;
11042 : }
11043 :
11044 34461894 : if (!(state.dataUnitarySystems->HeatingLoad && this->m_NumOfSpeedHeating == 0)) {
11045 22252806 : if (this->m_SingleMode == 1) {
11046 76113 : if (this->m_FanOpMode == DataHVACGlobals::ContFanCycCoil) {
11047 0 : AverageUnitMassFlow = state.dataUnitarySystems->CompOnMassFlow;
11048 0 : state.dataUnitarySystems->FanSpeedRatio = state.dataUnitarySystems->CompOnFlowRatio;
11049 0 : state.dataUnitarySystems->m_runTimeFraction1 = 1.0;
11050 0 : state.dataUnitarySystems->m_runTimeFraction2 = 0.0;
11051 : } else {
11052 76113 : AverageUnitMassFlow = FanPartLoadRatio * state.dataUnitarySystems->CompOnMassFlow;
11053 76113 : state.dataUnitarySystems->FanSpeedRatio = FanPartLoadRatio * state.dataUnitarySystems->CompOnFlowRatio;
11054 76113 : state.dataUnitarySystems->m_runTimeFraction1 = FanPartLoadRatio;
11055 76113 : state.dataUnitarySystems->m_runTimeFraction2 = 0.0;
11056 : }
11057 : }
11058 : }
11059 :
11060 34461894 : if (this->OAMixerExists) {
11061 16528733 : Real64 AverageOAMassFlow = (FanPartLoadRatio * state.dataUnitarySystems->OACompOnMassFlow) +
11062 16528733 : ((1 - FanPartLoadRatio) * state.dataUnitarySystems->OACompOffMassFlow);
11063 :
11064 16528733 : state.dataLoopNodes->Node(this->m_OAMixerNodes[0]).MassFlowRate = AverageOAMassFlow;
11065 16528733 : state.dataLoopNodes->Node(this->m_OAMixerNodes[0]).MassFlowRateMaxAvail = AverageOAMassFlow;
11066 : // don't need to set relief node, delete them when working
11067 16528733 : state.dataLoopNodes->Node(this->m_OAMixerNodes[1]).MassFlowRate = AverageOAMassFlow;
11068 16528733 : state.dataLoopNodes->Node(this->m_OAMixerNodes[1]).MassFlowRateMaxAvail = AverageOAMassFlow;
11069 : }
11070 :
11071 : // BEGIN - refactor/move this to Init during FirstHVACIteration, need struct or module level global for turnFansOn and turnFansOff
11072 : // If the unitary system is scheduled on or nightime cycle overrides fan schedule. Uses same logic as fan.
11073 34461894 : if (this->m_FanExists) {
11074 34461894 : FanOn = false;
11075 34461894 : if (ScheduleManager::GetCurrentScheduleValue(state, this->m_FanAvailSchedPtr) > 0) FanOn = true;
11076 : } else {
11077 0 : FanOn = true;
11078 : }
11079 : // combine above and below into 1 logical
11080 34461894 : bool turnFansOn = false;
11081 34461894 : bool turnFansOff = false;
11082 34461894 : if (this->m_IsZoneEquipment) {
11083 18410574 : turnFansOn = state.dataHVACGlobal->ZoneCompTurnFansOn;
11084 18410574 : turnFansOff = state.dataHVACGlobal->ZoneCompTurnFansOff;
11085 : } else {
11086 16051320 : turnFansOn = state.dataHVACGlobal->TurnFansOn;
11087 16051320 : turnFansOff = state.dataHVACGlobal->TurnFansOff;
11088 : }
11089 : // END - move this to Init during FirstHVACIteration
11090 :
11091 34461894 : if (ScheduleManager::GetCurrentScheduleValue(state, this->m_SysAvailSchedPtr) > 0.0 && ((FanOn || turnFansOn) && !turnFansOff)) {
11092 34204954 : if (this->m_ControlType == UnitarySysCtrlType::Setpoint) {
11093 : // set point based equipment should use VAV terminal units to set the flow.
11094 : // zone equipment needs to set flow since no other device regulates flow (ZoneHVAC /= AirLoopEquipment)
11095 22478 : if (!this->m_AirLoopEquipment) {
11096 0 : state.dataLoopNodes->Node(InletNode).MassFlowRate = AverageUnitMassFlow;
11097 0 : state.dataLoopNodes->Node(InletNode).MassFlowRateMaxAvail =
11098 : AverageUnitMassFlow; // #5531 zone equipment needs MaxAvail set or fan will not turn ON
11099 : }
11100 22478 : if (AverageUnitMassFlow > 0.0) {
11101 22478 : OnOffAirFlowRatio = 1.0;
11102 : } else {
11103 0 : OnOffAirFlowRatio = 0.0;
11104 : }
11105 : } else {
11106 34182476 : state.dataLoopNodes->Node(InletNode).MassFlowRate = AverageUnitMassFlow;
11107 34182476 : if (!this->m_AirLoopEquipment) {
11108 17978886 : state.dataLoopNodes->Node(InletNode).MassFlowRateMaxAvail =
11109 : AverageUnitMassFlow; // #5531 zone equipment needs MaxAvail set or fan will not turn ON
11110 : }
11111 34182476 : if (AverageUnitMassFlow > 0.0) {
11112 28103739 : if (SpeedNum > 1) {
11113 4251072 : OnOffAirFlowRatio = 1.0;
11114 : } else {
11115 23852667 : OnOffAirFlowRatio = state.dataUnitarySystems->CompOnMassFlow / AverageUnitMassFlow;
11116 : }
11117 : } else {
11118 6078737 : OnOffAirFlowRatio = 0.0;
11119 : }
11120 : }
11121 : } else {
11122 256940 : state.dataLoopNodes->Node(InletNode).MassFlowRate = 0.0;
11123 : // fan will turn on unless these are reset, or maybe one of them. Might be a better way when calling fan.
11124 256940 : state.dataUnitarySystems->m_massFlow1 = 0.0;
11125 256940 : state.dataUnitarySystems->m_massFlow2 = 0.0;
11126 256940 : OnOffAirFlowRatio = 1.0;
11127 256940 : if (this->OAMixerExists) {
11128 : // maybe can just set MaxAvail = 0?
11129 5640 : state.dataLoopNodes->Node(this->m_OAMixerNodes[0]).MassFlowRate = 0.0;
11130 5640 : state.dataLoopNodes->Node(this->m_OAMixerNodes[0]).MassFlowRateMaxAvail = 0.0;
11131 : // don't need to set relief node, delete then when working
11132 5640 : state.dataLoopNodes->Node(this->m_OAMixerNodes[1]).MassFlowRate = 0.0;
11133 5640 : state.dataLoopNodes->Node(this->m_OAMixerNodes[1]).MassFlowRateMaxAvail = 0.0;
11134 : }
11135 : }
11136 34461894 : }
11137 :
11138 20222676 : void UnitarySys::calcUnitarySystemToLoad(EnergyPlusData &state,
11139 : int const AirLoopNum, // index to air loop
11140 : bool const FirstHVACIteration, // True when first HVAC iteration
11141 : Real64 const CoolPLR, // operating cooling part-load ratio []
11142 : Real64 const HeatPLR, // operating cooling part-load ratio []
11143 : Real64 &OnOffAirFlowRatio, // ratio of heating PLR to cooling PLR (is this correct?)
11144 : Real64 &SensOutput, // sensible capacity (W)
11145 : Real64 &LatOutput, // latent capacity (W)
11146 : bool HXUnitOn, // Flag to control HX for HXAssisted Cooling Coil
11147 : Real64 HeatCoilLoad, // Adjusted load to heating coil when SAT exceeds max limit (W)
11148 : Real64 SuppCoilLoad, // Adjusted load to supp heating coil when SAT exceeds max limit (W)
11149 : DataHVACGlobals::CompressorOperation const CompressorOn // Determines if compressor is on or off
11150 : )
11151 : {
11152 :
11153 : // SUBROUTINE INFORMATION:
11154 : // AUTHOR Richard Raustad, FSEC
11155 : // DATE WRITTEN February 2013
11156 :
11157 : // PURPOSE OF THIS SUBROUTINE:
11158 : // This subroutine calculates the resulting performance of the unitary system given
11159 : // the operating PLR. System output is calculated with respect to zone condition.
11160 :
11161 20222676 : Real64 CoilCoolHeatRat = 1.0; // ratio of cooling to heating PLR for cycling fan RH control
11162 :
11163 20222676 : DataHVACGlobals::CompressorOperation CoolingCompOn = DataHVACGlobals::CompressorOperation::Off;
11164 20222676 : if (CoolPLR > 0) {
11165 7905402 : CoolingCompOn = CompressorOn;
11166 : // for multispeed coils, comp is on IF speed > 1
11167 12317274 : } else if (this->m_CoolingSpeedNum > 1) {
11168 232404 : CoolingCompOn = DataHVACGlobals::CompressorOperation::On;
11169 : }
11170 :
11171 20222676 : DataHVACGlobals::CompressorOperation HeatingCompOn = DataHVACGlobals::CompressorOperation::Off;
11172 20222676 : if (HeatPLR > 0) {
11173 5562179 : HeatingCompOn = CompressorOn;
11174 5562179 : CoilCoolHeatRat = min(1.0, CoolPLR / HeatPLR);
11175 : }
11176 : // for multispeed coils, comp is on at PLR=0 IF speed > 1
11177 20222676 : if (this->m_HeatingSpeedNum > 1) HeatingCompOn = DataHVACGlobals::CompressorOperation::On;
11178 :
11179 : // set the operating flow rate
11180 20222676 : if (this->m_NumOfSpeedCooling > 0 || this->m_NumOfSpeedHeating > 0) {
11181 18958919 : this->setOnOffMassFlowRate(state, OnOffAirFlowRatio, max(CoolPLR, HeatPLR));
11182 : } else {
11183 1263757 : this->setAverageAirFlow(state, max(CoolPLR, HeatPLR), OnOffAirFlowRatio);
11184 : }
11185 :
11186 : // Call the series of components that simulate a Unitary System
11187 20222676 : if (this->ATMixerExists) {
11188 : // There is an air terminal mixer
11189 789030 : if (this->ATMixerType == DataHVACGlobals::ATMixer_InletSide) { // if there is an inlet side air terminal mixer
11190 : // set the primary air inlet mass flow rate
11191 955416 : state.dataLoopNodes->Node(this->m_ATMixerPriNode).MassFlowRate = min(
11192 955416 : state.dataLoopNodes->Node(this->m_ATMixerPriNode).MassFlowRateMaxAvail, state.dataLoopNodes->Node(this->AirInNode).MassFlowRate);
11193 : // now calculate the the mixer outlet conditions (and the secondary air inlet flow rate)
11194 : // the mixer outlet flow rate has already been set above (it is the "inlet" node flow rate)
11195 477708 : SingleDuct::SimATMixer(state, this->m_ATMixerName, FirstHVACIteration, this->m_ATMixerIndex);
11196 : }
11197 : }
11198 20222676 : if (this->OAMixerExists) {
11199 : // the PTHP does one or the other, but why can't an OA Mixer exist with the AT Mixer?
11200 : // use of a blank std::string is not great here, but I'm not ready to change this API at the moment, so passing a static blank string is
11201 : // at least better than constructing a new string each time to call this function
11202 9643630 : MixedAir::SimOAMixer(state, blankStdString, FirstHVACIteration, this->OAMixerIndex);
11203 : }
11204 :
11205 20222676 : if (this->m_FanExists && this->m_FanPlace == FanPlace::BlowThru) {
11206 9422083 : if (this->m_FanType_Num == DataHVACGlobals::FanType_SystemModelObject) {
11207 9864150 : state.dataHVACFan->fanObjs[this->m_FanIndex]->simulate(state,
11208 : _,
11209 : _,
11210 : _,
11211 : _,
11212 1972830 : state.dataUnitarySystems->m_massFlow1,
11213 1972830 : state.dataUnitarySystems->m_runTimeFraction1,
11214 1972830 : state.dataUnitarySystems->m_massFlow2,
11215 1972830 : state.dataUnitarySystems->m_runTimeFraction2,
11216 : _);
11217 : } else {
11218 7449253 : if (this->m_IsZoneEquipment) {
11219 4936924 : Fans::SimulateFanComponents(state,
11220 : blankString,
11221 : FirstHVACIteration,
11222 : this->m_FanIndex,
11223 1234231 : state.dataUnitarySystems->FanSpeedRatio,
11224 1234231 : state.dataHVACGlobal->ZoneCompTurnFansOn,
11225 1234231 : state.dataHVACGlobal->ZoneCompTurnFansOff);
11226 : } else {
11227 6215022 : Fans::SimulateFanComponents(state, blankString, FirstHVACIteration, this->m_FanIndex, state.dataUnitarySystems->FanSpeedRatio);
11228 : }
11229 : }
11230 : }
11231 :
11232 20222676 : if (this->m_CoolingCoilUpstream) {
11233 :
11234 18976664 : if (this->m_CoolCoilExists) {
11235 18976664 : this->calcUnitaryCoolingSystem(
11236 : state, AirLoopNum, FirstHVACIteration, CoolPLR, CoolingCompOn, OnOffAirFlowRatio, CoilCoolHeatRat, HXUnitOn);
11237 : }
11238 18976664 : if (this->m_HeatCoilExists) {
11239 : // operate the heating coil without regard to coil outlet temperature
11240 18976664 : this->calcUnitaryHeatingSystem(state, AirLoopNum, FirstHVACIteration, HeatPLR, HeatingCompOn, OnOffAirFlowRatio, HeatCoilLoad);
11241 18976664 : if (state.dataLoopNodes->Node(this->HeatCoilOutletNodeNum).Temp > this->DesignMaxOutletTemp && !this->m_SimASHRAEModel) {
11242 237979 : Real64 MDotAir = state.dataLoopNodes->Node(this->HeatCoilInletNodeNum).MassFlowRate;
11243 475958 : Real64 CpAir = Psychrometrics::PsyCpAirFnW(0.5 * (state.dataLoopNodes->Node(this->HeatCoilInletNodeNum).HumRat +
11244 475958 : state.dataLoopNodes->Node(this->HeatCoilOutletNodeNum).HumRat));
11245 237979 : Real64 HCDeltaT = this->DesignMaxOutletTemp - state.dataLoopNodes->Node(this->HeatCoilInletNodeNum).Temp;
11246 237979 : Real64 MaxHeatCoilLoad = MDotAir * CpAir * HCDeltaT;
11247 237979 : this->calcUnitaryHeatingSystem(state, AirLoopNum, FirstHVACIteration, HeatPLR, HeatingCompOn, OnOffAirFlowRatio, MaxHeatCoilLoad);
11248 237979 : HeatCoilLoad = MaxHeatCoilLoad;
11249 : }
11250 : }
11251 :
11252 : // If blow thru fan is used, the fan must be simulated after coil sets OnOffFanPartLoadFraction
11253 18976664 : if (this->m_FanExists && this->m_FanPlace == FanPlace::BlowThru && state.dataHVACGlobal->OnOffFanPartLoadFraction < 1.0) {
11254 553082 : if (this->m_FanType_Num == DataHVACGlobals::FanType_SystemModelObject) {
11255 341835 : state.dataHVACFan->fanObjs[this->m_FanIndex]->simulate(state,
11256 : _,
11257 : _,
11258 : _,
11259 : _,
11260 68367 : state.dataUnitarySystems->m_massFlow1,
11261 68367 : state.dataUnitarySystems->m_runTimeFraction1,
11262 68367 : state.dataUnitarySystems->m_massFlow2,
11263 68367 : state.dataUnitarySystems->m_runTimeFraction2,
11264 : _);
11265 : } else {
11266 484715 : if (this->m_IsZoneEquipment) {
11267 462572 : Fans::SimulateFanComponents(state,
11268 : blankString,
11269 : FirstHVACIteration,
11270 : this->m_FanIndex,
11271 115643 : state.dataUnitarySystems->FanSpeedRatio,
11272 115643 : state.dataHVACGlobal->ZoneCompTurnFansOn,
11273 115643 : state.dataHVACGlobal->ZoneCompTurnFansOff);
11274 : } else {
11275 738144 : Fans::SimulateFanComponents(
11276 369072 : state, blankString, FirstHVACIteration, this->m_FanIndex, state.dataUnitarySystems->FanSpeedRatio);
11277 : }
11278 : }
11279 553082 : if (this->m_CoolCoilExists) {
11280 553082 : this->calcUnitaryCoolingSystem(
11281 : state, AirLoopNum, FirstHVACIteration, CoolPLR, CoolingCompOn, OnOffAirFlowRatio, CoilCoolHeatRat, HXUnitOn);
11282 : }
11283 553082 : if (this->m_HeatCoilExists) {
11284 553082 : this->calcUnitaryHeatingSystem(state, AirLoopNum, FirstHVACIteration, HeatPLR, HeatingCompOn, OnOffAirFlowRatio, HeatCoilLoad);
11285 553082 : if (state.dataLoopNodes->Node(this->HeatCoilOutletNodeNum).Temp > this->DesignMaxOutletTemp && !this->m_SimASHRAEModel) {
11286 5424 : Real64 MDotAir = state.dataLoopNodes->Node(this->HeatCoilInletNodeNum).MassFlowRate;
11287 10848 : Real64 CpAir = Psychrometrics::PsyCpAirFnW(0.5 * (state.dataLoopNodes->Node(this->HeatCoilInletNodeNum).HumRat +
11288 10848 : state.dataLoopNodes->Node(this->HeatCoilOutletNodeNum).HumRat));
11289 5424 : Real64 HCDeltaT = this->DesignMaxOutletTemp - state.dataLoopNodes->Node(this->HeatCoilInletNodeNum).Temp;
11290 5424 : Real64 MaxHeatCoilLoad = MDotAir * CpAir * HCDeltaT;
11291 5424 : this->calcUnitaryHeatingSystem(
11292 : state, AirLoopNum, FirstHVACIteration, HeatPLR, HeatingCompOn, OnOffAirFlowRatio, MaxHeatCoilLoad);
11293 : }
11294 : }
11295 : }
11296 :
11297 : } else {
11298 :
11299 1246012 : if (this->m_HeatCoilExists) {
11300 1246012 : this->calcUnitaryHeatingSystem(state, AirLoopNum, FirstHVACIteration, HeatPLR, HeatingCompOn, OnOffAirFlowRatio, HeatCoilLoad);
11301 1246012 : if (state.dataLoopNodes->Node(this->HeatCoilOutletNodeNum).Temp > this->DesignMaxOutletTemp && !this->m_SimASHRAEModel) {
11302 167184 : Real64 MDotAir = state.dataLoopNodes->Node(this->HeatCoilInletNodeNum).MassFlowRate;
11303 334368 : Real64 CpAir = Psychrometrics::PsyCpAirFnW(0.5 * (state.dataLoopNodes->Node(this->HeatCoilInletNodeNum).HumRat +
11304 334368 : state.dataLoopNodes->Node(this->HeatCoilOutletNodeNum).HumRat));
11305 167184 : Real64 HCDeltaT = this->DesignMaxOutletTemp - state.dataLoopNodes->Node(this->HeatCoilInletNodeNum).Temp;
11306 167184 : Real64 MaxHeatCoilLoad = MDotAir * CpAir * HCDeltaT;
11307 167184 : this->calcUnitaryHeatingSystem(state, AirLoopNum, FirstHVACIteration, HeatPLR, HeatingCompOn, OnOffAirFlowRatio, MaxHeatCoilLoad);
11308 : }
11309 : }
11310 1246012 : if (this->m_CoolCoilExists) {
11311 1246012 : this->calcUnitaryCoolingSystem(
11312 : state, AirLoopNum, FirstHVACIteration, CoolPLR, CoolingCompOn, OnOffAirFlowRatio, CoilCoolHeatRat, HXUnitOn);
11313 : }
11314 :
11315 : // If blow thru fan is used, the fan must be simulated after coil sets OnOffFanPartLoadFraction
11316 1246012 : if (this->m_FanExists && this->m_FanPlace == FanPlace::BlowThru && state.dataHVACGlobal->OnOffFanPartLoadFraction < 1.0) {
11317 18326 : if (this->m_FanType_Num == DataHVACGlobals::FanType_SystemModelObject) {
11318 91630 : state.dataHVACFan->fanObjs[this->m_FanIndex]->simulate(state,
11319 : _,
11320 : _,
11321 : _,
11322 : _,
11323 18326 : state.dataUnitarySystems->m_massFlow1,
11324 18326 : state.dataUnitarySystems->m_runTimeFraction1,
11325 18326 : state.dataUnitarySystems->m_massFlow2,
11326 18326 : state.dataUnitarySystems->m_runTimeFraction2,
11327 : _);
11328 : } else {
11329 0 : if (this->m_IsZoneEquipment) {
11330 0 : Fans::SimulateFanComponents(state,
11331 : blankString,
11332 : FirstHVACIteration,
11333 : this->m_FanIndex,
11334 0 : state.dataUnitarySystems->FanSpeedRatio,
11335 0 : state.dataHVACGlobal->ZoneCompTurnFansOn,
11336 0 : state.dataHVACGlobal->ZoneCompTurnFansOff);
11337 : } else {
11338 0 : Fans::SimulateFanComponents(
11339 0 : state, blankString, FirstHVACIteration, this->m_FanIndex, state.dataUnitarySystems->FanSpeedRatio);
11340 : }
11341 : }
11342 18326 : if (this->m_HeatCoilExists) {
11343 18326 : this->calcUnitaryHeatingSystem(state, AirLoopNum, FirstHVACIteration, HeatPLR, HeatingCompOn, OnOffAirFlowRatio, HeatCoilLoad);
11344 18326 : if (state.dataLoopNodes->Node(this->HeatCoilOutletNodeNum).Temp > this->DesignMaxOutletTemp && !this->m_SimASHRAEModel) {
11345 8516 : Real64 MDotAir = state.dataLoopNodes->Node(this->HeatCoilInletNodeNum).MassFlowRate;
11346 17032 : Real64 CpAir = Psychrometrics::PsyCpAirFnW(0.5 * (state.dataLoopNodes->Node(this->HeatCoilInletNodeNum).HumRat +
11347 17032 : state.dataLoopNodes->Node(this->HeatCoilOutletNodeNum).HumRat));
11348 8516 : Real64 HCDeltaT = this->DesignMaxOutletTemp - state.dataLoopNodes->Node(this->HeatCoilInletNodeNum).Temp;
11349 8516 : Real64 MaxHeatCoilLoad = MDotAir * CpAir * HCDeltaT;
11350 8516 : this->calcUnitaryHeatingSystem(
11351 : state, AirLoopNum, FirstHVACIteration, HeatPLR, HeatingCompOn, OnOffAirFlowRatio, MaxHeatCoilLoad);
11352 : }
11353 : }
11354 18326 : if (this->m_CoolCoilExists) {
11355 18326 : this->calcUnitaryCoolingSystem(
11356 : state, AirLoopNum, FirstHVACIteration, CoolPLR, CoolingCompOn, OnOffAirFlowRatio, CoilCoolHeatRat, HXUnitOn);
11357 : }
11358 : }
11359 : }
11360 :
11361 20222676 : if (this->m_FanExists && this->m_FanPlace == FanPlace::DrawThru) {
11362 10800593 : if (this->m_FanType_Num == DataHVACGlobals::FanType_SystemModelObject) {
11363 4743375 : state.dataHVACFan->fanObjs[this->m_FanIndex]->simulate(state,
11364 : _,
11365 : _,
11366 : _,
11367 : _,
11368 948675 : state.dataUnitarySystems->m_massFlow1,
11369 948675 : state.dataUnitarySystems->m_runTimeFraction1,
11370 948675 : state.dataUnitarySystems->m_massFlow2,
11371 948675 : state.dataUnitarySystems->m_runTimeFraction2,
11372 : _);
11373 : } else {
11374 9851918 : if (this->m_IsZoneEquipment) {
11375 35311388 : Fans::SimulateFanComponents(state,
11376 : blankString,
11377 : FirstHVACIteration,
11378 : this->m_FanIndex,
11379 8827847 : state.dataUnitarySystems->FanSpeedRatio,
11380 8827847 : state.dataHVACGlobal->ZoneCompTurnFansOn,
11381 8827847 : state.dataHVACGlobal->ZoneCompTurnFansOff);
11382 : } else {
11383 1024071 : Fans::SimulateFanComponents(state, blankString, FirstHVACIteration, this->m_FanIndex, state.dataUnitarySystems->FanSpeedRatio);
11384 : }
11385 : }
11386 : }
11387 20222676 : if (this->m_SuppCoilExists) {
11388 5440891 : this->calcUnitarySuppHeatingSystem(state, FirstHVACIteration, SuppCoilLoad);
11389 5445545 : if ((state.dataLoopNodes->Node(this->SuppCoilOutletNodeNum).Temp > this->DesignMaxOutletTemp) && this->m_SuppHeatPartLoadFrac > 0.0 &&
11390 4654 : !this->m_SimASHRAEModel) {
11391 : // EMS override will ignore this recalculation.
11392 4654 : Real64 MDotAir = state.dataLoopNodes->Node(this->m_SuppCoilAirInletNode).MassFlowRate;
11393 9308 : Real64 CpAir = Psychrometrics::PsyCpAirFnW(0.5 * (state.dataLoopNodes->Node(this->m_SuppCoilAirInletNode).HumRat +
11394 9308 : state.dataLoopNodes->Node(this->SuppCoilOutletNodeNum).HumRat));
11395 4654 : Real64 HCDeltaT = max(0.0, this->DesignMaxOutletTemp - state.dataLoopNodes->Node(this->m_SuppCoilAirInletNode).Temp);
11396 4654 : Real64 MaxHeatCoilLoad = MDotAir * CpAir * HCDeltaT;
11397 4654 : this->calcUnitarySuppHeatingSystem(state, FirstHVACIteration, MaxHeatCoilLoad);
11398 4654 : SuppCoilLoad = MaxHeatCoilLoad;
11399 : }
11400 : }
11401 :
11402 : // If there is a supply side air terminal mixer, calculate its output
11403 20222676 : if (this->ATMixerExists) {
11404 789030 : if (this->ATMixerType == DataHVACGlobals::ATMixer_SupplySide) {
11405 311322 : SingleDuct::SimATMixer(state, this->m_ATMixerName, FirstHVACIteration, this->m_ATMixerIndex);
11406 : }
11407 : }
11408 :
11409 20222676 : calculateCapacity(state, SensOutput, LatOutput);
11410 20222676 : }
11411 :
11412 1099980 : void UnitarySys::calcMultiStageSuppCoilStageByLoad(EnergyPlusData &state, Real64 const SuppHeatLoad, bool const FirstHVACIteration)
11413 : {
11414 1099980 : if (SuppHeatLoad <= 0.0) {
11415 1090956 : this->m_SuppHeatPartLoadFrac = 0.0;
11416 1090956 : this->m_SuppHeatingSpeedRatio = 0.0;
11417 1090956 : this->m_SuppHeatingCycRatio = 0.0;
11418 2186368 : return;
11419 : }
11420 9024 : constexpr bool SuppHeatingCoilFlag(true);
11421 9024 : Real64 PartLoadFrac = 0.0;
11422 9024 : Real64 SpeedRatio = 0.0;
11423 9024 : Real64 CycRatio = 0.0;
11424 13592 : std::string CompName = this->m_SuppHeatCoilName;
11425 9024 : int CompIndex = this->m_SuppHeatCoilIndex;
11426 9024 : int FanOpMode = this->m_FanOpMode;
11427 9024 : Real64 QCoilActual = 0.0; // Heating coil operating capacity [W]
11428 9024 : int SpeedNum = 0;
11429 : // Get full load result
11430 9024 : PartLoadFrac = 1.0;
11431 9024 : CycRatio = 1.0;
11432 9024 : SpeedRatio = 1.0;
11433 9024 : int SolFla = 0.0;
11434 :
11435 : // SUBROUTINE PARAMETER DEFINITIONS:
11436 9024 : int constexpr MaxIte(500); // Maximum number of iterations for solver
11437 9024 : Real64 constexpr Acc(1.0e-3); // Accuracy of solver result
11438 :
11439 30696 : for (SpeedNum = 1; SpeedNum <= this->m_NumOfSpeedSuppHeating; ++SpeedNum) {
11440 26240 : this->m_SuppHeatingSpeedNum = SpeedNum;
11441 26240 : HeatingCoils::SimulateHeatingCoilComponents(state,
11442 : CompName,
11443 : FirstHVACIteration,
11444 : SuppHeatLoad,
11445 : CompIndex,
11446 : QCoilActual,
11447 : SuppHeatingCoilFlag,
11448 : FanOpMode,
11449 : PartLoadFrac,
11450 : SpeedNum,
11451 : SpeedRatio);
11452 26240 : if (QCoilActual > SuppHeatLoad) break;
11453 : }
11454 9024 : if (QCoilActual < SuppHeatLoad) {
11455 4456 : this->m_SuppHeatPartLoadFrac = 1.0;
11456 4456 : this->m_SuppHeatingSpeedRatio = 1.0;
11457 4456 : this->m_SuppHeatingCycRatio = 1.0;
11458 4456 : this->m_SuppHeatingSpeedNum = this->m_NumOfSpeedSuppHeating;
11459 4456 : return;
11460 : } else {
11461 :
11462 4568 : if (this->m_SuppHeatingSpeedNum > 1.0) {
11463 54768 : auto f = [&state, this, CycRatio, FanOpMode, SuppHeatLoad](Real64 const SpeedRatio) {
11464 : Real64 QActual;
11465 13692 : int CoilIndex = this->m_SuppHeatCoilIndex;
11466 13692 : int SpeedNum = this->m_SuppHeatingSpeedNum;
11467 13692 : HeatingCoils::CalcMultiStageElectricHeatingCoil(state, CoilIndex, SpeedRatio, CycRatio, SpeedNum, FanOpMode, QActual, true);
11468 13692 : return SuppHeatLoad - QActual;
11469 4564 : };
11470 :
11471 4564 : General::SolveRoot(state, Acc, MaxIte, SolFla, SpeedRatio, f, 0.0, 1.0);
11472 4564 : this->m_SuppHeatingCycRatio = CycRatio;
11473 4564 : this->m_SuppHeatingSpeedRatio = SpeedRatio;
11474 4564 : this->m_SuppHeatPartLoadFrac = SpeedRatio;
11475 4564 : PartLoadFrac = SpeedRatio;
11476 : } else {
11477 4 : SpeedRatio = 0.0;
11478 4 : this->m_SuppHeatingSpeedRatio = SpeedRatio;
11479 48 : auto f = [&state, this, SpeedRatio, FanOpMode, SuppHeatLoad](Real64 const CycRatio) {
11480 : Real64 QActual;
11481 12 : int CoilIndex = this->m_SuppHeatCoilIndex;
11482 12 : int SpeedNum = this->m_SuppHeatingSpeedNum;
11483 12 : HeatingCoils::CalcMultiStageElectricHeatingCoil(state, CoilIndex, SpeedRatio, CycRatio, SpeedNum, FanOpMode, QActual, true);
11484 12 : return SuppHeatLoad - QActual;
11485 4 : };
11486 :
11487 4 : General::SolveRoot(state, Acc, MaxIte, SolFla, CycRatio, f, 0.0, 1.0);
11488 4 : this->m_SuppHeatingCycRatio = CycRatio;
11489 4 : this->m_SuppHeatPartLoadFrac = CycRatio;
11490 4 : PartLoadFrac = CycRatio;
11491 : }
11492 : }
11493 : }
11494 :
11495 23781842 : void UnitarySys::calculateCapacity(EnergyPlusData &state, Real64 &SensOutput, Real64 &LatOutput)
11496 : {
11497 :
11498 : // Check delta T (outlet to reference temp), IF positive use reference HumRat ELSE outlet humrat to calculate
11499 : // sensible capacity as MdotDeltaH at constant humidity ratio
11500 23781842 : int OutletNode = this->AirOutNode;
11501 23781842 : Real64 AirMassFlow = state.dataLoopNodes->Node(OutletNode).MassFlowRate;
11502 23781842 : Real64 RefTemp = 0.0;
11503 23781842 : Real64 RefHumRat = 0.0;
11504 23781842 : if (this->m_ControlType == UnitarySysCtrlType::Setpoint) {
11505 3559166 : RefTemp = state.dataLoopNodes->Node(this->AirInNode).Temp;
11506 3559166 : RefHumRat = state.dataLoopNodes->Node(this->AirInNode).HumRat;
11507 : } else {
11508 20222676 : RefTemp = state.dataLoopNodes->Node(this->NodeNumOfControlledZone).Temp;
11509 20222676 : RefHumRat = state.dataLoopNodes->Node(this->NodeNumOfControlledZone).HumRat;
11510 : }
11511 23781842 : Real64 SensibleOutput(0.0); // sensible output rate, {W}
11512 23781842 : Real64 LatentOutput(0.0); // latent output rate, {W}
11513 23781842 : Real64 TotalOutput(0.0); // total output rate, {W}
11514 : // calculate sensible load met
11515 23781842 : if (this->ATMixerExists) {
11516 789030 : if (this->ATMixerType == DataHVACGlobals::ATMixer_SupplySide) {
11517 : // Air terminal supply side mixer
11518 311322 : int ATMixOutNode = this->ATMixerOutNode;
11519 622644 : CalcZoneSensibleLatentOutput(state.dataLoopNodes->Node(ATMixOutNode).MassFlowRate,
11520 311322 : state.dataLoopNodes->Node(ATMixOutNode).Temp,
11521 311322 : state.dataLoopNodes->Node(ATMixOutNode).HumRat,
11522 : RefTemp,
11523 : RefHumRat,
11524 : SensibleOutput,
11525 : LatentOutput,
11526 : TotalOutput);
11527 311322 : SensOutput = SensibleOutput - this->m_SenLoadLoss;
11528 311322 : if (this->m_Humidistat) {
11529 0 : LatOutput = LatentOutput - this->m_LatLoadLoss;
11530 : } else {
11531 311322 : LatOutput = 0.0;
11532 : }
11533 : } else {
11534 : // Air terminal inlet side mixer
11535 955416 : CalcZoneSensibleLatentOutput(AirMassFlow,
11536 477708 : state.dataLoopNodes->Node(OutletNode).Temp,
11537 477708 : state.dataLoopNodes->Node(OutletNode).HumRat,
11538 : RefTemp,
11539 : RefHumRat,
11540 : SensibleOutput,
11541 : LatentOutput,
11542 : TotalOutput);
11543 477708 : SensOutput = SensibleOutput - this->m_SenLoadLoss;
11544 477708 : if (this->m_Humidistat) {
11545 0 : LatOutput = LatentOutput - this->m_LatLoadLoss;
11546 : } else {
11547 477708 : LatOutput = 0.0;
11548 : }
11549 : }
11550 : } else {
11551 : // Calculate sensible load met
11552 45985624 : CalcZoneSensibleLatentOutput(AirMassFlow,
11553 22992812 : state.dataLoopNodes->Node(OutletNode).Temp,
11554 22992812 : state.dataLoopNodes->Node(OutletNode).HumRat,
11555 : RefTemp,
11556 : RefHumRat,
11557 : SensibleOutput,
11558 : LatentOutput,
11559 : TotalOutput);
11560 22992812 : SensOutput = SensibleOutput - this->m_SenLoadLoss;
11561 22992812 : if (this->m_Humidistat) {
11562 1481414 : LatOutput = LatentOutput - this->m_LatLoadLoss;
11563 : } else {
11564 21511398 : LatOutput = 0.0;
11565 : }
11566 : }
11567 23781842 : this->m_SensibleLoadMet = SensOutput;
11568 23781842 : this->m_LatentLoadMet = LatOutput;
11569 23781842 : }
11570 :
11571 24381270 : void UnitarySys::calcUnitaryCoolingSystem(EnergyPlusData &state,
11572 : int const AirLoopNum, // index to air loop
11573 : bool const FirstHVACIteration, // True when first HVAC iteration
11574 : Real64 const PartLoadRatio, // coil operating part-load ratio
11575 : DataHVACGlobals::CompressorOperation const CompressorOn, // compressor control (0=off, 1=on)
11576 : Real64 const OnOffAirFlowRatio,
11577 : Real64 const CoilCoolHeatRat, // ratio of cooling to heating PLR for cycling fan RH control
11578 : bool const HXUnitOn // Flag to control HX for HXAssisted Cooling Coil
11579 : )
11580 : {
11581 :
11582 : // SUBROUTINE INFORMATION:
11583 : // AUTHOR Richard Raustad, FSEC
11584 : // DATE WRITTEN February 2013
11585 :
11586 : // PURPOSE OF THIS SUBROUTINE:
11587 : // This subroutine manages unitary cooling system component simulation.
11588 :
11589 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
11590 : Real64 OutsideDryBulbTemp; // outdoor temperature (C)
11591 : Real64 mdot; // water side flow rate (kg/s)
11592 : Real64 QActual; // actual coil output (W)
11593 : Real64 OutdoorPressure; // Outdoor barometric pressure at condenser (Pa)
11594 : bool errFlag; // returned flag from called routine
11595 : bool HeatingActive; // dummy variable for UserDefined coil which are passed back indicating if coil is on or off. Not needed here since
11596 : // coil is wrapped by UnitarySystem.
11597 : bool CoolingActive; // dummy variable for UserDefined coil which are passed back indicating if coil is on or off. Not needed here since
11598 : // coil is wrapped by UnitarySystem.
11599 :
11600 : // Simulate the coil component
11601 48762540 : std::string CompName = this->m_CoolingCoilName;
11602 24381270 : int CompIndex = this->m_CoolingCoilIndex;
11603 24381270 : Real64 CoilPLR = 1.0;
11604 24381270 : if (this->m_CondenserNodeNum != 0) {
11605 5924018 : OutdoorPressure = state.dataLoopNodes->Node(this->m_CondenserNodeNum).Press;
11606 : // IF node is not connected to anything, pressure = default, use weather data
11607 5924018 : if (OutdoorPressure == state.dataLoopNodes->DefaultNodeValues.Press) {
11608 0 : OutsideDryBulbTemp = state.dataEnvrn->OutDryBulbTemp;
11609 : } else {
11610 5924018 : OutsideDryBulbTemp = state.dataLoopNodes->Node(this->m_CondenserNodeNum).Temp;
11611 : }
11612 : } else {
11613 18457252 : OutsideDryBulbTemp = state.dataEnvrn->OutDryBulbTemp;
11614 : }
11615 24381270 : if (this->m_EMSOverrideCoilSpeedNumOn) {
11616 : // pass
11617 : } else {
11618 24276601 : switch (this->m_CoolingCoilType_Num) {
11619 12792742 : case DataHVACGlobals::CoilDX_CoolingSingleSpeed: { // Coil:Cooling:DX:SingleSpeed
11620 12792742 : DXCoils::SimDXCoil(state,
11621 : blankString,
11622 : CompressorOn,
11623 : FirstHVACIteration,
11624 : CompIndex,
11625 : this->m_FanOpMode,
11626 : PartLoadRatio,
11627 : OnOffAirFlowRatio,
11628 : CoilCoolHeatRat);
11629 12792742 : this->m_CoolCompPartLoadRatio = (CompressorOn == DataHVACGlobals::CompressorOperation::On) ? PartLoadRatio : 0.0;
11630 12792742 : } break;
11631 4239706 : case DataHVACGlobals::CoilDX_Cooling: { // CoilCoolingDX
11632 4239706 : bool const singleMode = (this->m_SingleMode == 1);
11633 4239706 : if (this->m_ControlType == UnitarySysCtrlType::Setpoint) {
11634 35253 : if (CompressorOn == DataHVACGlobals::CompressorOperation::On) {
11635 25926 : CoilPLR = (this->m_CoolingSpeedNum > 1) ? 1.0 : PartLoadRatio;
11636 : } else
11637 9327 : CoilPLR = 0.0;
11638 : } else {
11639 4204453 : if (state.dataUnitarySystems->CoolingLoad) {
11640 2910342 : if (this->m_CoolingSpeedNum > 1) {
11641 1168720 : if (!singleMode) {
11642 1145424 : CoilPLR = (CompressorOn == DataHVACGlobals::CompressorOperation::On) ? 1.0 : 0.0;
11643 1145424 : this->m_CoolingSpeedRatio = (CompressorOn == DataHVACGlobals::CompressorOperation::On) ? PartLoadRatio : 0.0;
11644 : } else {
11645 23296 : CoilPLR = (CompressorOn == DataHVACGlobals::CompressorOperation::On) ? PartLoadRatio : 0.0;
11646 : }
11647 : } else {
11648 1741622 : CoilPLR = (CompressorOn == DataHVACGlobals::CompressorOperation::On) ? PartLoadRatio : 0.0;
11649 : }
11650 : } else {
11651 1294111 : CoilPLR = 0.0;
11652 : }
11653 : }
11654 4239706 : int OperationMode = DataHVACGlobals::coilNormalMode;
11655 4239706 : if (state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].SubcoolReheatFlag) {
11656 76768 : OperationMode = DataHVACGlobals::coilSubcoolReheatMode;
11657 4162938 : } else if (this->m_DehumidificationMode == 1) {
11658 0 : OperationMode = DataHVACGlobals::coilEnhancedMode;
11659 : }
11660 :
11661 4239706 : state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate(
11662 : state, OperationMode, CoilPLR, this->m_CoolingSpeedNum, this->m_CoolingSpeedRatio, this->m_FanOpMode, singleMode, this->CoilSHR);
11663 :
11664 4239706 : if (this->m_CoolingSpeedNum > 1) {
11665 1173859 : if (this->m_SingleMode == 0) {
11666 1150563 : this->m_CoolCompPartLoadRatio = (CompressorOn == DataHVACGlobals::CompressorOperation::On) ? 1.0 : 0.0;
11667 : } else {
11668 23296 : this->m_CoolCompPartLoadRatio = (CompressorOn == DataHVACGlobals::CompressorOperation::On) ? PartLoadRatio : 0.0;
11669 : // this->m_CoolingCycRatio = this->m_CoolingSpeedRatio;
11670 23296 : this->m_CoolingSpeedRatio = 1.0;
11671 : }
11672 : } else {
11673 3065847 : this->m_CoolCompPartLoadRatio = (CompressorOn == DataHVACGlobals::CompressorOperation::On) ? this->m_CoolingCycRatio : 0.0;
11674 : // this->m_CoolingCycRatio = this->m_CoolingSpeedRatio;
11675 3065847 : this->m_CoolingSpeedRatio = 0.0;
11676 : }
11677 4239706 : } break;
11678 25066 : case DataHVACGlobals::CoilDX_CoolingHXAssisted:
11679 : case DataHVACGlobals::CoilWater_CoolingHXAssisted: {
11680 25066 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilWater_CoolingHXAssisted) {
11681 0 : Real64 mdot = min(state.dataLoopNodes->Node(this->CoolCoilFluidOutletNodeNum).MassFlowRateMaxAvail,
11682 0 : this->MaxCoolCoilFluidFlow * PartLoadRatio);
11683 0 : state.dataLoopNodes->Node(this->CoolCoilFluidInletNode).MassFlowRate = mdot;
11684 : }
11685 50132 : HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil(state,
11686 : blankString,
11687 : FirstHVACIteration,
11688 : CompressorOn,
11689 : PartLoadRatio,
11690 : CompIndex,
11691 : this->m_FanOpMode,
11692 : HXUnitOn,
11693 : OnOffAirFlowRatio,
11694 25066 : state.dataUnitarySystems->economizerFlag,
11695 : _,
11696 : this->m_DehumidificationMode,
11697 : 0.0); // this->CoilSHR);
11698 25066 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_CoolingHXAssisted) {
11699 25066 : this->m_CoolCompPartLoadRatio = (CompressorOn == DataHVACGlobals::CompressorOperation::On) ? PartLoadRatio : 0.0;
11700 : }
11701 25066 : } break;
11702 1034668 : case DataHVACGlobals::CoilDX_CoolingTwoSpeed: { // Coil:Cooling:DX:TwoSpeed
11703 : // formerly (v3 and beyond)COIL:DX:MULTISPEED:COOLINGEMPIRICAL
11704 1034668 : DXCoils::SimDXCoilMultiSpeed(state, blankString, this->m_CoolingSpeedRatio, this->m_CoolingCycRatio, CompIndex);
11705 1034668 : if (this->m_CoolingSpeedRatio > 0.0) {
11706 352858 : this->m_CoolCompPartLoadRatio = (CompressorOn == DataHVACGlobals::CompressorOperation::On) ? this->m_CoolingSpeedRatio : 0.0;
11707 : } else {
11708 681810 : this->m_CoolCompPartLoadRatio = (CompressorOn == DataHVACGlobals::CompressorOperation::On) ? this->m_CoolingCycRatio : 0.0;
11709 : }
11710 1034668 : } break;
11711 3995355 : case DataHVACGlobals::CoilDX_MultiSpeedCooling: { // Coil:Cooling:DX:Multispeed
11712 3995355 : if (OutsideDryBulbTemp > this->m_MinOATCompressorCooling) {
11713 3995355 : DXCoils::SimDXCoilMultiSpeed(state,
11714 : CompName,
11715 : this->m_CoolingSpeedRatio,
11716 : this->m_CoolingCycRatio,
11717 : CompIndex,
11718 : this->m_CoolingSpeedNum,
11719 : this->m_FanOpMode,
11720 : CompressorOn,
11721 : this->m_SingleMode);
11722 3995355 : if (this->m_CoolingSpeedNum > 1) {
11723 874552 : if (this->m_SingleMode == 0) {
11724 874552 : this->m_CoolCompPartLoadRatio = (CompressorOn == DataHVACGlobals::CompressorOperation::On) ? 1.0 : 0.0;
11725 : } else {
11726 0 : this->m_CoolCompPartLoadRatio =
11727 0 : (CompressorOn == DataHVACGlobals::CompressorOperation::On) ? this->m_CoolingCycRatio : 0.0;
11728 : }
11729 : } else {
11730 3120803 : this->m_CoolCompPartLoadRatio = (CompressorOn == DataHVACGlobals::CompressorOperation::On) ? this->m_CoolingCycRatio : 0.0;
11731 : }
11732 : } else {
11733 0 : DXCoils::SimDXCoilMultiSpeed(state, CompName, 0.0, 0.0, CompIndex, this->m_CoolingSpeedNum, this->m_FanOpMode, CompressorOn);
11734 0 : this->m_CoolCompPartLoadRatio = 0.0;
11735 : }
11736 3995355 : } break;
11737 48952 : case DataHVACGlobals::CoilDX_CoolingTwoStageWHumControl: {
11738 : // formerly (v3 and beyond) COIL:DX:MULTIMODE:COOLINGEMPIRICAL
11739 48952 : DXCoils::SimDXCoilMultiMode(
11740 : state, CompName, CompressorOn, FirstHVACIteration, PartLoadRatio, this->m_DehumidificationMode, CompIndex, this->m_FanOpMode);
11741 48952 : this->m_CoolCompPartLoadRatio = (CompressorOn == DataHVACGlobals::CompressorOperation::On) ? PartLoadRatio : 0.0;
11742 48952 : } break;
11743 0 : case DataHVACGlobals::Coil_UserDefined: {
11744 0 : HeatingActive = false; // set to arbitrary value on entry to function
11745 0 : CoolingActive = false; // set to arbitrary value on entry to function
11746 :
11747 0 : UserDefinedComponents::SimCoilUserDefined(state, CompName, CompIndex, AirLoopNum, HeatingActive, CoolingActive);
11748 0 : } break;
11749 708560 : case DataHVACGlobals::Coil_CoolingWater:
11750 : case DataHVACGlobals::Coil_CoolingWaterDetailed: {
11751 708560 : if (this->CoolCoilWaterFlowRatio == 0.0) {
11752 708560 : mdot = this->MaxCoolCoilFluidFlow * PartLoadRatio;
11753 : } else {
11754 0 : mdot = this->CoolCoilWaterFlowRatio * this->MaxCoolCoilFluidFlow;
11755 : }
11756 708560 : state.dataLoopNodes->Node(this->CoolCoilFluidInletNode).MassFlowRate = mdot;
11757 708560 : WaterCoils::SimulateWaterCoilComponents(
11758 : state, CompName, FirstHVACIteration, this->m_CoolingCoilIndex, QActual, this->m_FanOpMode, PartLoadRatio);
11759 708560 : } break;
11760 409318 : case DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed:
11761 : case DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit: {
11762 409318 : if (this->m_CoolingSpeedNum > 1) {
11763 91589 : CoilPLR = 1.0;
11764 : } else {
11765 317729 : CoilPLR = PartLoadRatio;
11766 : }
11767 409318 : VariableSpeedCoils::SimVariableSpeedCoils(state,
11768 : CompName,
11769 : CompIndex,
11770 : this->m_FanOpMode,
11771 : this->m_MaxONOFFCyclesperHour,
11772 : this->m_HPTimeConstant,
11773 : this->m_FanDelayTime,
11774 : CompressorOn,
11775 : CoilPLR,
11776 : this->m_CoolingSpeedNum,
11777 : this->m_CoolingSpeedRatio,
11778 : this->m_CoolingCoilSensDemand,
11779 : this->m_CoolingCoilLatentDemand,
11780 : OnOffAirFlowRatio);
11781 409318 : if (this->m_CoolingSpeedNum > 1) {
11782 91589 : this->m_CoolCompPartLoadRatio = 1.0;
11783 : } else {
11784 317729 : this->m_CoolCompPartLoadRatio = (CompressorOn == DataHVACGlobals::CompressorOperation::On) ? PartLoadRatio : 0.0;
11785 : }
11786 409318 : } break;
11787 576676 : case DataHVACGlobals::Coil_CoolingWaterToAirHPSimple: {
11788 : // WSHP coils do not have a PLF curve and do not adjust fan performance
11789 719120 : if (PartLoadRatio > 0.0 && this->m_WSHPRuntimeFrac > 0.0 && this->m_FanOpMode == DataHVACGlobals::CycFanCycCoil &&
11790 142444 : this->m_sysType != SysType::PackagedWSHP) {
11791 0 : state.dataHVACGlobal->OnOffFanPartLoadFraction = PartLoadRatio / this->m_WSHPRuntimeFrac;
11792 : }
11793 :
11794 576676 : WaterToAirHeatPumpSimple::SimWatertoAirHPSimple(state,
11795 : blankString,
11796 : this->m_CoolingCoilIndex,
11797 : this->m_CoolingCoilSensDemand,
11798 : this->m_CoolingCoilLatentDemand,
11799 : this->m_FanOpMode,
11800 : this->m_WSHPRuntimeFrac,
11801 : this->m_MaxONOFFCyclesperHour,
11802 : this->m_HPTimeConstant,
11803 : this->m_FanDelayTime,
11804 : CompressorOn,
11805 : PartLoadRatio,
11806 : FirstHVACIteration);
11807 :
11808 576676 : this->m_CoolCompPartLoadRatio = (CompressorOn == DataHVACGlobals::CompressorOperation::On) ? PartLoadRatio : 0.0;
11809 576676 : } break;
11810 416586 : case DataHVACGlobals::Coil_CoolingWaterToAirHP: {
11811 416586 : this->heatPumpRunFrac(PartLoadRatio, errFlag, this->m_WSHPRuntimeFrac);
11812 :
11813 416586 : if (PartLoadRatio > 0.0 && this->m_WSHPRuntimeFrac > 0.0 && this->m_FanOpMode == DataHVACGlobals::CycFanCycCoil) {
11814 138600 : state.dataHVACGlobal->OnOffFanPartLoadFraction = PartLoadRatio / this->m_WSHPRuntimeFrac;
11815 : }
11816 :
11817 833172 : WaterToAirHeatPump::SimWatertoAirHP(state,
11818 : blankString,
11819 : this->m_CoolingCoilIndex,
11820 : this->MaxCoolAirMassFlow,
11821 : this->m_FanOpMode,
11822 : FirstHVACIteration,
11823 : this->m_WSHPRuntimeFrac,
11824 : this->m_MaxONOFFCyclesperHour,
11825 : this->m_HPTimeConstant,
11826 : this->m_FanDelayTime,
11827 416586 : this->m_InitHeatPump,
11828 : this->m_CoolingCoilSensDemand,
11829 : this->m_CoolingCoilLatentDemand,
11830 : CompressorOn,
11831 : PartLoadRatio);
11832 :
11833 416586 : this->m_CoolCompPartLoadRatio = (CompressorOn == DataHVACGlobals::CompressorOperation::On) ? PartLoadRatio : 0.0;
11834 416586 : } break;
11835 28972 : case DataHVACGlobals::CoilDX_PackagedThermalStorageCooling: {
11836 28972 : PackagedThermalStorageCoil::SimTESCoil(
11837 : state, CompName, this->m_CoolingCoilIndex, this->m_FanOpMode, this->m_TESOpMode, PartLoadRatio);
11838 28972 : } break;
11839 0 : default:
11840 0 : break;
11841 : }
11842 : }
11843 :
11844 24381270 : this->m_CoolingPartLoadFrac = PartLoadRatio;
11845 24381270 : }
11846 :
11847 21328678 : void UnitarySys::calcUnitaryHeatingSystem(EnergyPlusData &state,
11848 : int const AirLoopNum, // index to air loop
11849 : bool const FirstHVACIteration, // True when first HVAC iteration
11850 : Real64 const PartLoadRatio, // coil operating part-load ratio
11851 : DataHVACGlobals::CompressorOperation const CompressorOn, // compressor control (0=off, 1=on)
11852 : Real64 const OnOffAirFlowRatio, // ratio of on to off flow rate
11853 : Real64 HeatCoilLoad // adjusted heating coil load if outlet temp exceeds max (W)
11854 : )
11855 : {
11856 :
11857 : // SUBROUTINE INFORMATION:
11858 : // AUTHOR Richard Raustad, FSEC
11859 : // DATE WRITTEN February 2013
11860 :
11861 : // PURPOSE OF THIS SUBROUTINE:
11862 : // This subroutine manages unitary heating system component simulation.
11863 :
11864 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
11865 : Real64 OutsideDryBulbTemp; // outdoor temperature (C)
11866 : Real64 mdot; // water side flow rate (kg/s)
11867 : Real64 QActual; // actual output of coil (W)
11868 : Real64 OutdoorPressure; // Outdoor barometric pressure at condenser (Pa)
11869 : bool errFlag; // returned flag from called routine
11870 : bool HeatingActive; // dummy variable for UserDefined coil which are passed back indicating if coil is on or off. Not needed here since
11871 : // coil is wrapped by UnitarySystem.
11872 : bool CoolingActive; // dummy variable for UserDefined coil which are passed back indicating if coil is on or off. Not needed here since
11873 : // coil is wrapped by UnitarySystem.
11874 :
11875 42657356 : std::string CompName = this->m_HeatingCoilName;
11876 21328678 : Real64 dummy = 0.0;
11877 21328678 : Real64 HeatPLR = 1.0;
11878 21328678 : if (this->m_CondenserNodeNum != 0) {
11879 5957967 : OutdoorPressure = state.dataLoopNodes->Node(this->m_CondenserNodeNum).Press;
11880 : // IF node is not connected to anything, pressure = default, use weather data
11881 5957967 : if (OutdoorPressure == state.dataLoopNodes->DefaultNodeValues.Press) {
11882 0 : OutsideDryBulbTemp = state.dataEnvrn->OutDryBulbTemp;
11883 : } else {
11884 5957967 : OutsideDryBulbTemp = state.dataLoopNodes->Node(this->m_CondenserNodeNum).Temp;
11885 : }
11886 : } else {
11887 15370711 : OutsideDryBulbTemp = state.dataEnvrn->OutDryBulbTemp;
11888 : }
11889 :
11890 21328678 : switch (this->m_HeatingCoilType_Num) {
11891 2153813 : case DataHVACGlobals::CoilDX_HeatingEmpirical: { // COIL:HEATING:DX:SINGLESPEED
11892 2153813 : DXCoils::SimDXCoil(
11893 : state, CompName, CompressorOn, FirstHVACIteration, this->m_HeatingCoilIndex, this->m_FanOpMode, PartLoadRatio, OnOffAirFlowRatio);
11894 2153813 : this->m_HeatCompPartLoadRatio = PartLoadRatio * double(CompressorOn);
11895 2153813 : } break;
11896 0 : case DataHVACGlobals::Coil_UserDefined: {
11897 0 : HeatingActive = false; // set to arbitrary value on entry to function
11898 0 : CoolingActive = true; // set to arbitrary value on entry to function
11899 :
11900 0 : UserDefinedComponents::SimCoilUserDefined(state, CompName, this->m_HeatingCoilIndex, AirLoopNum, HeatingActive, CoolingActive);
11901 0 : } break;
11902 14225806 : case DataHVACGlobals::Coil_HeatingGasOrOtherFuel:
11903 : case DataHVACGlobals::Coil_HeatingElectric: {
11904 14225806 : HeatCoilLoad = PartLoadRatio * m_DesignHeatingCapacity;
11905 14225806 : HeatingCoils::SimulateHeatingCoilComponents(
11906 : state, CompName, FirstHVACIteration, HeatCoilLoad, this->m_HeatingCoilIndex, _, false, this->m_FanOpMode, PartLoadRatio);
11907 14225806 : } break;
11908 0 : case DataHVACGlobals::Coil_HeatingDesuperheater: {
11909 0 : HeatingCoils::SimulateHeatingCoilComponents(
11910 : state, CompName, FirstHVACIteration, HeatCoilLoad, this->m_HeatingCoilIndex, _, false, this->m_FanOpMode, PartLoadRatio);
11911 :
11912 0 : } break;
11913 2508705 : case DataHVACGlobals::CoilDX_MultiSpeedHeating: {
11914 2508705 : if (OutsideDryBulbTemp > this->m_MinOATCompressorHeating) {
11915 2321279 : DXCoils::SimDXCoilMultiSpeed(state,
11916 : CompName,
11917 : this->m_HeatingSpeedRatio,
11918 : this->m_HeatingCycRatio,
11919 : this->m_HeatingCoilIndex,
11920 : this->m_HeatingSpeedNum,
11921 : this->m_FanOpMode,
11922 : CompressorOn,
11923 : this->m_SingleMode);
11924 2321279 : this->m_HeatCompPartLoadRatio = PartLoadRatio * double(CompressorOn);
11925 : } else {
11926 187426 : DXCoils::SimDXCoilMultiSpeed(
11927 : state, CompName, 0.0, 0.0, this->m_HeatingCoilIndex, this->m_HeatingSpeedNum, this->m_FanOpMode, CompressorOn);
11928 187426 : this->m_HeatCompPartLoadRatio = 0.0;
11929 : }
11930 2508705 : } break;
11931 0 : case DataHVACGlobals::Coil_HeatingElectric_MultiStage:
11932 : case DataHVACGlobals::Coil_HeatingGas_MultiStage: {
11933 0 : HeatingCoils::SimulateHeatingCoilComponents(state,
11934 : CompName,
11935 : FirstHVACIteration,
11936 : _,
11937 : 0,
11938 : _,
11939 : _,
11940 : this->m_FanOpMode,
11941 : PartLoadRatio,
11942 : this->m_HeatingSpeedNum,
11943 : this->m_HeatingSpeedRatio);
11944 : // This doesn't look right when it was at higher speed
11945 : // this->m_HeatingCycRatio = PartLoadRatio;
11946 0 : } break;
11947 1105543 : case DataHVACGlobals::Coil_HeatingWater: {
11948 1105543 : if (this->HeatCoilWaterFlowRatio == 0.0) {
11949 1105543 : mdot = this->MaxHeatCoilFluidFlow * PartLoadRatio;
11950 : } else {
11951 0 : mdot = this->HeatCoilWaterFlowRatio * this->MaxHeatCoilFluidFlow;
11952 : }
11953 1105543 : state.dataLoopNodes->Node(this->HeatCoilFluidInletNode).MassFlowRate = mdot;
11954 1105543 : WaterCoils::SimulateWaterCoilComponents(
11955 : state, CompName, FirstHVACIteration, this->m_HeatingCoilIndex, QActual, this->m_FanOpMode, PartLoadRatio);
11956 1105543 : } break;
11957 55058 : case DataHVACGlobals::Coil_HeatingSteam: {
11958 : // this same CALL is made in the steam coil calc routine
11959 55058 : mdot = min(state.dataLoopNodes->Node(this->HeatCoilFluidOutletNodeNum).MassFlowRateMaxAvail, this->MaxHeatCoilFluidFlow * PartLoadRatio);
11960 55058 : if (this->m_sysType == SysType::PackagedAC || this->m_sysType == SysType::PackagedHP || this->m_sysType == SysType::PackagedWSHP) {
11961 : // tried this to resolve the PackagedTerminalAirConditioner steam spike issue, no help, but this is the correct way to do this
11962 55058 : PlantUtilities::SetComponentFlowRate(
11963 : state, mdot, this->HeatCoilFluidInletNode, this->HeatCoilFluidOutletNodeNum, this->HeatCoilPlantLoc);
11964 : } else {
11965 0 : state.dataLoopNodes->Node(this->HeatCoilFluidInletNode).MassFlowRate = mdot;
11966 : }
11967 165174 : SteamCoils::SimulateSteamCoilComponents(state,
11968 : CompName,
11969 : FirstHVACIteration,
11970 : this->m_HeatingCoilIndex,
11971 110116 : this->m_DesignHeatingCapacity * PartLoadRatio,
11972 : _,
11973 : this->m_FanOpMode,
11974 : PartLoadRatio);
11975 55058 : } break;
11976 286424 : case DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed:
11977 : case DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit: {
11978 286424 : if (this->m_HeatingSpeedNum > 1) {
11979 91989 : HeatPLR = 1.0;
11980 91989 : if (this->m_sysType == SysType::PackagedAC || this->m_sysType == SysType::PackagedHP || this->m_sysType == SysType::PackagedWSHP) {
11981 30188 : this->m_HeatingSpeedRatio = PartLoadRatio;
11982 : }
11983 : } else {
11984 194435 : HeatPLR = PartLoadRatio;
11985 : }
11986 :
11987 286424 : VariableSpeedCoils::SimVariableSpeedCoils(state,
11988 : CompName,
11989 : this->m_HeatingCoilIndex,
11990 : this->m_FanOpMode,
11991 : this->m_MaxONOFFCyclesperHour,
11992 : this->m_HPTimeConstant,
11993 : this->m_FanDelayTime,
11994 : CompressorOn,
11995 : HeatPLR,
11996 : this->m_HeatingSpeedNum,
11997 : this->m_HeatingSpeedRatio,
11998 : this->m_HeatingCoilSensDemand,
11999 : dummy,
12000 : OnOffAirFlowRatio);
12001 286424 : if (this->m_HeatingSpeedNum > 1) {
12002 91989 : this->m_HeatCompPartLoadRatio = 1.0;
12003 : } else {
12004 194435 : this->m_HeatCompPartLoadRatio = PartLoadRatio * double(CompressorOn);
12005 : }
12006 286424 : } break;
12007 576743 : case DataHVACGlobals::Coil_HeatingWaterToAirHPSimple: {
12008 : // WSHP coils do not have a PLF curve and do not adjust fan performance
12009 720041 : if (PartLoadRatio > 0.0 && this->m_WSHPRuntimeFrac > 0.0 && this->m_FanOpMode == DataHVACGlobals::CycFanCycCoil &&
12010 143298 : this->m_sysType != SysType::PackagedWSHP) { // used to match up to PTUnit results
12011 0 : state.dataHVACGlobal->OnOffFanPartLoadFraction = PartLoadRatio / this->m_WSHPRuntimeFrac;
12012 : }
12013 :
12014 576743 : WaterToAirHeatPumpSimple::SimWatertoAirHPSimple(state,
12015 : blankString,
12016 : this->m_HeatingCoilIndex,
12017 : this->m_HeatingCoilSensDemand,
12018 : dummy,
12019 : this->m_FanOpMode,
12020 : this->m_WSHPRuntimeFrac,
12021 : this->m_MaxONOFFCyclesperHour,
12022 : this->m_HPTimeConstant,
12023 : this->m_FanDelayTime,
12024 : CompressorOn,
12025 : PartLoadRatio,
12026 : FirstHVACIteration);
12027 576743 : this->m_HeatCompPartLoadRatio = PartLoadRatio * double(CompressorOn);
12028 576743 : } break;
12029 416586 : case DataHVACGlobals::Coil_HeatingWaterToAirHP: {
12030 416586 : this->heatPumpRunFrac(PartLoadRatio, errFlag, this->m_WSHPRuntimeFrac);
12031 :
12032 416586 : if (PartLoadRatio > 0.0 && this->m_WSHPRuntimeFrac > 0.0 && this->m_FanOpMode == DataHVACGlobals::CycFanCycCoil) {
12033 205056 : state.dataHVACGlobal->OnOffFanPartLoadFraction = PartLoadRatio / this->m_WSHPRuntimeFrac;
12034 : }
12035 :
12036 833172 : WaterToAirHeatPump::SimWatertoAirHP(state,
12037 : blankString,
12038 : this->m_HeatingCoilIndex,
12039 : this->MaxHeatAirMassFlow,
12040 : this->m_FanOpMode,
12041 : FirstHVACIteration,
12042 : this->m_WSHPRuntimeFrac,
12043 : this->m_MaxONOFFCyclesperHour,
12044 : this->m_HPTimeConstant,
12045 : this->m_FanDelayTime,
12046 416586 : this->m_InitHeatPump,
12047 : this->m_HeatingCoilSensDemand,
12048 : dummy,
12049 : CompressorOn,
12050 : PartLoadRatio);
12051 416586 : this->m_HeatCompPartLoadRatio = PartLoadRatio * double(CompressorOn);
12052 416586 : } break;
12053 0 : default: {
12054 0 : ShowFatalError(
12055 0 : state, "CalcUnitaryHeatingSystem: Invalid Unitary System coil type = " + DataHVACGlobals::cAllCoilTypes(this->m_HeatingCoilType_Num));
12056 0 : } break;
12057 : }
12058 :
12059 21328678 : this->m_HeatingPartLoadFrac = PartLoadRatio;
12060 21328678 : }
12061 :
12062 5445545 : void UnitarySys::calcUnitarySuppHeatingSystem(EnergyPlusData &state,
12063 : bool const FirstHVACIteration, // True when first HVAC iteration
12064 : Real64 const SuppCoilLoad // adjusted supp coil load when outlet temp exceeds max (W)
12065 : )
12066 : {
12067 :
12068 : // SUBROUTINE INFORMATION:
12069 : // AUTHOR Richard Raustad, FSEC
12070 : // DATE WRITTEN February 2013
12071 :
12072 : // PURPOSE OF THIS SUBROUTINE:
12073 : // This subroutine manages supplemental heater simulation.
12074 :
12075 : // SUBROUTINE PARAMETER DEFINITIONS:
12076 5445545 : int constexpr MaxIte(500); // Maximum number of iterations for solver
12077 5445545 : Real64 constexpr Acc(1.e-3); // Accuracy of solver result
12078 :
12079 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
12080 : // std::string CompName; // Name of Unitary System object
12081 : Real64 SuppHeatCoilLoad; // load passed to supplemental heating coil (W)
12082 : Real64 QActual; // actual coil output (W)
12083 : Real64 mdot; // water coil water mass flow rate (kg/s)
12084 10891090 : std::vector<Real64> Par; // Parameter array passed to solver
12085 : int SolFla; // Flag of solver, num iterations if >0, else error index
12086 : Real64 PartLoadFrac; // temporary PLR variable
12087 :
12088 5445545 : Par.resize(5);
12089 : // work is needed to figure out how to adjust other coil types if outlet temp exceeds maximum
12090 : // this works for gas and electric heating coils
12091 10891090 : std::string CompName = this->m_SuppHeatCoilName;
12092 10954372 : if (state.dataEnvrn->OutDryBulbTemp <= this->m_MaxOATSuppHeat ||
12093 3407138 : (state.dataUnitarySystems->MoistureLoad < 0.0 && this->m_CoolingPartLoadFrac > 0.0)) {
12094 2208627 : SuppHeatCoilLoad = SuppCoilLoad;
12095 : //} else {
12096 : // SuppHeatCoilLoad = this->m_DesignSuppHeatingCapacity * PartLoadRatio;
12097 : //}
12098 : } else {
12099 3236918 : SuppHeatCoilLoad = 0.0;
12100 : }
12101 5445545 : switch (this->m_SuppHeatCoilType_Num) {
12102 5445545 : case DataHVACGlobals::Coil_HeatingGasOrOtherFuel:
12103 : case DataHVACGlobals::Coil_HeatingElectric:
12104 : case DataHVACGlobals::Coil_HeatingElectric_MultiStage: {
12105 5445545 : switch (this->m_ControlType) {
12106 0 : case UnitarySysCtrlType::Setpoint: {
12107 0 : HeatingCoils::SimulateHeatingCoilComponents(state,
12108 : CompName,
12109 : FirstHVACIteration,
12110 : _,
12111 : this->m_SuppHeatCoilIndex,
12112 : _,
12113 : true,
12114 : this->m_FanOpMode,
12115 : this->m_SuppHeatPartLoadFrac,
12116 : this->m_SuppHeatingSpeedNum,
12117 : this->m_SuppHeatingSpeedRatio);
12118 0 : } break;
12119 5445545 : default: {
12120 5445545 : if (this->m_EMSOverrideSuppCoilSpeedNumOn) {
12121 456780 : if (SuppHeatCoilLoad > 0.0) {
12122 93584 : this->setEMSSuppCoilStagePLR(state);
12123 : } else {
12124 363196 : this->m_SuppHeatingSpeedRatio = 0.0;
12125 363196 : this->m_SuppHeatingCycRatio = 0.0;
12126 363196 : this->m_SuppHeatPartLoadFrac = 0.0;
12127 : }
12128 : } else {
12129 4988765 : if (this->m_SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingElectric_MultiStage) {
12130 1099980 : this->calcMultiStageSuppCoilStageByLoad(state, SuppHeatCoilLoad, FirstHVACIteration);
12131 : }
12132 : }
12133 5445545 : HeatingCoils::SimulateHeatingCoilComponents(state,
12134 : CompName,
12135 : FirstHVACIteration,
12136 : SuppHeatCoilLoad,
12137 : this->m_SuppHeatCoilIndex,
12138 : _,
12139 : true,
12140 : this->m_FanOpMode,
12141 : this->m_SuppHeatPartLoadFrac,
12142 : this->m_SuppHeatingSpeedNum,
12143 : this->m_SuppHeatingSpeedRatio);
12144 5445545 : } break;
12145 : }
12146 5445545 : } break;
12147 0 : case DataHVACGlobals::Coil_HeatingDesuperheater: {
12148 0 : HeatingCoils::SimulateHeatingCoilComponents(state,
12149 : CompName,
12150 : FirstHVACIteration,
12151 : SuppHeatCoilLoad,
12152 : this->m_SuppHeatCoilIndex,
12153 : _,
12154 : true,
12155 : this->m_FanOpMode,
12156 : this->m_SuppHeatPartLoadFrac);
12157 0 : } break;
12158 0 : case DataHVACGlobals::Coil_HeatingWater: {
12159 : // if (present(SuppCoilLoad)) {
12160 0 : if (SuppHeatCoilLoad > 0.0) {
12161 : // see if HW coil has enough capacity to meet the load
12162 0 : mdot = min(state.dataLoopNodes->Node(this->m_SuppCoilFluidOutletNodeNum).MassFlowRateMaxAvail, this->m_MaxSuppCoilFluidFlow);
12163 0 : state.dataLoopNodes->Node(this->m_SuppCoilFluidInletNode).MassFlowRate = mdot;
12164 : // simulate water coil to find operating capacity
12165 0 : WaterCoils::SimulateWaterCoilComponents(state,
12166 : this->m_SuppHeatCoilName,
12167 : FirstHVACIteration,
12168 : this->m_SuppHeatCoilIndex,
12169 : QActual,
12170 : this->m_FanOpMode,
12171 : this->m_SuppHeatPartLoadFrac);
12172 0 : if (QActual > SuppHeatCoilLoad) {
12173 0 : auto f = [&state, this, FirstHVACIteration, SuppHeatCoilLoad](Real64 const PartLoadFrac) {
12174 0 : Real64 mdot = min(state.dataLoopNodes->Node(this->m_SuppCoilFluidOutletNodeNum).MassFlowRateMaxAvail,
12175 0 : this->m_MaxSuppCoilFluidFlow * PartLoadFrac);
12176 0 : state.dataLoopNodes->Node(this->m_SuppCoilFluidInletNode).MassFlowRate = mdot;
12177 0 : WaterCoils::SimulateWaterCoilComponents(
12178 : state, this->m_SuppHeatCoilName, FirstHVACIteration, this->m_SuppHeatCoilIndex, 0.0, this->m_FanOpMode, PartLoadFrac);
12179 0 : return SuppHeatCoilLoad;
12180 0 : };
12181 :
12182 0 : General::SolveRoot(state, Acc, MaxIte, SolFla, PartLoadFrac, f, 0.0, 1.0);
12183 0 : this->m_SuppHeatPartLoadFrac = PartLoadFrac;
12184 : } else {
12185 0 : this->m_SuppHeatPartLoadFrac = 1.0;
12186 : }
12187 : }
12188 0 : } break;
12189 0 : case DataHVACGlobals::Coil_HeatingSteam: {
12190 0 : mdot = min(state.dataLoopNodes->Node(this->m_SuppCoilFluidOutletNodeNum).MassFlowRateMaxAvail,
12191 0 : this->m_MaxSuppCoilFluidFlow * this->m_SuppHeatPartLoadFrac);
12192 0 : state.dataLoopNodes->Node(this->m_SuppCoilFluidInletNode).MassFlowRate = mdot;
12193 0 : SteamCoils::SimulateSteamCoilComponents(
12194 : state, CompName, FirstHVACIteration, this->m_SuppHeatCoilIndex, SuppHeatCoilLoad, _, this->m_FanOpMode, this->m_SuppHeatPartLoadFrac);
12195 0 : } break;
12196 0 : default:
12197 0 : break;
12198 : }
12199 5445545 : }
12200 :
12201 93584 : void UnitarySys::setEMSSuppCoilStagePLR(EnergyPlusData &state)
12202 : {
12203 93584 : bool useMaxedSpeed = false;
12204 93584 : int SpeedNumEMS = ceil(this->m_EMSOverrideSuppCoilSpeedNumValue);
12205 93584 : if (SpeedNumEMS > this->m_NumOfSpeedSuppHeating) {
12206 0 : SpeedNumEMS = this->m_NumOfSpeedSuppHeating;
12207 0 : useMaxedSpeed = true;
12208 : }
12209 93584 : this->m_SuppHeatingSpeedNum = SpeedNumEMS;
12210 93584 : if (useMaxedSpeed) {
12211 0 : this->m_CoilSpeedErrIdx++;
12212 0 : ShowRecurringWarningErrorAtEnd(state,
12213 0 : format("Wrong coil speed EMS override value, for unit=\"{}\". Exceeding maximum coil speed "
12214 : "level. Speed level is set to the maximum coil speed level allowed.",
12215 0 : this->m_SuppHeatCoilName),
12216 : this->m_CoilSpeedErrIdx,
12217 : this->m_EMSOverrideSuppCoilSpeedNumValue,
12218 : this->m_EMSOverrideSuppCoilSpeedNumValue,
12219 : _,
12220 : "",
12221 : "");
12222 : }
12223 93584 : if (this->m_SuppHeatingSpeedNum == 1) {
12224 16 : this->m_SuppHeatingSpeedRatio = 0.0;
12225 16 : this->m_SuppHeatingCycRatio = this->m_EMSOverrideSuppCoilSpeedNumValue - floor(this->m_EMSOverrideSuppCoilSpeedNumValue);
12226 16 : if (useMaxedSpeed || this->m_SuppHeatingCycRatio == 0) {
12227 16 : this->m_SuppHeatingCycRatio = 1;
12228 : }
12229 16 : this->m_SuppHeatPartLoadFrac = this->m_SuppHeatingCycRatio;
12230 : } else {
12231 93568 : this->m_SuppHeatingCycRatio = 1.0;
12232 93568 : this->m_SuppHeatingSpeedRatio = this->m_EMSOverrideSuppCoilSpeedNumValue - floor(this->m_EMSOverrideSuppCoilSpeedNumValue);
12233 93568 : if (useMaxedSpeed || this->m_SuppHeatingSpeedRatio == 0) {
12234 0 : this->m_SuppHeatingSpeedRatio = 1;
12235 : }
12236 93568 : this->m_SuppHeatPartLoadFrac = this->m_SuppHeatingSpeedRatio;
12237 : }
12238 93584 : }
12239 :
12240 3553043 : void UnitarySys::controlCoolingSystemToSP(EnergyPlusData &state,
12241 : int const AirLoopNum, // index to air loop
12242 : bool const FirstHVACIteration, // First HVAC iteration flag
12243 : bool &HXUnitOn, // flag to enable heat exchanger heat recovery
12244 : DataHVACGlobals::CompressorOperation &CompressorOp // compressor on/off control
12245 : )
12246 : {
12247 : // SUBROUTINE INFORMATION:
12248 : // AUTHOR Richard Raustad, FSEC
12249 : // DATE WRITTEN February 2013
12250 : // MODIFIED Nov. 2016, R. Zhang, LBNL. Applied the coil supply air temperature sensor offset fault model
12251 :
12252 : // PURPOSE OF THIS SUBROUTINE:
12253 : // Simulate the coil object at the required PLR.
12254 :
12255 : // METHODOLOGY EMPLOYED:
12256 : // Calculate operating PLR and adjust speed when using multispeed coils.
12257 : // Meet moisture load if required to do so.
12258 :
12259 : // SUBROUTINE PARAMETER DEFINITIONS:
12260 3553043 : int constexpr MaxIte(500); // Maximum number of iterations for solver
12261 3553043 : Real64 constexpr Acc(1.e-3); // Accuracy of solver result
12262 3553043 : Real64 constexpr HumRatAcc(1.e-6); // Accuracy of solver result
12263 :
12264 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
12265 : Real64 ReqOutput; // Sensible capacity (outlet - inlet) required to meet load or setpoint temperature
12266 : // for variable speed or 2 speed compressors
12267 : Real64 OutletTempDXCoil; // Actual outlet temperature of the DX cooling coil
12268 : Real64 OutletHumRatLS; // Actual outlet humrat of the variable speed DX cooling coil at low speed
12269 : Real64 OutletHumRatHS; // Actual outlet humrat of the variable speed DX cooling coil at high speed
12270 : Real64 OutletHumRatDXCoil; // Actual outlet humidity ratio of the DX cooling coil
12271 : Real64 TempMinPLR; // Used to find latent PLR when max iterations exceeded
12272 : Real64 TempMaxPLR; // Used to find latent PLR when max iterations exceeded
12273 : Real64 TempOutletTempDXCoil; // Used to find latent PLR when max iterations exceeded
12274 : Real64 OutletTemp;
12275 : bool HeatingActive; // dummy variable for UserDefined coil which are passed back indicating if coil is on or off.
12276 : bool CoolingActive; // dummy variable for UserDefined coil which are passed back indicating if coil is on or off.
12277 : Real64 OutdoorDryBulb; // local variable for OutDryBulbTemp
12278 : Real64 maxPartLoadFrac; // calculated maximum water side PLR for RegulaFalsi call (when plant limits flow max PLR != 1)
12279 :
12280 : // Set local variables
12281 : // Retrieve the load on the controlled zone
12282 3553043 : int OutletNode = this->CoolCoilOutletNodeNum;
12283 3553043 : int InletNode = this->CoolCoilInletNodeNum;
12284 3553043 : Real64 DesOutTemp = this->m_DesiredOutletTemp;
12285 3553043 : Real64 DesOutHumRat = this->m_DesiredOutletHumRat;
12286 3553043 : int CoilType_Num = this->m_CoolingCoilType_Num;
12287 3553043 : Real64 LoopDXCoilMaxRTFSave = 0.0;
12288 3553043 : if (state.afn->distribution_simulated) {
12289 124385 : LoopDXCoilMaxRTFSave = state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).AFNLoopDXCoilRTF;
12290 124385 : state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).AFNLoopDXCoilRTF = 0.0;
12291 : }
12292 :
12293 7106086 : std::string CompName = this->m_CoolingCoilName;
12294 3553043 : int FanOpMode = this->m_FanOpMode;
12295 3553043 : Real64 SpeedRatio = 0.0;
12296 3553043 : int SpeedNum = 0;
12297 3553043 : Real64 CycRatio = 0.0;
12298 3553043 : Real64 PartLoadFrac = 0.0;
12299 3553043 : int DehumidMode = 0;
12300 3553043 : bool SensibleLoad = false;
12301 3553043 : bool LatentLoad = false;
12302 3553043 : Real64 m_WSHPRuntimeFrac = 0.0;
12303 3553043 : Real64 dummy = 0.0;
12304 3553043 : Real64 SensLoad = 0.0;
12305 3553043 : int SolFla = 0;
12306 3553043 : int SolFlaLat = 0;
12307 3553043 : Real64 NoLoadTempOut = 0.0;
12308 3553043 : Real64 NoLoadHumRatOut = 0.0;
12309 : // #8849, FullLoadHumRatOut set only at max speed
12310 3553043 : Real64 FullLoadHumRatOut = 0.0;
12311 3553043 : Real64 FullOutput = 0.0; // Sensible capacity (outlet - inlet) when the compressor is on
12312 3553043 : Real64 OnOffAirFlowRatio = 0.0; // Autodesk:Init Patch to prevent use uninitialized in calls to SimVariableSpeedCoils
12313 3553043 : Real64 mdot = 0.0; // water coil water flow rate [kg/s]
12314 :
12315 3553043 : if (this->m_CondenserNodeNum != 0) {
12316 149442 : OutdoorDryBulb = state.dataLoopNodes->Node(this->m_CondenserNodeNum).Temp;
12317 : } else {
12318 3403601 : OutdoorDryBulb = state.dataEnvrn->OutDryBulbTemp;
12319 : }
12320 :
12321 : // Check the dehumidification control type. IF it's multimode, turn off the HX to find the sensible PLR. Then check to
12322 : // see if the humidity load is met without the use of the HX. Always run the HX for the other modes.
12323 3553043 : if (this->m_DehumidControlType_Num != DehumCtrlType::Multimode && this->m_CoolingCoilType_Num != DataHVACGlobals::CoilDX_Cooling) {
12324 3458933 : HXUnitOn = true;
12325 : } else {
12326 94110 : HXUnitOn = false;
12327 : }
12328 :
12329 : // IF there is a fault of coil SAT Sensor
12330 3553043 : if (this->m_FaultyCoilSATFlag) {
12331 : // calculate the sensor offset using fault information
12332 0 : int FaultIndex = this->m_FaultyCoilSATIndex;
12333 0 : this->m_FaultyCoilSATOffset = state.dataFaultsMgr->FaultsCoilSATSensor(FaultIndex).CalFaultOffsetAct(state);
12334 : // update the DesOutTemp
12335 0 : DesOutTemp -= this->m_FaultyCoilSATOffset;
12336 : }
12337 :
12338 : // IF UnitarySystem is scheduled on and there is flow
12339 10324329 : if ((ScheduleManager::GetCurrentScheduleValue(state, this->m_SysAvailSchedPtr) > 0.0) &&
12340 6744348 : ScheduleManager::GetCurrentScheduleValue(state, this->m_CoolingCoilAvailSchPtr) > 0.0 &&
12341 3191305 : (state.dataLoopNodes->Node(InletNode).MassFlowRate > DataHVACGlobals::SmallAirVolFlow)) {
12342 :
12343 2636125 : bool unitSys = false;
12344 2636125 : Real64 tempHumRatAcc = HumRatAcc;
12345 2636125 : Real64 tempAcc = Acc;
12346 : // Determine if there is a sensible load on this system
12347 2636125 : if (this->m_sysType == SysType::CoilCoolingDX) {
12348 6311935 : if ((state.dataLoopNodes->Node(InletNode).Temp > state.dataLoopNodes->Node(this->CoolCtrlNode).TempSetPoint) &&
12349 3797065 : (state.dataLoopNodes->Node(InletNode).Temp > DesOutTemp) &&
12350 1298729 : (std::abs(state.dataLoopNodes->Node(InletNode).Temp - DesOutTemp) > DataHVACGlobals::TempControlTol)) {
12351 1126624 : SensibleLoad = true;
12352 : }
12353 2498336 : tempAcc = 0.0;
12354 2498336 : tempHumRatAcc = 0.0;
12355 : } else {
12356 137789 : unitSys = true;
12357 137789 : if (state.dataLoopNodes->Node(InletNode).Temp - DesOutTemp > DataHVACGlobals::TempControlTol) SensibleLoad = true;
12358 : }
12359 :
12360 : // if a heat pump and other coil is on, disable this coil
12361 2636125 : if (this->m_HeatPump && this->m_HeatingPartLoadFrac > 0.0) SensibleLoad = false;
12362 :
12363 : // Determine if there is a latent load on this system - for future use to serve latent-only loads
12364 2636125 : if (this->m_sysType == SysType::CoilCoolingDX) {
12365 4973074 : if ((state.dataLoopNodes->Node(InletNode).HumRat > state.dataLoopNodes->Node(InletNode).HumRatMax) &&
12366 2474738 : (state.dataLoopNodes->Node(InletNode).HumRat > DesOutHumRat))
12367 11617 : LatentLoad = true;
12368 : } else {
12369 137789 : if (state.dataLoopNodes->Node(InletNode).HumRat > DesOutHumRat) LatentLoad = true;
12370 : }
12371 :
12372 : // disable latent dehumidification if there is no sensible load and latent only is not allowed
12373 2636125 : if (this->m_RunOnLatentOnlyWithSensible && !SensibleLoad) LatentLoad = false;
12374 :
12375 : // disable compressor if OAT is below minimum outdoor temperature
12376 2636125 : if (OutdoorDryBulb < this->m_MinOATCompressorCooling) {
12377 0 : SensibleLoad = false;
12378 0 : LatentLoad = false;
12379 : }
12380 :
12381 : // activate heat recovery loop coil if scheduled on and there is air flow
12382 2636125 : if (this->m_WaterHRPlantLoopModel) {
12383 16212 : if (this->temperatureOffsetControlStatus == 1) {
12384 1 : PartLoadFrac = 1.0;
12385 1 : mdot = this->MaxCoolCoilFluidFlow;
12386 : }
12387 16212 : if (this->CoolCoilPlantLoc.loopNum > 0) {
12388 16212 : PlantUtilities::SetComponentFlowRate(
12389 : state, mdot, this->CoolCoilFluidInletNode, this->CoolCoilFluidOutletNodeNum, this->CoolCoilPlantLoc);
12390 : }
12391 :
12392 16212 : WaterCoils::SimulateWaterCoilComponents(
12393 : state, CompName, FirstHVACIteration, this->m_CoolingCoilIndex, _, this->m_FanOpMode, PartLoadFrac);
12394 16212 : SensibleLoad = false; // fall through remaining checks
12395 16212 : LatentLoad = false;
12396 2619913 : } else if (this->m_TemperatureOffsetControlActive) {
12397 : // disable waterside economizer if the condition is NOT favorable
12398 38346 : if (this->temperatureOffsetControlStatus == 0) {
12399 37720 : SensibleLoad = false;
12400 37720 : LatentLoad = false;
12401 37720 : HXUnitOn = false;
12402 : }
12403 : }
12404 :
12405 : // IF DXCoolingSystem runs with a cooling load then set PartLoadFrac on Cooling System and the Mass Flow
12406 : // Multimode coil will switch to enhanced dehumidification IF available and needed, but it
12407 : // still runs to meet the sensible load. Multimode applies to Multimode or HXAssistedCooling coils.
12408 2636125 : if ((SensibleLoad && this->m_RunOnSensibleLoad) || (LatentLoad && this->m_RunOnLatentLoad)) {
12409 : // calculate sensible PLR, don't care IF latent is true here but need to gaurd for
12410 : // when LatentLoad=TRUE and SensibleLoad=FALSE
12411 2392076 : ReqOutput = state.dataLoopNodes->Node(InletNode).MassFlowRate *
12412 3588114 : Psychrometrics::PsyDeltaHSenFnTdb2W2Tdb1W1(DesOutTemp,
12413 1196038 : state.dataLoopNodes->Node(OutletNode).HumRat,
12414 1196038 : state.dataLoopNodes->Node(InletNode).Temp,
12415 1196038 : state.dataLoopNodes->Node(InletNode).HumRat);
12416 :
12417 1196038 : PartLoadFrac = 0.0;
12418 1196038 : CompressorOp = DataHVACGlobals::CompressorOperation::Off;
12419 :
12420 1196038 : if (this->m_EMSOverrideCoilSpeedNumOn &&
12421 21022 : (CoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedCooling || CoilType_Num == DataHVACGlobals::CoilDX_Cooling)) {
12422 21022 : this->m_CoolingSpeedNum = ceil(this->m_EMSOverrideCoilSpeedNumValue);
12423 21022 : this->m_SpeedNum = this->m_CoolingSpeedNum;
12424 21022 : bool useMaxedSpeed = false;
12425 21022 : if (this->m_SpeedNum > this->m_NumOfSpeedCooling) {
12426 0 : this->m_CoolingSpeedNum = this->m_NumOfSpeedCooling;
12427 0 : this->m_SpeedNum = this->m_NumOfSpeedCooling;
12428 0 : CycRatio = this->m_CoolingCycRatio = 1.0;
12429 0 : PartLoadFrac = SpeedRatio = this->m_CoolingSpeedRatio = 1.0;
12430 0 : useMaxedSpeed = true;
12431 0 : if (this->m_CoilSpeedErrIdx == 0) {
12432 0 : ShowWarningMessage(state, "Wrong coil speed EMS override value, for unit=\"" + this->m_CoolingCoilName);
12433 0 : ShowContinueError(state,
12434 : " Exceeding maximum coil speed level. Speed level is set to the maximum coil speed level allowed.");
12435 : }
12436 0 : ShowRecurringWarningErrorAtEnd(
12437 : state,
12438 0 : "Wrong coil speed EMS override value, for unit=\"" + this->m_CoolingCoilName +
12439 : "\". Exceeding maximum coil speed level. Speed level is set to the maximum coil speed level allowed.",
12440 : this->m_CoilSpeedErrIdx,
12441 : this->m_EMSOverrideCoilSpeedNumValue,
12442 : this->m_EMSOverrideCoilSpeedNumValue,
12443 : _,
12444 : "",
12445 : "");
12446 : }
12447 :
12448 21022 : if (this->m_SpeedNum < 0) {
12449 0 : this->m_CoolingSpeedNum = 0;
12450 0 : this->m_SpeedNum = 0;
12451 0 : CycRatio = this->m_CoolingCycRatio = 0.0;
12452 0 : PartLoadFrac = SpeedRatio = this->m_CoolingSpeedRatio = 0.0;
12453 0 : if (this->m_CoilSpeedErrIdx == 0) {
12454 0 : ShowWarningMessage(state, "Wrong coil speed EMS override value, for unit=\"" + this->m_CoolingCoilName);
12455 0 : ShowContinueError(state, " Input speed value is below zero. Speed level is set to zero.");
12456 : }
12457 0 : ShowRecurringWarningErrorAtEnd(state,
12458 0 : "Wrong coil speed EMS override value, for unit=\"" + this->m_CoolingCoilName +
12459 : "\". Input speed value is below zero. Speed level is set to zero.",
12460 : this->m_CoilSpeedErrIdx,
12461 : this->m_EMSOverrideCoilSpeedNumValue,
12462 : this->m_EMSOverrideCoilSpeedNumValue,
12463 : _,
12464 : "",
12465 : "");
12466 : }
12467 :
12468 21022 : if (this->m_CoolingSpeedNum == 1) {
12469 3229 : SpeedRatio = this->m_CoolingSpeedRatio = 0.0;
12470 3229 : CycRatio = this->m_CoolingCycRatio = this->m_EMSOverrideCoilSpeedNumValue - floor(this->m_EMSOverrideCoilSpeedNumValue);
12471 3229 : if (useMaxedSpeed || this->m_CoolingCycRatio == 0) {
12472 3229 : CycRatio = this->m_CoolingCycRatio = 1;
12473 : }
12474 3229 : PartLoadFrac = this->m_CoolingCycRatio;
12475 : } else {
12476 17793 : CycRatio = this->m_CoolingCycRatio = 1.0;
12477 17793 : SpeedRatio = this->m_CoolingSpeedRatio = this->m_EMSOverrideCoilSpeedNumValue - floor(this->m_EMSOverrideCoilSpeedNumValue);
12478 17793 : if (useMaxedSpeed || this->m_CoolingSpeedRatio == 0) {
12479 0 : SpeedRatio = this->m_CoolingSpeedRatio = 1;
12480 : }
12481 17793 : PartLoadFrac = this->m_CoolingSpeedRatio;
12482 : }
12483 21022 : this->m_CoolCompPartLoadRatio = PartLoadFrac;
12484 21022 : if (CoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedCooling) {
12485 0 : this->simMultiSpeedCoils(state,
12486 : AirLoopNum,
12487 : FirstHVACIteration,
12488 : CompressorOp,
12489 : SensibleLoad,
12490 : LatentLoad,
12491 : PartLoadFrac,
12492 : CoolingCoil,
12493 : this->m_SpeedNum);
12494 0 : OutletTemp = state.dataLoopNodes->Node(OutletNode).Temp;
12495 0 : if (SpeedNum == this->m_NumOfSpeedCooling) {
12496 0 : FullLoadHumRatOut = state.dataLoopNodes->Node(OutletNode).HumRat;
12497 : }
12498 : } else {
12499 21022 : int OperationMode = DataHVACGlobals::coilNormalMode;
12500 21022 : if (state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].SubcoolReheatFlag) {
12501 0 : OperationMode = DataHVACGlobals::coilSubcoolReheatMode;
12502 21022 : } else if (this->m_DehumidificationMode == 1) {
12503 0 : OperationMode = DataHVACGlobals::coilEnhancedMode;
12504 : }
12505 21022 : bool const singleMode = (this->m_SingleMode == 1);
12506 21022 : state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate(
12507 : state, OperationMode, PartLoadFrac, this->m_CoolingSpeedNum, this->m_CoolingSpeedRatio, this->m_FanOpMode, singleMode);
12508 21022 : }
12509 :
12510 1175016 : } else if (CoilType_Num == DataHVACGlobals::CoilDX_CoolingSingleSpeed) { // COIL:DX:COOLINGBYPASSFACTOREMPIRICAL
12511 699920 : this->m_CompPartLoadRatio = PartLoadFrac;
12512 :
12513 699920 : DXCoils::SimDXCoil(state,
12514 : CompName,
12515 : DataHVACGlobals::CompressorOperation::On,
12516 : FirstHVACIteration,
12517 : this->m_CoolingCoilIndex,
12518 : FanOpMode,
12519 : PartLoadFrac);
12520 :
12521 475096 : } else if ((CoilType_Num == DataHVACGlobals::CoilDX_CoolingHXAssisted) ||
12522 : (CoilType_Num == DataHVACGlobals::CoilWater_CoolingHXAssisted)) { // CoilSystem:Cooling:DX:HeatExchangerAssisted
12523 :
12524 9946 : if (this->CoolCoilFluidInletNode > 0) state.dataLoopNodes->Node(this->CoolCoilFluidInletNode).MassFlowRate = 0.0;
12525 :
12526 19892 : HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil(state,
12527 : CompName,
12528 : FirstHVACIteration,
12529 : DataHVACGlobals::CompressorOperation::On,
12530 : PartLoadFrac,
12531 : this->m_CoolingCoilIndex,
12532 : FanOpMode,
12533 : HXUnitOn,
12534 : _,
12535 9946 : state.dataUnitarySystems->economizerFlag,
12536 : _,
12537 : this->m_DehumidificationMode,
12538 : 0.0); // this->CoilSHR);
12539 9946 : if (CoilType_Num == DataHVACGlobals::CoilDX_CoolingHXAssisted) this->m_CompPartLoadRatio = PartLoadFrac;
12540 465150 : } else if (CoilType_Num == DataHVACGlobals::CoilDX_CoolingTwoSpeed) {
12541 :
12542 402304 : DXCoils::SimDXCoilMultiSpeed(state, CompName, 0.0, PartLoadFrac, this->m_CoolingCoilIndex);
12543 :
12544 62846 : } else if (CoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedCooling) {
12545 5209 : this->simMultiSpeedCoils(
12546 : state, AirLoopNum, FirstHVACIteration, CompressorOp, SensibleLoad, LatentLoad, PartLoadFrac, CoolingCoil, this->m_SpeedNum);
12547 :
12548 57637 : } else if ((CoilType_Num == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) ||
12549 : (CoilType_Num == DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit)) {
12550 :
12551 13630 : this->m_CoolingCoilSensDemand = ReqOutput;
12552 27260 : VariableSpeedCoils::SimVariableSpeedCoils(state,
12553 : "",
12554 : this->m_CoolingCoilIndex,
12555 : FanOpMode,
12556 : this->m_MaxONOFFCyclesperHour,
12557 : this->m_HPTimeConstant,
12558 : this->m_FanDelayTime,
12559 : CompressorOp,
12560 : CycRatio,
12561 : SpeedNum,
12562 : SpeedRatio,
12563 : SensLoad,
12564 : dummy,
12565 13630 : OnOffAirFlowRatio);
12566 :
12567 44007 : } else if (CoilType_Num == DataHVACGlobals::CoilDX_CoolingTwoStageWHumControl) {
12568 :
12569 10974 : DXCoils::SimDXCoilMultiMode(state,
12570 : CompName,
12571 : DataHVACGlobals::CompressorOperation::On,
12572 : FirstHVACIteration,
12573 : PartLoadFrac,
12574 : DehumidMode,
12575 : this->m_CoolingCoilIndex,
12576 : FanOpMode);
12577 10974 : this->m_CompPartLoadRatio = PartLoadFrac;
12578 33033 : } else if (CoilType_Num == DataHVACGlobals::CoilDX_Cooling) { // CoilCoolingDX
12579 : // SP control (tentatively) operates at constant air flow regardless of speed
12580 : // speed n uses MSHPMassFlowRateHigh and speed n-1 uses MSHPMassFlowRateLow
12581 25926 : state.dataHVACGlobal->MSHPMassFlowRateLow = this->m_DesignMassFlowRate;
12582 25926 : state.dataHVACGlobal->MSHPMassFlowRateHigh = this->m_DesignMassFlowRate;
12583 25926 : int OperationMode = DataHVACGlobals::coilNormalMode;
12584 25926 : if (state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].SubcoolReheatFlag) {
12585 0 : OperationMode = DataHVACGlobals::coilSubcoolReheatMode;
12586 25926 : } else if (this->m_DehumidificationMode == 1) {
12587 0 : OperationMode = DataHVACGlobals::coilEnhancedMode;
12588 : }
12589 25926 : bool const singleMode = (this->m_SingleMode == 1);
12590 25926 : state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate(
12591 : state, OperationMode, PartLoadFrac, this->m_CoolingSpeedNum, this->m_CoolingSpeedRatio, this->m_FanOpMode, singleMode);
12592 25926 : this->m_CoolCompPartLoadRatio = PartLoadFrac;
12593 7107 : } else if ((CoilType_Num == DataHVACGlobals::Coil_CoolingWater) ||
12594 : (CoilType_Num == DataHVACGlobals::Coil_CoolingWaterDetailed)) { // COIL:COOLING:WATER
12595 :
12596 576 : WaterCoils::SimulateWaterCoilComponents(
12597 : state, CompName, FirstHVACIteration, this->m_CoolingCoilIndex, _, this->m_FanOpMode, PartLoadFrac);
12598 :
12599 6531 : } else if (CoilType_Num == DataHVACGlobals::Coil_CoolingWaterToAirHPSimple) {
12600 :
12601 0 : WaterToAirHeatPumpSimple::SimWatertoAirHPSimple(state,
12602 : blankString,
12603 : this->m_CoolingCoilIndex,
12604 : ReqOutput,
12605 : dummy,
12606 : FanOpMode,
12607 : m_WSHPRuntimeFrac,
12608 : this->m_MaxONOFFCyclesperHour,
12609 : this->m_HPTimeConstant,
12610 : this->m_FanDelayTime,
12611 : DataHVACGlobals::CompressorOperation::Off,
12612 : PartLoadFrac,
12613 : FirstHVACIteration);
12614 0 : this->m_CoolingCoilSensDemand = 0.0;
12615 :
12616 6531 : } else if (CoilType_Num == DataHVACGlobals::Coil_CoolingWaterToAirHP) {
12617 :
12618 0 : WaterToAirHeatPump::SimWatertoAirHP(state,
12619 : blankString,
12620 : this->m_CoolingCoilIndex,
12621 : this->MaxCoolAirMassFlow,
12622 : FanOpMode,
12623 : FirstHVACIteration,
12624 : m_WSHPRuntimeFrac,
12625 : this->m_MaxONOFFCyclesperHour,
12626 : this->m_HPTimeConstant,
12627 : this->m_FanDelayTime,
12628 0 : this->m_InitHeatPump,
12629 : ReqOutput,
12630 : dummy,
12631 : DataHVACGlobals::CompressorOperation::Off,
12632 : PartLoadFrac);
12633 :
12634 6531 : } else if (CoilType_Num == DataHVACGlobals::Coil_UserDefined) {
12635 :
12636 0 : HeatingActive = false; // set to arbitrary value on entry to function
12637 0 : CoolingActive = true; // set to arbitrary value on entry to function
12638 0 : UserDefinedComponents::SimCoilUserDefined(state, CompName, this->m_CoolingCoilIndex, AirLoopNum, HeatingActive, CoolingActive);
12639 0 : if (CoolingActive) PartLoadFrac = 1.0;
12640 :
12641 6531 : } else if (CoilType_Num == DataHVACGlobals::CoilDX_PackagedThermalStorageCooling) {
12642 :
12643 6531 : PackagedThermalStorageCoil::SimTESCoil(state, CompName, this->m_CoolingCoilIndex, FanOpMode, this->m_TESOpMode, PartLoadFrac);
12644 :
12645 : } else {
12646 : }
12647 :
12648 1196038 : NoLoadTempOut = state.dataLoopNodes->Node(OutletNode).Temp;
12649 1196038 : NoLoadHumRatOut = state.dataLoopNodes->Node(OutletNode).HumRat;
12650 :
12651 1196038 : Real64 NoOutput = 0.0; // CoilSystem:Cooling:DX
12652 1196038 : Real64 ReqOutput = 0.0;
12653 1196038 : FullOutput = 0.0;
12654 1196038 : if (this->m_sysType == SysType::CoilCoolingDX) {
12655 2253248 : NoOutput = state.dataLoopNodes->Node(InletNode).MassFlowRate *
12656 2253248 : (Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(OutletNode).Temp, state.dataLoopNodes->Node(OutletNode).HumRat) -
12657 1126624 : Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(InletNode).Temp, state.dataLoopNodes->Node(OutletNode).HumRat));
12658 2253248 : ReqOutput = state.dataLoopNodes->Node(InletNode).MassFlowRate *
12659 2253248 : (Psychrometrics::PsyHFnTdbW(DesOutTemp, state.dataLoopNodes->Node(OutletNode).HumRat) -
12660 1126624 : Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(InletNode).Temp, state.dataLoopNodes->Node(OutletNode).HumRat));
12661 : }
12662 :
12663 : // Changed logic to use temperature instead of load. The Psyc calcs can cause slight errors.
12664 : // For example it's possible that (NoOutput-ReqOutput) > Acc while (Node(OutletNode)%Temp-DesOutTemp) is not
12665 : // This can (and did) lead to RegulaFalsi errors
12666 :
12667 : // IF ((NoOutput-ReqOutput) .LT. Acc) THEN
12668 : // IF outlet temp at no load is lower than DesOutTemp (set point), do not operate the coil
12669 : // and if coolReheat, check hum rat as well
12670 1196038 : bool doIt = false; // CoilSystem:Cooling:DX
12671 1196038 : if (this->m_sysType == SysType::CoilCoolingDX) {
12672 1126624 : if ((NoOutput - ReqOutput) < Acc) {
12673 0 : PartLoadFrac = 0.0;
12674 : } else {
12675 1126624 : doIt = true;
12676 : }
12677 69414 : } else if (((NoLoadTempOut - DesOutTemp) < Acc) && ((NoLoadHumRatOut - DesOutHumRat) < HumRatAcc)) {
12678 388 : PartLoadFrac = 0.0;
12679 : } else { // need to turn on compressor to see if load is met
12680 69026 : doIt = true; // CoilSystem:Cooling:DX
12681 : } // CoilSystem:Cooling:DX
12682 1196038 : if (this->m_EMSOverrideCoilSpeedNumOn) doIt = false;
12683 :
12684 1196038 : if (doIt) { // CoilSystem:Cooling:DX
12685 1175016 : PartLoadFrac = 1.0;
12686 1175016 : CompressorOp = DataHVACGlobals::CompressorOperation::On;
12687 1175016 : m_WSHPRuntimeFrac = 1.0;
12688 :
12689 1175016 : if (CoilType_Num == DataHVACGlobals::CoilDX_CoolingSingleSpeed) { // COIL:DX:COOLINGBYPASSFACTOREMPIRICAL
12690 :
12691 699920 : DXCoils::SimDXCoil(state,
12692 : CompName,
12693 : DataHVACGlobals::CompressorOperation::On,
12694 : FirstHVACIteration,
12695 : this->m_CoolingCoilIndex,
12696 : FanOpMode,
12697 : PartLoadFrac);
12698 699920 : this->m_CompPartLoadRatio = PartLoadFrac;
12699 699920 : FullLoadHumRatOut = state.dataLoopNodes->Node(OutletNode).HumRat;
12700 :
12701 475096 : } else if ((CoilType_Num == DataHVACGlobals::CoilDX_CoolingHXAssisted) ||
12702 : (CoilType_Num == DataHVACGlobals::CoilWater_CoolingHXAssisted)) { // CoilSystem:Cooling:DX:HeatExchangerAssisted
12703 :
12704 9946 : if (this->CoolCoilFluidInletNode > 0)
12705 0 : state.dataLoopNodes->Node(this->CoolCoilFluidInletNode).MassFlowRate = max(0.0, this->MaxCoolCoilFluidFlow);
12706 19892 : HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil(state,
12707 : CompName,
12708 : FirstHVACIteration,
12709 : DataHVACGlobals::CompressorOperation::On,
12710 : PartLoadFrac,
12711 : this->m_CoolingCoilIndex,
12712 : FanOpMode,
12713 : HXUnitOn,
12714 : _,
12715 9946 : state.dataUnitarySystems->economizerFlag,
12716 : _,
12717 : this->m_DehumidificationMode,
12718 : 0.0); // this->CoilSHR);
12719 :
12720 9946 : if (CoilType_Num == DataHVACGlobals::CoilDX_CoolingHXAssisted) this->m_CompPartLoadRatio = PartLoadFrac;
12721 9946 : FullLoadHumRatOut = state.dataLoopNodes->Node(OutletNode).HumRat;
12722 :
12723 465150 : } else if (CoilType_Num == DataHVACGlobals::CoilDX_CoolingTwoSpeed) {
12724 :
12725 402304 : CycRatio = 1.0;
12726 755162 : for (int speedRatio = 0; speedRatio < this->m_NumOfSpeedCooling; ++speedRatio) {
12727 755162 : SpeedRatio = Real64(speedRatio);
12728 755162 : DXCoils::SimDXCoilMultiSpeed(state, CompName, SpeedRatio, CycRatio, this->m_CoolingCoilIndex);
12729 755162 : OutletTemp = state.dataDXCoils->DXCoilOutletTemp(this->m_CoolingCoilIndex);
12730 755162 : if (SpeedRatio == 1) {
12731 352858 : FullLoadHumRatOut = state.dataDXCoils->DXCoilOutletHumRat(this->m_CoolingCoilIndex);
12732 352858 : break;
12733 : }
12734 402304 : if (OutletTemp < DesOutTemp && SensibleLoad) break;
12735 : }
12736 :
12737 62846 : } else if (CoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedCooling) {
12738 :
12739 5209 : CycRatio = 1.0;
12740 5209 : SpeedRatio = 0.0;
12741 15584 : for (SpeedNum = 1; SpeedNum <= this->m_NumOfSpeedCooling; ++SpeedNum) {
12742 10397 : if (SpeedNum > 1) CycRatio = 0.0;
12743 10397 : if (SpeedNum > 1) SpeedRatio = 1.0;
12744 10397 : this->m_CoolingSpeedNum = SpeedNum;
12745 10397 : this->simMultiSpeedCoils(
12746 : state, AirLoopNum, FirstHVACIteration, CompressorOp, SensibleLoad, LatentLoad, PartLoadFrac, CoolingCoil, SpeedNum);
12747 10397 : OutletTemp = state.dataLoopNodes->Node(OutletNode).Temp;
12748 10397 : if (SpeedNum == this->m_NumOfSpeedCooling) {
12749 5188 : FullLoadHumRatOut = state.dataLoopNodes->Node(OutletNode).HumRat;
12750 : }
12751 10397 : if (OutletTemp < DesOutTemp && SensibleLoad) break;
12752 : }
12753 :
12754 57637 : } else if ((CoilType_Num == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) ||
12755 : (CoilType_Num == DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit)) {
12756 :
12757 13630 : CycRatio = 1.0;
12758 13630 : SpeedRatio = 1.0;
12759 13630 : SensLoad = -1.0; // turns on coil
12760 13630 : this->m_CoolingSpeedRatio = SpeedRatio;
12761 13630 : this->m_CoolingPartLoadFrac = PartLoadFrac;
12762 18412 : for (SpeedNum = 1; SpeedNum <= this->m_NumOfSpeedCooling; ++SpeedNum) {
12763 16459 : this->m_CoolingSpeedNum = SpeedNum;
12764 32918 : VariableSpeedCoils::SimVariableSpeedCoils(state,
12765 : "",
12766 : this->m_CoolingCoilIndex,
12767 : FanOpMode,
12768 : this->m_MaxONOFFCyclesperHour,
12769 : this->m_HPTimeConstant,
12770 : this->m_FanDelayTime,
12771 : CompressorOp,
12772 : CycRatio,
12773 : SpeedNum,
12774 : SpeedRatio,
12775 : SensLoad,
12776 : dummy,
12777 16459 : OnOffAirFlowRatio);
12778 16459 : OutletTemp = state.dataLoopNodes->Node(OutletNode).Temp;
12779 16459 : if (SpeedNum == this->m_NumOfSpeedCooling) {
12780 11598 : FullLoadHumRatOut = state.dataLoopNodes->Node(OutletNode).HumRat;
12781 : }
12782 16459 : if (OutletTemp < DesOutTemp && SensibleLoad) break;
12783 : }
12784 27260 : if (SpeedNum == 1) {
12785 9739 : CycRatio = 1.0;
12786 9739 : SpeedRatio = 0.0;
12787 : } else {
12788 3891 : CycRatio = 0.0;
12789 3891 : SpeedRatio = 1.0;
12790 : }
12791 :
12792 44007 : } else if (CoilType_Num ==
12793 : DataHVACGlobals::CoilDX_CoolingTwoStageWHumControl) { // Coil:Cooling:DX:TwoStageWithHumidityControlMode
12794 :
12795 10974 : DXCoils::SimDXCoilMultiMode(state,
12796 : CompName,
12797 : DataHVACGlobals::CompressorOperation::On,
12798 : FirstHVACIteration,
12799 : PartLoadFrac,
12800 : DehumidMode,
12801 : this->m_CoolingCoilIndex,
12802 : FanOpMode);
12803 10974 : this->m_CompPartLoadRatio = PartLoadFrac;
12804 :
12805 33033 : } else if (CoilType_Num == DataHVACGlobals::CoilDX_Cooling) { // CoilCoolingDX
12806 25926 : int OperationMode = DataHVACGlobals::coilNormalMode;
12807 25926 : if (state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].SubcoolReheatFlag) {
12808 0 : OperationMode = DataHVACGlobals::coilSubcoolReheatMode;
12809 25926 : } else if (this->m_DehumidificationMode == 1) {
12810 0 : OperationMode = DataHVACGlobals::coilEnhancedMode;
12811 : }
12812 25926 : this->m_CoolingSpeedRatio = 1.0;
12813 25926 : bool const singleMode = (this->m_SingleMode == 1);
12814 34741 : for (int speedNum = 1; speedNum <= this->m_NumOfSpeedCooling; speedNum++) {
12815 31065 : this->m_CoolingSpeedNum = speedNum;
12816 31065 : state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate(state,
12817 : OperationMode,
12818 : PartLoadFrac,
12819 : this->m_CoolingSpeedNum,
12820 : this->m_CoolingSpeedRatio,
12821 : this->m_FanOpMode,
12822 : singleMode);
12823 31065 : if (speedNum == this->m_NumOfSpeedCooling) {
12824 21899 : FullLoadHumRatOut = state.dataLoopNodes->Node(OutletNode).HumRat;
12825 : }
12826 31065 : if ((state.dataLoopNodes->Node(OutletNode).Temp - DesOutTemp) < Acc) break;
12827 : }
12828 25926 : if (this->m_CoolingSpeedNum == 1) {
12829 20787 : this->m_CompPartLoadRatio = PartLoadFrac;
12830 20787 : this->m_CoolCompPartLoadRatio = PartLoadFrac; // why is the set only for a few?
12831 20787 : SpeedRatio = 0.0;
12832 : } else {
12833 5139 : SpeedRatio = PartLoadFrac;
12834 5139 : PartLoadFrac = 1.0;
12835 5139 : this->m_CompPartLoadRatio = 1.0;
12836 5139 : this->m_CoolCompPartLoadRatio = 1.0;
12837 : }
12838 7107 : } else if ((CoilType_Num == DataHVACGlobals::Coil_CoolingWater) ||
12839 : (CoilType_Num == DataHVACGlobals::Coil_CoolingWaterDetailed)) { // COIL:COOLING:WATER
12840 :
12841 576 : mdot = this->MaxCoolCoilFluidFlow;
12842 576 : PlantUtilities::SetComponentFlowRate(
12843 : state, mdot, this->CoolCoilFluidInletNode, this->CoolCoilFluidOutletNodeNum, this->CoolCoilPlantLoc);
12844 :
12845 576 : WaterCoils::SimulateWaterCoilComponents(
12846 : state, CompName, FirstHVACIteration, this->m_CoolingCoilIndex, _, this->m_FanOpMode, PartLoadFrac);
12847 576 : FullLoadHumRatOut = state.dataLoopNodes->Node(OutletNode).HumRat;
12848 :
12849 6531 : } else if (CoilType_Num == DataHVACGlobals::Coil_CoolingWaterToAirHPSimple) {
12850 :
12851 0 : WaterToAirHeatPumpSimple::SimWatertoAirHPSimple(state,
12852 : blankString,
12853 : this->m_CoolingCoilIndex,
12854 : ReqOutput,
12855 : dummy,
12856 : FanOpMode,
12857 : m_WSHPRuntimeFrac,
12858 : this->m_MaxONOFFCyclesperHour,
12859 : this->m_HPTimeConstant,
12860 : this->m_FanDelayTime,
12861 : DataHVACGlobals::CompressorOperation::On,
12862 : PartLoadFrac,
12863 : FirstHVACIteration);
12864 0 : this->m_CoolingCoilSensDemand = ReqOutput;
12865 0 : FullLoadHumRatOut = state.dataLoopNodes->Node(OutletNode).HumRat;
12866 :
12867 6531 : } else if (CoilType_Num == DataHVACGlobals::Coil_CoolingWaterToAirHP) {
12868 :
12869 0 : WaterToAirHeatPump::SimWatertoAirHP(state,
12870 : blankString,
12871 : this->m_CoolingCoilIndex,
12872 : this->MaxCoolAirMassFlow,
12873 : FanOpMode,
12874 : FirstHVACIteration,
12875 : m_WSHPRuntimeFrac,
12876 : this->m_MaxONOFFCyclesperHour,
12877 : this->m_HPTimeConstant,
12878 : this->m_FanDelayTime,
12879 0 : this->m_InitHeatPump,
12880 : ReqOutput,
12881 : dummy,
12882 : DataHVACGlobals::CompressorOperation::Off,
12883 : PartLoadFrac);
12884 0 : FullLoadHumRatOut = state.dataLoopNodes->Node(OutletNode).HumRat;
12885 :
12886 6531 : } else if (CoilType_Num == DataHVACGlobals::Coil_UserDefined) {
12887 0 : HeatingActive = false; // set to arbitrary value on entry to function
12888 0 : CoolingActive = false; // set to arbitrary value on entry to function
12889 :
12890 0 : UserDefinedComponents::SimCoilUserDefined(
12891 : state, CompName, this->m_CoolingCoilIndex, AirLoopNum, HeatingActive, CoolingActive);
12892 0 : if (CoolingActive) PartLoadFrac = 1.0;
12893 :
12894 6531 : } else if (CoilType_Num == DataHVACGlobals::CoilDX_PackagedThermalStorageCooling) {
12895 :
12896 : // TES coil simulated above with PLR=0. Operating mode is known here, no need to simulate again to determine operating
12897 : // mode.
12898 13062 : if (this->m_TESOpMode == PackagedThermalStorageCoil::PTSCOperatingMode::Off ||
12899 6531 : this->m_TESOpMode == PackagedThermalStorageCoil::PTSCOperatingMode::ChargeOnly) { // cannot cool
12900 0 : PartLoadFrac = 0.0;
12901 : } else {
12902 : // Get full load result
12903 6531 : PackagedThermalStorageCoil::SimTESCoil(
12904 : state, CompName, this->m_CoolingCoilIndex, FanOpMode, this->m_TESOpMode, PartLoadFrac);
12905 : }
12906 :
12907 : } else {
12908 : }
12909 :
12910 2350032 : ReqOutput = state.dataLoopNodes->Node(InletNode).MassFlowRate *
12911 2350032 : (Psychrometrics::PsyHFnTdbW(DesOutTemp, state.dataLoopNodes->Node(OutletNode).HumRat) -
12912 1175016 : Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(InletNode).Temp, state.dataLoopNodes->Node(OutletNode).HumRat));
12913 2350032 : FullOutput = state.dataLoopNodes->Node(InletNode).MassFlowRate *
12914 3525048 : Psychrometrics::PsyDeltaHSenFnTdb2W2Tdb1W1(state.dataLoopNodes->Node(OutletNode).Temp,
12915 1175016 : state.dataLoopNodes->Node(OutletNode).HumRat,
12916 1175016 : state.dataLoopNodes->Node(InletNode).Temp,
12917 1175016 : state.dataLoopNodes->Node(InletNode).HumRat);
12918 : }
12919 :
12920 : // IF ((FullOutput - ReqOutput) .GT. Acc) THEN ! old method
12921 : // IF ((Node(OutletNode)%Temp-DesOutTemp) .GT. Acc) THEN ! new method gets caught when temps are very close
12922 1196038 : if (this->m_sysType == SysType::CoilCoolingDX) {
12923 1126624 : if ((FullOutput - ReqOutput) > tempAcc) {
12924 170490 : PartLoadFrac = 1.0;
12925 170490 : doIt = false;
12926 : } else {
12927 956134 : doIt = true;
12928 : }
12929 : }
12930 1196038 : if (this->m_EMSOverrideCoilSpeedNumOn) doIt = false;
12931 :
12932 1196038 : if (doIt) {
12933 1004526 : if (unitSys && state.dataLoopNodes->Node(OutletNode).Temp > DesOutTemp - tempAcc) {
12934 17804 : PartLoadFrac = 1.0;
12935 17804 : if (CoilType_Num == DataHVACGlobals::CoilDX_PackagedThermalStorageCooling &&
12936 0 : (this->m_TESOpMode == PackagedThermalStorageCoil::PTSCOperatingMode::Off ||
12937 0 : this->m_TESOpMode == PackagedThermalStorageCoil::PTSCOperatingMode::ChargeOnly)) {
12938 0 : PartLoadFrac = 0.0;
12939 : }
12940 992200 : } else if (CoilType_Num == DataHVACGlobals::CoilDX_PackagedThermalStorageCooling &&
12941 10956 : (this->m_TESOpMode == PackagedThermalStorageCoil::PTSCOperatingMode::Off ||
12942 5478 : this->m_TESOpMode == PackagedThermalStorageCoil::PTSCOperatingMode::ChargeOnly)) {
12943 0 : PartLoadFrac = 0.0;
12944 986722 : } else if (!SensibleLoad) {
12945 0 : PartLoadFrac = 0.0;
12946 986722 : } else if (SensibleLoad) {
12947 :
12948 986722 : if (CoilType_Num == DataHVACGlobals::CoilDX_CoolingSingleSpeed) {
12949 9907104 : auto f = [&state, this, DesOutTemp, FanOpMode](Real64 const PartLoadRatio) {
12950 2476776 : int CoilIndex = this->m_CoolingCoilIndex;
12951 4953552 : DXCoils::CalcDoe2DXCoil(state, CoilIndex, DataHVACGlobals::CompressorOperation::On, true, PartLoadRatio, FanOpMode);
12952 2476776 : Real64 OutletAirTemp = state.dataDXCoils->DXCoilOutletTemp(CoilIndex);
12953 :
12954 2476776 : return DesOutTemp - OutletAirTemp;
12955 626770 : };
12956 626770 : General::SolveRoot(state, Acc, MaxIte, SolFla, PartLoadFrac, f, 0.0, 1.0);
12957 626770 : this->m_CompPartLoadRatio = PartLoadFrac;
12958 :
12959 359952 : } else if ((CoilType_Num == DataHVACGlobals::CoilDX_CoolingHXAssisted) ||
12960 : (CoilType_Num == DataHVACGlobals::CoilWater_CoolingHXAssisted)) {
12961 :
12962 134784 : auto f = [&state, this, DesOutTemp, FirstHVACIteration, HXUnitOn, FanOpMode](Real64 const PartLoadFrac) {
12963 16848 : if (this->CoolCoilFluidInletNode > 0) {
12964 0 : state.dataLoopNodes->Node(this->CoolCoilFluidInletNode).MassFlowRate = this->MaxCoolCoilFluidFlow * PartLoadFrac;
12965 : }
12966 101088 : HVACHXAssistedCoolingCoil::CalcHXAssistedCoolingCoil(
12967 : state,
12968 : this->m_CoolingCoilIndex,
12969 : FirstHVACIteration,
12970 : DataHVACGlobals::CompressorOperation::On,
12971 : PartLoadFrac,
12972 : HXUnitOn,
12973 : FanOpMode,
12974 : _,
12975 : _,
12976 : this->m_DehumidificationMode, // double(this->m_DehumidificationMode)
12977 : 0.0);
12978 33696 : return DesOutTemp - state.dataHVACAssistedCC->HXAssistedCoilOutletTemp(this->m_CoolingCoilIndex);
12979 3522 : };
12980 :
12981 3522 : General::SolveRoot(state, Acc, MaxIte, SolFla, PartLoadFrac, f, 0.0, 1.0);
12982 3522 : if (SolFla == -1) {
12983 :
12984 : // RegulaFalsi may not find sensible PLR when the latent degradation model is used.
12985 : // IF iteration limit is exceeded, find tighter boundary of solution and repeat RegulaFalsi
12986 0 : TempMaxPLR = -0.1;
12987 0 : TempOutletTempDXCoil = state.dataLoopNodes->Node(InletNode).Temp;
12988 0 : while ((TempOutletTempDXCoil - DesOutTemp) > 0.0 && TempMaxPLR <= 1.0) {
12989 : // find upper limit of PLR
12990 0 : TempMaxPLR += 0.1;
12991 0 : HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil(state,
12992 : CompName,
12993 : FirstHVACIteration,
12994 : DataHVACGlobals::CompressorOperation::On,
12995 : TempMaxPLR,
12996 : this->m_CoolingCoilIndex,
12997 : FanOpMode,
12998 : HXUnitOn,
12999 : _,
13000 0 : state.dataUnitarySystems->economizerFlag,
13001 : _,
13002 : this->m_DehumidificationMode,
13003 : 0.0); // this->CoilSHR);
13004 0 : TempOutletTempDXCoil = state.dataHVACAssistedCC->HXAssistedCoilOutletTemp(this->m_CoolingCoilIndex);
13005 : }
13006 0 : TempMinPLR = TempMaxPLR;
13007 0 : while ((TempOutletTempDXCoil - DesOutTemp) < 0.0 && TempMinPLR >= 0.0) {
13008 : // pull upper limit of PLR DOwn to last valid limit (i.e. outlet temp still exceeds DesOutTemp)
13009 0 : TempMaxPLR = TempMinPLR;
13010 : // find minimum limit of PLR
13011 0 : TempMinPLR -= 0.01;
13012 0 : HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil(state,
13013 : CompName,
13014 : FirstHVACIteration,
13015 : DataHVACGlobals::CompressorOperation::On,
13016 : TempMinPLR,
13017 : this->m_CoolingCoilIndex,
13018 : FanOpMode,
13019 : HXUnitOn,
13020 : _,
13021 0 : state.dataUnitarySystems->economizerFlag,
13022 : _,
13023 : this->m_DehumidificationMode,
13024 : 0.0); // this->CoilSHR);
13025 0 : TempOutletTempDXCoil = state.dataHVACAssistedCC->HXAssistedCoilOutletTemp(this->m_CoolingCoilIndex);
13026 : }
13027 : // Relax boundary slightly to assure a solution can be found using RegulaFalsi (i.e. one boundary may
13028 : // be very near the desired result)
13029 0 : TempMinPLR = max(0.0, (TempMinPLR - 0.01));
13030 0 : TempMaxPLR = min(1.0, (TempMaxPLR + 0.01));
13031 : // tighter boundary of solution has been found, CALL RegulaFalsi a second time
13032 0 : General::SolveRoot(state, Acc, MaxIte, SolFla, PartLoadFrac, f, TempMinPLR, TempMaxPLR);
13033 0 : if (SolFla == -1) {
13034 0 : if (!state.dataGlobal->WarmupFlag) {
13035 0 : if (this->warnIndex.m_HXAssistedSensPLRIter < 1) {
13036 0 : ++this->warnIndex.m_HXAssistedSensPLRIter;
13037 0 : ShowWarningError(
13038 : state,
13039 0 : this->UnitType +
13040 0 : " - Iteration limit exceeded calculating DX unit sensible part-load ratio for unit = " +
13041 : this->Name);
13042 0 : ShowContinueError(state, format("Estimated part-load ratio = {:.3R}", (ReqOutput / FullOutput)));
13043 0 : ShowContinueError(state, format("Calculated part-load ratio = {:.3R}", PartLoadFrac));
13044 0 : ShowContinueErrorTimeStamp(
13045 : state, "The calculated part-load ratio will be used and the simulation continues. Occurrence info:");
13046 : }
13047 0 : ShowRecurringWarningErrorAtEnd(state,
13048 0 : this->UnitType + " \"" + this->Name +
13049 : "\" - Iteration limit exceeded calculating sensible part-load ratio "
13050 : "error continues. Sensible PLR "
13051 : "statistics follow.",
13052 : this->warnIndex.m_HXAssistedSensPLRIterIndex,
13053 : PartLoadFrac,
13054 : PartLoadFrac);
13055 : }
13056 0 : } else if (SolFla == -2) {
13057 0 : PartLoadFrac = ReqOutput / FullOutput;
13058 0 : if (!state.dataGlobal->WarmupFlag) {
13059 0 : if (this->warnIndex.m_HXAssistedSensPLRFail < 1) {
13060 0 : ++this->warnIndex.m_HXAssistedSensPLRFail;
13061 0 : ShowWarningError(
13062 : state,
13063 0 : this->UnitType +
13064 : " - DX unit sensible part-load ratio calculation unexpectedly failed: part-load ratio "
13065 0 : "limits exceeded, for unit = " +
13066 : this->Name);
13067 0 : ShowContinueError(state, format("Estimated part-load ratio = {:.3R}", PartLoadFrac));
13068 0 : ShowContinueErrorTimeStamp(
13069 : state, "The estimated part-load ratio will be used and the simulation continues. Occurrence info:");
13070 : }
13071 0 : ShowRecurringWarningErrorAtEnd(state,
13072 0 : this->UnitType + " \"" + this->Name +
13073 : "\" - DX unit sensible part-load ratio calculation unexpectedly "
13074 : "failed error continues. Sensible PLR "
13075 : "statistics follow.",
13076 : this->warnIndex.m_HXAssistedSensPLRFailIndex,
13077 : PartLoadFrac,
13078 : PartLoadFrac);
13079 : }
13080 : }
13081 3522 : } else if (SolFla == -2) {
13082 0 : PartLoadFrac = ReqOutput / FullOutput;
13083 0 : if (!state.dataGlobal->WarmupFlag) {
13084 0 : if (this->warnIndex.m_HXAssistedSensPLRFail2 < 1) {
13085 0 : ++this->warnIndex.m_HXAssistedSensPLRFail2;
13086 0 : ShowWarningError(state,
13087 0 : this->UnitType +
13088 : " - DX unit sensible part-load ratio calculation failed: part-load ratio limits "
13089 0 : "exceeded, for unit = " +
13090 : this->Name);
13091 0 : ShowContinueError(state, format("Estimated part-load ratio = {:.3R}", PartLoadFrac));
13092 0 : ShowContinueErrorTimeStamp(
13093 : state, "The estimated part-load ratio will be used and the simulation continues. Occurrence info:");
13094 : }
13095 0 : ShowRecurringWarningErrorAtEnd(state,
13096 0 : this->UnitType + " \"" + this->Name +
13097 : "\" - DX unit sensible part-load ratio calculation failed error continues. "
13098 : "Sensible PLR statistics follow.",
13099 : this->warnIndex.m_HXAssistedSensPLRFailIndex2,
13100 : PartLoadFrac,
13101 : PartLoadFrac);
13102 : }
13103 : }
13104 3522 : if (CoilType_Num == DataHVACGlobals::CoilDX_CoolingHXAssisted) this->m_CompPartLoadRatio = PartLoadFrac;
13105 :
13106 356430 : } else if (CoilType_Num == DataHVACGlobals::CoilDX_CoolingTwoSpeed) {
13107 313275 : this->m_CoolingSpeedRatio = SpeedRatio;
13108 313275 : if (SpeedRatio == 1.0) {
13109 5168520 : auto f = [&state, this, DesOutTemp](Real64 const SpeedRatio) {
13110 1722840 : int par1 = this->m_CoolingCoilIndex;
13111 1722840 : Real64 par2 = DesOutTemp;
13112 1722840 : int par3 = this->m_UnitarySysNum;
13113 : // 4-7 are not used for TwoSpeed coils, so these shouldn't matter at all
13114 1722840 : Real64 par4_CycRatio = 0.0;
13115 1722840 : int par5_SpeedNum = 0.0;
13116 1722840 : int par6_FanOpMode = 0.0;
13117 1722840 : DataHVACGlobals::CompressorOperation par7_CompressorOp = DataHVACGlobals::CompressorOperation::On;
13118 : return UnitarySys::DXCoilVarSpeedResidual(
13119 1722840 : state, SpeedRatio, par1, par2, par3, par4_CycRatio, par5_SpeedNum, par6_FanOpMode, par7_CompressorOp);
13120 263829 : };
13121 263829 : General::SolveRoot(state, Acc, MaxIte, SolFla, SpeedRatio, f, 0.0, 1.0);
13122 263829 : PartLoadFrac = SpeedRatio;
13123 : } else {
13124 917230 : auto f = [&state, this, DesOutTemp, AirLoopNum, FirstHVACIteration](Real64 const CycRatio) {
13125 : // several pars are not used in two speed coils, so these are just dummy values
13126 183446 : Real64 par4_SpeedRatio = 0.0;
13127 183446 : int par5_SpeedNum = 0.0;
13128 183446 : int par6_FanOpMode = 0.0;
13129 183446 : DataHVACGlobals::CompressorOperation par7_CompressorOp = DataHVACGlobals::CompressorOperation::On;
13130 550338 : return UnitarySys::DXCoilCyclingResidual(state,
13131 : CycRatio,
13132 : this->m_CoolingCoilIndex,
13133 : DesOutTemp,
13134 : this->m_UnitarySysNum,
13135 : par4_SpeedRatio,
13136 : par5_SpeedNum,
13137 : par6_FanOpMode,
13138 : par7_CompressorOp,
13139 : AirLoopNum,
13140 183446 : FirstHVACIteration);
13141 49446 : };
13142 49446 : General::SolveRoot(state, Acc, MaxIte, SolFla, CycRatio, f, 0.0, 1.0);
13143 49446 : PartLoadFrac = CycRatio;
13144 : }
13145 :
13146 43155 : } else if (CoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedCooling) {
13147 :
13148 22 : if (this->m_CoolingSpeedNum > 1.0) {
13149 8 : auto f = [&state, this, DesOutTemp, CycRatio](Real64 const SpeedRatio) {
13150 2 : int par1 = this->m_CoolingCoilIndex;
13151 2 : Real64 par2 = DesOutTemp;
13152 2 : int par3 = this->m_UnitarySysNum;
13153 2 : Real64 par4_CycRatio = CycRatio;
13154 2 : int par5_SpeedNum = this->m_CoolingSpeedNum;
13155 2 : int par6_FanOpMode = 1.0;
13156 2 : DataHVACGlobals::CompressorOperation par7_CompressorOp = DataHVACGlobals::CompressorOperation::On;
13157 : return UnitarySys::DXCoilVarSpeedResidual(
13158 2 : state, SpeedRatio, par1, par2, par3, par4_CycRatio, par5_SpeedNum, par6_FanOpMode, par7_CompressorOp);
13159 1 : };
13160 1 : General::SolveRoot(state, Acc, MaxIte, SolFla, SpeedRatio, f, 0.0, 1.0);
13161 1 : PartLoadFrac = SpeedRatio;
13162 : } else {
13163 21 : SpeedRatio = 0.0;
13164 21 : this->m_CoolingSpeedRatio = SpeedRatio;
13165 625 : auto f = [&state, this, DesOutTemp, SpeedRatio, AirLoopNum, FirstHVACIteration](Real64 const CycRatio) {
13166 500 : return UnitarySys::DXCoilCyclingResidual(state,
13167 : CycRatio,
13168 : this->m_CoolingCoilIndex,
13169 : DesOutTemp,
13170 : this->m_UnitarySysNum,
13171 : SpeedRatio,
13172 : this->m_CoolingSpeedNum,
13173 : 1.0,
13174 : DataHVACGlobals::CompressorOperation::On,
13175 : AirLoopNum,
13176 : FirstHVACIteration);
13177 146 : };
13178 21 : General::SolveRoot(state, Acc, MaxIte, SolFla, CycRatio, f, 0.0, 1.0);
13179 21 : PartLoadFrac = CycRatio;
13180 : }
13181 :
13182 43133 : } else if ((CoilType_Num == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) ||
13183 : (CoilType_Num == DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit)) {
13184 :
13185 11671 : CycRatio = 1.0;
13186 11671 : SpeedRatio = 1.0;
13187 :
13188 11671 : if (this->m_CoolingSpeedNum > 1.0) {
13189 41850 : auto f = [&state, this, DesOutTemp, CycRatio](Real64 const SpeedRatio) {
13190 8370 : int par1 = this->m_CoolingCoilIndex;
13191 8370 : Real64 par2 = DesOutTemp;
13192 8370 : int par3 = this->m_UnitarySysNum;
13193 8370 : Real64 par4_CycRatio = CycRatio;
13194 8370 : int par5_SpeedNum = this->m_CoolingSpeedNum;
13195 8370 : int par6_FanOpMode = this->m_FanOpMode;
13196 8370 : DataHVACGlobals::CompressorOperation par7_CompressorOp = DataHVACGlobals::CompressorOperation::On;
13197 : return UnitarySys::DXCoilVarSpeedResidual(
13198 8370 : state, SpeedRatio, par1, par2, par3, par4_CycRatio, par5_SpeedNum, par6_FanOpMode, par7_CompressorOp);
13199 1938 : };
13200 1938 : General::SolveRoot(state, Acc, MaxIte, SolFla, SpeedRatio, f, 0.0, 1.0);
13201 1938 : this->m_CoolingCycRatio = CycRatio;
13202 1938 : this->m_CoolingSpeedRatio = SpeedRatio;
13203 1938 : this->m_CoolingPartLoadFrac = SpeedRatio;
13204 1938 : this->calcPassiveSystem(state, AirLoopNum, FirstHVACIteration);
13205 1938 : PartLoadFrac = SpeedRatio;
13206 : } else {
13207 9733 : this->m_CoolingSpeedRatio = SpeedRatio;
13208 233130 : auto f = [&state, this, DesOutTemp, SpeedRatio, AirLoopNum, FirstHVACIteration](Real64 const CycRatio) {
13209 194275 : return UnitarySys::DXCoilCyclingResidual(state,
13210 : CycRatio,
13211 : this->m_CoolingCoilIndex,
13212 : DesOutTemp,
13213 : this->m_UnitarySysNum,
13214 : SpeedRatio,
13215 : this->m_CoolingSpeedNum,
13216 : this->m_FanOpMode,
13217 : DataHVACGlobals::CompressorOperation::On,
13218 : AirLoopNum,
13219 : FirstHVACIteration);
13220 48588 : };
13221 9733 : General::SolveRoot(state, Acc, MaxIte, SolFla, CycRatio, f, 0.0, 1.0);
13222 9733 : SpeedRatio = 0.0;
13223 9733 : this->m_CoolingCycRatio = CycRatio;
13224 9733 : this->m_CoolingPartLoadFrac = CycRatio;
13225 9733 : this->calcPassiveSystem(state, AirLoopNum, FirstHVACIteration);
13226 9733 : PartLoadFrac = CycRatio;
13227 11671 : }
13228 :
13229 31462 : } else if (CoilType_Num == DataHVACGlobals::CoilDX_CoolingTwoStageWHumControl) {
13230 72550 : auto f = [&state, this, DesOutTemp, DehumidMode, FanOpMode](Real64 const PartLoadRatio) {
13231 29020 : DXCoils::SimDXCoilMultiMode(state,
13232 : "",
13233 : DataHVACGlobals::CompressorOperation::On,
13234 : false,
13235 : PartLoadRatio,
13236 : DehumidMode,
13237 : this->m_CoolingCoilIndex,
13238 14510 : FanOpMode);
13239 29020 : return DesOutTemp - state.dataDXCoils->DXCoilOutletTemp(this->m_CoolingCoilIndex);
13240 3716 : };
13241 3716 : General::SolveRoot(state, Acc, MaxIte, SolFla, PartLoadFrac, f, 0.0, 1.0);
13242 3716 : this->m_CompPartLoadRatio = PartLoadFrac;
13243 27746 : } else if (CoilType_Num == DataHVACGlobals::CoilDX_Cooling) { // CoilCoolingDX
13244 1104948 : auto f = [&state, this, DesOutTemp, DehumidMode, FanOpMode](Real64 const PartLoadRatio) {
13245 122772 : int CoilIndex = this->m_CoolingCoilIndex;
13246 122772 : int CoolingSpeedNum = this->m_CoolingSpeedNum;
13247 122772 : Real64 CoolingSpeedRatio = this->m_CoolingSpeedRatio;
13248 122772 : bool const singleMode = this->m_SingleMode;
13249 122772 : if (CoolingSpeedNum == 1) {
13250 182334 : state.dataCoilCooingDX->coilCoolingDXs[CoilIndex].simulate(
13251 : state, DehumidMode, PartLoadRatio, CoolingSpeedNum, CoolingSpeedRatio, FanOpMode, singleMode);
13252 : } else {
13253 63210 : state.dataCoilCooingDX->coilCoolingDXs[CoilIndex].simulate(
13254 : state, DehumidMode, CoolingSpeedRatio, CoolingSpeedNum, PartLoadRatio, FanOpMode, singleMode);
13255 : }
13256 : Real64 outletCondition =
13257 245544 : state.dataLoopNodes->Node(state.dataCoilCooingDX->coilCoolingDXs[CoilIndex].evapOutletNodeIndex).Temp;
13258 122772 : return DesOutTemp - outletCondition;
13259 22250 : };
13260 :
13261 22250 : General::SolveRoot(state, Acc, MaxIte, SolFla, PartLoadFrac, f, 0.0, 1.0);
13262 22250 : if (this->m_CoolingSpeedNum == 1) {
13263 19566 : this->m_CompPartLoadRatio = PartLoadFrac;
13264 19566 : SpeedRatio = 0.0;
13265 : } else {
13266 2684 : SpeedRatio = PartLoadFrac;
13267 2684 : PartLoadFrac = 1.0;
13268 2684 : this->m_CompPartLoadRatio = 1.0;
13269 : }
13270 5496 : } else if ((CoilType_Num == DataHVACGlobals::Coil_CoolingWater) ||
13271 : (CoilType_Num == DataHVACGlobals::Coil_CoolingWaterDetailed)) {
13272 :
13273 : // calculate max waterside PLR from mdot request above in case plant chokes water flow
13274 18 : maxPartLoadFrac =
13275 18 : min(1.0,
13276 18 : ((mdot / this->MaxCoolCoilFluidFlow) +
13277 : 0.001)); // plant can limit flow and RegulaFalsi could hit max iteration limit (leave a little slop, 0.001)
13278 :
13279 836 : auto f = [&state, this, FirstHVACIteration, DesOutTemp](Real64 const PartLoadRatio) {
13280 228 : Real64 mdot = min(state.dataLoopNodes->Node(this->CoolCoilFluidOutletNodeNum).MassFlowRateMaxAvail,
13281 152 : this->MaxCoolCoilFluidFlow * PartLoadRatio);
13282 228 : state.dataLoopNodes->Node(this->CoolCoilFluidInletNode).MassFlowRate = mdot;
13283 380 : WaterCoils::SimulateWaterCoilComponents(
13284 : state, this->m_CoolingCoilName, FirstHVACIteration, this->m_CoolingCoilIndex, _, _, PartLoadRatio);
13285 152 : return DesOutTemp - state.dataLoopNodes->Node(this->CoolCoilOutletNodeNum).Temp;
13286 18 : };
13287 :
13288 18 : General::SolveRoot(state, Acc, MaxIte, SolFla, PartLoadFrac, f, 0.0, maxPartLoadFrac);
13289 :
13290 5478 : } else if ((CoilType_Num == DataHVACGlobals::Coil_CoolingWaterToAirHPSimple) ||
13291 : (CoilType_Num == DataHVACGlobals::Coil_CoolingWaterToAirHP)) {
13292 0 : this->m_CoolingCoilSensDemand = ReqOutput;
13293 0 : auto f = [&state, this, FirstHVACIteration, DesOutTemp, ReqOutput](Real64 const PartLoadRatio) {
13294 0 : return UnitarySys::coolWatertoAirHPTempResidual(
13295 : state, PartLoadRatio, this->m_UnitarySysNum, FirstHVACIteration, DesOutTemp, ReqOutput);
13296 0 : };
13297 0 : General::SolveRoot(state, Acc, MaxIte, SolFla, PartLoadFrac, f, 0.0, 1.0);
13298 5478 : } else if (CoilType_Num == DataHVACGlobals::Coil_UserDefined) {
13299 : // do nothing, user defined coil cannot be controlled
13300 :
13301 5478 : } else if (CoilType_Num == DataHVACGlobals::CoilDX_PackagedThermalStorageCooling) {
13302 110045 : auto f = [&state, this, DesOutTemp](Real64 const PartLoadRatio) {
13303 44018 : UnitarySys &thisSys = state.dataUnitarySystems->unitarySys[this->m_UnitarySysNum];
13304 44018 : PackagedThermalStorageCoil::SimTESCoil(state,
13305 : thisSys.m_CoolingCoilName,
13306 : thisSys.m_CoolingCoilIndex,
13307 : thisSys.m_FanOpMode,
13308 : thisSys.m_TESOpMode,
13309 : PartLoadRatio);
13310 44018 : return state.dataLoopNodes->Node(thisSys.CoolCoilOutletNodeNum).Temp - DesOutTemp;
13311 5478 : };
13312 5478 : General::SolveRoot(state, Acc, MaxIte, SolFla, PartLoadFrac, f, 0.0, 1.0);
13313 : } else {
13314 0 : ShowMessage(state, " For :" + this->UnitType + "=\"" + this->Name + "\"");
13315 0 : ShowFatalError(state,
13316 0 : "ControlCoolingSystemToSP: Invalid cooling coil type = " + DataHVACGlobals::cAllCoilTypes(CoilType_Num));
13317 : }
13318 : }
13319 : }
13320 : }
13321 :
13322 : // IF system does not operate to meet sensible load, use no load humidity ratio to test against humidity setpoint,
13323 : // ELSE use operating humidity ratio to test against humidity setpoint
13324 2636125 : if (PartLoadFrac == 0.0) {
13325 1440475 : OutletHumRatDXCoil = NoLoadHumRatOut;
13326 : } else {
13327 1195650 : OutletHumRatDXCoil = state.dataLoopNodes->Node(OutletNode).HumRat;
13328 : }
13329 :
13330 : // IF humidity setpoint is not satisfied and humidity control type is MultiMode,
13331 : // then enable heat exchanger and run to meet sensible load
13332 :
13333 2661376 : if ((OutletHumRatDXCoil > (DesOutHumRat + tempHumRatAcc)) && (!unitSys || PartLoadFrac < 1.0) &&
13334 25251 : (this->m_DehumidControlType_Num == DehumCtrlType::Multimode)) {
13335 :
13336 7551 : if (this->m_EMSOverrideCoilSpeedNumOn) {
13337 : // pass
13338 7551 : } else if ((CoilType_Num == DataHVACGlobals::CoilDX_CoolingHXAssisted) ||
13339 : (CoilType_Num == DataHVACGlobals::CoilWater_CoolingHXAssisted)) { // CoilSystem:Cooling:DX:HeatExchangerAssisted,
13340 : // CoilSystem:Cooling:Water:HeatExchangerAssisted
13341 : // Determine required part load when heat exchanger is ON
13342 0 : HXUnitOn = true;
13343 0 : PartLoadFrac = 1.0;
13344 0 : HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil(state,
13345 : CompName,
13346 : FirstHVACIteration,
13347 : DataHVACGlobals::CompressorOperation::On,
13348 : PartLoadFrac,
13349 : this->m_CoolingCoilIndex,
13350 : FanOpMode,
13351 : HXUnitOn,
13352 : _,
13353 0 : state.dataUnitarySystems->economizerFlag,
13354 : _,
13355 : this->m_DehumidificationMode,
13356 : 0.0); // this->CoilSHR);
13357 :
13358 0 : OutletTempDXCoil = state.dataHVACAssistedCC->HXAssistedCoilOutletTemp(this->m_CoolingCoilIndex);
13359 :
13360 : // FullOutput will be different than the FullOutput determined above during sensible PLR calculations
13361 0 : FullOutput = state.dataLoopNodes->Node(InletNode).MassFlowRate *
13362 0 : Psychrometrics::PsyDeltaHSenFnTdb2W2Tdb1W1(state.dataLoopNodes->Node(OutletNode).Temp,
13363 0 : state.dataLoopNodes->Node(OutletNode).HumRat,
13364 0 : state.dataLoopNodes->Node(InletNode).Temp,
13365 0 : state.dataLoopNodes->Node(InletNode).HumRat);
13366 0 : FullLoadHumRatOut = state.dataLoopNodes->Node(OutletNode).HumRat;
13367 :
13368 : // Check to see if the system can meet the load with the compressor off
13369 : // If NoOutput is lower than (more cooling than required) or very near the ReqOutput, do not run the compressor
13370 0 : if ((NoLoadTempOut - DesOutTemp) < Acc) {
13371 0 : PartLoadFrac = 0.0;
13372 : // OutletTempDXCoil is the full capacity outlet temperature at PartLoadFrac = 1 from the CALL above.
13373 : // if this temp is greater than or very near the desired outlet temp, then run the compressor at PartLoadFrac
13374 : // = 1.
13375 : // ELSEIF ((OutletTempDXCoil > DesOutTemp) .OR. ABS(OutletTempDXCoil - DesOutTemp) .LE. (Acc*2.0d0)) THEN
13376 0 : } else if (OutletTempDXCoil > DesOutTemp - (tempAcc * 2.0)) {
13377 0 : PartLoadFrac = 1.0;
13378 : } else {
13379 0 : auto f = [&state, this, DesOutTemp, FirstHVACIteration, HXUnitOn, FanOpMode](Real64 const PartLoadRatio) {
13380 0 : UnitarySys &thisSys = state.dataUnitarySystems->unitarySys[this->m_UnitarySysNum];
13381 :
13382 0 : if (thisSys.CoolCoilFluidInletNode > 0) {
13383 0 : state.dataLoopNodes->Node(thisSys.CoolCoilFluidInletNode).MassFlowRate = thisSys.MaxCoolCoilFluidFlow * PartLoadRatio;
13384 : }
13385 0 : HVACHXAssistedCoolingCoil::CalcHXAssistedCoolingCoil(state,
13386 : this->m_CoolingCoilIndex,
13387 : FirstHVACIteration,
13388 : DataHVACGlobals::CompressorOperation::On,
13389 : PartLoadRatio,
13390 : HXUnitOn,
13391 : FanOpMode,
13392 : _,
13393 : _,
13394 : this->m_DehumidificationMode, // double(this->m_DehumidificationMode)
13395 : 0.0);
13396 0 : Real64 OutletAirTemp = state.dataHVACAssistedCC->HXAssistedCoilOutletTemp(this->m_CoolingCoilIndex);
13397 0 : return DesOutTemp - OutletAirTemp;
13398 0 : };
13399 :
13400 0 : General::SolveRoot(state, Acc, MaxIte, SolFla, PartLoadFrac, f, 0.0, 1.0);
13401 : }
13402 0 : this->m_CompPartLoadRatio = PartLoadFrac;
13403 :
13404 7551 : } else if (CoilType_Num == DataHVACGlobals::CoilDX_CoolingTwoStageWHumControl) {
13405 :
13406 : // Get full load result
13407 7551 : PartLoadFrac = 1.0;
13408 7551 : DehumidMode = 1;
13409 7551 : this->m_DehumidificationMode = DehumidMode;
13410 7551 : DXCoils::SimDXCoilMultiMode(state,
13411 : CompName,
13412 : DataHVACGlobals::CompressorOperation::On,
13413 : FirstHVACIteration,
13414 : PartLoadFrac,
13415 : DehumidMode,
13416 : this->m_CoolingCoilIndex,
13417 : FanOpMode);
13418 15102 : FullOutput = state.dataLoopNodes->Node(InletNode).MassFlowRate *
13419 22653 : Psychrometrics::PsyDeltaHSenFnTdb2W2Tdb1W1(state.dataLoopNodes->Node(OutletNode).Temp,
13420 7551 : state.dataLoopNodes->Node(OutletNode).HumRat,
13421 7551 : state.dataLoopNodes->Node(InletNode).Temp,
13422 7551 : state.dataLoopNodes->Node(InletNode).HumRat);
13423 7551 : FullLoadHumRatOut = state.dataLoopNodes->Node(OutletNode).HumRat;
13424 :
13425 : // Since we are cooling, we expect FullOutput to be < 0 and FullOutput < NoCoolOutput
13426 : // Check that this is the case; IF not set PartLoadFrac = 0.0 (off) and return
13427 : // Calculate the part load fraction
13428 7551 : if (FullOutput >= 0) {
13429 0 : PartLoadFrac = 0.0;
13430 : } else {
13431 7551 : OutletTempDXCoil = state.dataDXCoils->DXCoilOutletTemp(this->m_CoolingCoilIndex);
13432 7551 : OutletHumRatDXCoil = state.dataDXCoils->DXCoilOutletHumRat(this->m_CoolingCoilIndex);
13433 : // If sensible load and setpoint cannot be met, set PLR = 1. if no sensible load and
13434 : // latent load exists and setpoint cannot be met, set PLR = 1.
13435 8154 : if ((OutletTempDXCoil > (DesOutTemp - (tempAcc * 2.0)) && SensibleLoad && this->m_RunOnSensibleLoad) ||
13436 853 : (OutletHumRatDXCoil >= (DesOutHumRat - (tempHumRatAcc * 2.0)) && !SensibleLoad && LatentLoad &&
13437 0 : this->m_RunOnLatentLoad)) {
13438 6948 : PartLoadFrac = 1.0;
13439 : // ELSEIF ((SensibleLoad .and. LatentLoad .AND. .NOT. UnitarySystem(UnitarySysNum)%RunOnLatentLoad
13440 : // .AND. &
13441 : // OutletHumRatDXCoil < DesOutHumRat)) THEN
13442 603 : } else if (!SensibleLoad && (OutletHumRatDXCoil < DesOutHumRat && LatentLoad && this->m_RunOnLatentLoad)) {
13443 0 : PartLoadFrac = ReqOutput / FullOutput;
13444 0 : auto f = [&state, this, DesOutHumRat, DehumidMode, FanOpMode](Real64 const PartLoadRatio) {
13445 0 : DXCoils::SimDXCoilMultiMode(state,
13446 : "",
13447 : DataHVACGlobals::CompressorOperation::On,
13448 : false,
13449 : PartLoadRatio,
13450 : DehumidMode,
13451 : this->m_CoolingCoilIndex,
13452 0 : FanOpMode);
13453 0 : return DesOutHumRat - state.dataDXCoils->DXCoilOutletHumRat(this->m_CoolingCoilIndex);
13454 0 : };
13455 0 : General::SolveRoot(state, Acc, MaxIte, SolFla, PartLoadFrac, f, 0.0, 1.0);
13456 : } else { // must be a sensible load so find PLR
13457 603 : PartLoadFrac = ReqOutput / FullOutput;
13458 11825 : auto f = [&state, this, DesOutTemp, DehumidMode, FanOpMode](Real64 const PartLoadRatio) {
13459 4730 : DXCoils::SimDXCoilMultiMode(state,
13460 : "",
13461 : DataHVACGlobals::CompressorOperation::On,
13462 : false,
13463 : PartLoadRatio,
13464 : DehumidMode,
13465 : this->m_CoolingCoilIndex,
13466 2365 : FanOpMode);
13467 4730 : return DesOutTemp - state.dataDXCoils->DXCoilOutletTemp(this->m_CoolingCoilIndex);
13468 603 : };
13469 603 : General::SolveRoot(state, Acc, MaxIte, SolFla, PartLoadFrac, f, 0.0, 1.0);
13470 : }
13471 : }
13472 7551 : this->m_CompPartLoadRatio = PartLoadFrac;
13473 :
13474 0 : } else if (CoilType_Num == DataHVACGlobals::CoilDX_Cooling) { // CoilCoolingDX
13475 0 : int OperationMode = DataHVACGlobals::coilEnhancedMode;
13476 0 : if (state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].SubcoolReheatFlag) {
13477 0 : OperationMode = DataHVACGlobals::coilSubcoolReheatMode;
13478 : }
13479 0 : if (this->m_CoolingSpeedNum == 0) this->m_CoolingSpeedNum = 1;
13480 0 : bool const singleMode = (this->m_SingleMode == 1);
13481 0 : PartLoadFrac = 1.0;
13482 0 : for (int speedNum = this->m_CoolingSpeedNum; speedNum <= this->m_NumOfSpeedCooling; speedNum++) {
13483 0 : this->m_CoolingSpeedNum = speedNum;
13484 0 : state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate(
13485 : state, OperationMode, PartLoadFrac, this->m_CoolingSpeedNum, this->m_CoolingSpeedRatio, this->m_FanOpMode, singleMode);
13486 : // Cooling: break if outlet temp is lower than DesOutTemp or approaches DesOutTemp to within Acc from above
13487 0 : if ((state.dataLoopNodes->Node(OutletNode).Temp - DesOutTemp) < Acc) break;
13488 : }
13489 :
13490 : // make sure outlet temp is below set point before calling SolveRoot
13491 : // Cooling: iterate only when outlet temp is below DesOutTemp by at least Acc
13492 0 : if ((DesOutTemp - state.dataLoopNodes->Node(OutletNode).Temp) > Acc) {
13493 :
13494 0 : auto f = [&state, this, DesOutTemp, FanOpMode](Real64 const PartLoadFrac) {
13495 0 : int CoilIndex = this->m_CoolingCoilIndex;
13496 0 : bool useDehumMode = true;
13497 0 : int CoolingSpeedNum = this->m_CoolingSpeedNum;
13498 0 : Real64 CoolingSpeedRatio = 1.0;
13499 0 : bool const singleMode = false;
13500 0 : if (CoolingSpeedNum == 1) {
13501 0 : state.dataCoilCooingDX->coilCoolingDXs[CoilIndex].simulate(
13502 : state, useDehumMode, PartLoadFrac, CoolingSpeedNum, CoolingSpeedRatio, FanOpMode, singleMode);
13503 : } else {
13504 0 : state.dataCoilCooingDX->coilCoolingDXs[CoilIndex].simulate(
13505 : state, useDehumMode, CoolingSpeedRatio, CoolingSpeedNum, PartLoadFrac, FanOpMode, singleMode);
13506 : }
13507 : Real64 outletCondition =
13508 0 : state.dataLoopNodes->Node(state.dataCoilCooingDX->coilCoolingDXs[CoilIndex].evapOutletNodeIndex).Temp;
13509 :
13510 0 : return DesOutTemp - outletCondition;
13511 0 : };
13512 :
13513 0 : General::SolveRoot(state, Acc, MaxIte, SolFla, PartLoadFrac, f, 0.0, 1.0);
13514 : }
13515 0 : if (this->m_CoolingSpeedNum == 1) {
13516 0 : this->m_CompPartLoadRatio = PartLoadFrac;
13517 0 : SpeedRatio = 0.0;
13518 : } else {
13519 0 : SpeedRatio = PartLoadFrac;
13520 0 : PartLoadFrac = 1.0;
13521 0 : this->m_CompPartLoadRatio = 1.0;
13522 : }
13523 :
13524 : } else {
13525 : }
13526 : } // END IF humidity ratio setpoint not met - Multimode humidity control
13527 :
13528 : // IF humidity setpoint is not satisfied and humidity control type is CoolReheat,
13529 : // then overcool to meet moisture load
13530 2636125 : if (this->m_EMSOverrideCoilSpeedNumOn) {
13531 : // pass
13532 2639264 : } else if ((OutletHumRatDXCoil > DesOutHumRat) && (!unitSys || PartLoadFrac < 1.0) && LatentLoad &&
13533 24898 : (this->m_DehumidControlType_Num == DehumCtrlType::CoolReheat)) {
13534 :
13535 : // IF NoLoadHumRatOut is lower than (more dehumidification than required) or very near the DesOutHumRat,
13536 : // do not run the compressor
13537 17700 : if ((NoLoadHumRatOut - DesOutHumRat) < tempHumRatAcc) {
13538 : // PartLoadFrac = PartLoadFrac; // keep part-load fraction from sensible calculation // Self-assignment commented out
13539 : // If the FullLoadHumRatOut is greater than (insufficient dehumidification) or very near the DesOutHumRat,
13540 : // run the compressor at PartLoadFrac = 1.
13541 : // ELSEIF ((DesOutHumRat-FullLoadHumRatOut) .LT. HumRatAcc) THEN
13542 17700 : } else if (FullLoadHumRatOut > (DesOutHumRat - tempHumRatAcc)) {
13543 13283 : PartLoadFrac = 1.0;
13544 13283 : SpeedRatio = 1.0; // #8849, need to set properties of multi-speed/2-speed coils
13545 13283 : if (this->m_IsDXCoil) {
13546 13283 : this->m_CompPartLoadRatio = PartLoadFrac;
13547 : }
13548 : // ELSE find the PLR to meet the load
13549 :
13550 : } else {
13551 :
13552 4417 : if (CoilType_Num == DataHVACGlobals::CoilDX_CoolingSingleSpeed) {
13553 38946 : auto f = [&state, this, DesOutHumRat, FanOpMode](Real64 const PartLoadRatio) {
13554 19473 : DXCoils::CalcDoe2DXCoil(
13555 : state, this->m_CoolingCoilIndex, DataHVACGlobals::CompressorOperation::On, true, PartLoadRatio, FanOpMode);
13556 12982 : Real64 OutletAirHumRat = state.dataDXCoils->DXCoilOutletHumRat(this->m_CoolingCoilIndex);
13557 6491 : return DesOutHumRat - OutletAirHumRat;
13558 614 : };
13559 614 : General::SolveRoot(state, HumRatAcc, MaxIte, SolFlaLat, PartLoadFrac, f, 0.0, 1.0);
13560 614 : this->m_CompPartLoadRatio = PartLoadFrac;
13561 3803 : } else if (CoilType_Num == DataHVACGlobals::CoilDX_CoolingHXAssisted) {
13562 :
13563 : // IF NoLoadHumRatOut is lower than (more dehumidification than required) or very near the DesOutHumRat,
13564 : // do not run the compressor
13565 949 : if ((NoLoadHumRatOut - DesOutHumRat) < tempHumRatAcc * 2.0) {
13566 : // PartLoadFrac = PartLoadFrac; // keep part-load fraction from sensible calculation // Self-assignment commented out
13567 : // If the FullLoadHumRatOut is greater than (insufficient dehumidification) or very near the
13568 : // DesOutHumRat, run the compressor at PartLoadFrac = 1.
13569 949 : } else if ((DesOutHumRat - FullLoadHumRatOut) < tempHumRatAcc * 2.0) {
13570 0 : PartLoadFrac = 1.0;
13571 : // ELSE find the PLR to meet the load
13572 : } else {
13573 33528 : auto f = [&state, this, FirstHVACIteration, HXUnitOn, FanOpMode, DesOutHumRat](Real64 const PartLoadRatio) {
13574 25146 : HVACHXAssistedCoolingCoil::CalcHXAssistedCoolingCoil(state,
13575 : this->m_CoolingCoilIndex,
13576 : FirstHVACIteration,
13577 : DataHVACGlobals::CompressorOperation::On,
13578 : PartLoadRatio,
13579 : HXUnitOn,
13580 : FanOpMode,
13581 : _,
13582 4191 : state.dataUnitarySystems->economizerFlag,
13583 : 0.0,
13584 : 0.0);
13585 8382 : return DesOutHumRat - state.dataHVACAssistedCC->HXAssistedCoilOutletHumRat(this->m_CoolingCoilIndex);
13586 949 : };
13587 949 : General::SolveRoot(state, HumRatAcc, MaxIte, SolFla, PartLoadFrac, f, 0.0, 1.0);
13588 949 : if (SolFla == -1) {
13589 :
13590 : // RegulaFalsi may not find latent PLR when the latent degradation model is used.
13591 : // IF iteration limit is exceeded, find tighter boundary of solution and repeat RegulaFalsi
13592 0 : TempMaxPLR = -0.1;
13593 0 : while ((OutletHumRatDXCoil - DesOutHumRat) >= 0.0 && TempMaxPLR <= 1.0) {
13594 : // find upper limit of LatentPLR
13595 0 : TempMaxPLR += 0.1;
13596 0 : HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil(state,
13597 : CompName,
13598 : FirstHVACIteration,
13599 : DataHVACGlobals::CompressorOperation::On,
13600 : TempMaxPLR,
13601 : this->m_CoolingCoilIndex,
13602 : FanOpMode,
13603 : HXUnitOn,
13604 : _,
13605 0 : state.dataUnitarySystems->economizerFlag,
13606 : _,
13607 : this->m_DehumidificationMode,
13608 : 0.0); // this->CoilSHR);
13609 0 : OutletHumRatDXCoil = state.dataHVACAssistedCC->HXAssistedCoilOutletHumRat(this->m_CoolingCoilIndex);
13610 : }
13611 0 : TempMaxPLR = min(1.0, TempMaxPLR + 0.1);
13612 0 : TempMinPLR = TempMaxPLR;
13613 0 : while ((OutletHumRatDXCoil - DesOutHumRat) <= 0.0 && TempMinPLR >= 0.0) {
13614 : // pull upper limit of LatentPLR DOwn to last valid limit (i.e. latent output still
13615 : // exceeds SystemMoisuterLoad)
13616 : // find minimum limit of Latent PLR
13617 0 : TempMinPLR -= 0.02;
13618 0 : HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil(state,
13619 : CompName,
13620 : FirstHVACIteration,
13621 : DataHVACGlobals::CompressorOperation::On,
13622 : TempMinPLR,
13623 : this->m_CoolingCoilIndex,
13624 : FanOpMode,
13625 : HXUnitOn,
13626 : _,
13627 0 : state.dataUnitarySystems->economizerFlag,
13628 : _,
13629 : this->m_DehumidificationMode,
13630 : 0.0); // this->CoilSHR);
13631 0 : OutletHumRatDXCoil = state.dataHVACAssistedCC->HXAssistedCoilOutletHumRat(this->m_CoolingCoilIndex);
13632 : }
13633 0 : TempMinPLR = max(0.0, TempMinPLR - 0.1);
13634 : // tighter boundary of solution has been found, CALL RegulaFalsi a second time
13635 0 : General::SolveRoot(state, HumRatAcc, MaxIte, SolFla, PartLoadFrac, f, TempMinPLR, TempMaxPLR);
13636 0 : if (SolFla == -1) {
13637 0 : if (!state.dataGlobal->WarmupFlag) {
13638 0 : if (this->warnIndex.m_HXAssistedCRLatPLRIter < 1) {
13639 0 : ++this->warnIndex.m_HXAssistedCRLatPLRIter;
13640 0 : ShowWarningError(
13641 : state,
13642 0 : this->UnitType +
13643 0 : " - Iteration limit exceeded calculating DX unit latent part-load ratio for unit = " +
13644 : this->Name);
13645 0 : ShowContinueError(state, format("Estimated latent part-load ratio = {:.3R}", (ReqOutput / FullOutput)));
13646 0 : ShowContinueError(state, format("Calculated latent part-load ratio = {:.3R}", PartLoadFrac));
13647 0 : ShowContinueErrorTimeStamp(state,
13648 : "The calculated latent part-load ratio will be used and the simulation "
13649 : "continues. Occurrence info:");
13650 : }
13651 0 : ShowRecurringWarningErrorAtEnd(state,
13652 0 : this->UnitType + " \"" + this->Name +
13653 : "\" - Iteration limit exceeded calculating latent part-load ratio "
13654 : "error continues. Latent PLR "
13655 : "statistics follow.",
13656 : this->warnIndex.m_HXAssistedCRLatPLRIterIndex,
13657 : PartLoadFrac,
13658 : PartLoadFrac);
13659 : }
13660 :
13661 0 : } else if (SolFla == -2) {
13662 :
13663 0 : PartLoadFrac = ReqOutput / FullOutput;
13664 0 : if (!state.dataGlobal->WarmupFlag) {
13665 0 : if (this->warnIndex.m_HXAssistedCRLatPLRFail < 1) {
13666 0 : ++this->warnIndex.m_HXAssistedCRLatPLRFail;
13667 0 : ShowWarningError(state,
13668 0 : this->UnitType +
13669 : " - DX unit latent part-load ratio calculation failed unexpectedly: part-load ratio "
13670 0 : "limits exceeded, for unit = " +
13671 : this->Name);
13672 0 : ShowContinueError(state, format("Estimated part-load ratio = {:.3R}", PartLoadFrac));
13673 0 : ShowContinueErrorTimeStamp(
13674 : state, "The estimated part-load ratio will be used and the simulation continues. Occurrence info:");
13675 : }
13676 0 : ShowRecurringWarningErrorAtEnd(state,
13677 0 : this->UnitType + " \"" + this->Name +
13678 : "\" - DX unit latent part-load ratio calculation failed "
13679 : "unexpectedly error continues. Latent PLR "
13680 : "statistics follow.",
13681 : this->warnIndex.m_HXAssistedCRLatPLRFailIndex,
13682 : PartLoadFrac,
13683 : PartLoadFrac);
13684 : }
13685 : }
13686 949 : } else if (SolFla == -2) {
13687 0 : PartLoadFrac = ReqOutput / FullOutput;
13688 0 : if (!state.dataGlobal->WarmupFlag) {
13689 0 : if (this->warnIndex.m_HXAssistedCRLatPLRFail2 < 1) {
13690 0 : ++this->warnIndex.m_HXAssistedCRLatPLRFail2;
13691 0 : ShowWarningError(state,
13692 0 : this->UnitType +
13693 : " - DX unit latent part-load ratio calculation failed: part-load ratio limits "
13694 0 : "exceeded, for unit = " +
13695 : this->Name);
13696 0 : ShowContinueError(state, format("Estimated part-load ratio = {:.3R}", PartLoadFrac));
13697 0 : ShowContinueErrorTimeStamp(
13698 : state, "The estimated part-load ratio will be used and the simulation continues. Occurrence info:");
13699 : }
13700 0 : ShowRecurringWarningErrorAtEnd(
13701 : state,
13702 0 : this->UnitType + " \"" + this->Name +
13703 : "\" - DX unit latent part-load ratio calculation failed error continues. Latent PLR statistics "
13704 : "follow.",
13705 : this->warnIndex.m_HXAssistedCRLatPLRFailIndex2,
13706 : PartLoadFrac,
13707 : PartLoadFrac);
13708 : }
13709 : }
13710 : }
13711 949 : this->m_CompPartLoadRatio = PartLoadFrac;
13712 :
13713 2854 : } else if (CoilType_Num == DataHVACGlobals::CoilDX_CoolingTwoSpeed) {
13714 :
13715 : // Simulate MultiSpeed DX coil at sensible result
13716 0 : DXCoils::SimDXCoilMultiSpeed(state, CompName, SpeedRatio, CycRatio, this->m_CoolingCoilIndex);
13717 :
13718 0 : OutletHumRatDXCoil = state.dataDXCoils->DXCoilOutletHumRat(this->m_CoolingCoilIndex);
13719 : // IF humidity setpoint is not satisfied and humidity control type is CoolReheat,
13720 : // then overcool to meet moisture load
13721 :
13722 0 : if (OutletHumRatDXCoil > DesOutHumRat) {
13723 :
13724 0 : CycRatio = 0.0;
13725 0 : SpeedRatio = 0.0;
13726 :
13727 0 : DXCoils::SimDXCoilMultiSpeed(state, CompName, 0.0, 1.0, this->m_CoolingCoilIndex);
13728 0 : OutletHumRatLS = state.dataDXCoils->DXCoilOutletHumRat(this->m_CoolingCoilIndex);
13729 0 : if (OutletHumRatLS > DesOutHumRat) {
13730 0 : CycRatio = 1.0;
13731 0 : DXCoils::SimDXCoilMultiSpeed(state, CompName, 1.0, 1.0, this->m_CoolingCoilIndex);
13732 0 : OutletHumRatHS = state.dataDXCoils->DXCoilOutletHumRat(this->m_CoolingCoilIndex);
13733 0 : if (OutletHumRatHS < DesOutHumRat) {
13734 0 : auto f = [&state, this, DesOutHumRat](Real64 const SpeedRatio) {
13735 0 : return UnitarySys::DXCoilVarSpeedHumRatResidual(state,
13736 : SpeedRatio,
13737 : this->m_CoolingCoilIndex,
13738 : DesOutHumRat,
13739 : this->m_UnitarySysNum, // int UnitarySysNum,
13740 : 0.0, // Real64 CycRatio,
13741 : 0, // int SpeedNum,
13742 : 0, // int FanOpMode,
13743 : DataHVACGlobals::CompressorOperation::On);
13744 0 : };
13745 0 : General::SolveRoot(state, HumRatAcc, MaxIte, SolFla, SpeedRatio, f, 0.0, 1.0);
13746 : } else {
13747 0 : SpeedRatio = 1.0;
13748 : }
13749 0 : PartLoadFrac = SpeedRatio;
13750 : } else {
13751 0 : SpeedRatio = 0.0;
13752 0 : auto f = [&state, this, DesOutHumRat](Real64 const CycRatio) {
13753 0 : return UnitarySys::DXCoilCyclingHumRatResidual(
13754 : state,
13755 : CycRatio, // compressor cycling ratio (1.0 is continuous, 0.0 is off)
13756 : this->m_CoolingCoilIndex,
13757 : DesOutHumRat,
13758 : this->m_UnitarySysNum, // int UnitarySysNum,
13759 : 1.0, // Real64 CycRatio,
13760 : this->m_CoolingSpeedNum,
13761 : this->m_FanOpMode, // int FanOpMode,
13762 : DataHVACGlobals::CompressorOperation::On);
13763 0 : };
13764 0 : General::SolveRoot(state, HumRatAcc, MaxIte, SolFla, CycRatio, f, 0.0, 1.0);
13765 0 : PartLoadFrac = CycRatio;
13766 : }
13767 : }
13768 :
13769 2854 : } else if (CoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedCooling) {
13770 :
13771 0 : DXCoils::SimDXCoilMultiSpeed(state, CompName, SpeedRatio, CycRatio, this->m_CoolingCoilIndex);
13772 0 : OutletHumRatDXCoil = state.dataDXCoils->DXCoilOutletHumRat(this->m_CoolingCoilIndex);
13773 :
13774 : // IF humidity setpoint is not satisfied and humidity control type is CoolReheat,
13775 : // then overcool to meet moisture load
13776 :
13777 0 : if (OutletHumRatDXCoil > DesOutHumRat) {
13778 :
13779 0 : CycRatio = 0.0;
13780 0 : SpeedRatio = 0.0;
13781 :
13782 0 : DXCoils::SimDXCoilMultiSpeed(state, CompName, 0.0, 1.0, this->m_CoolingCoilIndex);
13783 0 : OutletHumRatLS = state.dataDXCoils->DXCoilOutletHumRat(this->m_CoolingCoilIndex);
13784 0 : if (OutletHumRatLS > DesOutHumRat) {
13785 0 : CycRatio = 1.0;
13786 0 : DXCoils::SimDXCoilMultiSpeed(state, CompName, 1.0, 1.0, this->m_CoolingCoilIndex);
13787 0 : OutletHumRatHS = state.dataDXCoils->DXCoilOutletHumRat(this->m_CoolingCoilIndex);
13788 0 : if (OutletHumRatHS < DesOutHumRat) {
13789 0 : auto f = [&state, this, DesOutHumRat](Real64 const SpeedRatio) {
13790 0 : return UnitarySys::DXCoilVarSpeedHumRatResidual(state,
13791 : SpeedRatio,
13792 : this->m_CoolingCoilIndex,
13793 : DesOutHumRat,
13794 : this->m_UnitarySysNum, // int UnitarySysNum,
13795 : 0.0, // Real64 CycRatio,
13796 : 0, // int SpeedNum,
13797 : 0, // int FanOpMode,
13798 : DataHVACGlobals::CompressorOperation::On);
13799 0 : };
13800 0 : General::SolveRoot(state, HumRatAcc, MaxIte, SolFla, SpeedRatio, f, 0.0, 1.0);
13801 : } else {
13802 0 : SpeedRatio = 1.0;
13803 : }
13804 : } else {
13805 0 : SpeedRatio = 0.0;
13806 0 : auto f = [&state, this, DesOutHumRat](Real64 const CycRatio) {
13807 0 : return UnitarySys::DXCoilCyclingHumRatResidual(
13808 : state,
13809 : CycRatio, // compressor cycling ratio (1.0 is continuous, 0.0 is off)
13810 : this->m_CoolingCoilIndex,
13811 : DesOutHumRat,
13812 : this->m_UnitarySysNum, // int UnitarySysNum,
13813 : 0.0, // Real64 CycRatio,
13814 : 0,
13815 : 0, // int FanOpMode,
13816 : DataHVACGlobals::CompressorOperation::On);
13817 0 : };
13818 0 : General::SolveRoot(state, HumRatAcc, MaxIte, SolFla, CycRatio, f, 0.0, 1.0);
13819 : }
13820 : }
13821 2854 : } else if ((CoilType_Num == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) ||
13822 : (CoilType_Num == DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit)) {
13823 992 : VariableSpeedCoils::SimVariableSpeedCoils(state,
13824 : CompName,
13825 : this->m_CoolingCoilIndex,
13826 : this->m_FanOpMode,
13827 : this->m_MaxONOFFCyclesperHour,
13828 : this->m_HPTimeConstant,
13829 : this->m_FanDelayTime,
13830 : DataHVACGlobals::CompressorOperation::On,
13831 : CycRatio,
13832 : SpeedNum,
13833 : SpeedRatio,
13834 : ReqOutput,
13835 : dummy,
13836 : OnOffAirFlowRatio);
13837 992 : OutletHumRatLS = state.dataLoopNodes->Node(this->CoolCoilOutletNodeNum).HumRat;
13838 :
13839 992 : if (OutletHumRatLS > DesOutHumRat) {
13840 992 : CycRatio = 1.0;
13841 :
13842 992 : for (int speedNum = SpeedNum; speedNum <= this->m_NumOfSpeedCooling; ++speedNum) {
13843 992 : VariableSpeedCoils::SimVariableSpeedCoils(state,
13844 : CompName,
13845 : this->m_CoolingCoilIndex,
13846 : this->m_FanOpMode,
13847 : this->m_MaxONOFFCyclesperHour,
13848 : this->m_HPTimeConstant,
13849 : this->m_FanDelayTime,
13850 : DataHVACGlobals::CompressorOperation::On,
13851 : 1.0,
13852 : speedNum,
13853 : 1.0,
13854 : ReqOutput,
13855 : dummy,
13856 : OnOffAirFlowRatio);
13857 992 : OutletHumRatHS = state.dataLoopNodes->Node(this->CoolCoilOutletNodeNum).HumRat;
13858 992 : if (OutletHumRatHS < DesOutHumRat || speedNum == this->m_NumOfSpeedCooling) {
13859 992 : SpeedNum = speedNum;
13860 992 : this->m_CoolingSpeedNum = speedNum;
13861 992 : break;
13862 : }
13863 : }
13864 :
13865 992 : if (OutletHumRatHS < DesOutHumRat) {
13866 992 : if (SpeedNum == 1) {
13867 14880 : auto f = [&state, this, DesOutHumRat](Real64 const CycRatio) {
13868 11904 : return UnitarySys::DXCoilCyclingHumRatResidual(
13869 : state,
13870 : CycRatio, // compressor cycling ratio (1.0 is continuous, 0.0 is off)
13871 : this->m_CoolingCoilIndex,
13872 : DesOutHumRat,
13873 : this->m_UnitarySysNum, // int UnitarySysNum,
13874 : 1.0, // Real64 CycRatio,
13875 : this->m_CoolingSpeedNum,
13876 : this->m_FanOpMode, // int FanOpMode,
13877 : DataHVACGlobals::CompressorOperation::On);
13878 3968 : };
13879 992 : General::SolveRoot(state, HumRatAcc, MaxIte, SolFla, CycRatio, f, 0.0, 1.0);
13880 : } else {
13881 0 : auto f = [&state, this, DesOutHumRat](Real64 const SpeedRatio) {
13882 0 : return UnitarySys::DXCoilVarSpeedHumRatResidual(state,
13883 : SpeedRatio,
13884 : this->m_CoolingCoilIndex,
13885 : DesOutHumRat,
13886 : this->m_UnitarySysNum, // int UnitarySysNum,
13887 : 1.0, // Real64 CycRatio,
13888 : this->m_CoolingSpeedNum,
13889 : this->m_FanOpMode, // int FanOpMode,
13890 : DataHVACGlobals::CompressorOperation::On);
13891 0 : };
13892 0 : General::SolveRoot(state, HumRatAcc, MaxIte, SolFla, SpeedRatio, f, 0.0, 1.0);
13893 : }
13894 : } else {
13895 0 : if (SpeedNum == 1) {
13896 0 : CycRatio = 1.0;
13897 : } else {
13898 0 : SpeedRatio = 1.0;
13899 : }
13900 : }
13901 : } else {
13902 0 : SpeedRatio = 0.0;
13903 0 : auto f = [&state, this, DesOutHumRat](Real64 const SpeedRatio) {
13904 0 : return UnitarySys::DXCoilVarSpeedHumRatResidual(state,
13905 : SpeedRatio,
13906 : this->m_CoolingCoilIndex,
13907 : DesOutHumRat,
13908 : this->m_UnitarySysNum, // int UnitarySysNum,
13909 : 0.0, // Real64 CycRatio,
13910 : 0, // int SpeedNum
13911 : 0, // int FanOpMode,
13912 : DataHVACGlobals::CompressorOperation::On);
13913 0 : };
13914 0 : General::SolveRoot(state, HumRatAcc, MaxIte, SolFla, CycRatio, f, 0.0, 1.0);
13915 992 : }
13916 1862 : } else if (CoilType_Num == DataHVACGlobals::CoilDX_CoolingTwoStageWHumControl) {
13917 0 : auto f = [&state, this, DesOutHumRat, DehumidMode, FanOpMode](Real64 const PartLoadRatio) {
13918 0 : DXCoils::SimDXCoilMultiMode(state,
13919 : "",
13920 : DataHVACGlobals::CompressorOperation::On,
13921 : false,
13922 : PartLoadRatio,
13923 : DehumidMode,
13924 : this->m_CoolingCoilIndex,
13925 0 : FanOpMode);
13926 0 : return DesOutHumRat - state.dataDXCoils->DXCoilOutletHumRat(this->m_CoolingCoilIndex);
13927 0 : };
13928 0 : General::SolveRoot(state, Acc, MaxIte, SolFlaLat, PartLoadFrac, f, 0.0, 1.0);
13929 0 : this->m_CompPartLoadRatio = PartLoadFrac;
13930 1862 : } else if (CoilType_Num == DataHVACGlobals::CoilDX_Cooling) { // CoilCoolingDX
13931 1858 : int OperationMode = DataHVACGlobals::coilNormalMode;
13932 1858 : if (this->m_CoolingSpeedNum == 0) this->m_CoolingSpeedNum = 1;
13933 1858 : bool const singleMode = (this->m_SingleMode == 1);
13934 1858 : PartLoadFrac = 1.0;
13935 1858 : for (int speedNum = this->m_CoolingSpeedNum; speedNum <= this->m_NumOfSpeedCooling; speedNum++) {
13936 1858 : this->m_CoolingSpeedNum = speedNum;
13937 1858 : state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate(state,
13938 : OperationMode,
13939 : PartLoadFrac,
13940 : this->m_CoolingSpeedNum,
13941 : this->m_CoolingSpeedRatio,
13942 : this->m_FanOpMode,
13943 : singleMode);
13944 : // Cooling: break if outlet humrat is lower than DesOutHumRat or approaches DesOutHumRat to within HumRatAcc from above
13945 1858 : if ((state.dataLoopNodes->Node(OutletNode).HumRat - DesOutHumRat) < HumRatAcc) break;
13946 : }
13947 : // make sure outlet HumRat is below set point before calling SolveRoot
13948 : // Cooling: iterate only when outlet humrat is below DesOutHumRat by at least HumRatAcc
13949 1858 : if ((DesOutHumRat - state.dataLoopNodes->Node(OutletNode).HumRat) > HumRatAcc) {
13950 :
13951 : auto f = [&state,
13952 : this, // 0
13953 : DesOutHumRat, // 1
13954 : FanOpMode // 3
13955 70952 : ](Real64 const PartLoadFrac) {
13956 8869 : int CoilIndex = this->m_CoolingCoilIndex;
13957 8869 : bool useDehumMode = false;
13958 8869 : int CoolingSpeedNum = this->m_CoolingSpeedNum;
13959 8869 : Real64 CoolingSpeedRatio = 1.0;
13960 8869 : bool const singleMode = false;
13961 8869 : if (CoolingSpeedNum == 1) {
13962 26607 : state.dataCoilCooingDX->coilCoolingDXs[CoilIndex].simulate(
13963 : state, useDehumMode, PartLoadFrac, CoolingSpeedNum, CoolingSpeedRatio, FanOpMode, singleMode);
13964 : } else {
13965 0 : state.dataCoilCooingDX->coilCoolingDXs[CoilIndex].simulate(
13966 : state, useDehumMode, CoolingSpeedRatio, CoolingSpeedNum, PartLoadFrac, FanOpMode, singleMode);
13967 : }
13968 : Real64 outletCondition =
13969 17738 : state.dataLoopNodes->Node(state.dataCoilCooingDX->coilCoolingDXs[CoilIndex].evapOutletNodeIndex).HumRat;
13970 8869 : return DesOutHumRat - outletCondition;
13971 1858 : };
13972 :
13973 1858 : General::SolveRoot(state, HumRatAcc, MaxIte, SolFla, PartLoadFrac, f, 0.0, 1.0);
13974 : }
13975 1858 : if (this->m_CoolingSpeedNum == 1) {
13976 1858 : this->m_CompPartLoadRatio = PartLoadFrac;
13977 1858 : SpeedRatio = 0.0;
13978 : } else {
13979 0 : SpeedRatio = PartLoadFrac;
13980 0 : PartLoadFrac = 1.0;
13981 0 : this->m_CompPartLoadRatio = 1.0;
13982 : }
13983 :
13984 4 : } else if ((CoilType_Num == DataHVACGlobals::Coil_CoolingWater) ||
13985 : (CoilType_Num == DataHVACGlobals::Coil_CoolingWaterDetailed)) { // COIL:COOLING:WATER
13986 :
13987 224 : auto f = [&state, this, FirstHVACIteration, DesOutHumRat](Real64 const PartLoadRatio) {
13988 64 : UnitarySys &thisSys = state.dataUnitarySystems->unitarySys[this->m_UnitarySysNum];
13989 64 : Real64 mdot = min(state.dataLoopNodes->Node(thisSys.CoolCoilFluidOutletNodeNum).MassFlowRateMaxAvail,
13990 64 : thisSys.MaxCoolCoilFluidFlow * PartLoadRatio);
13991 64 : state.dataLoopNodes->Node(thisSys.CoolCoilFluidInletNode).MassFlowRate = mdot;
13992 96 : WaterCoils::SimulateWaterCoilComponents(
13993 : state, thisSys.m_CoolingCoilName, FirstHVACIteration, thisSys.m_CoolingCoilIndex, _, _, PartLoadRatio);
13994 32 : return DesOutHumRat - state.dataLoopNodes->Node(thisSys.CoolCoilOutletNodeNum).HumRat;
13995 4 : };
13996 :
13997 4 : General::SolveRoot(state, HumRatAcc, MaxIte, SolFlaLat, PartLoadFrac, f, 0.0, 1.0);
13998 :
13999 0 : } else if ((CoilType_Num == DataHVACGlobals::Coil_CoolingWaterToAirHPSimple) ||
14000 : (CoilType_Num == DataHVACGlobals::Coil_CoolingWaterToAirHP)) {
14001 :
14002 0 : auto f = [&state, this, FirstHVACIteration, DesOutHumRat, ReqOutput](Real64 const PartLoadRatio) {
14003 0 : UnitarySys &thisSys = state.dataUnitarySystems->unitarySys[this->m_UnitarySysNum];
14004 0 : bool errFlag = false;
14005 0 : Real64 RuntimeFrac = 0.0; // heat pump runtime fraction
14006 0 : thisSys.heatPumpRunFrac(PartLoadRatio, errFlag, RuntimeFrac);
14007 0 : thisSys.m_CompPartLoadRatio = PartLoadRatio;
14008 0 : thisSys.m_WSHPRuntimeFrac = RuntimeFrac;
14009 0 : Real64 dummy = 0.0;
14010 0 : if (thisSys.m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWaterToAirHPSimple) {
14011 0 : WaterToAirHeatPumpSimple::SimWatertoAirHPSimple(state,
14012 : blankString,
14013 : thisSys.m_CoolingCoilIndex,
14014 : ReqOutput,
14015 : dummy,
14016 : thisSys.m_FanOpMode,
14017 : RuntimeFrac,
14018 : thisSys.m_MaxONOFFCyclesperHour,
14019 : thisSys.m_HPTimeConstant,
14020 : thisSys.m_FanDelayTime,
14021 : DataHVACGlobals::CompressorOperation::Off,
14022 : PartLoadRatio,
14023 : FirstHVACIteration);
14024 : } else {
14025 0 : WaterToAirHeatPump::SimWatertoAirHP(state,
14026 : blankString,
14027 : thisSys.m_CoolingCoilIndex,
14028 : thisSys.MaxCoolAirMassFlow,
14029 : thisSys.m_FanOpMode,
14030 : FirstHVACIteration,
14031 : RuntimeFrac,
14032 : thisSys.m_MaxONOFFCyclesperHour,
14033 : thisSys.m_HPTimeConstant,
14034 : thisSys.m_FanDelayTime,
14035 0 : thisSys.m_InitHeatPump,
14036 : ReqOutput,
14037 : dummy,
14038 : DataHVACGlobals::CompressorOperation::Off,
14039 : PartLoadRatio);
14040 : }
14041 0 : return DesOutHumRat - state.dataLoopNodes->Node(thisSys.CoolCoilOutletNodeNum).HumRat;
14042 0 : };
14043 0 : General::SolveRoot(state, HumRatAcc, MaxIte, SolFlaLat, PartLoadFrac, f, 0.0, 1.0);
14044 :
14045 0 : } else if (CoilType_Num == DataHVACGlobals::CoilDX_PackagedThermalStorageCooling) {
14046 :
14047 0 : if (CoilType_Num == DataHVACGlobals::CoilDX_PackagedThermalStorageCooling &&
14048 0 : (this->m_TESOpMode != PackagedThermalStorageCoil::PTSCOperatingMode::Off &&
14049 0 : this->m_TESOpMode != PackagedThermalStorageCoil::PTSCOperatingMode::ChargeOnly)) {
14050 0 : auto f = [&state, this, DesOutHumRat](Real64 const PartLoadRatio) {
14051 0 : UnitarySys &thisSys = state.dataUnitarySystems->unitarySys[this->m_UnitarySysNum];
14052 0 : PackagedThermalStorageCoil::SimTESCoil(state,
14053 : thisSys.m_CoolingCoilName,
14054 : thisSys.m_CoolingCoilIndex,
14055 : thisSys.m_FanOpMode,
14056 : thisSys.m_TESOpMode,
14057 : PartLoadRatio);
14058 0 : return state.dataLoopNodes->Node(thisSys.CoolCoilOutletNodeNum).HumRat - DesOutHumRat;
14059 0 : };
14060 0 : General::SolveRoot(state, Acc, MaxIte, SolFla, PartLoadFrac, f, 0.0, 1.0);
14061 : }
14062 :
14063 : } else {
14064 : }
14065 : }
14066 : }
14067 : }
14068 3553043 : if (SolFla == -1) {
14069 2117 : if (!state.dataGlobal->WarmupFlag) {
14070 397 : if (this->warnIndex.m_SensPLRIter < 1) {
14071 1 : ++this->warnIndex.m_SensPLRIter;
14072 1 : ShowWarningError(state, this->UnitType + " - Iteration limit exceeded calculating part-load ratio for unit = " + this->Name);
14073 1 : ShowContinueError(state, format("Estimated part-load ratio = {:.3R}", (ReqOutput / FullOutput)));
14074 1 : ShowContinueError(state, format("Calculated part-load ratio = {:.3R}", PartLoadFrac));
14075 1 : ShowContinueErrorTimeStamp(state, "The calculated part-load ratio will be used and the simulation continues. Occurrence info:");
14076 : } else {
14077 1188 : ShowRecurringWarningErrorAtEnd(
14078 : state,
14079 792 : this->UnitType + " \"" + this->Name +
14080 : "\" - Iteration limit exceeded calculating sensible part-load ratio error continues. Sensible PLR statistics follow.",
14081 : this->warnIndex.m_SensPLRIterIndex,
14082 : PartLoadFrac,
14083 : PartLoadFrac);
14084 : }
14085 : }
14086 3550926 : } else if (SolFla == -2) {
14087 1 : PartLoadFrac = ReqOutput / FullOutput;
14088 1 : if (!state.dataGlobal->WarmupFlag) {
14089 0 : if (this->warnIndex.m_SensPLRFail < 1) {
14090 0 : ++this->warnIndex.m_SensPLRFail;
14091 0 : ShowWarningError(state,
14092 0 : this->UnitType +
14093 0 : " - sensible part-load ratio calculation failed: part-load ratio limits exceeded, for unit = " + this->Name);
14094 0 : ShowContinueError(state, format("Estimated part-load ratio = {:.3R}", PartLoadFrac));
14095 0 : ShowContinueErrorTimeStamp(state, "The estimated part-load ratio will be used and the simulation continues. Occurrence info:");
14096 : } else {
14097 0 : ShowRecurringWarningErrorAtEnd(
14098 : state,
14099 0 : this->UnitType + " \"" + this->Name +
14100 : "\" - sensible part-load ratio calculation failed error continues. Sensible PLR statistics follow.",
14101 : this->warnIndex.m_SensPLRFailIndex,
14102 : PartLoadFrac,
14103 : PartLoadFrac);
14104 : }
14105 : }
14106 : }
14107 :
14108 3553043 : if (SolFlaLat == -1 && SolFla != -1) {
14109 0 : if (!state.dataGlobal->WarmupFlag) {
14110 0 : if (this->warnIndex.m_LatPLRIter < 1) {
14111 0 : ++this->warnIndex.m_LatPLRIter;
14112 0 : ShowWarningError(state,
14113 0 : this->UnitType + " - Iteration limit exceeded calculating latent part-load ratio for unit = " + this->Name);
14114 0 : ShowContinueError(state, format("Estimated part-load ratio = {:.3R}", (ReqOutput / FullOutput)));
14115 0 : ShowContinueError(state, format("Calculated part-load ratio = {:.3R}", PartLoadFrac));
14116 0 : ShowContinueErrorTimeStamp(state, "The calculated part-load ratio will be used and the simulation continues. Occurrence info:");
14117 : }
14118 0 : ShowRecurringWarningErrorAtEnd(
14119 : state,
14120 0 : this->UnitType + " \"" + this->Name +
14121 : "\" - Iteration limit exceeded calculating latent part-load ratio error continues. Latent PLR statistics follow.",
14122 : this->warnIndex.m_LatPLRIterIndex,
14123 : PartLoadFrac,
14124 : PartLoadFrac);
14125 : }
14126 3553043 : } else if (SolFlaLat == -2 && SolFla != -2) {
14127 : // RegulaFalsi returns PLR = minPLR when a solution cannot be found, recalculate PartLoadFrac.
14128 0 : if (NoLoadHumRatOut - FullLoadHumRatOut != 0.0) {
14129 0 : PartLoadFrac = (NoLoadHumRatOut - DesOutHumRat) / (NoLoadHumRatOut - FullLoadHumRatOut);
14130 : } else {
14131 0 : PartLoadFrac = 1.0;
14132 : }
14133 0 : if (!state.dataGlobal->WarmupFlag) {
14134 0 : if (this->warnIndex.m_LatPLRFail < 1) {
14135 0 : ++this->warnIndex.m_LatPLRFail;
14136 0 : ShowWarningError(state,
14137 0 : this->UnitType +
14138 0 : " - latent part-load ratio calculation failed: part-load ratio limits exceeded, for unit = " + this->Name);
14139 0 : ShowContinueError(state, format("Estimated part-load ratio = {:.3R}", PartLoadFrac));
14140 0 : ShowContinueErrorTimeStamp(state, "The estimated part-load ratio will be used and the simulation continues. Occurrence info:");
14141 : }
14142 0 : ShowRecurringWarningErrorAtEnd(state,
14143 0 : this->UnitType + " \"" + this->Name +
14144 : "\" - latent part-load ratio calculation failed error continues. Latent PLR statistics follow.",
14145 : this->warnIndex.m_LatPLRFailIndex,
14146 : PartLoadFrac,
14147 : PartLoadFrac);
14148 : }
14149 : }
14150 : // Set the final results
14151 :
14152 3553043 : if (PartLoadFrac > 1.0) {
14153 0 : PartLoadFrac = 1.0;
14154 3553043 : } else if (PartLoadFrac < 0.0) {
14155 0 : PartLoadFrac = 0.0;
14156 : }
14157 :
14158 3553043 : this->m_CoolingPartLoadFrac = PartLoadFrac;
14159 3553043 : this->m_CoolingSpeedRatio = SpeedRatio;
14160 3553043 : this->m_CoolingCycRatio = CycRatio;
14161 3553043 : this->m_DehumidificationMode = DehumidMode;
14162 :
14163 3553043 : if (state.afn->distribution_simulated) {
14164 124385 : state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).AFNLoopDXCoilRTF =
14165 124385 : max(state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).AFNLoopDXCoilRTF, LoopDXCoilMaxRTFSave);
14166 : }
14167 :
14168 7048560 : if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWater ||
14169 3495517 : this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWaterDetailed) {
14170 57526 : mdot = PartLoadFrac * this->MaxCoolCoilFluidFlow;
14171 57526 : PlantUtilities::SetComponentFlowRate(state, mdot, this->CoolCoilFluidInletNode, this->CoolCoilFluidOutletNodeNum, this->CoolCoilPlantLoc);
14172 : }
14173 3553043 : } // namespace UnitarySystems
14174 :
14175 86211 : void UnitarySys::controlHeatingSystemToSP(EnergyPlusData &state,
14176 : int const AirLoopNum, // index to air loop
14177 : bool const FirstHVACIteration, // First HVAC iteration flag
14178 : DataHVACGlobals::CompressorOperation &CompressorOp, // compressor on/off control
14179 : Real64 &HeatCoilLoad // load met by heating coil
14180 : )
14181 : {
14182 : // SUBROUTINE INFORMATION:
14183 : // AUTHOR Richard Raustad, FSEC
14184 : // DATE WRITTEN February 2013
14185 :
14186 : // PURPOSE OF THIS SUBROUTINE:
14187 : // Simulate the coil object at the required PLR.
14188 :
14189 : // METHODOLOGY EMPLOYED:
14190 : // Calculate operating PLR and adjust speed when using multispeed coils.
14191 :
14192 : // SUBROUTINE PARAMETER DEFINITIONS:
14193 86211 : int constexpr MaxIte(500); // Maximum number of iterations for solver
14194 86211 : Real64 constexpr Acc(1.0e-3); // Accuracy of solver result
14195 86211 : bool constexpr SuppHeatingCoilFlag(false);
14196 :
14197 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
14198 : Real64 FullOutput; // Sensible capacity (outlet - inlet) when the compressor is on
14199 : Real64 ReqOutput; // Sensible capacity (outlet - inlet) required to meet load or set point temperature
14200 :
14201 86211 : Real64 m_WSHPRuntimeFrac = 0.0; // Run time fraction of water to air hp
14202 86211 : Real64 OutdoorDryBulb = 0.0; // local variable for OutDryBulbTemp
14203 86211 : Real64 OutdoorHumRat = 0.0; // local variable for OutHumRat
14204 86211 : Real64 OutdoorPressure = 0.0; // local variable for OutBaroPress
14205 86211 : Real64 OutdoorWetBulb = 0.0; // local variable for OutWetBulbTemp
14206 86211 : bool HeatingActive = false; // dummy variable for UserDefined coil which are passed back indicating if coil is on or off.
14207 86211 : bool CoolingActive = false; // dummy variable for UserDefined coil which are passed back indicating if coil is on or off.
14208 86211 : Real64 mdot = 0.0; // water coil water flow rate [kg/s]
14209 86211 : Real64 maxPartLoadFrac = 0.0; // calculated maximum water side PLR for RegulaFalsi call (when plant limits flow max PLR != 1)
14210 :
14211 : // Set local variables
14212 : // Retrieve the load on the controlled zone
14213 86211 : int InletNode = this->HeatCoilInletNodeNum;
14214 86211 : int OutletNode = this->HeatCoilOutletNodeNum;
14215 172422 : std::string CompName = this->m_HeatingCoilName;
14216 86211 : int CompIndex = this->m_HeatingCoilIndex;
14217 86211 : int FanOpMode = this->m_FanOpMode;
14218 86211 : Real64 DesOutTemp = this->m_DesiredOutletTemp;
14219 :
14220 86211 : Real64 LoopHeatingCoilMaxRTFSave = 0.0;
14221 86211 : Real64 LoopDXCoilMaxRTFSave = 0.0;
14222 86211 : if (state.afn->distribution_simulated) {
14223 0 : LoopHeatingCoilMaxRTFSave = state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).AFNLoopHeatingCoilMaxRTF;
14224 0 : state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).AFNLoopHeatingCoilMaxRTF = 0.0;
14225 0 : LoopDXCoilMaxRTFSave = state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).AFNLoopDXCoilRTF;
14226 0 : state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).AFNLoopDXCoilRTF = 0.0;
14227 : }
14228 :
14229 86211 : Real64 PartLoadFrac = 0.0;
14230 86211 : Real64 SpeedRatio = 0.0;
14231 86211 : Real64 CycRatio = 0.0;
14232 86211 : int SpeedNum = 0;
14233 86211 : Real64 dummy = 0.0;
14234 86211 : int SolFla = 0;
14235 86211 : bool SensibleLoad = false;
14236 86211 : Real64 SensLoad = 0.0;
14237 86211 : bool LatentLoad = false;
14238 86211 : Real64 OutletTemp = 0.0;
14239 :
14240 86211 : if (this->m_CondenserNodeNum != 0) {
14241 49746 : OutdoorDryBulb = state.dataLoopNodes->Node(this->m_CondenserNodeNum).Temp;
14242 49746 : if (this->m_CondenserType == DataHeatBalance::RefrigCondenserType::Water) {
14243 0 : OutdoorHumRat = state.dataEnvrn->OutHumRat;
14244 0 : OutdoorPressure = state.dataEnvrn->OutBaroPress;
14245 0 : OutdoorWetBulb = state.dataEnvrn->OutWetBulbTemp;
14246 : } else {
14247 49746 : OutdoorPressure = state.dataLoopNodes->Node(this->m_CondenserNodeNum).Press;
14248 : // IF node is not connected to anything, pressure = default, use weather data
14249 49746 : if (OutdoorPressure == state.dataLoopNodes->DefaultNodeValues.Press) {
14250 0 : OutdoorDryBulb = state.dataEnvrn->OutDryBulbTemp;
14251 0 : OutdoorHumRat = state.dataEnvrn->OutHumRat;
14252 0 : OutdoorPressure = state.dataEnvrn->OutBaroPress;
14253 0 : OutdoorWetBulb = state.dataEnvrn->OutWetBulbTemp;
14254 : } else {
14255 49746 : OutdoorHumRat = state.dataLoopNodes->Node(this->m_CondenserNodeNum).HumRat;
14256 : // this should use Node%WetBulbTemp or a PSYC function, not OAWB
14257 49746 : OutdoorWetBulb = state.dataLoopNodes->Node(this->m_CondenserNodeNum).OutAirWetBulb;
14258 : }
14259 : }
14260 : } else {
14261 36465 : OutdoorDryBulb = state.dataEnvrn->OutDryBulbTemp;
14262 36465 : OutdoorHumRat = state.dataEnvrn->OutHumRat;
14263 36465 : OutdoorPressure = state.dataEnvrn->OutBaroPress;
14264 36465 : OutdoorWetBulb = state.dataEnvrn->OutWetBulbTemp;
14265 : }
14266 :
14267 : // IF there is a fault of coil SAT Sensor
14268 86211 : if (this->m_FaultyCoilSATFlag) {
14269 : // calculate the sensor offset using fault information
14270 0 : int FaultIndex = this->m_FaultyCoilSATIndex;
14271 0 : this->m_FaultyCoilSATOffset = state.dataFaultsMgr->FaultsCoilSATSensor(FaultIndex).CalFaultOffsetAct(state);
14272 : // update the DesOutTemp
14273 0 : DesOutTemp -= this->m_FaultyCoilSATOffset;
14274 : }
14275 :
14276 : // IF DXHeatingSystem is scheduled on and there is flow
14277 258609 : if (ScheduleManager::GetCurrentScheduleValue(state, this->m_SysAvailSchedPtr) > 0.0 &&
14278 172398 : ScheduleManager::GetCurrentScheduleValue(state, this->m_HeatingCoilAvailSchPtr) > 0.0 &&
14279 86187 : state.dataLoopNodes->Node(InletNode).MassFlowRate > DataHVACGlobals::SmallAirVolFlow) {
14280 :
14281 : // Determine if there is a sensible load on this system
14282 78424 : if (DesOutTemp - state.dataLoopNodes->Node(InletNode).Temp > DataHVACGlobals::TempControlTol) SensibleLoad = true;
14283 : // if a heat pump and other coil is on, disable this coil
14284 78424 : if (this->m_HeatPump && this->m_CoolingPartLoadFrac > 0.0) SensibleLoad = false;
14285 :
14286 : // disable compressor if OAT is below minimum outdoor temperature
14287 78424 : if (OutdoorDryBulb < this->m_MinOATCompressorHeating) {
14288 1025 : SensibleLoad = false;
14289 : }
14290 :
14291 : // IF DXHeatingSystem runs with a heating load then set PartLoadFrac on Heating System
14292 78424 : if (SensibleLoad) {
14293 :
14294 51470 : ReqOutput = state.dataLoopNodes->Node(InletNode).MassFlowRate *
14295 77205 : Psychrometrics::PsyDeltaHSenFnTdb2W2Tdb1W1(DesOutTemp,
14296 25735 : state.dataLoopNodes->Node(InletNode).HumRat,
14297 25735 : state.dataLoopNodes->Node(InletNode).Temp,
14298 25735 : state.dataLoopNodes->Node(InletNode).HumRat);
14299 25735 : ReqOutput = max(0.0, ReqOutput);
14300 :
14301 : // Get no load result
14302 25735 : PartLoadFrac = 0.0;
14303 25735 : m_WSHPRuntimeFrac = 0.0;
14304 25735 : CompressorOp = DataHVACGlobals::CompressorOperation::Off;
14305 :
14306 25735 : switch (this->m_HeatingCoilType_Num) {
14307 0 : case DataHVACGlobals::CoilDX_HeatingEmpirical: {
14308 0 : DXCoils::SimDXCoil(
14309 : state, CompName, DataHVACGlobals::CompressorOperation::On, FirstHVACIteration, CompIndex, FanOpMode, PartLoadFrac);
14310 0 : this->m_CompPartLoadRatio = PartLoadFrac;
14311 0 : } break;
14312 0 : case DataHVACGlobals::Coil_UserDefined: { // do nothing, user defined coil cannot be controlled
14313 0 : UserDefinedComponents::SimCoilUserDefined(state, CompName, CompIndex, AirLoopNum, HeatingActive, CoolingActive);
14314 0 : if (HeatingActive) PartLoadFrac = 1.0;
14315 :
14316 0 : } break;
14317 2247 : case DataHVACGlobals::CoilDX_MultiSpeedHeating:
14318 : case DataHVACGlobals::Coil_HeatingElectric_MultiStage:
14319 : case DataHVACGlobals::Coil_HeatingGas_MultiStage: {
14320 2247 : if (this->m_EMSOverrideCoilSpeedNumOn) {
14321 0 : this->m_HeatingSpeedNum = ceil(this->m_EMSOverrideCoilSpeedNumValue);
14322 0 : this->m_SpeedNum = this->m_HeatingSpeedNum;
14323 0 : bool useMaxedSpeed = false;
14324 0 : if (this->m_SpeedNum > this->m_NumOfSpeedHeating) {
14325 0 : this->m_HeatingSpeedNum = this->m_NumOfSpeedHeating;
14326 0 : this->m_SpeedNum = this->m_NumOfSpeedHeating;
14327 0 : this->m_CoilSpeedErrIdx++;
14328 0 : useMaxedSpeed = true;
14329 0 : ShowRecurringWarningErrorAtEnd(
14330 : state,
14331 0 : "Wrong coil speed EMS override value, for unit=\"" + this->m_HeatingCoilName +
14332 : "\". Exceeding maximum coil speed level. Speed level is set to the maximum coil speed level allowed.",
14333 : this->m_CoilSpeedErrIdx,
14334 : this->m_EMSOverrideCoilSpeedNumValue,
14335 : this->m_EMSOverrideCoilSpeedNumValue,
14336 : _,
14337 : "",
14338 : "");
14339 : }
14340 0 : if (this->m_HeatingSpeedNum == 1) {
14341 0 : this->m_HeatingSpeedRatio = 0.0;
14342 0 : CycRatio = this->m_EMSOverrideCoilSpeedNumValue - floor(this->m_EMSOverrideCoilSpeedNumValue);
14343 0 : this->m_HeatingCycRatio = CycRatio;
14344 0 : if (useMaxedSpeed || CycRatio == 0) {
14345 0 : this->m_HeatingCycRatio = 1;
14346 : } else {
14347 0 : this->m_HeatingCycRatio = CycRatio;
14348 : }
14349 : } else {
14350 0 : this->m_HeatingCycRatio = 1.0;
14351 0 : SpeedRatio = this->m_EMSOverrideCoilSpeedNumValue - floor(this->m_EMSOverrideCoilSpeedNumValue);
14352 0 : this->m_HeatingSpeedRatio = SpeedRatio;
14353 0 : if (useMaxedSpeed || SpeedRatio == 0) {
14354 0 : this->m_HeatingSpeedRatio = 1;
14355 : } else {
14356 0 : this->m_HeatingSpeedRatio = SpeedRatio;
14357 : }
14358 : }
14359 : }
14360 2247 : this->simMultiSpeedCoils(
14361 : state, AirLoopNum, FirstHVACIteration, CompressorOp, SensibleLoad, LatentLoad, PartLoadFrac, HeatingCoil, this->m_SpeedNum);
14362 2247 : } break;
14363 0 : case DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed:
14364 : case DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit: {
14365 0 : this->m_HeatingCoilSensDemand = ReqOutput;
14366 0 : VariableSpeedCoils::SimVariableSpeedCoils(state,
14367 : "",
14368 : this->m_HeatingCoilIndex,
14369 : FanOpMode,
14370 : this->m_MaxONOFFCyclesperHour,
14371 : this->m_HPTimeConstant,
14372 : this->m_FanDelayTime,
14373 : CompressorOp,
14374 : CycRatio,
14375 : SpeedNum,
14376 : SpeedRatio,
14377 : SensLoad,
14378 0 : dummy);
14379 0 : } break;
14380 23488 : case DataHVACGlobals::Coil_HeatingGasOrOtherFuel:
14381 : case DataHVACGlobals::Coil_HeatingElectric:
14382 : case DataHVACGlobals::Coil_HeatingDesuperheater: {
14383 23488 : HeatingCoils::SimulateHeatingCoilComponents(state, CompName, FirstHVACIteration, PartLoadFrac, CompIndex, _, _, FanOpMode);
14384 23488 : } break;
14385 0 : case DataHVACGlobals::Coil_HeatingWater: {
14386 0 : WaterCoils::SimulateWaterCoilComponents(
14387 : state, CompName, FirstHVACIteration, this->m_HeatingCoilIndex, _, this->m_FanOpMode, PartLoadFrac);
14388 0 : } break;
14389 0 : case DataHVACGlobals::Coil_HeatingSteam: {
14390 0 : SteamCoils::SimulateSteamCoilComponents(state,
14391 : CompName,
14392 : FirstHVACIteration,
14393 : this->m_HeatingCoilIndex,
14394 : 1.0,
14395 : _,
14396 : this->m_FanOpMode,
14397 : PartLoadFrac); // QCoilReq, simulate any load > 0 to get max capacity
14398 0 : } break;
14399 0 : case DataHVACGlobals::Coil_HeatingWaterToAirHPSimple: {
14400 0 : if (FirstHVACIteration) this->m_CompPartLoadRatio = 1;
14401 0 : WaterToAirHeatPumpSimple::SimWatertoAirHPSimple(state,
14402 : blankString,
14403 : CompIndex,
14404 : ReqOutput,
14405 : dummy,
14406 : FanOpMode,
14407 : this->m_CompPartLoadRatio,
14408 : this->m_MaxONOFFCyclesperHour,
14409 : this->m_HPTimeConstant,
14410 : this->m_FanDelayTime,
14411 : DataHVACGlobals::CompressorOperation::Off,
14412 : PartLoadFrac,
14413 : FirstHVACIteration);
14414 0 : this->m_CompPartLoadRatio = PartLoadFrac;
14415 0 : this->m_HeatingCoilSensDemand = 0.0;
14416 0 : } break;
14417 0 : case DataHVACGlobals::Coil_HeatingWaterToAirHP: {
14418 0 : WaterToAirHeatPump::SimWatertoAirHP(state,
14419 : blankString,
14420 : CompIndex,
14421 : this->MaxHeatAirMassFlow,
14422 : FanOpMode,
14423 : FirstHVACIteration,
14424 : m_WSHPRuntimeFrac,
14425 : this->m_MaxONOFFCyclesperHour,
14426 : this->m_HPTimeConstant,
14427 : this->m_FanDelayTime,
14428 0 : this->m_InitHeatPump,
14429 : ReqOutput,
14430 : dummy,
14431 : DataHVACGlobals::CompressorOperation::Off,
14432 : PartLoadFrac);
14433 0 : this->m_CompPartLoadRatio = PartLoadFrac;
14434 0 : } break;
14435 0 : default:
14436 0 : break;
14437 : }
14438 :
14439 : // IF outlet temp at no load is within ACC of set point, do not run the coil
14440 :
14441 51470 : if (std::abs(state.dataLoopNodes->Node(OutletNode).Temp - DesOutTemp) < Acc ||
14442 25735 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_UserDefined) {
14443 : // do nothing, coil is at the set point.
14444 25735 : } else if ((state.dataLoopNodes->Node(OutletNode).Temp - DesOutTemp) > Acc) { // IF outlet temp is above set point turn off coil
14445 0 : PartLoadFrac = 0.0;
14446 : } else { // ELSE get full load result
14447 :
14448 : // Get full load result
14449 25735 : PartLoadFrac = 1.0;
14450 25735 : m_WSHPRuntimeFrac = 1.0;
14451 25735 : CompressorOp = DataHVACGlobals::CompressorOperation::On;
14452 :
14453 25735 : switch (this->m_HeatingCoilType_Num) {
14454 0 : case DataHVACGlobals::CoilDX_HeatingEmpirical: { // Coil:Heating:DX:SingleSpeed
14455 0 : DXCoils::SimDXCoil(state,
14456 : CompName,
14457 : DataHVACGlobals::CompressorOperation::On,
14458 : FirstHVACIteration,
14459 : this->m_HeatingCoilIndex,
14460 : FanOpMode,
14461 : PartLoadFrac);
14462 0 : this->m_CompPartLoadRatio = PartLoadFrac;
14463 0 : } break;
14464 0 : case DataHVACGlobals::Coil_UserDefined: {
14465 : // should never get here, coil cannot be controlled and has already been simulated
14466 0 : } break;
14467 2247 : case DataHVACGlobals::CoilDX_MultiSpeedHeating: {
14468 2247 : CycRatio = 1.0;
14469 2247 : SpeedRatio = 0.0;
14470 2247 : if (this->m_EMSOverrideCoilSpeedNumOn) {
14471 0 : this->m_HeatingSpeedNum = ceil(this->m_EMSOverrideCoilSpeedNumValue);
14472 0 : SpeedNum = this->m_HeatingSpeedNum;
14473 0 : if (this->m_HeatingSpeedNum == 1) {
14474 0 : this->m_HeatingSpeedRatio = SpeedRatio = 0.0;
14475 0 : CycRatio = this->m_EMSOverrideCoilSpeedNumValue - floor(this->m_EMSOverrideCoilSpeedNumValue);
14476 0 : this->m_HeatingCycRatio = CycRatio;
14477 0 : if (CycRatio == 0) {
14478 0 : this->m_HeatingCycRatio = 1;
14479 : } else {
14480 0 : this->m_HeatingCycRatio = CycRatio;
14481 : }
14482 : } else {
14483 0 : this->m_HeatingCycRatio = CycRatio = 1.0;
14484 0 : SpeedRatio = this->m_EMSOverrideCoilSpeedNumValue - floor(this->m_EMSOverrideCoilSpeedNumValue);
14485 0 : this->m_HeatingSpeedRatio = SpeedRatio;
14486 0 : if (SpeedRatio == 0) {
14487 0 : this->m_HeatingSpeedRatio = 1;
14488 : } else {
14489 0 : this->m_HeatingSpeedRatio = SpeedRatio;
14490 : }
14491 : }
14492 0 : if (SpeedNum > this->m_NumOfSpeedHeating) {
14493 0 : this->m_HeatingSpeedNum = this->m_NumOfSpeedHeating;
14494 0 : SpeedNum = this->m_NumOfSpeedHeating;
14495 0 : this->m_HeatingCycRatio = CycRatio = 1.0;
14496 0 : if (this->m_HeatingSpeedNum == 1) {
14497 0 : this->m_HeatingSpeedRatio = SpeedRatio = 0.0;
14498 : } else {
14499 0 : this->m_HeatingSpeedRatio = SpeedRatio = 1.0;
14500 : }
14501 : }
14502 0 : this->simMultiSpeedCoils(
14503 : state, AirLoopNum, FirstHVACIteration, CompressorOp, SensibleLoad, LatentLoad, PartLoadFrac, HeatingCoil, SpeedNum);
14504 0 : OutletTemp = state.dataLoopNodes->Node(OutletNode).Temp;
14505 : } else {
14506 6737 : for (SpeedNum = 1; SpeedNum <= this->m_NumOfSpeedHeating; ++SpeedNum) {
14507 4492 : if (SpeedNum > 1) CycRatio = 0.0;
14508 4492 : if (SpeedNum > 1) SpeedRatio = 1.0;
14509 4492 : this->m_HeatingSpeedNum = SpeedNum;
14510 4492 : this->simMultiSpeedCoils(state,
14511 : AirLoopNum,
14512 : FirstHVACIteration,
14513 : CompressorOp,
14514 : SensibleLoad,
14515 : LatentLoad,
14516 : PartLoadFrac,
14517 : HeatingCoil,
14518 : SpeedNum);
14519 4492 : OutletTemp = state.dataLoopNodes->Node(OutletNode).Temp;
14520 4492 : if (OutletTemp > DesOutTemp && SensibleLoad) break;
14521 : }
14522 : }
14523 2247 : } break;
14524 0 : case DataHVACGlobals::Coil_HeatingElectric_MultiStage:
14525 : case DataHVACGlobals::Coil_HeatingGas_MultiStage: {
14526 0 : CycRatio = 1.0;
14527 0 : SpeedRatio = 1.0;
14528 0 : SensLoad = 1.0; // turns on coil
14529 0 : this->m_HeatingSpeedRatio = SpeedRatio;
14530 0 : this->m_HeatingPartLoadFrac = PartLoadFrac;
14531 0 : for (SpeedNum = 1; SpeedNum <= this->m_NumOfSpeedHeating; ++SpeedNum) {
14532 0 : this->m_HeatingSpeedNum = SpeedNum;
14533 0 : this->simMultiSpeedCoils(
14534 : state, AirLoopNum, FirstHVACIteration, CompressorOp, SensibleLoad, LatentLoad, PartLoadFrac, HeatingCoil, SpeedNum);
14535 0 : OutletTemp = state.dataLoopNodes->Node(OutletNode).Temp;
14536 0 : SpeedRatio = double(SpeedNum) - 1.0;
14537 0 : if (OutletTemp > DesOutTemp && SensibleLoad) break;
14538 : }
14539 0 : } break;
14540 0 : case DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed:
14541 : case DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit: {
14542 0 : CycRatio = 1.0;
14543 0 : SpeedRatio = 1.0;
14544 0 : SensLoad = 1.0; // turns on coil
14545 0 : this->m_HeatingSpeedRatio = SpeedRatio;
14546 0 : this->m_HeatingPartLoadFrac = PartLoadFrac;
14547 0 : for (SpeedNum = 1; SpeedNum <= this->m_NumOfSpeedHeating; ++SpeedNum) {
14548 0 : this->m_HeatingSpeedNum = SpeedNum;
14549 0 : VariableSpeedCoils::SimVariableSpeedCoils(state,
14550 : "",
14551 : this->m_HeatingCoilIndex,
14552 : FanOpMode,
14553 : this->m_MaxONOFFCyclesperHour,
14554 : this->m_HPTimeConstant,
14555 : this->m_FanDelayTime,
14556 : CompressorOp,
14557 : CycRatio,
14558 : SpeedNum,
14559 : SpeedRatio,
14560 : SensLoad,
14561 0 : dummy);
14562 0 : OutletTemp = state.dataLoopNodes->Node(OutletNode).Temp;
14563 0 : if (OutletTemp > DesOutTemp && SensibleLoad) break;
14564 : }
14565 0 : } break;
14566 23488 : case DataHVACGlobals::Coil_HeatingGasOrOtherFuel:
14567 : case DataHVACGlobals::Coil_HeatingElectric: {
14568 23488 : HeatingCoils::SimulateHeatingCoilComponents(
14569 : state, CompName, FirstHVACIteration, this->m_DesignHeatingCapacity, CompIndex, _, _, FanOpMode);
14570 23488 : } break;
14571 0 : case DataHVACGlobals::Coil_HeatingDesuperheater: {
14572 0 : HeatingCoils::SimulateHeatingCoilComponents(state, CompName, FirstHVACIteration, ReqOutput, CompIndex, _, _, FanOpMode);
14573 0 : } break;
14574 0 : case DataHVACGlobals::Coil_HeatingWater: {
14575 0 : mdot = this->MaxHeatCoilFluidFlow;
14576 0 : PlantUtilities::SetComponentFlowRate(
14577 : state, mdot, this->HeatCoilFluidInletNode, this->HeatCoilFluidOutletNodeNum, this->HeatCoilPlantLoc);
14578 :
14579 0 : WaterCoils::SimulateWaterCoilComponents(
14580 : state, CompName, FirstHVACIteration, this->m_HeatingCoilIndex, _, this->m_FanOpMode, PartLoadFrac);
14581 0 : } break;
14582 0 : case DataHVACGlobals::Coil_HeatingSteam: {
14583 0 : mdot = this->MaxHeatCoilFluidFlow;
14584 0 : PlantUtilities::SetComponentFlowRate(
14585 : state, mdot, this->HeatCoilFluidInletNode, this->HeatCoilFluidOutletNodeNum, this->HeatCoilPlantLoc);
14586 :
14587 0 : SteamCoils::SimulateSteamCoilComponents(state,
14588 : CompName,
14589 : FirstHVACIteration,
14590 : this->m_HeatingCoilIndex,
14591 : 1.0,
14592 : _,
14593 : this->m_FanOpMode,
14594 : PartLoadFrac); // QCoilReq, simulate any load > 0 to get max capacity
14595 0 : } break;
14596 0 : case DataHVACGlobals::Coil_HeatingWaterToAirHPSimple: {
14597 0 : WaterToAirHeatPumpSimple::SimWatertoAirHPSimple(state,
14598 : blankString,
14599 : CompIndex,
14600 : ReqOutput,
14601 : dummy,
14602 : FanOpMode,
14603 : m_WSHPRuntimeFrac,
14604 : this->m_MaxONOFFCyclesperHour,
14605 : this->m_HPTimeConstant,
14606 : this->m_FanDelayTime,
14607 : DataHVACGlobals::CompressorOperation::On,
14608 : PartLoadFrac,
14609 : FirstHVACIteration);
14610 0 : this->m_HeatingCoilSensDemand = ReqOutput;
14611 0 : this->m_CompPartLoadRatio = PartLoadFrac;
14612 0 : } break;
14613 0 : case DataHVACGlobals::Coil_HeatingWaterToAirHP: {
14614 0 : WaterToAirHeatPump::SimWatertoAirHP(state,
14615 : blankString,
14616 : CompIndex,
14617 : this->MaxHeatAirMassFlow,
14618 : FanOpMode,
14619 : FirstHVACIteration,
14620 : m_WSHPRuntimeFrac,
14621 : this->m_MaxONOFFCyclesperHour,
14622 : this->m_HPTimeConstant,
14623 : this->m_FanDelayTime,
14624 0 : this->m_InitHeatPump,
14625 : ReqOutput,
14626 : dummy,
14627 : DataHVACGlobals::CompressorOperation::Off,
14628 : PartLoadFrac);
14629 0 : this->m_CompPartLoadRatio = PartLoadFrac;
14630 0 : } break;
14631 0 : default:
14632 0 : break;
14633 : }
14634 :
14635 51470 : FullOutput = state.dataLoopNodes->Node(InletNode).MassFlowRate *
14636 77205 : Psychrometrics::PsyDeltaHSenFnTdb2W2Tdb1W1(state.dataLoopNodes->Node(OutletNode).Temp,
14637 25735 : state.dataLoopNodes->Node(OutletNode).HumRat,
14638 25735 : state.dataLoopNodes->Node(InletNode).Temp,
14639 25735 : state.dataLoopNodes->Node(InletNode).HumRat);
14640 : // If the outlet temp is within ACC of set point,
14641 51470 : if (std::abs(state.dataLoopNodes->Node(OutletNode).Temp - DesOutTemp) < Acc ||
14642 25735 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_UserDefined) {
14643 : // do nothing, coil is at set point
14644 25735 : } else if (state.dataLoopNodes->Node(OutletNode).Temp < (DesOutTemp - Acc)) { // IF outlet temp is below set point coil must be on
14645 4296 : PartLoadFrac = 1.0;
14646 : } else { // ELSE find the PLR to meet the set point
14647 :
14648 21439 : switch (this->m_HeatingCoilType_Num) {
14649 0 : case DataHVACGlobals::CoilDX_HeatingEmpirical: { // Coil:Heating:DX:SingleSpeed
14650 0 : auto f = [&state, CompIndex, DesOutTemp](Real64 const PartLoadFrac) {
14651 0 : DXCoils::CalcDXHeatingCoil(state, CompIndex, PartLoadFrac, DataHVACGlobals::ContFanCycCoil, 1.0);
14652 0 : return DesOutTemp - state.dataDXCoils->DXCoilOutletTemp(CompIndex);
14653 0 : };
14654 0 : General::SolveRoot(state, Acc, MaxIte, SolFla, PartLoadFrac, f, 0.0, 1.0);
14655 0 : this->m_CompPartLoadRatio = PartLoadFrac;
14656 0 : } break;
14657 2 : case DataHVACGlobals::CoilDX_MultiSpeedHeating:
14658 : case DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed:
14659 : case DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit:
14660 : case DataHVACGlobals::Coil_HeatingElectric_MultiStage:
14661 : case DataHVACGlobals::Coil_HeatingGas_MultiStage: {
14662 2 : if (this->m_HeatingSpeedNum > 1.0) {
14663 0 : auto f = [&state, this, DesOutTemp, CycRatio, FanOpMode](Real64 const SpeedRatio) {
14664 0 : return UnitarySys::heatingCoilVarSpeedResidual(state,
14665 : SpeedRatio,
14666 : this->m_HeatingCoilIndex,
14667 : DesOutTemp,
14668 : this->m_UnitarySysNum,
14669 : CycRatio,
14670 : this->m_HeatingSpeedNum,
14671 : FanOpMode,
14672 : DataHVACGlobals::CompressorOperation::On,
14673 : false);
14674 0 : };
14675 0 : General::SolveRoot(state, Acc, MaxIte, SolFla, SpeedRatio, f, 0.0, 1.0);
14676 0 : this->m_HeatingCycRatio = CycRatio;
14677 0 : this->m_HeatingSpeedRatio = SpeedRatio;
14678 0 : this->m_HeatingPartLoadFrac = SpeedRatio;
14679 0 : this->calcPassiveSystem(state, AirLoopNum, FirstHVACIteration);
14680 0 : PartLoadFrac = SpeedRatio;
14681 : } else {
14682 2 : SpeedRatio = 0.0;
14683 2 : this->m_HeatingSpeedRatio = SpeedRatio;
14684 24 : auto f = [&state, this, DesOutTemp, SpeedRatio, FanOpMode](Real64 const CycRatio) {
14685 18 : return UnitarySys::heatingCoilVarSpeedCycResidual(state,
14686 : CycRatio,
14687 : this->m_HeatingCoilIndex,
14688 : DesOutTemp,
14689 : this->m_UnitarySysNum,
14690 : SpeedRatio,
14691 : this->m_HeatingSpeedNum,
14692 : FanOpMode,
14693 : DataHVACGlobals::CompressorOperation::On,
14694 : false);
14695 8 : };
14696 2 : General::SolveRoot(state, Acc, MaxIte, SolFla, CycRatio, f, 0.0, 1.0);
14697 2 : this->m_HeatingCycRatio = CycRatio;
14698 2 : this->m_HeatingPartLoadFrac = CycRatio;
14699 2 : this->calcPassiveSystem(state, AirLoopNum, FirstHVACIteration);
14700 2 : PartLoadFrac = CycRatio;
14701 : }
14702 2 : } break;
14703 21437 : case DataHVACGlobals::Coil_HeatingGasOrOtherFuel: {
14704 21437 : HeatingCoils::SimulateHeatingCoilComponents(
14705 : state, this->m_HeatingCoilName, FirstHVACIteration, ReqOutput, CompIndex, _, true, FanOpMode, PartLoadFrac);
14706 21437 : PartLoadFrac = ReqOutput / FullOutput;
14707 21437 : HeatCoilLoad = ReqOutput;
14708 21437 : } break;
14709 0 : case DataHVACGlobals::Coil_HeatingElectric:
14710 : case DataHVACGlobals::Coil_HeatingDesuperheater: {
14711 0 : bool tmpSuppHeatingCoilFlag = SuppHeatingCoilFlag; // CONST_LAMBDA_CAPTURE
14712 0 : auto f = [&state, this, FirstHVACIteration, DesOutTemp, FanOpMode, tmpSuppHeatingCoilFlag](Real64 const PartLoadFrac) {
14713 0 : return this->gasElecHeatingCoilResidual(state,
14714 : PartLoadFrac,
14715 : this->m_UnitarySysNum,
14716 : FirstHVACIteration,
14717 : DesOutTemp,
14718 : tmpSuppHeatingCoilFlag,
14719 : FanOpMode,
14720 : this->m_DesignHeatingCapacity);
14721 0 : };
14722 0 : General::SolveRoot(state, Acc, MaxIte, SolFla, PartLoadFrac, f, 0.0, 1.0);
14723 0 : } break;
14724 0 : case DataHVACGlobals::Coil_HeatingWater: {
14725 :
14726 : // calculate max waterside PLR from mdot request above in case plant chokes water flow
14727 0 : maxPartLoadFrac =
14728 0 : min(1.0,
14729 0 : ((mdot / this->MaxHeatCoilFluidFlow) +
14730 : 0.001)); // plant can limit flow and RegulaFalsi could hit max iteration limit (leave a little slop, 0.001)
14731 :
14732 0 : auto f = [&state, this, FirstHVACIteration, DesOutTemp](Real64 const maxPartLoadFrac) {
14733 : Real64 OutletAirTemp; // Outlet air temperature [C]
14734 :
14735 0 : Real64 mdot = min(state.dataLoopNodes->Node(this->HeatCoilFluidOutletNodeNum).MassFlowRateMaxAvail,
14736 0 : this->MaxHeatCoilFluidFlow * maxPartLoadFrac);
14737 0 : state.dataLoopNodes->Node(this->HeatCoilFluidInletNode).MassFlowRate = mdot;
14738 0 : WaterCoils::SimulateWaterCoilComponents(state,
14739 : this->m_HeatingCoilName,
14740 : FirstHVACIteration,
14741 : this->m_HeatingCoilIndex,
14742 : 0.0, // QActual
14743 : this->m_FanOpMode,
14744 : maxPartLoadFrac);
14745 0 : OutletAirTemp = state.dataLoopNodes->Node(this->HeatCoilOutletNodeNum).Temp;
14746 0 : return DesOutTemp - OutletAirTemp;
14747 0 : };
14748 0 : General::SolveRoot(state, Acc, MaxIte, SolFla, PartLoadFrac, f, 0.0, maxPartLoadFrac);
14749 0 : } break;
14750 0 : case DataHVACGlobals::Coil_HeatingSteam: {
14751 :
14752 : // calculate max waterside PLR from mdot request above in case plant chokes water flow
14753 0 : maxPartLoadFrac =
14754 0 : min(1.0,
14755 0 : ((mdot / this->MaxHeatCoilFluidFlow) +
14756 : 0.001)); // plant can limit flow and RegulaFalsi could hit max iteration limit (leave a little slop, 0.001)
14757 :
14758 0 : auto f = [&state, this, FirstHVACIteration, DesOutTemp](Real64 const PartLoadFrac) {
14759 : Real64 OutletAirTemp; // Outlet air temperature [C]
14760 : Real64 mdot;
14761 :
14762 0 : mdot = min(state.dataLoopNodes->Node(this->HeatCoilFluidOutletNodeNum).MassFlowRateMaxAvail,
14763 0 : this->MaxHeatCoilFluidFlow * PartLoadFrac);
14764 0 : state.dataLoopNodes->Node(this->HeatCoilFluidInletNode).MassFlowRate = mdot;
14765 0 : SteamCoils::SimulateSteamCoilComponents(state,
14766 : this->m_HeatingCoilName,
14767 : FirstHVACIteration,
14768 : this->m_HeatingCoilIndex,
14769 : 1.0,
14770 : _,
14771 : this->m_FanOpMode,
14772 : PartLoadFrac);
14773 0 : OutletAirTemp = state.dataLoopNodes->Node(this->HeatCoilOutletNodeNum).Temp; // RR this should be supp coil
14774 0 : return DesOutTemp - OutletAirTemp;
14775 0 : };
14776 :
14777 0 : General::SolveRoot(state, Acc, MaxIte, SolFla, PartLoadFrac, f, 0.0, maxPartLoadFrac);
14778 0 : } break;
14779 0 : case DataHVACGlobals::Coil_HeatingWaterToAirHPSimple:
14780 : case DataHVACGlobals::Coil_HeatingWaterToAirHP: {
14781 0 : this->m_HeatingCoilSensDemand = ReqOutput;
14782 :
14783 0 : auto f = [&state, this, FirstHVACIteration, DesOutTemp, ReqOutput](Real64 const PartLoadRatio) {
14784 : Real64 OutletAirTemp; // outlet air humidity ratio [kg/kg]
14785 : bool errFlag;
14786 : Real64 RuntimeFrac;
14787 : Real64 dummy;
14788 :
14789 0 : this->heatPumpRunFrac(PartLoadRatio, errFlag, RuntimeFrac);
14790 :
14791 0 : if (RuntimeFrac > 0.0 && this->m_FanOpMode == DataHVACGlobals::CycFanCycCoil) {
14792 0 : state.dataHVACGlobal->OnOffFanPartLoadFraction = PartLoadRatio / RuntimeFrac;
14793 : } else {
14794 0 : state.dataHVACGlobal->OnOffFanPartLoadFraction = 1.0;
14795 : }
14796 :
14797 0 : this->m_CompPartLoadRatio = PartLoadRatio;
14798 0 : this->m_WSHPRuntimeFrac = RuntimeFrac;
14799 :
14800 0 : dummy = 0.0;
14801 0 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHPSimple) {
14802 0 : WaterToAirHeatPumpSimple::SimWatertoAirHPSimple(state,
14803 : blankString,
14804 : this->m_HeatingCoilIndex,
14805 : ReqOutput,
14806 : dummy,
14807 : this->m_FanOpMode,
14808 : RuntimeFrac,
14809 : this->m_MaxONOFFCyclesperHour,
14810 : this->m_HPTimeConstant,
14811 : this->m_FanDelayTime,
14812 : DataHVACGlobals::CompressorOperation::On,
14813 : PartLoadRatio,
14814 : FirstHVACIteration);
14815 : } else {
14816 0 : WaterToAirHeatPump::SimWatertoAirHP(state,
14817 : blankString,
14818 : this->m_HeatingCoilIndex,
14819 : this->MaxHeatAirMassFlow,
14820 : this->m_FanOpMode,
14821 : FirstHVACIteration,
14822 : RuntimeFrac,
14823 : this->m_MaxONOFFCyclesperHour,
14824 : this->m_HPTimeConstant,
14825 : this->m_FanDelayTime,
14826 0 : this->m_InitHeatPump,
14827 : ReqOutput,
14828 : dummy,
14829 : DataHVACGlobals::CompressorOperation::Off,
14830 : PartLoadRatio);
14831 : }
14832 :
14833 0 : OutletAirTemp = state.dataLoopNodes->Node(this->HeatCoilOutletNodeNum).Temp;
14834 0 : return DesOutTemp - OutletAirTemp;
14835 0 : };
14836 :
14837 0 : General::SolveRoot(state, Acc, MaxIte, SolFla, PartLoadFrac, f, 0.0, 1.0);
14838 0 : } break;
14839 0 : case DataHVACGlobals::Coil_UserDefined: {
14840 : // should never get here, user defined coil cannot be controlled and has already been simulated
14841 0 : } break;
14842 0 : default: {
14843 0 : ShowMessage(state, " For :" + this->UnitType + "=\"" + this->Name + "\"");
14844 0 : ShowFatalError(state,
14845 0 : "ControlHeatingSystemToSP: Invalid heating coil type = " +
14846 : DataHVACGlobals::cAllCoilTypes(this->m_HeatingCoilType_Num));
14847 0 : } break;
14848 : }
14849 : }
14850 : }
14851 : }
14852 : }
14853 :
14854 86211 : if (PartLoadFrac > 1.0) {
14855 0 : PartLoadFrac = 1.0;
14856 86211 : } else if (PartLoadFrac < 0.0) {
14857 0 : PartLoadFrac = 0.0;
14858 : }
14859 :
14860 86211 : if (SolFla < 0) {
14861 0 : if (SolFla == -1) {
14862 0 : if (!state.dataGlobal->WarmupFlag) {
14863 0 : if (this->warnIndex.m_HeatCoilSensPLRIter < 1) {
14864 0 : ++this->warnIndex.m_HeatCoilSensPLRIter;
14865 0 : ShowWarningError(
14866 0 : state, this->UnitType + " - Iteration limit exceeded calculating sensible part-load ratio for unit = " + this->Name);
14867 0 : ShowContinueError(state, format("Estimated part-load ratio = {:.3R}", (ReqOutput / FullOutput)));
14868 0 : ShowContinueError(state, format("Calculated part-load ratio = {:.3R}", PartLoadFrac));
14869 0 : ShowContinueErrorTimeStamp(state,
14870 : "The calculated part-load ratio will be used and the simulation continues. Occurrence info:");
14871 : } else {
14872 0 : ShowRecurringWarningErrorAtEnd(state,
14873 0 : this->UnitType + " \"" + this->Name +
14874 : "\" - Iteration limit exceeded calculating sensible part-load ratio error continues. "
14875 : "Sensible PLR statistics follow.",
14876 : this->warnIndex.m_HeatCoilSensPLRIterIndex,
14877 : PartLoadFrac,
14878 : PartLoadFrac);
14879 : }
14880 : }
14881 0 : } else if (SolFla == -2) {
14882 0 : PartLoadFrac = ReqOutput / FullOutput;
14883 0 : if (!state.dataGlobal->WarmupFlag) {
14884 0 : if (this->warnIndex.m_HeatCoilSensPLRFail < 1) {
14885 0 : ++this->warnIndex.m_HeatCoilSensPLRFail;
14886 0 : ShowWarningError(
14887 : state,
14888 0 : this->UnitType +
14889 0 : " - sensible part-load ratio calculation failed: part-load ratio limits exceeded, for unit = " + this->Name);
14890 0 : ShowContinueError(state, format("Estimated part-load ratio = {:.3R}", PartLoadFrac));
14891 0 : ShowContinueErrorTimeStamp(state,
14892 : "The estimated part-load ratio will be used and the simulation continues. Occurrence info:");
14893 : } else {
14894 0 : ShowRecurringWarningErrorAtEnd(
14895 : state,
14896 0 : this->UnitType + " \"" + this->Name +
14897 : "\" - sensible part-load ratio calculation failed error continues. Sensible PLR statistics follow.",
14898 : this->warnIndex.m_HeatCoilSensPLRFailIndex,
14899 : PartLoadFrac,
14900 : PartLoadFrac);
14901 : }
14902 : }
14903 : }
14904 : }
14905 :
14906 : // Set the final results
14907 86211 : this->m_HeatingPartLoadFrac = PartLoadFrac;
14908 86211 : this->m_HeatingSpeedRatio = SpeedRatio;
14909 86211 : this->m_HeatingCycRatio = CycRatio;
14910 :
14911 86211 : if (state.afn->distribution_simulated) {
14912 0 : state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).AFNLoopHeatingCoilMaxRTF =
14913 0 : max(state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).AFNLoopHeatingCoilMaxRTF, LoopHeatingCoilMaxRTFSave);
14914 0 : state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).AFNLoopDXCoilRTF =
14915 0 : max(state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).AFNLoopDXCoilRTF, LoopDXCoilMaxRTFSave);
14916 : }
14917 :
14918 86211 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWater || this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingSteam) {
14919 0 : mdot = PartLoadFrac * this->MaxHeatCoilFluidFlow;
14920 0 : PlantUtilities::SetComponentFlowRate(state, mdot, this->HeatCoilFluidInletNode, this->HeatCoilFluidOutletNodeNum, this->HeatCoilPlantLoc);
14921 : }
14922 86211 : }
14923 :
14924 80088 : void UnitarySys::controlSuppHeatSystemToSP(EnergyPlusData &state,
14925 : int const AirLoopNum, // index to air loop
14926 : bool const FirstHVACIteration // First HVAC iteration flag
14927 : )
14928 : {
14929 : // SUBROUTINE INFORMATION:
14930 : // AUTHOR Richard Raustad, FSEC
14931 : // DATE WRITTEN February 2013
14932 : // MODIFIED Nov. 2016, R. Zhang, LBNL. Applied the coil supply air temperature sensor offset fault model
14933 :
14934 : // PURPOSE OF THIS SUBROUTINE:
14935 : // This subroutine updates the System outlet nodes.
14936 :
14937 : // METHODOLOGY EMPLOYED:
14938 : // Data is moved from the System data structure to the System outlet nodes.
14939 :
14940 : // SUBROUTINE PARAMETER DEFINITIONS:
14941 80088 : int constexpr MaxIte(500); // Maximum number of iterations for solver
14942 80088 : Real64 constexpr Acc(1.0e-3); // Accuracy of solver result
14943 80088 : int constexpr SolveMaxIter(50);
14944 80088 : constexpr bool SuppHeatingCoilFlag(true);
14945 :
14946 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
14947 80088 : Real64 FullOutput = 0.0; // Sensible capacity (outlet - inlet) when the compressor is on
14948 80088 : Real64 ReqOutput = 0.0; // Sensible capacity (outlet - inlet) required to meet load or set point temperature
14949 80088 : Real64 QCoilActual = 0.0; // Heating coil operating capacity [W]
14950 80088 : Real64 NoLoadTempOut = 0.0; // save outlet temp when coil is off (C)
14951 80088 : bool HeatingActive = false; // dummy variable for UserDefined coil which are passed back indicating if coil is on or off.
14952 80088 : bool CoolingActive = false; // dummy variable for UserDefined coil which are passed back indicating if coil is on or off.
14953 80088 : Real64 mdot = 0.0; // water coil water flow rate [kg/s]
14954 80088 : Real64 maxPartLoadFrac = 0.0; // calculated maximum water side PLR for RegulaFalsi call (when plant limits flow max PLR != 1)
14955 80088 : Real64 PartLoadFrac = 0.0;
14956 80088 : int SolFla = 0.0;
14957 80088 : bool SensibleLoad = false;
14958 80088 : Real64 OutletTemp = 0.0;
14959 80088 : Real64 SpeedRatio = 0.0;
14960 80088 : Real64 CycRatio = 0.0;
14961 80088 : int SpeedNum = 0;
14962 :
14963 : // Set local variables
14964 80088 : int OutletNode = this->SuppCoilOutletNodeNum;
14965 80088 : int InletNode = this->m_SuppCoilAirInletNode;
14966 80088 : Real64 DesOutTemp = this->m_DesiredOutletTemp;
14967 160176 : std::string CompName = this->m_SuppHeatCoilName;
14968 80088 : int CompIndex = this->m_SuppHeatCoilIndex;
14969 80088 : int FanOpMode = this->m_FanOpMode;
14970 :
14971 80088 : Real64 LoopHeatingCoilMaxRTFSave = 0.0;
14972 80088 : Real64 LoopDXCoilMaxRTFSave = 0.0;
14973 80088 : if (state.afn->distribution_simulated) {
14974 0 : LoopHeatingCoilMaxRTFSave = state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).AFNLoopHeatingCoilMaxRTF;
14975 0 : state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).AFNLoopHeatingCoilMaxRTF = 0.0;
14976 0 : LoopDXCoilMaxRTFSave = state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).AFNLoopDXCoilRTF;
14977 0 : state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).AFNLoopDXCoilRTF = 0.0;
14978 : }
14979 :
14980 : // IF there is a fault of coil SAT Sensor
14981 80088 : if (this->m_FaultyCoilSATFlag) {
14982 : // calculate the sensor offset using fault information
14983 0 : int FaultIndex = this->m_FaultyCoilSATIndex;
14984 0 : this->m_FaultyCoilSATOffset = state.dataFaultsMgr->FaultsCoilSATSensor(FaultIndex).CalFaultOffsetAct(state);
14985 : // update the DesOutTemp
14986 0 : DesOutTemp -= this->m_FaultyCoilSATOffset;
14987 : }
14988 :
14989 160158 : if ((ScheduleManager::GetCurrentScheduleValue(state, this->m_SysAvailSchedPtr) > 0.0) &&
14990 80070 : (state.dataLoopNodes->Node(InletNode).MassFlowRate > DataHVACGlobals::SmallAirVolFlow)) {
14991 :
14992 : // Determine if there is a sensible load on this system
14993 82357 : if ((state.dataLoopNodes->Node(InletNode).Temp < DesOutTemp) &&
14994 5972 : (std::abs(state.dataLoopNodes->Node(InletNode).Temp - DesOutTemp) > DataHVACGlobals::TempControlTol))
14995 4290 : SensibleLoad = true;
14996 :
14997 76385 : if (SensibleLoad) {
14998 4290 : if (this->m_EMSOverrideSuppCoilSpeedNumOn) {
14999 0 : this->setEMSSuppCoilStagePLR(state);
15000 : } else {
15001 8580 : ReqOutput = state.dataLoopNodes->Node(InletNode).MassFlowRate *
15002 12870 : Psychrometrics::PsyDeltaHSenFnTdb2W2Tdb1W1(DesOutTemp,
15003 4290 : state.dataLoopNodes->Node(InletNode).HumRat,
15004 4290 : state.dataLoopNodes->Node(InletNode).Temp,
15005 4290 : state.dataLoopNodes->Node(InletNode).HumRat);
15006 : // Get no load result
15007 4290 : PartLoadFrac = 0.0;
15008 :
15009 4290 : switch (this->m_SuppHeatCoilType_Num) {
15010 2047 : case DataHVACGlobals::Coil_HeatingGasOrOtherFuel:
15011 : case DataHVACGlobals::Coil_HeatingElectric:
15012 : case DataHVACGlobals::Coil_HeatingDesuperheater: {
15013 2047 : HeatingCoils::SimulateHeatingCoilComponents(state,
15014 : CompName,
15015 : FirstHVACIteration,
15016 : DataLoopNode::SensedLoadFlagValue,
15017 : CompIndex,
15018 : QCoilActual,
15019 : SuppHeatingCoilFlag,
15020 : FanOpMode,
15021 : PartLoadFrac); // QCoilReq= 0.0d0, &
15022 2047 : if (!(this->m_SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingDesuperheater)) {
15023 2047 : PartLoadFrac = QCoilActual / this->m_DesignSuppHeatingCapacity;
15024 : } else {
15025 0 : if (QCoilActual > DataHVACGlobals::SmallLoad) {
15026 0 : PartLoadFrac = 1.0;
15027 : } else {
15028 0 : PartLoadFrac = 0.0;
15029 : }
15030 : }
15031 2047 : } break;
15032 2243 : case DataHVACGlobals::Coil_HeatingElectric_MultiStage: {
15033 2243 : SpeedRatio = 0.0;
15034 2243 : HeatingCoils::SimulateHeatingCoilComponents(state,
15035 : CompName,
15036 : FirstHVACIteration,
15037 : DataLoopNode::SensedLoadFlagValue,
15038 : CompIndex,
15039 : QCoilActual,
15040 : SuppHeatingCoilFlag,
15041 : FanOpMode,
15042 : PartLoadFrac,
15043 : 0,
15044 : SpeedRatio);
15045 2243 : } break;
15046 0 : case DataHVACGlobals::Coil_HeatingWater: {
15047 0 : WaterCoils::SimulateWaterCoilComponents(
15048 : state, CompName, FirstHVACIteration, this->m_SuppHeatCoilIndex, _, this->m_FanOpMode, PartLoadFrac);
15049 0 : } break;
15050 0 : case DataHVACGlobals::Coil_HeatingSteam: {
15051 0 : SteamCoils::SimulateSteamCoilComponents(state,
15052 : CompName,
15053 : FirstHVACIteration,
15054 : this->m_SuppHeatCoilIndex,
15055 : 1.0,
15056 : _,
15057 : this->m_FanOpMode,
15058 : PartLoadFrac); // QCoilReq, simulate any load > 0 to get max capacity
15059 0 : } break;
15060 0 : case DataHVACGlobals::Coil_UserDefined: { // do nothing, user defined coil cannot be controlled
15061 0 : UserDefinedComponents::SimCoilUserDefined(state, CompName, CompIndex, AirLoopNum, HeatingActive, CoolingActive);
15062 0 : if (HeatingActive) PartLoadFrac = 1.0;
15063 0 : } break;
15064 0 : default:
15065 0 : break;
15066 : }
15067 :
15068 4290 : NoLoadTempOut = state.dataLoopNodes->Node(OutletNode).Temp;
15069 : // NoOutput = state.dataLoopNodes->Node(InletNode)%MassFlowRate * &
15070 : // (PsyHFnTdbW(NoLoadTempOut,Node(OutletNode)%HumRat) &
15071 : // - PsyHFnTdbW(Node(InletNode)%Temp,Node(OutletNode)%HumRat))
15072 :
15073 : // If OutletTemp is within ACC of set point, either coil operated or is not needed
15074 6533 : if (std::abs(state.dataLoopNodes->Node(OutletNode).Temp - DesOutTemp) < Acc ||
15075 2243 : this->m_SuppHeatCoilType_Num == DataHVACGlobals::Coil_UserDefined) {
15076 : // do nothing, coil is at set point (i.e., gas/elec/steam/user coil will try to hit set point)
15077 2243 : } else if (PartLoadFrac > 0.0) {
15078 : // do nothing, coil tried to hit set point (i.e., gas/elec/steam/user coil tried to hit set point but missed
15079 2243 : } else if (NoLoadTempOut > (DesOutTemp - Acc)) {
15080 0 : PartLoadFrac = 0.0; // outlet temp > set point, coil is not needed
15081 : } else { // outlet temp too low, turn on coil
15082 :
15083 : // Get full load result
15084 2243 : PartLoadFrac = 1.0;
15085 :
15086 2243 : switch (this->m_SuppHeatCoilType_Num) {
15087 0 : case DataHVACGlobals::Coil_HeatingGasOrOtherFuel:
15088 : case DataHVACGlobals::Coil_HeatingElectric: {
15089 0 : HeatingCoils::SimulateHeatingCoilComponents(state,
15090 : CompName,
15091 : FirstHVACIteration,
15092 : DataLoopNode::SensedLoadFlagValue,
15093 : CompIndex,
15094 : QCoilActual,
15095 : SuppHeatingCoilFlag,
15096 : FanOpMode,
15097 : PartLoadFrac);
15098 0 : PartLoadFrac = QCoilActual / this->m_DesignSuppHeatingCapacity;
15099 0 : } break;
15100 2243 : case DataHVACGlobals::Coil_HeatingElectric_MultiStage: {
15101 2243 : CycRatio = 1.0;
15102 2243 : SpeedRatio = 1.0;
15103 6344 : for (SpeedNum = 1; SpeedNum <= this->m_NumOfSpeedSuppHeating; ++SpeedNum) {
15104 6344 : this->m_SuppHeatingSpeedNum = SpeedNum;
15105 6344 : HeatingCoils::SimulateHeatingCoilComponents(state,
15106 : CompName,
15107 : FirstHVACIteration,
15108 : DataLoopNode::SensedLoadFlagValue,
15109 : CompIndex,
15110 : QCoilActual,
15111 : SuppHeatingCoilFlag,
15112 : FanOpMode,
15113 : PartLoadFrac,
15114 : SpeedNum,
15115 : SpeedRatio);
15116 6344 : OutletTemp = state.dataLoopNodes->Node(OutletNode).Temp;
15117 6344 : if (OutletTemp > DesOutTemp && SensibleLoad) break;
15118 : }
15119 2243 : } break;
15120 0 : case DataHVACGlobals::Coil_HeatingDesuperheater: {
15121 0 : HeatingCoils::SimulateHeatingCoilComponents(
15122 : state, CompName, FirstHVACIteration, DataLoopNode::SensedLoadFlagValue, CompIndex, _, SuppHeatingCoilFlag, FanOpMode);
15123 0 : } break;
15124 0 : case DataHVACGlobals::Coil_HeatingWater: {
15125 0 : mdot = this->m_MaxSuppCoilFluidFlow;
15126 0 : PlantUtilities::SetComponentFlowRate(
15127 : state, mdot, this->m_SuppCoilFluidInletNode, this->m_SuppCoilFluidOutletNodeNum, this->m_SuppCoilPlantLoc);
15128 :
15129 0 : WaterCoils::SimulateWaterCoilComponents(
15130 : state, CompName, FirstHVACIteration, this->m_SuppHeatCoilIndex, _, this->m_FanOpMode, PartLoadFrac);
15131 0 : } break;
15132 0 : case DataHVACGlobals::Coil_HeatingSteam: {
15133 0 : mdot = this->m_MaxSuppCoilFluidFlow;
15134 0 : PlantUtilities::SetComponentFlowRate(
15135 : state, mdot, this->m_SuppCoilFluidInletNode, this->m_SuppCoilFluidOutletNodeNum, this->m_SuppCoilPlantLoc);
15136 :
15137 0 : SteamCoils::SimulateSteamCoilComponents(state,
15138 : CompName,
15139 : FirstHVACIteration,
15140 : this->m_SuppHeatCoilIndex,
15141 : 1.0,
15142 : _,
15143 : this->m_FanOpMode,
15144 : PartLoadFrac); // QCoilReq, simulate any load > 0 to get max capacity
15145 0 : } break;
15146 0 : case DataHVACGlobals::Coil_UserDefined: {
15147 : // should never get here, coil has already been simulated
15148 0 : } break;
15149 0 : default:
15150 0 : break;
15151 : }
15152 :
15153 4486 : FullOutput = state.dataLoopNodes->Node(InletNode).MassFlowRate *
15154 6729 : Psychrometrics::PsyDeltaHSenFnTdb2W2Tdb1W1(state.dataLoopNodes->Node(OutletNode).Temp,
15155 2243 : state.dataLoopNodes->Node(OutletNode).HumRat,
15156 2243 : state.dataLoopNodes->Node(InletNode).Temp,
15157 2243 : state.dataLoopNodes->Node(InletNode).HumRat);
15158 :
15159 : // If the FullOutput outlet temp is less than (insufficient heating) or very near set point,
15160 : // run the coil at PartLoadFrac = 1.
15161 2243 : if (state.dataLoopNodes->Node(OutletNode).Temp < (DesOutTemp + Acc)) {
15162 0 : PartLoadFrac = 1.0;
15163 0 : CycRatio = 1.0;
15164 0 : SpeedRatio = 1.0;
15165 : } else {
15166 2243 : switch (this->m_SuppHeatCoilType_Num) {
15167 0 : case DataHVACGlobals::Coil_HeatingGasOrOtherFuel:
15168 : case DataHVACGlobals::Coil_HeatingElectric:
15169 : case DataHVACGlobals::Coil_HeatingDesuperheater: {
15170 0 : bool tmpSuppHeatingCoilFlag = SuppHeatingCoilFlag; // CONST_LAMBDA_CAPTURE
15171 : auto f =
15172 0 : [&state, this, FirstHVACIteration, DesOutTemp, FanOpMode, tmpSuppHeatingCoilFlag](Real64 const PartLoadFrac) {
15173 0 : return this->gasElecHeatingCoilResidual(state,
15174 : PartLoadFrac,
15175 : this->m_UnitarySysNum,
15176 : FirstHVACIteration,
15177 : DesOutTemp,
15178 : tmpSuppHeatingCoilFlag,
15179 : FanOpMode,
15180 : this->m_DesignSuppHeatingCapacity);
15181 0 : };
15182 0 : General::SolveRoot(state, Acc, MaxIte, SolFla, PartLoadFrac, f, 0.0, 1.0);
15183 0 : } break;
15184 2243 : case DataHVACGlobals::Coil_HeatingElectric_MultiStage: {
15185 2243 : if (this->m_SuppHeatingSpeedNum > 1) {
15186 26904 : auto f = [&state, this, DesOutTemp, CycRatio, FanOpMode](Real64 const SpeedRatio) {
15187 20178 : return UnitarySys::heatingCoilVarSpeedResidual(state,
15188 : SpeedRatio,
15189 : this->m_SuppHeatCoilIndex,
15190 : DesOutTemp,
15191 : this->m_UnitarySysNum,
15192 : CycRatio,
15193 : this->m_SuppHeatingSpeedNum,
15194 : FanOpMode,
15195 : DataHVACGlobals::CompressorOperation::On,
15196 : true);
15197 8968 : };
15198 2242 : General::SolveRoot(state, Acc, MaxIte, SolFla, SpeedRatio, f, 0.0, 1.0);
15199 2242 : this->m_SuppHeatingCycRatio = CycRatio;
15200 2242 : this->m_SuppHeatingSpeedRatio = SpeedRatio;
15201 2242 : this->m_SuppHeatPartLoadFrac = SpeedRatio;
15202 2242 : PartLoadFrac = SpeedRatio;
15203 : } else {
15204 1 : SpeedRatio = 0.0;
15205 1 : this->m_SuppHeatingSpeedRatio = SpeedRatio;
15206 12 : auto f = [&state, this, DesOutTemp, SpeedRatio, FanOpMode](Real64 const CycRatio) {
15207 9 : return UnitarySys::heatingCoilVarSpeedCycResidual(state,
15208 : CycRatio,
15209 : this->m_SuppHeatCoilIndex,
15210 : DesOutTemp,
15211 : this->m_UnitarySysNum,
15212 : SpeedRatio,
15213 : this->m_SuppHeatingSpeedNum,
15214 : FanOpMode,
15215 : DataHVACGlobals::CompressorOperation::On,
15216 : true);
15217 4 : };
15218 1 : General::SolveRoot(state, Acc, MaxIte, SolFla, CycRatio, f, 0.0, 1.0);
15219 1 : this->m_SuppHeatingCycRatio = CycRatio;
15220 1 : this->m_SuppHeatPartLoadFrac = CycRatio;
15221 1 : PartLoadFrac = CycRatio;
15222 : }
15223 2243 : } break;
15224 0 : case DataHVACGlobals::Coil_HeatingWater: {
15225 : // calculate max waterside PLR from mdot request above in case plant chokes water flow
15226 0 : maxPartLoadFrac =
15227 0 : min(1.0,
15228 0 : ((mdot / this->m_MaxSuppCoilFluidFlow) + 0.001)); // plant can limit flow and RegulaFalsi could hit
15229 : // max iteration limit (leave a little slop, 0.001)
15230 0 : auto f = [&state, this, FirstHVACIteration, DesOutTemp](Real64 const PartLoadFrac) {
15231 0 : Real64 mdot = min(state.dataLoopNodes->Node(this->m_SuppCoilFluidOutletNodeNum).MassFlowRateMaxAvail,
15232 0 : this->m_MaxSuppCoilFluidFlow * PartLoadFrac);
15233 0 : state.dataLoopNodes->Node(this->m_SuppCoilFluidInletNode).MassFlowRate = mdot;
15234 0 : WaterCoils::SimulateWaterCoilComponents(state,
15235 : this->m_SuppHeatCoilName,
15236 : FirstHVACIteration,
15237 : this->m_SuppHeatCoilIndex,
15238 : 0.0, // QActual
15239 : this->m_FanOpMode,
15240 : PartLoadFrac);
15241 :
15242 0 : return DesOutTemp - state.dataLoopNodes->Node(this->SuppCoilOutletNodeNum).Temp;
15243 0 : };
15244 :
15245 0 : General::SolveRoot(state, Acc, SolveMaxIter, SolFla, PartLoadFrac, f, 0.0, maxPartLoadFrac);
15246 0 : } break;
15247 0 : case DataHVACGlobals::Coil_HeatingSteam: {
15248 :
15249 : // calculate max waterside PLR from mdot request above in case plant chokes water flow
15250 0 : maxPartLoadFrac =
15251 0 : min(1.0,
15252 0 : ((mdot / this->m_MaxSuppCoilFluidFlow) + 0.001)); // plant can limit flow and RegulaFalsi could hit
15253 : // max iteration limit (leave a little slop, 0.001)
15254 :
15255 0 : auto f = [&state, this, FirstHVACIteration, DesOutTemp](Real64 const PartLoadFrac) {
15256 : Real64 mdot;
15257 :
15258 0 : mdot = min(state.dataLoopNodes->Node(this->m_SuppCoilFluidOutletNodeNum).MassFlowRateMaxAvail,
15259 0 : this->m_MaxSuppCoilFluidFlow * PartLoadFrac);
15260 0 : state.dataLoopNodes->Node(this->m_SuppCoilFluidInletNode).MassFlowRate = mdot;
15261 0 : SteamCoils::SimulateSteamCoilComponents(state,
15262 : this->m_SuppHeatCoilName,
15263 : FirstHVACIteration,
15264 : this->m_SuppHeatCoilIndex,
15265 : 1.0,
15266 : _,
15267 : this->m_FanOpMode,
15268 : PartLoadFrac);
15269 0 : return DesOutTemp - state.dataLoopNodes->Node(this->HeatCoilOutletNodeNum).Temp; // RR this should be supp coil
15270 0 : };
15271 :
15272 0 : General::SolveRoot(state, Acc, MaxIte, SolFla, PartLoadFrac, f, 0.0, maxPartLoadFrac);
15273 0 : } break;
15274 0 : case DataHVACGlobals::Coil_UserDefined: {
15275 : // do nothing, coil has already been simulated
15276 0 : } break;
15277 0 : default:
15278 0 : break;
15279 : }
15280 :
15281 : } // IF ((FullOutput - ReqOutput) < Acc) THEN
15282 : } // IF ((NoOutput-ReqOutput) > Acc) THEN
15283 :
15284 4290 : if (PartLoadFrac > 1.0) {
15285 0 : PartLoadFrac = 1.0;
15286 4290 : } else if (PartLoadFrac < 0.0) {
15287 0 : PartLoadFrac = 0.0;
15288 : }
15289 :
15290 4290 : if (SolFla == -1) {
15291 0 : if (!state.dataGlobal->WarmupFlag) {
15292 0 : if (this->warnIndex.m_SuppHeatCoilSensPLRIter < 1) {
15293 0 : ++this->warnIndex.m_SuppHeatCoilSensPLRIter;
15294 0 : ShowWarningError(state,
15295 0 : this->UnitType +
15296 0 : " - Iteration limit exceeded calculating sensible part-load ratio for unit = " + this->Name);
15297 0 : ShowContinueError(state, format("Estimated part-load ratio = {:.3R}", (ReqOutput / FullOutput)));
15298 0 : ShowContinueError(state, format("Calculated part-load ratio = {:.3R}", PartLoadFrac));
15299 0 : ShowContinueErrorTimeStamp(
15300 : state, "The calculated part-load ratio will be used and the simulation continues. Occurrence info:");
15301 : } else {
15302 0 : ShowRecurringWarningErrorAtEnd(
15303 : state,
15304 0 : this->UnitType + " \"" + this->Name +
15305 : "\" - Iteration limit exceeded calculating sensible part-load ratio error continues. "
15306 : "Sensible PLR statistics follow.",
15307 : this->warnIndex.m_SuppHeatCoilSensPLRIterIndex,
15308 : PartLoadFrac,
15309 : PartLoadFrac);
15310 : }
15311 : } // IF(.NOT. WarmupFlag)THEN
15312 4290 : } else if (SolFla == -2) {
15313 0 : PartLoadFrac = ReqOutput / FullOutput;
15314 0 : if (!state.dataGlobal->WarmupFlag) {
15315 0 : if (this->warnIndex.m_SuppHeatCoilSensPLRFail < 1) {
15316 0 : ++this->warnIndex.m_SuppHeatCoilSensPLRFail;
15317 0 : ShowWarningError(
15318 : state,
15319 0 : this->UnitType +
15320 0 : " - sensible part-load ratio calculation failed: part-load ratio limits exceeded, for unit = " + this->Name);
15321 0 : ShowContinueError(state, format("Estimated part-load ratio = {:.3R}", PartLoadFrac));
15322 0 : ShowContinueErrorTimeStamp(
15323 : state, "The estimated part-load ratio will be used and the simulation continues. Occurrence info:");
15324 : } else {
15325 0 : ShowRecurringWarningErrorAtEnd(
15326 : state,
15327 0 : this->UnitType + " \"" + this->Name +
15328 : "\" - sensible part-load ratio calculation failed error continues. Sensible PLR statistics follow.",
15329 : this->warnIndex.m_SuppHeatCoilSensPLRFailIndex,
15330 : PartLoadFrac,
15331 : PartLoadFrac);
15332 : }
15333 : } // IF(.NOT. WarmupFlag)THEN
15334 : } // IF (SolFla == -1) THEN
15335 :
15336 4290 : this->m_SuppHeatPartLoadFrac = PartLoadFrac;
15337 4290 : this->m_SuppHeatingCycRatio = CycRatio;
15338 4290 : this->m_SuppHeatingSpeedRatio = SpeedRatio;
15339 : } // IF (NOT EMS OVERRIDE) THEN
15340 :
15341 : } // IF SENSIBLE LOAD
15342 : } // IF((GetCurrentScheduleValue(state, UnitarySystem(UnitarySysNum)%m_SysAvailSchedPtr) > 0.0d0) .AND. &
15343 :
15344 : // LoopHeatingCoilMaxRTF used for AirflowNetwork gets set in child components (gas and fuel)
15345 80088 : if (state.afn->distribution_simulated) {
15346 0 : state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).AFNLoopHeatingCoilMaxRTF =
15347 0 : max(state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).AFNLoopHeatingCoilMaxRTF, LoopHeatingCoilMaxRTFSave);
15348 0 : state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).AFNLoopDXCoilRTF =
15349 0 : max(state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).AFNLoopDXCoilRTF, LoopDXCoilMaxRTFSave);
15350 : }
15351 :
15352 160176 : if (this->m_SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingWater ||
15353 80088 : this->m_SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingSteam) {
15354 0 : mdot = PartLoadFrac * this->m_MaxSuppCoilFluidFlow;
15355 0 : PlantUtilities::SetComponentFlowRate(
15356 : state, mdot, this->m_SuppCoilFluidInletNode, this->m_SuppCoilFluidOutletNodeNum, this->m_SuppCoilPlantLoc);
15357 : }
15358 80088 : }
15359 :
15360 22345 : void UnitarySys::simMultiSpeedCoils(EnergyPlusData &state,
15361 : int const AirLoopNum, // Index to air loop
15362 : bool const FirstHVACIteration, // True when first HVAC iteration
15363 : DataHVACGlobals::CompressorOperation &CompressorOn, // compresor on/off control
15364 : bool const SensibleLoad,
15365 : bool const LatentLoad,
15366 : Real64 const PartLoadFrac,
15367 : int const CoilType,
15368 : int const SpeedNumber)
15369 : {
15370 :
15371 : // SUBROUTINE INFORMATION:
15372 : // AUTHOR Chandan Sharma, FSEC
15373 : // DATE WRITTEN March 2013
15374 :
15375 : // PURPOSE OF THIS SUBROUTINE:
15376 : // This subroutine manages multispeed and variable speed cooling coil simulation.
15377 :
15378 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
15379 44690 : std::string CompName; // Name of Unitary System object
15380 22345 : Real64 SensLoad = 0.0;
15381 22345 : Real64 LatLoad = 0.0;
15382 22345 : int CoilTypeNum = 0;
15383 22345 : int CoilOutletNodeNum = 0;
15384 22345 : int CompIndex = 0;
15385 22345 : Real64 SpeedRatio = 0.0;
15386 22345 : Real64 CycRatio = 0.0;
15387 22345 : Real64 dummy = 0.0;
15388 :
15389 22345 : if (CoilType == CoolingCoil) {
15390 :
15391 15606 : CompName = this->m_CoolingCoilName;
15392 15606 : CompIndex = this->m_CoolingCoilIndex;
15393 15606 : CoilTypeNum = this->m_CoolingCoilType_Num;
15394 15606 : CoilOutletNodeNum = this->CoolCoilOutletNodeNum;
15395 15606 : if (SensibleLoad) {
15396 15606 : SensLoad = -1.0;
15397 15606 : state.dataUnitarySystems->CoolingLoad = true;
15398 15606 : state.dataUnitarySystems->HeatingLoad = false;
15399 : }
15400 15606 : if (LatentLoad) LatLoad = -1.0;
15401 :
15402 : } else {
15403 :
15404 6739 : CompName = this->m_HeatingCoilName;
15405 6739 : CompIndex = this->m_HeatingCoilIndex;
15406 6739 : CoilTypeNum = this->m_HeatingCoilType_Num;
15407 6739 : CoilOutletNodeNum = this->HeatCoilOutletNodeNum;
15408 :
15409 6739 : if (SensibleLoad) {
15410 6739 : SensLoad = 1.0;
15411 6739 : state.dataUnitarySystems->CoolingLoad = false;
15412 6739 : state.dataUnitarySystems->HeatingLoad = true;
15413 : } else {
15414 0 : SensLoad = 0.0;
15415 0 : state.dataUnitarySystems->HeatingLoad = false;
15416 : }
15417 6739 : LatLoad = 0.0;
15418 : }
15419 :
15420 22345 : Real64 OnOffAirFlowRatio = 1.0;
15421 22345 : this->setOnOffMassFlowRate(state, OnOffAirFlowRatio, PartLoadFrac); // 1.0d0 = PartLoadRatio
15422 :
15423 22345 : this->calcPassiveSystem(state, AirLoopNum, FirstHVACIteration);
15424 :
15425 22345 : if ((CoilTypeNum == DataHVACGlobals::CoilDX_MultiSpeedCooling) || (CoilTypeNum == DataHVACGlobals::CoilDX_MultiSpeedHeating)) {
15426 :
15427 : // TODO: THIS IF SECTION DOES NOTHING
15428 22345 : if (CoilType == DataHVACGlobals::Cooling) {
15429 0 : if (this->m_CoolingSpeedNum <= 1.0) {
15430 0 : SpeedRatio = 0.0;
15431 0 : CycRatio = PartLoadFrac;
15432 : } else {
15433 0 : if (this->m_SingleMode == 0) {
15434 0 : SpeedRatio = PartLoadFrac;
15435 0 : CycRatio = 0.0;
15436 : } else {
15437 0 : SpeedRatio = 1.0;
15438 0 : CycRatio = PartLoadFrac;
15439 : }
15440 : }
15441 : } else {
15442 22345 : if (this->m_HeatingSpeedNum <= 1.0) {
15443 20100 : SpeedRatio = 0.0;
15444 20100 : CycRatio = PartLoadFrac;
15445 : } else {
15446 2245 : if (this->m_SingleMode == 0) {
15447 2245 : SpeedRatio = PartLoadFrac;
15448 2245 : CycRatio = 0.0;
15449 : } else {
15450 0 : SpeedRatio = 1.0;
15451 0 : CycRatio = PartLoadFrac;
15452 : }
15453 : }
15454 : }
15455 22345 : DXCoils::SimDXCoilMultiSpeed(state,
15456 : CompName,
15457 : 0.0,
15458 : PartLoadFrac,
15459 : CompIndex,
15460 : SpeedNumber,
15461 : this->m_FanOpMode,
15462 : DataHVACGlobals::CompressorOperation::On,
15463 : this->m_SingleMode);
15464 :
15465 0 : } else if (CoilTypeNum == DataHVACGlobals::CoilDX_Cooling) {
15466 :
15467 0 : if (CoilType == DataHVACGlobals::Cooling) {
15468 0 : if (this->m_CoolingSpeedNum <= 1.0) {
15469 0 : SpeedRatio = 0.0;
15470 0 : CycRatio = PartLoadFrac;
15471 : } else {
15472 0 : if (this->m_SingleMode == 0) {
15473 0 : SpeedRatio = PartLoadFrac;
15474 0 : CycRatio = 0.0;
15475 : } else {
15476 0 : SpeedRatio = 1.0;
15477 0 : CycRatio = PartLoadFrac;
15478 : }
15479 : }
15480 : }
15481 0 : bool const singleMode = (this->m_SingleMode == 1);
15482 0 : int OperationMode = DataHVACGlobals::coilNormalMode;
15483 0 : if (state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].SubcoolReheatFlag) {
15484 0 : OperationMode = DataHVACGlobals::coilSubcoolReheatMode;
15485 0 : } else if (this->m_DehumidificationMode == 1) {
15486 0 : OperationMode = DataHVACGlobals::coilEnhancedMode;
15487 : }
15488 :
15489 0 : state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate(
15490 : state, OperationMode, CycRatio, this->m_CoolingSpeedNum, SpeedRatio, this->m_FanOpMode, singleMode, this->CoilSHR);
15491 :
15492 0 : } else if (CoilTypeNum == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) {
15493 :
15494 0 : VariableSpeedCoils::SimVariableSpeedCoils(state,
15495 : CompName,
15496 : CompIndex,
15497 : this->m_FanOpMode,
15498 : this->m_MaxONOFFCyclesperHour,
15499 : this->m_HPTimeConstant,
15500 : this->m_FanDelayTime,
15501 : CompressorOn,
15502 : PartLoadFrac,
15503 : SpeedNumber,
15504 : this->m_CoolingSpeedRatio,
15505 : SensLoad,
15506 : dummy,
15507 : OnOffAirFlowRatio);
15508 :
15509 0 : } else if (CoilTypeNum == DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed) {
15510 :
15511 0 : VariableSpeedCoils::SimVariableSpeedCoils(state,
15512 : CompName,
15513 : CompIndex,
15514 : this->m_FanOpMode,
15515 : this->m_MaxONOFFCyclesperHour,
15516 : this->m_HPTimeConstant,
15517 : this->m_FanDelayTime,
15518 : CompressorOn,
15519 : PartLoadFrac,
15520 : SpeedNumber,
15521 : this->m_HeatingSpeedRatio,
15522 : SensLoad,
15523 : dummy,
15524 : OnOffAirFlowRatio);
15525 :
15526 0 : } else if (CoilTypeNum == DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit) {
15527 :
15528 0 : VariableSpeedCoils::SimVariableSpeedCoils(state,
15529 : CompName,
15530 : CompIndex,
15531 : this->m_FanOpMode,
15532 : this->m_MaxONOFFCyclesperHour,
15533 : this->m_HPTimeConstant,
15534 : this->m_FanDelayTime,
15535 : CompressorOn,
15536 : PartLoadFrac,
15537 : SpeedNumber,
15538 : this->m_CoolingSpeedRatio,
15539 : SensLoad,
15540 : dummy,
15541 : OnOffAirFlowRatio);
15542 :
15543 0 : } else if (CoilTypeNum == DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit) {
15544 :
15545 0 : VariableSpeedCoils::SimVariableSpeedCoils(state,
15546 : CompName,
15547 : CompIndex,
15548 : this->m_FanOpMode,
15549 : this->m_MaxONOFFCyclesperHour,
15550 : this->m_HPTimeConstant,
15551 : this->m_FanDelayTime,
15552 : CompressorOn,
15553 : PartLoadFrac,
15554 : SpeedNumber,
15555 : this->m_HeatingSpeedRatio,
15556 : SensLoad,
15557 : dummy,
15558 : OnOffAirFlowRatio);
15559 :
15560 0 : } else if ((CoilTypeNum == DataHVACGlobals::Coil_HeatingElectric_MultiStage) ||
15561 : (CoilTypeNum == DataHVACGlobals::Coil_HeatingGas_MultiStage)) {
15562 :
15563 0 : HeatingCoils::SimulateHeatingCoilComponents(
15564 : state, CompName, FirstHVACIteration, _, CompIndex, _, _, this->m_FanOpMode, PartLoadFrac, SpeedNumber, this->m_HeatingSpeedRatio);
15565 : } else {
15566 : }
15567 22345 : }
15568 :
15569 34143 : void UnitarySys::calcPassiveSystem(EnergyPlusData &state,
15570 : int const AirLoopNum, // index to air loop
15571 : bool const FirstHVACIteration // True when first HVAC iteration
15572 : )
15573 : {
15574 :
15575 : // SUBROUTINE INFORMATION:
15576 : // AUTHOR Richard Raustad, FSEC
15577 : // DATE WRITTEN February 2013
15578 :
15579 : // PURPOSE OF THIS SUBROUTINE:
15580 : // This subroutine calculates the set point based output of the unitary system.
15581 :
15582 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
15583 34143 : Real64 PartLoadRatio = 0.0; // coil operating part-load ratio
15584 34143 : DataHVACGlobals::CompressorOperation CompressorOn = DataHVACGlobals::CompressorOperation::Off; // compressor control (0=off, 1=on)
15585 34143 : bool HXUnitOn = false;
15586 34143 : Real64 OnOffAirFlowRatio = 1.0;
15587 34143 : Real64 CoilCoolHeatRat = 1.0;
15588 34143 : Real64 HeatCoilLoad = 0.0;
15589 : // CALL the series of components that simulate a Unitary System
15590 34143 : if (this->m_FanExists && this->m_FanPlace == FanPlace::BlowThru) {
15591 29280 : if (this->m_FanType_Num == DataHVACGlobals::FanType_SystemModelObject) {
15592 0 : state.dataHVACFan->fanObjs[this->m_FanIndex]->simulate(state,
15593 : _,
15594 : _,
15595 : _,
15596 : _,
15597 0 : state.dataUnitarySystems->m_massFlow1,
15598 0 : state.dataUnitarySystems->m_runTimeFraction1,
15599 0 : state.dataUnitarySystems->m_massFlow2,
15600 0 : state.dataUnitarySystems->m_runTimeFraction2,
15601 : _);
15602 : } else {
15603 29280 : if (this->m_IsZoneEquipment) {
15604 0 : Fans::SimulateFanComponents(state,
15605 : blankString,
15606 : FirstHVACIteration,
15607 : this->m_FanIndex,
15608 0 : state.dataUnitarySystems->FanSpeedRatio,
15609 0 : state.dataHVACGlobal->ZoneCompTurnFansOn,
15610 0 : state.dataHVACGlobal->ZoneCompTurnFansOff);
15611 : } else {
15612 29280 : Fans::SimulateFanComponents(state, blankString, FirstHVACIteration, this->m_FanIndex, state.dataUnitarySystems->FanSpeedRatio);
15613 : }
15614 : }
15615 : }
15616 :
15617 34143 : if (this->m_CoolingCoilUpstream) {
15618 :
15619 34143 : if (this->m_CoolCoilExists) {
15620 34143 : PartLoadRatio = this->m_CoolingPartLoadFrac;
15621 34143 : CompressorOn = DataHVACGlobals::CompressorOperation::Off;
15622 34143 : if (PartLoadRatio > 0.0) CompressorOn = DataHVACGlobals::CompressorOperation::On;
15623 34143 : HXUnitOn = false;
15624 34143 : this->calcUnitaryCoolingSystem(
15625 : state, AirLoopNum, FirstHVACIteration, PartLoadRatio, CompressorOn, OnOffAirFlowRatio, CoilCoolHeatRat, HXUnitOn);
15626 : }
15627 34143 : if (this->m_HeatCoilExists) {
15628 29280 : PartLoadRatio = this->m_HeatingPartLoadFrac;
15629 29280 : CompressorOn = DataHVACGlobals::CompressorOperation::Off;
15630 29280 : if (PartLoadRatio > 0.0) CompressorOn = DataHVACGlobals::CompressorOperation::On;
15631 29280 : this->calcUnitaryHeatingSystem(state, AirLoopNum, FirstHVACIteration, PartLoadRatio, CompressorOn, OnOffAirFlowRatio, HeatCoilLoad);
15632 : }
15633 :
15634 : } else {
15635 :
15636 0 : if (this->m_HeatCoilExists) {
15637 0 : PartLoadRatio = this->m_HeatingPartLoadFrac;
15638 0 : CompressorOn = DataHVACGlobals::CompressorOperation::Off;
15639 0 : if (PartLoadRatio > 0.0) CompressorOn = DataHVACGlobals::CompressorOperation::On;
15640 0 : this->calcUnitaryHeatingSystem(state, AirLoopNum, FirstHVACIteration, PartLoadRatio, CompressorOn, OnOffAirFlowRatio, HeatCoilLoad);
15641 : }
15642 0 : if (this->m_CoolCoilExists) {
15643 0 : PartLoadRatio = this->m_CoolingPartLoadFrac;
15644 0 : CompressorOn = DataHVACGlobals::CompressorOperation::Off;
15645 0 : if (PartLoadRatio > 0.0) CompressorOn = DataHVACGlobals::CompressorOperation::On;
15646 0 : HXUnitOn = false;
15647 0 : this->calcUnitaryCoolingSystem(
15648 : state, AirLoopNum, FirstHVACIteration, PartLoadRatio, CompressorOn, OnOffAirFlowRatio, CoilCoolHeatRat, HXUnitOn);
15649 : }
15650 : }
15651 :
15652 34143 : if (this->m_FanExists && this->m_FanPlace == FanPlace::DrawThru) {
15653 0 : if (this->m_FanType_Num == DataHVACGlobals::FanType_SystemModelObject) {
15654 0 : state.dataHVACFan->fanObjs[this->m_FanIndex]->simulate(state,
15655 : _,
15656 : _,
15657 : _,
15658 : _,
15659 0 : state.dataUnitarySystems->m_massFlow1,
15660 0 : state.dataUnitarySystems->m_runTimeFraction1,
15661 0 : state.dataUnitarySystems->m_massFlow2,
15662 0 : state.dataUnitarySystems->m_runTimeFraction2,
15663 : _);
15664 : } else {
15665 0 : if (this->m_IsZoneEquipment) {
15666 0 : Fans::SimulateFanComponents(state,
15667 : blankString,
15668 : FirstHVACIteration,
15669 : this->m_FanIndex,
15670 0 : state.dataUnitarySystems->FanSpeedRatio,
15671 0 : state.dataHVACGlobal->ZoneCompTurnFansOn,
15672 0 : state.dataHVACGlobal->ZoneCompTurnFansOff);
15673 : } else {
15674 0 : Fans::SimulateFanComponents(state, blankString, FirstHVACIteration, this->m_FanIndex, state.dataUnitarySystems->FanSpeedRatio);
15675 : }
15676 : }
15677 : }
15678 :
15679 : // CALL reheat coils next
15680 34143 : if (this->m_SuppCoilExists) {
15681 29280 : state.dataUnitarySystems->SuppHeatingCoilFlag = true;
15682 29280 : this->calcUnitarySuppSystemToSP(state, FirstHVACIteration);
15683 29280 : state.dataUnitarySystems->SuppHeatingCoilFlag = false;
15684 : }
15685 34143 : }
15686 :
15687 6060022 : void UnitarySys::reportUnitarySystem(EnergyPlusData &state, int const AirLoopNum)
15688 : {
15689 :
15690 : // SUBROUTINE INFORMATION:
15691 : // AUTHOR Chandan Sharma
15692 : // DATE WRITTEN July 2013
15693 :
15694 : // PURPOSE OF THIS SUBROUTINE:
15695 : // This subroutine updates the report variable for the coils.
15696 :
15697 6060022 : auto &OASysEqSizing(state.dataSize->OASysEqSizing);
15698 6060022 : auto &CurOASysNum(state.dataSize->CurOASysNum);
15699 :
15700 6060022 : Real64 ReportingConstant = state.dataHVACGlobal->TimeStepSys * DataGlobalConstants::SecInHour;
15701 :
15702 6060022 : Real64 SensibleOutput = 0.0; // sensible output rate, {W}
15703 6060022 : Real64 LatentOutput = 0.0; // latent output rate, {W}
15704 6060022 : Real64 TotalOutput = 0.0; // total output rate, {W}
15705 6060022 : Real64 QTotUnitOut = 0.0;
15706 6060022 : Real64 QSensUnitOut = 0.0;
15707 6060022 : this->m_PartLoadFrac = 0.0;
15708 6060022 : this->m_CompPartLoadRatio = 0.0;
15709 6060022 : this->m_CycRatio = 0.0;
15710 6060022 : this->m_SpeedRatio = 0.0;
15711 6060022 : this->FanPartLoadRatio = 0.0;
15712 6060022 : this->m_TotalAuxElecPower = 0.0;
15713 6060022 : this->m_HeatingAuxElecConsumption = 0.0;
15714 6060022 : this->m_CoolingAuxElecConsumption = 0.0;
15715 6060022 : this->m_ElecPower = 0.0;
15716 6060022 : this->m_ElecPowerConsumption = 0.0;
15717 :
15718 6060022 : Real64 AirMassFlow = state.dataLoopNodes->Node(this->AirOutNode).MassFlowRate;
15719 6060022 : switch (this->m_ControlType) {
15720 : // Noticed that these are calculated differently.
15721 : // That doesn't make sense except that NodeNumOfControlledZone = 0 for set point control because the control zone name is not required.
15722 3559166 : case UnitarySysCtrlType::Setpoint: {
15723 3559166 : if (this->AirOutNode > 0) {
15724 3559166 : int InletNode = this->AirInNode;
15725 14236664 : CalcComponentSensibleLatentOutput(AirMassFlow,
15726 3559166 : state.dataLoopNodes->Node(this->AirOutNode).Temp,
15727 3559166 : state.dataLoopNodes->Node(this->AirOutNode).HumRat,
15728 3559166 : state.dataLoopNodes->Node(InletNode).Temp,
15729 3559166 : state.dataLoopNodes->Node(InletNode).HumRat,
15730 : SensibleOutput,
15731 : LatentOutput,
15732 : TotalOutput);
15733 3559166 : QSensUnitOut = SensibleOutput - this->m_SenLoadLoss;
15734 3559166 : QTotUnitOut = TotalOutput;
15735 : }
15736 3559166 : } break;
15737 2500856 : default: {
15738 2500856 : if (this->AirOutNode > 0 && this->NodeNumOfControlledZone > 0) {
15739 : // PTUnit uses old style method of calculating delivered capacity.
15740 : // Also PTUnit always uses inlet node data, which is good when inlet is connected to zone return node
15741 2500856 : if (this->m_sysType == SysType::PackagedAC || this->m_sysType == SysType::PackagedHP || this->m_sysType == SysType::PackagedWSHP) {
15742 1231508 : Real64 SpecHumOut = state.dataLoopNodes->Node(this->AirOutNode).HumRat;
15743 1231508 : Real64 SpecHumIn = state.dataLoopNodes->Node(this->AirInNode).HumRat;
15744 1231508 : LatentOutput = AirMassFlow * (SpecHumOut - SpecHumIn); // Latent rate, kg/s (dehumid = negative)
15745 2463016 : SensibleOutput = AirMassFlow * (Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(this->AirOutNode).Temp,
15746 2463016 : state.dataLoopNodes->Node(this->AirInNode).HumRat) -
15747 1231508 : Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(this->AirInNode).Temp,
15748 1231508 : state.dataLoopNodes->Node(this->AirInNode).HumRat));
15749 1231508 : TotalOutput =
15750 2463016 : AirMassFlow * (state.dataLoopNodes->Node(this->AirOutNode).Enthalpy - state.dataLoopNodes->Node(this->AirInNode).Enthalpy);
15751 : } else {
15752 : // air loop systems don't use the Sensible capacity, zone equipment uses this to adjust RemainingOutputRequired
15753 5077392 : CalcZoneSensibleLatentOutput(AirMassFlow,
15754 1269348 : state.dataLoopNodes->Node(this->AirOutNode).Temp,
15755 1269348 : state.dataLoopNodes->Node(this->AirOutNode).HumRat,
15756 1269348 : state.dataLoopNodes->Node(this->NodeNumOfControlledZone).Temp,
15757 1269348 : state.dataLoopNodes->Node(this->NodeNumOfControlledZone).HumRat,
15758 : SensibleOutput,
15759 : LatentOutput,
15760 : TotalOutput);
15761 : }
15762 2500856 : QSensUnitOut = SensibleOutput - this->m_SenLoadLoss;
15763 2500856 : QTotUnitOut = TotalOutput;
15764 : }
15765 2500856 : } break;
15766 : }
15767 :
15768 : // set the system part-load ratio report variable
15769 6060022 : this->m_PartLoadFrac = max(this->m_CoolingPartLoadFrac, this->m_HeatingPartLoadFrac);
15770 : // set the compressor part-load ratio report variable
15771 6060022 : this->m_CompPartLoadRatio = max(this->m_CoolCompPartLoadRatio, this->m_HeatCompPartLoadRatio);
15772 :
15773 : // logic difference in PTUnit *Rate reporting vs UnitarySystem. Use PTUnit more compact method for 9093.
15774 6060022 : if (this->m_sysType == SysType::PackagedAC || this->m_sysType == SysType::PackagedHP || this->m_sysType == SysType::PackagedWSHP) {
15775 : // Issue 9093.
15776 : // PTHP reports these differently, seems this is correct. Can't change this now, need an issue to resolve
15777 1231508 : this->m_TotCoolEnergyRate = std::abs(min(0.0, QTotUnitOut));
15778 1231508 : this->m_TotHeatEnergyRate = std::abs(max(0.0, QTotUnitOut));
15779 1231508 : this->m_SensCoolEnergyRate = std::abs(min(0.0, QSensUnitOut));
15780 1231508 : this->m_SensHeatEnergyRate = std::abs(max(0.0, QSensUnitOut));
15781 1231508 : this->m_LatCoolEnergyRate = std::abs(min(0.0, (QTotUnitOut - QSensUnitOut)));
15782 1231508 : this->m_LatHeatEnergyRate = std::abs(max(0.0, (QTotUnitOut - QSensUnitOut)));
15783 : } else {
15784 4828514 : if (state.dataUnitarySystems->HeatingLoad) {
15785 617884 : if (QTotUnitOut > 0.0) { // heating
15786 389501 : this->m_TotCoolEnergyRate = 0.0;
15787 389501 : this->m_SensCoolEnergyRate = 0.0;
15788 389501 : this->m_LatCoolEnergyRate = 0.0;
15789 389501 : this->m_TotHeatEnergyRate = QTotUnitOut;
15790 389501 : this->m_SensHeatEnergyRate = std::abs(max(0.0, QSensUnitOut));
15791 389501 : this->m_LatHeatEnergyRate = std::abs(max(0.0, (QTotUnitOut - QSensUnitOut)));
15792 : } else {
15793 228383 : this->m_TotCoolEnergyRate = std::abs(QTotUnitOut);
15794 228383 : this->m_SensCoolEnergyRate = std::abs(min(0.0, QSensUnitOut));
15795 228383 : this->m_LatCoolEnergyRate = std::abs(min(0.0, (QTotUnitOut - QSensUnitOut)));
15796 228383 : this->m_TotHeatEnergyRate = 0.0;
15797 228383 : this->m_SensHeatEnergyRate = 0.0;
15798 228383 : this->m_LatHeatEnergyRate = 0.0;
15799 : }
15800 : } else {
15801 4210630 : if (QTotUnitOut <= 0.0) { // cooling
15802 4067754 : this->m_TotCoolEnergyRate = std::abs(min(0.0, QTotUnitOut));
15803 4067754 : this->m_SensCoolEnergyRate = std::abs(min(0.0, QSensUnitOut));
15804 4067754 : this->m_LatCoolEnergyRate = std::abs(min(0.0, (QTotUnitOut - QSensUnitOut)));
15805 4067754 : this->m_TotHeatEnergyRate = 0.0;
15806 4067754 : this->m_SensHeatEnergyRate = 0.0;
15807 4067754 : this->m_LatHeatEnergyRate = 0.0;
15808 : } else {
15809 142876 : this->m_TotCoolEnergyRate = 0.0;
15810 142876 : this->m_SensCoolEnergyRate = 0.0;
15811 142876 : this->m_LatCoolEnergyRate = 0.0;
15812 142876 : this->m_TotHeatEnergyRate = QTotUnitOut;
15813 142876 : this->m_SensHeatEnergyRate = std::abs(max(0.0, QSensUnitOut));
15814 142876 : this->m_LatHeatEnergyRate = std::abs(max(0.0, (QTotUnitOut - QSensUnitOut)));
15815 : }
15816 : }
15817 : }
15818 :
15819 6060022 : this->m_TotHeatEnergy = m_TotHeatEnergyRate * ReportingConstant;
15820 6060022 : this->m_TotCoolEnergy = m_TotCoolEnergyRate * ReportingConstant;
15821 6060022 : this->m_SensHeatEnergy = m_SensHeatEnergyRate * ReportingConstant;
15822 6060022 : this->m_SensCoolEnergy = m_SensCoolEnergyRate * ReportingConstant;
15823 6060022 : this->m_LatHeatEnergy = m_LatHeatEnergyRate * ReportingConstant;
15824 6060022 : this->m_LatCoolEnergy = m_LatCoolEnergyRate * ReportingConstant;
15825 :
15826 6060022 : if (this->m_FanExists && this->AirOutNode > 0) {
15827 2580944 : if (state.dataUnitarySystems->CompOnMassFlow > 0.0) {
15828 2504855 : this->FanPartLoadRatio = state.dataLoopNodes->Node(this->AirOutNode).MassFlowRate / state.dataUnitarySystems->CompOnMassFlow;
15829 : }
15830 2580944 : if (AirLoopNum > 0) {
15831 1327032 : if (this->m_FanOpMode == DataHVACGlobals::CycFanCycCoil) {
15832 412593 : state.dataAirLoop->AirLoopFlow(AirLoopNum).FanPLR = this->FanPartLoadRatio;
15833 : } else {
15834 914439 : state.dataAirLoop->AirLoopFlow(AirLoopNum).FanPLR = 1.0;
15835 : }
15836 : }
15837 : }
15838 :
15839 6060022 : Real64 locFanElecPower = 0.0;
15840 6060022 : if (this->m_FanType_Num == DataHVACGlobals::FanType_SystemModelObject) {
15841 413993 : locFanElecPower = state.dataHVACFan->fanObjs[this->m_FanIndex]->fanPower();
15842 : } else {
15843 5646029 : locFanElecPower = Fans::GetFanPower(state, this->m_FanIndex);
15844 : }
15845 :
15846 6060022 : Real64 elecCoolingPower = 0.0;
15847 6060022 : Real64 elecHeatingPower = 0.0;
15848 6060022 : Real64 suppHeatingPower = 0.0;
15849 :
15850 6060022 : switch (this->m_CoolingCoilType_Num) {
15851 1034668 : case DataHVACGlobals::CoilDX_CoolingTwoSpeed: {
15852 : // need to make sure these are 0 for non-variable speed coils (or not report these variables)
15853 1034668 : this->m_CycRatio = max(this->m_CoolingCycRatio, this->m_HeatingCycRatio);
15854 1034668 : this->m_SpeedRatio = max(this->m_CoolingSpeedRatio, this->m_HeatingSpeedRatio);
15855 1034668 : this->m_SpeedNum = max(this->m_CoolingSpeedNum, this->m_HeatingSpeedNum);
15856 : // see :setSpeedVariables
15857 1034668 : if (state.dataUnitarySystems->CoolingLoad && this->m_SpeedNum <= 1) {
15858 17038 : this->m_TotalAuxElecPower = this->m_AncillaryOnPower * this->m_CycRatio + this->m_AncillaryOffPower * (1.0 - this->m_CycRatio);
15859 17038 : this->m_CoolingAuxElecConsumption = this->m_AncillaryOnPower * this->m_CycRatio * ReportingConstant;
15860 : }
15861 1034668 : if (this->m_LastMode == CoolingMode) {
15862 1034668 : this->m_CoolingAuxElecConsumption += this->m_AncillaryOffPower * (1.0 - this->m_CycRatio) * ReportingConstant;
15863 : }
15864 1034668 : elecCoolingPower = state.dataHVACGlobal->DXElecCoolingPower;
15865 1034668 : } break;
15866 531346 : case DataHVACGlobals::CoilDX_MultiSpeedCooling: {
15867 531346 : this->m_CycRatio = max(this->m_CoolingCycRatio, this->m_HeatingCycRatio);
15868 531346 : this->m_SpeedRatio = max(this->m_CoolingSpeedRatio, this->m_HeatingSpeedRatio);
15869 531346 : this->m_SpeedNum = max(this->m_CoolingSpeedNum, this->m_HeatingSpeedNum);
15870 :
15871 531346 : Real64 CompPartLoadFrac = this->m_CompPartLoadRatio;
15872 531346 : if (state.dataUnitarySystems->CoolingLoad) {
15873 213311 : this->m_TotalAuxElecPower = this->m_AncillaryOnPower * CompPartLoadFrac + this->m_AncillaryOffPower * (1.0 - CompPartLoadFrac);
15874 213311 : this->m_CoolingAuxElecConsumption = this->m_AncillaryOnPower * CompPartLoadFrac * ReportingConstant;
15875 : }
15876 531346 : if (this->m_LastMode == CoolingMode) {
15877 296159 : this->m_CoolingAuxElecConsumption += this->m_AncillaryOffPower * (1.0 - CompPartLoadFrac) * ReportingConstant;
15878 : }
15879 531346 : elecCoolingPower = state.dataHVACGlobal->DXElecCoolingPower;
15880 531346 : } break;
15881 93332 : case DataHVACGlobals::Coil_CoolingWater:
15882 : case DataHVACGlobals::Coil_CoolingWaterDetailed: {
15883 93332 : if (this->m_DiscreteSpeedCoolingCoil) {
15884 14968 : this->m_CycRatio = max(this->m_CoolingCycRatio, this->m_HeatingCycRatio);
15885 14968 : this->m_SpeedRatio = max(this->m_CoolingSpeedRatio, this->m_HeatingSpeedRatio);
15886 14968 : this->m_SpeedNum = max(this->m_CoolingSpeedNum, this->m_HeatingSpeedNum);
15887 14968 : if (state.dataUnitarySystems->CoolingLoad) {
15888 : // if discrete, the coil cycles on and off
15889 5176 : this->m_TotalAuxElecPower = this->m_AncillaryOnPower * this->m_CycRatio + this->m_AncillaryOffPower * (1.0 - this->m_CycRatio);
15890 5176 : this->m_CoolingAuxElecConsumption = this->m_AncillaryOnPower * this->m_CycRatio * ReportingConstant;
15891 : }
15892 14968 : if (this->m_LastMode == CoolingMode) {
15893 7278 : this->m_CoolingAuxElecConsumption += this->m_AncillaryOffPower * (1.0 - this->m_CycRatio) * ReportingConstant;
15894 : }
15895 : } else {
15896 78364 : if (state.dataUnitarySystems->CoolingLoad) {
15897 : // if not discrete, the coil runs the entire time step.
15898 7792 : this->m_TotalAuxElecPower =
15899 7792 : this->m_AncillaryOnPower * this->m_PartLoadFrac + this->m_AncillaryOffPower * (1.0 - this->m_PartLoadFrac);
15900 7792 : this->m_CoolingAuxElecConsumption = this->m_AncillaryOnPower * this->m_PartLoadFrac * ReportingConstant;
15901 : }
15902 78364 : if (this->m_LastMode == CoolingMode) {
15903 66710 : this->m_CoolingAuxElecConsumption += this->m_AncillaryOffPower * (1.0 - this->m_PartLoadFrac) * ReportingConstant;
15904 : }
15905 : }
15906 93332 : this->m_ElecPower = locFanElecPower;
15907 93332 : this->m_ElecPowerConsumption = this->m_ElecPower * ReportingConstant;
15908 93332 : } break;
15909 605267 : case DataHVACGlobals::CoilDX_Cooling: {
15910 605267 : if (this->m_NumOfSpeedCooling > 1) {
15911 474280 : this->m_CycRatio = max(this->m_CoolingCycRatio, this->m_HeatingCycRatio);
15912 474280 : this->m_SpeedRatio = max(this->m_CoolingSpeedRatio, this->m_HeatingSpeedRatio);
15913 474280 : this->m_SpeedNum = max(this->m_CoolingSpeedNum, this->m_HeatingSpeedNum);
15914 :
15915 474280 : Real64 CompPartLoadFrac = this->m_CompPartLoadRatio;
15916 474280 : if (state.dataUnitarySystems->CoolingLoad) {
15917 232594 : this->m_TotalAuxElecPower = this->m_AncillaryOnPower * CompPartLoadFrac + this->m_AncillaryOffPower * (1.0 - CompPartLoadFrac);
15918 232594 : this->m_CoolingAuxElecConsumption = this->m_AncillaryOnPower * CompPartLoadFrac * ReportingConstant;
15919 : }
15920 474280 : if (this->m_LastMode == CoolingMode) {
15921 369467 : this->m_CoolingAuxElecConsumption += this->m_AncillaryOffPower * (1.0 - CompPartLoadFrac) * ReportingConstant;
15922 : }
15923 474280 : elecCoolingPower = state.dataHVACGlobal->DXElecCoolingPower;
15924 : } else {
15925 130987 : if (state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].SubcoolReheatFlag) {
15926 8772 : if (state.dataUnitarySystems->CoolingLoad && this->LoadSHR == 0.0) {
15927 2396 : this->LoadSHR = 1.0;
15928 2396 : this->CoilSHR = state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].performance.NormalSHR;
15929 : }
15930 : }
15931 130987 : Real64 CompPartLoadFrac = this->m_CompPartLoadRatio;
15932 130987 : if (state.dataUnitarySystems->CoolingLoad) {
15933 41851 : this->m_TotalAuxElecPower = this->m_AncillaryOnPower * CompPartLoadFrac + this->m_AncillaryOffPower * (1.0 - CompPartLoadFrac);
15934 41851 : this->m_CoolingAuxElecConsumption = this->m_AncillaryOnPower * CompPartLoadFrac * ReportingConstant;
15935 : }
15936 130987 : if (this->m_LastMode == CoolingMode) {
15937 71034 : this->m_CoolingAuxElecConsumption += this->m_AncillaryOffPower * (1.0 - CompPartLoadFrac) * ReportingConstant;
15938 : }
15939 130987 : elecCoolingPower = state.dataHVACGlobal->DXElecCoolingPower;
15940 : }
15941 605267 : } break;
15942 28972 : case DataHVACGlobals::Coil_UserDefined:
15943 : case DataHVACGlobals::CoilWater_CoolingHXAssisted:
15944 : case DataHVACGlobals::CoilDX_PackagedThermalStorageCooling: {
15945 28972 : if (state.dataUnitarySystems->CoolingLoad) {
15946 0 : this->m_TotalAuxElecPower =
15947 0 : this->m_AncillaryOnPower * this->m_PartLoadFrac + this->m_AncillaryOffPower * (1.0 - this->m_PartLoadFrac);
15948 0 : this->m_CoolingAuxElecConsumption = this->m_AncillaryOnPower * this->m_PartLoadFrac * ReportingConstant;
15949 : }
15950 28972 : if (this->m_LastMode == CoolingMode) {
15951 28972 : this->m_CoolingAuxElecConsumption += this->m_AncillaryOffPower * (1.0 - this->m_PartLoadFrac) * ReportingConstant;
15952 : }
15953 : // these coil types do not consume electricity or report electricity at the plant
15954 28972 : } break;
15955 3766437 : default: { // all other DX cooling coils
15956 3766437 : Real64 CompPartLoadFrac = this->m_CompPartLoadRatio;
15957 3766437 : if (state.dataUnitarySystems->CoolingLoad) {
15958 786188 : this->m_TotalAuxElecPower = this->m_AncillaryOnPower * CompPartLoadFrac + this->m_AncillaryOffPower * (1.0 - CompPartLoadFrac);
15959 786188 : this->m_CoolingAuxElecConsumption = this->m_AncillaryOnPower * CompPartLoadFrac * ReportingConstant;
15960 : }
15961 3766437 : if (this->m_LastMode == CoolingMode) {
15962 3049765 : this->m_CoolingAuxElecConsumption += this->m_AncillaryOffPower * (1.0 - CompPartLoadFrac) * ReportingConstant;
15963 : }
15964 3766437 : elecCoolingPower = state.dataHVACGlobal->DXElecCoolingPower;
15965 3766437 : } break;
15966 : }
15967 :
15968 6060022 : switch (this->m_HeatingCoilType_Num) {
15969 321234 : case DataHVACGlobals::CoilDX_MultiSpeedHeating: {
15970 321234 : this->m_CycRatio = max(this->m_CoolingCycRatio, this->m_HeatingCycRatio);
15971 321234 : this->m_SpeedRatio = max(this->m_CoolingSpeedRatio, this->m_HeatingSpeedRatio);
15972 321234 : this->m_SpeedNum = max(this->m_CoolingSpeedNum, this->m_HeatingSpeedNum);
15973 :
15974 321234 : Real64 CompPartLoadFrac = this->m_CompPartLoadRatio;
15975 321234 : if (state.dataUnitarySystems->HeatingLoad) {
15976 81935 : this->m_TotalAuxElecPower = this->m_AncillaryOnPower * CompPartLoadFrac + this->m_AncillaryOffPower * (1.0 - CompPartLoadFrac);
15977 81935 : this->m_HeatingAuxElecConsumption = this->m_AncillaryOnPower * CompPartLoadFrac * ReportingConstant;
15978 : }
15979 321234 : if (this->m_LastMode == HeatingMode) {
15980 83706 : this->m_HeatingAuxElecConsumption += this->m_AncillaryOffPower * (1.0 - CompPartLoadFrac) * ReportingConstant;
15981 : }
15982 321234 : elecHeatingPower = state.dataHVACGlobal->DXElecHeatingPower;
15983 321234 : } break;
15984 0 : case DataHVACGlobals::Coil_HeatingGas_MultiStage:
15985 : case DataHVACGlobals::Coil_HeatingElectric_MultiStage: {
15986 0 : this->m_CycRatio = max(this->m_CoolingCycRatio, this->m_HeatingCycRatio);
15987 0 : this->m_SpeedRatio = max(this->m_CoolingSpeedRatio, this->m_HeatingSpeedRatio);
15988 :
15989 0 : if (state.dataUnitarySystems->HeatingLoad) {
15990 0 : this->m_TotalAuxElecPower =
15991 0 : this->m_AncillaryOnPower * this->m_PartLoadFrac + this->m_AncillaryOffPower * (1.0 - this->m_PartLoadFrac);
15992 0 : this->m_HeatingAuxElecConsumption = this->m_AncillaryOnPower * this->m_PartLoadFrac * ReportingConstant;
15993 : }
15994 0 : if (this->m_LastMode == HeatingMode) {
15995 0 : this->m_HeatingAuxElecConsumption += this->m_AncillaryOffPower * (1.0 - this->m_PartLoadFrac) * ReportingConstant;
15996 : }
15997 :
15998 0 : elecHeatingPower = state.dataHVACGlobal->ElecHeatingCoilPower;
15999 0 : } break;
16000 436108 : case DataHVACGlobals::CoilDX_HeatingEmpirical:
16001 : case DataHVACGlobals::Coil_HeatingWaterToAirHP:
16002 : case DataHVACGlobals::Coil_HeatingWaterToAirHPSimple:
16003 : case DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit:
16004 : case DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed: {
16005 436108 : if (state.dataUnitarySystems->HeatingLoad) {
16006 170870 : this->m_TotalAuxElecPower =
16007 170870 : this->m_AncillaryOnPower * this->m_PartLoadFrac + this->m_AncillaryOffPower * (1.0 - this->m_PartLoadFrac);
16008 170870 : this->m_HeatingAuxElecConsumption = this->m_AncillaryOnPower * this->m_PartLoadFrac * ReportingConstant;
16009 : }
16010 436108 : if (this->m_LastMode == HeatingMode) {
16011 182812 : this->m_HeatingAuxElecConsumption += this->m_AncillaryOffPower * (1.0 - this->m_PartLoadFrac) * ReportingConstant;
16012 : }
16013 :
16014 436108 : elecHeatingPower = state.dataHVACGlobal->DXElecHeatingPower;
16015 436108 : } break;
16016 74334 : case DataHVACGlobals::Coil_UserDefined:
16017 : case DataHVACGlobals::Coil_HeatingWater:
16018 : case DataHVACGlobals::Coil_HeatingSteam:
16019 : case DataHVACGlobals::Coil_HeatingDesuperheater: {
16020 74334 : if (state.dataUnitarySystems->HeatingLoad) {
16021 31960 : this->m_TotalAuxElecPower =
16022 31960 : this->m_AncillaryOnPower * this->m_PartLoadFrac + this->m_AncillaryOffPower * (1.0 - this->m_PartLoadFrac);
16023 31960 : this->m_HeatingAuxElecConsumption = this->m_AncillaryOnPower * this->m_PartLoadFrac * ReportingConstant;
16024 : }
16025 74334 : if (this->m_LastMode == HeatingMode) {
16026 36812 : this->m_HeatingAuxElecConsumption += this->m_AncillaryOffPower * (1.0 - this->m_PartLoadFrac) * ReportingConstant;
16027 : }
16028 74334 : } break;
16029 5228346 : default: {
16030 5228346 : if (this->m_HeatCoilExists) {
16031 1755391 : if (state.dataUnitarySystems->HeatingLoad) {
16032 : // if discrete, the coil cycles on and off
16033 749156 : this->m_TotalAuxElecPower =
16034 749156 : this->m_AncillaryOnPower * this->m_PartLoadFrac + this->m_AncillaryOffPower * (1.0 - this->m_PartLoadFrac);
16035 749156 : this->m_HeatingAuxElecConsumption = this->m_AncillaryOnPower * this->m_PartLoadFrac * ReportingConstant;
16036 : }
16037 1755391 : if (this->m_LastMode == HeatingMode) {
16038 823707 : this->m_HeatingAuxElecConsumption += this->m_AncillaryOffPower * (1.0 - this->m_PartLoadFrac) * ReportingConstant;
16039 : }
16040 1755391 : elecHeatingPower = state.dataHVACGlobal->ElecHeatingCoilPower;
16041 : }
16042 5228346 : } break;
16043 : }
16044 :
16045 6060022 : if (!state.dataUnitarySystems->HeatingLoad && !state.dataUnitarySystems->CoolingLoad) {
16046 3540291 : this->m_TotalAuxElecPower = this->m_AncillaryOffPower;
16047 : }
16048 :
16049 6060022 : if (this->m_SuppCoilExists) {
16050 827563 : if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingElectric) {
16051 0 : suppHeatingPower = state.dataHVACGlobal->SuppHeatingCoilPower;
16052 : }
16053 : }
16054 :
16055 6060022 : this->m_ElecPower = locFanElecPower + elecCoolingPower + elecHeatingPower + suppHeatingPower + this->m_TotalAuxElecPower;
16056 6060022 : this->m_ElecPowerConsumption = this->m_ElecPower * ReportingConstant;
16057 :
16058 6060022 : if (state.afn->distribution_simulated) {
16059 137737 : state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).LoopSystemOnMassFlowrate = state.dataUnitarySystems->CompOnMassFlow;
16060 137737 : state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).LoopSystemOffMassFlowrate = state.dataUnitarySystems->CompOffMassFlow;
16061 137737 : state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).LoopFanOperationMode = this->m_FanOpMode;
16062 137737 : state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).LoopOnOffFanPartLoadRatio = this->FanPartLoadRatio;
16063 137737 : state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).LoopCompCycRatio = this->m_CycRatio;
16064 : }
16065 6060022 : if (this->m_FirstPass) {
16066 790 : if (AirLoopNum > -1) {
16067 782 : if (!state.dataGlobal->SysSizingCalc) {
16068 :
16069 584 : if (CurOASysNum > 0) {
16070 2 : OASysEqSizing(CurOASysNum).AirFlow = false;
16071 2 : OASysEqSizing(CurOASysNum).CoolingAirFlow = false;
16072 2 : OASysEqSizing(CurOASysNum).HeatingAirFlow = false;
16073 2 : OASysEqSizing(CurOASysNum).Capacity = false;
16074 2 : OASysEqSizing(CurOASysNum).CoolingCapacity = false;
16075 2 : OASysEqSizing(CurOASysNum).HeatingCapacity = false;
16076 2 : this->m_FirstPass = false;
16077 582 : } else if (state.dataSize->CurSysNum > 0) {
16078 384 : state.dataAirLoop->AirLoopControlInfo(state.dataSize->CurSysNum).UnitarySysSimulating = false;
16079 384 : DataSizing::resetHVACSizingGlobals(state, state.dataSize->CurZoneEqNum, state.dataSize->CurSysNum, this->m_FirstPass);
16080 198 : } else if (state.dataSize->CurZoneEqNum > 0) {
16081 198 : DataSizing::resetHVACSizingGlobals(state, state.dataSize->CurZoneEqNum, state.dataSize->CurSysNum, this->m_FirstPass);
16082 : } else {
16083 0 : this->m_FirstPass = false;
16084 : }
16085 : }
16086 : } else {
16087 8 : this->m_FirstPass = false;
16088 : }
16089 : // reset the global system type flags
16090 790 : state.dataSize->ZoneEqDXCoil = false;
16091 : }
16092 :
16093 : // reset to 1 in case blow through fan configuration (fan resets to 1, but for blow thru fans coil sets back down < 1)
16094 6060022 : state.dataHVACGlobal->OnOffFanPartLoadFraction = 1.0;
16095 6060022 : state.dataSize->ZoneEqUnitarySys = false;
16096 6060022 : }
16097 :
16098 0 : void UnitarySys::unitarySystemHeatRecovery(EnergyPlusData &state)
16099 : {
16100 :
16101 : // SUBROUTINE INFORMATION:
16102 : // AUTHOR: Chandan Sharma
16103 : // DATE WRITTEN: May 2013
16104 :
16105 : // PURPOSE OF THIS SUBROUTINE:
16106 : // Calculate the heat recovered from UnitarySystem
16107 :
16108 : // SUBROUTINE PARAMETER DEFINITIONS:
16109 : static constexpr std::string_view routineName("UnitarySystemHeatRecovery");
16110 :
16111 0 : Real64 ReportingConstant = state.dataHVACGlobal->TimeStepSys * DataGlobalConstants::SecInHour;
16112 :
16113 0 : Real64 HeatRecInletTemp = state.dataLoopNodes->Node(this->m_HeatRecoveryInletNodeNum).Temp;
16114 0 : Real64 HeatRecOutletTemp = 0.0;
16115 0 : Real64 HeatRecMassFlowRate = state.dataLoopNodes->Node(this->m_HeatRecoveryInletNodeNum).MassFlowRate;
16116 :
16117 0 : Real64 QHeatRec = state.dataHVACGlobal->MSHPWasteHeat;
16118 :
16119 0 : if (HeatRecMassFlowRate > 0.0) {
16120 :
16121 0 : Real64 CpHeatRec = FluidProperties::GetSpecificHeatGlycol(state,
16122 0 : state.dataPlnt->PlantLoop(this->m_HRPlantLoc.loopNum).FluidName,
16123 : HeatRecInletTemp,
16124 0 : state.dataPlnt->PlantLoop(this->m_HRPlantLoc.loopNum).FluidIndex,
16125 0 : routineName);
16126 :
16127 0 : HeatRecOutletTemp = QHeatRec / (HeatRecMassFlowRate * CpHeatRec) + HeatRecInletTemp;
16128 : // coil model should be handling max outlet water temp (via limit to heat transfer) since heat rejection needs to be accounted for by the
16129 : // coil
16130 0 : if (HeatRecOutletTemp > this->m_MaxHROutletWaterTemp) {
16131 0 : HeatRecOutletTemp = max(HeatRecInletTemp, this->m_MaxHROutletWaterTemp);
16132 0 : QHeatRec = HeatRecMassFlowRate * CpHeatRec * (HeatRecOutletTemp - HeatRecInletTemp);
16133 : }
16134 : } else {
16135 0 : HeatRecOutletTemp = HeatRecInletTemp;
16136 0 : QHeatRec = 0.0;
16137 : }
16138 :
16139 0 : PlantUtilities::SafeCopyPlantNode(state, this->m_HeatRecoveryInletNodeNum, this->m_HeatRecoveryOutletNodeNum);
16140 :
16141 0 : state.dataLoopNodes->Node(this->m_HeatRecoveryOutletNodeNum).Temp = HeatRecOutletTemp;
16142 :
16143 0 : this->m_HeatRecoveryRate = QHeatRec;
16144 0 : this->m_HeatRecoveryEnergy = this->m_HeatRecoveryRate * ReportingConstant;
16145 0 : this->m_HeatRecoveryInletTemp = HeatRecInletTemp;
16146 0 : this->m_HeatRecoveryOutletTemp = HeatRecOutletTemp;
16147 0 : this->m_HeatRecoveryMassFlowRate = HeatRecMassFlowRate;
16148 0 : }
16149 :
16150 1198412 : void UnitarySys::heatPumpRunFrac(Real64 const PLR, // part load ratio
16151 : bool &errFlag, // part load factor out of range flag
16152 : Real64 &RuntimeFrac // the required run time fraction to meet part load
16153 : )
16154 : {
16155 :
16156 : // SUBROUTINE INFORMATION:
16157 : // AUTHOR Kenneth Tang
16158 : // DATE WRITTEN Apr 2004
16159 :
16160 : // PURPOSE OF THIS SUBROUTINE:
16161 : // This subroutine calculates the PLF based on the PLR. Parameters required are
16162 : // thermostat cycling rate (Nmax), heat pump time constant (tau), and the fraction
16163 : // of on-cycle power use (pr)
16164 :
16165 : // REFERENCES:
16166 : // (1) Henderson, H. I., K. Rengarajan.1996. A Model to predict the latent capacity
16167 : // of air conditioners and heat pumps at part-load conditions with constant fan
16168 : // operation. ASHRAE Transactions 102 (1): 266-274
16169 :
16170 : // (2) Henderson, H.I. Jr., Y.J. Huang and Danny Parker. 1999. Residential Equipment
16171 : // Part Load Curves for Use in DOE-2. Environmental Energy Technologies Division,
16172 : // Ernest OrlanDO Lawrence Berkeley National Laboratory.
16173 :
16174 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
16175 : Real64 PartLoadFactor; // Part load factor
16176 : Real64 Nmax; // Maximum cycling rate [cycles/hr]
16177 : Real64 tau; // Heat pump time constant [s]
16178 : Real64 pr; // On-cycle power use fraction [~]
16179 : Real64 error; // Calculation error
16180 : Real64 PLF1; // ith term of part load factor
16181 : Real64 PLF2; // (i+1)th term of part load factor
16182 : Real64 A; // Variable for simplIFy equation
16183 : int NumIteration; // Iteration Counter
16184 :
16185 1198412 : Nmax = this->m_MaxONOFFCyclesperHour;
16186 1198412 : tau = this->m_HPTimeConstant;
16187 1198412 : pr = this->m_OnCyclePowerFraction;
16188 :
16189 : // Initialize
16190 1198412 : errFlag = false;
16191 1198412 : error = 1;
16192 1198412 : NumIteration = 0;
16193 :
16194 : // Initial guess for part load fraction
16195 1198412 : PLF1 = 1;
16196 :
16197 : // Calculate PLF using successive substitution until convergence
16198 : // is achieved
16199 : while (true) {
16200 7191710 : ++NumIteration;
16201 :
16202 4195061 : if (PLR == 1) {
16203 : // Set part load fraction, PLF1=1.0 IF PLR=1.0 and EXIT loop
16204 173569 : PLF1 = 1;
16205 173569 : break;
16206 : }
16207 :
16208 4021492 : if (NumIteration > 100) {
16209 : // EXIT loop IF interation exceed 100
16210 0 : errFlag = true;
16211 0 : PLF1 = 1;
16212 0 : break;
16213 : }
16214 :
16215 4021492 : if (error < 0.00001) {
16216 : // EXIT loop IF convergence is achieved
16217 1024843 : break;
16218 :
16219 : } else {
16220 : // Calculate PLF
16221 2996649 : A = 4.0 * tau * (Nmax / 3600.0) * (1 - PLR / PLF1);
16222 2996649 : if (A < 1.5e-3) {
16223 : // A safety check to prevent PLF2 = 1 - A * (1 - Exp(-1 / A))
16224 : // from "float underflow error". Occurs when PLR is very close to 1.0,
16225 : // small A value, thus Exp(-1/A) = 0
16226 543 : PLF2 = 1.0 - A;
16227 : } else {
16228 2996106 : PLF2 = 1.0 - A * (1.0 - std::exp(-1.0 / A));
16229 : }
16230 2996649 : error = std::abs((PLF2 - PLF1) / PLF1);
16231 2996649 : PLF1 = PLF2;
16232 : }
16233 : }
16234 :
16235 : // Adjust PLF for the off cycle power consumption IF
16236 : // on-cycle power use is specified by the user
16237 1198412 : if (pr > 0.0) {
16238 1198412 : PartLoadFactor = PLR / ((PLR / PLF1) + (1.0 - PLR / PLF1) * pr);
16239 : } else {
16240 0 : PartLoadFactor = PLF1;
16241 : }
16242 :
16243 1198412 : if (PartLoadFactor <= 0.0) {
16244 594353 : PartLoadFactor = 0;
16245 594353 : RuntimeFrac = 0;
16246 594353 : errFlag = true;
16247 : } else {
16248 604059 : RuntimeFrac = PLR / PartLoadFactor;
16249 : }
16250 :
16251 1198412 : if (RuntimeFrac > 1.0) {
16252 0 : RuntimeFrac = 1.0;
16253 : }
16254 1198412 : }
16255 :
16256 7082247 : Real64 UnitarySys::calcUnitarySystemLoadResidual(EnergyPlusData &state,
16257 : Real64 const PartLoadRatio, // DX cooling coil part load ratio
16258 : int UnitarySysNum,
16259 : bool FirstHVACIteration,
16260 : // par 3 not used?
16261 : DataHVACGlobals::CompressorOperation CompressorOp,
16262 : Real64 LoadToBeMet,
16263 : Real64 coolHeatFlag, // make bool?
16264 : Real64 SensibleLoad,
16265 : Real64 OnOffAirFlowRatio,
16266 : bool HXUnitOn,
16267 : // par 10 not used
16268 : int AirLoopNum)
16269 : {
16270 :
16271 : // FUNCTION INFORMATION:
16272 : // AUTHOR Richard Raustad, FSEC
16273 : // DATE WRITTEN February 2013
16274 :
16275 : // PURPOSE OF THIS SUBROUTINE:
16276 : // To calculate the part-load ratio for the unitary system
16277 :
16278 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
16279 : Real64 SensOutput; // sensible output of system
16280 : Real64 LatOutput; // latent output of system
16281 7082247 : Real64 HeatCoilLoad = 0.0;
16282 7082247 : Real64 SupHeaterLoad = 0.0;
16283 7082247 : UnitarySys &thisSys = state.dataUnitarySystems->unitarySys[UnitarySysNum];
16284 7082247 : Real64 CoolPLR = coolHeatFlag == 1.0 ? PartLoadRatio : 0.0;
16285 7082247 : Real64 HeatPLR = coolHeatFlag == 1.0 ? 0.0 : PartLoadRatio;
16286 7082247 : thisSys.setSpeedVariables(state, SensibleLoad, PartLoadRatio);
16287 7082247 : thisSys.calcUnitarySystemToLoad(state,
16288 : AirLoopNum,
16289 : FirstHVACIteration,
16290 : CoolPLR,
16291 : HeatPLR,
16292 : OnOffAirFlowRatio,
16293 : SensOutput,
16294 : LatOutput,
16295 : HXUnitOn,
16296 : HeatCoilLoad,
16297 : SupHeaterLoad,
16298 : CompressorOp);
16299 : // Calculate residual based on output calculation flag
16300 7082247 : Real64 baselineLoad = SensibleLoad == 1.0 ? SensOutput : LatOutput;
16301 7082247 : Real64 divisor = std::abs(LoadToBeMet) == 0.0 ? 100.0 : LoadToBeMet;
16302 7082247 : return (baselineLoad - LoadToBeMet) / divisor;
16303 : }
16304 :
16305 1731212 : Real64 UnitarySys::DXCoilVarSpeedResidual(EnergyPlusData &state,
16306 : Real64 const SpeedRatio, // compressor speed ratio (1.0 is max, 0.0 is min)
16307 : int CoilIndex,
16308 : Real64 DesOutTemp,
16309 : int UnitarySysNum,
16310 : Real64 CycRatio,
16311 : int SpeedNum,
16312 : int FanOpMode,
16313 : DataHVACGlobals::CompressorOperation CompressorOp)
16314 : {
16315 : // FUNCTION INFORMATION:
16316 : // AUTHOR Fred Buhl
16317 : // DATE WRITTEN September 2002
16318 :
16319 : // PURPOSE OF THIS FUNCTION:
16320 : // Calculates residual function (desired outlet temp - actual outlet temp).
16321 : // DX Coil output depends on the compressor speed which is being varied to zero the residual.
16322 :
16323 : // METHODOLOGY EMPLOYED:
16324 : // Calls CalcMultiSpeedDXCoil to get outlet temperature at the given compressor speed
16325 : // and calculates the residual as defined above
16326 :
16327 : // FUNCTION LOCAL VARIABLE DECLARATIONS:
16328 1731212 : Real64 OutletAirTemp(0.0); // outlet air temperature [C]
16329 :
16330 : Real64 dummy;
16331 : Real64 RuntimeFrac;
16332 : Real64 OnOffAirFlowRatio;
16333 : Real64 SensLoad;
16334 :
16335 1731212 : UnitarySys &thisSys = state.dataUnitarySystems->unitarySys[UnitarySysNum];
16336 1731212 : switch (thisSys.m_CoolingCoilType_Num) {
16337 1722840 : case DataHVACGlobals::CoilDX_CoolingTwoSpeed: {
16338 1722840 : DXCoils::CalcMultiSpeedDXCoil(state, CoilIndex, SpeedRatio, 1.0);
16339 1722840 : OutletAirTemp = state.dataDXCoils->DXCoilOutletTemp(CoilIndex);
16340 1722840 : } break;
16341 2 : case DataHVACGlobals::CoilDX_MultiSpeedCooling: {
16342 2 : OnOffAirFlowRatio = 1.0;
16343 2 : thisSys.setAverageAirFlow(state, SpeedRatio, OnOffAirFlowRatio);
16344 2 : DXCoils::CalcMultiSpeedDXCoilCooling(state, CoilIndex, SpeedRatio, CycRatio, SpeedNum, FanOpMode, CompressorOp, 0);
16345 2 : OutletAirTemp = state.dataDXCoils->DXCoilOutletTemp(CoilIndex);
16346 2 : } break;
16347 8370 : case DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed:
16348 : case DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit: {
16349 8370 : dummy = 0.0;
16350 8370 : SensLoad = -1.0;
16351 8370 : RuntimeFrac = 1.0;
16352 8370 : OnOffAirFlowRatio = 1.0;
16353 16740 : VariableSpeedCoils::SimVariableSpeedCoils(state,
16354 : "",
16355 : CoilIndex,
16356 : FanOpMode,
16357 : thisSys.m_MaxONOFFCyclesperHour,
16358 : thisSys.m_HPTimeConstant,
16359 : thisSys.m_FanDelayTime,
16360 : CompressorOp,
16361 : CycRatio,
16362 : SpeedNum,
16363 : SpeedRatio,
16364 : SensLoad,
16365 : dummy,
16366 8370 : OnOffAirFlowRatio);
16367 :
16368 8370 : OutletAirTemp = state.dataLoopNodes->Node(thisSys.CoolCoilOutletNodeNum).Temp;
16369 8370 : } break;
16370 0 : default: {
16371 0 : assert(false);
16372 : } break;
16373 : }
16374 1731212 : return DesOutTemp - OutletAirTemp;
16375 : }
16376 :
16377 6726 : Real64 UnitarySys::heatingCoilVarSpeedResidual(EnergyPlusData &state,
16378 : Real64 const SpeedRatio, // compressor speed ratio (1.0 is max, 0.0 is min)
16379 : int CoilIndex,
16380 : Real64 DesOutTemp,
16381 : int UnitarySysNum,
16382 : Real64 CycRatio,
16383 : int SpeedNum,
16384 : int FanOpMode,
16385 : DataHVACGlobals::CompressorOperation CompressorOp,
16386 : bool SuppHeat
16387 :
16388 : )
16389 : {
16390 : // FUNCTION INFORMATION:
16391 : // AUTHOR Fred Buhl
16392 : // DATE WRITTEN September 2002
16393 :
16394 : // PURPOSE OF THIS FUNCTION:
16395 : // Calculates residual function (desired outlet temp - actual outlet temp).
16396 : // DX Coil output depends on the compressor speed which is being varied to zero the residual.
16397 :
16398 : // METHODOLOGY EMPLOYED:
16399 : // Calls calc routines of multi Speed or variable Coil to get outlet temperature at the given compressor speed
16400 : // and calculates the residual as defined above
16401 :
16402 : // FUNCTION LOCAL VARIABLE DECLARATIONS:
16403 6726 : Real64 OutletAirTemp(0.0); // outlet air temperature [C]
16404 : Real64 OnOffAirFlowRatio;
16405 : Real64 SensLoad;
16406 : Real64 LatLoad;
16407 : Real64 QActual;
16408 :
16409 6726 : UnitarySys &thisSys = state.dataUnitarySystems->unitarySys[UnitarySysNum];
16410 :
16411 6726 : int heatCoilType = thisSys.m_HeatingCoilType_Num;
16412 6726 : int heatingCoilOutletNode = thisSys.HeatCoilOutletNodeNum;
16413 6726 : if (SuppHeat) {
16414 6726 : heatCoilType = thisSys.m_SuppHeatCoilType_Num;
16415 6726 : heatingCoilOutletNode = thisSys.SuppCoilOutletNodeNum;
16416 : }
16417 :
16418 6726 : switch (heatCoilType) {
16419 0 : case DataHVACGlobals::CoilDX_MultiSpeedHeating: {
16420 0 : OnOffAirFlowRatio = 1.0;
16421 0 : thisSys.setAverageAirFlow(state, SpeedRatio, OnOffAirFlowRatio);
16422 0 : DXCoils::CalcMultiSpeedDXCoilHeating(state, CoilIndex, SpeedRatio, CycRatio, SpeedNum, FanOpMode, 0);
16423 0 : OutletAirTemp = state.dataDXCoils->DXCoilOutletTemp(CoilIndex);
16424 0 : } break;
16425 0 : case DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed:
16426 : case DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit: {
16427 0 : OnOffAirFlowRatio = 1.0;
16428 0 : SensLoad = 1.0;
16429 0 : LatLoad = -1.0;
16430 : // can't call only the calc routine with these coil types since Init sets air flow rate based on speed num and cycling ratio
16431 0 : VariableSpeedCoils::SimVariableSpeedCoils(state,
16432 : "",
16433 : CoilIndex,
16434 : FanOpMode,
16435 : thisSys.m_MaxONOFFCyclesperHour,
16436 : thisSys.m_HPTimeConstant,
16437 : thisSys.m_FanDelayTime,
16438 : CompressorOp,
16439 : CycRatio,
16440 : SpeedNum,
16441 : SpeedRatio,
16442 : SensLoad,
16443 : LatLoad,
16444 0 : OnOffAirFlowRatio);
16445 0 : OutletAirTemp = state.dataLoopNodes->Node(heatingCoilOutletNode).Temp;
16446 0 : } break;
16447 6726 : case DataHVACGlobals::Coil_HeatingElectric_MultiStage: {
16448 6726 : HeatingCoils::CalcMultiStageElectricHeatingCoil(state, CoilIndex, SpeedRatio, CycRatio, SpeedNum, FanOpMode, QActual, SuppHeat);
16449 6726 : OutletAirTemp = state.dataLoopNodes->Node(heatingCoilOutletNode).Temp;
16450 6726 : } break;
16451 0 : case DataHVACGlobals::Coil_HeatingGas_MultiStage: {
16452 0 : HeatingCoils::CalcMultiStageGasHeatingCoil(state, CoilIndex, SpeedRatio, CycRatio, SpeedNum, FanOpMode);
16453 0 : OutletAirTemp = state.dataLoopNodes->Node(heatingCoilOutletNode).Temp;
16454 0 : } break;
16455 0 : default: {
16456 0 : assert(false);
16457 : } break;
16458 : }
16459 6726 : return DesOutTemp - OutletAirTemp;
16460 : }
16461 :
16462 0 : Real64 UnitarySys::DXCoilVarSpeedHumRatResidual(EnergyPlusData &state,
16463 : Real64 const SpeedRatio, // compressor speed ratio (1.0 is max, 0.0 is min)
16464 : int CoilIndex,
16465 : Real64 DesOutHumRat,
16466 : int UnitarySysNum,
16467 : Real64 CycRatio,
16468 : int SpeedNum,
16469 : int FanOpMode,
16470 : DataHVACGlobals::CompressorOperation CompressorOp)
16471 : {
16472 : // FUNCTION INFORMATION:
16473 : // AUTHOR Richard Raustad
16474 : // DATE WRITTEN January 2008
16475 :
16476 : // PURPOSE OF THIS FUNCTION:
16477 : // Calculates residual function (desired outlet humrat - actual outlet humrat).
16478 : // DX Coil output depends on the compressor speed which is being varied to zero the residual.
16479 :
16480 : // METHODOLOGY EMPLOYED:
16481 : // Calls calc routine sof multi speed or variable speed coils to get outlet humidity ratio at the given compressor speed
16482 : // and calculates the residual as defined above
16483 :
16484 : // FUNCTION LOCAL VARIABLE DECLARATIONS:
16485 0 : Real64 OutletAirHumRat(0.0); // outlet air humidity ratio
16486 : Real64 SensLoad;
16487 : Real64 LatLoad;
16488 : Real64 RuntimeFrac;
16489 : Real64 OnOffAirFlowRatio;
16490 0 : UnitarySys &thisSys = state.dataUnitarySystems->unitarySys[UnitarySysNum];
16491 0 : switch (thisSys.m_CoolingCoilType_Num) {
16492 0 : case DataHVACGlobals::CoilDX_CoolingTwoSpeed: {
16493 0 : DXCoils::CalcMultiSpeedDXCoil(state, CoilIndex, SpeedRatio, 1.0);
16494 0 : OutletAirHumRat = state.dataDXCoils->DXCoilOutletHumRat(CoilIndex);
16495 0 : } break;
16496 0 : case DataHVACGlobals::CoilDX_MultiSpeedCooling: {
16497 0 : OnOffAirFlowRatio = 1.0;
16498 0 : thisSys.setAverageAirFlow(state, SpeedRatio, OnOffAirFlowRatio);
16499 0 : DXCoils::CalcMultiSpeedDXCoilCooling(state, CoilIndex, SpeedRatio, CycRatio, SpeedNum, FanOpMode, CompressorOp, 0);
16500 0 : OutletAirHumRat = state.dataDXCoils->DXCoilOutletHumRat(CoilIndex);
16501 0 : } break;
16502 0 : case DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed:
16503 : case DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit: {
16504 0 : SensLoad = -1.0;
16505 0 : LatLoad = 0.0;
16506 0 : RuntimeFrac = 1.0;
16507 0 : OnOffAirFlowRatio = 1.0;
16508 0 : VariableSpeedCoils::SimVariableSpeedCoils(state,
16509 : "",
16510 : CoilIndex,
16511 : FanOpMode,
16512 : thisSys.m_MaxONOFFCyclesperHour,
16513 : thisSys.m_HPTimeConstant,
16514 : thisSys.m_FanDelayTime,
16515 : CompressorOp,
16516 : CycRatio,
16517 : SpeedNum,
16518 : SpeedRatio,
16519 : SensLoad,
16520 : LatLoad,
16521 0 : OnOffAirFlowRatio);
16522 0 : OutletAirHumRat = state.dataLoopNodes->Node(thisSys.CoolCoilOutletNodeNum).HumRat;
16523 0 : } break;
16524 0 : default: {
16525 0 : assert(false);
16526 : } break;
16527 : }
16528 0 : return DesOutHumRat - OutletAirHumRat;
16529 : }
16530 :
16531 222426 : Real64 UnitarySys::DXCoilCyclingResidual(EnergyPlusData &state,
16532 : Real64 const CycRatio, // compressor cycling ratio (1.0 is continuous, 0.0 is off)
16533 : int CoilIndex,
16534 : Real64 DesOutTemp,
16535 : int UnitarySysNum,
16536 : Real64 SpeedRatio,
16537 : int SpeedNum,
16538 : int FanOpMode,
16539 : DataHVACGlobals::CompressorOperation CompressorOp,
16540 : int AirloopNum,
16541 : bool FirstHVACIteration
16542 :
16543 : )
16544 : {
16545 : // FUNCTION INFORMATION:
16546 : // AUTHOR Fred Buhl
16547 : // DATE WRITTEN September 2002
16548 :
16549 : // PURPOSE OF THIS FUNCTION:
16550 : // Calculates residual function (desired outlet temp - actual outlet temp)
16551 : // DX Coil output depends on the cycling ratio which is being varied to zero the residual.
16552 :
16553 : // METHODOLOGY EMPLOYED:
16554 : // Calls multi or variable speed coil to get outlet temperature at the given cycling ratio
16555 : // and calculates the residual as defined above
16556 :
16557 : // FUNCTION LOCAL VARIABLE DECLARATIONS:
16558 222426 : Real64 OutletAirTemp(0.0); // outlet air temperature [C]
16559 : Real64 OnOffAirFlowRatio;
16560 :
16561 222426 : UnitarySys &thisSys = state.dataUnitarySystems->unitarySys[UnitarySysNum];
16562 222426 : switch (thisSys.m_CoolingCoilType_Num) {
16563 183446 : case DataHVACGlobals::CoilDX_CoolingTwoSpeed: {
16564 183446 : if (thisSys.m_FanPlace == FanPlace::BlowThru) { // must simulate fan if blow through since OnOffFanPartLoadFrac affects fan heat
16565 0 : thisSys.m_CoolingCycRatio = CycRatio;
16566 0 : thisSys.m_CoolingPartLoadFrac = CycRatio;
16567 0 : thisSys.calcPassiveSystem(state, AirloopNum, FirstHVACIteration);
16568 : } else {
16569 183446 : DXCoils::CalcMultiSpeedDXCoil(state, CoilIndex, 0.0, CycRatio);
16570 : }
16571 183446 : OutletAirTemp = state.dataDXCoils->DXCoilOutletTemp(CoilIndex);
16572 183446 : } break;
16573 125 : case DataHVACGlobals::CoilDX_MultiSpeedCooling: {
16574 125 : OnOffAirFlowRatio = 1.0;
16575 125 : thisSys.setAverageAirFlow(state, CycRatio, OnOffAirFlowRatio);
16576 125 : if (thisSys.m_FanPlace == FanPlace::BlowThru) { // must simulate fan if blow through since OnOffFanPartLoadFrac affects fan heat
16577 125 : thisSys.m_CoolingCycRatio = CycRatio;
16578 125 : thisSys.m_CoolingPartLoadFrac = CycRatio;
16579 125 : thisSys.calcPassiveSystem(state, AirloopNum, FirstHVACIteration);
16580 : } else {
16581 0 : DXCoils::CalcMultiSpeedDXCoilCooling(state, CoilIndex, SpeedRatio, CycRatio, SpeedNum, FanOpMode, CompressorOp, 0);
16582 : }
16583 125 : OutletAirTemp = state.dataDXCoils->DXCoilOutletTemp(CoilIndex);
16584 125 : } break;
16585 38855 : case DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed:
16586 : case DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit: {
16587 38855 : if (CycRatio == 0.0) CompressorOp = DataHVACGlobals::CompressorOperation::Off;
16588 38855 : Real64 dummy = 0.0;
16589 38855 : OnOffAirFlowRatio = 1.0;
16590 38855 : Real64 SensLoad = -1.0;
16591 77710 : VariableSpeedCoils::SimVariableSpeedCoils(state,
16592 : "",
16593 : CoilIndex,
16594 : FanOpMode,
16595 : thisSys.m_MaxONOFFCyclesperHour,
16596 : thisSys.m_HPTimeConstant,
16597 : thisSys.m_FanDelayTime,
16598 : CompressorOp,
16599 : CycRatio,
16600 : SpeedNum,
16601 : SpeedRatio,
16602 : SensLoad,
16603 : dummy,
16604 38855 : OnOffAirFlowRatio);
16605 38855 : OutletAirTemp = state.dataLoopNodes->Node(thisSys.CoolCoilOutletNodeNum).Temp;
16606 38855 : } break;
16607 0 : default: {
16608 0 : assert(false);
16609 : } break;
16610 : }
16611 222426 : return DesOutTemp - OutletAirTemp;
16612 : }
16613 :
16614 2976 : Real64 UnitarySys::DXCoilCyclingHumRatResidual(EnergyPlusData &state,
16615 : Real64 const CycRatio, // compressor cycling ratio (1.0 is continuous, 0.0 is off)
16616 : int CoilIndex,
16617 : Real64 DesOutHumRat,
16618 : int UnitarySysNum,
16619 : Real64 SpeedRatio,
16620 : int SpeedNum,
16621 : int FanOpMode,
16622 : DataHVACGlobals::CompressorOperation CompressorOp)
16623 : {
16624 :
16625 : // FUNCTION INFORMATION:
16626 : // AUTHOR Fred Buhl
16627 : // DATE WRITTEN September 2002
16628 :
16629 : // PURPOSE OF THIS FUNCTION:
16630 : // Calculates residual function (desired outlet temp - actual outlet temp)
16631 : // DX Coil output depends on the cycling ratio which is being varied to zero the residual.
16632 :
16633 : // METHODOLOGY EMPLOYED:
16634 : // Calls CalcMultiSpeedDXCoil to get outlet temperature at the given cycling ratio
16635 : // and calculates the residual as defined above
16636 :
16637 : // FUNCTION LOCAL VARIABLE DECLARATIONS:
16638 2976 : Real64 OutletAirHumRat(0.0); // outlet air humidity ratio [kg/kg]
16639 : Real64 SensLoad;
16640 : Real64 LatLoad;
16641 : Real64 OnOffAirFlowRatio;
16642 :
16643 2976 : auto &thisSys = state.dataUnitarySystems->unitarySys[UnitarySysNum];
16644 2976 : switch (thisSys.m_CoolingCoilType_Num) {
16645 0 : case DataHVACGlobals::CoilDX_CoolingTwoSpeed: {
16646 0 : DXCoils::CalcMultiSpeedDXCoil(state, CoilIndex, 0.0, CycRatio);
16647 0 : OutletAirHumRat = state.dataDXCoils->DXCoilOutletHumRat(CoilIndex);
16648 0 : } break;
16649 0 : case DataHVACGlobals::CoilDX_MultiSpeedCooling: {
16650 0 : OnOffAirFlowRatio = 1.0;
16651 0 : thisSys.setAverageAirFlow(state, CycRatio, OnOffAirFlowRatio);
16652 0 : DXCoils::CalcMultiSpeedDXCoilCooling(state, CoilIndex, SpeedRatio, CycRatio, SpeedNum, FanOpMode, CompressorOp, 0);
16653 0 : OutletAirHumRat = state.dataDXCoils->DXCoilOutletHumRat(CoilIndex);
16654 0 : } break;
16655 2976 : case DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed:
16656 : case DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit: {
16657 2976 : SensLoad = -1.0;
16658 2976 : LatLoad = 0.0;
16659 2976 : OnOffAirFlowRatio = 1.0;
16660 5952 : VariableSpeedCoils::SimVariableSpeedCoils(state,
16661 : "",
16662 : CoilIndex,
16663 : FanOpMode,
16664 : thisSys.m_MaxONOFFCyclesperHour,
16665 : thisSys.m_HPTimeConstant,
16666 : thisSys.m_FanDelayTime,
16667 : CompressorOp,
16668 : CycRatio,
16669 : SpeedNum,
16670 : SpeedRatio,
16671 : SensLoad,
16672 : LatLoad,
16673 2976 : OnOffAirFlowRatio);
16674 2976 : OutletAirHumRat = state.dataLoopNodes->Node(thisSys.CoolCoilOutletNodeNum).HumRat;
16675 2976 : } break;
16676 0 : default: {
16677 0 : assert(false);
16678 : } break;
16679 : }
16680 2976 : return DesOutHumRat - OutletAirHumRat;
16681 : }
16682 :
16683 9 : Real64 UnitarySys::heatingCoilVarSpeedCycResidual(EnergyPlusData &state,
16684 : Real64 const CycRatio, // compressor cycling ratio (1.0 is continuous, 0.0 is off)
16685 : int CoilIndex,
16686 : Real64 DesOutTemp,
16687 : int UnitarySysNum,
16688 : Real64 SpeedRatio,
16689 : int SpeedNum,
16690 : int FanOpMode,
16691 : DataHVACGlobals::CompressorOperation CompressorOp,
16692 : bool SuppHeat)
16693 : {
16694 :
16695 : // FUNCTION INFORMATION:
16696 : // AUTHOR Fred Buhl
16697 : // DATE WRITTEN September 2002
16698 :
16699 : // PURPOSE OF THIS FUNCTION:
16700 : // Calculates residual function (desired outlet temp - actual outlet temp)
16701 : // DX Coil output depends on the cycling ratio which is being varied to zero the residual.
16702 :
16703 : // METHODOLOGY EMPLOYED:
16704 : // Calls multi or variable speed coil to get outlet temperature at the given cycling ratio
16705 : // and calculates the residual as defined above
16706 :
16707 : // FUNCTION LOCAL VARIABLE DECLARATIONS:
16708 9 : Real64 OutletAirTemp(0.0); // outlet air temperature [C]
16709 : Real64 SensLoad;
16710 : Real64 LatLoad;
16711 : Real64 OnOffAirFlowRatio;
16712 : Real64 QActual;
16713 :
16714 9 : auto &thisSys = state.dataUnitarySystems->unitarySys[UnitarySysNum];
16715 :
16716 9 : int heatCoilType = thisSys.m_HeatingCoilType_Num;
16717 9 : int heatingCoilOutletNode = thisSys.HeatCoilOutletNodeNum;
16718 9 : if (SuppHeat) {
16719 3 : heatCoilType = thisSys.m_SuppHeatCoilType_Num;
16720 3 : heatingCoilOutletNode = thisSys.SuppCoilOutletNodeNum;
16721 : }
16722 :
16723 9 : switch (heatCoilType) {
16724 6 : case DataHVACGlobals::CoilDX_MultiSpeedHeating: {
16725 6 : OnOffAirFlowRatio = 1.0;
16726 6 : thisSys.setAverageAirFlow(state, CycRatio, OnOffAirFlowRatio);
16727 6 : DXCoils::CalcMultiSpeedDXCoilHeating(state, CoilIndex, SpeedRatio, CycRatio, SpeedNum, FanOpMode, 0);
16728 6 : OutletAirTemp = state.dataDXCoils->DXCoilOutletTemp(CoilIndex);
16729 6 : } break;
16730 0 : case DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed:
16731 : case DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit: {
16732 0 : if (CycRatio == 0.0) CompressorOp = DataHVACGlobals::CompressorOperation::Off;
16733 0 : SensLoad = -1.0;
16734 0 : LatLoad = 0.0;
16735 0 : OnOffAirFlowRatio = 1.0;
16736 0 : VariableSpeedCoils::SimVariableSpeedCoils(state,
16737 : "",
16738 : CoilIndex,
16739 : FanOpMode,
16740 : thisSys.m_MaxONOFFCyclesperHour,
16741 : thisSys.m_HPTimeConstant,
16742 : thisSys.m_FanDelayTime,
16743 : CompressorOp,
16744 : CycRatio,
16745 : SpeedNum,
16746 : SpeedRatio,
16747 : SensLoad,
16748 : LatLoad,
16749 0 : OnOffAirFlowRatio);
16750 0 : OutletAirTemp = state.dataLoopNodes->Node(heatingCoilOutletNode).Temp;
16751 0 : } break;
16752 3 : case DataHVACGlobals::Coil_HeatingElectric_MultiStage: {
16753 3 : HeatingCoils::CalcMultiStageElectricHeatingCoil(state, CoilIndex, SpeedRatio, CycRatio, SpeedNum, FanOpMode, QActual, SuppHeat);
16754 3 : OutletAirTemp = state.dataLoopNodes->Node(heatingCoilOutletNode).Temp;
16755 3 : } break;
16756 0 : case DataHVACGlobals::Coil_HeatingGas_MultiStage: {
16757 0 : HeatingCoils::CalcMultiStageGasHeatingCoil(state, CoilIndex, SpeedRatio, CycRatio, SpeedNum, FanOpMode);
16758 0 : OutletAirTemp = state.dataLoopNodes->Node(heatingCoilOutletNode).Temp;
16759 0 : } break;
16760 0 : default: {
16761 0 : assert(false);
16762 : } break;
16763 : }
16764 :
16765 9 : return DesOutTemp - OutletAirTemp;
16766 : }
16767 :
16768 0 : Real64 UnitarySys::gasElecHeatingCoilResidual(EnergyPlusData &state,
16769 : Real64 const PartLoadFrac, // Compressor cycling ratio (1.0 is continuous, 0.0 is off)
16770 : int UnitarySysNum,
16771 : bool FirstHVACIteration,
16772 : Real64 desTemp,
16773 : bool SuppHeatingCoilFlag,
16774 : bool FanOpMode,
16775 : Real64 HeatingLoadArg)
16776 : {
16777 :
16778 : // FUNCTION INFORMATION:
16779 : // AUTHOR Chandan Sharma, FSEC
16780 : // DATE WRITTEN February 2013
16781 :
16782 : // PURPOSE OF THIS FUNCTION:
16783 : // Calculates residual function (desired outlet temp - actual outlet temp)
16784 : // hot water Coil output depends on the part load ratio which is being varied to zero the residual.
16785 :
16786 : // METHODOLOGY EMPLOYED:
16787 : // Calls SimulateHeatingCoilComponents to get outlet temperature at the given part load ratio
16788 : // and calculates the residual as defined above
16789 :
16790 : // FUNCTION LOCAL VARIABLE DECLARATIONS:
16791 0 : UnitarySys &thisSys = state.dataUnitarySystems->unitarySys[UnitarySysNum];
16792 0 : Real64 HeatingLoad = HeatingLoadArg * PartLoadFrac;
16793 : // heating coils using set point control pass DataLoopNode::SensedLoadFlagValue as QCoilReq to indicate temperature control
16794 0 : if (!SuppHeatingCoilFlag) {
16795 0 : HeatingCoils::SimulateHeatingCoilComponents(
16796 : state, thisSys.m_HeatingCoilName, FirstHVACIteration, HeatingLoad, thisSys.m_HeatingCoilIndex, _, _, FanOpMode, PartLoadFrac);
16797 0 : return desTemp - state.dataLoopNodes->Node(thisSys.HeatCoilOutletNodeNum).Temp;
16798 : } else {
16799 0 : HeatingCoils::SimulateHeatingCoilComponents(
16800 : state, thisSys.m_SuppHeatCoilName, FirstHVACIteration, HeatingLoad, thisSys.m_SuppHeatCoilIndex, _, true, FanOpMode, PartLoadFrac);
16801 0 : return desTemp - state.dataLoopNodes->Node(thisSys.SuppCoilOutletNodeNum).Temp;
16802 : }
16803 : }
16804 :
16805 0 : Real64 UnitarySys::coolWatertoAirHPTempResidual(EnergyPlusData &state,
16806 : Real64 const PartLoadRatio, // compressor cycling ratio (1.0 is continuous, 0.0 is off)
16807 : int UnitarySysNum,
16808 : bool FirstHVACIteration,
16809 : Real64 DesOutTemp,
16810 : Real64 ReqOutput)
16811 : {
16812 :
16813 : // FUNCTION INFORMATION:
16814 : // AUTHOR Chandan Sharma, FSEC
16815 : // DATE WRITTEN January 2013
16816 :
16817 : // PURPOSE OF THIS FUNCTION:
16818 : // Calculates residual function (desired outlet temp - actual outlet temp)
16819 : // Cool water coil output depends on the part load ratio which is being varied to zero the residual.
16820 :
16821 : // METHODOLOGY EMPLOYED:
16822 : // Calls SimWatertoAirHP or SimWatertoAirHPSimple to get outlet humidity ratio at the given cycling ratio
16823 : // and calculates the residual as defined above
16824 :
16825 0 : UnitarySys &thisSys = state.dataUnitarySystems->unitarySys[UnitarySysNum];
16826 0 : bool errFlag = false;
16827 0 : Real64 RuntimeFrac = 0.0;
16828 0 : thisSys.heatPumpRunFrac(PartLoadRatio, errFlag, RuntimeFrac);
16829 :
16830 0 : if (RuntimeFrac > 0.0 && thisSys.m_FanOpMode == DataHVACGlobals::CycFanCycCoil) {
16831 0 : state.dataHVACGlobal->OnOffFanPartLoadFraction = PartLoadRatio / RuntimeFrac;
16832 : } else {
16833 0 : state.dataHVACGlobal->OnOffFanPartLoadFraction = 1;
16834 : }
16835 :
16836 0 : thisSys.m_CompPartLoadRatio = PartLoadRatio;
16837 0 : thisSys.m_WSHPRuntimeFrac = RuntimeFrac;
16838 :
16839 0 : Real64 dummy = 0.0;
16840 0 : if (thisSys.m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWaterToAirHPSimple) {
16841 0 : WaterToAirHeatPumpSimple::SimWatertoAirHPSimple(state,
16842 : blankString,
16843 : thisSys.m_CoolingCoilIndex,
16844 : ReqOutput,
16845 : dummy,
16846 : thisSys.m_FanOpMode,
16847 : RuntimeFrac,
16848 : thisSys.m_MaxONOFFCyclesperHour,
16849 : thisSys.m_HPTimeConstant,
16850 : thisSys.m_FanDelayTime,
16851 : DataHVACGlobals::CompressorOperation::On,
16852 : PartLoadRatio,
16853 : FirstHVACIteration);
16854 : } else {
16855 0 : WaterToAirHeatPump::SimWatertoAirHP(state,
16856 : blankString,
16857 : thisSys.m_CoolingCoilIndex,
16858 : thisSys.MaxCoolAirMassFlow,
16859 : thisSys.m_FanOpMode,
16860 : FirstHVACIteration,
16861 : RuntimeFrac,
16862 : thisSys.m_MaxONOFFCyclesperHour,
16863 : thisSys.m_HPTimeConstant,
16864 : thisSys.m_FanDelayTime,
16865 0 : thisSys.m_InitHeatPump,
16866 : ReqOutput,
16867 : dummy,
16868 : DataHVACGlobals::CompressorOperation::Off,
16869 : PartLoadRatio);
16870 : }
16871 0 : return DesOutTemp - state.dataLoopNodes->Node(thisSys.CoolCoilOutletNodeNum).Temp;
16872 : }
16873 :
16874 0 : Real64 UnitarySys::calcUnitarySystemWaterFlowResidual(EnergyPlusData &state,
16875 : Real64 const PartLoadRatio, // coil part load ratio
16876 : int UnitarySysNum,
16877 : bool FirstHVACIteration,
16878 : Real64 QZnReq,
16879 : int AirControlNode,
16880 : Real64 OnOffAirFlowRat,
16881 : int AirLoopNum,
16882 : int WaterControlNode,
16883 : Real64 highWaterMdot,
16884 : Real64 lowSpeedRatio,
16885 : Real64 airMdot,
16886 : Real64 par13_SATempTarget,
16887 : Real64 systemMaxAirFlowRate,
16888 : Real64 par15_LoadType,
16889 : Real64 par16_IterationMethod)
16890 : {
16891 :
16892 : // FUNCTION INFORMATION:
16893 : // AUTHOR Richard Raustad, FSEC
16894 : // DATE WRITTEN January 2017
16895 :
16896 : // PURPOSE OF THIS SUBROUTINE:
16897 : // To calculate the part-load ratio for the UnitarySystem coil with varying part load ratio
16898 :
16899 : // METHODOLOGY EMPLOYED:
16900 : // Use SolveRoot to CALL this Function to converge on a solution
16901 :
16902 0 : Real64 HeatCoilLoad = 0.0;
16903 0 : Real64 SupHeaterLoad = 0.0;
16904 :
16905 : // Convert parameters to usable variables
16906 0 : UnitarySys &thisSys = state.dataUnitarySystems->unitarySys[UnitarySysNum];
16907 0 : Real64 SATempTarget = 0.0;
16908 0 : bool LoadIsTarget = false;
16909 0 : if (par13_SATempTarget == 0.0) {
16910 0 : LoadIsTarget = true;
16911 : } else {
16912 0 : SATempTarget = par13_SATempTarget;
16913 : }
16914 0 : bool iterateOnAirOnly = (par16_IterationMethod > 1.0);
16915 0 : bool coolingLoad = (par15_LoadType > 0.0);
16916 :
16917 0 : bool HXUnitOn = true;
16918 :
16919 0 : if (iterateOnAirOnly) {
16920 :
16921 : // set air flow rate bounded by low speed and high speed air flow rates
16922 0 : state.dataLoopNodes->Node(AirControlNode).MassFlowRate = airMdot * (lowSpeedRatio + (PartLoadRatio * (1.0 - lowSpeedRatio)));
16923 : // FanPartLoadRatio is used to pass info over to function SetAverageAirFlow since air and coil PLR are disassociated in the model
16924 : // FanPartLoadRatio is a report variable that is updated (overwritten) in ReportUnitarySystem
16925 0 : thisSys.FanPartLoadRatio = PartLoadRatio;
16926 : // if( WaterControlNode > 0 ) Node( WaterControlNode ).MassFlowRate = highWaterMdot;
16927 :
16928 : } else {
16929 :
16930 0 : state.dataLoopNodes->Node(AirControlNode).MassFlowRate = airMdot;
16931 0 : if (lowSpeedRatio != 1.0) {
16932 : // division by zero when lowSpeedRatio == 1.0
16933 0 : thisSys.FanPartLoadRatio =
16934 0 : max(0.0, ((airMdot - (systemMaxAirFlowRate * lowSpeedRatio)) / ((1.0 - lowSpeedRatio) * systemMaxAirFlowRate)));
16935 : } else {
16936 0 : thisSys.FanPartLoadRatio = 1.0;
16937 : }
16938 0 : if (WaterControlNode > 0) {
16939 0 : Real64 waterMdot = highWaterMdot * PartLoadRatio;
16940 0 : state.dataLoopNodes->Node(WaterControlNode).MassFlowRate = waterMdot;
16941 : }
16942 : }
16943 :
16944 0 : Real64 coolingPLR = 0.0;
16945 0 : Real64 heatingPLR = 0.0;
16946 :
16947 0 : if (WaterControlNode > 0 && WaterControlNode == thisSys.CoolCoilFluidInletNode) {
16948 : // cooling load using water cooling coil
16949 0 : coolingPLR = PartLoadRatio;
16950 0 : thisSys.m_CoolingPartLoadFrac = PartLoadRatio;
16951 0 : if (thisSys.MaxCoolCoilFluidFlow > 0.0)
16952 0 : thisSys.CoolCoilWaterFlowRatio = state.dataLoopNodes->Node(WaterControlNode).MassFlowRate / thisSys.MaxCoolCoilFluidFlow;
16953 0 : } else if (WaterControlNode > 0 && WaterControlNode == thisSys.HeatCoilFluidInletNode) {
16954 : // heating load using water heating coil
16955 0 : heatingPLR = PartLoadRatio;
16956 0 : thisSys.m_HeatingPartLoadFrac = PartLoadRatio;
16957 0 : if (thisSys.MaxHeatCoilFluidFlow > 0.0)
16958 0 : thisSys.HeatCoilWaterFlowRatio = state.dataLoopNodes->Node(WaterControlNode).MassFlowRate / thisSys.MaxHeatCoilFluidFlow;
16959 0 : } else if (coolingLoad) { // non-water coil with cooling load
16960 0 : coolingPLR = PartLoadRatio;
16961 0 : thisSys.m_CoolingPartLoadFrac = coolingPLR;
16962 : } else { // must be non-water coil with heating load
16963 0 : heatingPLR = PartLoadRatio;
16964 0 : thisSys.m_HeatingPartLoadFrac = heatingPLR;
16965 : }
16966 :
16967 0 : Real64 SensOutput = 0.0;
16968 0 : Real64 LatOutput = 0.0;
16969 0 : thisSys.calcUnitarySystemToLoad(state,
16970 : AirLoopNum,
16971 : FirstHVACIteration,
16972 : coolingPLR,
16973 : heatingPLR,
16974 : OnOffAirFlowRat,
16975 : SensOutput,
16976 : LatOutput,
16977 : HXUnitOn,
16978 : HeatCoilLoad,
16979 : SupHeaterLoad,
16980 : DataHVACGlobals::CompressorOperation::On);
16981 :
16982 0 : if (LoadIsTarget) {
16983 : // Calculate residual based on output magnitude
16984 0 : if (std::abs(QZnReq) <= 100.0) {
16985 0 : return (SensOutput - QZnReq) / 100.0;
16986 : } else {
16987 0 : return (SensOutput - QZnReq) / QZnReq;
16988 : }
16989 : } else {
16990 : // Calculate residual based on outlet temperature
16991 0 : return (state.dataLoopNodes->Node(thisSys.AirOutNode).Temp - SATempTarget) * 10.0;
16992 : }
16993 : }
16994 :
16995 7095129 : void UnitarySys::setSpeedVariables(EnergyPlusData &state,
16996 : bool const SensibleLoad, // True when meeting a sensible load (not a moisture load)
16997 : Real64 const PartLoadRatio // operating PLR
16998 : )
16999 : {
17000 :
17001 : // SUBROUTINE INFORMATION:
17002 : // AUTHOR Richard Raustad, FSEC
17003 : // DATE WRITTEN February 2013
17004 :
17005 : // PURPOSE OF THIS SUBROUTINE:
17006 : // This subroutine determines operating PLR and calculates the load based system output.
17007 :
17008 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
17009 7095129 : bool errFlag = false; // error flag returned from subroutine
17010 7095129 : Real64 RuntimeFrac = 0.0; // heat pump runtime fraction
17011 7095129 : Real64 OnOffAirFlowRatio = 0.0; // compressor on to average flow rate
17012 :
17013 7095129 : if (state.dataUnitarySystems->HeatingLoad && SensibleLoad) {
17014 3033539 : this->m_CoolingSpeedRatio = 0.0;
17015 3033539 : this->m_CoolingCycRatio = 0.0;
17016 3033539 : if (this->m_MultiSpeedHeatingCoil || this->m_VarSpeedHeatingCoil) {
17017 251164 : if (this->m_HeatingSpeedNum <= 1) {
17018 19867 : this->m_HeatingSpeedRatio = 0.0;
17019 19867 : this->m_HeatingCycRatio = PartLoadRatio;
17020 19867 : state.dataHVACGlobal->MSHPMassFlowRateLow = state.dataUnitarySystems->CompOnMassFlow;
17021 : } else {
17022 105715 : if (this->m_SingleMode == 0) {
17023 105715 : this->m_HeatingSpeedRatio = PartLoadRatio;
17024 105715 : this->m_HeatingCycRatio = 1.0;
17025 : } else {
17026 0 : this->m_HeatingSpeedRatio = 1.0;
17027 0 : this->m_HeatingCycRatio = PartLoadRatio;
17028 : }
17029 : }
17030 5707602 : } else if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHPSimple ||
17031 2799645 : this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWaterToAirHP) {
17032 190336 : this->heatPumpRunFrac(PartLoadRatio, errFlag, RuntimeFrac);
17033 : // WSHP coils do not have a PLF curve and do not adjust fan performance
17034 301474 : if (RuntimeFrac > 0.0 && this->m_FanOpMode == DataHVACGlobals::CycFanCycCoil &&
17035 111138 : this->m_sysType != SysType::PackagedWSHP) { // was DataHVACGlobals::ContFanCycCoil
17036 61518 : state.dataHVACGlobal->OnOffFanPartLoadFraction = PartLoadRatio / RuntimeFrac;
17037 : } else {
17038 128818 : state.dataHVACGlobal->OnOffFanPartLoadFraction = 1;
17039 : }
17040 190336 : this->m_CompPartLoadRatio = PartLoadRatio;
17041 190336 : this->m_WSHPRuntimeFrac = RuntimeFrac;
17042 190336 : this->m_HeatingSpeedNum = 0;
17043 : }
17044 : } else {
17045 4061590 : this->m_HeatingSpeedRatio = 0.0;
17046 4061590 : this->m_HeatingCycRatio = 0.0;
17047 4061590 : if (this->m_DiscreteSpeedCoolingCoil || this->m_ContSpeedCoolingCoil) {
17048 3154628 : if (this->m_CoolingSpeedNum <= 1) {
17049 794531 : this->m_CoolingSpeedRatio = 0.0;
17050 794531 : this->m_CoolingCycRatio = PartLoadRatio;
17051 794531 : state.dataHVACGlobal->MSHPMassFlowRateLow = state.dataUnitarySystems->CompOnMassFlow;
17052 : } else {
17053 782783 : if (this->m_SingleMode == 0) {
17054 773639 : this->m_CoolingSpeedRatio = PartLoadRatio;
17055 773639 : this->m_CoolingCycRatio = 1.0;
17056 : } else {
17057 9144 : this->m_CoolingSpeedRatio = 1.0;
17058 9144 : this->m_CoolingCycRatio = PartLoadRatio;
17059 : }
17060 : }
17061 4849088 : } else if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWaterToAirHPSimple ||
17062 2364812 : this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWaterToAirHP) {
17063 174904 : this->heatPumpRunFrac(PartLoadRatio, errFlag, RuntimeFrac);
17064 : // WSHP coils do not have a PLF curve and do not adjust fan performance
17065 277737 : if (RuntimeFrac > 0.0 && this->m_FanOpMode == DataHVACGlobals::CycFanCycCoil &&
17066 102833 : this->m_sysType != SysType::PackagedWSHP) { // was DataHVACGlobals::ContFanCycCoil, maybe file an issue or see if it fixes some
17067 41580 : state.dataHVACGlobal->OnOffFanPartLoadFraction = PartLoadRatio / RuntimeFrac;
17068 : } else {
17069 133324 : state.dataHVACGlobal->OnOffFanPartLoadFraction = 1.0;
17070 : }
17071 174904 : this->m_CompPartLoadRatio = PartLoadRatio;
17072 174904 : this->m_WSHPRuntimeFrac = RuntimeFrac;
17073 174904 : this->m_CoolingSpeedNum = 0;
17074 2309372 : } else if (this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_CoolingTwoSpeed) {
17075 0 : if (this->m_CoolingSpeedNum == 1) {
17076 0 : this->m_CoolingSpeedRatio = 0.0;
17077 0 : this->m_CoolingCycRatio = PartLoadRatio;
17078 : } else {
17079 0 : this->m_CoolingSpeedRatio = PartLoadRatio;
17080 0 : this->m_CoolingCycRatio = 1.0;
17081 : }
17082 : } else {
17083 2309372 : this->m_CoolingSpeedNum = 0;
17084 : }
17085 : }
17086 7095129 : OnOffAirFlowRatio = 1.0;
17087 7095129 : this->setAverageAirFlow(state, PartLoadRatio, OnOffAirFlowRatio);
17088 7095129 : }
17089 :
17090 19 : void UnitarySys::checkUnitarySysCoilInOASysExists(EnergyPlusData &state, std::string_view UnitarySysName, int const ZoneOAUnitNum)
17091 : {
17092 :
17093 : // SUBROUTINE INFORMATION:
17094 : // AUTHOR Chandan Sharma
17095 : // DATE WRITTEN April 2013
17096 :
17097 : // PURPOSE OF THIS SUBROUTINE:
17098 : // After making sure get input is done, checks if the Coil System DX coil is in the
17099 : // OA System. IF exists then the DX cooling coil is 100% DOAS DX coil.
17100 : // METHODOLOGY EMPLOYED:
17101 : // Based on CheckDXCoolingCoilInOASysExists by Bereket Nigusse
17102 :
17103 : // SUBROUTINE PARAMETER DEFINITIONS:
17104 : static constexpr std::string_view RoutineName("CheckUnitarySysCoilInOASysExists: "); // include trailing blank space
17105 :
17106 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
17107 19 : if (state.dataUnitarySystems->getInputOnceFlag) {
17108 2 : getUnitarySystemInput(state, UnitarySysName, false, ZoneOAUnitNum);
17109 2 : state.dataUnitarySystems->getInputOnceFlag = false;
17110 : }
17111 :
17112 19 : bool UnitarySysFound = false;
17113 19 : if (state.dataUnitarySystems->numUnitarySystems > 0) {
17114 43 : for (int UnitarySysNum = 0; UnitarySysNum < state.dataUnitarySystems->numUnitarySystems; ++UnitarySysNum) {
17115 43 : if (UtilityRoutines::SameString(UnitarySysName, state.dataUnitarySystems->unitarySys[UnitarySysNum].Name)) {
17116 19 : if (state.dataUnitarySystems->unitarySys[UnitarySysNum].m_ThisSysInputShouldBeGotten)
17117 9 : getUnitarySystemInput(state, UnitarySysName, false, ZoneOAUnitNum);
17118 19 : if (state.dataUnitarySystems->unitarySys[UnitarySysNum].m_ISHundredPercentDOASDXCoil) {
17119 4 : if (!(state.dataUnitarySystems->unitarySys[UnitarySysNum].m_CoolingCoilType_Num ==
17120 : DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed ||
17121 2 : state.dataUnitarySystems->unitarySys[UnitarySysNum].m_CoolingCoilType_Num ==
17122 : DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit)) {
17123 2 : DXCoils::SetDXCoilTypeData(state, state.dataUnitarySystems->unitarySys[UnitarySysNum].m_CoolingCoilName);
17124 : }
17125 : }
17126 19 : UnitarySysFound = true;
17127 19 : break;
17128 : }
17129 : }
17130 19 : if (!UnitarySysFound) {
17131 0 : ShowSevereError(state, std::string{RoutineName} + "System not found = UnitarySystem \"" + std::string{UnitarySysName} + "\"");
17132 : }
17133 : } else {
17134 0 : ShowSevereError(state, std::string{RoutineName} + "System not found = UnitarySystem \"" + std::string{UnitarySysName} + "\"");
17135 : }
17136 19 : }
17137 :
17138 207 : void UnitarySys::getUnitarySysHeatCoolCoil(EnergyPlusData &state,
17139 : std::string_view UnitarySysName, // Name of Unitary System object
17140 : bool &CoolingCoil, // Cooling coil exists
17141 : bool &HeatingCoil, // Heating coil exists
17142 : int const ZoneOAUnitNum // index to zone OA unit
17143 : )
17144 : {
17145 :
17146 : // FUNCTION INFORMATION:
17147 : // AUTHOR Chandan Sharma
17148 : // DATE WRITTEN April 2013
17149 :
17150 : // PURPOSE OF THIS FUNCTION:
17151 : // Determined weather Unitary system has heating or cooling coils
17152 :
17153 207 : if (state.dataUnitarySystems->getInputOnceFlag) {
17154 0 : getUnitarySystemInput(state, UnitarySysName, false, ZoneOAUnitNum);
17155 0 : state.dataUnitarySystems->getInputOnceFlag = false;
17156 : }
17157 :
17158 896 : for (int UnitarySysNum = 0; UnitarySysNum < state.dataUnitarySystems->numUnitarySystems; ++UnitarySysNum) {
17159 896 : if (UtilityRoutines::SameString(UnitarySysName, state.dataUnitarySystems->unitarySys[UnitarySysNum].Name)) {
17160 207 : if (state.dataUnitarySystems->unitarySys[UnitarySysNum].m_ThisSysInputShouldBeGotten)
17161 104 : getUnitarySystemInput(state, UnitarySysName, false, ZoneOAUnitNum);
17162 413 : if (state.dataUnitarySystems->unitarySys[UnitarySysNum].m_CoolCoilExists &&
17163 206 : !state.dataUnitarySystems->unitarySys[UnitarySysNum].m_WaterHRPlantLoopModel) {
17164 206 : CoolingCoil = true;
17165 : }
17166 209 : if (state.dataUnitarySystems->unitarySys[UnitarySysNum].m_HeatCoilExists ||
17167 2 : state.dataUnitarySystems->unitarySys[UnitarySysNum].m_SuppCoilExists) {
17168 205 : HeatingCoil = true;
17169 : }
17170 207 : break;
17171 : }
17172 : }
17173 207 : }
17174 :
17175 0 : int UnitarySys::getAirInNode(EnergyPlusData &state, std::string_view UnitarySysName, int const ZoneOAUnitNum, bool &errFlag)
17176 : {
17177 0 : if (state.dataUnitarySystems->getInputOnceFlag) {
17178 0 : getUnitarySystemInput(state, UnitarySysName, false, ZoneOAUnitNum);
17179 0 : state.dataUnitarySystems->getInputOnceFlag = false;
17180 : }
17181 0 : int airNode = 0;
17182 0 : for (int UnitarySysNum = 0; UnitarySysNum < state.dataUnitarySystems->numUnitarySystems; ++UnitarySysNum) {
17183 0 : if (UtilityRoutines::SameString(UnitarySysName, state.dataUnitarySystems->unitarySys[UnitarySysNum].Name)) {
17184 0 : airNode = this->AirInNode;
17185 0 : break;
17186 : }
17187 : }
17188 0 : if (airNode == 0) errFlag = true;
17189 0 : return airNode;
17190 : }
17191 :
17192 0 : int UnitarySys::getAirOutNode(EnergyPlusData &state, std::string_view UnitarySysName, int const ZoneOAUnitNum, bool &errFlag)
17193 : {
17194 0 : if (state.dataUnitarySystems->getInputOnceFlag) {
17195 0 : getUnitarySystemInput(state, UnitarySysName, false, ZoneOAUnitNum);
17196 0 : state.dataUnitarySystems->getInputOnceFlag = false;
17197 : }
17198 0 : int airNode = 0;
17199 0 : for (int UnitarySysNum = 0; UnitarySysNum < state.dataUnitarySystems->numUnitarySystems; ++UnitarySysNum) {
17200 0 : if (UtilityRoutines::SameString(UnitarySysName, state.dataUnitarySystems->unitarySys[UnitarySysNum].Name)) {
17201 0 : airNode = this->AirOutNode;
17202 0 : break;
17203 : }
17204 : }
17205 0 : if (airNode == 0) errFlag = true;
17206 0 : return airNode;
17207 : }
17208 :
17209 69407 : int UnitarySys::getAirOutletNode()
17210 : {
17211 69407 : return this->AirOutNode;
17212 : }
17213 :
17214 69407 : int UnitarySys::getMixerOANode()
17215 : {
17216 69407 : return this->m_OAMixerNodes[0];
17217 : }
17218 :
17219 69407 : int UnitarySys::getMixerMixNode()
17220 : {
17221 69407 : return this->m_OAMixerNodes[3];
17222 : }
17223 :
17224 69407 : int UnitarySys::getMixerRetNode()
17225 : {
17226 69407 : return this->m_OAMixerNodes[2];
17227 : }
17228 :
17229 198 : int UnitarySys::getEquipIndex()
17230 : {
17231 198 : return this->m_EquipCompNum;
17232 : }
17233 :
17234 3 : bool searchZoneInletNodes(EnergyPlusData &state, int nodeToFind, int &ZoneEquipConfigIndex, int &InletNodeIndex)
17235 : {
17236 13 : for (int ControlledZoneNum = 1; ControlledZoneNum <= state.dataGlobal->NumOfZones; ++ControlledZoneNum) {
17237 23 : for (int ZoneInletNum = 1; ZoneInletNum <= state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).NumInletNodes; ++ZoneInletNum) {
17238 13 : if (state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).InletNode(ZoneInletNum) == nodeToFind) {
17239 3 : ZoneEquipConfigIndex = ControlledZoneNum;
17240 3 : InletNodeIndex = ZoneInletNum;
17241 3 : return true;
17242 : }
17243 : }
17244 : }
17245 0 : return false;
17246 : }
17247 :
17248 195 : bool searchZoneInletNodesByEquipmentIndex(EnergyPlusData &state, int nodeToFind, int zoneEquipmentIndex)
17249 : {
17250 195 : for (int ZoneInletNum = 1; ZoneInletNum <= state.dataZoneEquip->ZoneEquipConfig(zoneEquipmentIndex).NumInletNodes; ++ZoneInletNum) {
17251 195 : if (state.dataZoneEquip->ZoneEquipConfig(zoneEquipmentIndex).InletNode(ZoneInletNum) == nodeToFind) {
17252 195 : return true;
17253 : }
17254 : }
17255 0 : return false;
17256 : }
17257 :
17258 192 : bool searchZoneInletNodeAirLoopNum(EnergyPlusData &state, int airLoopNumToFind, int ZoneEquipConfigIndex, int &InletNodeIndex)
17259 : {
17260 192 : for (int ZoneInletNum = 1; ZoneInletNum <= state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigIndex).NumInletNodes; ++ZoneInletNum) {
17261 192 : if (state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigIndex).InletNodeAirLoopNum(ZoneInletNum) == airLoopNumToFind) {
17262 192 : InletNodeIndex = ZoneInletNum;
17263 192 : return true;
17264 : }
17265 : }
17266 0 : return false;
17267 : }
17268 :
17269 198 : bool searchExhaustNodes(EnergyPlusData &state, const int nodeToFind, int &ZoneEquipConfigIndex, int &ExhaustNodeIndex)
17270 : {
17271 4421 : for (int ControlledZoneNum = 1; ControlledZoneNum <= state.dataGlobal->NumOfZones; ++ControlledZoneNum) {
17272 7254 : for (int ZoneExhNum = 1; ZoneExhNum <= state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).NumExhaustNodes; ++ZoneExhNum) {
17273 3031 : if (state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).ExhaustNode(ZoneExhNum) == nodeToFind) {
17274 195 : ZoneEquipConfigIndex = ControlledZoneNum;
17275 195 : ExhaustNodeIndex = ZoneExhNum;
17276 195 : return true;
17277 : }
17278 : }
17279 : }
17280 3 : return false;
17281 : }
17282 :
17283 198 : void UnitarySys::setSystemParams(EnergyPlusData &state, Real64 &TotalFloorAreaOnAirLoop, const std::string &thisObjectName)
17284 : {
17285 198 : this->NodeNumOfControlledZone = state.dataZoneEquip->ZoneEquipConfig(this->ControlZoneNum).ZoneNode;
17286 198 : TotalFloorAreaOnAirLoop = state.dataHeatBal->Zone(this->ControlZoneNum).FloorArea;
17287 198 : this->m_AirLoopEquipment = false;
17288 198 : if (state.dataZoneEquip->ZoneEquipConfig(this->ControlZoneNum).EquipListIndex > 0) {
17289 429 : for (int EquipNum = 1;
17290 429 : EquipNum <=
17291 429 : state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(this->ControlZoneNum).EquipListIndex).NumOfEquipTypes;
17292 : ++EquipNum) {
17293 474 : if ((state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(this->ControlZoneNum).EquipListIndex)
17294 243 : .EquipTypeEnum(EquipNum) != DataZoneEquipment::ZoneEquip::ZoneUnitarySys) ||
17295 6 : state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(this->ControlZoneNum).EquipListIndex)
17296 6 : .EquipName(EquipNum) != thisObjectName)
17297 231 : continue;
17298 6 : this->m_ZoneSequenceCoolingNum =
17299 6 : state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(this->ControlZoneNum).EquipListIndex)
17300 6 : .CoolingPriority(EquipNum);
17301 6 : this->m_ZoneSequenceHeatingNum =
17302 6 : state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(this->ControlZoneNum).EquipListIndex)
17303 6 : .HeatingPriority(EquipNum);
17304 6 : break;
17305 : }
17306 : }
17307 198 : }
17308 :
17309 394 : bool searchTotalComponents(EnergyPlusData &state,
17310 : SimAirServingZones::CompType compTypeToFind,
17311 : std::string_view objectNameToFind,
17312 : int &compIndex,
17313 : int &branchIndex,
17314 : int &airLoopIndex)
17315 : {
17316 1171 : for (int AirLoopNum = 1; AirLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++AirLoopNum) {
17317 1938 : for (int BranchNum = 1; BranchNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).NumBranches; ++BranchNum) {
17318 4430 : for (int CompNum = 1; CompNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).TotalComponents;
17319 : ++CompNum) {
17320 3653 : if (compTypeToFind != state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).CompType_Num)
17321 2548 : continue;
17322 1105 : if (UtilityRoutines::SameString(state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).Name,
17323 : objectNameToFind)) {
17324 384 : compIndex = CompNum;
17325 384 : branchIndex = BranchNum;
17326 384 : airLoopIndex = AirLoopNum;
17327 384 : return true;
17328 : }
17329 : }
17330 : }
17331 : }
17332 10 : return false;
17333 : }
17334 :
17335 722 : void setupAllOutputVars(EnergyPlusData &state, int const numAllSystemTypes)
17336 : {
17337 : // setup reports only once
17338 722 : if (state.dataUnitarySystems->reportVariablesAreSetup) return;
17339 : // all report variable are set up here after all systems are allocated.
17340 : // UnitarySystem now models other equipment types, any new reports may be setup here.
17341 161 : if (numAllSystemTypes == state.dataUnitarySystems->numUnitarySystems) {
17342 753 : for (int sysNum = 0; sysNum < state.dataUnitarySystems->numUnitarySystems; ++sysNum) {
17343 592 : switch (state.dataUnitarySystems->unitarySys[sysNum].m_sysType) {
17344 110 : case UnitarySys::SysType::Unitary:
17345 : // Setup Report variables for the Unitary System that are not reported in the components themselves
17346 440 : SetupOutputVariable(state,
17347 : "Unitary System Part Load Ratio",
17348 : OutputProcessor::Unit::None,
17349 110 : state.dataUnitarySystems->unitarySys[sysNum].m_PartLoadFrac,
17350 : OutputProcessor::SOVTimeStepType::System,
17351 : OutputProcessor::SOVStoreType::Average,
17352 220 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17353 440 : SetupOutputVariable(state,
17354 : "Unitary System Total Cooling Rate",
17355 : OutputProcessor::Unit::W,
17356 110 : state.dataUnitarySystems->unitarySys[sysNum].m_TotCoolEnergyRate,
17357 : OutputProcessor::SOVTimeStepType::System,
17358 : OutputProcessor::SOVStoreType::Average,
17359 220 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17360 440 : SetupOutputVariable(state,
17361 : "Unitary System Sensible Cooling Rate",
17362 : OutputProcessor::Unit::W,
17363 110 : state.dataUnitarySystems->unitarySys[sysNum].m_SensCoolEnergyRate,
17364 : OutputProcessor::SOVTimeStepType::System,
17365 : OutputProcessor::SOVStoreType::Average,
17366 220 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17367 440 : SetupOutputVariable(state,
17368 : "Unitary System Latent Cooling Rate",
17369 : OutputProcessor::Unit::W,
17370 110 : state.dataUnitarySystems->unitarySys[sysNum].m_LatCoolEnergyRate,
17371 : OutputProcessor::SOVTimeStepType::System,
17372 : OutputProcessor::SOVStoreType::Average,
17373 220 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17374 440 : SetupOutputVariable(state,
17375 : "Unitary System Total Heating Rate",
17376 : OutputProcessor::Unit::W,
17377 110 : state.dataUnitarySystems->unitarySys[sysNum].m_TotHeatEnergyRate,
17378 : OutputProcessor::SOVTimeStepType::System,
17379 : OutputProcessor::SOVStoreType::Average,
17380 220 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17381 440 : SetupOutputVariable(state,
17382 : "Unitary System Sensible Heating Rate",
17383 : OutputProcessor::Unit::W,
17384 110 : state.dataUnitarySystems->unitarySys[sysNum].m_SensHeatEnergyRate,
17385 : OutputProcessor::SOVTimeStepType::System,
17386 : OutputProcessor::SOVStoreType::Average,
17387 220 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17388 440 : SetupOutputVariable(state,
17389 : "Unitary System Latent Heating Rate",
17390 : OutputProcessor::Unit::W,
17391 110 : state.dataUnitarySystems->unitarySys[sysNum].m_LatHeatEnergyRate,
17392 : OutputProcessor::SOVTimeStepType::System,
17393 : OutputProcessor::SOVStoreType::Average,
17394 220 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17395 440 : SetupOutputVariable(state,
17396 : "Unitary System Ancillary Electricity Rate",
17397 : OutputProcessor::Unit::W,
17398 110 : state.dataUnitarySystems->unitarySys[sysNum].m_TotalAuxElecPower,
17399 : OutputProcessor::SOVTimeStepType::System,
17400 : OutputProcessor::SOVStoreType::Average,
17401 220 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17402 110 : if (state.dataUnitarySystems->unitarySys[sysNum].m_CoolCoilExists) {
17403 436 : SetupOutputVariable(state,
17404 : "Unitary System Cooling Ancillary Electricity Energy",
17405 : OutputProcessor::Unit::J,
17406 109 : state.dataUnitarySystems->unitarySys[sysNum].m_CoolingAuxElecConsumption,
17407 : OutputProcessor::SOVTimeStepType::System,
17408 : OutputProcessor::SOVStoreType::Summed,
17409 109 : state.dataUnitarySystems->unitarySys[sysNum].Name,
17410 : _,
17411 : "Electricity",
17412 : "Cooling",
17413 : _,
17414 109 : "System");
17415 : }
17416 111 : if (state.dataUnitarySystems->unitarySys[sysNum].m_HeatCoilExists ||
17417 1 : state.dataUnitarySystems->unitarySys[sysNum].m_SuppCoilExists) {
17418 436 : SetupOutputVariable(state,
17419 : "Unitary System Heating Ancillary Electricity Energy",
17420 : OutputProcessor::Unit::J,
17421 109 : state.dataUnitarySystems->unitarySys[sysNum].m_HeatingAuxElecConsumption,
17422 : OutputProcessor::SOVTimeStepType::System,
17423 : OutputProcessor::SOVStoreType::Summed,
17424 109 : state.dataUnitarySystems->unitarySys[sysNum].Name,
17425 : _,
17426 : "Electricity",
17427 : "Heating",
17428 : _,
17429 109 : "System");
17430 : }
17431 :
17432 440 : SetupOutputVariable(state,
17433 : "Unitary System Electricity Rate",
17434 : OutputProcessor::Unit::W,
17435 110 : state.dataUnitarySystems->unitarySys[sysNum].m_ElecPower,
17436 : OutputProcessor::SOVTimeStepType::System,
17437 : OutputProcessor::SOVStoreType::Average,
17438 220 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17439 440 : SetupOutputVariable(state,
17440 : "Unitary System Electricity Energy",
17441 : OutputProcessor::Unit::J,
17442 110 : state.dataUnitarySystems->unitarySys[sysNum].m_ElecPowerConsumption,
17443 : OutputProcessor::SOVTimeStepType::System,
17444 : OutputProcessor::SOVStoreType::Summed,
17445 220 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17446 :
17447 : // report predicted load as determined by Unitary System for load control only
17448 110 : if (state.dataUnitarySystems->unitarySys[sysNum].m_ControlType != UnitarySys::UnitarySysCtrlType::Setpoint) {
17449 408 : SetupOutputVariable(state,
17450 : "Unitary System Predicted Sensible Load to Setpoint Heat Transfer Rate",
17451 : OutputProcessor::Unit::W,
17452 102 : state.dataUnitarySystems->unitarySys[sysNum].m_SensibleLoadPredicted,
17453 : OutputProcessor::SOVTimeStepType::System,
17454 : OutputProcessor::SOVStoreType::Average,
17455 204 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17456 408 : SetupOutputVariable(state,
17457 : "Unitary System Predicted Moisture Load to Setpoint Heat Transfer Rate",
17458 : OutputProcessor::Unit::W,
17459 102 : state.dataUnitarySystems->unitarySys[sysNum].m_MoistureLoadPredicted,
17460 : OutputProcessor::SOVTimeStepType::System,
17461 : OutputProcessor::SOVStoreType::Average,
17462 204 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17463 : }
17464 :
17465 : // IF(UnitarySystem(UnitarySysNum)%m_DehumidControlType_Num .EQ. dehumidm_ControlType::CoolReheat)THEN
17466 440 : SetupOutputVariable(state,
17467 : "Unitary System Dehumidification Induced Heating Demand Rate",
17468 : OutputProcessor::Unit::W,
17469 110 : state.dataUnitarySystems->unitarySys[sysNum].m_DehumidInducedHeatingDemandRate,
17470 : OutputProcessor::SOVTimeStepType::System,
17471 : OutputProcessor::SOVStoreType::Average,
17472 220 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17473 : // END IF
17474 :
17475 110 : if (state.dataUnitarySystems->unitarySys[sysNum].m_FanExists) {
17476 432 : SetupOutputVariable(state,
17477 : "Unitary System Fan Part Load Ratio",
17478 : OutputProcessor::Unit::None,
17479 108 : state.dataUnitarySystems->unitarySys[sysNum].FanPartLoadRatio,
17480 : OutputProcessor::SOVTimeStepType::System,
17481 : OutputProcessor::SOVStoreType::Average,
17482 216 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17483 : }
17484 :
17485 440 : SetupOutputVariable(state,
17486 : "Unitary System Compressor Part Load Ratio",
17487 : OutputProcessor::Unit::None,
17488 110 : state.dataUnitarySystems->unitarySys[sysNum].m_CompPartLoadRatio,
17489 : OutputProcessor::SOVTimeStepType::System,
17490 : OutputProcessor::SOVStoreType::Average,
17491 220 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17492 :
17493 440 : SetupOutputVariable(state,
17494 : "Unitary System Frost Control Status",
17495 : OutputProcessor::Unit::None,
17496 110 : state.dataUnitarySystems->unitarySys[sysNum].m_FrostControlStatus,
17497 : OutputProcessor::SOVTimeStepType::System,
17498 : OutputProcessor::SOVStoreType::Average,
17499 220 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17500 :
17501 110 : switch (state.dataUnitarySystems->unitarySys[sysNum].m_CoolingCoilType_Num) {
17502 86 : case DataHVACGlobals::CoilDX_MultiSpeedCooling:
17503 : case DataHVACGlobals::CoilDX_Cooling: {
17504 86 : if (state.dataUnitarySystems->unitarySys[sysNum].m_HeatRecActive) {
17505 0 : SetupOutputVariable(state,
17506 : "Unitary System Heat Recovery Rate",
17507 : OutputProcessor::Unit::W,
17508 0 : state.dataUnitarySystems->unitarySys[sysNum].m_HeatRecoveryRate,
17509 : OutputProcessor::SOVTimeStepType::System,
17510 : OutputProcessor::SOVStoreType::Average,
17511 0 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17512 0 : SetupOutputVariable(state,
17513 : "Unitary System Heat Recovery Inlet Temperature",
17514 : OutputProcessor::Unit::C,
17515 0 : state.dataUnitarySystems->unitarySys[sysNum].m_HeatRecoveryInletTemp,
17516 : OutputProcessor::SOVTimeStepType::System,
17517 : OutputProcessor::SOVStoreType::Average,
17518 0 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17519 0 : SetupOutputVariable(state,
17520 : "Unitary System Heat Recovery Outlet Temperature",
17521 : OutputProcessor::Unit::C,
17522 0 : state.dataUnitarySystems->unitarySys[sysNum].m_HeatRecoveryOutletTemp,
17523 : OutputProcessor::SOVTimeStepType::System,
17524 : OutputProcessor::SOVStoreType::Average,
17525 0 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17526 0 : SetupOutputVariable(state,
17527 : "Unitary System Heat Recovery Fluid Mass Flow Rate",
17528 : OutputProcessor::Unit::kg_s,
17529 0 : state.dataUnitarySystems->unitarySys[sysNum].m_HeatRecoveryMassFlowRate,
17530 : OutputProcessor::SOVTimeStepType::System,
17531 : OutputProcessor::SOVStoreType::Average,
17532 0 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17533 0 : SetupOutputVariable(state,
17534 : "Unitary System Heat Recovery Energy",
17535 : OutputProcessor::Unit::J,
17536 0 : state.dataUnitarySystems->unitarySys[sysNum].m_HeatRecoveryEnergy,
17537 : OutputProcessor::SOVTimeStepType::System,
17538 : OutputProcessor::SOVStoreType::Summed,
17539 0 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17540 : }
17541 86 : } break;
17542 9 : case DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed:
17543 : case DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit:
17544 : case DataHVACGlobals::Coil_CoolingWaterToAirHPSimple:
17545 : case DataHVACGlobals::Coil_CoolingWaterToAirHP: {
17546 36 : SetupOutputVariable(state,
17547 : "Unitary System Requested Sensible Cooling Rate",
17548 : OutputProcessor::Unit::W,
17549 9 : state.dataUnitarySystems->unitarySys[sysNum].m_CoolingCoilSensDemand,
17550 : OutputProcessor::SOVTimeStepType::System,
17551 : OutputProcessor::SOVStoreType::Average,
17552 18 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17553 36 : SetupOutputVariable(state,
17554 : "Unitary System Requested Latent Cooling Rate",
17555 : OutputProcessor::Unit::W,
17556 9 : state.dataUnitarySystems->unitarySys[sysNum].m_CoolingCoilLatentDemand,
17557 : OutputProcessor::SOVTimeStepType::System,
17558 : OutputProcessor::SOVStoreType::Average,
17559 18 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17560 9 : } break;
17561 15 : default:
17562 15 : break;
17563 : }
17564 :
17565 110 : if (state.dataUnitarySystems->unitarySys[sysNum].m_CoolingCoilIndex >= 0) {
17566 159 : if (state.dataUnitarySystems->unitarySys[sysNum].m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_Cooling &&
17567 49 : state.dataCoilCooingDX->coilCoolingDXs[state.dataUnitarySystems->unitarySys[sysNum].m_CoolingCoilIndex]
17568 49 : .SubcoolReheatFlag) {
17569 4 : SetupOutputVariable(state,
17570 : "Unitary System Zone Load Sensible Heat Ratio",
17571 : OutputProcessor::Unit::None,
17572 1 : state.dataUnitarySystems->unitarySys[sysNum].LoadSHR,
17573 : OutputProcessor::SOVTimeStepType::System,
17574 : OutputProcessor::SOVStoreType::Average,
17575 2 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17576 4 : SetupOutputVariable(state,
17577 : "Unitary System Cooling Coil Load Sensible Heat Ratio",
17578 : OutputProcessor::Unit::None,
17579 1 : state.dataUnitarySystems->unitarySys[sysNum].CoilSHR,
17580 : OutputProcessor::SOVTimeStepType::System,
17581 : OutputProcessor::SOVStoreType::Average,
17582 2 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17583 : }
17584 : }
17585 :
17586 110 : switch (state.dataUnitarySystems->unitarySys[sysNum].m_HeatingCoilType_Num) {
17587 8 : case DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed:
17588 : case DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit:
17589 : case DataHVACGlobals::Coil_HeatingWaterToAirHPSimple:
17590 : case DataHVACGlobals::Coil_HeatingWaterToAirHP: {
17591 32 : SetupOutputVariable(state,
17592 : "Unitary System Requested Heating Rate",
17593 : OutputProcessor::Unit::W,
17594 8 : state.dataUnitarySystems->unitarySys[sysNum].m_HeatingCoilSensDemand,
17595 : OutputProcessor::SOVTimeStepType::System,
17596 : OutputProcessor::SOVStoreType::Average,
17597 16 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17598 8 : } break;
17599 102 : default:
17600 102 : break;
17601 : }
17602 :
17603 293 : if (state.dataUnitarySystems->unitarySys[sysNum].m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedCooling ||
17604 146 : state.dataUnitarySystems->unitarySys[sysNum].m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_CoolingTwoSpeed ||
17605 97 : state.dataUnitarySystems->unitarySys[sysNum].m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_Cooling ||
17606 48 : state.dataUnitarySystems->unitarySys[sysNum].m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedHeating ||
17607 158 : state.dataUnitarySystems->unitarySys[sysNum].m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingElectric_MultiStage ||
17608 24 : state.dataUnitarySystems->unitarySys[sysNum].m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingGas_MultiStage) {
17609 344 : SetupOutputVariable(state,
17610 : "Unitary System DX Coil Cycling Ratio",
17611 : OutputProcessor::Unit::None,
17612 86 : state.dataUnitarySystems->unitarySys[sysNum].m_CycRatio,
17613 : OutputProcessor::SOVTimeStepType::System,
17614 : OutputProcessor::SOVStoreType::Average,
17615 172 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17616 344 : SetupOutputVariable(state,
17617 : "Unitary System DX Coil Speed Ratio",
17618 : OutputProcessor::Unit::None,
17619 86 : state.dataUnitarySystems->unitarySys[sysNum].m_SpeedRatio,
17620 : OutputProcessor::SOVTimeStepType::System,
17621 : OutputProcessor::SOVStoreType::Average,
17622 172 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17623 344 : SetupOutputVariable(state,
17624 : "Unitary System DX Coil Speed Level",
17625 : OutputProcessor::Unit::None,
17626 86 : state.dataUnitarySystems->unitarySys[sysNum].m_SpeedNum,
17627 : OutputProcessor::SOVTimeStepType::System,
17628 : OutputProcessor::SOVStoreType::Average,
17629 172 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17630 : }
17631 :
17632 328 : if (((state.dataUnitarySystems->unitarySys[sysNum].m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWater ||
17633 110 : state.dataUnitarySystems->unitarySys[sysNum].m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWaterDetailed) &&
17634 222 : state.dataUnitarySystems->unitarySys[sysNum].m_DiscreteSpeedCoolingCoil) ||
17635 110 : (state.dataUnitarySystems->unitarySys[sysNum].m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWater &&
17636 1 : state.dataUnitarySystems->unitarySys[sysNum].m_MultiSpeedHeatingCoil)) {
17637 4 : SetupOutputVariable(state,
17638 : "Unitary System Water Coil Cycling Ratio",
17639 : OutputProcessor::Unit::None,
17640 1 : state.dataUnitarySystems->unitarySys[sysNum].m_CycRatio,
17641 : OutputProcessor::SOVTimeStepType::System,
17642 : OutputProcessor::SOVStoreType::Average,
17643 2 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17644 4 : SetupOutputVariable(state,
17645 : "Unitary System Water Coil Speed Ratio",
17646 : OutputProcessor::Unit::None,
17647 1 : state.dataUnitarySystems->unitarySys[sysNum].m_SpeedRatio,
17648 : OutputProcessor::SOVTimeStepType::System,
17649 : OutputProcessor::SOVStoreType::Average,
17650 2 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17651 4 : SetupOutputVariable(state,
17652 : "Unitary System Water Coil Speed Level",
17653 : OutputProcessor::Unit::None,
17654 1 : state.dataUnitarySystems->unitarySys[sysNum].m_SpeedNum,
17655 : OutputProcessor::SOVTimeStepType::System,
17656 : OutputProcessor::SOVStoreType::Average,
17657 2 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17658 : }
17659 :
17660 110 : if (state.dataGlobal->AnyEnergyManagementSystemInModel) {
17661 184 : SetupEMSActuator(state,
17662 : "UnitarySystem",
17663 46 : state.dataUnitarySystems->unitarySys[sysNum].Name,
17664 : "Autosized Supply Air Flow Rate",
17665 : "[m3/s]",
17666 46 : state.dataUnitarySystems->unitarySys[sysNum].m_DesignFanVolFlowRateEMSOverrideOn,
17667 138 : state.dataUnitarySystems->unitarySys[sysNum].m_DesignFanVolFlowRateEMSOverrideValue);
17668 184 : SetupEMSActuator(state,
17669 : "UnitarySystem",
17670 46 : state.dataUnitarySystems->unitarySys[sysNum].Name,
17671 : "Autosized Supply Air Flow Rate During Cooling Operation",
17672 : "[m3/s]",
17673 46 : state.dataUnitarySystems->unitarySys[sysNum].m_MaxCoolAirVolFlowEMSOverrideOn,
17674 138 : state.dataUnitarySystems->unitarySys[sysNum].m_MaxCoolAirVolFlowEMSOverrideValue);
17675 184 : SetupEMSActuator(state,
17676 : "UnitarySystem",
17677 46 : state.dataUnitarySystems->unitarySys[sysNum].Name,
17678 : "Autosized Supply Air Flow Rate During Heating Operation",
17679 : "[m3/s]",
17680 46 : state.dataUnitarySystems->unitarySys[sysNum].m_MaxHeatAirVolFlowEMSOverrideOn,
17681 138 : state.dataUnitarySystems->unitarySys[sysNum].m_MaxHeatAirVolFlowEMSOverrideValue);
17682 184 : SetupEMSActuator(state,
17683 : "UnitarySystem",
17684 46 : state.dataUnitarySystems->unitarySys[sysNum].Name,
17685 : "Autosized Supply Air Flow Rate During No Heating or Cooling Operation",
17686 : "[m3/s]",
17687 46 : state.dataUnitarySystems->unitarySys[sysNum].m_MaxNoCoolHeatAirVolFlowEMSOverrideOn,
17688 138 : state.dataUnitarySystems->unitarySys[sysNum].m_MaxNoCoolHeatAirVolFlowEMSOverrideValue);
17689 138 : SetupEMSInternalVariable(state,
17690 : "Unitary System Control Zone Mass Flow Fraction",
17691 46 : state.dataUnitarySystems->unitarySys[sysNum].Name,
17692 : "[]",
17693 138 : state.dataUnitarySystems->unitarySys[sysNum].ControlZoneMassFlowFrac);
17694 138 : SetupEMSInternalVariable(state,
17695 : "Unitary HVAC Design Heating Capacity",
17696 46 : state.dataUnitarySystems->unitarySys[sysNum].Name,
17697 : "[W]",
17698 138 : state.dataUnitarySystems->unitarySys[sysNum].m_DesignHeatingCapacity);
17699 138 : SetupEMSInternalVariable(state,
17700 : "Unitary HVAC Design Cooling Capacity",
17701 46 : state.dataUnitarySystems->unitarySys[sysNum].Name,
17702 : "[W]",
17703 138 : state.dataUnitarySystems->unitarySys[sysNum].m_DesignCoolingCapacity);
17704 184 : SetupEMSActuator(state,
17705 : "Unitary HVAC",
17706 46 : state.dataUnitarySystems->unitarySys[sysNum].Name,
17707 : "Sensible Load Request",
17708 : "[W]",
17709 46 : state.dataUnitarySystems->unitarySys[sysNum].m_EMSOverrideSensZoneLoadRequest,
17710 138 : state.dataUnitarySystems->unitarySys[sysNum].m_EMSSensibleZoneLoadValue);
17711 184 : SetupEMSActuator(state,
17712 : "Unitary HVAC",
17713 46 : state.dataUnitarySystems->unitarySys[sysNum].Name,
17714 : "Moisture Load Request",
17715 : "[W]",
17716 46 : state.dataUnitarySystems->unitarySys[sysNum].m_EMSOverrideMoistZoneLoadRequest,
17717 138 : state.dataUnitarySystems->unitarySys[sysNum].m_EMSMoistureZoneLoadValue);
17718 104 : if (state.dataUnitarySystems->unitarySys[sysNum].m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedCooling ||
17719 54 : state.dataUnitarySystems->unitarySys[sysNum].m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedHeating ||
17720 8 : state.dataUnitarySystems->unitarySys[sysNum].m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_Cooling) {
17721 180 : SetupEMSActuator(state,
17722 : "Coil Speed Control",
17723 45 : state.dataUnitarySystems->unitarySys[sysNum].Name,
17724 : "Unitary System DX Coil Speed Value",
17725 : "[]",
17726 45 : state.dataUnitarySystems->unitarySys[sysNum].m_EMSOverrideCoilSpeedNumOn,
17727 135 : state.dataUnitarySystems->unitarySys[sysNum].m_EMSOverrideCoilSpeedNumValue);
17728 : }
17729 184 : SetupEMSActuator(state,
17730 : "Coil Speed Control",
17731 46 : state.dataUnitarySystems->unitarySys[sysNum].Name,
17732 : "Unitary System Supplemental Coil Stage Level",
17733 : "[]",
17734 46 : state.dataUnitarySystems->unitarySys[sysNum].m_EMSOverrideSuppCoilSpeedNumOn,
17735 138 : state.dataUnitarySystems->unitarySys[sysNum].m_EMSOverrideSuppCoilSpeedNumValue);
17736 : }
17737 : bool anyEMSRan;
17738 110 : EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::ComponentGetInput, anyEMSRan, ObjexxFCL::Optional_int_const());
17739 702 : break;
17740 287 : case UnitarySys::SysType::CoilCoolingDX:
17741 : // Setup Report variables for the DXCoolingSystem that is not reported in the components themselves
17742 287 : if (state.dataUnitarySystems->unitarySys[sysNum].m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_CoolingTwoSpeed) {
17743 268 : SetupOutputVariable(state,
17744 : "Coil System Cycling Ratio",
17745 : OutputProcessor::Unit::None,
17746 67 : state.dataUnitarySystems->unitarySys[sysNum].m_CoolingCycRatio,
17747 : OutputProcessor::SOVTimeStepType::System,
17748 : OutputProcessor::SOVStoreType::Average,
17749 134 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17750 268 : SetupOutputVariable(state,
17751 : "Coil System Compressor Speed Ratio",
17752 : OutputProcessor::Unit::None,
17753 67 : state.dataUnitarySystems->unitarySys[sysNum].m_CoolingSpeedRatio,
17754 : OutputProcessor::SOVTimeStepType::System,
17755 : OutputProcessor::SOVStoreType::Average,
17756 134 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17757 220 : } else if (state.dataUnitarySystems->unitarySys[sysNum].m_CoolingCoilType_Num ==
17758 : DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) {
17759 8 : SetupOutputVariable(state,
17760 : "Coil System Cycling Ratio",
17761 : OutputProcessor::Unit::None,
17762 2 : state.dataUnitarySystems->unitarySys[sysNum].m_CoolingCycRatio,
17763 : OutputProcessor::SOVTimeStepType::System,
17764 : OutputProcessor::SOVStoreType::Average,
17765 4 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17766 8 : SetupOutputVariable(state,
17767 : "Coil System Compressor Speed Ratio",
17768 : OutputProcessor::Unit::None,
17769 2 : state.dataUnitarySystems->unitarySys[sysNum].m_CoolingSpeedRatio,
17770 : OutputProcessor::SOVTimeStepType::System,
17771 : OutputProcessor::SOVStoreType::Average,
17772 4 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17773 8 : SetupOutputVariable(state,
17774 : "Coil System Compressor Speed Number",
17775 : OutputProcessor::Unit::None,
17776 2 : state.dataUnitarySystems->unitarySys[sysNum].m_CoolingSpeedNum,
17777 : OutputProcessor::SOVTimeStepType::System,
17778 : OutputProcessor::SOVStoreType::Average,
17779 4 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17780 : } else {
17781 872 : SetupOutputVariable(state,
17782 : "Coil System Part Load Ratio",
17783 : OutputProcessor::Unit::None,
17784 218 : state.dataUnitarySystems->unitarySys[sysNum].m_CoolingPartLoadFrac,
17785 : OutputProcessor::SOVTimeStepType::System,
17786 : OutputProcessor::SOVStoreType::Average,
17787 436 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17788 : }
17789 1148 : SetupOutputVariable(state,
17790 : "Coil System Frost Control Status",
17791 : OutputProcessor::Unit::None,
17792 287 : state.dataUnitarySystems->unitarySys[sysNum].m_FrostControlStatus,
17793 : OutputProcessor::SOVTimeStepType::System,
17794 : OutputProcessor::SOVStoreType::Average,
17795 574 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17796 287 : break;
17797 3 : case UnitarySys::SysType::CoilCoolingWater:
17798 : // Setup Report variables for the CoilSystemWater
17799 12 : SetupOutputVariable(state,
17800 : "Coil System Water Part Load Ratio",
17801 : OutputProcessor::Unit::None,
17802 3 : state.dataUnitarySystems->unitarySys[sysNum].m_PartLoadFrac,
17803 : OutputProcessor::SOVTimeStepType::System,
17804 : OutputProcessor::SOVStoreType::Average,
17805 6 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17806 12 : SetupOutputVariable(state,
17807 : "Coil System Water Total Cooling Rate",
17808 : OutputProcessor::Unit::W,
17809 3 : state.dataUnitarySystems->unitarySys[sysNum].m_TotCoolEnergyRate,
17810 : OutputProcessor::SOVTimeStepType::System,
17811 : OutputProcessor::SOVStoreType::Average,
17812 6 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17813 12 : SetupOutputVariable(state,
17814 : "Coil System Water Sensible Cooling Rate",
17815 : OutputProcessor::Unit::W,
17816 3 : state.dataUnitarySystems->unitarySys[sysNum].m_SensCoolEnergyRate,
17817 : OutputProcessor::SOVTimeStepType::System,
17818 : OutputProcessor::SOVStoreType::Average,
17819 6 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17820 12 : SetupOutputVariable(state,
17821 : "Coil System Water Latent Cooling Rate",
17822 : OutputProcessor::Unit::W,
17823 3 : state.dataUnitarySystems->unitarySys[sysNum].m_LatCoolEnergyRate,
17824 : OutputProcessor::SOVTimeStepType::System,
17825 : OutputProcessor::SOVStoreType::Average,
17826 6 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17827 :
17828 3 : if (state.dataUnitarySystems->unitarySys[sysNum].m_TemperatureOffsetControlActive) {
17829 12 : SetupOutputVariable(state,
17830 : "Coil System Water Control Status",
17831 : OutputProcessor::Unit::None,
17832 3 : state.dataUnitarySystems->unitarySys[sysNum].temperatureOffsetControlStatus,
17833 : OutputProcessor::SOVTimeStepType::System,
17834 : OutputProcessor::SOVStoreType::Average,
17835 6 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17836 : }
17837 3 : break;
17838 142 : case UnitarySys::SysType::PackagedAC:
17839 : // CurrentModuleObject = 'ZoneHVAC:PackagedTerminalAirConditioner'
17840 568 : SetupOutputVariable(state,
17841 : "Zone Packaged Terminal Air Conditioner Total Heating Rate",
17842 : OutputProcessor::Unit::W,
17843 142 : state.dataUnitarySystems->unitarySys[sysNum].m_TotHeatEnergyRate,
17844 : OutputProcessor::SOVTimeStepType::System,
17845 : OutputProcessor::SOVStoreType::Average,
17846 284 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17847 568 : SetupOutputVariable(state,
17848 : "Zone Packaged Terminal Air Conditioner Total Heating Energy",
17849 : OutputProcessor::Unit::J,
17850 142 : state.dataUnitarySystems->unitarySys[sysNum].m_TotHeatEnergy,
17851 : OutputProcessor::SOVTimeStepType::System,
17852 : OutputProcessor::SOVStoreType::Summed,
17853 284 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17854 568 : SetupOutputVariable(state,
17855 : "Zone Packaged Terminal Air Conditioner Total Cooling Rate",
17856 : OutputProcessor::Unit::W,
17857 142 : state.dataUnitarySystems->unitarySys[sysNum].m_TotCoolEnergyRate,
17858 : OutputProcessor::SOVTimeStepType::System,
17859 : OutputProcessor::SOVStoreType::Average,
17860 284 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17861 568 : SetupOutputVariable(state,
17862 : "Zone Packaged Terminal Air Conditioner Total Cooling Energy",
17863 : OutputProcessor::Unit::J,
17864 142 : state.dataUnitarySystems->unitarySys[sysNum].m_TotCoolEnergy,
17865 : OutputProcessor::SOVTimeStepType::System,
17866 : OutputProcessor::SOVStoreType::Summed,
17867 284 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17868 568 : SetupOutputVariable(state,
17869 : "Zone Packaged Terminal Air Conditioner Sensible Heating Rate",
17870 : OutputProcessor::Unit::W,
17871 142 : state.dataUnitarySystems->unitarySys[sysNum].m_SensHeatEnergyRate,
17872 : OutputProcessor::SOVTimeStepType::System,
17873 : OutputProcessor::SOVStoreType::Average,
17874 284 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17875 568 : SetupOutputVariable(state,
17876 : "Zone Packaged Terminal Air Conditioner Sensible Heating Energy",
17877 : OutputProcessor::Unit::J,
17878 142 : state.dataUnitarySystems->unitarySys[sysNum].m_SensHeatEnergy,
17879 : OutputProcessor::SOVTimeStepType::System,
17880 : OutputProcessor::SOVStoreType::Summed,
17881 284 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17882 568 : SetupOutputVariable(state,
17883 : "Zone Packaged Terminal Air Conditioner Sensible Cooling Rate",
17884 : OutputProcessor::Unit::W,
17885 142 : state.dataUnitarySystems->unitarySys[sysNum].m_SensCoolEnergyRate,
17886 : OutputProcessor::SOVTimeStepType::System,
17887 : OutputProcessor::SOVStoreType::Average,
17888 284 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17889 568 : SetupOutputVariable(state,
17890 : "Zone Packaged Terminal Air Conditioner Sensible Cooling Energy",
17891 : OutputProcessor::Unit::J,
17892 142 : state.dataUnitarySystems->unitarySys[sysNum].m_SensCoolEnergy,
17893 : OutputProcessor::SOVTimeStepType::System,
17894 : OutputProcessor::SOVStoreType::Summed,
17895 284 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17896 568 : SetupOutputVariable(state,
17897 : "Zone Packaged Terminal Air Conditioner Latent Heating Rate",
17898 : OutputProcessor::Unit::W,
17899 142 : state.dataUnitarySystems->unitarySys[sysNum].m_LatHeatEnergyRate,
17900 : OutputProcessor::SOVTimeStepType::System,
17901 : OutputProcessor::SOVStoreType::Average,
17902 284 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17903 568 : SetupOutputVariable(state,
17904 : "Zone Packaged Terminal Air Conditioner Latent Heating Energy",
17905 : OutputProcessor::Unit::J,
17906 142 : state.dataUnitarySystems->unitarySys[sysNum].m_LatHeatEnergy,
17907 : OutputProcessor::SOVTimeStepType::System,
17908 : OutputProcessor::SOVStoreType::Summed,
17909 284 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17910 568 : SetupOutputVariable(state,
17911 : "Zone Packaged Terminal Air Conditioner Latent Cooling Rate",
17912 : OutputProcessor::Unit::W,
17913 142 : state.dataUnitarySystems->unitarySys[sysNum].m_LatCoolEnergyRate,
17914 : OutputProcessor::SOVTimeStepType::System,
17915 : OutputProcessor::SOVStoreType::Average,
17916 284 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17917 568 : SetupOutputVariable(state,
17918 : "Zone Packaged Terminal Air Conditioner Latent Cooling Energy",
17919 : OutputProcessor::Unit::J,
17920 142 : state.dataUnitarySystems->unitarySys[sysNum].m_LatCoolEnergy,
17921 : OutputProcessor::SOVTimeStepType::System,
17922 : OutputProcessor::SOVStoreType::Summed,
17923 284 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17924 568 : SetupOutputVariable(state,
17925 : "Zone Packaged Terminal Air Conditioner Electricity Rate",
17926 : OutputProcessor::Unit::W,
17927 142 : state.dataUnitarySystems->unitarySys[sysNum].m_ElecPower,
17928 : OutputProcessor::SOVTimeStepType::System,
17929 : OutputProcessor::SOVStoreType::Average,
17930 284 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17931 568 : SetupOutputVariable(state,
17932 : "Zone Packaged Terminal Air Conditioner Electricity Energy",
17933 : OutputProcessor::Unit::J,
17934 142 : state.dataUnitarySystems->unitarySys[sysNum].m_ElecPowerConsumption,
17935 : OutputProcessor::SOVTimeStepType::System,
17936 : OutputProcessor::SOVStoreType::Summed,
17937 284 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17938 568 : SetupOutputVariable(state,
17939 : "Zone Packaged Terminal Air Conditioner Fan Part Load Ratio",
17940 : OutputProcessor::Unit::None,
17941 142 : state.dataUnitarySystems->unitarySys[sysNum].FanPartLoadRatio,
17942 : OutputProcessor::SOVTimeStepType::System,
17943 : OutputProcessor::SOVStoreType::Average,
17944 284 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17945 568 : SetupOutputVariable(state,
17946 : "Zone Packaged Terminal Air Conditioner Compressor Part Load Ratio",
17947 : OutputProcessor::Unit::None,
17948 142 : state.dataUnitarySystems->unitarySys[sysNum].m_CompPartLoadRatio,
17949 : OutputProcessor::SOVTimeStepType::System,
17950 : OutputProcessor::SOVStoreType::Average,
17951 284 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17952 568 : SetupOutputVariable(state,
17953 : "Zone Packaged Terminal Air Conditioner Fan Availability Status",
17954 : OutputProcessor::Unit::None,
17955 142 : state.dataUnitarySystems->unitarySys[sysNum].m_AvailStatus,
17956 : OutputProcessor::SOVTimeStepType::System,
17957 : OutputProcessor::SOVStoreType::Average,
17958 284 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17959 142 : break;
17960 28 : case UnitarySys::SysType::PackagedHP:
17961 : // CurrentModuleObject = 'ZoneHVAC:PackagedTerminalHeatPump'
17962 112 : SetupOutputVariable(state,
17963 : "Zone Packaged Terminal Heat Pump Total Heating Rate",
17964 : OutputProcessor::Unit::W,
17965 28 : state.dataUnitarySystems->unitarySys[sysNum].m_TotHeatEnergyRate,
17966 : OutputProcessor::SOVTimeStepType::System,
17967 : OutputProcessor::SOVStoreType::Average,
17968 56 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17969 112 : SetupOutputVariable(state,
17970 : "Zone Packaged Terminal Heat Pump Total Heating Energy",
17971 : OutputProcessor::Unit::J,
17972 28 : state.dataUnitarySystems->unitarySys[sysNum].m_TotHeatEnergy,
17973 : OutputProcessor::SOVTimeStepType::System,
17974 : OutputProcessor::SOVStoreType::Summed,
17975 56 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17976 112 : SetupOutputVariable(state,
17977 : "Zone Packaged Terminal Heat Pump Total Cooling Rate",
17978 : OutputProcessor::Unit::W,
17979 28 : state.dataUnitarySystems->unitarySys[sysNum].m_TotCoolEnergyRate,
17980 : OutputProcessor::SOVTimeStepType::System,
17981 : OutputProcessor::SOVStoreType::Average,
17982 56 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17983 112 : SetupOutputVariable(state,
17984 : "Zone Packaged Terminal Heat Pump Total Cooling Energy",
17985 : OutputProcessor::Unit::J,
17986 28 : state.dataUnitarySystems->unitarySys[sysNum].m_TotCoolEnergy,
17987 : OutputProcessor::SOVTimeStepType::System,
17988 : OutputProcessor::SOVStoreType::Summed,
17989 56 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17990 112 : SetupOutputVariable(state,
17991 : "Zone Packaged Terminal Heat Pump Sensible Heating Rate",
17992 : OutputProcessor::Unit::W,
17993 28 : state.dataUnitarySystems->unitarySys[sysNum].m_SensHeatEnergyRate,
17994 : OutputProcessor::SOVTimeStepType::System,
17995 : OutputProcessor::SOVStoreType::Average,
17996 56 : state.dataUnitarySystems->unitarySys[sysNum].Name);
17997 112 : SetupOutputVariable(state,
17998 : "Zone Packaged Terminal Heat Pump Sensible Heating Energy",
17999 : OutputProcessor::Unit::J,
18000 28 : state.dataUnitarySystems->unitarySys[sysNum].m_SensHeatEnergy,
18001 : OutputProcessor::SOVTimeStepType::System,
18002 : OutputProcessor::SOVStoreType::Summed,
18003 56 : state.dataUnitarySystems->unitarySys[sysNum].Name);
18004 112 : SetupOutputVariable(state,
18005 : "Zone Packaged Terminal Heat Pump Sensible Cooling Rate",
18006 : OutputProcessor::Unit::W,
18007 28 : state.dataUnitarySystems->unitarySys[sysNum].m_SensCoolEnergyRate,
18008 : OutputProcessor::SOVTimeStepType::System,
18009 : OutputProcessor::SOVStoreType::Average,
18010 56 : state.dataUnitarySystems->unitarySys[sysNum].Name);
18011 112 : SetupOutputVariable(state,
18012 : "Zone Packaged Terminal Heat Pump Sensible Cooling Energy",
18013 : OutputProcessor::Unit::J,
18014 28 : state.dataUnitarySystems->unitarySys[sysNum].m_SensCoolEnergy,
18015 : OutputProcessor::SOVTimeStepType::System,
18016 : OutputProcessor::SOVStoreType::Summed,
18017 56 : state.dataUnitarySystems->unitarySys[sysNum].Name);
18018 112 : SetupOutputVariable(state,
18019 : "Zone Packaged Terminal Heat Pump Latent Heating Rate",
18020 : OutputProcessor::Unit::W,
18021 28 : state.dataUnitarySystems->unitarySys[sysNum].m_LatHeatEnergyRate,
18022 : OutputProcessor::SOVTimeStepType::System,
18023 : OutputProcessor::SOVStoreType::Average,
18024 56 : state.dataUnitarySystems->unitarySys[sysNum].Name);
18025 112 : SetupOutputVariable(state,
18026 : "Zone Packaged Terminal Heat Pump Latent Heating Energy",
18027 : OutputProcessor::Unit::J,
18028 28 : state.dataUnitarySystems->unitarySys[sysNum].m_LatHeatEnergy,
18029 : OutputProcessor::SOVTimeStepType::System,
18030 : OutputProcessor::SOVStoreType::Summed,
18031 56 : state.dataUnitarySystems->unitarySys[sysNum].Name);
18032 112 : SetupOutputVariable(state,
18033 : "Zone Packaged Terminal Heat Pump Latent Cooling Rate",
18034 : OutputProcessor::Unit::W,
18035 28 : state.dataUnitarySystems->unitarySys[sysNum].m_LatCoolEnergyRate,
18036 : OutputProcessor::SOVTimeStepType::System,
18037 : OutputProcessor::SOVStoreType::Average,
18038 56 : state.dataUnitarySystems->unitarySys[sysNum].Name);
18039 112 : SetupOutputVariable(state,
18040 : "Zone Packaged Terminal Heat Pump Latent Cooling Energy",
18041 : OutputProcessor::Unit::J,
18042 28 : state.dataUnitarySystems->unitarySys[sysNum].m_LatCoolEnergy,
18043 : OutputProcessor::SOVTimeStepType::System,
18044 : OutputProcessor::SOVStoreType::Summed,
18045 56 : state.dataUnitarySystems->unitarySys[sysNum].Name);
18046 112 : SetupOutputVariable(state,
18047 : "Zone Packaged Terminal Heat Pump Electricity Rate",
18048 : OutputProcessor::Unit::W,
18049 28 : state.dataUnitarySystems->unitarySys[sysNum].m_ElecPower,
18050 : OutputProcessor::SOVTimeStepType::System,
18051 : OutputProcessor::SOVStoreType::Average,
18052 56 : state.dataUnitarySystems->unitarySys[sysNum].Name);
18053 112 : SetupOutputVariable(state,
18054 : "Zone Packaged Terminal Heat Pump Electricity Energy",
18055 : OutputProcessor::Unit::J,
18056 28 : state.dataUnitarySystems->unitarySys[sysNum].m_ElecPowerConsumption,
18057 : OutputProcessor::SOVTimeStepType::System,
18058 : OutputProcessor::SOVStoreType::Summed,
18059 56 : state.dataUnitarySystems->unitarySys[sysNum].Name);
18060 112 : SetupOutputVariable(state,
18061 : "Zone Packaged Terminal Heat Pump Fan Part Load Ratio",
18062 : OutputProcessor::Unit::None,
18063 28 : state.dataUnitarySystems->unitarySys[sysNum].FanPartLoadRatio,
18064 : OutputProcessor::SOVTimeStepType::System,
18065 : OutputProcessor::SOVStoreType::Average,
18066 56 : state.dataUnitarySystems->unitarySys[sysNum].Name);
18067 112 : SetupOutputVariable(state,
18068 : "Zone Packaged Terminal Heat Pump Compressor Part Load Ratio",
18069 : OutputProcessor::Unit::None,
18070 28 : state.dataUnitarySystems->unitarySys[sysNum].m_CompPartLoadRatio,
18071 : OutputProcessor::SOVTimeStepType::System,
18072 : OutputProcessor::SOVStoreType::Average,
18073 56 : state.dataUnitarySystems->unitarySys[sysNum].Name);
18074 112 : SetupOutputVariable(state,
18075 : "Zone Packaged Terminal Heat Pump Fan Availability Status",
18076 : OutputProcessor::Unit::None,
18077 28 : state.dataUnitarySystems->unitarySys[sysNum].m_AvailStatus,
18078 : OutputProcessor::SOVTimeStepType::System,
18079 : OutputProcessor::SOVStoreType::Average,
18080 56 : state.dataUnitarySystems->unitarySys[sysNum].Name);
18081 28 : break;
18082 22 : case UnitarySys::SysType::PackagedWSHP:
18083 : // CurrentModuleObject = 'ZoneHVAC:WaterToAirHeatPump'
18084 88 : SetupOutputVariable(state,
18085 : "Zone Water to Air Heat Pump Total Heating Rate",
18086 : OutputProcessor::Unit::W,
18087 22 : state.dataUnitarySystems->unitarySys[sysNum].m_TotHeatEnergyRate,
18088 : OutputProcessor::SOVTimeStepType::System,
18089 : OutputProcessor::SOVStoreType::Average,
18090 44 : state.dataUnitarySystems->unitarySys[sysNum].Name);
18091 88 : SetupOutputVariable(state,
18092 : "Zone Water to Air Heat Pump Total Heating Energy",
18093 : OutputProcessor::Unit::J,
18094 22 : state.dataUnitarySystems->unitarySys[sysNum].m_TotHeatEnergy,
18095 : OutputProcessor::SOVTimeStepType::System,
18096 : OutputProcessor::SOVStoreType::Summed,
18097 44 : state.dataUnitarySystems->unitarySys[sysNum].Name);
18098 88 : SetupOutputVariable(state,
18099 : "Zone Water to Air Heat Pump Total Cooling Rate",
18100 : OutputProcessor::Unit::W,
18101 22 : state.dataUnitarySystems->unitarySys[sysNum].m_TotCoolEnergyRate,
18102 : OutputProcessor::SOVTimeStepType::System,
18103 : OutputProcessor::SOVStoreType::Average,
18104 44 : state.dataUnitarySystems->unitarySys[sysNum].Name);
18105 88 : SetupOutputVariable(state,
18106 : "Zone Water to Air Heat Pump Total Cooling Energy",
18107 : OutputProcessor::Unit::J,
18108 22 : state.dataUnitarySystems->unitarySys[sysNum].m_TotCoolEnergy,
18109 : OutputProcessor::SOVTimeStepType::System,
18110 : OutputProcessor::SOVStoreType::Summed,
18111 44 : state.dataUnitarySystems->unitarySys[sysNum].Name);
18112 88 : SetupOutputVariable(state,
18113 : "Zone Water to Air Heat Pump Sensible Heating Rate",
18114 : OutputProcessor::Unit::W,
18115 22 : state.dataUnitarySystems->unitarySys[sysNum].m_SensHeatEnergyRate,
18116 : OutputProcessor::SOVTimeStepType::System,
18117 : OutputProcessor::SOVStoreType::Average,
18118 44 : state.dataUnitarySystems->unitarySys[sysNum].Name);
18119 88 : SetupOutputVariable(state,
18120 : "Zone Water to Air Heat Pump Sensible Heating Energy",
18121 : OutputProcessor::Unit::J,
18122 22 : state.dataUnitarySystems->unitarySys[sysNum].m_SensHeatEnergy,
18123 : OutputProcessor::SOVTimeStepType::System,
18124 : OutputProcessor::SOVStoreType::Summed,
18125 44 : state.dataUnitarySystems->unitarySys[sysNum].Name);
18126 88 : SetupOutputVariable(state,
18127 : "Zone Water to Air Heat Pump Sensible Cooling Rate",
18128 : OutputProcessor::Unit::W,
18129 22 : state.dataUnitarySystems->unitarySys[sysNum].m_SensCoolEnergyRate,
18130 : OutputProcessor::SOVTimeStepType::System,
18131 : OutputProcessor::SOVStoreType::Average,
18132 44 : state.dataUnitarySystems->unitarySys[sysNum].Name);
18133 88 : SetupOutputVariable(state,
18134 : "Zone Water to Air Heat Pump Sensible Cooling Energy",
18135 : OutputProcessor::Unit::J,
18136 22 : state.dataUnitarySystems->unitarySys[sysNum].m_SensCoolEnergy,
18137 : OutputProcessor::SOVTimeStepType::System,
18138 : OutputProcessor::SOVStoreType::Summed,
18139 44 : state.dataUnitarySystems->unitarySys[sysNum].Name);
18140 88 : SetupOutputVariable(state,
18141 : "Zone Water to Air Heat Pump Latent Heating Rate",
18142 : OutputProcessor::Unit::W,
18143 22 : state.dataUnitarySystems->unitarySys[sysNum].m_LatHeatEnergyRate,
18144 : OutputProcessor::SOVTimeStepType::System,
18145 : OutputProcessor::SOVStoreType::Average,
18146 44 : state.dataUnitarySystems->unitarySys[sysNum].Name);
18147 88 : SetupOutputVariable(state,
18148 : "Zone Water to Air Heat Pump Latent Heating Energy",
18149 : OutputProcessor::Unit::J,
18150 22 : state.dataUnitarySystems->unitarySys[sysNum].m_LatHeatEnergy,
18151 : OutputProcessor::SOVTimeStepType::System,
18152 : OutputProcessor::SOVStoreType::Summed,
18153 44 : state.dataUnitarySystems->unitarySys[sysNum].Name);
18154 88 : SetupOutputVariable(state,
18155 : "Zone Water to Air Heat Pump Latent Cooling Rate",
18156 : OutputProcessor::Unit::W,
18157 22 : state.dataUnitarySystems->unitarySys[sysNum].m_LatCoolEnergyRate,
18158 : OutputProcessor::SOVTimeStepType::System,
18159 : OutputProcessor::SOVStoreType::Average,
18160 44 : state.dataUnitarySystems->unitarySys[sysNum].Name);
18161 88 : SetupOutputVariable(state,
18162 : "Zone Water to Air Heat Pump Latent Cooling Energy",
18163 : OutputProcessor::Unit::J,
18164 22 : state.dataUnitarySystems->unitarySys[sysNum].m_LatCoolEnergy,
18165 : OutputProcessor::SOVTimeStepType::System,
18166 : OutputProcessor::SOVStoreType::Summed,
18167 44 : state.dataUnitarySystems->unitarySys[sysNum].Name);
18168 88 : SetupOutputVariable(state,
18169 : "Zone Water to Air Heat Pump Electricity Rate",
18170 : OutputProcessor::Unit::W,
18171 22 : state.dataUnitarySystems->unitarySys[sysNum].m_ElecPower,
18172 : OutputProcessor::SOVTimeStepType::System,
18173 : OutputProcessor::SOVStoreType::Average,
18174 44 : state.dataUnitarySystems->unitarySys[sysNum].Name);
18175 88 : SetupOutputVariable(state,
18176 : "Zone Water to Air Heat Pump Electricity Energy",
18177 : OutputProcessor::Unit::J,
18178 22 : state.dataUnitarySystems->unitarySys[sysNum].m_ElecPowerConsumption,
18179 : OutputProcessor::SOVTimeStepType::System,
18180 : OutputProcessor::SOVStoreType::Summed,
18181 44 : state.dataUnitarySystems->unitarySys[sysNum].Name);
18182 88 : SetupOutputVariable(state,
18183 : "Zone Water to Air Heat Pump Fan Part Load Ratio",
18184 : OutputProcessor::Unit::None,
18185 22 : state.dataUnitarySystems->unitarySys[sysNum].FanPartLoadRatio,
18186 : OutputProcessor::SOVTimeStepType::System,
18187 : OutputProcessor::SOVStoreType::Average,
18188 44 : state.dataUnitarySystems->unitarySys[sysNum].Name);
18189 88 : SetupOutputVariable(state,
18190 : "Zone Water to Air Heat Pump Compressor Part Load Ratio",
18191 : OutputProcessor::Unit::None,
18192 22 : state.dataUnitarySystems->unitarySys[sysNum].m_CompPartLoadRatio,
18193 : OutputProcessor::SOVTimeStepType::System,
18194 : OutputProcessor::SOVStoreType::Average,
18195 44 : state.dataUnitarySystems->unitarySys[sysNum].Name);
18196 88 : SetupOutputVariable(state,
18197 : "Zone Water to Air Heat Pump Fan Availability Status",
18198 : OutputProcessor::Unit::None,
18199 22 : state.dataUnitarySystems->unitarySys[sysNum].m_AvailStatus,
18200 : OutputProcessor::SOVTimeStepType::System,
18201 : OutputProcessor::SOVStoreType::Average,
18202 44 : state.dataUnitarySystems->unitarySys[sysNum].Name);
18203 22 : break;
18204 0 : default:
18205 0 : ShowFatalError(state,
18206 : "setupAllOutputVar: Developer error. All report variables must be set up here after all systems are read in.");
18207 : }
18208 : }
18209 : } else {
18210 0 : ShowSevereError(state,
18211 : "setupAllOutputVar: Developer error. Should never get here. Remove when confortable that UnitarySys::allocateUnitarySys "
18212 : "is working as expected.");
18213 0 : ShowFatalError(state, "setupAllOutputVar: Developer error. Conflict in number of UnitarySystems.");
18214 : }
18215 161 : state.dataUnitarySystems->reportVariablesAreSetup = true;
18216 : }
18217 :
18218 55 : void isWaterCoilHeatRecoveryType(EnergyPlusData &state, int const waterCoilNodeNum, bool &nodeNotFound)
18219 : {
18220 57 : for (int sysNum = 0; sysNum < state.dataUnitarySystems->numUnitarySystems; ++sysNum) {
18221 4 : if (state.dataUnitarySystems->unitarySys[sysNum].m_HRcoolCoilFluidInletNode == waterCoilNodeNum &&
18222 1 : state.dataUnitarySystems->unitarySys[sysNum].m_WaterHRPlantLoopModel) {
18223 1 : nodeNotFound = false;
18224 1 : break;
18225 : }
18226 : }
18227 55 : }
18228 :
18229 : } // namespace UnitarySystems
18230 2313 : } // namespace EnergyPlus
|