LCOV - code coverage report
Current view: top level - EnergyPlus - RefrigeratedCase.cc (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 6013 8576 70.1 %
Date: 2023-01-17 19:17:23 Functions: 41 43 95.3 %

          Line data    Source code
       1             : // EnergyPlus, Copyright (c) 1996-2023, The Board of Trustees of the University of Illinois,
       2             : // The Regents of the University of California, through Lawrence Berkeley National Laboratory
       3             : // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
       4             : // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
       5             : // contributors. All rights reserved.
       6             : //
       7             : // NOTICE: This Software was developed under funding from the U.S. Department of Energy and the
       8             : // U.S. Government consequently retains certain rights. As such, the U.S. Government has been
       9             : // granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable,
      10             : // worldwide license in the Software to reproduce, distribute copies to the public, prepare
      11             : // derivative works, and perform publicly and display publicly, and to permit others to do so.
      12             : //
      13             : // Redistribution and use in source and binary forms, with or without modification, are permitted
      14             : // provided that the following conditions are met:
      15             : //
      16             : // (1) Redistributions of source code must retain the above copyright notice, this list of
      17             : //     conditions and the following disclaimer.
      18             : //
      19             : // (2) Redistributions in binary form must reproduce the above copyright notice, this list of
      20             : //     conditions and the following disclaimer in the documentation and/or other materials
      21             : //     provided with the distribution.
      22             : //
      23             : // (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory,
      24             : //     the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be
      25             : //     used to endorse or promote products derived from this software without specific prior
      26             : //     written permission.
      27             : //
      28             : // (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form
      29             : //     without changes from the version obtained under this License, or (ii) Licensee makes a
      30             : //     reference solely to the software portion of its product, Licensee must refer to the
      31             : //     software as "EnergyPlus version X" software, where "X" is the version number Licensee
      32             : //     obtained under this License and may not use a different name for the software. Except as
      33             : //     specifically required in this Section (4), Licensee shall not use in a company name, a
      34             : //     product name, in advertising, publicity, or other promotional activities any name, trade
      35             : //     name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly
      36             : //     similar designation, without the U.S. Department of Energy's prior written consent.
      37             : //
      38             : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
      39             : // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
      40             : // AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
      41             : // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
      42             : // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
      43             : // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
      44             : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
      45             : // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
      46             : // POSSIBILITY OF SUCH DAMAGE.
      47             : 
      48             : // C++ Headers
      49             : #include <cmath>
      50             : #include <string>
      51             : 
      52             : // ObjexxFCL Headers
      53             : #include <ObjexxFCL/Array.functions.hh>
      54             : #include <ObjexxFCL/Array2D.hh>
      55             : #include <ObjexxFCL/Fmath.hh>
      56             : 
      57             : // EnergyPlus Headers
      58             : #include <EnergyPlus/BranchNodeConnections.hh>
      59             : #include <EnergyPlus/CurveManager.hh>
      60             : #include <EnergyPlus/Data/EnergyPlusData.hh>
      61             : #include <EnergyPlus/DataEnvironment.hh>
      62             : #include <EnergyPlus/DataHVACGlobals.hh>
      63             : #include <EnergyPlus/DataHeatBalFanSys.hh>
      64             : #include <EnergyPlus/DataHeatBalance.hh>
      65             : #include <EnergyPlus/DataIPShortCuts.hh>
      66             : #include <EnergyPlus/DataLoopNode.hh>
      67             : #include <EnergyPlus/DataWater.hh>
      68             : #include <EnergyPlus/DataZoneEnergyDemands.hh>
      69             : #include <EnergyPlus/DataZoneEquipment.hh>
      70             : #include <EnergyPlus/EMSManager.hh>
      71             : #include <EnergyPlus/FluidProperties.hh>
      72             : #include <EnergyPlus/General.hh>
      73             : #include <EnergyPlus/GlobalNames.hh>
      74             : #include <EnergyPlus/HeatBalanceInternalHeatGains.hh>
      75             : #include <EnergyPlus/InputProcessing/InputProcessor.hh>
      76             : #include <EnergyPlus/NodeInputManager.hh>
      77             : #include <EnergyPlus/OutAirNodeManager.hh>
      78             : #include <EnergyPlus/OutputProcessor.hh>
      79             : #include <EnergyPlus/Plant/DataPlant.hh>
      80             : #include <EnergyPlus/PlantUtilities.hh>
      81             : #include <EnergyPlus/Psychrometrics.hh>
      82             : #include <EnergyPlus/RefrigeratedCase.hh>
      83             : #include <EnergyPlus/ScheduleManager.hh>
      84             : #include <EnergyPlus/UtilityRoutines.hh>
      85             : #include <EnergyPlus/WaterManager.hh>
      86             : 
      87             : namespace EnergyPlus::RefrigeratedCase {
      88             : 
      89             : // MODULE INFORMATION:
      90             : //       AUTHOR         Richard Raustad, FSEC
      91             : //       DATE WRITTEN   Oct/Nov 2004
      92             : //       MODIFIED       Shirey, FSEC Dec 2004; Hudson, ORNL Feb 2007, July 2007
      93             : //       MODIFIED       Stovall, ORNL, April 2008 added detailed refrigeration systems
      94             : //       MODIFIED       Stovall, ORNL, Fall 2009 added cascade condensers, secondary loops, and walk-ins.
      95             : //       MODIFIED       Griffith, NREL, 2010, Plant upgrade, generalize plant fluid properties.
      96             : //       MODIFIED       Fricke, ORNL, Fall 2011, added detailed transcritical CO2 refrigeration system.
      97             : //       RE-ENGINEERED  na
      98             : 
      99             : // PURPOSE OF THIS MODULE:
     100             : // To simulate refrigerated cases,walk-in coolers, secondary loops,
     101             : //             compressor racks, and detailed refrigeration systems.
     102             : // Case performance is varied based on specific operating conditions within the zone.
     103             : 
     104             : // METHODOLOGY EMPLOYED:
     105             : // Refrigerated cases are simulated based on performance information available from manufacturers
     106             : // and knowing the latent heat ratio of the case cooling load which can be obtained from ASHRAE or
     107             : // others who have completed research to quantify this value. The sensible case credits
     108             : // (sensible cooling provided to the surrounding zone air) are calculated during input
     109             : // processing by subtracting the fan, lighting, and anti-sweat heater energy from the
     110             : // design sensible capacity (TotCap * (1-LHR) * RTF).  The actual latent cooling provided
     111             : // by the case (at the actual operating conditions) is calculated based on the latent performance
     112             : // curve supplied by the user.  The actual sensible cooling provided by the case (at the actual
     113             : // operating conditions) is calculated by summing all sensible components (fan + light + anti-sweat +
     114             : // sensible case credit). The case (evaporator) fans are assumed to be disabled during hot-gas or
     115             : // electric defrost modes. A stocking schedule (W/m) is available for added load if desired.
     116             : // Walk-In coolers are simulated based on the specified sum of the conductance*area of each wall and door facing
     117             : // up to three (extendible) zones.  Two types of doors are specified, stock doors and glass doors.  For each category
     118             : // of doors, schedules for door openings are used with ASHRAE models for infiltration
     119             : // which are a function of the height of the door.  That
     120             : // infiltration is used to calculate the latent load on the cooler and the latent case credits for each zone.
     121             : // The sensible case credit for each zone is the sum of the conductive and sensible infiltration load
     122             : // for each surface/door facing that zone.  Note that the latent portion of the infiltration is unused
     123             : // during defrost to be consistent with decision for refrigerated cases.
     124             : // Compressor racks are simulated by summing the attached refrigerated case and walk-in cooler
     125             : // capacities.  The energy use of the
     126             : // compressor rack is then calculated with a simplified model for COP variation with temperature. Condenser fan power
     127             : // is based on a user-supplied curve object. Racks are not scheduled.
     128             : // Compressor racks may have indoor (in-zone) or outdoor condensers.  If outdoors, the condensers may be cooled
     129             : // by dry air cooling or evaporative cooling. A water-cooled condenser is also available by specifying water-cooling
     130             : // as the Condenser Type.  If a water-cooled condenser is utilized, a second entry to this module will
     131             : // occur during the HVAC simulation as called from the NonZoneEquipmentManager.
     132             : // Detailed refrigeration systems model each compressor individually using the manufacturer's rating curves.
     133             : // A collection of such curves has been added in the datasets library. The curves produce the refrigeration
     134             : // capacity and power consumption. The capacity needed is based on the sum of the case and walk-in loads (as is done
     135             : // for the compressor racks).  The compressors are dispatched to meet this load according to the order
     136             : // prescribed in the compressor list input object. The condenser for each system can be air-cooled,
     137             : // evaporative-cooled, or water cooled.  For air and evap-cooled condensers, manufacturer's rating data
     138             : // is input to describe the performance and to determine the required air flow rate, which is used to
     139             : // calculate the fan power requirements.  The fans can be described as single-speed, two-speed, or variable
     140             : // speed. The condenser performance data also is used to calculate the condensing temperature, which is a function
     141             : // of the heat sink temperature and the load on the condenser.  This must be solved iteratively, checking on
     142             : // the calculated refrigerant mass flow through the compressors.  The solution usually requires less than 5 iterations.
     143             : // The refrigerant state exiting the compressor group is known so the amount of heat available for
     144             : // desuperheat reclaim is explicitly known.
     145             : // The detailed refrigeration model allows the use of subcoolers,secondary loops, and cascade condensers
     146             : // to transfer load from one suction group to another. This introduces the need for further iterations among
     147             : // the systems.  Three loops through the
     148             : // systems are adequate to model these interactions.  The detailed model will also calculate a variable suction
     149             : // pressure for systems with controls that allow the suction temperature/pressure to float
     150             : // up when the case loads are less than their design capacity.
     151             : 
     152             : // Secondary Systems include case and walk-in refrigeration loads.  However, the balance of the system is
     153             : // made up of a heat exchanger and circulating pump(s) instead of a condenser and compressors.
     154             : // The total load on the heat exchanger is the sum of the refrigeration loads, any pipe heat gains,
     155             : // and the portion of the pump power that is absorbed by the circulating fluid. If the total load is
     156             : // greater than the rated capacity of the secondary loop, the unmet load for any time step is carried over
     157             : // to the next time step.  Each secondary system appears as a load on a detailed refrigeration system. If
     158             : // any of the cases or walk-ins served by a secondary are defrosted using hot brine, the primary system
     159             : // serving the secondary loop receives the defrost energy credits (i.e., heat reclaim used to generate defrost
     160             : // energy).
     161             : 
     162             : // Cascade Condensers allow the use of a higher temperature refrigeration system (primary system) to serve as a
     163             : // heat rejection sink for a lower temperature refrigeration system (secondary system). The condensing
     164             : // temperature can be fixed or can be allowed to float according to the minimum required evaporating temperature
     165             : // for other loads upon the primary system. For cases and walk-ins served by cascade condensers, energy associated
     166             : // with hot gas defrost is reclaimed from the primary system.  The refrigeration load the cascade condenser
     167             : // places upon the primary system is the sum of all case and walk-in loads served by the secondary system plus
     168             : // the sum of the secondary loop's compressor power. The same name used to identify the condenser in the
     169             : // secondary loop is used to identify the cascade load on the primary system.
     170             : 
     171             : // Detailed transcritical CO2 refrigeration systems model each compressor individually using the manufacturer's
     172             : // performance data. A collection of CO2 compressor performance curves has been added in the datasets library.
     173             : // The curves produce the refrigeration capacity and power consumption. The capacity required is based on the sum
     174             : // of the case and walk-in loads and the compressors are dispatched to meet this load according to the order
     175             : // prescribed in the compressor list input object. Currently, an air-cooled gas cooler is modeled, and
     176             : // manufacturer's rating data is input to describe the performance and to determine the required fan power
     177             : // requirements. The gas cooler fans can be described as single-speed, two-speed, or variable speed. During
     178             : // transcritical operation, the optimal gas cooler pressure, which maximizes the system's COP, is determined as
     179             : // a function of the ambient air temperature. During subcritical operation, the condensing pressure is allowed to
     180             : // float with ambient temperature in order to achieve maximum performance.
     181             : 
     182             : // This module was designed to be accessed once for each time step.  It uses several accumulating variables
     183             : //  to carry unmet loads from one time step to the next (cases/walk-ins and compressors.  Also, it meets
     184             : //  heat reclaim needs with the loads from the previous time step (because they are unknown for the current
     185             : //  zone time step).  However, the loads time step may be repeated, such as when a demand manager is used.
     186             : //  For that purpose, the values for these accumulating variables are saved at the start of each time step
     187             : //  and reset whenever the time step is repeated.  (see the init subroutine.)
     188             : // This correction is also applied when working on the system time step for coil-type loads by setting the saved values
     189             : //  at the start of each system time step to the value at the end of the previous time step. They are reset
     190             : //  to that value at each sys time step iteration. (see InitRefrigeration)
     191             : 
     192             : // REFERENCES:
     193             : // Specific references are provided for the equipment simulation subroutines below.
     194             : 
     195             : // True at the start of each time step, False after first subtime step of time step
     196             : // includes DataGlobals::CurrentTime, in fractional hours, from start of day. Uses Loads time step.
     197             : // includes DataGlobals::NumOfZones
     198             : 
     199             : // Following constant approp for R22, future may make f(refrigerant)
     200             : Real64 constexpr CaseSuperheat(4.0);       // case superheat used to control thermal expansion valve, ASHRAE 2006 p 44.6 (C)
     201             : Real64 constexpr TransCaseSuperheat(10.0); // case superheat for transcritical CO2 systems (C)
     202             : 
     203             : // Next two constants used to autosize evap condenser
     204             : Real64 constexpr CondPumpRatePower(0.004266);  // evap condenser pump rated, Wpump/Wcapacity (15 W/ton)
     205             : Real64 constexpr AirVolRateEvapCond(0.000144); // evap cond air flow rate for autosize, equiv 850 cfm/ton (m3/W-s)
     206             : Real64 constexpr EvapCutOutTdb(4.0);           // shut off evap water flow if outdoor drybulb < evapcutOutTdb (C)
     207             : 
     208             : // Miscellaneous constants
     209             : Real64 constexpr MyLargeNumber(1.0e9);
     210             : Real64 constexpr MySmallNumber(1.0e-9);
     211             : Real64 constexpr Rair(0.3169);                   // Air resistance used with Heat Balance anti-sweat (AS) heater
     212             : Real64 constexpr IceMeltEnthalpy(335000.0);      // heat of fusion of water J/kg
     213             : Real64 constexpr TempTooHotToFrost(5.0);         // C, used to check for frosting conditions on evaporator coils
     214             : Real64 constexpr IcetoVaporEnthalpy(2833000.0);  // J/kg to freeze water vapor to ice
     215             : Real64 constexpr SpecificHeatIce(2000.0);        // in the likely range (2040 at 0C and 1950 at -20C) (J/kg-C)
     216             : Real64 constexpr CondAirVolExponentDry(1.58);    // exponent for forced air over a cylinder, = 1/.633 per ASHRAE 2005 (page 3.15)
     217             : Real64 constexpr CondAirVolExponentEvap(1.32);   // exponent for evap condenser air vol flow, = 1/.76 per Manske, 1999
     218             : Real64 constexpr EvaporatorAirVolExponent(1.54); // exponent for evaporator air vol flow, = 1/.65 per Manske, 1999, page 35
     219             : Real64 constexpr FanHalfSpeedRatio(0.1768);      // = 1/(2**2.5) for power step for two speed fan
     220             : Real64 constexpr CapFac60Percent(0.60);          // = 60%, load served by half power 2-speed fan
     221             : 
     222             : static constexpr std::array<Real64, 5> EuropeanWetCoilFactor = {1.35, 1.15, 1.05, 1.01, 1.0};
     223             : static constexpr std::array<Real64, 5> EuropeanAirInletTemp = {10.0, 0.0, -18.0, -25.0, -34.0};
     224             : 
     225     2921669 : void ManageRefrigeratedCaseRacks(EnergyPlusData &state)
     226             : {
     227             : 
     228             :     // SUBROUTINE INFORMATION:
     229             :     //       AUTHOR         Richard Raustad, FSEC
     230             :     //       DATE WRITTEN   Oct/Nov 2004
     231             :     //       MODIFIED       Shirey, FSEC Dec 2004, Stovall, ORNL, May 2008
     232             :     //       RE-ENGINEERED  na
     233             : 
     234             :     // PURPOSE OF THIS SUBROUTINE:
     235             :     // This subroutine is called from HVACManager.cc, subroutine ManageHVAC to
     236             :     // manage refrigerated cases and associated compressor racks on zone time step
     237             :     // OR from SimAirChillerSet in this module on sys time step (Stovall 2011)
     238             : 
     239             :     // METHODOLOGY EMPLOYED:
     240             :     // Each compressor rack is modeled by first simulating the attached refrigeration loads. The
     241             :     // loads can include refrigerated cases, walk-in coolers, and secondary fluid chillers.  The sum
     242             :     // of the total heat transfer for all attached loads determines the load on the compressor rack.
     243             :     // For the refrigeration rack approach, a simple model for variation of COP with
     244             :     // condensing temperature is used to determine rack power and energy consumption.
     245             :     // For the detailed system approach, the compressors and condensers are modeled individually
     246             :     // using manufacturer's data and rated performance curves.
     247             :     // Inter-system heat transfer via subcoolers and cascade condensers can be accommodated.
     248             :     // Secondary refrigeration cycles are also available.
     249             : 
     250     2921669 :     auto &RefrigRack(state.dataRefrigCase->RefrigRack);
     251             : 
     252     2921669 :     if (!state.dataRefrigCase->ManageRefrigeration) return;
     253             : 
     254      469683 :     CheckRefrigerationInput(state);
     255             : 
     256      469683 :     InitRefrigeration(state);
     257             : 
     258             :     // ManageRefrigeratedCaseRacks is called on each zone time step.
     259             :     //  However, if have chillers, ManageRefrigeration will be .TRUE. and will
     260             :     //  need to bounce back. (InitRefrig has to be called anyway to zero values at zone time step.)
     261             :     //  Therefore...
     262      469683 :     if ((!state.dataRefrigCase->HaveCasesOrWalkins) && (!state.dataRefrigCase->UseSysTimeStep)) {
     263             :         // Zero requests for cooling water from plant or tank
     264        2891 :         ZeroHVACValues(state);
     265        2891 :         return;
     266             :     }
     267             :     // Following case should never occur, but just for completeness:
     268      466792 :     if ((!state.dataRefrigCase->HaveChillers) && (state.dataRefrigCase->UseSysTimeStep)) return;
     269             : 
     270             :     // Refrigerated cases are not simulated the first time through, replicate this on beginning of next environment
     271      466792 :     if (state.dataGlobal->BeginEnvrnFlag && state.dataRefrigCase->MyOneTimeFlag) {
     272         299 :         state.dataRefrigCase->MyOneTimeFlag = false;
     273         299 :         return;
     274             :     }
     275      466493 :     if (!state.dataGlobal->BeginEnvrnFlag) state.dataRefrigCase->MyOneTimeFlag = true;
     276             : 
     277      466493 :     if (state.dataRefrigCase->HaveRefrigRacks) {
     278      294878 :         for (int RackNum = 1; RackNum <= state.dataRefrigCase->NumRefrigeratedRacks; ++RackNum) {
     279      200582 :             RefrigRack(RackNum).CalcRackSystem(state);
     280      200582 :             RefrigRack(RackNum).ReportRackSystem(state, RackNum);
     281             :         }
     282             :     }
     283             : 
     284      466493 :     if (state.dataRefrigCase->HaveDetailedRefrig) SimulateDetailedRefrigerationSystems(state);
     285      466493 :     if (state.dataRefrigCase->HaveDetailedTransRefrig) SimulateDetailedTransRefrigSystems(state);
     286             : }
     287             : 
     288         771 : void GetRefrigerationInput(EnergyPlusData &state)
     289             : {
     290             : 
     291             :     // SUBROUTINE INFORMATION:
     292             :     //       AUTHOR         Richard Raustad, FSEC
     293             :     //       DATE WRITTEN   Oct/Nov 2004
     294             :     //       MODIFIED       Shirey, FSEC Dec 2004; Hudson, ORNL Feb 2007, July 2007
     295             :     //       MODIFIED       Stovall, ORNL April 2008, Assisted by Hugh Henderson
     296             :     //       RE-ENGINEERED  na
     297             : 
     298             :     // PURPOSE OF THIS SUBROUTINE:
     299             :     // GetObjectItem is called to read refrigerated case, rack, compressor, and condenser information
     300             :     // Lists of cases and compressors are then correlated to the appropriate system.
     301             :     // The nominal ratings of all components are then compared and a warning is printed if the system is not balanced
     302             : 
     303             :     // METHODOLOGY EMPLOYED:
     304             :     // GetObjectItem is called to read refrigerated case information
     305             : 
     306             :     static constexpr std::string_view TrackMessage("from refrigerated case");
     307             :     static constexpr std::string_view RoutineName("GetRefrigerationInput: ");
     308             :     static constexpr std::string_view TrackMessageAlt("GetInput in RefrigeratedCase");
     309             :     static constexpr std::string_view RoutineNameNoColon("GetRefrigerationInput");
     310             : 
     311         771 :     int constexpr AlwaysOn(-1); // -1 pointer sent to schedule manager returns a value of 1.0
     312             :     //     input in both watts and flow rate
     313         771 :     int constexpr NumWIAlphaFieldsBeforeZoneInput(9);   // Used to cycle through zones on input for walk in coolers
     314         771 :     int constexpr NumWIAlphaFieldsPerZone(4);           // Used to cycle through zones on input for walk in coolers
     315         771 :     int constexpr NumWINumberFieldsBeforeZoneInput(12); // Used to cycle through zones on input for walk in coolers
     316         771 :     int constexpr NumWINumberFieldsPerZone(8);          // Used to cycle through zones on input for walk in coolers
     317         771 :     Real64 constexpr CondARI460DelT(16.7);              // Rated sat cond temp - dry bulb air T for air-cooled Condensers, ARI460
     318         771 :     Real64 constexpr CondARI460Tcond(51.7);             // Rated sat cond temp for air-cooled cond, ARI 460
     319         771 :     Real64 constexpr CondARI490DelT(15.0);              // Rated sat cond temp - wet bulb air T for evap-cooled Cond w R22, ARI490
     320         771 :     Real64 constexpr CondARI490Tcond(40.6);             // Rated sat cond temp for evap-cooled cond with R22, ARI 490
     321         771 :     Real64 constexpr DelEvapTDefault(5.0);              // default difference between case T and evap T (C)
     322         771 :     Real64 constexpr HoursPerDay(24.0);
     323         771 :     Real64 constexpr SecondsPerHour(3600.0);
     324         771 :     Real64 constexpr DefaultCascadeCondApproach(3.0); // Cascade condenser approach temperature difference (deltaC)
     325         771 :     Real64 constexpr DefaultCircRate(2.5);            // Phase change liquid overfeed circulating rate (ASHRAE definition)
     326         771 :     Real64 constexpr DefaultWISurfaceUValue(0.3154);  // equiv R18 in Archaic American units (W/m2-delta T)
     327         771 :     Real64 constexpr DefaultWIUValueGlassDr(1.136);   // equiv R5 in Archaic American units (W/m2-delta T)
     328         771 :     Real64 constexpr DefaultWIUValueStockDr(0.3785);  // equiv R15 in Archaic American units (W/m2-delta T)
     329         771 :     Real64 constexpr DefaultWIHeightGlassDr(1.5);     // glass door height in walk-in cooler (m)
     330         771 :     Real64 constexpr DefaultWIHeightStockDr(3.0);     // stock door height in walk-in cooler (m)
     331         771 :     Real64 constexpr PumpImpellerEfficiency(0.78);    // same as used in pump auto-sizing, dimensionless
     332         771 :     Real64 constexpr PumpMotorEfficiency(0.85);       // suggested as average value in ITT/Gould pump references,
     333             : 
     334        1542 :     Array1D_string Alphas;             // Alpha items for object
     335        1542 :     Array1D_string cAlphaFieldNames;   // Alpha field names (from input processor)
     336        1542 :     Array1D_string cNumericFieldNames; // Numeric field names (from input processor)
     337        1542 :     std::string CurrentModuleObject;   // Object type for getting and error messages
     338             : 
     339        1542 :     Array1D_bool lAlphaBlanks;   // Logic array, alpha input blank = .TRUE.
     340        1542 :     Array1D_bool lNumericBlanks; // Logic array, numeric input blank = .TRUE.
     341         771 :     bool ErrorsFound(false);     // Set to true if errors in input, fatal at end of routine
     342             : 
     343         771 :     int AlphaNum(0);                       // Used to cycle through input
     344         771 :     int IOStatus(0);                       // Used in GetObjectItem
     345         771 :     int MaxNumAlphasRack(0);               // Maximum number of alphas for rack object
     346         771 :     int MaxNumAlphasAirChiller(0);         // Maximum number of alphas for air chiller
     347         771 :     int MaxNumAlphasAll(0);                // Maximum number of alphas for all objects
     348         771 :     int MaxNumAlphasSys(0);                // Maximum number of alphas for system object
     349         771 :     int MaxNumAlphasTransSys(0);           // Maximum number of alphas for transcritical system object
     350         771 :     int MaxNumAlphasChillerSet(0);         // Maximum number of alphas for chiller set
     351         771 :     int MaxNumAlphasConda(0);              // Maximum number of alphas for air-cooled condenser object
     352         771 :     int MaxNumAlphasConde(0);              // Maximum number of alphas for evap-cooled condenser object
     353         771 :     int MaxNumAlphasCondw(0);              // Maximum number of alphas for water-cooled condenser object
     354         771 :     int MaxNumAlphasGasCoolera(0);         // Maximum number of alphas for air-cooled gas cooler object
     355         771 :     int MaxNumAlphasComp(0);               // Maximum number of alphas for compressor object
     356         771 :     int MaxNumAlphasCompressorList(0);     // Maximum number of alphas for compressor list objects
     357         771 :     int MaxNumAlphasCase(0);               // Maximum number of alphas for case object
     358         771 :     int MaxNumAlphasCaseAndWalkInList(0);  // Maximum number of alphas in CaseAndWalkInList
     359         771 :     int MaxNumAlphasWalkIn(0);             // Maximum number of alphas for walkin object
     360         771 :     int MaxNumAlphasSecond(0);             // Maximum number of alphas for air chiller object
     361         771 :     int MaxNumNumbersAirChiller(0);        // Maximum number of numbers for air chiller object
     362         771 :     int MaxNumNumbersSecond(0);            // Maximum number of numbers for secondary system object
     363         771 :     int MaxNumNumbersWalkIn(0);            // Maximum number of numbers for walkin object
     364         771 :     int MaxNumNumbersCase(0);              // Maximum number of numbers for case object
     365         771 :     int MaxNumNumbersCaseAndWalkInList(0); // Maximum number of numbers in CaseAndWalkInList
     366         771 :     int MaxNumNumbersRack(0);              // Maximum number of numbers for rack object
     367         771 :     int MaxNumNumbersAll(0);               // Maximum number of numeric inputs for all objects
     368         771 :     int MaxNumNumbersSys(0);               // Maximum number of numbers for system object
     369         771 :     int MaxNumNumbersTransSys(0);          // Maximum number of numbers for transcritical system object
     370         771 :     int MaxNumNumbersChillerSet(0);        // Maximum number of numbers for chiller set object
     371         771 :     int MaxNumNumbersConda(0);             // Maximum number of numbers for air-cooled condenser object
     372         771 :     int MaxNumNumbersConde(0);             // Maximum number of numbers for evap-cooled condenser object
     373         771 :     int MaxNumNumbersCondw(0);             // Maximum number of numbers for water-cooled condenser object
     374         771 :     int MaxNumNumbersGasCoolera(0);        // Maximum number of numbers for air-cooled gas cooler object
     375         771 :     int MaxNumNumbersComp(0);              // Maximum number of numbers for compressor object
     376         771 :     int MaxNumNumbersCompressorList(0);    // Maximum number of numbers
     377         771 :     int MaxNumArgs(0);                     // Max number of alphas and numbers (arguments) for rack object
     378         771 :     int NumAlphas(0);                      // Number of Alphas for each GetObjectItem call
     379         771 :     int NumCases(0);                       // Number of refrigerated cases for single system
     380         771 :     int NumNum(0);                         // Used to cycle through input
     381         771 :     int NumNumbers(0);                     // Number of Numbers for each GetObjectItem call
     382         771 :     int NumDisplayCases(0);                // Counter for refrigerated cases in GetInput do loop
     383         771 :     int NumWalkIns(0);                     // Number of walk ins
     384         771 :     int RefrigSysNum(0);
     385         771 :     int RefrigIndex(0);                // Index used in fluid property routines
     386         771 :     Real64 DeltaHPhaseChange(0.0);     // Secondary loop enthalpy change in condenser w overfeed system (J/g)
     387         771 :     Real64 DelTempMin(0.0);            // min temperature for heat rej curve for air cooled condenser (C)
     388         771 :     Real64 DelTempMax(0.0);            // max temperature for heat rej curve for air cooled condenser (C)
     389         771 :     Real64 DensityBrineRated(0.0);     // density of circ fluid in secondary loop
     390         771 :     Real64 DensityPhaseChange(0.0);    // Secondary loop density at condensing temperature w overfeed system (g/m3)
     391         771 :     Real64 NominalTotalCompCapLP(0.0); // Total of nominal low pressure compressor capacities, used for rough input check (W) (Transcritical CO2)
     392         771 :     Real64 NominalTotalCompCapHP(0.0);
     393        1542 :     Array1D<Real64> Numbers;   // Numeric items for object
     394        1542 :     Array2D<Real64> DayValues; // Array of schedule values
     395             : 
     396         771 :     auto &RefrigCase(state.dataRefrigCase->RefrigCase);
     397         771 :     auto &RefrigRack(state.dataRefrigCase->RefrigRack);
     398         771 :     auto &CaseRAFraction(state.dataRefrigCase->CaseRAFraction);
     399         771 :     auto &System(state.dataRefrigCase->System);
     400         771 :     auto &TransSystem(state.dataRefrigCase->TransSystem);
     401         771 :     auto &Condenser(state.dataRefrigCase->Condenser);
     402         771 :     auto &Compressor(state.dataRefrigCase->Compressor);
     403         771 :     auto &GasCooler(state.dataRefrigCase->GasCooler);
     404         771 :     auto &Subcooler(state.dataRefrigCase->Subcooler);
     405         771 :     auto &CaseAndWalkInList(state.dataRefrigCase->CaseAndWalkInList);
     406         771 :     auto &CompressorLists(state.dataRefrigCase->CompressorLists);
     407         771 :     auto &Secondary(state.dataRefrigCase->Secondary);
     408         771 :     auto &TransferLoadList(state.dataRefrigCase->TransferLoadList);
     409         771 :     auto &WalkIn(state.dataRefrigCase->WalkIn);
     410         771 :     auto &WarehouseCoil(state.dataRefrigCase->WarehouseCoil);
     411         771 :     auto &AirChillerSet(state.dataRefrigCase->AirChillerSet);
     412         771 :     auto &CoilSysCredit(state.dataRefrigCase->CoilSysCredit);
     413         771 :     auto &CaseWIZoneReport(state.dataRefrigCase->CaseWIZoneReport);
     414             : 
     415         771 :     state.dataRefrigCase->NumSimulationCascadeCondensers =
     416        1542 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Refrigeration:Condenser:Cascade");
     417         771 :     state.dataRefrigCase->NumSimulationCases = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Refrigeration:Case");
     418         771 :     state.dataRefrigCase->NumSimulationCaseAndWalkInLists =
     419        1542 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Refrigeration:CaseAndWalkInList");
     420         771 :     state.dataRefrigCase->NumRefrigeratedRacks = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Refrigeration:CompressorRack");
     421         771 :     state.dataRefrigCase->NumSimulationSecondarySystems =
     422        1542 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Refrigeration:SecondarySystem");
     423         771 :     state.dataRefrigCase->NumSimulationTransferLoadLists =
     424        1542 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Refrigeration:TransferLoadList");
     425         771 :     state.dataRefrigCase->NumSimulationWalkIns = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Refrigeration:WalkIn");
     426         771 :     state.dataRefrigCase->NumRefrigSystems = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Refrigeration:System");
     427         771 :     state.dataRefrigCase->NumTransRefrigSystems =
     428        1542 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Refrigeration:TranscriticalSystem");
     429         771 :     state.dataRefrigCase->NumSimulationCondAir =
     430        1542 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Refrigeration:Condenser:AirCooled");
     431         771 :     state.dataRefrigCase->NumSimulationCondEvap =
     432        1542 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Refrigeration:Condenser:EvaporativeCooled");
     433         771 :     state.dataRefrigCase->NumSimulationCondWater =
     434        1542 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Refrigeration:Condenser:WaterCooled");
     435         771 :     state.dataRefrigCase->NumSimulationGasCooler =
     436        1542 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Refrigeration:GasCooler:AirCooled");
     437        2313 :     state.dataRefrigCase->NumRefrigCondensers = state.dataRefrigCase->NumSimulationCondAir + state.dataRefrigCase->NumSimulationCondEvap +
     438        1542 :                                                 state.dataRefrigCase->NumSimulationCondWater + state.dataRefrigCase->NumSimulationCascadeCondensers;
     439         771 :     state.dataRefrigCase->NumSimulationCompressors = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Refrigeration:Compressor");
     440         771 :     state.dataRefrigCase->NumSimulationSubcoolers = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Refrigeration:Subcooler");
     441         771 :     int NumCompressorLists = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Refrigeration:CompressorList");
     442         771 :     state.dataRefrigCase->NumRefrigChillerSets =
     443        1542 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "ZoneHVAC:RefrigerationChillerSet");
     444         771 :     state.dataRefrigCase->NumSimulationRefrigAirChillers =
     445        1542 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Refrigeration:AirChiller");
     446             : 
     447             :     // Set flags used later to avoid unnecessary steps.
     448         771 :     if (state.dataRefrigCase->NumRefrigeratedRacks == 0) state.dataRefrigCase->HaveRefrigRacks = false;
     449         771 :     if (state.dataRefrigCase->NumRefrigSystems == 0) state.dataRefrigCase->HaveDetailedRefrig = false;
     450         771 :     if (state.dataRefrigCase->NumTransRefrigSystems == 0) state.dataRefrigCase->HaveDetailedTransRefrig = false;
     451         771 :     if (state.dataRefrigCase->NumSimulationCases == 0 && state.dataRefrigCase->NumSimulationWalkIns == 0)
     452         736 :         state.dataRefrigCase->HaveCasesOrWalkins = false;
     453         771 :     if (state.dataRefrigCase->NumSimulationRefrigAirChillers == 0) state.dataRefrigCase->HaveChillers = false;
     454             : 
     455         771 :     if (state.dataRefrigCase->NumRefrigeratedRacks > 0) {
     456          30 :         RefrigRack.allocate(state.dataRefrigCase->NumRefrigeratedRacks);
     457          30 :         state.dataHeatBal->HeatReclaimRefrigeratedRack.allocate(state.dataRefrigCase->NumRefrigeratedRacks);
     458             :     }
     459         771 :     if (state.dataRefrigCase->NumRefrigSystems > 0) {
     460          14 :         System.allocate(state.dataRefrigCase->NumRefrigSystems);
     461          14 :         state.dataRefrigCase->ShowUnmetEnergyWarning.allocate(state.dataRefrigCase->NumRefrigSystems);
     462          14 :         state.dataRefrigCase->ShowHiStageUnmetEnergyWarning.allocate(state.dataRefrigCase->NumRefrigSystems);
     463          14 :         state.dataRefrigCase->ShowUnmetEnergyWarning = true;
     464          14 :         state.dataRefrigCase->ShowHiStageUnmetEnergyWarning = true;
     465             :     }
     466         771 :     if (state.dataRefrigCase->NumTransRefrigSystems > 0) {
     467           1 :         TransSystem.allocate(state.dataRefrigCase->NumTransRefrigSystems);
     468           1 :         state.dataRefrigCase->ShowUnmetEnergyWarningTrans.dimension(state.dataRefrigCase->NumTransRefrigSystems, true);
     469             :     }
     470         771 :     if (state.dataRefrigCase->NumRefrigChillerSets > 0) AirChillerSet.allocate(state.dataRefrigCase->NumRefrigChillerSets);
     471         771 :     if (state.dataRefrigCase->NumRefrigCondensers > 0) {
     472          14 :         state.dataHeatBal->HeatReclaimRefrigCondenser.allocate(state.dataRefrigCase->NumRefrigCondensers);
     473          14 :         Condenser.allocate(state.dataRefrigCase->NumRefrigCondensers);
     474          14 :         state.dataRefrigCase->UniqueCondenserNames.reserve(static_cast<unsigned>(state.dataRefrigCase->NumRefrigCondensers));
     475             :     }
     476         771 :     if (state.dataRefrigCase->NumSimulationGasCooler > 0) {
     477           1 :         GasCooler.allocate(state.dataRefrigCase->NumSimulationGasCooler);
     478             :     }
     479         771 :     if (state.dataRefrigCase->NumSimulationCases > 0) {
     480          35 :         CaseRAFraction.allocate(state.dataGlobal->NumOfZones);
     481          35 :         RefrigCase.allocate(state.dataRefrigCase->NumSimulationCases);
     482          35 :         state.dataRefrigCase->ShowStockingWarning.dimension(state.dataRefrigCase->NumSimulationCases, true);
     483             :     }
     484         771 :     if (state.dataRefrigCase->NumSimulationWalkIns > 0) {
     485          13 :         WalkIn.allocate(state.dataRefrigCase->NumSimulationWalkIns);
     486             :     }
     487         771 :     if ((state.dataRefrigCase->NumSimulationWalkIns > 0) || (state.dataRefrigCase->NumSimulationCases > 0)) {
     488          35 :         CaseWIZoneReport.allocate(state.dataGlobal->NumOfZones);
     489             :     } else {
     490         736 :         state.dataRefrigCase->UseSysTimeStep = true;
     491             :         // needed to avoid accessing unallocated caseWIZoneReport on early call to SumZones
     492             :     }
     493         771 :     if (state.dataRefrigCase->NumSimulationSecondarySystems > 0) {
     494           1 :         Secondary.allocate(state.dataRefrigCase->NumSimulationSecondarySystems);
     495           1 :         state.dataRefrigCase->ShowUnmetSecondEnergyWarning.dimension(state.dataRefrigCase->NumSimulationSecondarySystems, true);
     496             :     }
     497         771 :     if (state.dataRefrigCase->NumSimulationRefrigAirChillers > 0) {
     498           1 :         WarehouseCoil.allocate(state.dataRefrigCase->NumSimulationRefrigAirChillers);
     499           1 :         CoilSysCredit.allocate(state.dataGlobal->NumOfZones);
     500             :     }
     501         771 :     if (state.dataRefrigCase->NumSimulationCompressors > 0) Compressor.allocate(state.dataRefrigCase->NumSimulationCompressors);
     502         771 :     if (state.dataRefrigCase->NumSimulationSubcoolers > 0) Subcooler.allocate(state.dataRefrigCase->NumSimulationSubcoolers);
     503         771 :     if (state.dataRefrigCase->NumSimulationCaseAndWalkInLists > 0) CaseAndWalkInList.allocate(state.dataRefrigCase->NumSimulationCaseAndWalkInLists);
     504         771 :     if (NumCompressorLists > 0) CompressorLists.allocate(NumCompressorLists);
     505         771 :     if (state.dataRefrigCase->NumSimulationTransferLoadLists > 0) TransferLoadList.allocate(state.dataRefrigCase->NumSimulationTransferLoadLists);
     506             : 
     507         771 :     DayValues.allocate(state.dataGlobal->NumOfTimeStepInHour, 24);
     508         771 :     state.dataRefrigCase->RefrigPresentInZone.dimension(state.dataGlobal->NumOfZones, false);
     509             : 
     510         771 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, "Refrigeration:Case", MaxNumArgs, MaxNumAlphasCase, MaxNumNumbersCase);
     511        1542 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(
     512         771 :         state, "Refrigeration:CaseAndWalkInList", MaxNumArgs, MaxNumAlphasCaseAndWalkInList, MaxNumNumbersCaseAndWalkInList);
     513        1542 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(
     514         771 :         state, "Refrigeration:CompressorRack", MaxNumArgs, MaxNumAlphasRack, MaxNumNumbersRack);
     515         771 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, "Refrigeration:System", MaxNumArgs, MaxNumAlphasSys, MaxNumNumbersSys);
     516        1542 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(
     517         771 :         state, "Refrigeration:TranscriticalSystem", MaxNumArgs, MaxNumAlphasTransSys, MaxNumNumbersTransSys);
     518        1542 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(
     519         771 :         state, "Refrigeration:Condenser:AirCooled", MaxNumArgs, MaxNumAlphasConda, MaxNumNumbersConda);
     520        1542 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(
     521         771 :         state, "Refrigeration:Condenser:EvaporativeCooled", MaxNumArgs, MaxNumAlphasConde, MaxNumNumbersConde);
     522        1542 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(
     523         771 :         state, "Refrigeration:Condenser:WaterCooled", MaxNumArgs, MaxNumAlphasCondw, MaxNumNumbersCondw);
     524        1542 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(
     525         771 :         state, "Refrigeration:GasCooler:AirCooled", MaxNumArgs, MaxNumAlphasGasCoolera, MaxNumNumbersGasCoolera);
     526        1542 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(
     527         771 :         state, "Refrigeration:Compressor", MaxNumArgs, MaxNumAlphasComp, MaxNumNumbersComp);
     528        1542 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(
     529         771 :         state, "Refrigeration:CompressorList", MaxNumArgs, MaxNumAlphasCompressorList, MaxNumNumbersCompressorList);
     530        1542 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(
     531         771 :         state, "Refrigeration:WalkIn", MaxNumArgs, MaxNumAlphasWalkIn, MaxNumNumbersWalkIn);
     532        1542 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(
     533         771 :         state, "Refrigeration:SecondarySystem", MaxNumArgs, MaxNumAlphasSecond, MaxNumNumbersSecond);
     534        1542 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(
     535         771 :         state, "ZoneHVAC:RefrigerationChillerSet", MaxNumArgs, MaxNumAlphasChillerSet, MaxNumNumbersChillerSet);
     536        1542 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(
     537         771 :         state, "Refrigeration:AirChiller", MaxNumArgs, MaxNumAlphasAirChiller, MaxNumNumbersAirChiller);
     538             : 
     539         771 :     MaxNumAlphasAll = max(MaxNumAlphasCase,
     540             :                           MaxNumAlphasCaseAndWalkInList,
     541             :                           MaxNumAlphasRack,
     542             :                           MaxNumAlphasSys,
     543             :                           MaxNumAlphasTransSys,
     544             :                           MaxNumAlphasConda,
     545             :                           MaxNumAlphasConde,
     546             :                           MaxNumAlphasCondw,
     547             :                           MaxNumAlphasGasCoolera,
     548             :                           MaxNumAlphasComp,
     549             :                           MaxNumAlphasCompressorList,
     550             :                           MaxNumAlphasSecond,
     551             :                           MaxNumAlphasWalkIn,
     552             :                           MaxNumAlphasChillerSet,
     553             :                           MaxNumAlphasAirChiller);
     554         771 :     MaxNumNumbersAll = max(MaxNumNumbersCase,
     555             :                            MaxNumNumbersCaseAndWalkInList,
     556             :                            MaxNumNumbersRack,
     557             :                            MaxNumNumbersSys,
     558             :                            MaxNumNumbersTransSys,
     559             :                            MaxNumNumbersConda,
     560             :                            MaxNumNumbersConde,
     561             :                            MaxNumNumbersCondw,
     562             :                            MaxNumNumbersGasCoolera,
     563             :                            MaxNumNumbersComp,
     564             :                            MaxNumNumbersCompressorList,
     565             :                            MaxNumNumbersSecond,
     566             :                            MaxNumNumbersWalkIn,
     567             :                            MaxNumNumbersChillerSet,
     568             :                            MaxNumNumbersAirChiller);
     569             : 
     570         771 :     Alphas.allocate(MaxNumAlphasAll);
     571         771 :     Numbers.dimension(MaxNumNumbersAll, 0.0);
     572         771 :     cAlphaFieldNames.allocate(MaxNumAlphasAll);
     573         771 :     cNumericFieldNames.allocate(MaxNumNumbersAll);
     574         771 :     lAlphaBlanks.dimension(MaxNumAlphasAll, true);
     575         771 :     lNumericBlanks.dimension(MaxNumNumbersAll, true);
     576             :     // bbb stovall note for future - for all curve entries, see if need fail on type or if can allow table input
     577         771 :     if (state.dataRefrigCase->NumSimulationCases > 0) {
     578          35 :         CurrentModuleObject = "Refrigeration:Case";
     579         219 :         for (int CaseNum = 1; CaseNum <= state.dataRefrigCase->NumSimulationCases; ++CaseNum) {
     580         184 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
     581             :                                                                      CurrentModuleObject,
     582             :                                                                      CaseNum,
     583             :                                                                      Alphas,
     584             :                                                                      NumAlphas,
     585             :                                                                      Numbers,
     586             :                                                                      NumNumbers,
     587             :                                                                      IOStatus,
     588             :                                                                      lNumericBlanks,
     589             :                                                                      lAlphaBlanks,
     590             :                                                                      cAlphaFieldNames,
     591             :                                                                      cNumericFieldNames);
     592             : 
     593         184 :             ++NumDisplayCases;
     594             : 
     595         184 :             AlphaNum = 1;
     596         184 :             UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound);
     597         184 :             RefrigCase(CaseNum).Name = Alphas(AlphaNum);
     598             : 
     599         184 :             AlphaNum = 2;
     600         184 :             if (!lAlphaBlanks(AlphaNum)) {
     601         184 :                 RefrigCase(CaseNum).SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(AlphaNum)); // convert schedule name to pointer
     602         184 :                 if (RefrigCase(CaseNum).SchedPtr == 0) {
     603           0 :                     ShowSevereError(state,
     604           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", invalid  " +
     605           0 :                                         cAlphaFieldNames(AlphaNum) + " not found: " + Alphas(AlphaNum));
     606           0 :                     ErrorsFound = true;
     607             :                 }    // ptr == 0
     608             :             } else { // no schedule specified
     609           0 :                 RefrigCase(CaseNum).SchedPtr = AlwaysOn;
     610             :             } // not blank
     611             : 
     612             :             //   check availability schedule for values between 0 and 1
     613         184 :             if (RefrigCase(CaseNum).SchedPtr > 0) {
     614         184 :                 if (!ScheduleManager::CheckScheduleValueMinMax(state, RefrigCase(CaseNum).SchedPtr, ">=", 0.0, "<=", 1.0)) {
     615           0 :                     ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\"");
     616           0 :                     ShowContinueError(state, "Error found in " + cAlphaFieldNames(AlphaNum) + " = " + Alphas(AlphaNum));
     617           0 :                     ShowContinueError(state, "schedule values must be (>=0., <=1.)");
     618           0 :                     ErrorsFound = true;
     619             :                 }
     620             :             }
     621             : 
     622             :             // Get the Zone node number from the zone name entered by the user
     623         184 :             RefrigCase(CaseNum).ZoneName = Alphas(3);
     624         184 :             RefrigCase(CaseNum).ActualZoneNum = UtilityRoutines::FindItemInList(Alphas(3), state.dataHeatBal->Zone);
     625             : 
     626         184 :             if (RefrigCase(CaseNum).ActualZoneNum == 0) {
     627           0 :                 ShowSevereError(state,
     628           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", invalid  " +
     629           0 :                                     cAlphaFieldNames(3) + " not valid: " + Alphas(3));
     630           0 :                 ErrorsFound = true;
     631             :             } else {
     632         184 :                 state.dataRefrigCase->RefrigPresentInZone(RefrigCase(CaseNum).ActualZoneNum) = true;
     633             :             }
     634             : 
     635         184 :             RefrigCase(CaseNum).ZoneNodeNum = DataZoneEquipment::GetSystemNodeNumberForZone(state, RefrigCase(CaseNum).ActualZoneNum);
     636             : 
     637         184 :             RefrigCase(CaseNum).RatedAmbientTemp = Numbers(1);
     638         184 :             if (Numbers(1) <= 0.0) {
     639           0 :                 ShowSevereError(state,
     640           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", " + cNumericFieldNames(1) +
     641             :                                     " must be greater than 0 C");
     642           0 :                 ErrorsFound = true;
     643             :             }
     644             : 
     645         184 :             RefrigCase(CaseNum).RatedAmbientRH = Numbers(2);
     646         184 :             if (Numbers(2) <= 0.0 || Numbers(2) >= 100.0) {
     647           0 :                 ShowSevereError(state,
     648           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", " + cNumericFieldNames(2) +
     649             :                                     " must be greater than 0% and less than 100%");
     650           0 :                 ErrorsFound = true;
     651             :             }
     652         736 :             RefrigCase(CaseNum).RatedAmbientDewPoint = Psychrometrics::PsyTdpFnWPb(
     653             :                 state,
     654             :                 Psychrometrics::PsyWFnTdbRhPb(
     655         552 :                     state, RefrigCase(CaseNum).RatedAmbientTemp, (RefrigCase(CaseNum).RatedAmbientRH / 100.0), state.dataEnvrn->StdBaroPress),
     656         184 :                 state.dataEnvrn->StdBaroPress);
     657             : 
     658         184 :             RefrigCase(CaseNum).RateTotCapPerLength = Numbers(3);
     659         184 :             if (Numbers(3) <= 0.0) {
     660           0 :                 ShowSevereError(state,
     661           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", " + cNumericFieldNames(3) +
     662             :                                     " must be greater than 0 W/m");
     663           0 :                 ErrorsFound = true;
     664             :             }
     665             : 
     666         184 :             RefrigCase(CaseNum).RatedLHR = Numbers(4);
     667         184 :             if (Numbers(4) < 0.0 || Numbers(4) > 1.0) {
     668           0 :                 ShowSevereError(state,
     669           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", " + cNumericFieldNames(4) +
     670             :                                     " must be >= 0 and <= 1");
     671           0 :                 ErrorsFound = true;
     672             :             }
     673             : 
     674         184 :             RefrigCase(CaseNum).RatedRTF = Numbers(5);
     675         184 :             if (Numbers(5) <= 0.0 || Numbers(5) > 1.0) {
     676           0 :                 ShowSevereError(state,
     677           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", " + cNumericFieldNames(5) +
     678             :                                     " must be > 0 and <= to 1");
     679           0 :                 ErrorsFound = true;
     680             :             }
     681             : 
     682         184 :             RefrigCase(CaseNum).Length = Numbers(6);
     683         184 :             if (Numbers(6) <= 0.0) {
     684           0 :                 ShowSevereError(state,
     685           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", " + cNumericFieldNames(6) +
     686             :                                     " must be greater than 0 m");
     687           0 :                 ErrorsFound = true;
     688             :             }
     689             : 
     690         184 :             RefrigCase(CaseNum).Temperature = Numbers(7);
     691         184 :             if (RefrigCase(CaseNum).Temperature >= RefrigCase(CaseNum).RatedAmbientTemp) {
     692           0 :                 ShowSevereError(state,
     693           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", " + cNumericFieldNames(7) +
     694           0 :                                     " must be below " + cNumericFieldNames(1));
     695           0 :                 ErrorsFound = true;
     696             :             }
     697             : 
     698         184 :             if (UtilityRoutines::SameString(Alphas(4), "CaseTemperatureMethod")) {
     699         158 :                 RefrigCase(CaseNum).LatentEnergyCurveType = EnergyEqnForm::CaseTemperatureMethod;
     700          26 :             } else if (UtilityRoutines::SameString(Alphas(4), "RelativeHumidityMethod")) {
     701          18 :                 RefrigCase(CaseNum).LatentEnergyCurveType = EnergyEqnForm::RHCubic;
     702           8 :             } else if (UtilityRoutines::SameString(Alphas(4), "DewpointMethod")) {
     703           8 :                 RefrigCase(CaseNum).LatentEnergyCurveType = EnergyEqnForm::DPCubic;
     704             :             } else {
     705           0 :                 ShowSevereError(state,
     706           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", invalid  " +
     707           0 :                                     cAlphaFieldNames(4) + "=\"" + Alphas(4) + "\".");
     708           0 :                 ErrorsFound = true;
     709             :             }
     710             : 
     711         184 :             RefrigCase(CaseNum).LatCapCurvePtr = Curve::GetCurveIndex(state, Alphas(5)); // convert curve name to number
     712         184 :             if (RefrigCase(CaseNum).LatCapCurvePtr == 0) {
     713           0 :                 ShowSevereError(state,
     714           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", invalid  " +
     715           0 :                                     cAlphaFieldNames(5) + " not found:" + Alphas(5));
     716           0 :                 ErrorsFound = true;
     717             :             }
     718             : 
     719         552 :             ErrorsFound |= Curve::CheckCurveDims(state,
     720         184 :                                                  RefrigCase(CaseNum).LatCapCurvePtr, // Curve index
     721             :                                                  {1},                                // Valid dimensions
     722             :                                                  RoutineName,                        // Routine name
     723             :                                                  CurrentModuleObject,                // Object Type
     724         184 :                                                  RefrigCase(CaseNum).Name,           // Object Name
     725         184 :                                                  cAlphaFieldNames(5));               // Field Name
     726             : 
     727         184 :             NumNum = 8;
     728         184 :             if (!lNumericBlanks(NumNum)) {
     729         184 :                 RefrigCase(CaseNum).STDFanPower = Numbers(NumNum);
     730         184 :                 if (Numbers(NumNum) < 0.0) {
     731           0 :                     ShowSevereError(state,
     732           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", " +
     733           0 :                                         cNumericFieldNames(NumNum) + " must be greater than or equal to 0 W/m");
     734           0 :                     ErrorsFound = true;
     735             :                 }
     736             :             } else { // blank use default of 75 W/m
     737           0 :                 RefrigCase(CaseNum).STDFanPower = 75.0;
     738             :             } // blank input
     739             : 
     740         184 :             NumNum = 9;
     741         184 :             if (!lNumericBlanks(NumNum)) {
     742         184 :                 RefrigCase(CaseNum).OperatingFanPower = Numbers(NumNum);
     743         184 :                 if (Numbers(NumNum) < 0.0) {
     744           0 :                     ShowSevereError(state,
     745           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", " +
     746           0 :                                         cNumericFieldNames(NumNum) + " must be greater than or equal to 0 W/m");
     747           0 :                     ErrorsFound = true;
     748             :                 }
     749             :             } else { // if blank set = to std fan power
     750           0 :                 RefrigCase(CaseNum).OperatingFanPower = RefrigCase(CaseNum).STDFanPower;
     751             :             } // if blank
     752             : 
     753         184 :             NumNum = 10;
     754         184 :             if (!lNumericBlanks(NumNum)) {
     755         184 :                 RefrigCase(CaseNum).RatedLightingPower = Numbers(NumNum);
     756         184 :                 if (Numbers(NumNum) < 0.0) {
     757           0 :                     ShowSevereError(state,
     758           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", " +
     759           0 :                                         cNumericFieldNames(NumNum) + " must be greater than or equal to 0 W/m");
     760           0 :                     ErrorsFound = true;
     761             :                 }
     762             :             } else { // blank input - use default of 90 W/m
     763           0 :                 RefrigCase(CaseNum).RatedLightingPower = 90.0;
     764             :             } // blank input
     765             : 
     766         184 :             NumNum = 11;
     767         184 :             if (!lNumericBlanks(NumNum)) {
     768           8 :                 RefrigCase(CaseNum).LightingPower = Numbers(NumNum);
     769           8 :                 if (Numbers(NumNum) < 0.0) {
     770           0 :                     ShowSevereError(state,
     771           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", " +
     772           0 :                                         cNumericFieldNames(NumNum) + " must be greater than or equal to 0 W/m");
     773           0 :                     ErrorsFound = true;
     774             :                 }
     775             :             } else { // blank input so set lighting power equal to rated/std lighting power
     776         176 :                 RefrigCase(CaseNum).LightingPower = RefrigCase(CaseNum).RatedLightingPower;
     777             :             } // blank input
     778             : 
     779         184 :             if (!lAlphaBlanks(6)) {
     780         184 :                 RefrigCase(CaseNum).LightingSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(6)); // convert schedule name to pointer
     781         184 :                 if (RefrigCase(CaseNum).LightingSchedPtr == 0) {
     782           0 :                     ShowSevereError(state,
     783           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", invalid  " +
     784           0 :                                         cAlphaFieldNames(6) + " not found: " + Alphas(6));
     785           0 :                     ErrorsFound = true;
     786             :                 }    // ptr == 0
     787             :             } else { // no schedule specified
     788           0 :                 RefrigCase(CaseNum).LightingSchedPtr = AlwaysOn;
     789             :             } // not blank
     790             : 
     791             :             //   check lighting schedule for values between 0 and 1
     792         184 :             if (RefrigCase(CaseNum).LightingSchedPtr > 0) {
     793         184 :                 if (!ScheduleManager::CheckScheduleValueMinMax(state, RefrigCase(CaseNum).LightingSchedPtr, ">=", 0.0, "<=", 1.0)) {
     794           0 :                     ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\"");
     795           0 :                     ShowContinueError(state, "Error found in " + cAlphaFieldNames(6) + " = " + Alphas(6));
     796           0 :                     ShowContinueError(state, "schedule values must be (>=0., <=1.)");
     797           0 :                     ErrorsFound = true;
     798             :                 }
     799             :             }
     800             : 
     801         184 :             NumNum = 12;
     802         184 :             RefrigCase(CaseNum).LightingFractionToCase = 1.0; // default value
     803         184 :             if (!lNumericBlanks(NumNum)) {
     804         184 :                 RefrigCase(CaseNum).LightingFractionToCase = Numbers(NumNum);
     805             :             } // blank input lighting fraction to case
     806             :             //   check lighting fraction to case input
     807         184 :             if (RefrigCase(CaseNum).LightingFractionToCase < 0.0 || RefrigCase(CaseNum).LightingFractionToCase > 1.0) {
     808           0 :                 ShowSevereError(state,
     809           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", " +
     810           0 :                                     cNumericFieldNames(NumNum) + " has a value outside the valid range");
     811           0 :                 ShowContinueError(state, "  Minimum should be >= 0.0 and Maximum should be <= 1.0");
     812           0 :                 ErrorsFound = true;
     813             :             }
     814             : 
     815         184 :             NumNum = 13;
     816         184 :             RefrigCase(CaseNum).AntiSweatPower = Numbers(NumNum);
     817         184 :             if (Numbers(NumNum) < 0.0) {
     818           0 :                 ShowSevereError(state,
     819           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", " +
     820           0 :                                     cNumericFieldNames(NumNum) + " must be greater than or equal to 0 W/m");
     821           0 :                 ErrorsFound = true;
     822             :             }
     823             : 
     824         184 :             NumNum = 14;
     825         184 :             RefrigCase(CaseNum).MinimumASPower = Numbers(NumNum);
     826         184 :             if (Numbers(NumNum) < 0.0) {
     827           0 :                 ShowSevereError(state,
     828           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", " +
     829           0 :                                     cNumericFieldNames(NumNum) + " must be greater than or equal to 0 W/m");
     830           0 :                 ErrorsFound = true;
     831             :             }
     832             : 
     833         184 :             if (UtilityRoutines::SameString(Alphas(7), "None")) {
     834         105 :                 RefrigCase(CaseNum).AntiSweatControlType = ASHtrCtrlType::None;
     835         105 :                 RefrigCase(CaseNum).AntiSweatPower = 0.0;
     836          79 :             } else if (UtilityRoutines::SameString(Alphas(7), "Constant")) {
     837           0 :                 RefrigCase(CaseNum).AntiSweatControlType = ASHtrCtrlType::Constant;
     838          79 :             } else if (UtilityRoutines::SameString(Alphas(7), "Linear")) {
     839          38 :                 RefrigCase(CaseNum).AntiSweatControlType = ASHtrCtrlType::Linear;
     840          41 :             } else if (UtilityRoutines::SameString(Alphas(7), "DewpointMethod")) {
     841           0 :                 RefrigCase(CaseNum).AntiSweatControlType = ASHtrCtrlType::DewPoint;
     842          41 :             } else if (UtilityRoutines::SameString(Alphas(7), "HeatBalanceMethod")) {
     843          41 :                 RefrigCase(CaseNum).AntiSweatControlType = ASHtrCtrlType::HeatBalance;
     844             :             } else {
     845           0 :                 ShowSevereError(state,
     846           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", invalid  " +
     847           0 :                                     cAlphaFieldNames(7) + "=\"" + Alphas(7) + "\".");
     848           0 :                 ErrorsFound = true;
     849             :             }
     850             : 
     851             :             //   Assure that case temperature is below the rated dew point when anti-sweat heater control type is dew point method
     852         184 :             if (RefrigCase(CaseNum).Temperature >= RefrigCase(CaseNum).RatedAmbientDewPoint &&
     853           0 :                 RefrigCase(CaseNum).AntiSweatControlType == ASHtrCtrlType::DewPoint) {
     854           0 :                 ShowSevereError(state,
     855           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", " + cNumericFieldNames(7) +
     856           0 :                                     " must be below the Rated Ambient Dew Point when " + cAlphaFieldNames(7) + " is Dew Point Method");
     857           0 :                 ErrorsFound = true;
     858             :             }
     859             : 
     860         184 :             NumNum = 15;
     861             :             //  negative values for minimum humidity are allowed
     862         184 :             RefrigCase(CaseNum).HumAtZeroAS = Numbers(NumNum);
     863             : 
     864             :             //   check minimum humidity when linear AS control type is used
     865         184 :             if (RefrigCase(CaseNum).HumAtZeroAS >= RefrigCase(CaseNum).RatedAmbientRH &&
     866           0 :                 RefrigCase(CaseNum).AntiSweatControlType == ASHtrCtrlType::Linear) {
     867           0 :                 ShowSevereError(state,
     868           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", " +
     869           0 :                                     cNumericFieldNames(NumNum) + " must be less than " + cNumericFieldNames(2));
     870           0 :                 ShowContinueError(state, " for Linear " + cAlphaFieldNames(7) + '.');
     871           0 :                 ErrorsFound = true;
     872             :             }
     873             : 
     874         184 :             NumNum = 16;
     875         184 :             RefrigCase(CaseNum).Height = Numbers(NumNum);
     876         184 :             if (Numbers(NumNum) < 0.0) {
     877           0 :                 ShowSevereError(state,
     878           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", " +
     879           0 :                                     cNumericFieldNames(NumNum) + " must be greater than or equal to 0 m");
     880           0 :                 ErrorsFound = true;
     881             :             }
     882             : 
     883         184 :             if (RefrigCase(CaseNum).Height <= 0.0 && RefrigCase(CaseNum).AntiSweatControlType == ASHtrCtrlType::HeatBalance) {
     884           0 :                 ShowSevereError(state,
     885           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", " +
     886           0 :                                     cNumericFieldNames(NumNum) + " must be greater than 0 when " + cAlphaFieldNames(7) + " is Heat Balance Method.");
     887           0 :                 ShowContinueError(state, format("..given {} was: {:.3R}", cNumericFieldNames(NumNum), RefrigCase(CaseNum).Height));
     888           0 :                 ErrorsFound = true;
     889             :             }
     890             : 
     891             :             //   initialize case resistance for anti-sweat heater control type = Heat Balance Method
     892         184 :             if (RefrigCase(CaseNum).AntiSweatControlType == ASHtrCtrlType::HeatBalance) {
     893          41 :                 Real64 Rcase(0.0);      // Case thermal resistance used with anti-sweat heater control
     894          41 :                 Real64 RcaseDenom(0.0); // Denominator of case thermal resistance calculation for anti-sweat
     895             : 
     896          41 :                 if (RefrigCase(CaseNum).Height == 0.0) {
     897           0 :                     Rcase = 0.0;
     898             :                 } else {
     899          82 :                     RcaseDenom = ((RefrigCase(CaseNum).AntiSweatPower / RefrigCase(CaseNum).Height) -
     900          41 :                                   (RefrigCase(CaseNum).RatedAmbientDewPoint - RefrigCase(CaseNum).RatedAmbientTemp) / Rair);
     901          41 :                     Rcase = (RefrigCase(CaseNum).RatedAmbientDewPoint - RefrigCase(CaseNum).Temperature) / RcaseDenom;
     902             :                 }
     903          41 :                 RefrigCase(CaseNum).Rcase = max(0.0, Rcase);
     904          41 :                 if (RefrigCase(CaseNum).Rcase == 0.0) {
     905           0 :                     ShowWarningError(state,
     906           0 :                                      CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name +
     907             :                                          "\" A case thermal resistance of 0 was calculated for anti-sweat heater performance using the");
     908           0 :                     ShowContinueError(state,
     909           0 :                                       " Heat Balance Method control type. Anti-sweat heater performance cannot be calculated and " +
     910           0 :                                           cAlphaFieldNames(7) + " will be set to None and simulation continues.");
     911           0 :                     ShowContinueError(state, " See Engineering Documentation for anti-sweat heater control of refrigerated cases.");
     912             :                 }
     913             :             }
     914             : 
     915         184 :             NumNum = 17;
     916         184 :             RefrigCase(CaseNum).ASHeaterFractionToCase = Numbers(NumNum);
     917         184 :             if (Numbers(NumNum) < 0.0 || Numbers(NumNum) > 1.0) {
     918           0 :                 ShowSevereError(state,
     919           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", " +
     920           0 :                                     cNumericFieldNames(NumNum) + " must be >= 0 and <= 1");
     921           0 :                 ErrorsFound = true;
     922             :             }
     923             : 
     924         184 :             if (UtilityRoutines::SameString(Alphas(8), "None")) {
     925          34 :                 RefrigCase(CaseNum).defrostType = RefCaseDefrostType::None;
     926         150 :             } else if (UtilityRoutines::SameString(Alphas(8), "OffCycle")) {
     927          47 :                 RefrigCase(CaseNum).defrostType = RefCaseDefrostType::OffCycle;
     928         103 :             } else if ((UtilityRoutines::SameString(Alphas(8), "HotFluid")) || (UtilityRoutines::SameString(Alphas(8), "HotGas"))) {
     929          18 :                 RefrigCase(CaseNum).defrostType = RefCaseDefrostType::HotFluid;
     930         255 :             } else if ((UtilityRoutines::SameString(Alphas(8), "HotFluidWithTemperatureTermination")) ||
     931         170 :                        (UtilityRoutines::SameString(Alphas(8), "HotGasWithTemperatureTermination"))) {
     932          40 :                 RefrigCase(CaseNum).defrostType = RefCaseDefrostType::HotFluidTerm;
     933             :                 //   ELSEIF (UtilityRoutines::SameString(Alphas(8),'Hot-Fluid On Demand')) THEN
     934             :                 //     RefrigCase(CaseNum)%DefrostType = DefHotFluidOnDemand
     935          45 :             } else if (UtilityRoutines::SameString(Alphas(8), "Electric")) {
     936          27 :                 RefrigCase(CaseNum).defrostType = RefCaseDefrostType::Electric;
     937          18 :             } else if (UtilityRoutines::SameString(Alphas(8), "ElectricWithTemperatureTermination")) {
     938          18 :                 RefrigCase(CaseNum).defrostType = RefCaseDefrostType::ElectricTerm;
     939             :                 //   ELSEIF (UtilityRoutines::SameString(Alphas(8),'Electric On Demand')) THEN
     940             :                 //     RefrigCase(CaseNum)%DefrostType = DefElectricOnDemand
     941             :             } else {
     942           0 :                 ShowWarningError(state,
     943           0 :                                  CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", invalid  " + cAlphaFieldNames(8) + "=\"" + Alphas(8) +
     944             :                                      "\".");
     945           0 :                 ShowContinueError(state, "Simulation will default to " + cAlphaFieldNames(8) + "=\"None\" and continue.");
     946           0 :                 RefrigCase(CaseNum).defrostType = RefCaseDefrostType::None;
     947             :             }
     948             : 
     949         184 :             auto DefType = RefrigCase(CaseNum).defrostType;
     950         184 :             NumNum = 18;
     951         184 :             if (!lNumericBlanks(NumNum)) {
     952         184 :                 RefrigCase(CaseNum).DefrostPower = Numbers(NumNum);
     953         184 :                 if (Numbers(NumNum) < 0.0) {
     954           0 :                     ShowSevereError(state,
     955           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", " +
     956           0 :                                         cNumericFieldNames(NumNum) + " must be greater than or equal to 0 W/m");
     957           0 :                     ErrorsFound = true;
     958             :                 }
     959             :                 //   disregard defrost power for Off-Cycle or None defrost types
     960         184 :                 if ((DefType == RefCaseDefrostType::OffCycle || DefType == RefCaseDefrostType::None) && (RefrigCase(CaseNum).DefrostPower > 0.0)) {
     961           0 :                     RefrigCase(CaseNum).DefrostPower = 0.0;
     962           0 :                     ShowWarningError(state,
     963           0 :                                      CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", " + cNumericFieldNames(NumNum) + " for " +
     964           0 :                                          cAlphaFieldNames(8) + " None or Off-Cycle will be set to 0 and simulation continues.");
     965             :                 }
     966             :             } else {
     967           0 :                 RefrigCase(CaseNum).DefrostPower = 0.0;
     968             :             }
     969             : 
     970             :             // defrost power needed to calculate heat gain to case even if not needed for electric consumption
     971         350 :             if ((DefType == RefCaseDefrostType::HotFluid || DefType == RefCaseDefrostType::HotFluidTerm || DefType == RefCaseDefrostType::Electric ||
     972         287 :                  DefType == RefCaseDefrostType::ElectricTerm) &&
     973         103 :                 RefrigCase(CaseNum).DefrostPower <= 0.0) {
     974           0 :                 ShowSevereError(state,
     975           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", " +
     976           0 :                                     cNumericFieldNames(NumNum) + " must be greater than 0 W/m for " + cAlphaFieldNames(8) + ' ' + Alphas(8));
     977           0 :                 ErrorsFound = true;
     978             :             }
     979             : 
     980         184 :             RefrigCase(CaseNum).DefrostSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(9)); // convert schedule name to pointer
     981         184 :             if (RefrigCase(CaseNum).DefrostSchedPtr == 0 && RefrigCase(CaseNum).defrostType != RefCaseDefrostType::None) {
     982           0 :                 ShowSevereError(state,
     983           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", invalid  " +
     984           0 :                                     cAlphaFieldNames(9) + " not found: " + Alphas(9));
     985           0 :                 ShowContinueError(state, "required when " + cAlphaFieldNames(8) + "=\"" + Alphas(8) + "\".");
     986           0 :                 ErrorsFound = true;
     987             :             }
     988             : 
     989             :             //   check defrost schedule for values between 0 and 1
     990         184 :             if (RefrigCase(CaseNum).DefrostSchedPtr > 0) {
     991         152 :                 if (!ScheduleManager::CheckScheduleValueMinMax(state, RefrigCase(CaseNum).DefrostSchedPtr, ">=", 0.0, "<=", 1.0)) {
     992           0 :                     ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\".");
     993           0 :                     ShowContinueError(state, "Error found in " + cAlphaFieldNames(9) + " = " + Alphas(9));
     994           0 :                     ShowContinueError(state, "schedule values must be (>=0., <=1.)");
     995           0 :                     ErrorsFound = true;
     996             :                 }
     997             :             }
     998             :             //   Note that next section counting number cycles and setting maxkgfrost not used now, but may be in the future.
     999             :             //   count the number of defrost cycles
    1000             : 
    1001             :             // Flag for counting defrost cycles
    1002         184 :             bool StartCycle = false;
    1003         184 :             int NumDefCycles = 0;
    1004         184 :             DayValues = 0.0;
    1005         184 :             ScheduleManager::GetScheduleValuesForDay(state, RefrigCase(CaseNum).DefrostSchedPtr, DayValues, 1);
    1006        4600 :             for (int HRNum = 1; HRNum <= 24; ++HRNum) {
    1007       29184 :                 for (int TSNum = 1; TSNum <= state.dataGlobal->NumOfTimeStepInHour; ++TSNum) {
    1008       24768 :                     if (DayValues(TSNum, HRNum) > 0.0) {
    1009         574 :                         if (!StartCycle) {
    1010         288 :                             ++NumDefCycles;
    1011         288 :                             StartCycle = true;
    1012             :                         }
    1013             :                     } else {
    1014       24194 :                         StartCycle = false;
    1015             :                     }
    1016             :                 }
    1017             :             }
    1018             : 
    1019         184 :             if (NumDefCycles > 0) {
    1020             :                 //     calculate maximum frost formation based on defrost schedule, heat of vaporization+fusion for water = 2833.0 kJ/kg
    1021         432 :                 RefrigCase(CaseNum).MaxKgFrost = (RefrigCase(CaseNum).RateTotCapPerLength * RefrigCase(CaseNum).RatedLHR *
    1022         288 :                                                   RefrigCase(CaseNum).RatedRTF * SecondsPerHour * HoursPerDay / 1000.0 / 2833.0) /
    1023             :                                                  (NumDefCycles);
    1024             :             } else {
    1025          40 :                 RefrigCase(CaseNum).MaxKgFrost = 9999999.9;
    1026             :             }
    1027             : 
    1028             :             //   some defrost types do not use drip-down schedules, use same defrost schedule pointer in that case
    1029         184 :             if (!lAlphaBlanks(10)) {
    1030         152 :                 RefrigCase(CaseNum).DefrostDripDownSchedPtr =
    1031         152 :                     ScheduleManager::GetScheduleIndex(state, Alphas(10)); // convert schedule name to pointer
    1032         152 :                 if (RefrigCase(CaseNum).DefrostDripDownSchedPtr == 0) {
    1033           0 :                     ShowSevereError(state,
    1034           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", invalid  " +
    1035           0 :                                         cAlphaFieldNames(10) + " not found: " + Alphas(10));
    1036           0 :                     ErrorsFound = true;
    1037             :                 }
    1038             :             } else {
    1039          32 :                 RefrigCase(CaseNum).DefrostDripDownSchedPtr = RefrigCase(CaseNum).DefrostSchedPtr;
    1040             :             }
    1041             : 
    1042             :             //   check defrost drip-down schedule for values between 0 and 1
    1043         184 :             if (RefrigCase(CaseNum).DefrostDripDownSchedPtr > 0 && (!lAlphaBlanks(10))) {
    1044         152 :                 if (!ScheduleManager::CheckScheduleValueMinMax(state, RefrigCase(CaseNum).DefrostDripDownSchedPtr, ">=", 0.0, "<=", 1.0)) {
    1045           0 :                     ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\".");
    1046           0 :                     ShowContinueError(state, "Error found in " + cAlphaFieldNames(10) + " = " + Alphas(10));
    1047           0 :                     ShowContinueError(state, "schedule values must be (>=0., <=1.)");
    1048           0 :                     ErrorsFound = true;
    1049             :                 }
    1050             :             }
    1051             : 
    1052         184 :             if (UtilityRoutines::SameString(Alphas(11), "CaseTemperatureMethod")) {
    1053          58 :                 RefrigCase(CaseNum).DefrostEnergyCurveType = EnergyEqnForm::CaseTemperatureMethod;
    1054         126 :             } else if (UtilityRoutines::SameString(Alphas(11), "RelativeHumidityMethod")) {
    1055           0 :                 RefrigCase(CaseNum).DefrostEnergyCurveType = EnergyEqnForm::RHCubic;
    1056         126 :             } else if (UtilityRoutines::SameString(Alphas(11), "DewpointMethod")) {
    1057           0 :                 RefrigCase(CaseNum).DefrostEnergyCurveType = EnergyEqnForm::DPCubic;
    1058         126 :             } else if (UtilityRoutines::SameString(Alphas(11), "None")) {
    1059         126 :                 RefrigCase(CaseNum).DefrostEnergyCurveType = EnergyEqnForm::None;
    1060             :             } else {
    1061           0 :                 ShowSevereError(state,
    1062           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", invalid  " +
    1063           0 :                                     cAlphaFieldNames(11) + "=\"" + Alphas(11) + "\".");
    1064           0 :                 ErrorsFound = true;
    1065             :             }
    1066             : 
    1067         184 :             RefrigCase(CaseNum).DefCapCurvePtr = Curve::GetCurveIndex(state, Alphas(12)); // convert curve name to number
    1068         534 :             if ((RefrigCase(CaseNum).defrostType == RefCaseDefrostType::ElectricTerm ||
    1069         242 :                  RefrigCase(CaseNum).defrostType == RefCaseDefrostType::HotFluidTerm) &&
    1070          58 :                 (RefrigCase(CaseNum).DefCapCurvePtr == 0)) {
    1071           0 :                 ShowSevereError(state,
    1072           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", invalid  " +
    1073           0 :                                     cAlphaFieldNames(12) + " not found:" + Alphas(12));
    1074           0 :                 ErrorsFound = true;
    1075             :             }
    1076             : 
    1077         184 :             if (RefrigCase(CaseNum).DefCapCurvePtr > 0) {
    1078         174 :                 ErrorsFound |= Curve::CheckCurveDims(state,
    1079          58 :                                                      RefrigCase(CaseNum).DefCapCurvePtr, // Curve index
    1080             :                                                      {1},                                // Valid dimensions
    1081             :                                                      RoutineName,                        // Routine name
    1082             :                                                      CurrentModuleObject,                // Object Type
    1083          58 :                                                      RefrigCase(CaseNum).Name,           // Object Name
    1084          58 :                                                      cAlphaFieldNames(12));              // Field Name
    1085             :             }
    1086             : 
    1087             :             //  warn user if defrost energy curve is entered that it is only used for temperature termination types
    1088         184 :             if (RefrigCase(CaseNum).DefCapCurvePtr > 0) {
    1089          98 :                 if (RefrigCase(CaseNum).defrostType != RefCaseDefrostType::ElectricTerm &&
    1090          40 :                     RefrigCase(CaseNum).defrostType != RefCaseDefrostType::HotFluidTerm) {
    1091           0 :                     ShowWarningError(state,
    1092           0 :                                      CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", invalid  " + cAlphaFieldNames(12) +
    1093             :                                          " is only applicable to Defrost Temperature Termination types.");
    1094           0 :                     ShowContinueError(state, cAlphaFieldNames(12) + " will be disregarded and simulation continues.");
    1095             :                 }
    1096             :             }
    1097             : 
    1098         184 :             NumNum = 19;
    1099         184 :             RefrigCase(CaseNum).RAFrac = Numbers(NumNum);
    1100         184 :             if (Numbers(NumNum) < 0.0 || Numbers(NumNum) > 1.0) {
    1101           0 :                 ShowSevereError(state,
    1102           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", " +
    1103           0 :                                     cNumericFieldNames(NumNum) + " must be >= 0 or <= 1 ");
    1104           0 :                 ErrorsFound = true;
    1105             :             }
    1106             : 
    1107             :             // Set return air node number
    1108         184 :             RefrigCase(CaseNum).ZoneRANode = 0;
    1109         368 :             std::string retNodeName;
    1110         184 :             if (!lAlphaBlanks(15)) {
    1111           0 :                 retNodeName = Alphas(15);
    1112             :             }
    1113         184 :             if (RefrigCase(CaseNum).RAFrac > 0.0) {
    1114         244 :                 std::string callDescription = CurrentModuleObject + "=" + RefrigCase(CaseNum).Name;
    1115         122 :                 RefrigCase(CaseNum).ZoneRANode =
    1116         122 :                     DataZoneEquipment::GetReturnAirNodeForZone(state, RefrigCase(CaseNum).ActualZoneNum, retNodeName, callDescription);
    1117             :             }
    1118             : 
    1119         184 :             if (RefrigCase(CaseNum).ActualZoneNum >= 0) {
    1120         184 :                 if (RefrigCase(CaseNum).ZoneNodeNum == 0) {
    1121           0 :                     ShowSevereError(state,
    1122           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name +
    1123           0 :                                         "\", System Node Number not found for " + cAlphaFieldNames(3) + " = " + Alphas(3));
    1124           0 :                     ShowContinueError(state,
    1125             :                                       "..Refrigerated cases must reference a controlled Zone (appear in a ZoneHVAC:EquipmentConnections object).");
    1126           0 :                     ErrorsFound = true;
    1127             :                 }
    1128         184 :                 if ((RefrigCase(CaseNum).RAFrac > 0.0) && (RefrigCase(CaseNum).ZoneRANode == 0)) {
    1129           0 :                     ShowSevereError(state,
    1130           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name +
    1131           0 :                                         "\", Under Case HVAC Return Air Node number not found for " + cAlphaFieldNames(3) + " = " + Alphas(3));
    1132           0 :                     ShowContinueError(state,
    1133             :                                       "..Refrigerated cases must reference a controlled Zone (appear in a ZoneHVAC:EquipmentConnections object) "
    1134             :                                       "with at least one return air node.");
    1135           0 :                     ErrorsFound = true;
    1136             :                 }
    1137             :             }
    1138             : 
    1139             :             // set flag in Zone Data if RAFrac > 0
    1140         184 :             if (RefrigCase(CaseNum).RAFrac > 0.0) {
    1141         122 :                 state.dataHeatBal->Zone(RefrigCase(CaseNum).ActualZoneNum).RefrigCaseRA = true;
    1142             :             }
    1143             : 
    1144             :             //   Make sure RA node exists for display cases with under case HVAC returns
    1145         184 :             if (RefrigCase(CaseNum).ZoneRANode == 0 && RefrigCase(CaseNum).RAFrac > 0.0) {
    1146           0 :                 ShowSevereError(state,
    1147           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", " + cNumericFieldNames(19) +
    1148             :                                     " not applicable to zones without return air systems.");
    1149           0 :                 ErrorsFound = true;
    1150             :             }
    1151             : 
    1152         184 :             if (RefrigCase(CaseNum).ActualZoneNum != 0) {
    1153         184 :                 CaseRAFraction(RefrigCase(CaseNum).ActualZoneNum).TotalCaseRAFraction += RefrigCase(CaseNum).RAFrac;
    1154         184 :                 CaseRAFraction(RefrigCase(CaseNum).ActualZoneNum).ZoneName = RefrigCase(CaseNum).ZoneName;
    1155             :             }
    1156             : 
    1157         184 :             RefrigCase(CaseNum).StockingSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(13)); // convert schedule name to pointer
    1158         184 :             if (!lAlphaBlanks(13)) {
    1159         184 :                 if (RefrigCase(CaseNum).StockingSchedPtr == 0) {
    1160           0 :                     ShowSevereError(state,
    1161           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", invalid  " +
    1162           0 :                                         cAlphaFieldNames(13) + " not found: " + Alphas(13));
    1163           0 :                     ErrorsFound = true;
    1164             :                 }
    1165             :             } else {
    1166           0 :                 RefrigCase(CaseNum).StockingSchedPtr = 0;
    1167             :             }
    1168             : 
    1169             :             //   calculate sensible case load at design conditions
    1170             :             // Case sensible capacity used for error messages
    1171         184 :             Real64 DesignSensibleCap = RefrigCase(CaseNum).RateTotCapPerLength * (1.0 - RefrigCase(CaseNum).RatedLHR) * RefrigCase(CaseNum).RatedRTF *
    1172         184 :                                        RefrigCase(CaseNum).Length;
    1173             : 
    1174             :             //   calculate case heat gain = lights + fans + anti-sweat
    1175             :             Real64 CaseHeatGain =
    1176         368 :                 ((RefrigCase(CaseNum).RatedLightingPower * RefrigCase(CaseNum).LightingFractionToCase) +
    1177         368 :                  (RefrigCase(CaseNum).AntiSweatPower * RefrigCase(CaseNum).ASHeaterFractionToCase) + RefrigCase(CaseNum).STDFanPower) *
    1178         184 :                 RefrigCase(CaseNum).Length;
    1179             : 
    1180             :             //   sensible case credits are calculated as the difference between the design sensible capacity and the case heat gain
    1181         184 :             RefrigCase(CaseNum).DesignSensCaseCredit = DesignSensibleCap - CaseHeatGain;
    1182             : 
    1183             :             //   compare case loads to design capacity
    1184         184 :             if (DesignSensibleCap < CaseHeatGain) {
    1185           0 :                 ShowSevereError(state,
    1186           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name +
    1187             :                                     "\", the sum of lighting, fan, and anti-sweat heater energy is greater than refrigerated case sensible capacity");
    1188           0 :                 ErrorsFound = true;
    1189             :             }
    1190             : 
    1191         184 :             RefrigCase(CaseNum).CaseCreditFracSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(14)); // convert schedule name to pointer
    1192         184 :             if (!lAlphaBlanks(14)) {
    1193         115 :                 if (RefrigCase(CaseNum).CaseCreditFracSchedPtr == 0) {
    1194           0 :                     ShowSevereError(state,
    1195           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\", invalid  " +
    1196           0 :                                         cAlphaFieldNames(14) + " not found: " + Alphas(14));
    1197           0 :                     ErrorsFound = true;
    1198             :                 }
    1199             :             } else {
    1200          69 :                 RefrigCase(CaseNum).CaseCreditFracSchedPtr = 0;
    1201             :             }
    1202             : 
    1203             :             //   check case credit fraction schedule for values between 0 and 1
    1204         184 :             if (RefrigCase(CaseNum).CaseCreditFracSchedPtr > 0) {
    1205         115 :                 if (!ScheduleManager::CheckScheduleValueMinMax(state, RefrigCase(CaseNum).CaseCreditFracSchedPtr, ">=", 0.0, "<=", 1.0)) {
    1206           0 :                     ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\".");
    1207           0 :                     ShowContinueError(state, "Error found in " + cAlphaFieldNames(14) + " = " + Alphas(14));
    1208           0 :                     ShowContinueError(state, "schedule values must be (>=0., <=1.)");
    1209           0 :                     ErrorsFound = true;
    1210             :                 }
    1211             :             }
    1212             : 
    1213         184 :             RefrigCase(CaseNum).DesignRatedCap = RefrigCase(CaseNum).RateTotCapPerLength * RefrigCase(CaseNum).Length;
    1214         184 :             RefrigCase(CaseNum).DesignLatentCap = RefrigCase(CaseNum).DesignRatedCap * RefrigCase(CaseNum).RatedLHR * RefrigCase(CaseNum).RatedRTF;
    1215         184 :             RefrigCase(CaseNum).DesignDefrostCap = RefrigCase(CaseNum).DefrostPower * RefrigCase(CaseNum).Length;
    1216         184 :             RefrigCase(CaseNum).DesignLighting = RefrigCase(CaseNum).LightingPower * RefrigCase(CaseNum).Length;
    1217         184 :             RefrigCase(CaseNum).DesignFanPower = RefrigCase(CaseNum).OperatingFanPower * RefrigCase(CaseNum).Length;
    1218             : 
    1219             :             // Design evaporating temperature:  for a DX system, saturated temperature for pressure leaving case
    1220             :             //                              :  for a liquid system, liquid temperature entering case
    1221         184 :             NumNum = 20;
    1222         184 :             if (!lNumericBlanks(NumNum)) {
    1223          85 :                 RefrigCase(CaseNum).EvapTempDesign = Numbers(NumNum);
    1224          85 :                 if (RefrigCase(CaseNum).EvapTempDesign >= RefrigCase(CaseNum).Temperature) {
    1225           0 :                     ShowSevereError(state,
    1226           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\" " +
    1227           0 :                                         cNumericFieldNames(NumNum) + " must be below " + cNumericFieldNames(7));
    1228           0 :                     ErrorsFound = true;
    1229             :                 }
    1230             :             } else {
    1231          99 :                 RefrigCase(CaseNum).EvapTempDesign = RefrigCase(CaseNum).Temperature - DelEvapTDefault;
    1232             :                 //    default 5C less than case operating temperature
    1233             :             }
    1234             : 
    1235         184 :             NumNum = 21;
    1236         184 :             if (!lNumericBlanks(NumNum)) {
    1237           8 :                 RefrigCase(CaseNum).RefrigInventory = Numbers(NumNum);
    1238           8 :                 RefrigCase(CaseNum).DesignRefrigInventory = RefrigCase(CaseNum).RefrigInventory * RefrigCase(CaseNum).Length;
    1239           8 :                 if (RefrigCase(CaseNum).RefrigInventory < 0.0) {
    1240           0 :                     ShowSevereError(state,
    1241           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigCase(CaseNum).Name + "\" " +
    1242           0 :                                         cNumericFieldNames(NumNum) + " must be a positive number.");
    1243           0 :                     ErrorsFound = true;
    1244             :                 }
    1245             :             } else {
    1246         176 :                 RefrigCase(CaseNum).RefrigInventory = 0.0;
    1247             :             }
    1248             : 
    1249             :         } // Individual refrigerated cases
    1250             :     }     //(NumSimulationCases > 0 )
    1251             : 
    1252             :     //************ START WALK IN COOLER INPUT **************
    1253             : 
    1254         771 :     if (state.dataRefrigCase->NumSimulationWalkIns > 0) {
    1255          13 :         CurrentModuleObject = "Refrigeration:WalkIn";
    1256          28 :         for (int WalkInID = 1; WalkInID <= state.dataRefrigCase->NumSimulationWalkIns; ++WalkInID) {
    1257          15 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
    1258             :                                                                      CurrentModuleObject,
    1259             :                                                                      WalkInID,
    1260             :                                                                      Alphas,
    1261             :                                                                      NumAlphas,
    1262             :                                                                      Numbers,
    1263             :                                                                      NumNumbers,
    1264             :                                                                      IOStatus,
    1265             :                                                                      lNumericBlanks,
    1266             :                                                                      lAlphaBlanks,
    1267             :                                                                      cAlphaFieldNames,
    1268             :                                                                      cNumericFieldNames);
    1269          15 :             UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound);
    1270             : 
    1271          15 :             WalkIn(WalkInID).Name = Alphas(1);
    1272             : 
    1273          15 :             if (!lAlphaBlanks(2)) {
    1274          15 :                 WalkIn(WalkInID).SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer
    1275          15 :                 if (WalkIn(WalkInID).SchedPtr == 0) {
    1276           0 :                     ShowSevereError(state,
    1277           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + WalkIn(WalkInID).Name + "\", invalid  " +
    1278           0 :                                         cAlphaFieldNames(2) + " not found: " + Alphas(2));
    1279           0 :                     ErrorsFound = true;
    1280             :                 }    // ptr == 0
    1281             :             } else { // no schedule specified
    1282           0 :                 WalkIn(WalkInID).SchedPtr = AlwaysOn;
    1283             :             } // not blank
    1284             : 
    1285             :             //   check availability schedule for values between 0 and 1
    1286          15 :             if (WalkIn(WalkInID).SchedPtr > 0) {
    1287          15 :                 if (!ScheduleManager::CheckScheduleValueMinMax(state, WalkIn(WalkInID).SchedPtr, ">=", 0.0, "<=", 1.0)) {
    1288           0 :                     ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + WalkIn(WalkInID).Name + "\"");
    1289           0 :                     ShowContinueError(state, "Error found in " + cAlphaFieldNames(2) + " = " + Alphas(2));
    1290           0 :                     ShowContinueError(state, "schedule values must be (>=0., <=1.)");
    1291           0 :                     ErrorsFound = true;
    1292             :                 }
    1293             :             }
    1294             : 
    1295          15 :             WalkIn(WalkInID).DesignRatedCap = Numbers(1);
    1296          15 :             if (Numbers(1) <= 0.0) {
    1297           0 :                 ShowSevereError(state,
    1298           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + WalkIn(WalkInID).Name + "\", " + cNumericFieldNames(1) +
    1299             :                                     " must be greater than 0 W");
    1300           0 :                 ErrorsFound = true;
    1301             :             }
    1302             : 
    1303          15 :             if (!lNumericBlanks(2)) {
    1304          15 :                 WalkIn(WalkInID).Temperature = Numbers(2);
    1305             :             } else {
    1306           0 :                 ShowSevereError(state,
    1307           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + WalkIn(WalkInID).Name + "\", " + cNumericFieldNames(2) +
    1308             :                                     " must be input ");
    1309           0 :                 ErrorsFound = true;
    1310             :             }
    1311             : 
    1312          15 :             if (!lNumericBlanks(3)) {
    1313          15 :                 WalkIn(WalkInID).TEvapDesign = Numbers(3);
    1314             :             } else {
    1315           0 :                 ShowSevereError(state,
    1316           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + WalkIn(WalkInID).Name + "\", " + cNumericFieldNames(3) +
    1317             :                                     " must be input");
    1318           0 :                 ErrorsFound = true;
    1319             :             }
    1320             : 
    1321          15 :             if (!lNumericBlanks(4)) {
    1322          15 :                 WalkIn(WalkInID).HeaterPower = Numbers(4);
    1323             :             } else {
    1324           0 :                 ShowSevereError(state,
    1325           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + WalkIn(WalkInID).Name + "\", " + cNumericFieldNames(4) +
    1326             :                                     " must be input ");
    1327           0 :                 ErrorsFound = true;
    1328             :             }
    1329             : 
    1330          15 :             AlphaNum = 3;
    1331          15 :             if (!lAlphaBlanks(AlphaNum)) {
    1332          15 :                 WalkIn(WalkInID).HeaterSchedPtr =
    1333          15 :                     ScheduleManager::GetScheduleIndex(state, Alphas(AlphaNum)); // convert heater schedule name to pointer
    1334          15 :                 if (WalkIn(WalkInID).HeaterSchedPtr == 0) {
    1335           0 :                     ShowSevereError(state,
    1336           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + WalkIn(WalkInID).Name + "\", invalid  " +
    1337           0 :                                         cAlphaFieldNames(AlphaNum) + " not found: " + Alphas(AlphaNum));
    1338           0 :                     ErrorsFound = true;
    1339             :                 }    // ptr == 0
    1340             :             } else { // no schedule specified
    1341           0 :                 WalkIn(WalkInID).HeaterSchedPtr = AlwaysOn;
    1342             :             } // not blank
    1343             : 
    1344             :             //   check heater schedule for values between 0 and 1
    1345          15 :             if (WalkIn(WalkInID).HeaterSchedPtr > 0) {
    1346          15 :                 if (!ScheduleManager::CheckScheduleValueMinMax(state, WalkIn(WalkInID).HeaterSchedPtr, ">=", 0.0, "<=", 1.0)) {
    1347           0 :                     ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + WalkIn(WalkInID).Name + "\"");
    1348           0 :                     ShowContinueError(state, "Error found in " + cAlphaFieldNames(AlphaNum) + " = " + Alphas(AlphaNum));
    1349           0 :                     ShowContinueError(state, "schedule values must be (>=0., <=1.)");
    1350           0 :                     ErrorsFound = true;
    1351             :                 }
    1352             :             }
    1353             : 
    1354          15 :             if (!lNumericBlanks(5) && Numbers(5) > 0.0) {
    1355          15 :                 WalkIn(WalkInID).CoilFanPower = Numbers(5);
    1356             :             } else {
    1357           0 :                 ShowWarningError(state,
    1358           0 :                                  std::string{RoutineName} + CurrentModuleObject + "=\"" + WalkIn(WalkInID).Name + "\", " + cNumericFieldNames(5) +
    1359             :                                      " was not input or was less than 0 and default of 375.0 W will be used ");
    1360           0 :                 WalkIn(WalkInID).CoilFanPower = 375.0; // default value = 1/2 hp
    1361             :             }
    1362             : 
    1363          15 :             if (lNumericBlanks(6)) {
    1364           0 :                 WalkIn(WalkInID).CircFanPower = 0.0;
    1365             :             } else {
    1366          15 :                 WalkIn(WalkInID).CircFanPower = Numbers(6);
    1367          15 :                 if (Numbers(7) < 0.0) {
    1368           0 :                     ShowSevereError(state,
    1369           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + WalkIn(WalkInID).Name + "\", " + cNumericFieldNames(6) +
    1370             :                                         " must be greater than >= 0 W");
    1371           0 :                     ErrorsFound = true;
    1372             :                 }
    1373             :             }
    1374             : 
    1375          15 :             if (!lNumericBlanks(7)) {
    1376          15 :                 WalkIn(WalkInID).DesignLighting = Numbers(7);
    1377             :             } else {
    1378           0 :                 ShowSevereError(state,
    1379           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + WalkIn(WalkInID).Name + "\" " + cNumericFieldNames(7) +
    1380             :                                     " must be input ");
    1381           0 :                 ErrorsFound = true;
    1382             :             }
    1383             : 
    1384          15 :             AlphaNum = 4;
    1385          15 :             if (!lAlphaBlanks(AlphaNum)) {
    1386          15 :                 WalkIn(WalkInID).LightingSchedPtr =
    1387          15 :                     ScheduleManager::GetScheduleIndex(state, Alphas(AlphaNum)); // convert lighting schedule name to pointer
    1388          15 :                 if (WalkIn(WalkInID).LightingSchedPtr == 0) {
    1389           0 :                     ShowSevereError(state,
    1390           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + WalkIn(WalkInID).Name + "\", invalid  " +
    1391           0 :                                         cAlphaFieldNames(AlphaNum) + " not found: " + Alphas(AlphaNum));
    1392           0 :                     ErrorsFound = true;
    1393             :                 }    // ptr == 0
    1394             :             } else { // no schedule specified
    1395           0 :                 WalkIn(WalkInID).LightingSchedPtr = AlwaysOn;
    1396             :             } // schedule name not blank
    1397             :             //   check Lighting schedule for values between 0 and 1
    1398          15 :             if (WalkIn(WalkInID).LightingSchedPtr > 0) {
    1399          15 :                 if (!ScheduleManager::CheckScheduleValueMinMax(state, WalkIn(WalkInID).LightingSchedPtr, ">=", 0.0, "<=", 1.0)) {
    1400           0 :                     ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + WalkIn(WalkInID).Name + "\"");
    1401           0 :                     ShowContinueError(state, "Error found in " + cAlphaFieldNames(AlphaNum) + " = " + Alphas(AlphaNum));
    1402           0 :                     ShowContinueError(state, "schedule values must be (>=0., <=1.)");
    1403           0 :                     ErrorsFound = true;
    1404             :                 }
    1405             :             }
    1406             : 
    1407             :             // Input walk-in cooler defrost information
    1408          15 :             AlphaNum = 5;
    1409          15 :             if (lAlphaBlanks(AlphaNum) || UtilityRoutines::SameString(Alphas(AlphaNum), "Electric")) {
    1410          13 :                 WalkIn(WalkInID).defrostType = WalkinClrDefrostType::Elec;
    1411           2 :             } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "HotFluid")) {
    1412           2 :                 WalkIn(WalkInID).defrostType = WalkinClrDefrostType::Fluid;
    1413           0 :             } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "None")) {
    1414           0 :                 WalkIn(WalkInID).defrostType = WalkinClrDefrostType::None;
    1415           0 :             } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "OffCycle")) {
    1416           0 :                 WalkIn(WalkInID).defrostType = WalkinClrDefrostType::OffCycle;
    1417             :             } else {
    1418           0 :                 ShowSevereError(state,
    1419           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + WalkIn(WalkInID).Name + "\", invalid  " +
    1420           0 :                                     cAlphaFieldNames(AlphaNum) + "=\"" + Alphas(AlphaNum) + "\".");
    1421           0 :                 ErrorsFound = true;
    1422             :             }
    1423             : 
    1424          15 :             AlphaNum = 6;
    1425          15 :             if (lAlphaBlanks(AlphaNum) || UtilityRoutines::SameString(Alphas(AlphaNum), "TimeSchedule")) {
    1426          11 :                 WalkIn(WalkInID).DefrostControlType = DefrostCtrlType::Sched;
    1427           4 :             } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "TemperatureTermination")) {
    1428           4 :                 WalkIn(WalkInID).DefrostControlType = DefrostCtrlType::TempTerm;
    1429             :             } else {
    1430           0 :                 ShowSevereError(state,
    1431           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + WalkIn(WalkInID).Name + "\", invalid  " +
    1432           0 :                                     cAlphaFieldNames(AlphaNum) + " not found: " + Alphas(AlphaNum));
    1433           0 :                 ErrorsFound = true;
    1434             :             } // defrost control type
    1435             : 
    1436             :             // convert defrost schedule name to pointer
    1437          15 :             AlphaNum = 7;
    1438          15 :             WalkIn(WalkInID).DefrostSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(AlphaNum));
    1439          15 :             if (WalkIn(WalkInID).DefrostSchedPtr == 0) {
    1440           0 :                 ShowSevereError(state,
    1441           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + WalkIn(WalkInID).Name + "\", invalid  " +
    1442           0 :                                     cAlphaFieldNames(AlphaNum) + " not found: " + Alphas(AlphaNum));
    1443           0 :                 ErrorsFound = true;
    1444             :             }
    1445             :             //   check defrost schedule for values between 0 and 1
    1446          15 :             if (WalkIn(WalkInID).DefrostSchedPtr > 0) {
    1447          15 :                 if (!ScheduleManager::CheckScheduleValueMinMax(state, WalkIn(WalkInID).DefrostSchedPtr, ">=", 0.0, "<=", 1.0)) {
    1448           0 :                     ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + " = \"" + WalkIn(WalkInID).Name + "\"");
    1449           0 :                     ShowContinueError(state, "Error found in " + cAlphaFieldNames(AlphaNum) + '=' + Alphas(AlphaNum));
    1450           0 :                     ShowContinueError(state, "schedule values must be (>=0., <=1.)");
    1451           0 :                     ErrorsFound = true;
    1452             :                 }
    1453             :             }
    1454             : 
    1455             :             // convert defrost drip-down schedule name to pointer
    1456             :             // some defrost types do not use drip-down schedules, use same defrost schedule pointer in that case
    1457          15 :             AlphaNum = 8;
    1458          15 :             if (!lAlphaBlanks(AlphaNum)) {
    1459          14 :                 WalkIn(WalkInID).DefrostDripDownSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(AlphaNum));
    1460          14 :                 if (WalkIn(WalkInID).DefrostDripDownSchedPtr == 0) {
    1461           0 :                     ShowSevereError(state,
    1462           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + WalkIn(WalkInID).Name + "\", invalid  " +
    1463           0 :                                         cAlphaFieldNames(AlphaNum) + " not found: " + Alphas(AlphaNum));
    1464           0 :                     ErrorsFound = true;
    1465             :                 }
    1466             :                 // check schedule for values between 0 and 1
    1467          14 :                 if (WalkIn(WalkInID).DefrostDripDownSchedPtr > 0) {
    1468          14 :                     if (!ScheduleManager::CheckScheduleValueMinMax(state, WalkIn(WalkInID).DefrostDripDownSchedPtr, ">=", 0.0, "<=", 1.0)) {
    1469           0 :                         ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + WalkIn(WalkInID).Name + "\"");
    1470           0 :                         ShowContinueError(state, "Error found in " + cAlphaFieldNames(AlphaNum) + " = " + Alphas(AlphaNum));
    1471           0 :                         ShowContinueError(state, "schedule values must be (>=0., <=1.)");
    1472           0 :                         ErrorsFound = true;
    1473             :                     }
    1474             :                 }
    1475             :             } else { // blank input so use drip down schedule for defrost
    1476           1 :                 WalkIn(WalkInID).DefrostDripDownSchedPtr = WalkIn(WalkInID).DefrostSchedPtr;
    1477             :             }
    1478             : 
    1479          15 :             if (WalkIn(WalkInID).defrostType == WalkinClrDefrostType::OffCycle || WalkIn(WalkInID).defrostType == WalkinClrDefrostType::None) {
    1480           0 :                 WalkIn(WalkInID).DefrostCapacity = 0.0;
    1481             :                 // Don't even need to read N8 or N9 for those two defrost types.
    1482             :             } else { // have electric or hot gas/brine defrost
    1483          15 :                 if ((lNumericBlanks(8)) || (Numbers(8) <= 0.0)) {
    1484           0 :                     ShowSevereError(state,
    1485           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + WalkIn(WalkInID).Name + "\", " + cNumericFieldNames(8) +
    1486           0 :                                         " must be input and greater than or equal to 0 W for " + cAlphaFieldNames(5) + ' ' + Alphas(5));
    1487           0 :                     ErrorsFound = true;
    1488             :                 } else {
    1489          15 :                     WalkIn(WalkInID).DefrostCapacity = Numbers(8);
    1490             :                 } // Blank  or negative N8
    1491             : 
    1492             :                 // defaults for defrost energy fraction are 0.7 for elec defrost and 0.3 for warm fluid
    1493             :                 // note this value is only used for temperature terminated defrost control type
    1494          15 :                 if (WalkIn(WalkInID).defrostType == WalkinClrDefrostType::Elec) WalkIn(WalkInID).DefEnergyFraction = 0.7;
    1495          15 :                 if (WalkIn(WalkInID).defrostType == WalkinClrDefrostType::Fluid) WalkIn(WalkInID).DefEnergyFraction = 0.3;
    1496          15 :                 if (!lNumericBlanks(9)) {
    1497           4 :                     if ((Numbers(9) > 1.0) || (Numbers(9) < 0.0)) {
    1498           0 :                         ShowWarningError(state,
    1499           0 :                                          std::string{RoutineName} + CurrentModuleObject + "=\"" + WalkIn(WalkInID).Name + "\", " +
    1500           0 :                                              cNumericFieldNames(9) + " must be between 0 and 1, default values will be used.");
    1501             :                     } else {
    1502           4 :                         WalkIn(WalkInID).DefEnergyFraction = Numbers(9);
    1503             :                     } // number out of range
    1504             :                 }     // lnumericblanks
    1505             :             }         // defrost type
    1506             : 
    1507             :             // convert restocking schedule name to pointer, default of 0.1 is assigned inside walkin subroutine if blank
    1508          15 :             AlphaNum = 9;
    1509          15 :             if (lAlphaBlanks(AlphaNum)) {
    1510           0 :                 WalkIn(WalkInID).StockingSchedPtr = 0;
    1511             :             } else {
    1512          15 :                 WalkIn(WalkInID).StockingSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(AlphaNum));
    1513          15 :                 if (WalkIn(WalkInID).StockingSchedPtr == 0) {
    1514           0 :                     ShowSevereError(state,
    1515           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + WalkIn(WalkInID).Name + "\", invalid  " +
    1516           0 :                                         cAlphaFieldNames(AlphaNum) + " not found: " + Alphas(AlphaNum));
    1517           0 :                     ErrorsFound = true;
    1518             :                 }
    1519             :             } // blank
    1520             : 
    1521          15 :             WalkIn(WalkInID).DesignRefrigInventory = 0.0;
    1522          15 :             if (!lNumericBlanks(10)) WalkIn(WalkInID).DesignRefrigInventory = Numbers(10);
    1523             : 
    1524          15 :             if (!lNumericBlanks(11)) {
    1525          15 :                 WalkIn(WalkInID).FloorArea = Numbers(11);
    1526             :             } else {
    1527           0 :                 ShowSevereError(state,
    1528           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + WalkIn(WalkInID).Name + "\", " + cNumericFieldNames(11) +
    1529             :                                     " must be input");
    1530           0 :                 ErrorsFound = true;
    1531             :             }
    1532             : 
    1533          15 :             if (lNumericBlanks(12)) {
    1534           0 :                 WalkIn(WalkInID).FloorUValue = DefaultWISurfaceUValue;
    1535             :             } else {
    1536          15 :                 WalkIn(WalkInID).FloorUValue = Numbers(12);
    1537          15 :                 if (Numbers(12) <= 0.0) {
    1538           0 :                     ShowSevereError(state,
    1539           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + WalkIn(WalkInID).Name + "\", " + cNumericFieldNames(12) +
    1540             :                                         " must be > 0.");
    1541           0 :                     ErrorsFound = true;
    1542             :                 }
    1543             :             }
    1544             : 
    1545             :             // Calculate the number of zones exposed to walk-in based on number of input fields, all integer math,
    1546             :             // This approach used because last zone could have less than NumWIFieldsPerZone due to optional values
    1547          15 :             int NumWIFieldsPerZone = NumWIAlphaFieldsPerZone + NumWINumberFieldsPerZone;
    1548          15 :             int NumWIFieldsTotal = NumNumbers + NumAlphas - NumWIAlphaFieldsBeforeZoneInput - NumWINumberFieldsBeforeZoneInput;
    1549          15 :             int NumZones = 1;
    1550          15 :             if (NumWIFieldsTotal > NumWIFieldsPerZone) NumZones = 2;
    1551          15 :             if (NumWIFieldsTotal > (2 * NumWIFieldsPerZone)) NumZones = 3;
    1552          15 :             if (NumWIFieldsTotal > (3 * NumWIFieldsPerZone)) NumZones = 4;
    1553          15 :             if (NumWIFieldsTotal > (4 * NumWIFieldsPerZone)) NumZones = 5;
    1554          15 :             if (NumWIFieldsTotal > (5 * NumWIFieldsPerZone)) NumZones = 6;
    1555          15 :             WalkIn(WalkInID).NumZones = NumZones;
    1556             : 
    1557             :             // All variables for walk-in/zone interactions need to be allocated after know number of zones
    1558             :             // Autodesk Missing initialization added below: At least SensZoneCreditRate was used uninitialized
    1559          15 :             if (!allocated(WalkIn(WalkInID).ZoneName)) WalkIn(WalkInID).ZoneName.allocate(NumZones);
    1560          15 :             if (!allocated(WalkIn(WalkInID).ZoneNum)) WalkIn(WalkInID).ZoneNum.allocate(NumZones) = 0;
    1561          15 :             if (!allocated(WalkIn(WalkInID).ZoneNodeNum)) WalkIn(WalkInID).ZoneNodeNum.allocate(NumZones) = 0;
    1562          15 :             if (!allocated(WalkIn(WalkInID).SurfaceArea)) WalkIn(WalkInID).SurfaceArea.allocate(NumZones) = 0.0;
    1563          15 :             if (!allocated(WalkIn(WalkInID).UValue)) WalkIn(WalkInID).UValue.allocate(NumZones) = 0.0;
    1564          15 :             if (!allocated(WalkIn(WalkInID).UValueGlassDr)) WalkIn(WalkInID).UValueGlassDr.allocate(NumZones) = 0.0;
    1565          15 :             if (!allocated(WalkIn(WalkInID).GlassDoorOpenSchedPtr)) WalkIn(WalkInID).GlassDoorOpenSchedPtr.allocate(NumZones) = 0;
    1566          15 :             if (!allocated(WalkIn(WalkInID).AreaGlassDr)) WalkIn(WalkInID).AreaGlassDr.allocate(NumZones) = 0.0;
    1567          15 :             if (!allocated(WalkIn(WalkInID).HeightGlassDr)) WalkIn(WalkInID).HeightGlassDr.allocate(NumZones) = 0.0;
    1568          15 :             if (!allocated(WalkIn(WalkInID).UValueStockDr)) WalkIn(WalkInID).UValueStockDr.allocate(NumZones) = 0.0;
    1569          15 :             if (!allocated(WalkIn(WalkInID).StockDoorOpenSchedPtr)) WalkIn(WalkInID).StockDoorOpenSchedPtr.allocate(NumZones) = 0;
    1570          15 :             if (!allocated(WalkIn(WalkInID).StockDoorProtectType)) WalkIn(WalkInID).StockDoorProtectType.allocate(NumZones) = WIStockDoor::Invalid;
    1571          15 :             if (!allocated(WalkIn(WalkInID).AreaStockDr)) WalkIn(WalkInID).AreaStockDr.allocate(NumZones) = 0.0;
    1572          15 :             if (!allocated(WalkIn(WalkInID).HeightStockDr)) WalkIn(WalkInID).HeightStockDr.allocate(NumZones) = 0.0;
    1573          15 :             if (!allocated(WalkIn(WalkInID).SensZoneCreditRate)) WalkIn(WalkInID).SensZoneCreditRate.allocate(NumZones) = 0.0;
    1574          15 :             if (!allocated(WalkIn(WalkInID).SensZoneCreditCoolRate)) WalkIn(WalkInID).SensZoneCreditCoolRate.allocate(NumZones) = 0.0;
    1575          15 :             if (!allocated(WalkIn(WalkInID).SensZoneCreditCool)) WalkIn(WalkInID).SensZoneCreditCool.allocate(NumZones) = 0.0;
    1576          15 :             if (!allocated(WalkIn(WalkInID).SensZoneCreditHeatRate)) WalkIn(WalkInID).SensZoneCreditHeatRate.allocate(NumZones) = 0.0;
    1577          15 :             if (!allocated(WalkIn(WalkInID).SensZoneCreditHeat)) WalkIn(WalkInID).SensZoneCreditHeat.allocate(NumZones) = 0.0;
    1578          15 :             if (!allocated(WalkIn(WalkInID).LatZoneCreditRate)) WalkIn(WalkInID).LatZoneCreditRate.allocate(NumZones) = 0.0;
    1579          15 :             if (!allocated(WalkIn(WalkInID).LatZoneCredit)) WalkIn(WalkInID).LatZoneCredit.allocate(NumZones) = 0.0;
    1580             : 
    1581          15 :             int AStart = NumWIAlphaFieldsBeforeZoneInput + 1;
    1582          15 :             int NStart = NumWINumberFieldsBeforeZoneInput + 1;
    1583          30 :             for (int ZoneID = 1; ZoneID <= NumZones; ++ZoneID) {
    1584             :                 // Get the Zone node number from the zone name
    1585             :                 // The Zone Node is needed to get the zone's ambient conditions, DataGlobals::NumOfZones from dataglobals
    1586          15 :                 WalkIn(WalkInID).ZoneName(ZoneID) = Alphas(AStart);
    1587          15 :                 WalkIn(WalkInID).ZoneNum(ZoneID) = UtilityRoutines::FindItemInList(Alphas(AStart), state.dataHeatBal->Zone);
    1588             : 
    1589          15 :                 if (WalkIn(WalkInID).ZoneNum(ZoneID) == 0) {
    1590           0 :                     ShowSevereError(state,
    1591           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + WalkIn(WalkInID).Name + "\", invalid  " +
    1592           0 :                                         cAlphaFieldNames(AStart) + " not valid: " + Alphas(AStart));
    1593           0 :                     ErrorsFound = true;
    1594             :                 } else {
    1595          15 :                     state.dataRefrigCase->RefrigPresentInZone(WalkIn(WalkInID).ZoneNum(ZoneID)) = true;
    1596             :                 }
    1597          15 :                 WalkIn(WalkInID).ZoneNodeNum(ZoneID) = DataZoneEquipment::GetSystemNodeNumberForZone(state, WalkIn(WalkInID).ZoneNum(ZoneID));
    1598          15 :                 if (WalkIn(WalkInID).ZoneNum(ZoneID) >= 0) {
    1599          15 :                     if (WalkIn(WalkInID).ZoneNodeNum(ZoneID) == 0) {
    1600           0 :                         ShowSevereError(state,
    1601           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + WalkIn(WalkInID).Name +
    1602           0 :                                             "\" System Node Number not found for " + cAlphaFieldNames(AStart) + " = " + Alphas(AStart));
    1603           0 :                         ShowContinueError(state, ".. Walk Ins must reference a controlled Zone (appear in a ZoneHVAC:EquipmentConnections object.");
    1604           0 :                         ErrorsFound = true;
    1605             :                     }
    1606             :                 }
    1607             : 
    1608          15 :                 if (!lNumericBlanks(NStart)) {
    1609          15 :                     WalkIn(WalkInID).SurfaceArea(ZoneID) = Numbers(NStart);
    1610             :                 } else {
    1611           0 :                     ShowSevereError(state,
    1612           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + WalkIn(WalkInID).Name + "\", " +
    1613           0 :                                         cNumericFieldNames(NStart) + " must be input for Zone: " + WalkIn(WalkInID).ZoneName(ZoneID));
    1614           0 :                     ErrorsFound = true;
    1615             :                 }
    1616             : 
    1617          15 :                 if (lNumericBlanks(NStart + 1)) {
    1618           0 :                     WalkIn(WalkInID).UValue(ZoneID) = DefaultWISurfaceUValue;
    1619             :                 } else {
    1620          15 :                     WalkIn(WalkInID).UValue(ZoneID) = Numbers(NStart + 1);
    1621          15 :                     if (Numbers(NStart + 1) <= 0.0) {
    1622           0 :                         ShowSevereError(state,
    1623           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + WalkIn(WalkInID).Name + "\", Zone=\"" +
    1624           0 :                                             WalkIn(WalkInID).ZoneName(ZoneID) + "\", " + cNumericFieldNames(NStart + 1) + " must be > 0.");
    1625           0 :                         ErrorsFound = true;
    1626             :                     }
    1627             :                 }
    1628             : 
    1629             :                 // start IF set for glass doors in this zone
    1630          15 :                 WalkIn(WalkInID).AreaGlassDr(ZoneID) = 0.0;
    1631          15 :                 WalkIn(WalkInID).HeightGlassDr(ZoneID) = 0.0;
    1632          15 :                 WalkIn(WalkInID).UValueGlassDr(ZoneID) = 0.0;
    1633          15 :                 if (!lNumericBlanks(NStart + 2)) {
    1634           4 :                     WalkIn(WalkInID).AreaGlassDr(ZoneID) = Numbers(NStart + 2);
    1635             : 
    1636           4 :                     WalkIn(WalkInID).HeightGlassDr(ZoneID) = DefaultWIHeightGlassDr;
    1637           4 :                     if (!lNumericBlanks(NStart + 3)) WalkIn(WalkInID).HeightGlassDr(ZoneID) = Numbers(NStart + 3);
    1638             : 
    1639           4 :                     WalkIn(WalkInID).UValueGlassDr(ZoneID) = DefaultWIUValueGlassDr;
    1640           4 :                     if (!lNumericBlanks(NStart + 4)) WalkIn(WalkInID).UValueGlassDr(ZoneID) = Numbers(NStart + 4);
    1641             : 
    1642             :                     // convert door opening schedule name to pointer, default of 0.1 is assigned inside walkin subroutine if blank
    1643           4 :                     if (lAlphaBlanks(AStart + 1)) {
    1644           0 :                         WalkIn(WalkInID).GlassDoorOpenSchedPtr(ZoneID) = 0;
    1645             :                     } else {
    1646           4 :                         WalkIn(WalkInID).GlassDoorOpenSchedPtr(ZoneID) = ScheduleManager::GetScheduleIndex(state, Alphas(AStart + 1));
    1647           4 :                         if (WalkIn(WalkInID).GlassDoorOpenSchedPtr(ZoneID) == 0) {
    1648           0 :                             ShowSevereError(state,
    1649           0 :                                             std::string{RoutineName} + CurrentModuleObject + "=\"" + WalkIn(WalkInID).Name + "\", Zone=\"" +
    1650           0 :                                                 WalkIn(WalkInID).ZoneName(ZoneID) + "\", invalid  " + cAlphaFieldNames(AStart + 1) +
    1651           0 :                                                 " not found: " + Alphas(AStart + 1));
    1652           0 :                             ErrorsFound = true;
    1653             :                         } else {
    1654             :                             //       check schedule for values between 0 and 1
    1655           8 :                             if (!ScheduleManager::CheckScheduleValueMinMax(
    1656           4 :                                     state, WalkIn(WalkInID).GlassDoorOpenSchedPtr(ZoneID), ">=", 0.0, "<=", 1.0)) {
    1657           0 :                                 ShowSevereError(state,
    1658           0 :                                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + WalkIn(WalkInID).Name + "\", Zone=\"" +
    1659           0 :                                                     WalkIn(WalkInID).ZoneName(ZoneID) + "\"");
    1660           0 :                                 ShowContinueError(state, "Error found in " + cAlphaFieldNames(AStart + 1) + " = " + Alphas(AStart + 1));
    1661           0 :                                 ShowContinueError(state, "schedule values must be (>=0., <=1.)");
    1662           0 :                                 ErrorsFound = true;
    1663             :                             } // schedule values outside range
    1664             :                         }     // have schedule pointer
    1665             :                     }         // blank on door opening schedule (AStart + 1)
    1666             :                 }             // have glassdoor area facing zone (blank on lNumericBlanks(NStart+2))
    1667             : 
    1668             :                 // start IF set for stock doors in this zone
    1669          15 :                 WalkIn(WalkInID).AreaStockDr(ZoneID) = 0.0;
    1670          15 :                 WalkIn(WalkInID).HeightStockDr(ZoneID) = 0.0;
    1671          15 :                 WalkIn(WalkInID).UValueStockDr(ZoneID) = 0.0;
    1672          15 :                 if (!lNumericBlanks(NStart + 5)) {
    1673          15 :                     WalkIn(WalkInID).AreaStockDr(ZoneID) = Numbers(NStart + 5);
    1674             : 
    1675          15 :                     WalkIn(WalkInID).HeightStockDr(ZoneID) = DefaultWIHeightStockDr;
    1676          15 :                     if (!lNumericBlanks(NStart + 6)) WalkIn(WalkInID).HeightStockDr(ZoneID) = Numbers(NStart + 6);
    1677             : 
    1678          15 :                     WalkIn(WalkInID).UValueStockDr(ZoneID) = DefaultWIUValueStockDr;
    1679          15 :                     if (!lNumericBlanks(NStart + 7)) WalkIn(WalkInID).UValueStockDr(ZoneID) = Numbers(NStart + 7);
    1680             : 
    1681             :                     // convert door opening schedule name to pointer, default of 0.1 is assigned inside walkin subroutine if blank
    1682          15 :                     if (lAlphaBlanks(AStart + 2)) {
    1683           0 :                         WalkIn(WalkInID).StockDoorOpenSchedPtr(ZoneID) = 0;
    1684             :                     } else {
    1685          15 :                         WalkIn(WalkInID).StockDoorOpenSchedPtr(ZoneID) = ScheduleManager::GetScheduleIndex(state, Alphas(AStart + 2));
    1686          15 :                         if (WalkIn(WalkInID).StockDoorOpenSchedPtr(ZoneID) == 0) {
    1687           0 :                             ShowSevereError(state,
    1688           0 :                                             std::string{RoutineName} + CurrentModuleObject + "=\"" + WalkIn(WalkInID).Name + "\", Zone=\"" +
    1689           0 :                                                 WalkIn(WalkInID).ZoneName(ZoneID) + "\", invalid  " + cAlphaFieldNames(AStart + 2) +
    1690           0 :                                                 " not found: " + Alphas(AStart + 2));
    1691           0 :                             ErrorsFound = true;
    1692             :                         } else {
    1693             :                             //       check schedule for values between 0 and 1
    1694          30 :                             if (!ScheduleManager::CheckScheduleValueMinMax(
    1695          15 :                                     state, WalkIn(WalkInID).StockDoorOpenSchedPtr(ZoneID), ">=", 0.0, "<=", 1.0)) {
    1696           0 :                                 ShowSevereError(state,
    1697           0 :                                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + WalkIn(WalkInID).Name + "\", Zone=\"" +
    1698           0 :                                                     WalkIn(WalkInID).ZoneName(ZoneID) + "\"");
    1699           0 :                                 ShowContinueError(state, "Error found in " + cAlphaFieldNames(AStart + 2) + " = " + Alphas(AStart + 2));
    1700           0 :                                 ShowContinueError(state, "schedule values must be (>=0., <=1.)");
    1701           0 :                                 ErrorsFound = true;
    1702             :                             } // schedule values outside range
    1703             :                         }     // have schedule pointer
    1704             :                     }         // blank on door opening schedule (AStart + 2)
    1705             : 
    1706          15 :                     if (lAlphaBlanks(AStart + 3) || UtilityRoutines::SameString(Alphas(AStart + 3), "AirCurtain")) {
    1707             :                         // default air curtain
    1708           0 :                         WalkIn(WalkInID).StockDoorProtectType(ZoneID) = WIStockDoor::AirCurtain;
    1709          15 :                     } else if (UtilityRoutines::SameString(Alphas(AStart + 3), "None")) {
    1710           4 :                         WalkIn(WalkInID).StockDoorProtectType(ZoneID) = WIStockDoor::None;
    1711          11 :                     } else if (UtilityRoutines::SameString(Alphas(AStart + 3), "StripCurtain")) {
    1712          11 :                         WalkIn(WalkInID).StockDoorProtectType(ZoneID) = WIStockDoor::StripCurtain;
    1713             :                     } else {
    1714           0 :                         ShowSevereError(state,
    1715           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + WalkIn(WalkInID).Name + "\", invalid  " +
    1716           0 :                                             cAlphaFieldNames(AStart + 3) + "=\"" + Alphas(AStart + 3) + "\".");
    1717           0 :                         ErrorsFound = true;
    1718             :                     } // stock door protection (AStart + 3) blank
    1719             :                 }     // have Stockdoor area facing zone
    1720             : 
    1721          15 :                 AStart += NumWIAlphaFieldsPerZone;
    1722          15 :                 NStart += NumWINumberFieldsPerZone;
    1723             :             } // Zones for Walk Ins
    1724             :         }     // Individual Walk Ins
    1725             :     }         //(NumSimulationWalkIns > 0 )
    1726             : 
    1727             :     //************* Start Indiv Refrig Air Chillers
    1728             : 
    1729         771 :     if (state.dataRefrigCase->NumSimulationRefrigAirChillers > 0) {
    1730           1 :         CurrentModuleObject = "Refrigeration:AirChiller";
    1731          84 :         for (int CoilID = 1; CoilID <= state.dataRefrigCase->NumSimulationRefrigAirChillers; ++CoilID) {
    1732             :             // A1
    1733          83 :             AlphaNum = 1;
    1734          83 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
    1735             :                                                                      CurrentModuleObject,
    1736             :                                                                      CoilID,
    1737             :                                                                      Alphas,
    1738             :                                                                      NumAlphas,
    1739             :                                                                      Numbers,
    1740             :                                                                      NumNumbers,
    1741             :                                                                      IOStatus,
    1742             :                                                                      lNumericBlanks,
    1743             :                                                                      lAlphaBlanks,
    1744             :                                                                      cAlphaFieldNames,
    1745             :                                                                      cNumericFieldNames);
    1746          83 :             UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound);
    1747             : 
    1748          83 :             WarehouseCoil(CoilID).Name = Alphas(AlphaNum);
    1749             : 
    1750             :             // A2
    1751          83 :             ++AlphaNum;
    1752          83 :             if (!lAlphaBlanks(AlphaNum)) {
    1753          83 :                 WarehouseCoil(CoilID).SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(AlphaNum)); // convert schedule name to pointer
    1754          83 :                 if (WarehouseCoil(CoilID).SchedPtr == 0) {
    1755           0 :                     ShowSevereError(state,
    1756           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", invalid  " +
    1757           0 :                                         cAlphaFieldNames(AlphaNum) + " not found: " + Alphas(AlphaNum));
    1758           0 :                     ErrorsFound = true;
    1759             :                 }    // ptr == 0
    1760             :             } else { // no schedule specified
    1761           0 :                 WarehouseCoil(CoilID).SchedPtr = AlwaysOn;
    1762             :             } // not blank
    1763             : 
    1764             :             //   check availability schedule for values between 0 and 1
    1765          83 :             if (WarehouseCoil(CoilID).SchedPtr > 0) {
    1766          83 :                 if (!ScheduleManager::CheckScheduleValueMinMax(state, WarehouseCoil(CoilID).SchedPtr, ">=", 0.0, "<=", 1.0)) {
    1767           0 :                     ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\"");
    1768           0 :                     ShowContinueError(state, "Error found in " + cAlphaFieldNames(AlphaNum) + " = " + Alphas(AlphaNum));
    1769           0 :                     ShowContinueError(state, "schedule values must be (>=0., <=1.)");
    1770           0 :                     ErrorsFound = true;
    1771             :                 }
    1772             :             }
    1773             : 
    1774             :             // Input capacity rating type
    1775             :             // bbbbb input values (DT1 or DTM type)translate DT1 to DTm here because node will give avg temp?
    1776             :             //      ask whether ceiling or floor mounted? - effects translation from DT1 to DTM
    1777             :             //      input coil condition, wet or dry OR input rating basis, European SC1, SC2 etc., have to combine with refrigerant factor)
    1778             :             //      rated capacity, BAC give W/C, European gives W
    1779             :             //      fin material factor, default 1
    1780             :             //      refrigerant factor (factor of both refrigerant and Tevap)
    1781             : 
    1782             :             // A3
    1783          83 :             ++AlphaNum;
    1784          83 :             if (lAlphaBlanks(AlphaNum)) {
    1785           0 :                 ShowSevereError(state,
    1786           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + cAlphaFieldNames(AlphaNum) +
    1787             :                                     " is required and not found.");
    1788           0 :                 ErrorsFound = true;
    1789          83 :             } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "UnitLoadFactorSensibleOnly")) {
    1790          81 :                 WarehouseCoil(CoilID).ratingType = RatingType::UnitLoadFactorSens;
    1791           2 :             } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "CapacityTotalSpecificConditions")) {
    1792           1 :                 WarehouseCoil(CoilID).ratingType = RatingType::RatedCapacityTotal;
    1793           1 :             } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "EuropeanSC1Standard")) {
    1794           0 :                 WarehouseCoil(CoilID).ratingType = RatingType::EuropeanSC1Std;
    1795           1 :             } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "EuropeanSC1NominalWet")) {
    1796           0 :                 WarehouseCoil(CoilID).ratingType = RatingType::EuropeanSC1Nom;
    1797           1 :             } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "EuropeanSC2Standard")) {
    1798           0 :                 WarehouseCoil(CoilID).ratingType = RatingType::EuropeanSC2Std;
    1799           1 :             } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "EuropeanSC2NominalWet")) {
    1800           0 :                 WarehouseCoil(CoilID).ratingType = RatingType::EuropeanSC2Nom;
    1801           1 :             } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "EuropeanSC3Standard")) {
    1802           1 :                 WarehouseCoil(CoilID).ratingType = RatingType::EuropeanSC3Std;
    1803           0 :             } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "EuropeanSC3NominalWet")) {
    1804           0 :                 WarehouseCoil(CoilID).ratingType = RatingType::EuropeanSC3Nom;
    1805           0 :             } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "EuropeanSC4Standard")) {
    1806           0 :                 WarehouseCoil(CoilID).ratingType = RatingType::EuropeanSC4Std;
    1807           0 :             } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "EuropeanSC4NominalWet")) {
    1808           0 :                 WarehouseCoil(CoilID).ratingType = RatingType::EuropeanSC4Nom;
    1809           0 :             } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "EuropeanSC5Standard")) {
    1810           0 :                 WarehouseCoil(CoilID).ratingType = RatingType::EuropeanSC5Std;
    1811           0 :             } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "EuropeanSC5NominalWet")) {
    1812           0 :                 WarehouseCoil(CoilID).ratingType = RatingType::EuropeanSC5Nom;
    1813             :             } else {
    1814           0 :                 ShowSevereError(state,
    1815           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", invalid  " +
    1816           0 :                                     cAlphaFieldNames(AlphaNum) + "=\"" + Alphas(AlphaNum) + "\".");
    1817           0 :                 ErrorsFound = true;
    1818             :             }
    1819             : 
    1820             :             // Here have to do select case with one numeric field with units of W and the second with units of W/deltaC,
    1821             :             //  (RatedRH field only used for RatedCapacityTotal type)
    1822             :             {
    1823          83 :                 switch (WarehouseCoil(CoilID).ratingType) {
    1824          81 :                 case RatingType::UnitLoadFactorSens:
    1825             :                     // N1
    1826          81 :                     NumNum = 1;
    1827          81 :                     if (!lNumericBlanks(NumNum) && Numbers(NumNum) > 0.0) {
    1828          81 :                         WarehouseCoil(CoilID).UnitLoadFactorSens = Numbers(NumNum);
    1829             :                     } else {
    1830           0 :                         ShowSevereError(state,
    1831           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", " +
    1832           0 :                                             cNumericFieldNames(NumNum) + " must be input and be greater than 0 W/C");
    1833           0 :                         ErrorsFound = true;
    1834             :                     }
    1835          81 :                     break;
    1836           1 :                 case RatingType::RatedCapacityTotal:
    1837             :                     // N2
    1838           1 :                     NumNum = 2; // advance past rating in W/C to N2 with rating in W
    1839           1 :                     if (!lNumericBlanks(NumNum) && Numbers(NumNum) > 0.0) {
    1840           1 :                         WarehouseCoil(CoilID).RatedCapTotal = Numbers(NumNum);
    1841             :                         // N3
    1842           1 :                         NumNum = 3; // read rated RH only for this type of rating at N3
    1843           1 :                         if (lNumericBlanks(NumNum)) {
    1844           0 :                             WarehouseCoil(CoilID).RatedRH = 0.85;
    1845             :                         } else {
    1846           1 :                             if (Numbers(NumNum) <= 0.0 || Numbers(NumNum) >= 100.0) {
    1847           0 :                                 ShowSevereError(state,
    1848           0 :                                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", " +
    1849           0 :                                                     cNumericFieldNames(NumNum) + " must be greater than 0% and less than 100%");
    1850           0 :                                 ErrorsFound = true;
    1851             :                             }
    1852           1 :                             WarehouseCoil(CoilID).RatedRH = Numbers(NumNum) / 100.0;
    1853             :                         }
    1854             :                     } else {
    1855           0 :                         ShowSevereError(state,
    1856           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", " +
    1857           0 :                                             cNumericFieldNames(NumNum) + " must be input and be greater than 0 W");
    1858           0 :                         ErrorsFound = true;
    1859             :                     }
    1860           1 :                     break;
    1861           0 :                 case RatingType::EuropeanSC1Std:
    1862             :                     // N2
    1863           0 :                     NumNum = 2; // advance past rating in W/C to rating in W at N2
    1864           0 :                     if (!lNumericBlanks(NumNum) && Numbers(NumNum) > 0.0) {
    1865           0 :                         WarehouseCoil(CoilID).RatedSensibleCap = Numbers(NumNum);
    1866           0 :                         WarehouseCoil(CoilID).SCIndex = 1;
    1867             :                     } else {
    1868           0 :                         ShowSevereError(state,
    1869           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", " +
    1870           0 :                                             cNumericFieldNames(NumNum) + " must be input and be greater than 0 W");
    1871           0 :                         ErrorsFound = true;
    1872             :                     }
    1873           0 :                     break;
    1874           0 :                 case RatingType::EuropeanSC1Nom:
    1875             :                     // N2
    1876           0 :                     NumNum = 2; // advance past rating in W/C to rating in W at N2
    1877           0 :                     if (!lNumericBlanks(NumNum) && Numbers(NumNum) > 0.0) {
    1878           0 :                         WarehouseCoil(CoilID).RatedCapTotal = Numbers(NumNum);
    1879           0 :                         WarehouseCoil(CoilID).RatedSensibleCap = Numbers(NumNum) / EuropeanWetCoilFactor[0];
    1880           0 :                         WarehouseCoil(CoilID).SCIndex = 1;
    1881             :                     } else {
    1882           0 :                         ShowSevereError(state,
    1883           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", " +
    1884           0 :                                             cNumericFieldNames(NumNum) + " must be input and be greater than 0 W");
    1885           0 :                         ErrorsFound = true;
    1886             :                     }
    1887           0 :                     break;
    1888           0 :                 case RatingType::EuropeanSC2Std:
    1889             :                     // N2
    1890           0 :                     NumNum = 2; // advance past rating in W/C to rating in W at N2
    1891           0 :                     if (!lNumericBlanks(NumNum) && Numbers(NumNum) > 0.0) {
    1892           0 :                         WarehouseCoil(CoilID).RatedSensibleCap = Numbers(NumNum);
    1893           0 :                         WarehouseCoil(CoilID).SCIndex = 2;
    1894             :                     } else {
    1895           0 :                         ShowSevereError(state,
    1896           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", " +
    1897           0 :                                             cNumericFieldNames(NumNum) + " must be input and be greater than 0 W");
    1898           0 :                         ErrorsFound = true;
    1899             :                     }
    1900           0 :                     break;
    1901           0 :                 case RatingType::EuropeanSC2Nom:
    1902             :                     // N2
    1903           0 :                     NumNum = 2; // advance past rating in W/C to rating in W at N2
    1904           0 :                     if (!lNumericBlanks(NumNum) && Numbers(NumNum) > 0.0) {
    1905           0 :                         WarehouseCoil(CoilID).RatedCapTotal = Numbers(NumNum);
    1906           0 :                         WarehouseCoil(CoilID).RatedSensibleCap = Numbers(NumNum) / EuropeanWetCoilFactor[1];
    1907           0 :                         WarehouseCoil(CoilID).SCIndex = 2;
    1908             :                     } else {
    1909           0 :                         ShowSevereError(state,
    1910           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", " +
    1911           0 :                                             cNumericFieldNames(NumNum) + " must be input and be greater than 0 W");
    1912           0 :                         ErrorsFound = true;
    1913             :                     }
    1914           0 :                     break;
    1915           1 :                 case RatingType::EuropeanSC3Std:
    1916             :                     // N2
    1917           1 :                     NumNum = 2; // advance past rating in W/C to rating in W at N2
    1918           1 :                     if (!lNumericBlanks(NumNum) && Numbers(NumNum) > 0.0) {
    1919           1 :                         WarehouseCoil(CoilID).RatedSensibleCap = Numbers(NumNum);
    1920           1 :                         WarehouseCoil(CoilID).SCIndex = 3;
    1921             :                     } else {
    1922           0 :                         ShowSevereError(state,
    1923           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", " +
    1924           0 :                                             cNumericFieldNames(NumNum) + " must be input and be greater than 0 W");
    1925           0 :                         ErrorsFound = true;
    1926             :                     }
    1927           1 :                     break;
    1928           0 :                 case RatingType::EuropeanSC3Nom:
    1929             :                     // N2
    1930           0 :                     NumNum = 2; // advance past rating in W/C to rating in W at N2
    1931           0 :                     if (!lNumericBlanks(NumNum) && Numbers(NumNum) > 0.0) {
    1932           0 :                         WarehouseCoil(CoilID).RatedCapTotal = Numbers(NumNum);
    1933           0 :                         WarehouseCoil(CoilID).RatedSensibleCap = Numbers(NumNum) / EuropeanWetCoilFactor[2];
    1934           0 :                         WarehouseCoil(CoilID).SCIndex = 3;
    1935             :                     } else {
    1936           0 :                         ShowSevereError(state,
    1937           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", " +
    1938           0 :                                             cNumericFieldNames(NumNum) + " must be input and be greater than 0 W");
    1939           0 :                         ErrorsFound = true;
    1940             :                     }
    1941           0 :                     break;
    1942           0 :                 case RatingType::EuropeanSC4Std:
    1943             :                     // N2
    1944           0 :                     NumNum = 2; // advance past rating in W/C to rating in W at N2
    1945           0 :                     if (!lNumericBlanks(NumNum) && Numbers(NumNum) > 0.0) {
    1946           0 :                         WarehouseCoil(CoilID).RatedSensibleCap = Numbers(NumNum);
    1947           0 :                         WarehouseCoil(CoilID).SCIndex = 4;
    1948             :                     } else {
    1949           0 :                         ShowSevereError(state,
    1950           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", " +
    1951           0 :                                             cNumericFieldNames(NumNum) + " must be input and be greater than 0 W");
    1952           0 :                         ErrorsFound = true;
    1953             :                     }
    1954           0 :                     break;
    1955           0 :                 case RatingType::EuropeanSC4Nom:
    1956             :                     // N2
    1957           0 :                     NumNum = 2; // advance past rating in W/C to rating in W at N2
    1958           0 :                     if (!lNumericBlanks(NumNum) && Numbers(NumNum) > 0.0) {
    1959           0 :                         WarehouseCoil(CoilID).RatedCapTotal = Numbers(NumNum);
    1960           0 :                         WarehouseCoil(CoilID).RatedSensibleCap = Numbers(NumNum) / EuropeanWetCoilFactor[3];
    1961           0 :                         WarehouseCoil(CoilID).SCIndex = 4;
    1962             :                     } else {
    1963           0 :                         ShowSevereError(state,
    1964           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", " +
    1965           0 :                                             cNumericFieldNames(NumNum) + " must be input and be greater than 0 W");
    1966           0 :                         ErrorsFound = true;
    1967             :                     }
    1968           0 :                     break;
    1969           0 :                 case RatingType::EuropeanSC5Std:
    1970             :                     // N2
    1971           0 :                     NumNum = 2; // advance past rating in W/C to rating in W at N2
    1972           0 :                     if (!lNumericBlanks(NumNum) && Numbers(NumNum) > 0.0) {
    1973           0 :                         WarehouseCoil(CoilID).RatedSensibleCap = Numbers(NumNum);
    1974           0 :                         WarehouseCoil(CoilID).SCIndex = 5;
    1975             :                     } else {
    1976           0 :                         ShowSevereError(state,
    1977           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", " +
    1978           0 :                                             cNumericFieldNames(NumNum) + " must be input and be greater than 0 W");
    1979           0 :                         ErrorsFound = true;
    1980             :                     }
    1981           0 :                     break;
    1982           0 :                 case RatingType::EuropeanSC5Nom:
    1983             :                     // N2
    1984           0 :                     NumNum = 2; // advance past rating in W/C to rating in W at N2
    1985           0 :                     if (!lNumericBlanks(NumNum) && Numbers(NumNum) > 0.0) {
    1986           0 :                         WarehouseCoil(CoilID).RatedCapTotal = Numbers(NumNum);
    1987           0 :                         WarehouseCoil(CoilID).RatedSensibleCap = Numbers(NumNum) / EuropeanWetCoilFactor[4];
    1988           0 :                         WarehouseCoil(CoilID).SCIndex = 5;
    1989             :                     } else {
    1990           0 :                         ShowSevereError(state,
    1991           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", " +
    1992           0 :                                             cNumericFieldNames(NumNum) + " must be input and be greater than 0 W");
    1993           0 :                         ErrorsFound = true;
    1994             :                     }
    1995             :                 default:
    1996           0 :                     break;
    1997             :                 }
    1998             :             } // WarehouseCoil(CoilID)%RatingType
    1999             : 
    2000             :             // N4
    2001          83 :             NumNum = 4;
    2002          83 :             if (!lNumericBlanks(NumNum)) {
    2003          83 :                 WarehouseCoil(CoilID).TEvapDesign = Numbers(NumNum); // also used to rep inlet brine T later when add that option
    2004             :             } else {
    2005           0 :                 ShowSevereError(state,
    2006           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", " +
    2007           0 :                                     cNumericFieldNames(NumNum) + " must be input");
    2008           0 :                 ErrorsFound = true;
    2009             :             }
    2010             : 
    2011          83 :             ++NumNum; // N5
    2012          83 :             if (!lNumericBlanks(NumNum)) {
    2013          83 :                 WarehouseCoil(CoilID).RatedTemperatureDif = Numbers(NumNum);
    2014             :                 // INLET temperature - evaporating temperature, NOT room temp - evap temp
    2015             :             } else {
    2016           0 :                 ShowSevereError(state,
    2017           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", " +
    2018           0 :                                     cNumericFieldNames(NumNum) + " must be input");
    2019           0 :                 ErrorsFound = true;
    2020             :             }
    2021             : 
    2022          83 :             ++NumNum; // N6
    2023          83 :             if (!lNumericBlanks(NumNum)) {
    2024          83 :                 WarehouseCoil(CoilID).MaxTemperatureDif = Numbers(NumNum);
    2025             :                 // Maximum difference between INLET temperature - evaporating temperature, NOT room temp - evap temp
    2026             :                 // Important when cooling down space at start of environment or if large stocking loads imposed.
    2027             :             } else {
    2028           0 :                 WarehouseCoil(CoilID).MaxTemperatureDif = 1.3 * WarehouseCoil(CoilID).RatedTemperatureDif;
    2029           0 :                 ShowWarningError(state,
    2030           0 :                                  std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", " +
    2031           0 :                                      cNumericFieldNames(NumNum) + " not entered, default 1.3 times rated temperature difference will be used.");
    2032             :             }
    2033             : 
    2034             :             // Correction factor from manufacturer's rating for coil material, default 1.0
    2035          83 :             ++NumNum;                                 // N7
    2036          83 :             WarehouseCoil(CoilID).CorrMaterial = 1.0; // default value
    2037          83 :             if (!lNumericBlanks(NumNum)) WarehouseCoil(CoilID).CorrMaterial = Numbers(NumNum);
    2038             : 
    2039             :             // Correction factor from manufacturer's rating for refrigerant, default 1.0
    2040          83 :             ++NumNum;                                    // N8
    2041          83 :             WarehouseCoil(CoilID).CorrRefrigerant = 1.0; // default value
    2042          83 :             if (!lNumericBlanks(NumNum)) WarehouseCoil(CoilID).CorrRefrigerant = Numbers(NumNum);
    2043             :             // ONLY used if the Capacity Rating Type is CapacityTotalSpecificConditions
    2044             : 
    2045             :             // Convert all European sensible capacities to sensible load factors
    2046          85 :             if ((WarehouseCoil(CoilID).ratingType != RatingType::UnitLoadFactorSens) &&
    2047           2 :                 (WarehouseCoil(CoilID).ratingType != RatingType::RatedCapacityTotal))
    2048           1 :                 WarehouseCoil(CoilID).UnitLoadFactorSens = WarehouseCoil(CoilID).RatedSensibleCap / WarehouseCoil(CoilID).RatedTemperatureDif;
    2049             :             // Now have UnitLoadFactorSens for all except RatingType == RatedCapacityTotal
    2050             : 
    2051             :             // Apply material and refrigerant correction factors to sensible load factors
    2052          83 :             if ((WarehouseCoil(CoilID).ratingType != RatingType::RatedCapacityTotal))
    2053          82 :                 WarehouseCoil(CoilID).UnitLoadFactorSens *= WarehouseCoil(CoilID).CorrMaterial * WarehouseCoil(CoilID).CorrRefrigerant;
    2054             :             // First calc of ratedsensiblecap for type type unitloadfactorsens
    2055          83 :             WarehouseCoil(CoilID).RatedSensibleCap = WarehouseCoil(CoilID).UnitLoadFactorSens * WarehouseCoil(CoilID).RatedTemperatureDif;
    2056             :             // A4    Enter capacity correction curve type
    2057          83 :             AlphaNum = 4;
    2058          83 :             if ((lAlphaBlanks(AlphaNum)) && (WarehouseCoil(CoilID).ratingType != RatingType::RatedCapacityTotal)) {
    2059             :                 // For all except RatedCapacityTotal - default to linear capacity factor approximating Nelson August 2010 ASHRAE journal
    2060           0 :                 WarehouseCoil(CoilID).SHRCorrType = SHRCorrectionType::SHR60;
    2061          83 :             } else if (WarehouseCoil(CoilID).ratingType == RatingType::RatedCapacityTotal) {
    2062             :                 // For RatedCapacityTotal, the manufacturer's coil performance map is required
    2063             :                 // Specify the performance map with TabularRHxDT1xTRoom
    2064           1 :                 WarehouseCoil(CoilID).SHRCorrType = SHRCorrectionType::TabularRH_DT1_TRoom;
    2065           1 :                 if (!(UtilityRoutines::SameString(Alphas(AlphaNum), "TabularRHxDT1xTRoom"))) {
    2066           0 :                     ShowWarningError(state,
    2067           0 :                                      std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", invalid " +
    2068           0 :                                          cAlphaFieldNames(AlphaNum) + "=\"" + Alphas(AlphaNum) + "\".");
    2069           0 :                     ShowContinueError(state,
    2070             :                                       "The \"CapacityTotalSpecificConditions\" Capacity Rating Type has been specified for this air chiller.  "
    2071             :                                       "This rating type requires ");
    2072           0 :                     ShowContinueError(
    2073             :                         state,
    2074           0 :                         R"(the "TabularRHxDT1xTRoom" correction curve.  Verify that a valid "TabularRHxDT1xTRoom" curve is specified in ")" +
    2075           0 :                             cAlphaFieldNames(AlphaNum + 1) + "\".");
    2076             :                 }
    2077          82 :             } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "LinearSHR60")) {
    2078          81 :                 WarehouseCoil(CoilID).SHRCorrType = SHRCorrectionType::SHR60;
    2079           1 :             } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "QuadraticSHR")) {
    2080           0 :                 WarehouseCoil(CoilID).SHRCorrType = SHRCorrectionType::QuadraticSHR;
    2081           1 :             } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "European")) {
    2082           1 :                 WarehouseCoil(CoilID).SHRCorrType = SHRCorrectionType::European;
    2083           0 :             } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "TabularRHxDT1xTRoom")) {
    2084           0 :                 WarehouseCoil(CoilID).SHRCorrType = SHRCorrectionType::TabularRH_DT1_TRoom;
    2085             :             } else {
    2086           0 :                 ShowSevereError(state,
    2087           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", invalid  " +
    2088           0 :                                     cAlphaFieldNames(AlphaNum) + "=\"" + Alphas(AlphaNum) + "\".");
    2089           0 :                 ErrorsFound = true;
    2090             :             }
    2091             : 
    2092          83 :             ++AlphaNum; // A5
    2093          83 :             ++NumNum;   // N9
    2094          83 :             switch (WarehouseCoil(CoilID).SHRCorrType) {
    2095          81 :             case SHRCorrectionType::SHR60: {
    2096          81 :                 WarehouseCoil(CoilID).SHRCorrection60 = 1.48; // reference Nelson, ASHRAE journal August 2010 Fig 2
    2097          81 :                 if (!lNumericBlanks(NumNum)) WarehouseCoil(CoilID).SHRCorrection60 = Numbers(NumNum);
    2098             :                 //(1.66667 would be a perfect effectiveness, 1.0 would be artificial coil that does only sensible)
    2099          81 :                 if (WarehouseCoil(CoilID).SHRCorrection60 > 1.67) {
    2100           0 :                     WarehouseCoil(CoilID).SHRCorrection60 = 1.67;
    2101           0 :                     ShowWarningError(state,
    2102           0 :                                      std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", " +
    2103           0 :                                          cNumericFieldNames(NumNum) + " must be between 1 and 1.67, 1.67 will be used.");
    2104             :                 }
    2105          81 :                 if (WarehouseCoil(CoilID).SHRCorrection60 < 1.0) {
    2106           0 :                     WarehouseCoil(CoilID).SHRCorrection60 = 1.0;
    2107           0 :                     ShowWarningError(state,
    2108           0 :                                      std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", " +
    2109           0 :                                          cNumericFieldNames(NumNum) + " must be between 1 and 1.67, 1.00 will be used.");
    2110             :                 }
    2111          81 :             } break;
    2112           1 :             case SHRCorrectionType::European: {
    2113             :                 // WarehouseCoil(CoilID)%SHRCorrectionCurvePtr = CurveManager::GetCurveIndex(state, 'ChillerEuropeanWetCoilFactor')
    2114             :                 // This is a place holder, currently use embedded constants for European ratings, future may want a curve
    2115           1 :             } break;
    2116           0 :             case SHRCorrectionType::QuadraticSHR: {
    2117           0 :                 WarehouseCoil(CoilID).SHRCorrectionCurvePtr = Curve::GetCurveIndex(state, Alphas(AlphaNum)); // convert curve name to number
    2118           0 :                 if (lAlphaBlanks(AlphaNum)) {
    2119           0 :                     ShowSevereError(state,
    2120           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", invalid  " +
    2121           0 :                                         cAlphaFieldNames(AlphaNum) + " is blank, required.");
    2122           0 :                     ErrorsFound = true;
    2123           0 :                 } else if (WarehouseCoil(CoilID).SHRCorrectionCurvePtr == 0) {
    2124           0 :                     ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", invalid  ");
    2125           0 :                     ShowContinueError(state, "...invalid curve " + cAlphaFieldNames(AlphaNum) + "=\"" + Alphas(AlphaNum) + "\".");
    2126           0 :                     ErrorsFound = true;
    2127             :                 }
    2128             :                 // error checks for curve type entered and curve name
    2129           0 :                 ErrorsFound |= Curve::CheckCurveDims(state,
    2130           0 :                                                      WarehouseCoil(CoilID).SHRCorrectionCurvePtr, // Curve index
    2131             :                                                      {1},                                         // Valid dimensions
    2132             :                                                      RoutineName,                                 // Routine name
    2133             :                                                      CurrentModuleObject,                         // Object Type
    2134           0 :                                                      WarehouseCoil(CoilID).Name,                  // Object Name
    2135           0 :                                                      cAlphaFieldNames(AlphaNum));                 // Field Name
    2136           0 :             } break;
    2137           1 :             case SHRCorrectionType::TabularRH_DT1_TRoom: {
    2138           1 :                 WarehouseCoil(CoilID).SHRCorrectionCurvePtr = Curve::GetCurveIndex(state, Alphas(AlphaNum)); // convert curve name to number
    2139           1 :                 if (lAlphaBlanks(AlphaNum)) {
    2140           0 :                     ShowSevereError(state,
    2141           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", invalid  " +
    2142           0 :                                         cAlphaFieldNames(AlphaNum) + " is blank, required.");
    2143           0 :                     ErrorsFound = true;
    2144           1 :                 } else if (WarehouseCoil(CoilID).SHRCorrectionCurvePtr == 0) {
    2145           0 :                     ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", invalid  ");
    2146           0 :                     ShowContinueError(state, "...invalid curve " + cAlphaFieldNames(AlphaNum) + "=\"" + Alphas(AlphaNum) + "\".");
    2147           0 :                     ErrorsFound = true;
    2148             :                 }
    2149           3 :                 ErrorsFound |= Curve::CheckCurveDims(state,
    2150           1 :                                                      WarehouseCoil(CoilID).SHRCorrectionCurvePtr, // Curve index
    2151             :                                                      {3},                                         // Valid dimensions
    2152             :                                                      RoutineName,                                 // Routine name
    2153             :                                                      CurrentModuleObject,                         // Object Type
    2154           1 :                                                      WarehouseCoil(CoilID).Name,                  // Object Name
    2155           1 :                                                      cAlphaFieldNames(AlphaNum));                 // Field Name
    2156             :                 //        IF(WarehouseCoil(CoilID)%SHRCorrectionCurvePtr == 0) THEN
    2157             :                 //          CALL ShowSevereError(state, RoutineName//TRIM(CurrentModuleObject)//'="'//TRIM(WarehouseCoil(CoilID)%Name)//&
    2158             :                 //                           '", not found  '//TRIM(cAlphaFieldNames(AlphaNum)))
    2159             :                 //          ErrorsFound = .TRUE.
    2160             :                 //        END IF !valid table name
    2161           1 :             } break;
    2162           0 :             default:
    2163           0 :                 break;
    2164             :             } // SHRCorrectionType
    2165             : 
    2166          83 :             ++NumNum; // N10
    2167          83 :             if (!lNumericBlanks(NumNum)) {
    2168          83 :                 WarehouseCoil(CoilID).HeaterPower = Numbers(NumNum);
    2169             :             } else {
    2170           0 :                 ShowSevereError(state,
    2171           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", " +
    2172           0 :                                     cNumericFieldNames(NumNum) + " must be input ");
    2173           0 :                 ErrorsFound = true;
    2174             :             }
    2175             : 
    2176          83 :             ++AlphaNum; // A6
    2177          83 :             if (!lAlphaBlanks(AlphaNum)) {
    2178          83 :                 WarehouseCoil(CoilID).HeaterSchedPtr =
    2179          83 :                     ScheduleManager::GetScheduleIndex(state, Alphas(AlphaNum)); // convert heater schedule name to pointer
    2180          83 :                 if (WarehouseCoil(CoilID).HeaterSchedPtr == 0) {
    2181           0 :                     ShowSevereError(state,
    2182           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", invalid  " +
    2183           0 :                                         cAlphaFieldNames(AlphaNum) + " not found: " + Alphas(AlphaNum));
    2184           0 :                     ErrorsFound = true;
    2185             :                 } else { //   check heater schedule for values between 0 and 1
    2186          83 :                     if (!ScheduleManager::CheckScheduleValueMinMax(state, WarehouseCoil(CoilID).HeaterSchedPtr, ">=", 0.0, "<=", 1.0)) {
    2187           0 :                         ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\"");
    2188           0 :                         ShowContinueError(state, "Error found in " + cAlphaFieldNames(AlphaNum) + " = " + Alphas(AlphaNum));
    2189           0 :                         ShowContinueError(state, "schedule values must be (>=0., <=1.)");
    2190           0 :                         ErrorsFound = true;
    2191             :                     } // heater schedule ptr == 0
    2192             :                 }     // htr sched == 0
    2193             :             } else {  // lalphaBlanks, no schedule specified
    2194           0 :                 WarehouseCoil(CoilID).HeaterSchedPtr = AlwaysOn;
    2195             :             } // not blank
    2196             : 
    2197             :             // Input fan control type
    2198          83 :             ++AlphaNum; // A7
    2199          83 :             if (lAlphaBlanks(AlphaNum) || UtilityRoutines::SameString(Alphas(AlphaNum), "Fixed")) {
    2200          83 :                 WarehouseCoil(CoilID).FanType = FanSpeedCtrlType::ConstantSpeed;
    2201           0 :             } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "FixedLinear")) {
    2202           0 :                 WarehouseCoil(CoilID).FanType = FanSpeedCtrlType::ConstantSpeedLinear;
    2203           0 :             } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "VariableSpeed")) {
    2204           0 :                 WarehouseCoil(CoilID).FanType = FanSpeedCtrlType::VariableSpeed;
    2205           0 :             } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "TwoSpeed")) {
    2206           0 :                 WarehouseCoil(CoilID).FanType = FanSpeedCtrlType::TwoSpeed;
    2207             :             } else {
    2208           0 :                 ShowSevereError(state,
    2209           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", invalid  " +
    2210           0 :                                     cAlphaFieldNames(AlphaNum) + "=\"" + Alphas(AlphaNum) + "\".");
    2211           0 :                 ErrorsFound = true;
    2212             :             } // fan control type
    2213             : 
    2214          83 :             ++NumNum; // N11
    2215          83 :             if (!lNumericBlanks(NumNum) && Numbers(NumNum) > 0.0) {
    2216          83 :                 WarehouseCoil(CoilID).RatedFanPower = Numbers(NumNum);
    2217             :             } else {
    2218           0 :                 ShowSevereError(state,
    2219           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", " +
    2220           0 :                                     cNumericFieldNames(NumNum) + " was not input or was less than 0 ");
    2221           0 :                 ErrorsFound = true;
    2222             :             } // coil fan power
    2223             : 
    2224          83 :             ++NumNum; // N12
    2225          83 :             if (!lNumericBlanks(NumNum) && Numbers(NumNum) > 0.0) {
    2226          83 :                 WarehouseCoil(CoilID).RatedAirVolumeFlow = Numbers(NumNum);
    2227             :             } else {
    2228           0 :                 ShowSevereError(state,
    2229           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", " +
    2230           0 :                                     cNumericFieldNames(NumNum) + " is required and was not input or was less than 0  ");
    2231             :             } // air volume flow
    2232             : 
    2233          83 :             ++NumNum;                                       // N13
    2234          83 :             WarehouseCoil(CoilID).FanMinAirFlowRatio = 0.2; // default value
    2235          83 :             if (!lNumericBlanks(NumNum) && Numbers(NumNum) > 0.0) WarehouseCoil(CoilID).FanMinAirFlowRatio = Numbers(NumNum);
    2236             : 
    2237             :             // Input defrost type
    2238          83 :             ++AlphaNum; // A8
    2239          83 :             if (lAlphaBlanks(AlphaNum) || UtilityRoutines::SameString(Alphas(AlphaNum), "Electric")) {
    2240          82 :                 WarehouseCoil(CoilID).defrostType = DefrostType::Elec;
    2241           1 :             } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "HotFluid")) {
    2242           1 :                 WarehouseCoil(CoilID).defrostType = DefrostType::Fluid;
    2243           0 :             } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "None")) {
    2244           0 :                 WarehouseCoil(CoilID).defrostType = DefrostType::None;
    2245           0 :             } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "OffCycle")) {
    2246           0 :                 WarehouseCoil(CoilID).defrostType = DefrostType::OffCycle;
    2247             :             } else {
    2248           0 :                 ShowSevereError(state,
    2249           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", invalid  " +
    2250           0 :                                     cAlphaFieldNames(AlphaNum) + "=\"" + Alphas(AlphaNum) + "\".");
    2251           0 :                 ErrorsFound = true;
    2252             :             } // defrost type
    2253             : 
    2254          83 :             ++AlphaNum; // A9
    2255          83 :             if (lAlphaBlanks(AlphaNum) || UtilityRoutines::SameString(Alphas(AlphaNum), "TimeSchedule")) {
    2256          82 :                 WarehouseCoil(CoilID).DefrostControlType = DefrostCtrlType::Sched;
    2257           1 :             } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "TemperatureTermination")) {
    2258           1 :                 WarehouseCoil(CoilID).DefrostControlType = DefrostCtrlType::TempTerm;
    2259             :             } else {
    2260           0 :                 ShowSevereError(state,
    2261           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", invalid  " +
    2262           0 :                                     cAlphaFieldNames(AlphaNum) + " not found: " + Alphas(AlphaNum));
    2263           0 :                 ErrorsFound = true;
    2264             :             } // defrost control type
    2265             : 
    2266             :             // convert defrost schedule name to pointer
    2267          83 :             ++AlphaNum; // A10
    2268          83 :             WarehouseCoil(CoilID).DefrostSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(AlphaNum));
    2269          83 :             if (WarehouseCoil(CoilID).DefrostSchedPtr == 0) {
    2270           0 :                 ShowSevereError(state,
    2271           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", invalid  " +
    2272           0 :                                     cAlphaFieldNames(AlphaNum) + " not found: " + Alphas(AlphaNum));
    2273           0 :                 ErrorsFound = true;
    2274             :             } else { //   check defrost schedule for values between 0 and 1
    2275          83 :                 if (!ScheduleManager::CheckScheduleValueMinMax(state, WarehouseCoil(CoilID).DefrostSchedPtr, ">=", 0.0, "<=", 1.0)) {
    2276           0 :                     ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + " = \"" + WarehouseCoil(CoilID).Name + "\"");
    2277           0 :                     ShowContinueError(state, "Error found in " + cAlphaFieldNames(AlphaNum) + '=' + Alphas(AlphaNum));
    2278           0 :                     ShowContinueError(state, "schedule values must be (>=0., <=1.)");
    2279           0 :                     ErrorsFound = true;
    2280             :                 } // checkschedulevalueMinMax
    2281             :             }     // check for valid schedule name
    2282             : 
    2283             :             // convert defrost drip-down schedule name to pointer
    2284             :             // some defrost types do not use drip-down schedules, use same defrost schedule pointer in that case
    2285          83 :             ++AlphaNum; // A11
    2286          83 :             if (!lAlphaBlanks(AlphaNum)) {
    2287          83 :                 WarehouseCoil(CoilID).DefrostDripDownSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(AlphaNum));
    2288          83 :                 if (WarehouseCoil(CoilID).DefrostDripDownSchedPtr == 0) {
    2289           0 :                     ShowSevereError(state,
    2290           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", invalid  " +
    2291           0 :                                         cAlphaFieldNames(AlphaNum) + " not found: " + Alphas(AlphaNum));
    2292           0 :                     ErrorsFound = true;
    2293             :                 } else { // check schedule for values between 0 and 1
    2294          83 :                     if (!ScheduleManager::CheckScheduleValueMinMax(state, WarehouseCoil(CoilID).DefrostDripDownSchedPtr, ">=", 0.0, "<=", 1.0)) {
    2295           0 :                         ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\"");
    2296           0 :                         ShowContinueError(state, "Error found in " + cAlphaFieldNames(AlphaNum) + " = " + Alphas(AlphaNum));
    2297           0 :                         ShowContinueError(state, "schedule values must be (>=0., <=1.)");
    2298           0 :                         ErrorsFound = true;
    2299             :                     } // Check schedule value between 0 and 1
    2300             :                 }     // Check if drip down schedule name is valid
    2301             :             } else {  // .not. lAlphaBlanks  so use drip down schedule for defrost
    2302           0 :                 WarehouseCoil(CoilID).DefrostDripDownSchedPtr = WarehouseCoil(CoilID).DefrostSchedPtr;
    2303             :             } // .not. lAlphaBlanks
    2304             : 
    2305          83 :             ++NumNum; // N14
    2306          83 :             if (WarehouseCoil(CoilID).defrostType == DefrostType::OffCycle || WarehouseCoil(CoilID).defrostType == DefrostType::None) {
    2307           0 :                 WarehouseCoil(CoilID).DefrostCapacity = 0.0;
    2308             :                 // Don't even need to read Defrost capacity for those two defrost types.
    2309             :             } else { // have electric or hot gas/brine defrost
    2310          83 :                 if ((lNumericBlanks(NumNum)) || (Numbers(NumNum) <= 0.0)) {
    2311           0 :                     ShowSevereError(state,
    2312           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", " +
    2313           0 :                                         cNumericFieldNames(NumNum) + " must be input and greater than or equal to 0 W for " +
    2314           0 :                                         cAlphaFieldNames(AlphaNum) + ' ' + Alphas(AlphaNum));
    2315           0 :                     ErrorsFound = true;
    2316             :                 } else {
    2317          83 :                     WarehouseCoil(CoilID).DefrostCapacity = Numbers(NumNum);
    2318             :                 } // Blank  or negative Defrost Capacity
    2319             : 
    2320             :                 // defaults for defrost energy fraction are 0.7 for elec defrost and 0.3 for warm fluid
    2321             :                 // note this value is only used for temperature terminated defrost control type
    2322          83 :                 if (WarehouseCoil(CoilID).defrostType == DefrostType::Elec) WarehouseCoil(CoilID).DefEnergyFraction = 0.7;
    2323          83 :                 if (WarehouseCoil(CoilID).defrostType == DefrostType::Fluid) WarehouseCoil(CoilID).DefEnergyFraction = 0.3;
    2324             : 
    2325          83 :                 ++NumNum; // N15
    2326          83 :                 if (!lNumericBlanks(NumNum)) {
    2327           1 :                     if ((Numbers(NumNum) > 1.0) || (Numbers(NumNum) < 0.0)) {
    2328           0 :                         ShowWarningError(state,
    2329           0 :                                          std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", " +
    2330           0 :                                              cNumericFieldNames(NumNum) + " must be between 0 and 1, default values will be used.");
    2331             :                     } else {
    2332           1 :                         WarehouseCoil(CoilID).DefEnergyFraction = Numbers(NumNum);
    2333             :                     } // number out of range
    2334             :                 }     // lnumericblanks
    2335             :             }         // defrost type
    2336             : 
    2337          83 :             ++AlphaNum; // A12
    2338          83 :             if (lAlphaBlanks(AlphaNum) || UtilityRoutines::SameString(Alphas(AlphaNum), "Middle")) {
    2339          83 :                 WarehouseCoil(CoilID).VerticalLocation = VerticalLoc::Middle; // default position
    2340           0 :             } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "Ceiling")) {
    2341           0 :                 WarehouseCoil(CoilID).VerticalLocation = VerticalLoc::Ceiling;
    2342           0 :             } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "Floor")) {
    2343           0 :                 WarehouseCoil(CoilID).VerticalLocation = VerticalLoc::Floor;
    2344             :             } else {
    2345           0 :                 ShowSevereError(state,
    2346           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", invalid  " +
    2347           0 :                                     cAlphaFieldNames(AlphaNum) + " not found: " + Alphas(AlphaNum));
    2348           0 :                 ErrorsFound = true;
    2349             :             } // Vertical location class
    2350             : 
    2351          83 :             ++NumNum; // N16
    2352          83 :             WarehouseCoil(CoilID).DesignRefrigInventory = 0.0;
    2353          83 :             if (!lNumericBlanks(NumNum)) WarehouseCoil(CoilID).DesignRefrigInventory = Numbers(NumNum);
    2354             :         } // NumRefrigAirChillers
    2355             :     }     // NumRefrigerationAirChillers > 0
    2356             : 
    2357             :     //************ START Warehouse Coil SET INPUT **************
    2358             :     // One Set allowed per zone, but indiv coils within zone can be served by different compressor/condenser systems
    2359             : 
    2360         771 :     if (state.dataRefrigCase->NumRefrigChillerSets > 0) {
    2361             : 
    2362           1 :         state.dataRefrigCase->CheckChillerSetName.dimension(state.dataRefrigCase->NumRefrigChillerSets, true);
    2363             : 
    2364           1 :         CurrentModuleObject = "ZoneHVAC:RefrigerationChillerSet";
    2365          11 :         for (int SetID = 1; SetID <= state.dataRefrigCase->NumRefrigChillerSets; ++SetID) {
    2366          10 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
    2367             :                                                                      CurrentModuleObject,
    2368             :                                                                      SetID,
    2369             :                                                                      Alphas,
    2370             :                                                                      NumAlphas,
    2371             :                                                                      Numbers,
    2372             :                                                                      NumNumbers,
    2373             :                                                                      IOStatus,
    2374             :                                                                      lNumericBlanks,
    2375             :                                                                      lAlphaBlanks,
    2376             :                                                                      cAlphaFieldNames,
    2377             :                                                                      cNumericFieldNames);
    2378          10 :             AlphaNum = 1;
    2379          10 :             UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound);
    2380             : 
    2381          10 :             AirChillerSet(SetID).Name = Alphas(AlphaNum);
    2382             : 
    2383          10 :             AlphaNum = 2;
    2384          10 :             if (!lAlphaBlanks(AlphaNum)) {
    2385           0 :                 AirChillerSet(SetID).SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(AlphaNum)); // convert schedule name to pointer
    2386           0 :                 if (AirChillerSet(SetID).SchedPtr == 0) {
    2387           0 :                     ShowSevereError(state,
    2388           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + AirChillerSet(SetID).Name + "\", invalid  " +
    2389           0 :                                         cAlphaFieldNames(AlphaNum) + " not found: " + Alphas(AlphaNum));
    2390           0 :                     ErrorsFound = true;
    2391             :                 }    // ptr == 0
    2392             :             } else { // no schedule specified
    2393          10 :                 AirChillerSet(SetID).SchedPtr = AlwaysOn;
    2394             :             } // not blank
    2395             : 
    2396             :             //   check availability schedule for values between 0 and 1
    2397          10 :             if (AirChillerSet(SetID).SchedPtr > 0) {
    2398           0 :                 if (!ScheduleManager::CheckScheduleValueMinMax(state, AirChillerSet(SetID).SchedPtr, ">=", 0.0, "<=", 1.0)) {
    2399           0 :                     ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + AirChillerSet(SetID).Name + "\"");
    2400           0 :                     ShowContinueError(state, "Error found in " + cAlphaFieldNames(AlphaNum) + " = " + Alphas(AlphaNum));
    2401           0 :                     ShowContinueError(state, "schedule values must be (>=0., <=1.)");
    2402           0 :                     ErrorsFound = true;
    2403             :                 }
    2404             :             }
    2405             : 
    2406          10 :             ++AlphaNum;
    2407          10 :             AirChillerSet(SetID).ZoneName = Alphas(AlphaNum);
    2408          10 :             AirChillerSet(SetID).ZoneNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), state.dataHeatBal->Zone);
    2409             : 
    2410          10 :             if (AirChillerSet(SetID).ZoneNum == 0) {
    2411           0 :                 ShowSevereError(state,
    2412           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + AirChillerSet(SetID).Name + "\", invalid  " +
    2413           0 :                                     cAlphaFieldNames(AlphaNum) + " not valid: " + Alphas(AlphaNum));
    2414           0 :                 ErrorsFound = true;
    2415             :             }
    2416          10 :             AirChillerSet(SetID).ZoneNodeNum = DataZoneEquipment::GetSystemNodeNumberForZone(state, AirChillerSet(SetID).ZoneNum);
    2417          10 :             if (AirChillerSet(SetID).ZoneNodeNum == 0) {
    2418           0 :                 ShowSevereError(state,
    2419           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + AirChillerSet(SetID).Name +
    2420           0 :                                     "\" System Node Number not found for " + cAlphaFieldNames(AlphaNum) + " = " + Alphas(AlphaNum));
    2421           0 :                 ShowContinueError(state,
    2422             :                                   ".. Refrigeration chillers must reference a controlled Zone (appear in a ZoneHVAC:EquipmentConnections object.");
    2423           0 :                 ErrorsFound = true;
    2424             :             }
    2425          10 :             state.dataRefrigCase->RefrigPresentInZone(AirChillerSet(SetID).ZoneNum) = true;
    2426             : 
    2427          10 :             ++AlphaNum;
    2428          10 :             if (!lAlphaBlanks(AlphaNum)) {
    2429           0 :                 ShowMessage(state,
    2430           0 :                             std::string{RoutineName} + CurrentModuleObject + "=\"" + AirChillerSet(SetID).Name + "\" " + cAlphaFieldNames(AlphaNum) +
    2431             :                                 " is not used. This is not an error.  Energy is exchanged directly with the zone independent of any air system. ");
    2432             :                 // Node identification reserved for future use.  Currently exchange energy directly with zone outside any air system
    2433             :                 // AirChillerSet(SetID)%NodeNumInlet = &
    2434             :                 //       NodeInputManager::GetOnlySingleNode(state, Alphas(AlphaNum),ErrorsFound,TRIM(CurrentModuleObject), &
    2435             :                 //                    AirChillerSet(SetID)%Name,DataLoopNode::NodeFluidType::Air,DataLoopNode::NodeConnectionType::Inlet,1,DataLoopNode::ObjectIsNotParent)
    2436             :             }
    2437             : 
    2438          10 :             ++AlphaNum;
    2439          10 :             if (!lAlphaBlanks(AlphaNum)) {
    2440           0 :                 ShowMessage(state,
    2441           0 :                             std::string{RoutineName} + CurrentModuleObject + "=\"" + AirChillerSet(SetID).Name + "\" " + cAlphaFieldNames(AlphaNum) +
    2442             :                                 " is not used. This is not an error.  Energy is exchanged directly with the zone independent of any air system. ");
    2443             :                 // Node identification reserved for future use.  Currently exchange energy directly with zone outside any air system
    2444             :                 // AirChillerSet(SetID)%NodeNumOutlet = &
    2445             :                 //         NodeInputManager::GetOnlySingleNode(state, Alphas(AlphaNum),ErrorsFound,TRIM(CurrentModuleObject), &
    2446             :                 //                      AirChillerSet(SetID)%Name,DataLoopNode::NodeFluidType::Air,DataLoopNode::NodeConnectionType::Outlet,1,DataLoopNode::ObjectIsNotParent)
    2447             :             }
    2448             : 
    2449             :             // An extensible list is used to enter the individual names of each chiller in the set.
    2450             :             // These chillers will be dispatched in this list order to meet the required zone load
    2451          10 :             int NumChillersInSet = NumAlphas - AlphaNum;
    2452          10 :             int AlphaStartList = AlphaNum; //+ 1
    2453          10 :             AirChillerSet(SetID).NumCoils = NumChillersInSet;
    2454          10 :             if (!allocated(AirChillerSet(SetID).CoilNum)) AirChillerSet(SetID).CoilNum.allocate(NumChillersInSet);
    2455          93 :             for (int ChillerIndex = 1; ChillerIndex <= NumChillersInSet; ++ChillerIndex) {
    2456          83 :                 int AlphaListNum = AlphaStartList + ChillerIndex;
    2457          83 :                 if (!lAlphaBlanks(AlphaListNum)) {
    2458          83 :                     int CoilNum = UtilityRoutines::FindItemInList(Alphas(AlphaListNum), WarehouseCoil);
    2459          83 :                     if (CoilNum == 0) {
    2460           0 :                         ShowSevereError(state,
    2461           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + AirChillerSet(SetID).Name + "\", has an invalid " +
    2462           0 :                                             cAlphaFieldNames(AlphaListNum) + " defined as " + Alphas(AlphaListNum));
    2463           0 :                         ErrorsFound = true;
    2464             :                     } // == 0
    2465          83 :                     AirChillerSet(SetID).CoilNum(ChillerIndex) = CoilNum;
    2466          83 :                     WarehouseCoil(CoilNum).ZoneName = AirChillerSet(SetID).ZoneName;
    2467          83 :                     WarehouseCoil(CoilNum).ZoneNum = AirChillerSet(SetID).ZoneNum;
    2468          83 :                     WarehouseCoil(CoilNum).ZoneNodeNum = AirChillerSet(SetID).ZoneNodeNum;
    2469             :                 } // ! = alphablanks
    2470             :             }     // CoilID over NumChillersInSet
    2471             :         }         // NumChillerSets
    2472             :     }             // NumChillerSets > 0
    2473             :     //************* End Air Chiller Sets
    2474             : 
    2475             :     //**** Read CaseAndWalkIn Lists **********************************************************
    2476         771 :     if (state.dataRefrigCase->NumSimulationCaseAndWalkInLists > 0) {
    2477          27 :         CurrentModuleObject = "Refrigeration:CaseAndWalkInList";
    2478          89 :         for (int ListNum = 1; ListNum <= state.dataRefrigCase->NumSimulationCaseAndWalkInLists; ++ListNum) {
    2479          62 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
    2480             :                                                                      CurrentModuleObject,
    2481             :                                                                      ListNum,
    2482             :                                                                      Alphas,
    2483             :                                                                      NumAlphas,
    2484             :                                                                      Numbers,
    2485             :                                                                      NumNumbers,
    2486             :                                                                      IOStatus,
    2487             :                                                                      lNumericBlanks,
    2488             :                                                                      lAlphaBlanks,
    2489             :                                                                      cAlphaFieldNames,
    2490             :                                                                      cNumericFieldNames);
    2491          62 :             UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound);
    2492          62 :             CaseAndWalkInList(ListNum).Name = Alphas(1);
    2493             : 
    2494             :             // CaseAndWalkInList alphas include CaseAndWalkInList name and one name for each Case or WalkIn in list
    2495             :             // below allocates larger than needed (each allocated to sum of both), but avoids two loops through input fields
    2496          62 :             int NumTotalLoadsOnList = NumAlphas - 1;
    2497          62 :             if (!allocated(CaseAndWalkInList(ListNum).WalkInItemNum)) CaseAndWalkInList(ListNum).WalkInItemNum.allocate(NumTotalLoadsOnList);
    2498          62 :             if (!allocated(CaseAndWalkInList(ListNum).CaseItemNum)) CaseAndWalkInList(ListNum).CaseItemNum.allocate(NumTotalLoadsOnList);
    2499          62 :             if (!allocated(CaseAndWalkInList(ListNum).CoilItemNum)) CaseAndWalkInList(ListNum).CoilItemNum.allocate(NumTotalLoadsOnList);
    2500             : 
    2501          62 :             int NumCasesOnList = 0;
    2502          62 :             int NumCoilsOnList = 0;
    2503          62 :             int NumWalkInsOnList = 0;
    2504          62 :             int LoadCount = 0;
    2505         307 :             for (int NumLoad = 1; NumLoad <= NumTotalLoadsOnList; ++NumLoad) {
    2506         245 :                 int AlphaListNum = 1 + NumLoad;
    2507         245 :                 if (!lAlphaBlanks(AlphaListNum)) {
    2508         245 :                     ++LoadCount;
    2509         245 :                     int LoadWalkInNum = 0;
    2510         245 :                     int LoadCaseNum = 0;
    2511         245 :                     int LoadCoilNum = 0;
    2512         245 :                     if (state.dataRefrigCase->NumSimulationWalkIns > 0) LoadWalkInNum = UtilityRoutines::FindItemInList(Alphas(AlphaListNum), WalkIn);
    2513         245 :                     if (state.dataRefrigCase->NumSimulationCases > 0) LoadCaseNum = UtilityRoutines::FindItemInList(Alphas(AlphaListNum), RefrigCase);
    2514         245 :                     if (state.dataRefrigCase->NumSimulationRefrigAirChillers > 0)
    2515          83 :                         LoadCoilNum = UtilityRoutines::FindItemInList(Alphas(AlphaListNum), WarehouseCoil);
    2516         245 :                     if ((LoadWalkInNum == 0) && (LoadCaseNum == 0) && (LoadCoilNum == 0)) {
    2517           0 :                         ShowSevereError(state,
    2518           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + cAlphaFieldNames(AlphaListNum) +
    2519           0 :                                             "\", has an invalid value of " + Alphas(AlphaListNum));
    2520           0 :                         ErrorsFound = true;
    2521         245 :                     } else if ((LoadWalkInNum != 0) && (LoadCaseNum != 0) && (LoadCoilNum != 0)) {
    2522           0 :                         ShowSevereError(state,
    2523           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + cAlphaFieldNames(AlphaListNum) + "\", " +
    2524           0 :                                             Alphas(AlphaListNum) + " Case and WalkIns and Refrigerated Coils cannot have the same name.");
    2525           0 :                         ErrorsFound = true;
    2526         245 :                     } else if (LoadWalkInNum != 0) {
    2527          15 :                         ++NumWalkInsOnList;
    2528          15 :                         CaseAndWalkInList(ListNum).WalkInItemNum(NumWalkInsOnList) = LoadWalkInNum;
    2529         230 :                     } else if (LoadCaseNum != 0) {
    2530         147 :                         ++NumCasesOnList;
    2531         147 :                         CaseAndWalkInList(ListNum).CaseItemNum(NumCasesOnList) = LoadCaseNum;
    2532          83 :                     } else if (LoadCoilNum != 0) {
    2533          83 :                         ++NumCoilsOnList;
    2534          83 :                         CaseAndWalkInList(ListNum).CoilItemNum(NumCoilsOnList) = LoadCoilNum;
    2535             :                     }
    2536             :                 } // lAlphaBlanks
    2537             :             }     // Num Total Loads on List
    2538          62 :             if (LoadCount == 0) {
    2539           0 :                 ShowSevereError(state,
    2540           0 :                                 std::string{RoutineName} + CurrentModuleObject + ", \"" + CaseAndWalkInList(ListNum).Name +
    2541             :                                     "\" : degenerate list All entries were blank.");
    2542           0 :                 ErrorsFound = true;
    2543             :             } // loadcount == 0
    2544          62 :             CaseAndWalkInList(ListNum).NumCases = NumCasesOnList;
    2545          62 :             CaseAndWalkInList(ListNum).NumCoils = NumCoilsOnList;
    2546          62 :             CaseAndWalkInList(ListNum).NumWalkIns = NumWalkInsOnList;
    2547             :         } // ListNum=1,NumSimulationCaseAndWalkInLists
    2548             :     }     //(NumSimulationCaseAndWalkInLists > 0)
    2549             : 
    2550             :     //**** End read CaseAndWalkIn Lists **********************************************************
    2551             : 
    2552             :     //************** Start RefrigerationRacks
    2553             : 
    2554         771 :     if (state.dataRefrigCase->NumRefrigeratedRacks > 0) {
    2555             : 
    2556          30 :         CurrentModuleObject = "Refrigeration:CompressorRack";
    2557             : 
    2558          89 :         for (int RackNum = 1; RackNum <= state.dataRefrigCase->NumRefrigeratedRacks; ++RackNum) {
    2559             : 
    2560          59 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
    2561             :                                                                      CurrentModuleObject,
    2562             :                                                                      RackNum,
    2563             :                                                                      Alphas,
    2564             :                                                                      NumAlphas,
    2565             :                                                                      Numbers,
    2566             :                                                                      NumNumbers,
    2567             :                                                                      IOStatus,
    2568             :                                                                      lNumericBlanks,
    2569             :                                                                      lAlphaBlanks,
    2570             :                                                                      cAlphaFieldNames,
    2571             :                                                                      cNumericFieldNames);
    2572          59 :             UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound);
    2573             : 
    2574          59 :             RefrigRack(RackNum).Name = Alphas(1);
    2575          59 :             RefrigRack(RackNum).MyIdx = RackNum;
    2576          59 :             state.dataHeatBal->HeatReclaimRefrigeratedRack(RackNum).Name = Alphas(1);
    2577          59 :             state.dataHeatBal->HeatReclaimRefrigeratedRack(RackNum).SourceType = CurrentModuleObject;
    2578          59 :             if (UtilityRoutines::SameString(Alphas(2), "Outdoors")) {
    2579          32 :                 RefrigRack(RackNum).HeatRejectionLocation = HeatRejLocation::Outdoors;
    2580          27 :             } else if (UtilityRoutines::SameString(Alphas(2), "Zone")) {
    2581          27 :                 RefrigRack(RackNum).HeatRejectionLocation = HeatRejLocation::Zone;
    2582             :                 // don't need to set RefrigPresentInZone to .TRUE. here because only allowed to reject heat to zone
    2583             :                 // holding all served cases,  so already set when case read in
    2584             :             } else {
    2585           0 :                 RefrigRack(RackNum).HeatRejectionLocation = HeatRejLocation::Outdoors;
    2586           0 :                 ShowWarningError(state,
    2587           0 :                                  CurrentModuleObject + ", " + cAlphaFieldNames(1) + " = \"" + RefrigRack(RackNum).Name +
    2588           0 :                                      "\": " + cAlphaFieldNames(2) + " defined as " + Alphas(2) + " not found. Will assume " + cAlphaFieldNames(2) +
    2589             :                                      " is OUTDOORS and simulation continues.");
    2590             :             }
    2591             : 
    2592          59 :             RefrigRack(RackNum).RatedCOP = Numbers(1);
    2593             : 
    2594          59 :             if (RefrigRack(RackNum).RatedCOP <= 0.0) {
    2595           0 :                 ShowSevereError(state,
    2596           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigRack(RackNum).Name + "\" " + cNumericFieldNames(1) +
    2597             :                                     " must be greater than 0.0");
    2598           0 :                 ErrorsFound = true;
    2599             :             }
    2600             : 
    2601          59 :             RefrigRack(RackNum).COPFTempPtr = Curve::GetCurveIndex(state, Alphas(3)); // convert curve name to number
    2602          59 :             if (RefrigRack(RackNum).COPFTempPtr == 0) {
    2603           0 :                 ShowSevereError(state,
    2604           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigRack(RackNum).Name + "\", invalid  " +
    2605           0 :                                     cAlphaFieldNames(3) + " not found:" + Alphas(3));
    2606           0 :                 ErrorsFound = true;
    2607             :             }
    2608             : 
    2609         177 :             ErrorsFound |= Curve::CheckCurveDims(state,
    2610          59 :                                                  RefrigRack(RackNum).COPFTempPtr, // Curve index
    2611             :                                                  {1},                             // Valid dimensions
    2612             :                                                  RoutineName,                     // Routine name
    2613             :                                                  CurrentModuleObject,             // Object Type
    2614          59 :                                                  RefrigRack(RackNum).Name,        // Object Name
    2615          59 :                                                  cAlphaFieldNames(3));            // Field Name
    2616             : 
    2617          59 :             RefrigRack(RackNum).CondenserFanPower = Numbers(2);
    2618          59 :             if (Numbers(2) < 0.0) {
    2619           0 :                 ShowSevereError(state,
    2620           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigRack(RackNum).Name + "\" " + cNumericFieldNames(2) +
    2621             :                                     " must be greater than or equal to 0 Watts.");
    2622           0 :                 ErrorsFound = true;
    2623             :             }
    2624             : 
    2625          59 :             RefrigRack(RackNum).TotCondFTempPtr = Curve::GetCurveIndex(state, Alphas(4)); // convert curve name to number
    2626          59 :             if ((!lAlphaBlanks(4)) && RefrigRack(RackNum).TotCondFTempPtr == 0) {
    2627           0 :                 ShowSevereError(state,
    2628           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigRack(RackNum).Name + "\", invalid  " +
    2629           0 :                                     cAlphaFieldNames(4) + " not found:" + Alphas(4));
    2630           0 :                 ErrorsFound = true;
    2631             :             }
    2632             : 
    2633          59 :             if (!lAlphaBlanks(4)) {
    2634          90 :                 ErrorsFound |= Curve::CheckCurveDims(state,
    2635          30 :                                                      RefrigRack(RackNum).TotCondFTempPtr, // Curve index
    2636             :                                                      {1},                                 // Valid dimensions
    2637             :                                                      RoutineName,                         // Routine name
    2638             :                                                      CurrentModuleObject,                 // Object Type
    2639          30 :                                                      RefrigRack(RackNum).Name,            // Object Name
    2640          30 :                                                      cAlphaFieldNames(4));                // Field Name
    2641             :             }
    2642             : 
    2643          59 :             if (UtilityRoutines::SameString(Alphas(5), "EvaporativelyCooled")) {
    2644           2 :                 RefrigRack(RackNum).CondenserType = DataHeatBalance::RefrigCondenserType::Evap;
    2645           2 :                 if (RefrigRack(RackNum).HeatRejectionLocation == HeatRejLocation::Zone) {
    2646           0 :                     ShowWarningError(state,
    2647           0 :                                      CurrentModuleObject + "=\"" + RefrigRack(RackNum).Name + "\" Evap cooled " + cAlphaFieldNames(5) +
    2648           0 :                                          " not available with " + cAlphaFieldNames(2) + " = Zone.");
    2649           0 :                     ShowContinueError(state, cAlphaFieldNames(5) + " reset to Air Cooled and simulation continues.");
    2650           0 :                     RefrigRack(RackNum).CondenserType = DataHeatBalance::RefrigCondenserType::Air;
    2651             :                 }
    2652          57 :             } else if (UtilityRoutines::SameString(Alphas(5), "WaterCooled")) {
    2653           1 :                 RefrigRack(RackNum).CondenserType = DataHeatBalance::RefrigCondenserType::Water;
    2654           1 :                 if (RefrigRack(RackNum).HeatRejectionLocation == HeatRejLocation::Zone) {
    2655           0 :                     ShowWarningError(state,
    2656           0 :                                      CurrentModuleObject + "=\"" + RefrigRack(RackNum).Name + "\" Water cooled " + cAlphaFieldNames(5) +
    2657           0 :                                          " not available with " + cAlphaFieldNames(2) + " = Zone.");
    2658           0 :                     ShowContinueError(state, cAlphaFieldNames(5) + " reset to Air Cooled and simulation continues.");
    2659           0 :                     RefrigRack(RackNum).CondenserType = DataHeatBalance::RefrigCondenserType::Air;
    2660             :                 }
    2661             :             } else {
    2662          56 :                 RefrigRack(RackNum).CondenserType = DataHeatBalance::RefrigCondenserType::Air;
    2663             :             }
    2664             :             // Get water-cooled condenser input, if applicable
    2665          59 :             if (RefrigRack(RackNum).CondenserType == DataHeatBalance::RefrigCondenserType::Water) {
    2666           1 :                 RefrigRack(RackNum).InletNode = NodeInputManager::GetOnlySingleNode(state,
    2667           1 :                                                                                     Alphas(6),
    2668             :                                                                                     ErrorsFound,
    2669             :                                                                                     DataLoopNode::ConnectionObjectType::RefrigerationCompressorRack,
    2670           1 :                                                                                     Alphas(1),
    2671             :                                                                                     DataLoopNode::NodeFluidType::Water,
    2672             :                                                                                     DataLoopNode::ConnectionType::Inlet,
    2673             :                                                                                     NodeInputManager::CompFluidStream::Primary,
    2674           1 :                                                                                     DataLoopNode::ObjectIsNotParent);
    2675           1 :                 RefrigRack(RackNum).OutletNode = NodeInputManager::GetOnlySingleNode(state,
    2676           1 :                                                                                      Alphas(7),
    2677             :                                                                                      ErrorsFound,
    2678             :                                                                                      DataLoopNode::ConnectionObjectType::RefrigerationCompressorRack,
    2679           1 :                                                                                      Alphas(1),
    2680             :                                                                                      DataLoopNode::NodeFluidType::Water,
    2681             :                                                                                      DataLoopNode::ConnectionType::Outlet,
    2682             :                                                                                      NodeInputManager::CompFluidStream::Primary,
    2683           1 :                                                                                      DataLoopNode::ObjectIsNotParent);
    2684             :                 // Check node connections
    2685           1 :                 BranchNodeConnections::TestCompSet(state, CurrentModuleObject, Alphas(1), Alphas(6), Alphas(7), "RefrigRack Nodes");
    2686             :                 // Get loop flow type
    2687           1 :                 if (UtilityRoutines::SameString(Alphas(8), "VariableFlow")) {
    2688           1 :                     RefrigRack(RackNum).FlowType = CndsrFlowType::VariableFlow;
    2689           0 :                 } else if (UtilityRoutines::SameString(Alphas(8), "ConstantFlow")) {
    2690           0 :                     RefrigRack(RackNum).FlowType = CndsrFlowType::ConstantFlow;
    2691             :                 } else {
    2692           0 :                     ShowSevereError(state,
    2693           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigRack(RackNum).Name + "\", invalid  " +
    2694           0 :                                         cAlphaFieldNames(8) + " not recognized: " + Alphas(8));
    2695           0 :                     ShowContinueError(state, "Check input value choices.");
    2696           0 :                     ErrorsFound = true;
    2697             :                 }
    2698             :                 // Get outlet temperature schedule for variable flow case
    2699           1 :                 if (RefrigRack(RackNum).FlowType == CndsrFlowType::VariableFlow) {
    2700           1 :                     if (lAlphaBlanks(9)) {
    2701           0 :                         RefrigRack(RackNum).OutletTempSchedPtr = 0;
    2702             :                     } else {
    2703           1 :                         RefrigRack(RackNum).OutletTempSchedPtr =
    2704           1 :                             ScheduleManager::GetScheduleIndex(state, Alphas(9)); // convert schedule name to pointer
    2705             :                     }
    2706           1 :                     if (RefrigRack(RackNum).OutletTempSchedPtr == 0) {
    2707           0 :                         ShowSevereError(state,
    2708           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigRack(RackNum).Name + "\", invalid  " +
    2709           0 :                                             cAlphaFieldNames(9) + " : " + Alphas(9));
    2710           0 :                         ShowContinueError(state, "A schedule with this name is not defined in this input data file.");
    2711           0 :                         ErrorsFound = true;
    2712             :                     }
    2713             :                 }
    2714             :                 // Get volumetric flow rate if applicable
    2715           1 :                 if (RefrigRack(RackNum).FlowType == CndsrFlowType::ConstantFlow) {
    2716           0 :                     RefrigRack(RackNum).DesVolFlowRate = Numbers(3);
    2717           0 :                     RefrigRack(RackNum).VolFlowRate = Numbers(3);
    2718             :                 }
    2719             :                 // Get maximum flow rates
    2720           1 :                 RefrigRack(RackNum).VolFlowRateMax = Numbers(4);
    2721             : 
    2722             :                 // Check constant flow for max violation, if applicable
    2723           1 :                 if (RefrigRack(RackNum).FlowType == CndsrFlowType::ConstantFlow && RefrigRack(RackNum).VolFlowRate > Numbers(4)) {
    2724           0 :                     ShowSevereError(state,
    2725           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigRack(RackNum).Name + "\" " +
    2726           0 :                                         cNumericFieldNames(3) + " > " + cNumericFieldNames(4) + '.');
    2727           0 :                     ShowContinueError(state, "Revise flow rates.");
    2728           0 :                     ErrorsFound = true;
    2729             :                 }
    2730             :                 // Get max/min allowed water temps
    2731           1 :                 RefrigRack(RackNum).OutletTempMax = Numbers(5);
    2732           1 :                 RefrigRack(RackNum).InletTempMin = Numbers(6);
    2733             :                 // set flow request for plant sizing.
    2734           1 :                 PlantUtilities::RegisterPlantCompDesignFlow(state, RefrigRack(RackNum).InletNode, RefrigRack(RackNum).VolFlowRateMax);
    2735             :             } // Water cooled condenser data
    2736             : 
    2737             :             // Get evaporative cooled condenser input
    2738          59 :             if (lAlphaBlanks(10)) {
    2739          58 :                 RefrigRack(RackNum).EvapSchedPtr = 0;
    2740             :             } else {
    2741           1 :                 RefrigRack(RackNum).EvapSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(10)); // convert schedule name to pointer
    2742             :                 //   check availability schedule for values >= 0
    2743           1 :                 if (RefrigRack(RackNum).EvapSchedPtr > 0) {
    2744           1 :                     if (!ScheduleManager::CheckScheduleValueMinMax(state, RefrigRack(RackNum).EvapSchedPtr, ">=", 0.0)) {
    2745           0 :                         ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigRack(RackNum).Name + "\" .");
    2746           0 :                         ShowContinueError(state, "Error found in " + cAlphaFieldNames(10) + " = " + Alphas(10));
    2747           0 :                         ShowContinueError(state, "schedule values must be (>=0.).");
    2748           0 :                         ErrorsFound = true;
    2749             :                     }
    2750             :                 } else {
    2751           0 :                     ShowSevereError(state,
    2752           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigRack(RackNum).Name + "\", invalid  " +
    2753           0 :                                         cAlphaFieldNames(10) + " = " + Alphas(10));
    2754           0 :                     ShowContinueError(state, "A schedule with this name is not defined in this input data file.");
    2755           0 :                     ErrorsFound = true;
    2756             :                 }
    2757             :             }
    2758             : 
    2759          59 :             RefrigRack(RackNum).EvapEffect = Numbers(7);
    2760          59 :             if (RefrigRack(RackNum).EvapEffect < 0.0 || RefrigRack(RackNum).EvapEffect > 1.0) {
    2761           0 :                 ShowSevereError(state,
    2762           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigRack(RackNum).Name + "\" " + cNumericFieldNames(7) +
    2763             :                                     " cannot be less than zero or greater than 1.0.");
    2764           0 :                 ErrorsFound = true;
    2765             :             }
    2766             : 
    2767          59 :             RefrigRack(RackNum).CondenserAirFlowRate = Numbers(8);
    2768          61 :             if (RefrigRack(RackNum).CondenserType == DataHeatBalance::RefrigCondenserType::Evap && RefrigRack(RackNum).CondenserAirFlowRate <= 0.0 &&
    2769           2 :                 RefrigRack(RackNum).CondenserAirFlowRate != DataGlobalConstants::AutoCalculate) {
    2770           0 :                 ShowSevereError(state,
    2771           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigRack(RackNum).Name + "\", " + cNumericFieldNames(8) +
    2772             :                                     " cannot be less than or equal to zero.");
    2773           0 :                 ErrorsFound = true;
    2774             :             }
    2775             : 
    2776             :             //   Basin heater power as a function of temperature must be greater than or equal to 0
    2777          59 :             RefrigRack(RackNum).BasinHeaterPowerFTempDiff = Numbers(9);
    2778          59 :             if (RefrigRack(RackNum).CondenserType == DataHeatBalance::RefrigCondenserType::Evap && Numbers(9) < 0.0) {
    2779           0 :                 ShowSevereError(state,
    2780           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigRack(RackNum).Name + "\", " + cNumericFieldNames(9) +
    2781             :                                     " must be >= 0");
    2782           0 :                 ErrorsFound = true;
    2783             :             }
    2784             : 
    2785          59 :             RefrigRack(RackNum).BasinHeaterSetPointTemp = Numbers(10);
    2786          61 :             if (RefrigRack(RackNum).CondenserType == DataHeatBalance::RefrigCondenserType::Evap &&
    2787           2 :                 RefrigRack(RackNum).BasinHeaterSetPointTemp < 2.0) {
    2788           0 :                 ShowWarningError(state,
    2789           0 :                                  CurrentModuleObject + "=\"" + RefrigRack(RackNum).Name + "\", " + cNumericFieldNames(10) +
    2790             :                                      " is less than 2 deg C. Freezing could occur.");
    2791             :             }
    2792             : 
    2793          59 :             RefrigRack(RackNum).EvapPumpPower = Numbers(11);
    2794          61 :             if (RefrigRack(RackNum).CondenserType == DataHeatBalance::RefrigCondenserType::Evap && RefrigRack(RackNum).EvapPumpPower < 0.0 &&
    2795           2 :                 RefrigRack(RackNum).EvapPumpPower != DataGlobalConstants::AutoCalculate) {
    2796           0 :                 ShowSevereError(state,
    2797           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigRack(RackNum).Name + "\", " + cNumericFieldNames(11) +
    2798             :                                     " cannot be less than zero.");
    2799           0 :                 ErrorsFound = true;
    2800             :             }
    2801             : 
    2802             :             // Get Water System tank connections
    2803          59 :             RefrigRack(RackNum).SupplyTankName = Alphas(11);
    2804          59 :             if (lAlphaBlanks(11)) {
    2805          58 :                 RefrigRack(RackNum).EvapWaterSupplyMode = WaterSupply::FromMains;
    2806             :             } else {
    2807           1 :                 RefrigRack(RackNum).EvapWaterSupplyMode = WaterSupply::FromTank;
    2808           4 :                 WaterManager::SetupTankDemandComponent(state,
    2809           1 :                                                        RefrigRack(RackNum).Name,
    2810             :                                                        CurrentModuleObject,
    2811           1 :                                                        RefrigRack(RackNum).SupplyTankName,
    2812             :                                                        ErrorsFound,
    2813           1 :                                                        RefrigRack(RackNum).EvapWaterSupTankID,
    2814           1 :                                                        RefrigRack(RackNum).EvapWaterTankDemandARRID);
    2815             :             }
    2816             : 
    2817             :             // Check condenser air inlet node connection
    2818          59 :             if (lAlphaBlanks(12)) {
    2819          16 :                 RefrigRack(RackNum).OutsideAirNodeNum = 0;
    2820             :             } else {
    2821          43 :                 RefrigRack(RackNum).OutsideAirNodeNum =
    2822          86 :                     NodeInputManager::GetOnlySingleNode(state,
    2823          43 :                                                         Alphas(12),
    2824             :                                                         ErrorsFound,
    2825             :                                                         DataLoopNode::ConnectionObjectType::RefrigerationCompressorRack,
    2826          43 :                                                         Alphas(1),
    2827             :                                                         DataLoopNode::NodeFluidType::Air,
    2828             :                                                         DataLoopNode::ConnectionType::OutsideAirReference,
    2829             :                                                         NodeInputManager::CompFluidStream::Primary,
    2830          43 :                                                         DataLoopNode::ObjectIsParent);
    2831          43 :                 if (!OutAirNodeManager::CheckOutAirNodeNumber(state, RefrigRack(RackNum).OutsideAirNodeNum)) {
    2832           0 :                     ShowSevereError(state,
    2833           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigRack(RackNum).Name + "\", " +
    2834           0 :                                         cAlphaFieldNames(12) + " not found: " + Alphas(12));
    2835           0 :                     ShowContinueError(state, "...does not appear in an OutdoorAir:NodeList or as an OutdoorAir:Node.");
    2836           0 :                     ErrorsFound = true;
    2837             :                 }
    2838             :             }
    2839             : 
    2840          59 :             if (!lAlphaBlanks(13)) RefrigRack(RackNum).EndUseSubcategory = Alphas(13);
    2841             : 
    2842             :             // Read all loads on this rack: cases and walk-ins and coils
    2843          59 :             NumCases = 0;
    2844          59 :             int NumCoils = 0;
    2845          59 :             NumWalkIns = 0;
    2846          59 :             RefrigRack(RackNum).NumCases = 0;
    2847          59 :             RefrigRack(RackNum).NumCoils = 0;
    2848          59 :             RefrigRack(RackNum).NumWalkIns = 0;
    2849          59 :             RefrigRack(RackNum).TotalRackLoad = 0.0;
    2850             : 
    2851             :             //   Read display case and walkin assignments for this rack
    2852          59 :             AlphaNum = 14;
    2853          59 :             if (lAlphaBlanks(AlphaNum)) {
    2854             :                 // No cases or walkins or coils specified, ie, rack has no load
    2855           0 :                 ShowSevereError(state,
    2856           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigRack(RackNum).Name +
    2857           0 :                                     "\" : has no loads, must have at least one of: " + cAlphaFieldNames(14));
    2858           0 :                 ErrorsFound = true;
    2859             :             } else { // (.NOT. lAlphaBlanks(AlphaNum))
    2860             :                 // Entry for Alphas(AlphaNum) can be either a Case, WalkIn, Coil, or CaseAndWalkInList name
    2861          59 :                 int CaseAndWalkInListNum = 0;
    2862          59 :                 int CaseNum = 0;
    2863          59 :                 int WalkInNum = 0;
    2864          59 :                 int CoilNum = 0;
    2865          59 :                 if (state.dataRefrigCase->NumSimulationCaseAndWalkInLists > 0)
    2866          41 :                     CaseAndWalkInListNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), CaseAndWalkInList);
    2867          59 :                 if (state.dataRefrigCase->NumSimulationCases > 0) CaseNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), RefrigCase);
    2868          59 :                 if (state.dataRefrigCase->NumSimulationWalkIns > 0) WalkInNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), WalkIn);
    2869          59 :                 if (state.dataRefrigCase->NumSimulationRefrigAirChillers > 0)
    2870           0 :                     CoilNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), WarehouseCoil);
    2871          59 :                 int NumNameMatches = 0;
    2872          59 :                 if (CaseAndWalkInListNum != 0) ++NumNameMatches;
    2873          59 :                 if (CaseNum != 0) ++NumNameMatches;
    2874          59 :                 if (WalkInNum != 0) ++NumNameMatches;
    2875          59 :                 if (CoilNum != 0) ++NumNameMatches;
    2876             : 
    2877          59 :                 if (NumNameMatches != 1) { // name must uniquely point to a list or a single case or walkin
    2878           0 :                     ErrorsFound = true;
    2879           0 :                     if (NumNameMatches == 0) {
    2880           0 :                         ShowSevereError(state,
    2881           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigRack(RackNum).Name + "\" : has an invalid " +
    2882           0 :                                             cAlphaFieldNames(AlphaNum) + ": " + Alphas(AlphaNum));
    2883           0 :                     } else if (NumNameMatches > 1) {
    2884           0 :                         ShowSevereError(state,
    2885           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigRack(RackNum).Name +
    2886           0 :                                             "\" : has a non-unique name that could be either a " + cAlphaFieldNames(AlphaNum) + ": " +
    2887           0 :                                             Alphas(AlphaNum));
    2888             :                     }                                   // num matches = 0 or > 1
    2889          59 :                 } else if (CaseAndWalkInListNum != 0) { // Name points to a CaseAndWalkInList
    2890          25 :                     NumCoils = CaseAndWalkInList(CaseAndWalkInListNum).NumCoils;
    2891          25 :                     NumCases = CaseAndWalkInList(CaseAndWalkInListNum).NumCases;
    2892          25 :                     NumWalkIns = CaseAndWalkInList(CaseAndWalkInListNum).NumWalkIns;
    2893          25 :                     RefrigRack(RackNum).NumCoils = NumCoils;
    2894          25 :                     RefrigRack(RackNum).NumCases = NumCases;
    2895          25 :                     RefrigRack(RackNum).NumWalkIns = NumWalkIns;
    2896          25 :                     if (!allocated(RefrigRack(RackNum).CoilNum)) RefrigRack(RackNum).CoilNum.allocate(NumCoils);
    2897          25 :                     RefrigRack(RackNum).CoilNum({1, NumCoils}) = CaseAndWalkInList(CaseAndWalkInListNum).CoilItemNum({1, NumCoils});
    2898          25 :                     if (!allocated(RefrigRack(RackNum).CaseNum)) RefrigRack(RackNum).CaseNum.allocate(NumCases);
    2899          25 :                     RefrigRack(RackNum).CaseNum({1, NumCases}) = CaseAndWalkInList(CaseAndWalkInListNum).CaseItemNum({1, NumCases});
    2900          25 :                     if (!allocated(RefrigRack(RackNum).WalkInNum)) RefrigRack(RackNum).WalkInNum.allocate(NumWalkIns);
    2901          25 :                     RefrigRack(RackNum).WalkInNum({1, NumWalkIns}) = CaseAndWalkInList(CaseAndWalkInListNum).WalkInItemNum({1, NumWalkIns});
    2902          34 :                 } else if (CoilNum != 0) { // Name points to a coil
    2903           0 :                     NumCoils = 1;
    2904           0 :                     RefrigRack(RackNum).NumCoils = 1;
    2905           0 :                     if (!allocated(RefrigRack(RackNum).CoilNum)) RefrigRack(RackNum).CoilNum.allocate(NumCoils);
    2906           0 :                     RefrigRack(RackNum).CoilNum(NumCoils) = CoilNum;
    2907          34 :                 } else if (CaseNum != 0) { // Name points to a case
    2908          34 :                     NumCases = 1;
    2909          34 :                     RefrigRack(RackNum).NumCases = 1;
    2910          34 :                     if (!allocated(RefrigRack(RackNum).CaseNum)) RefrigRack(RackNum).CaseNum.allocate(NumCases);
    2911          34 :                     RefrigRack(RackNum).CaseNum(NumCases) = CaseNum;
    2912           0 :                 } else if (WalkInNum != 0) { // Name points to a walkin
    2913           0 :                     NumWalkIns = 1;
    2914           0 :                     RefrigRack(RackNum).NumWalkIns = 1;
    2915           0 :                     if (!allocated(RefrigRack(RackNum).WalkInNum)) RefrigRack(RackNum).WalkInNum.allocate(NumWalkIns);
    2916           0 :                     RefrigRack(RackNum).WalkInNum(NumWalkIns) = WalkInNum;
    2917             :                 } // NumNameMatches /= 1
    2918             :             }     // blank input for loads on rack
    2919             : 
    2920          59 :             if (NumCases > 0) {
    2921         149 :                 for (int caseIndex = 1; caseIndex <= NumCases; ++caseIndex) {
    2922          90 :                     int caseID = RefrigRack(RackNum).CaseNum(caseIndex);
    2923             :                     // mark all cases on rack as used by this system (checking for unused or non-unique cases)
    2924          90 :                     ++RefrigCase(caseID).NumSysAttach;
    2925             :                     // determine total capacity on rack
    2926          90 :                     RefrigRack(RackNum).TotalRackLoad += RefrigCase(caseID).DesignRatedCap;
    2927             :                 } // CaseIndex=1,NumCases
    2928             :                 //     check that all refrigerated cases attached to a rack are to the same zone if heat rejection location is "Zone"
    2929             :                 //     however, won't matter if walk-in specified
    2930         145 :                 if (RefrigRack(RackNum).HeatRejectionLocation == HeatRejLocation::Zone && RefrigRack(RackNum).NumCases > 1 &&
    2931          59 :                     RefrigCase(RefrigRack(RackNum).CaseNum(1)).ActualZoneNum != 0 && NumWalkIns < 1 && NumCoils < 1) {
    2932           0 :                     int ZoneNum = RefrigCase(RefrigRack(RackNum).CaseNum(1)).ActualZoneNum;
    2933           0 :                     for (int caseIndex = 2; caseIndex <= RefrigRack(RackNum).NumCases; ++caseIndex) {
    2934           0 :                         if (RefrigCase(RefrigRack(RackNum).CaseNum(caseIndex)).ActualZoneNum == ZoneNum) continue;
    2935           0 :                         ShowSevereError(state,
    2936           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigRack(RackNum).Name +
    2937           0 :                                             "\" : All cases attached to a rack must be in the same zone when " + cAlphaFieldNames(2) +
    2938             :                                             " equals \"Zone\".");
    2939           0 :                         ErrorsFound = true;
    2940           0 :                         break;
    2941             :                     }
    2942             :                 } // heat rejection location is zone
    2943             :             }     // numcases > 0
    2944             : 
    2945          59 :             if (NumCoils > 0) {
    2946           0 :                 RefrigRack(RackNum).CoilFlag = true;
    2947           0 :                 for (int CoilIndex = 1; CoilIndex <= NumCoils; ++CoilIndex) {
    2948           0 :                     int CoilNum = RefrigRack(RackNum).CoilNum(CoilIndex);
    2949             :                     // mark all Coils on rack as used by this system (checking for unused or non-unique Coils)
    2950           0 :                     ++WarehouseCoil(CoilNum).NumSysAttach;
    2951             :                     // determine total capacity on rack
    2952           0 :                     RefrigRack(RackNum).TotalRackLoad += WarehouseCoil(CoilNum).RatedSensibleCap;
    2953             :                 } // CoilIndex=1,NumCoils
    2954             :             }     // numcoils > 0
    2955             : 
    2956          59 :             if (NumWalkIns > 0) {
    2957           0 :                 for (int WalkInIndex = 1; WalkInIndex <= NumWalkIns; ++WalkInIndex) {
    2958           0 :                     int WalkInID = RefrigRack(RackNum).WalkInNum(WalkInIndex);
    2959             :                     // mark all WalkIns on rack as used by this system (checking for unused or non-unique WalkIns)
    2960           0 :                     ++WalkIn(WalkInID).NumSysAttach;
    2961             :                     // determine total capacity on rack
    2962           0 :                     RefrigRack(RackNum).TotalRackLoad += WalkIn(WalkInID).DesignRatedCap;
    2963             :                 } // WalkInIndex=1,NumWalkIns
    2964             :             }     // NumWalkins
    2965             : 
    2966          59 :             if (NumWalkIns > 0 || NumCoils > 0) {
    2967             :                 // Get the heat rejection Zone node number from the zone name entered by the user (if heatrej location = zone)
    2968           0 :                 if (RefrigRack(RackNum).HeatRejectionLocation == HeatRejLocation::Zone) {
    2969           0 :                     if (lAlphaBlanks(15)) {
    2970           0 :                         ShowSevereError(state,
    2971           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigRack(RackNum).Name + cAlphaFieldNames(15) +
    2972             :                                             " must be input if walkins or AirChillers connected to rack and heat rejection location = zone.");
    2973           0 :                         ErrorsFound = true;
    2974             :                     } else { // alpha (15) not blank
    2975           0 :                         RefrigRack(RackNum).HeatRejectionZoneNum = UtilityRoutines::FindItemInList(Alphas(15), state.dataHeatBal->Zone);
    2976           0 :                         RefrigRack(RackNum).HeatRejectionZoneNodeNum =
    2977           0 :                             DataZoneEquipment::GetSystemNodeNumberForZone(state, RefrigRack(RackNum).HeatRejectionZoneNum);
    2978           0 :                         if (RefrigRack(RackNum).HeatRejectionZoneNum == 0) {
    2979           0 :                             ShowSevereError(state,
    2980           0 :                                             std::string{RoutineName} + CurrentModuleObject + "=\"" + RefrigRack(RackNum).Name + "\", invalid  " +
    2981           0 :                                                 cAlphaFieldNames(15) + " not valid: " + Alphas(15));
    2982           0 :                             ErrorsFound = true;
    2983             :                         } else {
    2984           0 :                             state.dataRefrigCase->RefrigPresentInZone(RefrigRack(RackNum).HeatRejectionZoneNum) = true;
    2985             :                         } // zonenum == 0
    2986             :                     }     // alpha 15 blank
    2987             :                 }         // zone heat rej and walk-ins or coils present, must input heat rejection zone
    2988             :             }             // numwalkins or coils > 0
    2989             : 
    2990             :             // set condenser air flow and evap water pump power if autocalculated
    2991             :             // autocalculate condenser evap water pump if needed
    2992          61 :             if (RefrigRack(RackNum).CondenserType == DataHeatBalance::RefrigCondenserType::Evap &&
    2993           2 :                 RefrigRack(RackNum).EvapPumpPower == DataGlobalConstants::AutoCalculate) {
    2994           2 :                 RefrigRack(RackNum).EvapPumpPower = CondPumpRatePower * RefrigRack(RackNum).TotalRackLoad;
    2995             :             }
    2996             :             // autocalculate evap condenser air volume flow rate if needed
    2997          61 :             if (RefrigRack(RackNum).CondenserType == DataHeatBalance::RefrigCondenserType::Evap &&
    2998           2 :                 RefrigRack(RackNum).CondenserAirFlowRate == DataGlobalConstants::AutoCalculate) {
    2999           2 :                 RefrigRack(RackNum).CondenserAirFlowRate = AirVolRateEvapCond * RefrigRack(RackNum).TotalRackLoad;
    3000             :             }
    3001             : 
    3002             :         } // RackNum=1,NumRefrigeratedRacks
    3003             : 
    3004          30 :         state.dataRefrigCase->CheckEquipNameRackWaterCondenser.dimension(state.dataRefrigCase->NumRefrigeratedRacks, true);
    3005             :     } //(NumRefrigeratedRacks > 0)
    3006             : 
    3007         771 :     if (state.dataRefrigCase->NumRefrigSystems > 0 || state.dataRefrigCase->NumTransRefrigSystems > 0) {
    3008             : 
    3009          15 :         if (state.dataRefrigCase->NumRefrigSystems > 0 && state.dataRefrigCase->NumRefrigCondensers == 0) {
    3010           0 :             ShowSevereError(state,
    3011             :                             "Refrigeration:System objects were found during input processing, however no Rrefrigeration condenser objects (which "
    3012             :                             "may be either: ");
    3013           0 :             ShowContinueError(state,
    3014             :                               " Refrigeration:Condenser:AirCooled, Refrigeration:Condenser:WaterCooled, "
    3015             :                               "Refrigeration:Condenser:EvaporativeCooled,or Refrigeration:Condenser:CascadeCooled) were found.");
    3016           0 :             ErrorsFound = true;
    3017             :         }
    3018          15 :         if (state.dataRefrigCase->NumTransRefrigSystems > 0 && state.dataRefrigCase->NumSimulationGasCooler == 0) {
    3019           0 :             ShowSevereError(state,
    3020             :                             "Refrigeration:TranscriticalSystem objects were found during input processing, however no Refrigeration gas cooler "
    3021             :                             "objects (Refrigeration:GasCooler:AirCooled) were found.");
    3022           0 :             ErrorsFound = true;
    3023             :         }
    3024          15 :         if (state.dataRefrigCase->NumSimulationCompressors == 0) {
    3025           0 :             ShowSevereError(
    3026             :                 state, "Refrigeration:System objects were found during input processing, however no Refrigeration:Compressor objects were found.");
    3027           0 :             ErrorsFound = true;
    3028             :         }
    3029             : 
    3030             :         //************ START CONDENSER INPUT  **************
    3031             : 
    3032          15 :         if (state.dataRefrigCase->NumSimulationCondAir > 0) {
    3033          12 :             CurrentModuleObject = "Refrigeration:Condenser:AirCooled";
    3034          44 :             for (int CondNum = 1; CondNum <= state.dataRefrigCase->NumSimulationCondAir; ++CondNum) {
    3035          32 :                 state.dataInputProcessing->inputProcessor->getObjectItem(state,
    3036             :                                                                          CurrentModuleObject,
    3037             :                                                                          CondNum,
    3038             :                                                                          Alphas,
    3039             :                                                                          NumAlphas,
    3040             :                                                                          Numbers,
    3041             :                                                                          NumNumbers,
    3042             :                                                                          IOStatus,
    3043             :                                                                          lNumericBlanks,
    3044             :                                                                          lAlphaBlanks,
    3045             :                                                                          cAlphaFieldNames,
    3046             :                                                                          cNumericFieldNames);
    3047          64 :                 GlobalNames::VerifyUniqueInterObjectName(
    3048          64 :                     state, state.dataRefrigCase->UniqueCondenserNames, Alphas(1), CurrentModuleObject, cAlphaFieldNames(1), ErrorsFound);
    3049          32 :                 Condenser(CondNum).Name = Alphas(1);
    3050          32 :                 state.dataHeatBal->HeatReclaimRefrigCondenser(CondNum).Name = Alphas(1);
    3051          32 :                 Condenser(CondNum).CapCurvePtr = Curve::GetCurveIndex(state, Alphas(2)); // convert curve name to number
    3052          32 :                 if (Condenser(CondNum).CapCurvePtr == 0) {
    3053           0 :                     ShowSevereError(state,
    3054           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + Condenser(CondNum).Name + "\", invalid  " +
    3055           0 :                                         cAlphaFieldNames(2) + " not found:" + Alphas(2));
    3056           0 :                     ErrorsFound = true;
    3057             :                 }
    3058             : 
    3059             :                 // set start of count for number of systems attached to this condenser
    3060          32 :                 Condenser(CondNum).NumSysAttach = 0;
    3061          32 :                 if (!allocated(Condenser(CondNum).SysNum)) Condenser(CondNum).SysNum.allocate(state.dataRefrigCase->NumRefrigSystems);
    3062             : 
    3063             :                 // set CondenserType and rated temperature difference (51.7 - 35)C per ARI 460
    3064          32 :                 Condenser(CondNum).CondenserType = DataHeatBalance::RefrigCondenserType::Air;
    3065          32 :                 state.dataHeatBal->HeatReclaimRefrigCondenser(CondNum).SourceType = CurrentModuleObject;
    3066          32 :                 Condenser(CondNum).RatedDelT = CondARI460DelT; //= 16.7d0 ,Rated sat cond temp - dry bulb air T for air-cooled Condensers, ARI460
    3067          32 :                 Condenser(CondNum).RatedTCondense = CondARI460Tcond;
    3068          32 :                 if (Condenser(CondNum).CapCurvePtr > 0) {
    3069          32 :                     Condenser(CondNum).RatedCapacity = Curve::CurveValue(state, Condenser(CondNum).CapCurvePtr, CondARI460DelT);
    3070             :                 }
    3071             :                 // elevation capacity correction on air-cooled condensers, Carrier correlation more conservative than Trane
    3072          32 :                 Condenser(CondNum).RatedCapacity *= (1.0 - 7.17e-5 * state.dataEnvrn->Elevation);
    3073          32 :                 if (Condenser(CondNum).RatedCapacity > 0.0) {
    3074          32 :                     Curve::GetCurveMinMaxValues(state, Condenser(CondNum).CapCurvePtr, DelTempMin, DelTempMax);
    3075          64 :                     Real64 Capmin = Curve::CurveValue(state, Condenser(CondNum).CapCurvePtr, DelTempMin) *
    3076          32 :                                     (1.0 - 7.17e-5 * state.dataEnvrn->Elevation); // Mar 2011 bug fix
    3077          64 :                     Real64 Capmax = Curve::CurveValue(state, Condenser(CondNum).CapCurvePtr, DelTempMax) *
    3078          32 :                                     (1.0 - 7.17e-5 * state.dataEnvrn->Elevation); // Mar 2011 bug
    3079          32 :                     Condenser(CondNum).TempSlope =
    3080          32 :                         (DelTempMax - DelTempMin) / ((Capmax - Capmin)); // * ( 1.0 - 7.17e-5 * Elevation ) ) //Mar 2011 bug fix
    3081          32 :                     Condenser(CondNum).MinCondLoad = Capmax - DelTempMax / Condenser(CondNum).TempSlope;
    3082             :                 } else {
    3083           0 :                     ShowSevereError(state,
    3084           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + Condenser(CondNum).Name +
    3085             :                                         "\" Condenser capacity curve per ARI 460 must be input and must be greater than 0 Watts at 16.7C temperature "
    3086             :                                         "difference.");
    3087           0 :                     ErrorsFound = true;
    3088             :                 }
    3089             : 
    3090          32 :                 Condenser(CondNum).RatedSubcool = 0.0; // default value
    3091          32 :                 if (!lNumericBlanks(1)) Condenser(CondNum).RatedSubcool = Numbers(1);
    3092             : 
    3093             :                 // Get fan control type
    3094          32 :                 if (UtilityRoutines::SameString(Alphas(3), "FixedLinear")) {
    3095           0 :                     Condenser(CondNum).FanSpeedControlType = FanSpeedCtrlType::ConstantSpeedLinear;
    3096          32 :                 } else if (UtilityRoutines::SameString(Alphas(3), "VariableSpeed")) {
    3097           9 :                     Condenser(CondNum).FanSpeedControlType = FanSpeedCtrlType::VariableSpeed;
    3098          23 :                 } else if (UtilityRoutines::SameString(Alphas(3), "TwoSpeed")) {
    3099          16 :                     Condenser(CondNum).FanSpeedControlType = FanSpeedCtrlType::TwoSpeed;
    3100             :                 } else {
    3101           7 :                     Condenser(CondNum).FanSpeedControlType = FanSpeedCtrlType::ConstantSpeed; // default
    3102             :                 }                                                                             // Set fan control type
    3103             : 
    3104          32 :                 if (!lNumericBlanks(2)) Condenser(CondNum).RatedFanPower = Numbers(2);
    3105          32 :                 if ((lNumericBlanks(2)) || (Numbers(2) < 0.0)) {
    3106           0 :                     ShowSevereError(state,
    3107           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + Condenser(CondNum).Name + "\" " + cNumericFieldNames(2) +
    3108             :                                         " must be input greater than or equal to 0 Watts.");
    3109           0 :                     ErrorsFound = true;
    3110             :                 }
    3111             : 
    3112          32 :                 Condenser(CondNum).FanMinAirFlowRatio = 0.2; // default value
    3113          32 :                 if (!lNumericBlanks(3)) Condenser(CondNum).FanMinAirFlowRatio = Numbers(3);
    3114             : 
    3115             :                 // Check condenser air inlet node connection
    3116             :                 // Jan 2011 - added ability to reject heat to a zone from air-cooled condenser
    3117          32 :                 Condenser(CondNum).CondenserRejectHeatToZone = false;
    3118          32 :                 if (lAlphaBlanks(4)) {
    3119           0 :                     Condenser(CondNum).InletAirNodeNum = 0;
    3120             :                 } else { // see if it's an outside air node name or an indoor zone name,
    3121             :                     // have to check inside first because outside check automatically generates an error message
    3122          32 :                     Condenser(CondNum).InletAirZoneNum = UtilityRoutines::FindItemInList(Alphas(4), state.dataHeatBal->Zone);
    3123             :                     // need to clearly id node number for air inlet conditions and zone number for casecredit assignment
    3124          32 :                     if (Condenser(CondNum).InletAirZoneNum != 0) {
    3125             :                         // set condenser flag (later used to set system flag) and zone flag
    3126           3 :                         Condenser(CondNum).InletAirNodeNum = DataZoneEquipment::GetSystemNodeNumberForZone(state, Condenser(CondNum).InletAirZoneNum);
    3127           3 :                         Condenser(CondNum).CondenserRejectHeatToZone = true;
    3128           3 :                         state.dataRefrigCase->RefrigPresentInZone(Condenser(CondNum).InletAirZoneNum) = true;
    3129             :                     } else { // not in a conditioned zone, so see if it's outside
    3130          29 :                         Condenser(CondNum).InletAirNodeNum =
    3131          58 :                             NodeInputManager::GetOnlySingleNode(state,
    3132          29 :                                                                 Alphas(4),
    3133             :                                                                 ErrorsFound,
    3134             :                                                                 DataLoopNode::ConnectionObjectType::RefrigerationCondenserAirCooled,
    3135          29 :                                                                 Alphas(1),
    3136             :                                                                 DataLoopNode::NodeFluidType::Air,
    3137             :                                                                 DataLoopNode::ConnectionType::OutsideAirReference,
    3138             :                                                                 NodeInputManager::CompFluidStream::Primary,
    3139          29 :                                                                 DataLoopNode::ObjectIsParent);
    3140          29 :                         if (!OutAirNodeManager::CheckOutAirNodeNumber(state, Condenser(CondNum).InletAirNodeNum)) {
    3141             :                             // not outside and not a zone
    3142           0 :                             ShowSevereError(state,
    3143           0 :                                             std::string{RoutineName} + CurrentModuleObject + "=\"" + Condenser(CondNum).Name + "\", " +
    3144           0 :                                                 cAlphaFieldNames(4) + " not found: " + Alphas(4));
    3145           0 :                             ShowContinueError(state, "...does not appear in an OutdoorAir:NodeList or as an OutdoorAir:Node or as a Zone.");
    3146           0 :                             ErrorsFound = true;
    3147             :                         } // checkoutairnodenumber
    3148             :                     }     // InletAirZoneNum \=0
    3149             :                 }         // Condenser air inlet node connection
    3150             : 
    3151          32 :                 Condenser(CondNum).EndUseSubcategory = "";
    3152          32 :                 if (!lAlphaBlanks(5)) Condenser(CondNum).EndUseSubcategory = Alphas(5);
    3153             : 
    3154          32 :                 Condenser(CondNum).RefOpCharge = 0.0;
    3155          32 :                 Condenser(CondNum).RefReceiverInventory = 0.0;
    3156          32 :                 Condenser(CondNum).RefPipingInventory = 0.0;
    3157          32 :                 if (!lNumericBlanks(4)) Condenser(CondNum).RefOpCharge = Numbers(4);
    3158          32 :                 if (!lNumericBlanks(5)) Condenser(CondNum).RefReceiverInventory = Numbers(5);
    3159          32 :                 if (!lNumericBlanks(6)) Condenser(CondNum).RefPipingInventory = Numbers(6);
    3160             : 
    3161             :             } // Read input for REFRIGERATION:Condenser:AirCooled
    3162             :         }     // NumSimulationCondAir > 0
    3163             : 
    3164          15 :         if (state.dataRefrigCase->NumSimulationCondEvap > 0) {
    3165           2 :             CurrentModuleObject = "Refrigeration:Condenser:EvaporativeCooled";
    3166           5 :             for (int CondIndex = 1; CondIndex <= state.dataRefrigCase->NumSimulationCondEvap; ++CondIndex) {
    3167           3 :                 int CondNum = CondIndex + state.dataRefrigCase->NumSimulationCondAir;
    3168           3 :                 state.dataInputProcessing->inputProcessor->getObjectItem(state,
    3169             :                                                                          CurrentModuleObject,
    3170             :                                                                          CondIndex,
    3171             :                                                                          Alphas,
    3172             :                                                                          NumAlphas,
    3173             :                                                                          Numbers,
    3174             :                                                                          NumNumbers,
    3175             :                                                                          IOStatus,
    3176             :                                                                          lNumericBlanks,
    3177             :                                                                          lAlphaBlanks,
    3178             :                                                                          cAlphaFieldNames,
    3179             :                                                                          cNumericFieldNames);
    3180             : 
    3181           6 :                 GlobalNames::VerifyUniqueInterObjectName(
    3182           6 :                     state, state.dataRefrigCase->UniqueCondenserNames, Alphas(1), CurrentModuleObject, cAlphaFieldNames(1), ErrorsFound);
    3183           3 :                 Condenser(CondNum).Name = Alphas(1);
    3184           3 :                 state.dataHeatBal->HeatReclaimRefrigCondenser(CondNum).Name = Alphas(1);
    3185             : 
    3186             :                 // set start of count for number of systems attached to this condenser
    3187           3 :                 Condenser(CondNum).NumSysAttach = 0;
    3188           3 :                 if (!allocated(Condenser(CondNum).SysNum)) Condenser(CondNum).SysNum.allocate(state.dataRefrigCase->NumRefrigSystems);
    3189             : 
    3190             :                 // set CondenserType and rated Heat Rejection per ARI 490 rating
    3191           3 :                 Condenser(CondNum).CondenserType = DataHeatBalance::RefrigCondenserType::Evap;
    3192           3 :                 state.dataHeatBal->HeatReclaimRefrigCondenser(CondNum).SourceType = CurrentModuleObject;
    3193           3 :                 Condenser(CondNum).RatedTCondense = CondARI490Tcond;
    3194           3 :                 Condenser(CondNum).RatedDelT = CondARI490DelT;
    3195             : 
    3196           3 :                 if ((!lNumericBlanks(1)) && (Numbers(1) > 0.0)) {
    3197           3 :                     Condenser(CondNum).RatedCapacity = Numbers(1);
    3198             :                 } else {
    3199           0 :                     ShowSevereError(state,
    3200           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + Condenser(CondNum).Name + "\" " + cNumericFieldNames(1) +
    3201             :                                         " per ARI 490 must be input and must be greater than 0 Watts.");
    3202           0 :                     ErrorsFound = true;
    3203             :                 }
    3204             :                 // Calculate capacity elevation derate factor per ARI 490 barometric pressure correction factor
    3205           3 :                 Condenser(CondNum).EvapElevFact = 1.0 - 3.074e-5 * state.dataEnvrn->Elevation;
    3206             : 
    3207           3 :                 Condenser(CondNum).RatedSubcool = 0.0; // default value
    3208           3 :                 if ((!lNumericBlanks(2)) && (Numbers(2) > 0.0)) Condenser(CondNum).RatedSubcool = Numbers(2);
    3209             : 
    3210             :                 // Get fan control type
    3211           3 :                 if (UtilityRoutines::SameString(Alphas(3), "FixedLinear")) {
    3212           0 :                     Condenser(CondNum).FanSpeedControlType = FanSpeedCtrlType::ConstantSpeedLinear;
    3213           3 :                 } else if (UtilityRoutines::SameString(Alphas(2), "VariableSpeed")) {
    3214           2 :                     Condenser(CondNum).FanSpeedControlType = FanSpeedCtrlType::VariableSpeed;
    3215           1 :                 } else if (UtilityRoutines::SameString(Alphas(2), "TwoSpeed")) {
    3216           1 :                     Condenser(CondNum).FanSpeedControlType = FanSpeedCtrlType::TwoSpeed;
    3217             :                 } else {
    3218           0 :                     Condenser(CondNum).FanSpeedControlType = FanSpeedCtrlType::ConstantSpeed; // default
    3219             :                 }                                                                             // Set fan control type
    3220             : 
    3221           3 :                 Condenser(CondNum).RatedFanPower = Numbers(3);
    3222           3 :                 if (Numbers(3) < 0.0) {
    3223           0 :                     ShowSevereError(state,
    3224           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + Condenser(CondNum).Name + "\" " + cNumericFieldNames(3) +
    3225             :                                         " must be greater than or equal to 0 Watts.");
    3226           0 :                     ErrorsFound = true;
    3227             :                 }
    3228             : 
    3229           3 :                 Condenser(CondNum).FanMinAirFlowRatio = 0.2; // default value
    3230           3 :                 if (!lNumericBlanks(4)) Condenser(CondNum).FanMinAirFlowRatio = Numbers(4);
    3231             : 
    3232             :                 // Enter min and max and default coefficients for evap condenser HRCF correlation
    3233             :                 // Defaults taken from 2008 BAC equipment for R22, R134a, series CXV
    3234             :                 // Correlation coefficients for other manufacturers are very similar per Hugh Henderson's work
    3235           3 :                 Condenser(CondNum).EvapCoeff1 = 6.63;
    3236           3 :                 Condenser(CondNum).EvapCoeff2 = 0.468;
    3237           3 :                 Condenser(CondNum).EvapCoeff3 = 17.93;
    3238           3 :                 Condenser(CondNum).EvapCoeff4 = -0.322;
    3239           3 :                 Condenser(CondNum).MinCapFacEvap = 0.5;
    3240           3 :                 Condenser(CondNum).MaxCapFacEvap = 5.0;
    3241           3 :                 NumNum = 5; // added warnings if below not blank but unused due to limits
    3242           3 :                 if (!lNumericBlanks(NumNum)) {
    3243           3 :                     if (Numbers(NumNum) >= 0.0) {
    3244           3 :                         Condenser(CondNum).EvapCoeff1 = Numbers(NumNum);
    3245             :                     } else {
    3246           0 :                         ShowWarningError(state,
    3247           0 :                                          CurrentModuleObject + "=\"" + Condenser(CondNum).Name + "\", " + cNumericFieldNames(NumNum) +
    3248             :                                              " is less than 0 and was not used. Default was used.");
    3249             :                     }
    3250             :                 }
    3251           3 :                 NumNum = 6; // EvapCoeff2 can't be equal to 0 because used in a denominator
    3252           3 :                 if (!lNumericBlanks(NumNum)) {
    3253           3 :                     if (Numbers(NumNum) > 0.0) {
    3254           3 :                         Condenser(CondNum).EvapCoeff2 = Numbers(NumNum);
    3255             :                     } else {
    3256           0 :                         ShowWarningError(state,
    3257           0 :                                          CurrentModuleObject + "=\"" + Condenser(CondNum).Name + "\", " + cNumericFieldNames(NumNum) +
    3258             :                                              " is less than or equal to 0 and was not used. Default was used.");
    3259             :                     }
    3260             :                 }
    3261           3 :                 NumNum = 7;
    3262           3 :                 if (!lNumericBlanks(NumNum)) {
    3263           3 :                     if (Numbers(NumNum) >= 0.0) {
    3264           3 :                         Condenser(CondNum).EvapCoeff3 = Numbers(NumNum);
    3265             :                     } else {
    3266           0 :                         ShowWarningError(state,
    3267           0 :                                          CurrentModuleObject + "=\"" + Condenser(CondNum).Name + "\", " + cNumericFieldNames(NumNum) +
    3268             :                                              " is less than 0 and was not used. Default was used.");
    3269             :                     }
    3270             :                 }
    3271           3 :                 NumNum = 8;
    3272           3 :                 if (!lNumericBlanks(NumNum)) {
    3273           3 :                     if (Numbers(NumNum) >= -20.0) {
    3274           3 :                         Condenser(CondNum).EvapCoeff4 = Numbers(NumNum);
    3275             :                     } else {
    3276           0 :                         ShowWarningError(state,
    3277           0 :                                          CurrentModuleObject + "=\"" + Condenser(CondNum).Name + "\", " + cNumericFieldNames(NumNum) +
    3278             :                                              " is less than -20 and was not used. Default was used.");
    3279             :                     }
    3280             :                 }
    3281           3 :                 NumNum = 9;
    3282           3 :                 if (!lNumericBlanks(NumNum)) {
    3283           3 :                     if (Numbers(NumNum) >= 0.0) {
    3284           3 :                         Condenser(CondNum).MinCapFacEvap = Numbers(NumNum);
    3285             :                     } else {
    3286           0 :                         ShowWarningError(state,
    3287           0 :                                          CurrentModuleObject + "=\"" + Condenser(CondNum).Name + "\", " + cNumericFieldNames(NumNum) +
    3288             :                                              " is less than 0 and was not used. Default was used.");
    3289             :                     }
    3290             :                 }
    3291           3 :                 NumNum = 10;
    3292           3 :                 if (!lNumericBlanks(NumNum)) {
    3293           3 :                     if (Numbers(NumNum) >= 0.0) {
    3294           3 :                         Condenser(CondNum).MaxCapFacEvap = Numbers(NumNum);
    3295             :                     } else {
    3296           0 :                         ShowWarningError(state,
    3297           0 :                                          CurrentModuleObject + "=\"" + Condenser(CondNum).Name + "\", " + cNumericFieldNames(NumNum) +
    3298             :                                              " is less than 0 and was not used. Default was used.");
    3299             :                     }
    3300             :                 }
    3301             : 
    3302             :                 // Check condenser air inlet node connection
    3303           3 :                 if (lAlphaBlanks(3)) {
    3304           0 :                     Condenser(CondNum).InletAirNodeNum = 0;
    3305             :                 } else {
    3306           3 :                     Condenser(CondNum).InletAirNodeNum =
    3307           6 :                         NodeInputManager::GetOnlySingleNode(state,
    3308           3 :                                                             Alphas(3),
    3309             :                                                             ErrorsFound,
    3310             :                                                             DataLoopNode::ConnectionObjectType::RefrigerationCondenserEvaporativeCooled,
    3311           3 :                                                             Alphas(1),
    3312             :                                                             DataLoopNode::NodeFluidType::Air,
    3313             :                                                             DataLoopNode::ConnectionType::OutsideAirReference,
    3314             :                                                             NodeInputManager::CompFluidStream::Primary,
    3315           3 :                                                             DataLoopNode::ObjectIsParent);
    3316           3 :                     if (!OutAirNodeManager::CheckOutAirNodeNumber(state, Condenser(CondNum).InletAirNodeNum)) {
    3317           0 :                         ShowSevereError(state,
    3318           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + Condenser(CondNum).Name + "\", " +
    3319           0 :                                             cAlphaFieldNames(3) + " not found: " + Alphas(3));
    3320           0 :                         ShowContinueError(state, "...does not appear in an OutdoorAir:NodeList or as an OutdoorAir:Node.");
    3321           0 :                         ErrorsFound = true;
    3322             :                     }
    3323             :                 } // Condenser air inlet node connection
    3324             : 
    3325           3 :                 NumNum = 11;
    3326           3 :                 Condenser(CondNum).RatedAirFlowRate = Numbers(NumNum);
    3327             :                 // Note the autocalculate feature for this value takes place in the system section because
    3328             :                 //  it is a function of the total cooling capacity of the cases served by the condenser
    3329             : 
    3330             :                 // Evaporative condensers basin heater power as a function of temperature must be greater than or equal to 0
    3331           3 :                 NumNum = 12;
    3332           3 :                 Condenser(CondNum).BasinHeaterPowerFTempDiff = Numbers(NumNum);
    3333           3 :                 if (Numbers(NumNum) < 0.0) {
    3334           0 :                     ShowSevereError(state,
    3335           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + Condenser(CondNum).Name + "\", " +
    3336           0 :                                         cNumericFieldNames(NumNum) + " must be >= 0");
    3337           0 :                     ErrorsFound = true;
    3338             :                 }
    3339             : 
    3340           3 :                 NumNum = 13;
    3341           3 :                 Condenser(CondNum).BasinHeaterSetPointTemp = 2.0; // default
    3342           3 :                 if (!lNumericBlanks(NumNum)) Condenser(CondNum).BasinHeaterSetPointTemp = Numbers(NumNum);
    3343           3 :                 if (Condenser(CondNum).BasinHeaterSetPointTemp < 2.0) {
    3344           0 :                     ShowWarningError(state,
    3345           0 :                                      CurrentModuleObject + "=\"" + Condenser(CondNum).Name + "\", " + cNumericFieldNames(NumNum) +
    3346             :                                          " is less than 2 deg C. Freezing could occur.");
    3347             :                 }
    3348             : 
    3349           3 :                 NumNum = 14;
    3350           3 :                 Condenser(CondNum).EvapPumpPower = 1000.0; // default
    3351           3 :                 if (!lNumericBlanks(NumNum)) Condenser(CondNum).EvapPumpPower = Numbers(NumNum);
    3352             :                 // Note the autocalculate feature for this value takes place in the system section because
    3353             :                 //  it is a function of the total cooling capacity of the cases served by the condenser
    3354             : 
    3355             :                 // Get Evaporative Water System tank connections
    3356           3 :                 Condenser(CondNum).SupplyTankName = Alphas(4);
    3357           3 :                 if (lAlphaBlanks(4)) {
    3358           0 :                     Condenser(CondNum).EvapWaterSupplyMode = WaterSupply::FromMains;
    3359             :                 } else {
    3360           3 :                     Condenser(CondNum).EvapWaterSupplyMode = WaterSupply::FromTank;
    3361          12 :                     WaterManager::SetupTankDemandComponent(state,
    3362           3 :                                                            Condenser(CondNum).Name,
    3363             :                                                            CurrentModuleObject,
    3364           3 :                                                            Condenser(CondNum).SupplyTankName,
    3365             :                                                            ErrorsFound,
    3366           3 :                                                            Condenser(CondNum).EvapWaterSupTankID,
    3367           3 :                                                            Condenser(CondNum).EvapWaterTankDemandARRID);
    3368             :                 }
    3369             : 
    3370           3 :                 if (lAlphaBlanks(5)) {
    3371           0 :                     Condenser(CondNum).EvapSchedPtr = 0;
    3372             :                 } else {
    3373           3 :                     Condenser(CondNum).EvapSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(5)); // convert schedule name to pointer
    3374             :                     //   check availability schedule for values >= 0
    3375           3 :                     if (Condenser(CondNum).EvapSchedPtr > 0) {
    3376           3 :                         if (!ScheduleManager::CheckScheduleValueMinMax(state, Condenser(CondNum).EvapSchedPtr, ">=", 0.0)) {
    3377           0 :                             ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Condenser(CondNum).Name + "\" .");
    3378           0 :                             ShowContinueError(state, "Error found in " + cAlphaFieldNames(5) + " = " + Alphas(5));
    3379           0 :                             ShowContinueError(state, "schedule values must be (>=0.).");
    3380           0 :                             ErrorsFound = true;
    3381             :                         }
    3382             :                     } else {
    3383           0 :                         ShowSevereError(state,
    3384           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + Condenser(CondNum).Name + "\", invalid  " +
    3385           0 :                                             cAlphaFieldNames(5) + " = " + Alphas(5));
    3386           0 :                         ShowContinueError(state, "A schedule with this name is not defined in this input data file.");
    3387           0 :                         ErrorsFound = true;
    3388             :                     }
    3389             :                 } // Set Evap Schedule Pointer
    3390             : 
    3391           3 :                 Condenser(CondNum).EndUseSubcategory = "";
    3392           3 :                 if (!lAlphaBlanks(6)) Condenser(CondNum).EndUseSubcategory = Alphas(6);
    3393             : 
    3394           3 :                 Condenser(CondNum).RefOpCharge = 0.0;
    3395           3 :                 Condenser(CondNum).RefReceiverInventory = 0.0;
    3396           3 :                 Condenser(CondNum).RefPipingInventory = 0.0;
    3397           3 :                 NumNum = 15;
    3398           3 :                 if (!lNumericBlanks(NumNum)) Condenser(CondNum).RefOpCharge = Numbers(NumNum);
    3399           3 :                 NumNum = 16;
    3400           3 :                 if (!lNumericBlanks(NumNum)) Condenser(CondNum).RefReceiverInventory = Numbers(NumNum);
    3401           3 :                 NumNum = 17;
    3402           3 :                 if (!lNumericBlanks(NumNum)) Condenser(CondNum).RefPipingInventory = Numbers(NumNum);
    3403             :             } // Read input for CONDENSER:REFRIGERATION:EVAPorativeCooled
    3404             :         }     // If NumSimulationCondEvap > 0
    3405             : 
    3406          15 :         if (state.dataRefrigCase->NumSimulationCondWater > 0) {
    3407           1 :             CurrentModuleObject = "Refrigeration:Condenser:WaterCooled";
    3408           2 :             for (int CondIndex = 1; CondIndex <= state.dataRefrigCase->NumSimulationCondWater; ++CondIndex) {
    3409           1 :                 int CondNum = CondIndex + state.dataRefrigCase->NumSimulationCondAir + state.dataRefrigCase->NumSimulationCondEvap;
    3410           1 :                 state.dataInputProcessing->inputProcessor->getObjectItem(state,
    3411             :                                                                          CurrentModuleObject,
    3412             :                                                                          CondIndex,
    3413             :                                                                          Alphas,
    3414             :                                                                          NumAlphas,
    3415             :                                                                          Numbers,
    3416             :                                                                          NumNumbers,
    3417             :                                                                          IOStatus,
    3418             :                                                                          lNumericBlanks,
    3419             :                                                                          lAlphaBlanks,
    3420             :                                                                          cAlphaFieldNames,
    3421             :                                                                          cNumericFieldNames);
    3422             : 
    3423           2 :                 GlobalNames::VerifyUniqueInterObjectName(
    3424           2 :                     state, state.dataRefrigCase->UniqueCondenserNames, Alphas(1), CurrentModuleObject, cAlphaFieldNames(1), ErrorsFound);
    3425           1 :                 Condenser(CondNum).Name = Alphas(1);
    3426           1 :                 state.dataHeatBal->HeatReclaimRefrigCondenser(CondNum).Name = Alphas(1);
    3427             : 
    3428             :                 // set start of count for number of systems attached to this condenser
    3429           1 :                 Condenser(CondNum).NumSysAttach = 0;
    3430           1 :                 if (!allocated(Condenser(CondNum).SysNum)) Condenser(CondNum).SysNum.allocate(state.dataRefrigCase->NumRefrigSystems);
    3431             : 
    3432             :                 // set CondenserType and rated Heat Rejection per ARI 450 rating
    3433           1 :                 Condenser(CondNum).CondenserType = DataHeatBalance::RefrigCondenserType::Water;
    3434           1 :                 state.dataHeatBal->HeatReclaimRefrigCondenser(CondNum).SourceType = CurrentModuleObject;
    3435           1 :                 if ((!lNumericBlanks(1)) && (Numbers(1) > 0.0)) {
    3436           1 :                     Condenser(CondNum).RatedCapacity = Numbers(1);
    3437             :                 } else {
    3438           0 :                     ShowSevereError(state,
    3439           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + Condenser(CondNum).Name + "\" " + cNumericFieldNames(1) +
    3440             :                                         " per ARI 450 must be input and must be greater than 0 Watts.");
    3441           0 :                     ErrorsFound = true;
    3442             :                 }
    3443             : 
    3444           1 :                 if ((!lNumericBlanks(2)) && (Numbers(2) > 0.0)) {
    3445           1 :                     Condenser(CondNum).RatedTCondense = Numbers(2);
    3446             :                 } else {
    3447           0 :                     ShowSevereError(state,
    3448           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + Condenser(CondNum).Name + "\" " + cNumericFieldNames(2) +
    3449             :                                         " per ARI 450 must be input and must be greater than 0 C.");
    3450           0 :                     ErrorsFound = true;
    3451             :                 }
    3452             : 
    3453           1 :                 if (!lNumericBlanks(3)) {
    3454           1 :                     if (Numbers(3) >= 0.0) {
    3455           1 :                         Condenser(CondNum).RatedSubcool = Numbers(3);
    3456             :                     } else {
    3457           0 :                         ShowSevereError(state,
    3458           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + Condenser(CondNum).Name + "\" " +
    3459           0 :                                             cNumericFieldNames(3) + " must be greater than or equal to zero.");
    3460           0 :                         ErrorsFound = true;
    3461             :                     }
    3462             :                 } else {
    3463           0 :                     Condenser(CondNum).RatedSubcool = 0.0; // default value
    3464             :                 }
    3465             : 
    3466           1 :                 if ((!lNumericBlanks(4)) && (Numbers(4) > 0.0)) {
    3467           1 :                     Condenser(CondNum).RatedWaterInletT = Numbers(4);
    3468           1 :                     Condenser(CondNum).RatedApproachT = Condenser(CondNum).RatedTCondense - Numbers(4);
    3469             :                 } else {
    3470           0 :                     ShowSevereError(state,
    3471           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + Condenser(CondNum).Name + "\" " + cNumericFieldNames(4) +
    3472             :                                         " must be input and greater than zero.");
    3473           0 :                     ErrorsFound = true;
    3474             :                 }
    3475             : 
    3476           1 :                 Condenser(CondNum).InletNode =
    3477           2 :                     NodeInputManager::GetOnlySingleNode(state,
    3478           1 :                                                         Alphas(2),
    3479             :                                                         ErrorsFound,
    3480             :                                                         DataLoopNode::ConnectionObjectType::RefrigerationCondenserWaterCooled,
    3481           1 :                                                         Alphas(1),
    3482             :                                                         DataLoopNode::NodeFluidType::Water,
    3483             :                                                         DataLoopNode::ConnectionType::Inlet,
    3484             :                                                         NodeInputManager::CompFluidStream::Primary,
    3485           1 :                                                         DataLoopNode::ObjectIsNotParent);
    3486           1 :                 Condenser(CondNum).OutletNode =
    3487           2 :                     NodeInputManager::GetOnlySingleNode(state,
    3488           1 :                                                         Alphas(3),
    3489             :                                                         ErrorsFound,
    3490             :                                                         DataLoopNode::ConnectionObjectType::RefrigerationCondenserWaterCooled,
    3491           1 :                                                         Alphas(1),
    3492             :                                                         DataLoopNode::NodeFluidType::Water,
    3493             :                                                         DataLoopNode::ConnectionType::Outlet,
    3494             :                                                         NodeInputManager::CompFluidStream::Primary,
    3495           1 :                                                         DataLoopNode::ObjectIsNotParent);
    3496             :                 // Check node connections
    3497           1 :                 BranchNodeConnections::TestCompSet(state, CurrentModuleObject, Alphas(1), Alphas(2), Alphas(3), "Water Cooled Condenser Nodes");
    3498             :                 // Get loop flow type
    3499           1 :                 if (UtilityRoutines::SameString(Alphas(4), "VariableFlow")) { // set FlowType
    3500           1 :                     Condenser(CondNum).FlowType = CndsrFlowType::VariableFlow;
    3501           0 :                 } else if (UtilityRoutines::SameString(Alphas(4), "ConstantFlow")) {
    3502           0 :                     Condenser(CondNum).FlowType = CndsrFlowType::ConstantFlow;
    3503             :                 } else {
    3504           0 :                     ShowSevereError(state,
    3505           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + Condenser(CondNum).Name + "\", invalid  " +
    3506           0 :                                         cAlphaFieldNames(4) + " not recognized: " + Alphas(4));
    3507           0 :                     ShowContinueError(state, "Check input value choices.");
    3508           0 :                     ErrorsFound = true;
    3509             :                 } // Set FlowType
    3510             : 
    3511             :                 // Get outlet temperature schedule for variable flow case
    3512           1 :                 if (Condenser(CondNum).FlowType == CndsrFlowType::VariableFlow) {
    3513           1 :                     if (lAlphaBlanks(5)) {
    3514           0 :                         Condenser(CondNum).OutletTempSchedPtr = 0;
    3515             :                     } else {
    3516           1 :                         Condenser(CondNum).OutletTempSchedPtr =
    3517           1 :                             ScheduleManager::GetScheduleIndex(state, Alphas(5)); // convert schedule name to pointer
    3518             :                     }
    3519           1 :                     if (Condenser(CondNum).OutletTempSchedPtr == 0) {
    3520           0 :                         ShowSevereError(state,
    3521           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + Condenser(CondNum).Name + "\", invalid  " +
    3522           0 :                                             cAlphaFieldNames(5) + " = " + Alphas(5));
    3523           0 :                         ShowContinueError(state, "A schedule with this name is not defined in this input data file.");
    3524           0 :                         ErrorsFound = true;
    3525             :                     }
    3526             :                 } // Outlet temperature schedule
    3527             : 
    3528             :                 // Get volumetric flow rate if applicable
    3529           1 :                 if (Condenser(CondNum).FlowType == CndsrFlowType::ConstantFlow) {
    3530           0 :                     if ((!lNumericBlanks(5)) && (Numbers(5) > 0.0)) {
    3531           0 :                         Condenser(CondNum).DesVolFlowRate = Numbers(5);
    3532           0 :                         Condenser(CondNum).VolFlowRate = Numbers(5);
    3533             :                     } else {
    3534           0 :                         ShowSevereError(state,
    3535           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + Condenser(CondNum).Name + "\" " +
    3536           0 :                                             cNumericFieldNames(5) + " must be greater than zero.");
    3537           0 :                         ShowContinueError(state, "Revise flow rates.");
    3538           0 :                         ErrorsFound = true;
    3539             :                     }
    3540           0 :                     PlantUtilities::RegisterPlantCompDesignFlow(state, Condenser(CondNum).InletNode, Condenser(CondNum).DesVolFlowRate);
    3541             :                 }
    3542             : 
    3543             :                 // Get maximum flow rates
    3544           1 :                 if (Numbers(6) > 0.0) {
    3545           1 :                     Condenser(CondNum).VolFlowRateMax = Numbers(6);
    3546             :                     // Check constant flow for max violation, if applicable
    3547           1 :                     if (Condenser(CondNum).FlowType == CndsrFlowType::ConstantFlow && Condenser(CondNum).VolFlowRate > Numbers(6)) {
    3548           0 :                         ShowSevereError(state,
    3549           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + Condenser(CondNum).Name + "\" " +
    3550           0 :                                             cNumericFieldNames(5) + " > " + cNumericFieldNames(6) + " .");
    3551           0 :                         ShowContinueError(state, "Revise flow rates.");
    3552           0 :                         ErrorsFound = true;
    3553             :                     } // Error check on max flow rate
    3554             :                 } else {
    3555           0 :                     ShowSevereError(state,
    3556           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + Condenser(CondNum).Name + "\" " + cNumericFieldNames(6) +
    3557             :                                         " must be greater than zero.");
    3558           0 :                     ErrorsFound = true;
    3559             :                 }
    3560             : 
    3561             :                 // Get max/min allowed water temps
    3562           1 :                 Condenser(CondNum).OutletTempMax = Numbers(7);
    3563           1 :                 Condenser(CondNum).InletTempMin = Numbers(8);
    3564             : 
    3565           1 :                 Condenser(CondNum).EndUseSubcategory = "";
    3566           1 :                 if (!lAlphaBlanks(6)) Condenser(CondNum).EndUseSubcategory = Alphas(6);
    3567             : 
    3568           1 :                 Condenser(CondNum).RefOpCharge = 0.0;
    3569           1 :                 Condenser(CondNum).RefReceiverInventory = 0.0;
    3570           1 :                 Condenser(CondNum).RefPipingInventory = 0.0;
    3571           1 :                 if (!lNumericBlanks(9)) Condenser(CondNum).RefOpCharge = Numbers(9);
    3572           1 :                 if (!lNumericBlanks(10)) Condenser(CondNum).RefReceiverInventory = Numbers(10);
    3573           1 :                 if (!lNumericBlanks(11)) Condenser(CondNum).RefPipingInventory = Numbers(11);
    3574             : 
    3575             :             } // Read input for CONDENSER:REFRIGERATION:WaterCooled
    3576             : 
    3577           1 :             state.dataRefrigCase->CheckEquipNameWaterCondenser.dimension(state.dataRefrigCase->NumRefrigCondensers, true);
    3578             :         } // NumSimulationCondWater > 0
    3579             : 
    3580             :         // cascade condensers assumed to provide zero subcooling
    3581          15 :         if (state.dataRefrigCase->NumSimulationCascadeCondensers > 0) {
    3582           1 :             CurrentModuleObject = "Refrigeration:Condenser:Cascade";
    3583           2 :             for (int CondIndex = 1; CondIndex <= state.dataRefrigCase->NumSimulationCascadeCondensers; ++CondIndex) {
    3584           1 :                 int CondNum = CondIndex + state.dataRefrigCase->NumSimulationCondAir + state.dataRefrigCase->NumSimulationCondEvap +
    3585           1 :                               state.dataRefrigCase->NumSimulationCondWater;
    3586           1 :                 state.dataInputProcessing->inputProcessor->getObjectItem(state,
    3587             :                                                                          CurrentModuleObject,
    3588             :                                                                          CondIndex,
    3589             :                                                                          Alphas,
    3590             :                                                                          NumAlphas,
    3591             :                                                                          Numbers,
    3592             :                                                                          NumNumbers,
    3593             :                                                                          IOStatus,
    3594             :                                                                          lNumericBlanks,
    3595             :                                                                          lAlphaBlanks,
    3596             :                                                                          cAlphaFieldNames,
    3597             :                                                                          cNumericFieldNames);
    3598             : 
    3599           2 :                 GlobalNames::VerifyUniqueInterObjectName(
    3600           2 :                     state, state.dataRefrigCase->UniqueCondenserNames, Alphas(1), CurrentModuleObject, cAlphaFieldNames(1), ErrorsFound);
    3601           1 :                 Condenser(CondNum).Name = Alphas(1);
    3602           1 :                 state.dataHeatBal->HeatReclaimRefrigCondenser(CondNum).Name = Alphas(1);
    3603             : 
    3604             :                 // set start of count for number of systems attached to this condenser
    3605           1 :                 Condenser(CondNum).NumSysAttach = 0;
    3606           1 :                 if (!allocated(Condenser(CondNum).SysNum)) Condenser(CondNum).SysNum.allocate(state.dataRefrigCase->NumRefrigSystems);
    3607             : 
    3608             :                 // set CondenserType
    3609           1 :                 Condenser(CondNum).CondenserType = DataHeatBalance::RefrigCondenserType::Cascade;
    3610             : 
    3611           1 :                 if (!lNumericBlanks(1)) {
    3612           1 :                     Condenser(CondNum).RatedTCondense = Numbers(1);
    3613             :                 } else {
    3614           0 :                     ShowSevereError(state,
    3615           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + Condenser(CondNum).Name + "\" " + cNumericFieldNames(1) +
    3616             :                                         " must be input.");
    3617           0 :                     ErrorsFound = true;
    3618             :                 }
    3619             : 
    3620           1 :                 if (!lNumericBlanks(2)) {
    3621           1 :                     if (Numbers(2) >= 0.0) {
    3622           1 :                         Condenser(CondNum).RatedApproachT = Numbers(2);
    3623             :                     } else {
    3624           0 :                         ShowSevereError(state,
    3625           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + Condenser(CondNum).Name + "\" " +
    3626           0 :                                             cNumericFieldNames(2) + " must be greater than or equal to zero.");
    3627           0 :                         ErrorsFound = true;
    3628             :                     }
    3629             :                 } else {
    3630           0 :                     Condenser(CondNum).RatedApproachT = DefaultCascadeCondApproach;
    3631             :                 }
    3632             : 
    3633           1 :                 if ((!lNumericBlanks(3)) && (Numbers(3) > 0.0)) {
    3634           1 :                     Condenser(CondNum).RatedCapacity = Numbers(3);
    3635             :                 } else {
    3636           0 :                     ShowSevereError(state,
    3637           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + Condenser(CondNum).Name + "\" " + cNumericFieldNames(3) +
    3638             :                                         " must be in put and must be greater than or equal to zero.");
    3639           0 :                     ErrorsFound = true;
    3640             :                 }
    3641             : 
    3642             :                 // Get condensing temperature type, either fixed by design or allowed to float to match other loads on supply system
    3643           1 :                 if (!lAlphaBlanks(2)) {
    3644           1 :                     if (UtilityRoutines::SameString(Alphas(2), "Fixed")) { // set Condenser Temperature Control Type
    3645           1 :                         Condenser(CondNum).CascadeTempControl = CascadeCndsrTempCtrlType::TempSet;
    3646           0 :                     } else if (UtilityRoutines::SameString(Alphas(2), "Float")) {
    3647           0 :                         Condenser(CondNum).CascadeTempControl = CascadeCndsrTempCtrlType::TempFloat;
    3648             :                     } else {
    3649           0 :                         ShowSevereError(state,
    3650           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + Condenser(CondNum).Name + "\", invalid  " +
    3651           0 :                                             cAlphaFieldNames(2) + " not recognized: " + Alphas(2));
    3652           0 :                         ShowContinueError(state, "Check input value choices.");
    3653           0 :                         ErrorsFound = true;
    3654             :                     }    // string comparison to key choices
    3655             :                 } else { // default is fixed/cascadetempset
    3656           0 :                     Condenser(CondNum).CascadeTempControl = CascadeCndsrTempCtrlType::TempSet;
    3657             :                 } // not blank
    3658             : 
    3659           1 :                 Condenser(CondNum).CascadeRatedEvapTemp = Condenser(CondNum).RatedTCondense - Condenser(CondNum).RatedApproachT;
    3660             : 
    3661             :                 // future - add refrigerant inventory on system side accepting reject heat (as was done for secondary)
    3662           1 :                 Condenser(CondNum).RefOpCharge = 0.0;
    3663           1 :                 Condenser(CondNum).RefReceiverInventory = 0.0;
    3664           1 :                 Condenser(CondNum).RefPipingInventory = 0.0;
    3665           1 :                 if (!lNumericBlanks(4)) Condenser(CondNum).RefOpCharge = Numbers(4);
    3666           1 :                 if (!lNumericBlanks(5)) Condenser(CondNum).RefReceiverInventory = Numbers(5);
    3667           1 :                 if (!lNumericBlanks(6)) Condenser(CondNum).RefPipingInventory = Numbers(6);
    3668             : 
    3669             :             } // Read input for CONDENSER:REFRIGERATION:Cascade
    3670             :         }     // NumSimulationCascadeCondensers > 0
    3671             : 
    3672             :         //************ END CONDENSER INPUT   **************
    3673             : 
    3674             :         //**********  START GAS COOLER INPUT  **********
    3675             : 
    3676          15 :         if (state.dataRefrigCase->NumSimulationGasCooler > 0) {
    3677           1 :             CurrentModuleObject = "Refrigeration:GasCooler:AirCooled";
    3678           2 :             for (int GCNum = 1; GCNum <= state.dataRefrigCase->NumSimulationGasCooler; ++GCNum) {
    3679           1 :                 state.dataInputProcessing->inputProcessor->getObjectItem(state,
    3680             :                                                                          CurrentModuleObject,
    3681             :                                                                          GCNum,
    3682             :                                                                          Alphas,
    3683             :                                                                          NumAlphas,
    3684             :                                                                          Numbers,
    3685             :                                                                          NumNumbers,
    3686             :                                                                          IOStatus,
    3687             :                                                                          lNumericBlanks,
    3688             :                                                                          lAlphaBlanks,
    3689             :                                                                          cAlphaFieldNames,
    3690             :                                                                          cNumericFieldNames);
    3691           1 :                 UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound);
    3692           1 :                 GasCooler(GCNum).Name = Alphas(1);
    3693             : 
    3694           1 :                 GasCooler(GCNum).CapCurvePtr = Curve::GetCurveIndex(state, Alphas(2)); // convert curve name to number
    3695           1 :                 if (GasCooler(GCNum).CapCurvePtr == 0) {
    3696           0 :                     ShowSevereError(state,
    3697           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + GasCooler(GCNum).Name + "\", invalid " +
    3698           0 :                                         cAlphaFieldNames(2) + " not found:" + Alphas(2));
    3699           0 :                     ErrorsFound = true;
    3700             :                 }
    3701             : 
    3702             :                 // set start of count for number of systems attached to this gas cooler
    3703           1 :                 GasCooler(GCNum).NumSysAttach = 0;
    3704           1 :                 if (!allocated(GasCooler(GCNum).SysNum)) GasCooler(GCNum).SysNum.allocate(state.dataRefrigCase->NumTransRefrigSystems);
    3705             : 
    3706           1 :                 GasCooler(GCNum).RatedApproachT = 3.0; // rated CO2 gas cooler approach temperature
    3707           1 :                 if (GasCooler(GCNum).CapCurvePtr > 0) {
    3708           1 :                     GasCooler(GCNum).RatedCapacity = Curve::CurveValue(state, GasCooler(GCNum).CapCurvePtr, GasCooler(GCNum).RatedApproachT);
    3709             :                 }
    3710             :                 // elevation capacity correction on air-cooled condensers, Carrier correlation more conservative than Trane
    3711           1 :                 GasCooler(GCNum).RatedCapacity *= (1.0 - 7.17e-5 * state.dataEnvrn->Elevation);
    3712           1 :                 if (GasCooler(GCNum).RatedCapacity > 0.0) {
    3713           1 :                     Curve::GetCurveMinMaxValues(state, GasCooler(GCNum).CapCurvePtr, DelTempMin, DelTempMax);
    3714           1 :                     Real64 Capmin = Curve::CurveValue(state, GasCooler(GCNum).CapCurvePtr, DelTempMin) * (1.0 - 7.17e-5 * state.dataEnvrn->Elevation);
    3715           1 :                     Real64 Capmax = Curve::CurveValue(state, GasCooler(GCNum).CapCurvePtr, DelTempMax) * (1.0 - 7.17e-5 * state.dataEnvrn->Elevation);
    3716           1 :                     GasCooler(GCNum).TempSlope = (DelTempMax - DelTempMin) / ((Capmax - Capmin));
    3717           1 :                     GasCooler(GCNum).MinCondLoad = Capmax - DelTempMax / GasCooler(GCNum).TempSlope;
    3718             :                 } else {
    3719           0 :                     ShowSevereError(state,
    3720           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + GasCooler(GCNum).Name +
    3721             :                                         "\" Gas Cooler capacity curve must be input and must be greater than 0 Watts at 3C temperature difference.");
    3722           0 :                     ErrorsFound = true;
    3723             :                 }
    3724             : 
    3725             :                 // Get fan control type
    3726           1 :                 if (UtilityRoutines::SameString(Alphas(3), "FixedLinear")) {
    3727           0 :                     GasCooler(GCNum).FanSpeedControlType = FanSpeedCtrlType::ConstantSpeedLinear;
    3728           1 :                 } else if (UtilityRoutines::SameString(Alphas(3), "VariableSpeed")) {
    3729           0 :                     GasCooler(GCNum).FanSpeedControlType = FanSpeedCtrlType::VariableSpeed;
    3730           1 :                 } else if (UtilityRoutines::SameString(Alphas(3), "TwoSpeed")) {
    3731           0 :                     GasCooler(GCNum).FanSpeedControlType = FanSpeedCtrlType::TwoSpeed;
    3732             :                 } else {
    3733           1 :                     GasCooler(GCNum).FanSpeedControlType = FanSpeedCtrlType::ConstantSpeed; // default
    3734             :                 }                                                                           // Set fan control type
    3735             : 
    3736             :                 // Gas cooler fan power
    3737           1 :                 GasCooler(GCNum).RatedFanPower = 5000.0; // default value
    3738           1 :                 if (!lNumericBlanks(1)) GasCooler(GCNum).RatedFanPower = Numbers(1);
    3739           1 :                 if (Numbers(1) < 0.0) {
    3740           0 :                     ShowSevereError(state,
    3741           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + GasCooler(GCNum).Name + "\" " + cNumericFieldNames(1) +
    3742             :                                         " must be input greater than or equal to 0 Watts.");
    3743           0 :                     ErrorsFound = true;
    3744             :                 }
    3745             : 
    3746             :                 // Gas cooler minimum fan air flow ratio
    3747           1 :                 GasCooler(GCNum).FanMinAirFlowRatio = 0.2; // default value
    3748           1 :                 if (!lNumericBlanks(2)) GasCooler(GCNum).FanMinAirFlowRatio = Numbers(2);
    3749           1 :                 if ((GasCooler(GCNum).FanMinAirFlowRatio < 0.0) || (GasCooler(GCNum).FanMinAirFlowRatio > 1.0)) {
    3750           0 :                     ShowSevereError(state,
    3751           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + GasCooler(GCNum).Name + "\" " + cNumericFieldNames(2) +
    3752             :                                         " must be a value between zero and one.  The default value (0.2) will be used.");
    3753           0 :                     GasCooler(GCNum).FanMinAirFlowRatio = 0.2;
    3754             :                 }
    3755             : 
    3756             :                 // Gas cooler transition temperature
    3757           1 :                 GasCooler(GCNum).TransitionTemperature = 2.7e1; // default value
    3758           1 :                 if (!lNumericBlanks(3)) GasCooler(GCNum).TransitionTemperature = Numbers(3);
    3759           1 :                 if (GasCooler(GCNum).TransitionTemperature < 2.5e1) {
    3760           0 :                     ShowWarningError(state,
    3761           0 :                                      std::string{RoutineName} + CurrentModuleObject + "=\"" + GasCooler(GCNum).Name + "\" " + cNumericFieldNames(3) +
    3762             :                                          " is low (less than 25C).  Consider raising the transition temperature to operate for longer periods of "
    3763             :                                          "time in the subcritical region.");
    3764             :                 }
    3765           1 :                 if (GasCooler(GCNum).TransitionTemperature > 30.978) {
    3766           0 :                     ShowWarningError(state,
    3767           0 :                                      std::string{RoutineName} + CurrentModuleObject + "=\"" + GasCooler(GCNum).Name + "\" " + cNumericFieldNames(3) +
    3768             :                                          " is greater than the critical temperature of carbon dioxide.  The default value (27C) will be used.");
    3769           0 :                     GasCooler(GCNum).TransitionTemperature = 2.7e1;
    3770             :                 }
    3771             : 
    3772             :                 // Gas cooler approach temperature for transcritical operation
    3773           1 :                 GasCooler(GCNum).GasCoolerApproachT = 3.0; // default value
    3774           1 :                 if (!lNumericBlanks(4)) GasCooler(GCNum).GasCoolerApproachT = Numbers(4);
    3775           1 :                 if (GasCooler(GCNum).GasCoolerApproachT < 0.0) {
    3776           0 :                     ShowSevereError(state,
    3777           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + GasCooler(GCNum).Name + "\" " + cNumericFieldNames(4) +
    3778             :                                         " must be greater than 0C.");
    3779           0 :                     ErrorsFound = true;
    3780             :                 }
    3781             : 
    3782             :                 // Gas cooler temperature difference for subcritical operation
    3783           1 :                 GasCooler(GCNum).SubcriticalTempDiff = 1.0e1; // default value
    3784           1 :                 if (!lNumericBlanks(5)) GasCooler(GCNum).SubcriticalTempDiff = Numbers(5);
    3785           1 :                 if (GasCooler(GCNum).SubcriticalTempDiff < 0.0) {
    3786           0 :                     ShowSevereError(state,
    3787           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + GasCooler(GCNum).Name + "\" " + cNumericFieldNames(5) +
    3788             :                                         " must be greater than 0C.");
    3789           0 :                     ErrorsFound = true;
    3790             :                 }
    3791             : 
    3792             :                 // Gas cooler minimum condensing temperature for subcritical operation
    3793           1 :                 GasCooler(GCNum).MinCondTemp = 1.0e1; // default value
    3794           1 :                 if (!lNumericBlanks(6)) GasCooler(GCNum).MinCondTemp = Numbers(6);
    3795           1 :                 if (GasCooler(GCNum).MinCondTemp > 30.9) {
    3796           0 :                     ShowSevereError(state,
    3797           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + GasCooler(GCNum).Name + "\" " + cNumericFieldNames(6) +
    3798             :                                         " must be less than the critical temperature of carbon dioxide (31C).");
    3799           0 :                     ErrorsFound = true;
    3800             :                 }
    3801             : 
    3802             :                 // Check GasCooler air inlet node connection
    3803           1 :                 GasCooler(GCNum).GasCoolerRejectHeatToZone = false;
    3804           1 :                 if (lAlphaBlanks(4)) {
    3805           1 :                     GasCooler(GCNum).InletAirNodeNum = 0;
    3806             :                 } else { // see if it's an outside air node name or an indoor zone name,
    3807             :                     // have to check inside first because outside check automatically generates an error message
    3808           0 :                     GasCooler(GCNum).InletAirZoneNum = UtilityRoutines::FindItemInList(Alphas(4), state.dataHeatBal->Zone);
    3809             :                     // need to clearly id node number for air inlet conditions and zone number for casecredit assignment
    3810           0 :                     if (GasCooler(GCNum).InletAirZoneNum != 0) {
    3811             :                         // set condenser flag (later used to set system flag) and zone flag
    3812           0 :                         GasCooler(GCNum).InletAirNodeNum = DataZoneEquipment::GetSystemNodeNumberForZone(state, GasCooler(GCNum).InletAirZoneNum);
    3813           0 :                         GasCooler(GCNum).GasCoolerRejectHeatToZone = true;
    3814           0 :                         state.dataRefrigCase->RefrigPresentInZone(GasCooler(GCNum).InletAirZoneNum) = true;
    3815             :                     } else { // not in a conditioned zone, so see if it's outside
    3816           0 :                         GasCooler(GCNum).InletAirNodeNum =
    3817           0 :                             NodeInputManager::GetOnlySingleNode(state,
    3818           0 :                                                                 Alphas(4),
    3819             :                                                                 ErrorsFound,
    3820             :                                                                 DataLoopNode::ConnectionObjectType::RefrigerationGasCoolerAirCooled,
    3821           0 :                                                                 Alphas(1),
    3822             :                                                                 DataLoopNode::NodeFluidType::Air,
    3823             :                                                                 DataLoopNode::ConnectionType::OutsideAirReference,
    3824             :                                                                 NodeInputManager::CompFluidStream::Primary,
    3825           0 :                                                                 DataLoopNode::ObjectIsParent);
    3826           0 :                         if (!OutAirNodeManager::CheckOutAirNodeNumber(state, GasCooler(GCNum).InletAirNodeNum)) {
    3827             :                             // not outside and not a zone
    3828           0 :                             ShowSevereError(state,
    3829           0 :                                             std::string{RoutineName} + CurrentModuleObject + "=\"" + GasCooler(GCNum).Name + "\", " +
    3830           0 :                                                 cAlphaFieldNames(4) + " not found: " + Alphas(4));
    3831           0 :                             ShowContinueError(state, "...does not appear in an OutdoorAir:NodeList or as an OutdoorAir:Node or as a Zone.");
    3832           0 :                             ErrorsFound = true;
    3833             :                         } // checkoutairnodenumber
    3834             :                     }     // InletAirZoneNum \=0
    3835             :                 }         // Gas cooler air inlet node connection
    3836             : 
    3837           1 :                 GasCooler(GCNum).EndUseSubcategory = "";
    3838           1 :                 if (!lAlphaBlanks(5)) GasCooler(GCNum).EndUseSubcategory = Alphas(5);
    3839             : 
    3840           1 :                 GasCooler(GCNum).RefOpCharge = 0.0;
    3841           1 :                 GasCooler(GCNum).RefReceiverInventory = 0.0;
    3842           1 :                 GasCooler(GCNum).RefPipingInventory = 0.0;
    3843           1 :                 if (!lNumericBlanks(7)) GasCooler(GCNum).RefOpCharge = Numbers(7);
    3844           1 :                 if (!lNumericBlanks(8)) GasCooler(GCNum).RefReceiverInventory = Numbers(8);
    3845           1 :                 if (!lNumericBlanks(9)) GasCooler(GCNum).RefPipingInventory = Numbers(9);
    3846             : 
    3847             :             } // Read input for REFRIGERATION:GasCooler:AirCooled
    3848             :         }     // NumSimulationGasCooler > 0
    3849             : 
    3850             :         //**********  END GAS COOLER INPUT  **********
    3851             : 
    3852             :         //************ START SECONDARY LOOP INPUT (before system input) **************
    3853          15 :         if (state.dataRefrigCase->NumSimulationSecondarySystems > 0) {
    3854           1 :             CurrentModuleObject = "Refrigeration:SecondarySystem";
    3855           3 :             for (int SecondaryNum = 1; SecondaryNum <= state.dataRefrigCase->NumSimulationSecondarySystems; ++SecondaryNum) {
    3856           2 :                 state.dataInputProcessing->inputProcessor->getObjectItem(state,
    3857             :                                                                          CurrentModuleObject,
    3858             :                                                                          SecondaryNum,
    3859             :                                                                          Alphas,
    3860             :                                                                          NumAlphas,
    3861             :                                                                          Numbers,
    3862             :                                                                          NumNumbers,
    3863             :                                                                          IOStatus,
    3864             :                                                                          lNumericBlanks,
    3865             :                                                                          lAlphaBlanks,
    3866             :                                                                          cAlphaFieldNames,
    3867             :                                                                          cNumericFieldNames);
    3868           2 :                 UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound);
    3869             : 
    3870           2 :                 Secondary(SecondaryNum).Name = Alphas(1);
    3871             : 
    3872             :                 //   Find the loads on the secondary loop: can be input in form of case or walkin or CaseAndWalkInList names
    3873           2 :                 Real64 NominalTotalCaseCap = 0.0;
    3874           2 :                 NumCases = 0;
    3875           2 :                 Real64 NominalTotalCoilCap = 0.0;
    3876           2 :                 int NumCoils = 0;
    3877           2 :                 NumWalkIns = 0;
    3878           2 :                 Real64 NominalTotalWalkInCap = 0.0;
    3879           2 :                 Secondary(SecondaryNum).RefInventory = 0.0;
    3880             : 
    3881             :                 //   Read display case and walkin assignments for this secondary
    3882           2 :                 AlphaNum = 2;
    3883           2 :                 if (lAlphaBlanks(AlphaNum)) {
    3884             :                     // No cases or walkins specified, ie, secondary has no load
    3885           0 :                     ShowSevereError(state,
    3886           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + Secondary(SecondaryNum).Name +
    3887           0 :                                         "\", has no loads, must have at least one of: " + cAlphaFieldNames(AlphaNum));
    3888           0 :                     ErrorsFound = true;
    3889             :                 } else { // (.NOT. lAlphaBlanks(AlphaNum))
    3890             : 
    3891             :                     // Entry for Alphas(AlphaNum) can be either a Case, WalkIn Coil, or CaseAndWalkInList name
    3892           2 :                     int CaseAndWalkInListNum = 0;
    3893           2 :                     int CaseNum = 0;
    3894           2 :                     int WalkInNum = 0;
    3895           2 :                     int CoilNum = 0;
    3896           2 :                     if (state.dataRefrigCase->NumSimulationCaseAndWalkInLists > 0)
    3897           2 :                         CaseAndWalkInListNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), CaseAndWalkInList);
    3898           2 :                     if (state.dataRefrigCase->NumSimulationCases > 0) CaseNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), RefrigCase);
    3899           2 :                     if (state.dataRefrigCase->NumSimulationWalkIns > 0) WalkInNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), WalkIn);
    3900           2 :                     if (state.dataRefrigCase->NumSimulationRefrigAirChillers > 0)
    3901           0 :                         CoilNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), WarehouseCoil);
    3902           2 :                     int NumNameMatches = 0;
    3903           2 :                     if (CaseAndWalkInListNum != 0) ++NumNameMatches;
    3904           2 :                     if (CaseNum != 0) ++NumNameMatches;
    3905           2 :                     if (WalkInNum != 0) ++NumNameMatches;
    3906           2 :                     if (CoilNum != 0) ++NumNameMatches;
    3907             : 
    3908           2 :                     if (NumNameMatches != 1) { // name must uniquely point to a list or a single case or walkin or coil
    3909           0 :                         ErrorsFound = true;
    3910           0 :                         if (NumNameMatches == 0) {
    3911           0 :                             ShowSevereError(state,
    3912           0 :                                             std::string{RoutineName} + CurrentModuleObject + "=\"" + Secondary(SecondaryNum).Name +
    3913           0 :                                                 "\", has an invalid " + cAlphaFieldNames(AlphaNum) + ": " + Alphas(AlphaNum));
    3914           0 :                         } else if (NumNameMatches > 1) {
    3915           0 :                             ShowSevereError(state,
    3916           0 :                                             std::string{RoutineName} + CurrentModuleObject + "=\"" + Secondary(SecondaryNum).Name +
    3917           0 :                                                 "\", has a non-unique name that could be either a " + cAlphaFieldNames(AlphaNum) + ": " +
    3918           0 :                                                 Alphas(AlphaNum));
    3919             :                         }                                   // num matches = 0 or > 1
    3920           2 :                     } else if (CaseAndWalkInListNum != 0) { // Name points to a CaseAndWalkInList
    3921           2 :                         NumCoils = CaseAndWalkInList(CaseAndWalkInListNum).NumCoils;
    3922           2 :                         NumCases = CaseAndWalkInList(CaseAndWalkInListNum).NumCases;
    3923           2 :                         NumWalkIns = CaseAndWalkInList(CaseAndWalkInListNum).NumWalkIns;
    3924           2 :                         Secondary(SecondaryNum).NumCases = NumCases;
    3925           2 :                         Secondary(SecondaryNum).NumCoils = NumCoils;
    3926           2 :                         Secondary(SecondaryNum).NumWalkIns = NumWalkIns;
    3927           2 :                         if (!allocated(Secondary(SecondaryNum).CaseNum)) Secondary(SecondaryNum).CaseNum.allocate(NumCases);
    3928           2 :                         Secondary(SecondaryNum).CaseNum({1, NumCases}) = CaseAndWalkInList(CaseAndWalkInListNum).CaseItemNum({1, NumCases});
    3929           2 :                         if (!allocated(Secondary(SecondaryNum).CoilNum)) Secondary(SecondaryNum).CoilNum.allocate(NumCoils);
    3930           2 :                         Secondary(SecondaryNum).CoilNum({1, NumCoils}) = CaseAndWalkInList(CaseAndWalkInListNum).CoilItemNum({1, NumCoils});
    3931           2 :                         if (!allocated(Secondary(SecondaryNum).WalkInNum)) Secondary(SecondaryNum).WalkInNum.allocate(NumWalkIns);
    3932           2 :                         Secondary(SecondaryNum).WalkInNum({1, NumWalkIns}) = CaseAndWalkInList(CaseAndWalkInListNum).WalkInItemNum({1, NumWalkIns});
    3933           0 :                     } else if (CaseNum != 0) { // Name points to a case
    3934           0 :                         NumCases = 1;
    3935           0 :                         Secondary(SecondaryNum).NumCases = 1;
    3936           0 :                         if (!allocated(Secondary(SecondaryNum).CaseNum)) Secondary(SecondaryNum).CaseNum.allocate(NumCases);
    3937           0 :                         Secondary(SecondaryNum).CaseNum(NumCases) = CaseNum;
    3938           0 :                     } else if (CoilNum != 0) { // Name points to a coil
    3939           0 :                         NumCoils = 1;
    3940           0 :                         Secondary(SecondaryNum).NumCoils = 1;
    3941           0 :                         if (!allocated(Secondary(SecondaryNum).CoilNum)) Secondary(SecondaryNum).CoilNum.allocate(NumCoils);
    3942           0 :                         Secondary(SecondaryNum).CoilNum(NumCoils) = CoilNum;
    3943           0 :                     } else if (WalkInNum != 0) { // Name points to a walkin
    3944           0 :                         NumWalkIns = 1;
    3945           0 :                         Secondary(SecondaryNum).NumWalkIns = 1;
    3946           0 :                         if (!allocated(Secondary(SecondaryNum).WalkInNum)) Secondary(SecondaryNum).WalkInNum.allocate(NumWalkIns);
    3947           0 :                         Secondary(SecondaryNum).WalkInNum(NumWalkIns) = WalkInNum;
    3948             :                     } // NumNameMatches /= 1
    3949             :                 }     // blank input for loads on secondary
    3950             : 
    3951           2 :                 if (NumCases > 0) {
    3952             :                     // Find lowest design T loop fluid out of secondary chiller
    3953             :                     // Sum rated capacity of all cases on Secondary
    3954           9 :                     for (int caseIndex = 1; caseIndex <= NumCases; ++caseIndex) {
    3955             :                         // mark all cases on Secondary as used by this Secondary - checking for unused or non-unique cases
    3956           7 :                         int CaseNum = Secondary(SecondaryNum).CaseNum(caseIndex);
    3957           7 :                         ++RefrigCase(CaseNum).NumSysAttach;
    3958           7 :                         NominalTotalCaseCap += RefrigCase(CaseNum).DesignRatedCap * RefrigCase(CaseNum).RatedRTF;
    3959           7 :                         Secondary(SecondaryNum).RefInventory += RefrigCase(CaseNum).DesignRefrigInventory;
    3960           7 :                         if (caseIndex == 1) { // look for lowest case design evap T for Secondary
    3961           2 :                             Secondary(SecondaryNum).TMinNeeded = RefrigCase(CaseNum).EvapTempDesign;
    3962             :                         } else {
    3963           5 :                             Secondary(SecondaryNum).TMinNeeded = min(RefrigCase(CaseNum).EvapTempDesign, Secondary(SecondaryNum).TMinNeeded);
    3964             :                         }
    3965             :                     } // CaseIndex=1,NumCases
    3966             :                 }     // Numcases > 0
    3967             : 
    3968           2 :                 if (NumCoils > 0) {
    3969             :                     // Find lowest design T loop fluid out of secondary chiller
    3970             :                     // Sum rated capacity of all Coils on Secondary
    3971           0 :                     for (int CoilIndex = 1; CoilIndex <= NumCoils; ++CoilIndex) {
    3972             :                         // mark all Coils on Secondary as used by this Secondary - checking for unused or non-unique Coils
    3973           0 :                         int CoilNum = Secondary(SecondaryNum).CoilNum(CoilIndex);
    3974           0 :                         ++WarehouseCoil(CoilNum).NumSysAttach;
    3975           0 :                         NominalTotalCoilCap += WarehouseCoil(CoilNum).RatedSensibleCap;
    3976           0 :                         Secondary(SecondaryNum).RefInventory += WarehouseCoil(CoilNum).DesignRefrigInventory;
    3977           0 :                         if ((CoilIndex == 1) && (NumCases == 0)) { // look for lowest Coil design evap T for Secondary
    3978           0 :                             Secondary(SecondaryNum).TMinNeeded = WarehouseCoil(CoilNum).TEvapDesign;
    3979             :                         } else {
    3980           0 :                             Secondary(SecondaryNum).TMinNeeded = min(WarehouseCoil(CoilNum).TEvapDesign, Secondary(SecondaryNum).TMinNeeded);
    3981             :                         }
    3982             :                     } // CoilIndex=1,NumCoils
    3983             :                 }     // NumCoils > 0
    3984             : 
    3985           2 :                 if (NumWalkIns > 0) {
    3986             :                     // Find lowest design T loop fluid out of secondary chiller
    3987             :                     // Sum rated capacity of all WalkIns on Secondary
    3988           2 :                     for (int WalkInIndex = 1; WalkInIndex <= NumWalkIns; ++WalkInIndex) {
    3989             :                         // mark all WalkIns on Secondary as used by this Secondary - checking for unused or non-unique WalkIns
    3990           1 :                         int WalkInID = Secondary(SecondaryNum).WalkInNum(WalkInIndex);
    3991           1 :                         ++WalkIn(WalkInID).NumSysAttach;
    3992           1 :                         NominalTotalWalkInCap += WalkIn(WalkInID).DesignRatedCap;
    3993           1 :                         Secondary(SecondaryNum).RefInventory += WalkIn(WalkInID).DesignRefrigInventory;
    3994           1 :                         if ((WalkInIndex == 1) && (NumCases == 0) && (NumCoils == 0)) { // look for lowest load design evap T for Secondary
    3995           0 :                             Secondary(SecondaryNum).TMinNeeded = WalkIn(WalkInID).TEvapDesign;
    3996             :                         } else {
    3997           1 :                             Secondary(SecondaryNum).TMinNeeded = min(Secondary(SecondaryNum).TMinNeeded, WalkIn(WalkInID).TEvapDesign);
    3998             :                         }
    3999             :                     } // WalkInIndex=1,NumWalkIns
    4000             :                 }     // Numwalkins > 0
    4001             : 
    4002             :                 // Get circulating fluid type
    4003           2 :                 AlphaNum = 3;
    4004           2 :                 if (!lAlphaBlanks(AlphaNum)) {
    4005           2 :                     if (UtilityRoutines::SameString(Alphas(AlphaNum), "FluidAlwaysLiquid")) {
    4006           1 :                         Secondary(SecondaryNum).FluidType = SecFluidType::AlwaysLiquid;
    4007           1 :                     } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "FluidPhaseChange")) {
    4008           1 :                         Secondary(SecondaryNum).FluidType = SecFluidType::PhaseChange;
    4009             :                     } else {
    4010           0 :                         ShowSevereError(state,
    4011           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + Secondary(SecondaryNum).Name + "\"  " +
    4012           0 :                                             cAlphaFieldNames(AlphaNum) + " not recognized = " + Alphas(AlphaNum));
    4013           0 :                         ShowContinueError(state, "Input value choices should be FluidAlwaysLiquid or FluidPhaseChange.");
    4014           0 :                         ErrorsFound = true;
    4015             :                     } // Set FluidType
    4016             :                 } else {
    4017           0 :                     ShowSevereError(state,
    4018           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + Secondary(SecondaryNum).Name + "\" " +
    4019           0 :                                         cAlphaFieldNames(AlphaNum) + " must be specified.");
    4020           0 :                     ErrorsFound = true;
    4021             :                 } // blank on cir fluid type
    4022             : 
    4023           2 :                 AlphaNum = 4;
    4024           2 :                 Secondary(SecondaryNum).FluidName = Alphas(AlphaNum);
    4025             :                 // Error messages for refrigerants and glycols already found in fluidproperties
    4026             : 
    4027             :                 // Note remainder of inputs for secondary don't follow IDD input order because of different interpretations
    4028             :                 //   and intermediate calculations used to assign default values for brine type vs. liquid overfeed/phase change loops
    4029             : 
    4030           2 :                 if (!lNumericBlanks(3)) {
    4031           2 :                     Secondary(SecondaryNum).TEvapDesign = Numbers(3);
    4032             :                 } else {
    4033           0 :                     ShowSevereError(state,
    4034           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + Secondary(SecondaryNum).Name + "\" " +
    4035           0 :                                         cNumericFieldNames(3) + " must be specified.");
    4036           0 :                     ErrorsFound = true;
    4037             :                 } // blank on N3
    4038             : 
    4039           2 :                 if (!lNumericBlanks(4)) {
    4040           2 :                     Secondary(SecondaryNum).TApproachDifRated = Numbers(4);
    4041             :                 } else {
    4042           0 :                     ShowSevereError(state,
    4043           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + Secondary(SecondaryNum).Name + "\" " +
    4044           0 :                                         cNumericFieldNames(4) + " must be specified.");
    4045           0 :                     ErrorsFound = true;
    4046             :                 } // blank on N4
    4047             : 
    4048             :                 //^^^^^^^Now look at input and once-only calculations required only for liquid/brine secondary loops^^^^^^^^^^^^^^^^^^^^^^
    4049             :                 //   Ensure that required input data is not missing prior to performing the following once-only calculations
    4050           2 :                 if (ErrorsFound) {
    4051           0 :                     ShowFatalError(state,
    4052           0 :                                    std::string{RoutineName} + CurrentModuleObject + "=\"" + Secondary(SecondaryNum).Name +
    4053             :                                        "\", Program terminated due to previous condition(s).");
    4054             :                 } // ErrorsFound
    4055             : 
    4056           2 :                 Real64 CpBrineRated = 0.0;
    4057           2 :                 Real64 PumpTotRatedFlowVol(0.0);   // Rated flow from input pump data, m3/s
    4058           2 :                 Real64 SecondaryFlowVolRated(0.0); // Rated flow of secondary fluid, used to calculate capacity (m3/s)
    4059           2 :                 Real64 TBrineOutRated(0.0);        // Rated temperature of circ fluid LEAVING heat exchanger,C
    4060           2 :                 Real64 TBrineInRated(0.0);         // Rated temperature of circ fluid going INTO heat exchanger, C
    4061             : 
    4062           2 :                 if (Secondary(SecondaryNum).FluidType == SecFluidType::AlwaysLiquid) {
    4063           1 :                     if (!lNumericBlanks(5)) {
    4064           1 :                         Secondary(SecondaryNum).TRangeDifRated = Numbers(5);
    4065             :                     } else {
    4066           0 :                         ShowSevereError(state,
    4067           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + Secondary(SecondaryNum).Name + "\", " +
    4068           0 :                                             cNumericFieldNames(5) + " must be specified.");
    4069           0 :                         ShowContinueError(state, "...when " + cAlphaFieldNames(3) + "=\"FluidAlwaysLiquid\".");
    4070           0 :                         ErrorsFound = true;
    4071             :                     } // blank on N5
    4072             : 
    4073             :                     // Get fluid properties at rated conditions, will be used to calculate ht exchgr effectiveness
    4074           1 :                     TBrineOutRated = Secondary(SecondaryNum).TEvapDesign + Secondary(SecondaryNum).TApproachDifRated;
    4075           1 :                     TBrineInRated = TBrineOutRated + Secondary(SecondaryNum).TRangeDifRated;
    4076           1 :                     Real64 TBrineAverage = (TBrineOutRated + TBrineInRated) / 2.0;
    4077           1 :                     Secondary(SecondaryNum).TBrineAverage = TBrineAverage;
    4078           2 :                     DensityBrineRated = FluidProperties::GetDensityGlycol(
    4079           2 :                         state, Secondary(SecondaryNum).FluidName, TBrineAverage, Secondary(SecondaryNum).FluidID, TrackMessage);
    4080           1 :                     Secondary(SecondaryNum).DensityBrineRated = DensityBrineRated;
    4081           2 :                     CpBrineRated = FluidProperties::GetSpecificHeatGlycol(
    4082           2 :                         state, Secondary(SecondaryNum).FluidName, TBrineAverage, Secondary(SecondaryNum).FluidID, TrackMessage);
    4083           1 :                     Secondary(SecondaryNum).CpBrineRated = CpBrineRated;
    4084             : 
    4085             :                     // Users can input either design brine flow (m3/s), or capacity in W, or both.  Now have
    4086             :                     //  temperatures needed to calculate either the loop cooling capacity or fluid flow rate, if one was not input
    4087             :                     //  Don't need to save as a flow vol as a permanent var because calc whichever is missing here
    4088           1 :                     Real64 FlowMassRated(0.0); // Design mass flow rate of circ fluid in secondary loop(kg/s)
    4089           1 :                     if ((!lNumericBlanks(1)) && (!lNumericBlanks(2))) {
    4090             :                         // Both values input, check for approximate agreement
    4091           1 :                         Secondary(SecondaryNum).CoolingLoadRated = Numbers(1);
    4092           1 :                         SecondaryFlowVolRated = Numbers(2);
    4093           1 :                         FlowMassRated = SecondaryFlowVolRated * DensityBrineRated;
    4094           1 :                         Real64 NominalSecondaryCapacity = FlowMassRated * CpBrineRated * Secondary(SecondaryNum).TRangeDifRated;
    4095           1 :                         Real64 TestDelta = (NominalSecondaryCapacity - Secondary(SecondaryNum).CoolingLoadRated) / NominalSecondaryCapacity;
    4096           1 :                         if (std::abs(TestDelta) > 0.2) {
    4097           0 :                             ShowWarningError(state,
    4098           0 :                                              format("{}=\"{} You may wish to check the system definition. Based upon the design flow rate and "
    4099             :                                                     "range temperature difference,  The nominal secondary loop heat exchanger capacity is, "
    4100             :                                                     "{:.0R} but the specified design capacity is,  {:.0R}",
    4101             :                                                     CurrentModuleObject,
    4102           0 :                                                     Secondary(SecondaryNum).Name,
    4103             :                                                     NominalSecondaryCapacity,
    4104           0 :                                                     Secondary(SecondaryNum).CoolingLoadRated));
    4105             :                         }
    4106           0 :                     } else if (!lNumericBlanks(1)) {
    4107           0 :                         Secondary(SecondaryNum).CoolingLoadRated = Numbers(1);
    4108             :                         // Calc flow vol rated
    4109           0 :                         FlowMassRated = Secondary(SecondaryNum).CoolingLoadRated / (CpBrineRated * Secondary(SecondaryNum).TRangeDifRated);
    4110           0 :                         SecondaryFlowVolRated = FlowMassRated / DensityBrineRated;
    4111           0 :                     } else if (!lNumericBlanks(2)) {
    4112           0 :                         SecondaryFlowVolRated = Numbers(2);
    4113             :                         // Calc rated load
    4114           0 :                         FlowMassRated = SecondaryFlowVolRated * DensityBrineRated;
    4115           0 :                         Secondary(SecondaryNum).CoolingLoadRated = FlowMassRated * CpBrineRated * Secondary(SecondaryNum).TRangeDifRated;
    4116             :                     } else {
    4117           0 :                         ShowSevereError(state,
    4118           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + Secondary(SecondaryNum).Name + "\", Either \"" +
    4119           0 :                                             cNumericFieldNames(1) + "\" OR \"" + cNumericFieldNames(2) + "\" must be input.");
    4120           0 :                         ErrorsFound = true;
    4121             :                     } // Capacity Input via either or both options
    4122             : 
    4123           1 :                     if (!ErrorsFound) {
    4124             :                         // Calculate heat exchanger effectiveness based on rated flow and temperature differences
    4125           1 :                         Secondary(SecondaryNum).HeatExchangeEta =
    4126           2 :                             Secondary(SecondaryNum).CoolingLoadRated /
    4127           1 :                             (FlowMassRated * CpBrineRated * (TBrineInRated - Secondary(SecondaryNum).TEvapDesign));
    4128           1 :                         Secondary(SecondaryNum).TBrineInRated = TBrineInRated;
    4129           1 :                         if (Secondary(SecondaryNum).HeatExchangeEta > 0.99) {
    4130           0 :                             ShowWarningError(
    4131             :                                 state,
    4132           0 :                                 format("{}=\"{} You may wish to check the system definition.  The heat exchanger effectiveness is, {:.2R}",
    4133             :                                        CurrentModuleObject,
    4134           0 :                                        Secondary(SecondaryNum).Name,
    4135           0 :                                        Secondary(SecondaryNum).HeatExchangeEta));
    4136           0 :                             Secondary(SecondaryNum).HeatExchangeEta = 0.99;
    4137             :                         }
    4138             :                     } else {
    4139           0 :                         ShowContinueError(state, "...remainder of this object input skipped due to previous errors");
    4140           0 :                         continue;
    4141             :                     }
    4142             : 
    4143           1 :                     PumpTotRatedFlowVol = SecondaryFlowVolRated;
    4144           1 :                     if (!lNumericBlanks(7)) PumpTotRatedFlowVol = Numbers(7);
    4145             : 
    4146             :                 } else { // FluidType = FluidTypePhaseChange     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    4147           1 :                     if (!lNumericBlanks(1)) {
    4148           0 :                         Secondary(SecondaryNum).CoolingLoadRated = Numbers(1);
    4149             :                     } else {
    4150           1 :                         Secondary(SecondaryNum).CoolingLoadRated = NominalTotalCaseCap + NominalTotalWalkInCap;
    4151             :                         // first estimate, will later be adjusted to include pump power
    4152             :                     } // input capacity
    4153             : 
    4154           1 :                     Secondary(SecondaryNum).TCondense = Secondary(SecondaryNum).TEvapDesign + Secondary(SecondaryNum).TApproachDifRated;
    4155           1 :                     Secondary(SecondaryNum).CircRate = DefaultCircRate;
    4156           1 :                     if (!lNumericBlanks(10)) Secondary(SecondaryNum).CircRate = Numbers(10);
    4157             : 
    4158           3 :                     DensityPhaseChange = FluidProperties::GetSatDensityRefrig(state,
    4159           1 :                                                                               Secondary(SecondaryNum).FluidName,
    4160           1 :                                                                               Secondary(SecondaryNum).TCondense,
    4161             :                                                                               0.0,
    4162           1 :                                                                               Secondary(SecondaryNum).FluidID,
    4163             :                                                                               TrackMessageAlt);
    4164           4 :                     DeltaHPhaseChange = FluidProperties::GetSatEnthalpyRefrig(state,
    4165           1 :                                                                               Secondary(SecondaryNum).FluidName,
    4166           1 :                                                                               Secondary(SecondaryNum).TCondense,
    4167             :                                                                               1.0,
    4168           1 :                                                                               Secondary(SecondaryNum).FluidID,
    4169             :                                                                               TrackMessageAlt) -
    4170           3 :                                         FluidProperties::GetSatEnthalpyRefrig(state,
    4171           1 :                                                                               Secondary(SecondaryNum).FluidName,
    4172           1 :                                                                               Secondary(SecondaryNum).TCondense,
    4173             :                                                                               0.0,
    4174           1 :                                                                               Secondary(SecondaryNum).FluidID,
    4175             :                                                                               TrackMessageAlt);
    4176             : 
    4177             :                     // TotRatedFlowVol= capacity*circrate/deltahphasechange/density
    4178             :                     Real64 CalcTotFlowVol =
    4179           1 :                         Secondary(SecondaryNum).CoolingLoadRated * Secondary(SecondaryNum).CircRate / (DensityPhaseChange * DeltaHPhaseChange);
    4180           1 :                     PumpTotRatedFlowVol = CalcTotFlowVol;
    4181           1 :                     if (!lNumericBlanks(7)) {
    4182           0 :                         PumpTotRatedFlowVol = Numbers(7);
    4183           0 :                         Real64 CalcCircRate = DensityPhaseChange * DeltaHPhaseChange * PumpTotRatedFlowVol / Secondary(SecondaryNum).CoolingLoadRated;
    4184           0 :                         Real64 DiffCircRates = (CalcCircRate - Secondary(SecondaryNum).CircRate) / Secondary(SecondaryNum).CircRate;
    4185           0 :                         if (std::abs(DiffCircRates) > 0.3) {
    4186           0 :                             ShowWarningError(state,
    4187           0 :                                              format("{}=\"{} {} Produces a circulating rate of {:.2R} ;  A circulating rate of {:.2R} would need "
    4188             :                                                     "a {} of {:.2R} m3/s",
    4189             :                                                     CurrentModuleObject,
    4190           0 :                                                     Secondary(SecondaryNum).Name,
    4191             :                                                     cNumericFieldNames(7),
    4192             :                                                     CalcCircRate,
    4193           0 :                                                     Secondary(SecondaryNum).CircRate,
    4194             :                                                     cNumericFieldNames(7),
    4195           0 :                                                     CalcTotFlowVol));
    4196             :                         } // warning check on pump flow rate vs circ rate input
    4197             :                     }     // blank pump flow rate
    4198           1 :                     SecondaryFlowVolRated = PumpTotRatedFlowVol;
    4199             : 
    4200             :                 } // fluid type AlwaysLiquid or PhaseChange ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    4201             : 
    4202             :                 // Read number of pumps (or pump stages) in secondary loop
    4203           2 :                 int NumPumps = 1; // default value
    4204           2 :                 if ((!lNumericBlanks(6)) && (Numbers(6) >= 1)) NumPumps = Numbers(6);
    4205           2 :                 Secondary(SecondaryNum).NumPumps = NumPumps;
    4206             :                 // Get pump power (users can input either power in W or head in Pa or both)
    4207             :                 // Assume pump impeller efficiency is 0.78 (consistent with E+ Pump auto sizing assumption)
    4208             :                 // Assume pump motor efficiency is 0.85 (Goulds Pumps motor data sheet)
    4209             :                 // It is important that tot rated head must be for specific fluid
    4210           2 :                 Real64 PumpTotRatedHead(0.0); // Total pump rated head on secondary loop (Pa)
    4211             : 
    4212           2 :                 if ((!lNumericBlanks(8)) && (!lNumericBlanks(9))) {
    4213           0 :                     Secondary(SecondaryNum).PumpTotRatedPower = Numbers(8);
    4214           0 :                     PumpTotRatedHead = Numbers(9);
    4215           0 :                     Real64 ErrSecondPumpPower = (Secondary(SecondaryNum).PumpTotRatedPower -
    4216           0 :                                                  PumpTotRatedFlowVol * PumpTotRatedHead / (PumpImpellerEfficiency * PumpMotorEfficiency)) /
    4217           0 :                                                 Secondary(SecondaryNum).PumpTotRatedPower;
    4218           0 :                     if (std::abs(ErrSecondPumpPower) > 0.35)
    4219           0 :                         ShowWarningError(state,
    4220           0 :                                          CurrentModuleObject + "=\"" + Secondary(SecondaryNum).Name + " Input value for " + cNumericFieldNames(9) +
    4221           0 :                                              " not consistent with input value for " + cNumericFieldNames(8) + ". " + cNumericFieldNames(8) +
    4222             :                                              " will be used"); // generous diff allowed because comparing to my assumed impeller and motor effs
    4223           2 :                 } else if (!lNumericBlanks(8)) {
    4224           0 :                     Secondary(SecondaryNum).PumpTotRatedPower = Numbers(8);
    4225           2 :                 } else if (!lNumericBlanks(9)) {
    4226           2 :                     PumpTotRatedHead = Numbers(9);
    4227           2 :                     Secondary(SecondaryNum).PumpTotRatedPower =
    4228           2 :                         PumpTotRatedFlowVol * PumpTotRatedHead / (PumpImpellerEfficiency * PumpMotorEfficiency);
    4229             :                 } else {
    4230           0 :                     ShowSevereError(state,
    4231           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + Secondary(SecondaryNum).Name + "\", Either \"" +
    4232           0 :                                         cNumericFieldNames(8) + "\" OR \"" + cNumericFieldNames(9) + "\" must be input.");
    4233           0 :                     ErrorsFound = true;
    4234             :                 } // Either or pump power Input variations (head or power)
    4235             : 
    4236             :                 // Get pump drive type
    4237           2 :                 AlphaNum = 5;
    4238           2 :                 Secondary(SecondaryNum).PumpControlType = SecPumpCtrl::Constant; // default
    4239           2 :                 if (!lAlphaBlanks(AlphaNum)) {
    4240           1 :                     if (UtilityRoutines::SameString(Alphas(AlphaNum), "Constant")) {
    4241           0 :                         Secondary(SecondaryNum).PumpControlType = SecPumpCtrl::Constant;
    4242           1 :                     } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "Variable")) {
    4243           1 :                         Secondary(SecondaryNum).PumpControlType = SecPumpCtrl::Variable;
    4244             :                     } else {
    4245           0 :                         ShowSevereError(state,
    4246           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + Secondary(SecondaryNum).Name + "\"  " +
    4247           0 :                                             cAlphaFieldNames(AlphaNum) + " not recognized = " + Alphas(AlphaNum));
    4248           0 :                         ShowContinueError(state, "Check input value choices.");
    4249           0 :                         ErrorsFound = true;
    4250             :                     } // Set PumpControlType
    4251             :                 }     // blank on pump drive control type
    4252             : 
    4253             :                 //  Print warning if Pump Control = Constant and Variable Speed Curve is specified.
    4254           2 :                 if ((Secondary(SecondaryNum).PumpControlType == SecPumpCtrl::Constant) && (!lAlphaBlanks(AlphaNum + 1))) {
    4255           0 :                     ShowWarningError(state,
    4256           0 :                                      std::string{RoutineName} + CurrentModuleObject + "=\"" + Secondary(SecondaryNum).Name + "\", A " +
    4257           0 :                                          cAlphaFieldNames(AlphaNum + 1) + " is specified even though " + cAlphaFieldNames(AlphaNum) +
    4258             :                                          " is \"CONSTANT\".");
    4259           0 :                     ShowContinueError(state,
    4260           0 :                                       "The secondary loop pump(s) will be modeled as constant speed and the " + cAlphaFieldNames(AlphaNum + 1) +
    4261             :                                           " will be ignored.");
    4262             :                 }
    4263             : 
    4264           2 :                 if (Secondary(SecondaryNum).PumpControlType == SecPumpCtrl::Constant) {
    4265             :                     // Set incremental flow and power amounts for pump dispatch
    4266           1 :                     Secondary(SecondaryNum).PumpIncrementFlowVol = PumpTotRatedFlowVol / NumPumps;
    4267           1 :                     Secondary(SecondaryNum).PumpIncrementPower = Secondary(SecondaryNum).PumpTotRatedPower / NumPumps;
    4268             :                 } else { // Variable speed drive need to read in power curve
    4269           1 :                     AlphaNum = 6;
    4270           1 :                     Secondary(SecondaryNum).VarSpeedCurvePtr = Curve::GetCurveIndex(state, Alphas(AlphaNum)); // convert curve name to number
    4271           1 :                     if (Secondary(SecondaryNum).VarSpeedCurvePtr == 0) {
    4272           0 :                         ShowSevereError(state,
    4273           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + Secondary(SecondaryNum).Name + "\", invalid  " +
    4274           0 :                                             cAlphaFieldNames(AlphaNum) + " not found:" + Alphas(AlphaNum));
    4275           0 :                         ErrorsFound = true;
    4276             :                     }
    4277           3 :                     ErrorsFound |= Curve::CheckCurveDims(state,
    4278           1 :                                                          Secondary(SecondaryNum).VarSpeedCurvePtr, // Curve index
    4279             :                                                          {1},                                      // Valid dimensions
    4280             :                                                          RoutineName,                              // Routine name
    4281             :                                                          CurrentModuleObject,                      // Object Type
    4282           1 :                                                          Secondary(SecondaryNum).Name,             // Object Name
    4283           1 :                                                          cAlphaFieldNames(AlphaNum));              // Field Name
    4284             :                 } // input power conditions/levels for constant or variable speed pump drives
    4285             : 
    4286             :                 // Default non-hermetic motor eff at 85% and all shaft power goes to heat in fluid
    4287             :                 // In a semi-hermetic motor, assume all power to motor goes to heat in fluid
    4288           2 :                 Secondary(SecondaryNum).PumpPowerToHeat = PumpMotorEfficiency;
    4289           2 :                 NumNum = 11;
    4290           2 :                 if (!lNumericBlanks(NumNum)) {
    4291           2 :                     if ((0.5 <= Numbers(NumNum)) && (1.0 >= Numbers(NumNum))) {
    4292           2 :                         Secondary(SecondaryNum).PumpPowerToHeat = Numbers(NumNum);
    4293             :                     } else {
    4294           0 :                         ShowWarningError(state,
    4295           0 :                                          format("{}{}=\"{}\" {} must be between 0.5 and 1.0. Default value of : {:.3R} will be used",
    4296             :                                                 RoutineName,
    4297             :                                                 CurrentModuleObject,
    4298           0 :                                                 Secondary(SecondaryNum).Name,
    4299             :                                                 cNumericFieldNames(NumNum),
    4300           0 :                                                 PumpMotorEfficiency));
    4301             :                     } // range of pump moter heat to fluid
    4302             :                 }     // blank input for pumppowertoheat
    4303             : 
    4304             :                 // Distribution piping heat gain - optional
    4305             :                 //  Input UA and Zone containing the bulk of the secondary coolant distribution piping
    4306             :                 //  This Zone ID will be used to determine the temperature used for distribution piping heat gain.
    4307             :                 //  Zone Id is only required if Sum UA Distribution Piping >0.0
    4308             :                 //  Get the Zone node number from the zone name entered by the user
    4309           2 :                 Secondary(SecondaryNum).SumUADistPiping = 0.0;
    4310           2 :                 AlphaNum = 7;
    4311           2 :                 NumNum = 12;
    4312           2 :                 if (!lNumericBlanks(NumNum) && !lAlphaBlanks(AlphaNum)) {
    4313           2 :                     Secondary(SecondaryNum).SumUADistPiping = Numbers(NumNum);
    4314           2 :                     Secondary(SecondaryNum).DistPipeZoneNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), state.dataHeatBal->Zone);
    4315           2 :                     Secondary(SecondaryNum).DistPipeZoneNodeNum =
    4316           2 :                         DataZoneEquipment::GetSystemNodeNumberForZone(state, Secondary(SecondaryNum).DistPipeZoneNum);
    4317             : 
    4318           2 :                     if (Secondary(SecondaryNum).DistPipeZoneNum == 0) {
    4319           0 :                         ShowSevereError(state,
    4320           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + Secondary(SecondaryNum).Name + "\", invalid  " +
    4321           0 :                                             cAlphaFieldNames(AlphaNum) + " not valid: " + Alphas(AlphaNum));
    4322           0 :                         ErrorsFound = true;
    4323             :                     } else {
    4324           2 :                         state.dataRefrigCase->RefrigPresentInZone(Secondary(SecondaryNum).DistPipeZoneNum) = true;
    4325             :                     }
    4326             : 
    4327           2 :                     if (Secondary(SecondaryNum).DistPipeZoneNodeNum == 0) {
    4328           0 :                         ShowSevereError(state,
    4329           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + Secondary(SecondaryNum).Name +
    4330           0 :                                             "\" System Node Number not found for " + cAlphaFieldNames(AlphaNum) + " = " + Alphas(AlphaNum) +
    4331           0 :                                             " even though " + cNumericFieldNames(NumNum) +
    4332             :                                             " is greater than zero. Distribution piping heat gain cannot be calculated unless a controlled Zone "
    4333             :                                             "(appear in a ZoneHVAC:EquipmentConnections object.) is defined to determine the environmental "
    4334             :                                             "temperature surrounding the piping.");
    4335           0 :                         ErrorsFound = true;
    4336             :                     }
    4337           0 :                 } else if (!lNumericBlanks(NumNum) && lAlphaBlanks(AlphaNum)) {
    4338           0 :                     ShowWarningError(state,
    4339           0 :                                      std::string{RoutineName} + CurrentModuleObject + "=\"" + Secondary(SecondaryNum).Name + "\", " +
    4340           0 :                                          cAlphaFieldNames(AlphaNum) + " not found even though " + cNumericFieldNames(NumNum) +
    4341             :                                          " is greater than zero. Distribution piping heat gain will not be calculated unless a Zone is defined to "
    4342             :                                          "deterimine the environmental temperature surrounding the piping.");
    4343           0 :                 } else if (lNumericBlanks(NumNum) && !lAlphaBlanks(AlphaNum)) {
    4344           0 :                     ShowWarningError(state,
    4345           0 :                                      std::string{RoutineName} + CurrentModuleObject + "=\"" + Secondary(SecondaryNum).Name + "\", " +
    4346           0 :                                          cAlphaFieldNames(AlphaNum) +
    4347           0 :                                          " will not be used and distribution piping heat gain will not be calculated because " +
    4348           0 :                                          cNumericFieldNames(NumNum) + " was blank.");
    4349             :                 } // distribution piping
    4350             : 
    4351             :                 // Separator/receiver heat gain - optional
    4352             :                 //  Input UA and Zone containing the Separator/receiver
    4353             :                 //  This Zone ID will be used to determine the temperature used for Separator/receiver heat gain.
    4354             :                 //  Zone Id is only required if Sum UA Separator/receiver >0.0
    4355             :                 //  Get the Zone node number from the zone name entered by the user
    4356           2 :                 Secondary(SecondaryNum).SumUAReceiver = 0.0;
    4357           2 :                 AlphaNum = 8;
    4358           2 :                 NumNum = 13;
    4359           2 :                 if (!lNumericBlanks(NumNum) && !lAlphaBlanks(AlphaNum)) {
    4360           1 :                     Secondary(SecondaryNum).SumUAReceiver = Numbers(NumNum);
    4361           1 :                     Secondary(SecondaryNum).ReceiverZoneNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), state.dataHeatBal->Zone);
    4362           1 :                     Secondary(SecondaryNum).ReceiverZoneNodeNum =
    4363           1 :                         DataZoneEquipment::GetSystemNodeNumberForZone(state, Secondary(SecondaryNum).ReceiverZoneNum);
    4364             : 
    4365           1 :                     if (Secondary(SecondaryNum).ReceiverZoneNum == 0) {
    4366           0 :                         ShowSevereError(state,
    4367           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + Secondary(SecondaryNum).Name + "\", invalid  " +
    4368           0 :                                             cAlphaFieldNames(AlphaNum) + " not valid: " + Alphas(AlphaNum));
    4369           0 :                         ErrorsFound = true;
    4370             :                     } else {
    4371           1 :                         state.dataRefrigCase->RefrigPresentInZone(Secondary(SecondaryNum).ReceiverZoneNum) = true;
    4372             :                     }
    4373           1 :                     if (Secondary(SecondaryNum).ReceiverZoneNodeNum == 0) {
    4374           0 :                         ShowSevereError(state,
    4375           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + Secondary(SecondaryNum).Name +
    4376           0 :                                             "\" System Node Number not found for " + cAlphaFieldNames(AlphaNum) + " = " + Alphas(AlphaNum) +
    4377           0 :                                             " even though " + cNumericFieldNames(NumNum) +
    4378             :                                             " is greater than zero. Receiver heat gain cannot be calculated unless a controlled Zone (appear in a "
    4379             :                                             "ZoneHVAC:EquipmentConnections object.) is defined to determine the environmental temperature "
    4380             :                                             "surrounding the Receiver.");
    4381           0 :                         ErrorsFound = true;
    4382             :                     }
    4383           1 :                 } else if (!lNumericBlanks(NumNum) && lAlphaBlanks(AlphaNum)) {
    4384           0 :                     ShowWarningError(state,
    4385           0 :                                      std::string{RoutineName} + CurrentModuleObject + "=\"" + Secondary(SecondaryNum).Name + "\", " +
    4386           0 :                                          cAlphaFieldNames(AlphaNum) + " not found even though " + cNumericFieldNames(NumNum) +
    4387             :                                          " is greater than zero. Receiver heat gain will not be calculated unless a Zone is defined to deterimine "
    4388             :                                          "the environmental temperature surrounding the Receiver.");
    4389           1 :                 } else if (lNumericBlanks(NumNum) && !lAlphaBlanks(AlphaNum)) {
    4390           0 :                     ShowWarningError(state,
    4391           0 :                                      std::string{RoutineName} + CurrentModuleObject + "=\"" + Secondary(SecondaryNum).Name + "\", " +
    4392           0 :                                          cAlphaFieldNames(AlphaNum) + " will not be used and Receiver heat gain will not be calculated because " +
    4393           0 :                                          cNumericFieldNames(NumNum) + " was blank.");
    4394             :                 } // Receiver
    4395             : 
    4396           2 :                 NumNum = 14;
    4397           2 :                 Secondary(SecondaryNum).ChillerRefInventory = 0.0;
    4398           2 :                 if (!lNumericBlanks(NumNum)) Secondary(SecondaryNum).ChillerRefInventory = Numbers(NumNum);
    4399           2 :                 if (Secondary(SecondaryNum).ChillerRefInventory < 0.0) {
    4400           0 :                     Secondary(SecondaryNum).ChillerRefInventory = 0.0;
    4401           0 :                     ShowWarningError(state,
    4402           0 :                                      std::string{RoutineName} + CurrentModuleObject + "=\"" + Secondary(SecondaryNum).Name +
    4403           0 :                                          "\", The value specified for " + cNumericFieldNames(NumNum) +
    4404             :                                          " is less than zero. The default value of zero will be used.");
    4405             :                 }
    4406             : 
    4407           2 :                 AlphaNum = 9;
    4408           2 :                 if (!lAlphaBlanks(AlphaNum)) Secondary(SecondaryNum).EndUseSubcategory = Alphas(AlphaNum);
    4409             : 
    4410             :                 // Error checks on secondary loop:
    4411             :                 // Note, rated capacities can be far off from operating capacities, but rough checks here
    4412             :                 //       (don't include dist piping or receiver heat gains).
    4413             :                 // Load limit logic here (maxvolflow and maxload used in calcs later)
    4414           2 :                 Secondary(SecondaryNum).MaxVolFlow = min(SecondaryFlowVolRated, PumpTotRatedFlowVol);
    4415           2 :                 Real64 NominalSecondaryRefLoad = NominalTotalCaseCap + NominalTotalWalkInCap + Secondary(SecondaryNum).PumpTotRatedPower;
    4416             : 
    4417           2 :                 if (Secondary(SecondaryNum).FluidType == SecFluidType::AlwaysLiquid) {
    4418           1 :                     if (TBrineOutRated > (Secondary(SecondaryNum).TMinNeeded + 0.5)) {
    4419           0 :                         ShowWarningError(state,
    4420           0 :                                          format("{}=\"{} The design brine temperature to the refrigeration loads: {:.1R} ;",
    4421             :                                                 CurrentModuleObject,
    4422           0 :                                                 Secondary(SecondaryNum).Name,
    4423           0 :                                                 TBrineOutRated));
    4424           0 :                         ShowContinueError(state,
    4425           0 :                                           format(" is greater than the design inlet temperature for at least one of the cases or walkins: {:.1R}",
    4426           0 :                                                  Secondary(SecondaryNum).TMinNeeded));
    4427           0 :                         ShowContinueError(
    4428             :                             state, " Compare your Approach and Evaporating Temperature to the design inlet temperatures needed for the loads.");
    4429             :                         // ErrorsFound = .TRUE.
    4430             :                     } // Tbrine out warning
    4431           2 :                     Real64 CapacityAtMaxVolFlow = Secondary(SecondaryNum).MaxVolFlow * Secondary(SecondaryNum).HeatExchangeEta *
    4432           2 :                                                   (CpBrineRated * DensityBrineRated) * (TBrineInRated - Secondary(SecondaryNum).TEvapDesign);
    4433           1 :                     Secondary(SecondaryNum).MaxLoad = min(Secondary(SecondaryNum).CoolingLoadRated, CapacityAtMaxVolFlow);
    4434             :                     Real64 DeltaCap1 =
    4435           1 :                         std::abs((Secondary(SecondaryNum).CoolingLoadRated - CapacityAtMaxVolFlow) / Secondary(SecondaryNum).CoolingLoadRated);
    4436           1 :                     if (DeltaCap1 > (0.3)) { // diff between chiller rating and capacity at max flow > 30%
    4437           0 :                         ShowWarningError(state,
    4438           0 :                                          format("{}=\"{}\" You may wish to check the system sizing.  The nominal secondary loop heat exchanger "
    4439             :                                                 "capacity is {:.0R} But the capacity based upon the maximum flow rate is {:.0R}",
    4440             :                                                 CurrentModuleObject,
    4441           0 :                                                 Secondary(SecondaryNum).Name,
    4442           0 :                                                 Secondary(SecondaryNum).CoolingLoadRated,
    4443           0 :                                                 CapacityAtMaxVolFlow));
    4444             :                     }                            // DeltaCap1 > .3
    4445             :                 } else {                         // Fluid type phase change                !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    4446           1 :                     if (lNumericBlanks(1)) {     // Chiller/evaporator capacity was not specified
    4447           1 :                         if (lNumericBlanks(7)) { // Pump power was not input, calc based on flow and head
    4448             :                             // need to refine because capacity calculated, but needs to include pump power (which was prev
    4449             :                             //   estimated based upon capacity which had been estimated as sum of case and walk-in capacities)
    4450           1 :                             PumpTotRatedFlowVol =
    4451           1 :                                 NominalSecondaryRefLoad * Secondary(SecondaryNum).CircRate / (DensityPhaseChange * DeltaHPhaseChange);
    4452           1 :                             Secondary(SecondaryNum).PumpTotRatedPower =
    4453           1 :                                 PumpTotRatedFlowVol * PumpTotRatedHead / (PumpImpellerEfficiency * PumpMotorEfficiency);
    4454             :                             // need to recalc nominal load with new pump power value
    4455           1 :                             NominalSecondaryRefLoad = NominalTotalCaseCap + NominalTotalWalkInCap + Secondary(SecondaryNum).PumpTotRatedPower;
    4456           1 :                             if (Secondary(SecondaryNum).PumpControlType == SecPumpCtrl::Constant) {
    4457             :                                 // Set incremental flow and power amounts for pump dispatch
    4458           0 :                                 Secondary(SecondaryNum).PumpIncrementFlowVol = PumpTotRatedFlowVol / NumPumps;
    4459           0 :                                 Secondary(SecondaryNum).PumpIncrementPower = Secondary(SecondaryNum).PumpTotRatedPower / NumPumps;
    4460             :                             } // constant speed pump
    4461             :                         }     // Pump power was not specified
    4462           1 :                         Secondary(SecondaryNum).CoolingLoadRated = NominalSecondaryRefLoad;
    4463             :                     } // Chiller/evap capacity was not specified
    4464           1 :                     Secondary(SecondaryNum).MaxLoad = Secondary(SecondaryNum).CoolingLoadRated;
    4465             :                 } // SecFluidType
    4466             : 
    4467             :                 Real64 DeltaCap2 =
    4468           2 :                     std::abs((Secondary(SecondaryNum).CoolingLoadRated - NominalSecondaryRefLoad) / Secondary(SecondaryNum).CoolingLoadRated);
    4469           2 :                 if (DeltaCap2 > (0.3)) { // diff between chiller rating and sum of nominal loads > 30%
    4470           0 :                     ShowWarningError(
    4471             :                         state,
    4472           0 :                         format("{}=\"{}\" You may wish to check the system sizing. Total nominal refrigerating load is {:.0R} (Including cases, "
    4473             :                                "walk-ins, and pump heat).  The nominal secondary loop heat exchanger capacity is {:.0R}",
    4474             :                                CurrentModuleObject,
    4475           0 :                                Secondary(SecondaryNum).Name,
    4476             :                                NominalSecondaryRefLoad,
    4477           0 :                                Secondary(SecondaryNum).CoolingLoadRated));
    4478             :                 }
    4479             :                 // compare rated xt xchanger brine flow to the total rated pump flow
    4480           2 :                 if (SecondaryFlowVolRated > (1.1 * PumpTotRatedFlowVol)) {
    4481           0 :                     ShowWarningError(state,
    4482           0 :                                      format("{}=\"{}\" You may wish to check the pump sizing. Total nominal brine flow is {:.0R} m3/s, but the "
    4483             :                                             "total nominal pump flow rate is:  {:.0R} m3/s. ",
    4484             :                                             CurrentModuleObject,
    4485           0 :                                             Secondary(SecondaryNum).Name,
    4486             :                                             SecondaryFlowVolRated,
    4487           0 :                                             PumpTotRatedFlowVol));
    4488             :                 }
    4489             : 
    4490             :             } // Secondary Loops
    4491             :         }     //(  IF (NumSimulationSecondarySystems > 0)
    4492             : 
    4493             :         //************ END SECONDARY SYSTEM INPUT  **************
    4494             : 
    4495             :         //************ START Compressor INPUT  **************
    4496             : 
    4497          15 :         CurrentModuleObject = "Refrigeration:Compressor";
    4498         189 :         for (int CompNum = 1; CompNum <= state.dataRefrigCase->NumSimulationCompressors; ++CompNum) {
    4499         174 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
    4500             :                                                                      CurrentModuleObject,
    4501             :                                                                      CompNum,
    4502             :                                                                      Alphas,
    4503             :                                                                      NumAlphas,
    4504             :                                                                      Numbers,
    4505             :                                                                      NumNumbers,
    4506             :                                                                      IOStatus,
    4507             :                                                                      lNumericBlanks,
    4508             :                                                                      lAlphaBlanks,
    4509             :                                                                      cAlphaFieldNames,
    4510             :                                                                      cNumericFieldNames);
    4511         174 :             UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound);
    4512             : 
    4513         174 :             Compressor(CompNum).Name = Alphas(1);
    4514             : 
    4515         174 :             Compressor(CompNum).ElecPowerCurvePtr = Curve::GetCurveIndex(state, Alphas(2)); // convert curve name to number
    4516         174 :             if ((!lAlphaBlanks(2)) && Compressor(CompNum).ElecPowerCurvePtr == 0) {
    4517           0 :                 ShowSevereError(state,
    4518           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + Compressor(CompNum).Name + "\", invalid  " +
    4519           0 :                                     cAlphaFieldNames(2) + " not found = " + Alphas(2));
    4520           0 :                 ErrorsFound = true;
    4521             :             }
    4522             : 
    4523         174 :             Compressor(CompNum).CapacityCurvePtr = Curve::GetCurveIndex(state, Alphas(3)); // convert curve name to number
    4524         174 :             if ((!lAlphaBlanks(3)) && Compressor(CompNum).CapacityCurvePtr == 0) {
    4525           0 :                 ShowSevereError(state,
    4526           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + Compressor(CompNum).Name + "\", invalid  " +
    4527           0 :                                     cAlphaFieldNames(3) + " not found = " + Alphas(3));
    4528           0 :                 ErrorsFound = true;
    4529             :             }
    4530             : 
    4531             :             // Get superheat rating type (Either N1 or N2 Must be input)
    4532         174 :             if (((!lNumericBlanks(1)) && (!lNumericBlanks(2))) || (lNumericBlanks(1) && lNumericBlanks(2))) {
    4533           0 :                 ShowSevereError(state,
    4534           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + Compressor(CompNum).Name + "\"One, and Only One of " +
    4535           0 :                                     cNumericFieldNames(1) + " or " + cNumericFieldNames(2));
    4536           0 :                 ShowContinueError(state, "Must Be Entered. Check input value choices.");
    4537           0 :                 ErrorsFound = true;
    4538         174 :             } else if (!lNumericBlanks(1)) {
    4539          83 :                 Compressor(CompNum).SuperheatRatingType = CompRatingType::Superheat;
    4540          83 :                 Compressor(CompNum).RatedSuperheat = Numbers(1);
    4541          91 :             } else if (!lNumericBlanks(2)) {
    4542          91 :                 Compressor(CompNum).SuperheatRatingType = CompRatingType::ReturnGasTemperature;
    4543          91 :                 Compressor(CompNum).RatedSuperheat = Numbers(2);
    4544             :             } // Set SuperheatRatingType
    4545             : 
    4546             :             // Get subcool rating type (Either N3 or N4 Must be input)
    4547         174 :             if (((!lNumericBlanks(3)) && (!lNumericBlanks(4))) || (lNumericBlanks(3) && lNumericBlanks(4))) {
    4548           0 :                 ShowSevereError(state,
    4549           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + Compressor(CompNum).Name + "\" One, and Only One of " +
    4550           0 :                                     cNumericFieldNames(3) + " or " + cNumericFieldNames(4));
    4551           0 :                 ShowContinueError(state, "Must Be Entered. Check input value choices.");
    4552           0 :                 ErrorsFound = true;
    4553         174 :             } else if (!lNumericBlanks(3)) {
    4554          19 :                 Compressor(CompNum).SubcoolRatingType = CompRatingType::LiquidTemperature;
    4555          19 :                 Compressor(CompNum).RatedSubcool = Numbers(3);
    4556         155 :             } else if (!lNumericBlanks(4)) {
    4557         155 :                 Compressor(CompNum).SubcoolRatingType = CompRatingType::Subcooling;
    4558         155 :                 Compressor(CompNum).RatedSubcool = Numbers(4);
    4559             :             } // Set SubcoolRatingType
    4560             : 
    4561         174 :             Compressor(CompNum).EndUseSubcategory = "General";
    4562         174 :             if (!lAlphaBlanks(4)) Compressor(CompNum).EndUseSubcategory = Alphas(4);
    4563             : 
    4564             :             //  If the compressor is a transcritical CO compressor, get transcritical power and capacity curves
    4565         174 :             if (UtilityRoutines::SameString(Alphas(5), "Transcritical")) { // Mode of Operation = Transcritical
    4566           3 :                 Compressor(CompNum).TransFlag = true;
    4567           3 :                 Compressor(CompNum).TransElecPowerCurvePtr = Curve::GetCurveIndex(state, Alphas(6)); // convert curve name to number
    4568           3 :                 if (lAlphaBlanks(6) && Compressor(CompNum).TransElecPowerCurvePtr == 0) {
    4569           0 :                     ShowSevereError(state,
    4570           0 :                                     std::string{RoutineName} + CurrentModuleObject + '=' + Compressor(CompNum).Name + ": " + cAlphaFieldNames(6) +
    4571             :                                         " not found.");
    4572           0 :                     ErrorsFound = true;
    4573             :                 }
    4574           3 :                 Compressor(CompNum).TransCapacityCurvePtr = Curve::GetCurveIndex(state, Alphas(7)); // convert curve name to number
    4575           3 :                 if (lAlphaBlanks(7) && Compressor(CompNum).TransCapacityCurvePtr == 0) {
    4576           0 :                     ShowSevereError(state,
    4577           0 :                                     std::string{RoutineName} + CurrentModuleObject + '=' + Compressor(CompNum).Name + ": " + cAlphaFieldNames(7) +
    4578             :                                         " not found.");
    4579           0 :                     ErrorsFound = true;
    4580             :                 }
    4581         171 :             } else if ((UtilityRoutines::SameString(Alphas(5), "Subcritical")) || (lAlphaBlanks(5))) { // Mode of Operation = Subcritical
    4582         171 :                 Compressor(CompNum).TransFlag = false;
    4583         171 :                 if ((!lAlphaBlanks(6)) || (!lAlphaBlanks(7))) { // Transcritical compressor curves specified for subcritical compressor
    4584           0 :                     ShowWarningError(state,
    4585           0 :                                      std::string{RoutineName} + CurrentModuleObject + '=' + Compressor(CompNum).Name +
    4586             :                                          " is specified to be a subcritical compressor, however transcritical compressor curve(s) are given.");
    4587           0 :                     ShowContinueError(
    4588             :                         state,
    4589             :                         "The compressor will be modeled as a subcritical compressor and the transcritical compressor curve(s) will be ignored.");
    4590             :                 }
    4591             :             } else { // Invalid Mode of Operation
    4592           0 :                 ShowSevereError(state,
    4593           0 :                                 std::string{RoutineName} + CurrentModuleObject + ": " + cAlphaFieldNames(5) + " for " + Compressor(CompNum).Name +
    4594           0 :                                     '=' + Alphas(5) + R"( is invalid. Valid choices are "Subcritical" or "Transcritical".)");
    4595           0 :                 ErrorsFound = true;
    4596             :             }
    4597             : 
    4598             :         } // RefrigCompressor
    4599             : 
    4600             :         //************ END Compressor INPUT         **************
    4601             : 
    4602             :         //************ START Subcooler INPUT        **************
    4603          15 :         if (state.dataRefrigCase->NumSimulationSubcoolers > 0) {
    4604           1 :             CurrentModuleObject = "Refrigeration:Subcooler";
    4605           1 :             state.dataRefrigCase->NumSimulationMechSubcoolers = 0;
    4606           3 :             for (int SubcoolerNum = 1; SubcoolerNum <= state.dataRefrigCase->NumSimulationSubcoolers; ++SubcoolerNum) {
    4607           2 :                 state.dataInputProcessing->inputProcessor->getObjectItem(state,
    4608             :                                                                          CurrentModuleObject,
    4609             :                                                                          SubcoolerNum,
    4610             :                                                                          Alphas,
    4611             :                                                                          NumAlphas,
    4612             :                                                                          Numbers,
    4613             :                                                                          NumNumbers,
    4614             :                                                                          IOStatus,
    4615             :                                                                          lNumericBlanks,
    4616             :                                                                          lAlphaBlanks,
    4617             :                                                                          cAlphaFieldNames,
    4618             :                                                                          cNumericFieldNames);
    4619           2 :                 UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound);
    4620             : 
    4621           2 :                 Subcooler(SubcoolerNum).Name = Alphas(1);
    4622             : 
    4623             :                 // Get subcooler type
    4624           2 :                 Subcooler(SubcoolerNum).subcoolerType = SubcoolerType::LiquidSuction; // default subcooler type
    4625           2 :                 if (UtilityRoutines::SameString(Alphas(2), "Mechanical")) {           // set subcooler type
    4626           1 :                     Subcooler(SubcoolerNum).subcoolerType = SubcoolerType::Mechanical;
    4627           1 :                     ++state.dataRefrigCase->NumSimulationMechSubcoolers;
    4628           1 :                 } else if (UtilityRoutines::SameString(Alphas(2), "LiquidSuction")) {
    4629           1 :                     Subcooler(SubcoolerNum).subcoolerType = SubcoolerType::LiquidSuction;
    4630             :                 } else {
    4631           0 :                     ShowSevereError(state,
    4632           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + Subcooler(SubcoolerNum).Name + "\", " +
    4633           0 :                                         cAlphaFieldNames(2) + " not recognized = " + Alphas(2));
    4634           0 :                     ShowContinueError(state, "Check input value choices.");
    4635           0 :                     ErrorsFound = true;
    4636             :                 } // Set Subcooler Type
    4637             : 
    4638           2 :                 switch (Subcooler(SubcoolerNum).subcoolerType) {
    4639           1 :                 case SubcoolerType::LiquidSuction: {
    4640           1 :                     Subcooler(SubcoolerNum).LiqSuctDesignDelT = 10.0; // default value
    4641           1 :                     if (!lNumericBlanks(1)) Subcooler(SubcoolerNum).LiqSuctDesignDelT = Numbers(1);
    4642           1 :                     if (Subcooler(SubcoolerNum).LiqSuctDesignDelT < 0.0) {
    4643           0 :                         ShowSevereError(state,
    4644           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + Subcooler(SubcoolerNum).Name + "\" " +
    4645           0 :                                             cNumericFieldNames(1) + " cannot be less than zero.");
    4646           0 :                         ErrorsFound = true;
    4647             :                     }
    4648             : 
    4649           1 :                     if (!lNumericBlanks(2)) {
    4650           1 :                         Subcooler(SubcoolerNum).LiqSuctDesignTliqIn = Numbers(2);
    4651             :                     } else {
    4652           0 :                         ShowSevereError(state,
    4653           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + Subcooler(SubcoolerNum).Name + "\" " +
    4654           0 :                                             cNumericFieldNames(2) + " must be specified.");
    4655           0 :                         ErrorsFound = true;
    4656             :                     }
    4657             : 
    4658           1 :                     if (!lNumericBlanks(3)) {
    4659           1 :                         Subcooler(SubcoolerNum).LiqSuctDesignTvapIn = Numbers(3);
    4660             :                     } else {
    4661           0 :                         ShowSevereError(state,
    4662           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + Subcooler(SubcoolerNum).Name + "\" " +
    4663           0 :                                             cNumericFieldNames(3) + " must be specified.");
    4664           0 :                         ErrorsFound = true;
    4665             :                     }
    4666           1 :                     if (Subcooler(SubcoolerNum).LiqSuctDesignTvapIn > Subcooler(SubcoolerNum).LiqSuctDesignTliqIn) {
    4667           0 :                         ShowSevereError(state,
    4668           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + Subcooler(SubcoolerNum).Name + "\" " +
    4669           0 :                                             cNumericFieldNames(3) + " cannot be greater than " + cNumericFieldNames(2) + '.');
    4670           0 :                         ErrorsFound = true;
    4671             :                     } // error check
    4672           1 :                 } break;
    4673           1 :                 case SubcoolerType::Mechanical: {
    4674           1 :                     Subcooler(SubcoolerNum).MechSourceSys = Alphas(3);
    4675             :                     // Error check on system name comes later after systems have been read
    4676             : 
    4677           1 :                     if (!lNumericBlanks(4)) {
    4678           1 :                         Subcooler(SubcoolerNum).MechControlTliqOut = Numbers(4);
    4679             :                     } else {
    4680           0 :                         ShowSevereError(state,
    4681           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + Subcooler(SubcoolerNum).Name + "\" " +
    4682           0 :                                             cNumericFieldNames(4) + " must be specified.");
    4683           0 :                         ErrorsFound = true;
    4684             :                     } // error check
    4685           1 :                 } break;
    4686           0 :                 default:
    4687           0 :                     break;
    4688             :                 }
    4689             :             } // Subcooler Input
    4690             :         }     // If there are subcoolers
    4691             : 
    4692             :         // ********END SUBCOOLER INPUTS ************
    4693             : 
    4694             :         //**** Read TransferLoad Lists **********************************************************
    4695          15 :         if (state.dataRefrigCase->NumSimulationTransferLoadLists > 0) {
    4696           1 :             CurrentModuleObject = "Refrigeration:TransferLoadList";
    4697           2 :             for (int ListNum = 1; ListNum <= state.dataRefrigCase->NumSimulationTransferLoadLists; ++ListNum) {
    4698           1 :                 state.dataInputProcessing->inputProcessor->getObjectItem(state,
    4699             :                                                                          CurrentModuleObject,
    4700             :                                                                          ListNum,
    4701             :                                                                          Alphas,
    4702             :                                                                          NumAlphas,
    4703             :                                                                          Numbers,
    4704             :                                                                          NumNumbers,
    4705             :                                                                          IOStatus,
    4706             :                                                                          lNumericBlanks,
    4707             :                                                                          lAlphaBlanks,
    4708             :                                                                          cAlphaFieldNames,
    4709             :                                                                          cNumericFieldNames);
    4710           1 :                 UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound);
    4711             : 
    4712           1 :                 TransferLoadList(ListNum).Name = Alphas(1);
    4713             : 
    4714             :                 // Transfer load list alphas include TransferLoadList name and one name for each Secondary or Cascade Condenser in list
    4715             :                 // below allocates larger than needed (each allocated to sum of both), but avoids two loops through input fields
    4716           1 :                 int NumTotalLoadsOnList = NumAlphas - 1;
    4717           1 :                 if (!allocated(TransferLoadList(ListNum).CascadeLoadItemNum))
    4718           1 :                     TransferLoadList(ListNum).CascadeLoadItemNum.allocate(NumTotalLoadsOnList);
    4719           1 :                 if (!allocated(TransferLoadList(ListNum).SecondaryItemNum)) TransferLoadList(ListNum).SecondaryItemNum.allocate(NumTotalLoadsOnList);
    4720             : 
    4721           1 :                 int NumSecondarysOnList = 0;
    4722           1 :                 int NumCascadeLoadsOnList = 0;
    4723           2 :                 for (int NumLoad = 1; NumLoad <= NumTotalLoadsOnList; ++NumLoad) {
    4724           1 :                     int AlphaListNum = 1 + NumLoad;
    4725           1 :                     int LoadCascadeNum = 0;
    4726           1 :                     int LoadSecondaryNum = 0;
    4727           1 :                     if (state.dataRefrigCase->NumRefrigCondensers > 0)
    4728           1 :                         LoadCascadeNum = UtilityRoutines::FindItemInList(Alphas(AlphaListNum), Condenser);
    4729           1 :                     if (state.dataRefrigCase->NumSimulationSecondarySystems > 0)
    4730           1 :                         LoadSecondaryNum = UtilityRoutines::FindItemInList(Alphas(AlphaListNum), Secondary);
    4731           1 :                     if ((LoadCascadeNum == 0) && (LoadSecondaryNum == 0)) {
    4732           0 :                         ShowSevereError(state,
    4733           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + cAlphaFieldNames(AlphaListNum) +
    4734           0 :                                             "\" : has an invalid value of " + Alphas(AlphaListNum));
    4735           0 :                         ErrorsFound = true;
    4736           1 :                     } else if ((LoadCascadeNum != 0) && (LoadSecondaryNum != 0)) {
    4737           0 :                         ShowSevereError(state,
    4738           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + cAlphaFieldNames(AlphaListNum) +
    4739           0 :                                             "\" : has a non-unique name : " + Alphas(AlphaListNum));
    4740           0 :                         ErrorsFound = true;
    4741           1 :                     } else if (LoadCascadeNum != 0) {
    4742           0 :                         if (Condenser(LoadCascadeNum).CondenserType != DataHeatBalance::RefrigCondenserType::Cascade) {
    4743           0 :                             ShowSevereError(
    4744             :                                 state,
    4745           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + System(RefrigSysNum).Name +
    4746           0 :                                     "\" : has a condenser listed as a transfer load that is not a cascade condenser: " + Alphas(AlphaListNum));
    4747           0 :                             ErrorsFound = true;
    4748             :                         } else {
    4749           0 :                             ++NumCascadeLoadsOnList;
    4750           0 :                             TransferLoadList(ListNum).CascadeLoadItemNum(NumCascadeLoadsOnList) = LoadCascadeNum;
    4751             :                         } // /= condenser cascade type
    4752           1 :                     } else if (LoadSecondaryNum != 0) {
    4753           1 :                         ++NumSecondarysOnList;
    4754           1 :                         TransferLoadList(ListNum).SecondaryItemNum(NumSecondarysOnList) = LoadSecondaryNum;
    4755             :                     }
    4756           1 :                     TransferLoadList(ListNum).NumSecondarys = NumSecondarysOnList;
    4757           1 :                     TransferLoadList(ListNum).NumCascadeLoads = NumCascadeLoadsOnList;
    4758             :                 } // Num Total Loads on List
    4759             :             }     // ListNum=1,NumSimulationTransferLoadLists
    4760             :         }         //(NumSimulationTransferLoadLists > 0)
    4761             : 
    4762             :         //**** End read transfer load Lists **********************************************************
    4763             : 
    4764             :         //**** Read Compressor Lists **********************************************************
    4765          15 :         CurrentModuleObject = "Refrigeration:CompressorList";
    4766          58 :         for (int ListNum = 1; ListNum <= NumCompressorLists; ++ListNum) {
    4767          43 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
    4768             :                                                                      CurrentModuleObject,
    4769             :                                                                      ListNum,
    4770             :                                                                      Alphas,
    4771             :                                                                      NumAlphas,
    4772             :                                                                      Numbers,
    4773             :                                                                      NumNumbers,
    4774             :                                                                      IOStatus,
    4775             :                                                                      lNumericBlanks,
    4776             :                                                                      lAlphaBlanks,
    4777             :                                                                      cAlphaFieldNames,
    4778             :                                                                      cNumericFieldNames);
    4779          43 :             CompressorLists(ListNum).NumCompressors = NumAlphas - 1;
    4780          43 :             UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound);
    4781             : 
    4782          43 :             CompressorLists(ListNum).Name = Alphas(1);
    4783          43 :             if (!allocated(CompressorLists(ListNum).CompItemNum))
    4784          43 :                 CompressorLists(ListNum).CompItemNum.allocate(CompressorLists(ListNum).NumCompressors);
    4785             : 
    4786         217 :             for (int CompIndex = 1; CompIndex <= CompressorLists(ListNum).NumCompressors; ++CompIndex) {
    4787         174 :                 int AlphaListNum = CompIndex + 1; // same as do loop from 2 to end of list
    4788         174 :                 if (!lAlphaBlanks(AlphaListNum)) {
    4789         174 :                     CompressorLists(ListNum).CompItemNum(CompIndex) = UtilityRoutines::FindItemInList(Alphas(AlphaListNum), Compressor);
    4790         174 :                     if (CompressorLists(ListNum).CompItemNum(CompIndex) == 0) {
    4791           0 :                         ShowSevereError(state,
    4792           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + CompressorLists(ListNum).Name +
    4793           0 :                                             "\", has an invalid " + cAlphaFieldNames(AlphaListNum) + " defined as " + Alphas(AlphaListNum));
    4794           0 :                         ErrorsFound = true;
    4795             :                     }
    4796             :                 }
    4797             :             } // NumCompressors in CompressorList
    4798             : 
    4799             :         } // NumCompressorLists
    4800             : 
    4801             :         // ********READ REFRIGERATION SYSTEMS  ***********
    4802             : 
    4803          15 :         CurrentModuleObject = "Refrigeration:System";
    4804          54 :         for (RefrigSysNum = 1; RefrigSysNum <= state.dataRefrigCase->NumRefrigSystems; ++RefrigSysNum) {
    4805             : 
    4806          39 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
    4807             :                                                                      CurrentModuleObject,
    4808             :                                                                      RefrigSysNum,
    4809             :                                                                      Alphas,
    4810             :                                                                      NumAlphas,
    4811             :                                                                      Numbers,
    4812             :                                                                      NumNumbers,
    4813             :                                                                      IOStatus,
    4814             :                                                                      lNumericBlanks,
    4815             :                                                                      lAlphaBlanks,
    4816             :                                                                      cAlphaFieldNames,
    4817             :                                                                      cNumericFieldNames);
    4818          39 :             UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound);
    4819             : 
    4820          39 :             System(RefrigSysNum).Name = Alphas(1);
    4821             : 
    4822             :             // Read all loads on this System: cases, walk-ins, cascade loads, and secondary loops
    4823          39 :             if (lAlphaBlanks(2) && lAlphaBlanks(3)) {
    4824             :                 // No cases, walkins, cascade loads, or secondary loops specified, ie, System has no load
    4825           0 :                 ShowSevereError(state,
    4826           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + System(RefrigSysNum).Name +
    4827           0 :                                     "\", has no loads, must have at least one of: " + cAlphaFieldNames(2) + " or " + cAlphaFieldNames(3) +
    4828             :                                     " objects attached.");
    4829           0 :                 ErrorsFound = true;
    4830             :             }
    4831          39 :             NumCases = 0;
    4832          39 :             System(RefrigSysNum).NumCases = 0;
    4833          39 :             int NumCoils = 0;
    4834          39 :             System(RefrigSysNum).NumCoils = 0;
    4835          39 :             NumWalkIns = 0;
    4836          39 :             System(RefrigSysNum).NumWalkIns = 0;
    4837          39 :             int NumSecondary = 0;
    4838          39 :             System(RefrigSysNum).NumSecondarys = 0;
    4839          39 :             System(RefrigSysNum).NumCascadeLoads = 0;
    4840          39 :             System(RefrigSysNum).NumNonCascadeLoads = 0;
    4841          39 :             Real64 NominalTotalCaseCap = 0.0;
    4842          39 :             Real64 NominalTotalCoilCap = 0.0;
    4843          39 :             Real64 NominalTotalWalkInCap = 0.0;
    4844          39 :             Real64 NominalTotalSecondaryCap = 0.0;
    4845             :             Real64 NominalTotalCoolingCap;
    4846          39 :             Real64 NominalTotalCascadeLoad = 0.0;
    4847          39 :             System(RefrigSysNum).RefInventory = 0.0;
    4848             : 
    4849             :             //   Check for case or walkin or CaseAndWalkInList names
    4850          39 :             AlphaNum = 2;
    4851          39 :             if (!lAlphaBlanks(AlphaNum)) {
    4852             : 
    4853             :                 // Entry for Alphas(AlphaNum) can be either a Case, WalkIn or CaseAndWalkInList name
    4854          36 :                 int CaseAndWalkInListNum = 0;
    4855          36 :                 int CaseNum = 0;
    4856          36 :                 int WalkInNum = 0;
    4857          36 :                 int CoilNum = 0;
    4858          36 :                 if (state.dataRefrigCase->NumSimulationCaseAndWalkInLists > 0)
    4859          36 :                     CaseAndWalkInListNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), CaseAndWalkInList);
    4860          36 :                 if (state.dataRefrigCase->NumSimulationCases > 0) CaseNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), RefrigCase);
    4861          36 :                 if (state.dataRefrigCase->NumSimulationWalkIns > 0) WalkInNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), WalkIn);
    4862          36 :                 if (state.dataRefrigCase->NumSimulationRefrigAirChillers > 0)
    4863           9 :                     CoilNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), WarehouseCoil);
    4864          36 :                 int NumNameMatches = 0;
    4865          36 :                 if (CaseAndWalkInListNum != 0) ++NumNameMatches;
    4866          36 :                 if (CaseNum != 0) ++NumNameMatches;
    4867          36 :                 if (WalkInNum != 0) ++NumNameMatches;
    4868          36 :                 if (CoilNum != 0) ++NumNameMatches;
    4869             : 
    4870          36 :                 if (NumNameMatches != 1) { // name must uniquely point to a list or a single case or walkin or coil
    4871           0 :                     ErrorsFound = true;
    4872           0 :                     if (NumNameMatches == 0) {
    4873           0 :                         ShowSevereError(state,
    4874           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + System(RefrigSysNum).Name + "\", has an invalid " +
    4875           0 :                                             cAlphaFieldNames(AlphaNum) + ": " + Alphas(AlphaNum));
    4876           0 :                     } else if (NumNameMatches > 1) {
    4877           0 :                         ShowSevereError(state,
    4878           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + System(RefrigSysNum).Name +
    4879           0 :                                             "\",  has a non-unique name that could be either a " + cAlphaFieldNames(AlphaNum) + ": " +
    4880           0 :                                             Alphas(AlphaNum));
    4881             :                     }                                   // num matches = 0 or > 1
    4882          36 :                 } else if (CaseAndWalkInListNum != 0) { // Name points to a CaseAndWalkInList
    4883          33 :                     NumCases = CaseAndWalkInList(CaseAndWalkInListNum).NumCases;
    4884          33 :                     NumWalkIns = CaseAndWalkInList(CaseAndWalkInListNum).NumWalkIns;
    4885          33 :                     NumCoils = CaseAndWalkInList(CaseAndWalkInListNum).NumCoils;
    4886          33 :                     System(RefrigSysNum).NumCases = NumCases;
    4887          33 :                     System(RefrigSysNum).NumWalkIns = NumWalkIns;
    4888          33 :                     System(RefrigSysNum).NumCoils = NumCoils;
    4889          33 :                     if (NumCases > 0) {
    4890          22 :                         if (!allocated(System(RefrigSysNum).CaseNum)) System(RefrigSysNum).CaseNum.allocate(NumCases);
    4891          22 :                         System(RefrigSysNum).CaseNum({1, NumCases}) = CaseAndWalkInList(CaseAndWalkInListNum).CaseItemNum({1, NumCases});
    4892             :                     }
    4893          33 :                     if (NumCoils > 0) {
    4894           9 :                         if (!allocated(System(RefrigSysNum).CoilNum)) System(RefrigSysNum).CoilNum.allocate(NumCoils);
    4895           9 :                         System(RefrigSysNum).CoilNum({1, NumCoils}) = CaseAndWalkInList(CaseAndWalkInListNum).CoilItemNum({1, NumCoils});
    4896             :                     }
    4897          33 :                     if (NumWalkIns > 0) {
    4898          13 :                         if (!allocated(System(RefrigSysNum).WalkInNum)) System(RefrigSysNum).WalkInNum.allocate(NumWalkIns);
    4899          13 :                         System(RefrigSysNum).WalkInNum({1, NumWalkIns}) = CaseAndWalkInList(CaseAndWalkInListNum).WalkInItemNum({1, NumWalkIns});
    4900             :                     }
    4901           3 :                 } else if (CaseNum != 0) { // Name points to a case
    4902           3 :                     NumCases = 1;
    4903           3 :                     System(RefrigSysNum).NumCases = 1;
    4904           3 :                     if (!allocated(System(RefrigSysNum).CaseNum)) System(RefrigSysNum).CaseNum.allocate(NumCases);
    4905           3 :                     System(RefrigSysNum).CaseNum(NumCases) = CaseNum;
    4906           0 :                 } else if (CoilNum != 0) { // Name points to a coil
    4907           0 :                     NumCoils = 1;
    4908           0 :                     System(RefrigSysNum).NumCoils = 1;
    4909           0 :                     if (!allocated(System(RefrigSysNum).CoilNum)) System(RefrigSysNum).CoilNum.allocate(NumCoils);
    4910           0 :                     System(RefrigSysNum).CoilNum(NumCoils) = CoilNum;
    4911           0 :                 } else if (WalkInNum != 0) { // Name points to a walkin
    4912           0 :                     NumWalkIns = 1;
    4913           0 :                     System(RefrigSysNum).NumWalkIns = 1;
    4914           0 :                     if (!allocated(System(RefrigSysNum).WalkInNum)) System(RefrigSysNum).WalkInNum.allocate(NumWalkIns);
    4915           0 :                     System(RefrigSysNum).WalkInNum(NumWalkIns) = WalkInNum;
    4916             :                 } // NumNameMatches /= 1
    4917             :             }     // blank input for cases, walkins, or caseandwalkinlist
    4918             : 
    4919          39 :             if (NumCases > 0) {
    4920             :                 // Find lowest design evap T
    4921             :                 // Sum rated capacity of all cases on system
    4922         105 :                 for (int caseIndex = 1; caseIndex <= NumCases; ++caseIndex) {
    4923             :                     // mark all cases on system as used by this system - checking for unused or non-unique cases
    4924          80 :                     int CaseNum = System(RefrigSysNum).CaseNum(caseIndex);
    4925          80 :                     ++RefrigCase(CaseNum).NumSysAttach;
    4926          80 :                     NominalTotalCaseCap += RefrigCase(CaseNum).DesignRatedCap;
    4927          80 :                     System(RefrigSysNum).RefInventory += RefrigCase(CaseNum).DesignRefrigInventory;
    4928          80 :                     if (caseIndex == 1) { // look for lowest case design evap T for system
    4929          25 :                         System(RefrigSysNum).TEvapDesign = RefrigCase(CaseNum).EvapTempDesign;
    4930             :                     } else {
    4931          55 :                         System(RefrigSysNum).TEvapDesign = min(RefrigCase(CaseNum).EvapTempDesign, System(RefrigSysNum).TEvapDesign);
    4932             :                     }
    4933             :                 } // CaseIndex=1,NumCases
    4934          25 :                 System(RefrigSysNum).NumNonCascadeLoads += System(RefrigSysNum).NumCases;
    4935             :             } // Numcases > 0
    4936             : 
    4937          39 :             if (NumCoils > 0) {
    4938             :                 // Find lowest design evap T
    4939             :                 // Sum rated capacity of all Coils on system
    4940          92 :                 for (int CoilIndex = 1; CoilIndex <= NumCoils; ++CoilIndex) {
    4941             :                     // mark all Coils on system as used by this system - checking for unused or non-unique Coils
    4942          83 :                     int CoilNum = System(RefrigSysNum).CoilNum(CoilIndex);
    4943          83 :                     ++WarehouseCoil(CoilNum).NumSysAttach;
    4944          83 :                     NominalTotalCoilCap += WarehouseCoil(CoilNum).RatedSensibleCap;
    4945          83 :                     System(RefrigSysNum).RefInventory += WarehouseCoil(CoilNum).DesignRefrigInventory;
    4946          83 :                     if ((CoilIndex == 1) && (System(RefrigSysNum).NumCases == 0)) { // look for lowest Coil design evap T for system
    4947           9 :                         System(RefrigSysNum).TEvapDesign = WarehouseCoil(CoilNum).TEvapDesign;
    4948             :                     } else {
    4949          74 :                         System(RefrigSysNum).TEvapDesign = min(WarehouseCoil(CoilNum).TEvapDesign, System(RefrigSysNum).TEvapDesign);
    4950             :                     }
    4951             :                 } // CoilIndex=1,NumCoils
    4952           9 :                 System(RefrigSysNum).NumNonCascadeLoads += System(RefrigSysNum).NumCoils;
    4953             :             } // NumCoils > 0
    4954             : 
    4955          39 :             if (NumWalkIns > 0) {
    4956          26 :                 for (int WalkInIndex = 1; WalkInIndex <= NumWalkIns; ++WalkInIndex) {
    4957          13 :                     int WalkInID = System(RefrigSysNum).WalkInNum(WalkInIndex);
    4958             :                     // mark all WalkIns on rack as used by this system (checking for unused or non-unique WalkIns)
    4959          13 :                     ++WalkIn(WalkInID).NumSysAttach;
    4960          13 :                     NominalTotalWalkInCap += WalkIn(WalkInID).DesignRatedCap;
    4961          13 :                     System(RefrigSysNum).RefInventory += WalkIn(WalkInID).DesignRefrigInventory;
    4962             :                     // Defrost capacity is treated differently by compressor racks and detailed systems,
    4963             :                     //  so this value may be adjusted (or warnings issued) after the walkin is assigned
    4964             :                     //  to either the rack or system.
    4965             :                     // for walkins served by detailed system, need capacity for both fluid and electric types.
    4966          13 :                     if (WalkIn(WalkInID).DefrostCapacity <= -98.0) {
    4967             :                         // - 99 used as a flag for blank input error message for detailed systems
    4968           0 :                         ShowSevereError(state,
    4969           0 :                                         std::string{RoutineName} + "Refrigeration:WalkIn=\"" + WalkIn(WalkInID).Name +
    4970             :                                             "\", Defrost capacity must be greater than or equal to 0 W for electric and hotfluid defrost types");
    4971           0 :                         ErrorsFound = true;
    4972             :                     }
    4973             :                     // Find design evaporating temperature for system by getting min design evap for ALL loads
    4974          13 :                     if ((WalkInIndex == 1) && (System(RefrigSysNum).NumCases == 0) && (System(RefrigSysNum).NumCoils == 0)) {
    4975             :                         // note use walk in index, not walkinid here to get
    4976             :                         // first walkin on this suction group/system
    4977           2 :                         System(RefrigSysNum).TEvapDesign = WalkIn(WalkInID).TEvapDesign;
    4978             :                     } else {
    4979          11 :                         System(RefrigSysNum).TEvapDesign = min(WalkIn(WalkInID).TEvapDesign, System(RefrigSysNum).TEvapDesign);
    4980             :                     }
    4981             :                 } // WalkInIndex=1,NumWalkIns
    4982          13 :                 System(RefrigSysNum).NumNonCascadeLoads += System(RefrigSysNum).NumWalkIns;
    4983             :             } // numwalkins > 0
    4984             : 
    4985          39 :             AlphaNum = 3;
    4986             :             // Read Transfer Loads (Secondary and Cascade) assignments for this System ,
    4987             :             //     already allow more than one mech subcooler to load onto a system so they don't need to go in list
    4988          39 :             if (!lAlphaBlanks(AlphaNum)) {
    4989             : 
    4990             :                 // Entry for Alphas(AlphaNum) can be either a Secondary, CascadeLoad name or a TransferLoadList name
    4991           3 :                 int TransferLoadListNum = 0;
    4992           3 :                 int SecondaryNum = 0;
    4993           3 :                 int CascadeLoadNum = 0;
    4994           3 :                 if (state.dataRefrigCase->NumSimulationTransferLoadLists > 0)
    4995           2 :                     TransferLoadListNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), TransferLoadList);
    4996           3 :                 if (state.dataRefrigCase->NumSimulationSecondarySystems > 0)
    4997           2 :                     SecondaryNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), Secondary);
    4998           3 :                 if (state.dataRefrigCase->NumRefrigCondensers > 0) CascadeLoadNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), Condenser);
    4999           3 :                 int NumNameMatches = 0;
    5000           3 :                 if (TransferLoadListNum != 0) ++NumNameMatches;
    5001           3 :                 if (SecondaryNum != 0) ++NumNameMatches;
    5002           3 :                 if (CascadeLoadNum != 0) ++NumNameMatches;
    5003           3 :                 int NumCascadeLoad = 0;
    5004             : 
    5005           3 :                 if (NumNameMatches != 1) { // name must uniquely point to a list or a single transfer load
    5006           0 :                     ErrorsFound = true;
    5007           0 :                     if (NumNameMatches == 0) {
    5008           0 :                         ShowSevereError(state,
    5009           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + System(RefrigSysNum).Name + "\", has an invalid " +
    5010           0 :                                             cAlphaFieldNames(AlphaNum) + ": " + Alphas(AlphaNum));
    5011           0 :                     } else if (NumNameMatches > 1) {
    5012           0 :                         ShowSevereError(state,
    5013           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + System(RefrigSysNum).Name +
    5014           0 :                                             "\", has a non-unique name that could be either a " + cAlphaFieldNames(AlphaNum) + ": " +
    5015           0 :                                             Alphas(AlphaNum));
    5016             :                     }                                  // num matches = 0 or > 1
    5017           3 :                 } else if (TransferLoadListNum != 0) { // Name points to a transferLoad list
    5018           1 :                     NumSecondary = TransferLoadList(TransferLoadListNum).NumSecondarys;
    5019           1 :                     NumCascadeLoad = TransferLoadList(TransferLoadListNum).NumCascadeLoads;
    5020           1 :                     System(RefrigSysNum).NumSecondarys = NumSecondary;
    5021           1 :                     System(RefrigSysNum).NumCascadeLoads = NumCascadeLoad;
    5022           1 :                     if (!allocated(System(RefrigSysNum).SecondaryNum)) System(RefrigSysNum).SecondaryNum.allocate(NumSecondary);
    5023           1 :                     System(RefrigSysNum).SecondaryNum({1, NumSecondary}) = TransferLoadList(TransferLoadListNum).SecondaryItemNum({1, NumSecondary});
    5024           1 :                     if (!allocated(System(RefrigSysNum).CascadeLoadNum)) System(RefrigSysNum).CascadeLoadNum.allocate(NumCascadeLoad);
    5025           1 :                     System(RefrigSysNum).CascadeLoadNum({1, NumCascadeLoad}) =
    5026           2 :                         TransferLoadList(TransferLoadListNum).CascadeLoadItemNum({1, NumCascadeLoad});
    5027           2 :                 } else if (SecondaryNum != 0) { // Name points to a secondary loop load
    5028           1 :                     NumSecondary = 1;
    5029           1 :                     System(RefrigSysNum).NumSecondarys = 1;
    5030           1 :                     if (!allocated(System(RefrigSysNum).SecondaryNum)) System(RefrigSysNum).SecondaryNum.allocate(NumSecondary);
    5031           1 :                     System(RefrigSysNum).SecondaryNum(NumSecondary) = SecondaryNum;
    5032           1 :                 } else if (CascadeLoadNum != 0) { // Name points to a cascade condenser load
    5033           1 :                     NumCascadeLoad = 1;
    5034           1 :                     System(RefrigSysNum).NumCascadeLoads = 1;
    5035           1 :                     if (!allocated(System(RefrigSysNum).CascadeLoadNum)) System(RefrigSysNum).CascadeLoadNum.allocate(NumCascadeLoad);
    5036           1 :                     System(RefrigSysNum).CascadeLoadNum(NumCascadeLoad) = CascadeLoadNum;
    5037             :                 } // NumNameMatches /= 1
    5038             : 
    5039           3 :                 System(RefrigSysNum).CoilFlag = false;
    5040             :                 // Now need to loop through all transfer loads to see if they change the minimum required system evaporating temperature
    5041           3 :                 if (NumSecondary > 0) {
    5042           4 :                     for (int SecondaryIndex = 1; SecondaryIndex <= NumSecondary; ++SecondaryIndex) {
    5043           2 :                         int SecondaryID = System(RefrigSysNum).SecondaryNum(SecondaryIndex);
    5044           2 :                         if (SecondaryIndex == 1) { // check for consistency of loads (coils calc on sys time step, all others on zone time step)
    5045           2 :                             if (Secondary(SecondaryID).CoilFlag) System(RefrigSysNum).CoilFlag = true;
    5046           0 :                         } else if (Secondary(SecondaryID).CoilFlag != System(RefrigSysNum).CoilFlag) {
    5047           0 :                             ShowSevereError(state,
    5048           0 :                                             std::string{RoutineName} + CurrentModuleObject + "=\"" + System(RefrigSysNum).Name +
    5049             :                                                 "\", Serves an inconsistent mixture of loads. Coil-type loads are served on a different time step "
    5050           0 :                                                 "than case or walkin loads. Compare loads on system served by secondary loop \"" +
    5051           0 :                                                 Secondary(SecondaryID).Name);
    5052           0 :                             ErrorsFound = true;
    5053             :                         } // check for consistency of loads (coils calc on sys time step, all others on zone time step)
    5054             :                         // mark all Secondarys on system as used by this system (checking for unused or non-unique Secondarys)
    5055           2 :                         ++Secondary(SecondaryID).NumSysAttach;
    5056           2 :                         NominalTotalSecondaryCap += Secondary(SecondaryID).CoolingLoadRated;
    5057           2 :                         System(RefrigSysNum).RefInventory += Secondary(SecondaryID).ChillerRefInventory;
    5058             :                         // Find design evaporating temperature for system by getting min design evap for ALL loads
    5059           4 :                         if ((SecondaryIndex == 1) && (System(RefrigSysNum).NumCases == 0) && (System(RefrigSysNum).NumCoils == 0) &&
    5060           2 :                             (System(RefrigSysNum).NumWalkIns == 0)) {
    5061             :                             // note use secondary index above, not secondaryid here to get
    5062             :                             // first secondary on this suction group/system
    5063             :                             // note - TMinNeeded on secondary defined by cases and walkins served by secondary, not by
    5064             :                             //       the secondary's rated evaporating temperature (which is used to calc secondary heat
    5065             :                             //       exchanger effectiveness with other rated values)
    5066           2 :                             System(RefrigSysNum).TEvapDesign = Secondary(SecondaryID).TMinNeeded;
    5067             :                         } else {
    5068           0 :                             System(RefrigSysNum).TEvapDesign = min(Secondary(SecondaryID).TMinNeeded, System(RefrigSysNum).TEvapDesign);
    5069             :                         }
    5070             :                     } // SecondaryIndex=1,NumSecondary
    5071           2 :                     System(RefrigSysNum).NumNonCascadeLoads += System(RefrigSysNum).NumSecondarys;
    5072             :                 } // numsecondary > 0
    5073             : 
    5074           3 :                 if (NumCascadeLoad > 0) {
    5075           2 :                     for (int cascadeLoadIndex = 1; cascadeLoadIndex <= NumCascadeLoad; ++cascadeLoadIndex) {
    5076           1 :                         int CondID = System(RefrigSysNum).CascadeLoadNum(cascadeLoadIndex);
    5077           1 :                         if (Condenser(CondID).CondenserType != DataHeatBalance::RefrigCondenserType::Cascade) {
    5078           0 :                             ShowSevereError(state,
    5079           0 :                                             std::string{RoutineName} + CurrentModuleObject + "=\"" + System(RefrigSysNum).Name + "\", has a  " +
    5080           0 :                                                 cAlphaFieldNames(AlphaNum) + ": " + Alphas(AlphaNum) +
    5081             :                                                 " cascade load that is not a cascade condenser.");
    5082           0 :                             ErrorsFound = true;
    5083             :                         }
    5084             :                         // For a cascade condenser, need to identify the system absorbing the heat
    5085           1 :                         Condenser(CondID).CascadeSinkSystemID = RefrigSysNum;
    5086           1 :                         NominalTotalCascadeLoad += Condenser(CondID).RatedCapacity;
    5087             :                         // Find design evaporating temperature for system by getting min design evap for ALL loads
    5088           1 :                         if (System(RefrigSysNum).NumNonCascadeLoads == 0) {
    5089           1 :                             if (cascadeLoadIndex == 1) {
    5090             :                                 // note use cascadeload index above, not condid here to get
    5091             :                                 // first cascade condenser served by this suction group/system
    5092           1 :                                 System(RefrigSysNum).TEvapDesign = Condenser(CondID).CascadeRatedEvapTemp;
    5093             :                             } else {
    5094           0 :                                 System(RefrigSysNum).TEvapDesign = min(Condenser(CondID).CascadeRatedEvapTemp, System(RefrigSysNum).TEvapDesign);
    5095             :                             }    // CascadeLoadIndex == 1
    5096             :                         } else { // (NumNonCascadeLoads > 0 so initial TEvapDesign set above with those other loads)
    5097           0 :                             if (Condenser(CondID).CascadeTempControl == CascadeCndsrTempCtrlType::TempSet)
    5098           0 :                                 System(RefrigSysNum).TEvapDesign = min(Condenser(CondID).CascadeRatedEvapTemp,
    5099           0 :                                                                        System(RefrigSysNum).TEvapDesign); // other wise TEvapDesign set by other loads
    5100             :                         }
    5101             :                     } // CascadeLoadIndex=1,NumCascadeLoad
    5102             :                 }     // CascadeLoadNum > 0
    5103             :             }         // yes/no blank input for transfer loads
    5104             : 
    5105             :             // check for consistency of loads (coils calc on sys time step, all others on zone time step, so can't mix on one system)
    5106          39 :             if (System(RefrigSysNum).CoilFlag) { // could already be true if serving secondary that serves coils
    5107           0 :                 if ((System(RefrigSysNum).NumCases > 0) || (System(RefrigSysNum).NumWalkIns > 0)) {
    5108           0 :                     ShowSevereError(state,
    5109           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + System(RefrigSysNum).Name +
    5110             :                                         "\", Serves an inconsistent mixture of loads. Coil-type loads are served on a different time step than case "
    5111             :                                         "or walkin loads.");
    5112           0 :                     ErrorsFound = true;
    5113             :                 }
    5114             :             } else {                                     // no coils on secondary or no secondary
    5115          39 :                 if (System(RefrigSysNum).NumCoils > 0) { //(note, coilflag set to .FALSE. for all systems as default above
    5116           9 :                     System(RefrigSysNum).CoilFlag = true;
    5117           9 :                     if ((System(RefrigSysNum).NumCases > 0) || (System(RefrigSysNum).NumWalkIns > 0)) {
    5118           0 :                         ShowSevereError(state,
    5119           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + System(RefrigSysNum).Name +
    5120             :                                             "\", Serves an inconsistent mixture of loads. Coil-type loads are served on a different time step than "
    5121             :                                             "case or walkin loads.");
    5122           0 :                         ErrorsFound = true;
    5123             :                     }
    5124             :                 } // NumCoils > 0
    5125             :             }     // Coil flag already true due to secondary coil loads
    5126             : 
    5127          39 :             NominalTotalCoolingCap = NominalTotalCaseCap + NominalTotalWalkInCap + NominalTotalSecondaryCap + NominalTotalCascadeLoad;
    5128             : 
    5129             :             // read condenser
    5130             :             // currently assumes one condenser per refrigeration system and but multiple systems allowed per condenser
    5131          39 :             AlphaNum = 4;
    5132          39 :             int NumCondensers = 1;
    5133          39 :             if (!allocated(System(RefrigSysNum).CondenserNum)) System(RefrigSysNum).CondenserNum.allocate(NumCondensers);
    5134          39 :             System(RefrigSysNum).NumCondensers = 1;
    5135             :             // Find condenser number, note condensers were read in one of four objects, but all read into same list
    5136          39 :             int CondNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), Condenser);
    5137          39 :             if (CondNum == 0) {
    5138           0 :                 ShowSevereError(state,
    5139           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + System(RefrigSysNum).Name + "\", has an invalid " +
    5140           0 :                                     cAlphaFieldNames(AlphaNum) + " defined as " + Alphas(AlphaNum));
    5141           0 :                 ErrorsFound = true;
    5142             :             } else {
    5143          39 :                 System(RefrigSysNum).CondenserNum(NumCondensers) = CondNum;
    5144             :                 // Now take care of case where multiple systems share a condenser
    5145          39 :                 ++Condenser(CondNum).NumSysAttach;
    5146          39 :                 Condenser(CondNum).SysNum(Condenser(CondNum).NumSysAttach) = RefrigSysNum;
    5147             :             }
    5148             : 
    5149          39 :             System(RefrigSysNum).RefInventory +=
    5150          39 :                 Condenser(CondNum).RefReceiverInventory + Condenser(CondNum).RefPipingInventory + Condenser(CondNum).RefOpCharge;
    5151          39 :             if (Condenser(CondNum).CondenserType == DataHeatBalance::RefrigCondenserType::Cascade) Condenser(CondNum).CascadeSysID = RefrigSysNum;
    5152          39 :             if ((Condenser(CondNum).CondenserType == DataHeatBalance::RefrigCondenserType::Air) && (Condenser(CondNum).CondenserRejectHeatToZone))
    5153           3 :                 System(RefrigSysNum).SystemRejectHeatToZone = true;
    5154             : 
    5155             :             // Now do evaporative condenser auto sizing because it is a function of the system's cooling load
    5156          39 :             if (Condenser(CondNum).CondenserType == DataHeatBalance::RefrigCondenserType::Evap) {
    5157           4 :                 if (Condenser(CondNum).RatedAirFlowRate == DataGlobalConstants::AutoCalculate) {
    5158           0 :                     Condenser(CondNum).RatedAirFlowRate = AirVolRateEvapCond * Condenser(CondNum).RatedCapacity;
    5159             :                 }
    5160           4 :                 if (Condenser(CondNum).RatedAirFlowRate <= 0.0) {
    5161           0 :                     ShowSevereError(state,
    5162           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + Condenser(CondNum).Name +
    5163             :                                         "\", Evaporative Condenser Air Volume Flow Rate cannot be less than or equal to zero.");
    5164           0 :                     ErrorsFound = true;
    5165             :                 }
    5166           4 :                 if (Condenser(CondNum).EvapPumpPower == DataGlobalConstants::AutoCalculate) {
    5167           0 :                     Condenser(CondNum).EvapPumpPower = CondPumpRatePower * Condenser(CondNum).RatedCapacity;
    5168             :                 }
    5169           4 :                 if (Condenser(CondNum).EvapPumpPower < 0.0) {
    5170           0 :                     ShowSevereError(state,
    5171           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + Condenser(CondNum).Name +
    5172             :                                         "\", Design Evaporative Condenser Water Pump Power cannot be less than zero.");
    5173           0 :                     ErrorsFound = true;
    5174             :                 }
    5175             :             }
    5176             : 
    5177             :             // Read the compressor data.
    5178             :             // If the system consists of two stages of compression, these compressors will be the low-stage compressors.
    5179          39 :             AlphaNum = 5;
    5180          39 :             int NumCompressorsSys = 0;
    5181          39 :             if (lAlphaBlanks(AlphaNum)) {
    5182             :                 // blank input where must have compressor or compressor list input.
    5183           0 :                 ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + ' ' + cAlphaFieldNames(AlphaNum) + "\" : must be input.");
    5184           0 :                 ErrorsFound = true;
    5185             :             } else { //     Entry for Alphas(AlphaNum) can be either a compressor name or a compressorlist name
    5186             :                 int ListNum;
    5187          39 :                 if (NumCompressorLists > 0) {
    5188          39 :                     ListNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), CompressorLists);
    5189             :                 } else {
    5190           0 :                     ListNum = 0;
    5191             :                 }
    5192             :                 int CompNum;
    5193          39 :                 if (state.dataRefrigCase->NumSimulationCompressors > 0) {
    5194          39 :                     CompNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), Compressor);
    5195             :                 } else {
    5196           0 :                     CompNum = 0;
    5197             :                 }
    5198          39 :                 if ((ListNum == 0) && (CompNum == 0)) { // name doesn't match either a compressor or a compressor list
    5199           0 :                     ShowSevereError(state,
    5200           0 :                                     std::string{RoutineName} + CurrentModuleObject + ' ' + cAlphaFieldNames(AlphaNum) +
    5201           0 :                                         ", has an invalid or undefined value=\"" + Alphas(AlphaNum) + "\".");
    5202           0 :                     ErrorsFound = true;
    5203          39 :                 } else if ((ListNum != 0) && (CompNum != 0)) { // have compressor list and compressor with same name
    5204           0 :                     ShowSevereError(state,
    5205           0 :                                     std::string{RoutineName} + CurrentModuleObject + ' ' + cAlphaFieldNames(AlphaNum) +
    5206           0 :                                         ", has a non-unique name used for both Compressor and CompressorList name: \"" + Alphas(AlphaNum) + "\".");
    5207           0 :                     ErrorsFound = true;
    5208          39 :                 } else if (ListNum != 0) {
    5209          39 :                     NumCompressorsSys = CompressorLists(ListNum).NumCompressors;
    5210          39 :                     System(RefrigSysNum).NumCompressors = NumCompressorsSys;
    5211          39 :                     if (!allocated(System(RefrigSysNum).CompressorNum)) System(RefrigSysNum).CompressorNum.allocate(NumCompressorsSys);
    5212          39 :                     System(RefrigSysNum).CompressorNum({1, NumCompressorsSys}) = CompressorLists(ListNum).CompItemNum({1, NumCompressorsSys});
    5213           0 :                 } else if (CompNum != 0) {
    5214           0 :                     NumCompressorsSys = 1;
    5215           0 :                     System(RefrigSysNum).NumCompressors = 1;
    5216           0 :                     if (!allocated(System(RefrigSysNum).CompressorNum)) System(RefrigSysNum).CompressorNum.allocate(NumCompressorsSys);
    5217           0 :                     System(RefrigSysNum).CompressorNum(NumCompressorsSys) = CompNum;
    5218             :                 }
    5219             :             }
    5220             : 
    5221          39 :             if (!lNumericBlanks(1)) {
    5222          39 :                 System(RefrigSysNum).TCondenseMin = Numbers(1);
    5223          39 :                 System(RefrigSysNum).TCondenseMinInput = System(RefrigSysNum).TCondenseMin;
    5224          39 :                 if (state.dataGlobal->AnyEnergyManagementSystemInModel) {
    5225           8 :                     SetupEMSActuator(state,
    5226             :                                      "Refrigeration:System",
    5227           2 :                                      System(RefrigSysNum).Name,
    5228             :                                      "Minimum Condensing Temperature",
    5229             :                                      "[C]",
    5230           2 :                                      System(RefrigSysNum).EMSOverrideOnTCondenseMin,
    5231           6 :                                      System(RefrigSysNum).EMSOverrideValueTCondenseMin);
    5232             :                 }
    5233             :             } else {
    5234           0 :                 ShowSevereError(state,
    5235           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + System(RefrigSysNum).Name + "\", " + cNumericFieldNames(1) +
    5236             :                                     " must be defined.");
    5237           0 :                 ErrorsFound = true;
    5238             :             }
    5239          40 :             if ((Condenser(CondNum).CondenserType == DataHeatBalance::RefrigCondenserType::Cascade) &&
    5240           1 :                 (System(RefrigSysNum).TCondenseMin > Condenser(CondNum).RatedTCondense))
    5241           0 :                 ShowWarningError(state,
    5242           0 :                                  CurrentModuleObject + "=\"" + System(RefrigSysNum).Name +
    5243             :                                      "\", The system specified minimum condensing temperature is greater than the rated condensing temperature for "
    5244             :                                      "the cascade condenser. ");
    5245             : 
    5246          39 :             AlphaNum = 6;
    5247          39 :             System(RefrigSysNum).RefrigerantName = Alphas(AlphaNum);
    5248             :             // error messages for refrigerants already found in fluidproperties
    5249             : 
    5250          39 :             AlphaNum = 7;
    5251          39 :             if (!lAlphaBlanks(AlphaNum)) {
    5252          39 :                 if (UtilityRoutines::SameString(Alphas(AlphaNum), "ConstantSuctionTemperature")) {
    5253          37 :                     System(RefrigSysNum).CompSuctControl = CompressorSuctionPressureCtrl::ConstantSuctionTemperature;
    5254           2 :                 } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "FloatSuctionTemperature")) {
    5255           2 :                     System(RefrigSysNum).CompSuctControl = CompressorSuctionPressureCtrl::FloatSuctionTemperature;
    5256           2 :                     if (System(RefrigSysNum).CoilFlag) {
    5257           0 :                         ShowWarningError(state,
    5258           0 :                                          CurrentModuleObject + "=\"" + System(RefrigSysNum).Name +
    5259             :                                              "\", The system specified a FloatSuctionTemperature, but that is not available with air chiller loads "
    5260             :                                              "so ConstantSuctionTemperature will be used. ");
    5261             :                     } // coilflag
    5262             :                 } else {
    5263           0 :                     ShowSevereError(state,
    5264           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + System(RefrigSysNum).Name + "\", invalid  " +
    5265           0 :                                         cAlphaFieldNames(AlphaNum) + " not found = " + Alphas(AlphaNum));
    5266           0 :                     ErrorsFound = true;
    5267             :                 }
    5268             :             } else {
    5269           0 :                 System(RefrigSysNum).CompSuctControl = CompressorSuctionPressureCtrl::ConstantSuctionTemperature; // Default for blank
    5270             :             }
    5271             : 
    5272             :             // Count subcoolers on system and allocate
    5273          39 :             AlphaNum = 8;
    5274          39 :             System(RefrigSysNum).NumSubcoolers = 0;
    5275          39 :             if (!lAlphaBlanks(AlphaNum)) {
    5276           1 :                 ++System(RefrigSysNum).NumSubcoolers;
    5277             :             }
    5278          39 :             if (!lAlphaBlanks(AlphaNum + 1)) {
    5279           1 :                 ++System(RefrigSysNum).NumSubcoolers;
    5280             :             }
    5281             : 
    5282          39 :             if (System(RefrigSysNum).NumSubcoolers > 0) {
    5283           1 :                 if (!allocated(System(RefrigSysNum).SubcoolerNum)) System(RefrigSysNum).SubcoolerNum.allocate(System(RefrigSysNum).NumSubcoolers);
    5284           1 :                 int NumSubcooler = 1;
    5285           1 :                 if (!lAlphaBlanks(AlphaNum)) {
    5286           1 :                     System(RefrigSysNum).SubcoolerNum(NumSubcooler) =
    5287           2 :                         state.dataInputProcessing->inputProcessor->getObjectItemNum(state, "Refrigeration:Subcooler", Alphas(AlphaNum));
    5288           1 :                     if (System(RefrigSysNum).SubcoolerNum(NumSubcooler) <= 0) {
    5289           0 :                         ShowSevereError(state,
    5290           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + System(RefrigSysNum).Name + "\", has an invalid " +
    5291           0 :                                             cAlphaFieldNames(AlphaNum) + " defined as \"" + Alphas(AlphaNum) + "\".");
    5292           0 :                         ErrorsFound = true;
    5293             :                     } else {
    5294           1 :                         Subcooler(System(RefrigSysNum).SubcoolerNum(NumSubcooler)).CoilFlag = System(RefrigSysNum).CoilFlag;
    5295             :                     }
    5296           1 :                     ++NumSubcooler;
    5297             :                 }
    5298           1 :                 if (!lAlphaBlanks(AlphaNum + 1)) {
    5299           1 :                     System(RefrigSysNum).SubcoolerNum(NumSubcooler) =
    5300           2 :                         state.dataInputProcessing->inputProcessor->getObjectItemNum(state, "Refrigeration:Subcooler", Alphas(AlphaNum + 1));
    5301           1 :                     if (System(RefrigSysNum).SubcoolerNum(NumSubcooler) <= 0) {
    5302           0 :                         ShowSevereError(state,
    5303           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + System(RefrigSysNum).Name + "\", has an invalid " +
    5304           0 :                                             cAlphaFieldNames(AlphaNum + 1) + " defined as \"" + Alphas(AlphaNum + 1) + "\".");
    5305           0 :                         ErrorsFound = true;
    5306             :                     } else {
    5307           1 :                         Subcooler(System(RefrigSysNum).SubcoolerNum(NumSubcooler)).CoilFlag = System(RefrigSysNum).CoilFlag;
    5308             :                     }
    5309             :                 }
    5310             :             }
    5311             : 
    5312             :             // Suction piping heat gain - optional
    5313             :             //  Input UA and identify the Zone containing the bulk of the suction piping
    5314             :             //  This Zone ID will be used to determine the temperature used for suction piping heat gain.
    5315             :             //  The pipe heat gains are also counted as cooling credit for the zone.
    5316             :             //  Zone Id is only required if Sum UA Suction Piping >0.0
    5317             :             //  Get the Zone and zone node numbers from the zone name entered by the user
    5318          39 :             AlphaNum = 10;
    5319          39 :             System(RefrigSysNum).SumUASuctionPiping = 0.0;
    5320          39 :             if (!lNumericBlanks(2) && !lAlphaBlanks(AlphaNum)) {
    5321           2 :                 System(RefrigSysNum).SumUASuctionPiping = Numbers(2);
    5322           2 :                 System(RefrigSysNum).SuctionPipeActualZoneNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), state.dataHeatBal->Zone);
    5323           2 :                 System(RefrigSysNum).SuctionPipeZoneNodeNum =
    5324           2 :                     DataZoneEquipment::GetSystemNodeNumberForZone(state, System(RefrigSysNum).SuctionPipeActualZoneNum);
    5325           2 :                 if (System(RefrigSysNum).SuctionPipeZoneNodeNum == 0) {
    5326           0 :                     ShowSevereError(state,
    5327           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + System(RefrigSysNum).Name +
    5328           0 :                                         "\", System Node Number not found for " + cAlphaFieldNames(AlphaNum) + " = " + Alphas(AlphaNum) +
    5329           0 :                                         " even though " + cNumericFieldNames(2) +
    5330             :                                         " is greater than zero. Suction piping heat gain cannot be calculated unless a Zone is defined to deterimine "
    5331             :                                         "the environmental temperature surrounding the piping.");
    5332           0 :                     ErrorsFound = true;
    5333             :                 } else {
    5334           2 :                     state.dataRefrigCase->RefrigPresentInZone(System(RefrigSysNum).SuctionPipeActualZoneNum) = true;
    5335             :                 }
    5336          37 :             } else if (!lNumericBlanks(2) && lAlphaBlanks(AlphaNum)) {
    5337           0 :                 ShowWarningError(state,
    5338           0 :                                  std::string{RoutineName} + CurrentModuleObject + "=\"" + System(RefrigSysNum).Name + "\" " +
    5339           0 :                                      cAlphaFieldNames(AlphaNum) + " not found even though " + cNumericFieldNames(2) +
    5340             :                                      " is greater than zero. Suction piping heat gain will not be calculated unless a Zone is defined to determine "
    5341             :                                      "the environmental temperature surrounding the piping.");
    5342          37 :             } else if (lNumericBlanks(2) && !lAlphaBlanks(AlphaNum)) {
    5343           0 :                 ShowWarningError(state,
    5344           0 :                                  std::string{RoutineName} + CurrentModuleObject + "=\"" + System(RefrigSysNum).Name + "\" " +
    5345           0 :                                      cAlphaFieldNames(AlphaNum) + " will not be used and suction piping heat gain will not be calculated because " +
    5346           0 :                                      cNumericFieldNames(2) + " was blank.");
    5347             :             } // suction piping heat gains
    5348             : 
    5349          39 :             AlphaNum = 11;
    5350          39 :             if (!lAlphaBlanks(AlphaNum)) System(RefrigSysNum).EndUseSubcategory = Alphas(AlphaNum);
    5351             : 
    5352             :             // Single-stage or two-stage compression system
    5353          39 :             if (!lNumericBlanks(3)) {
    5354           2 :                 System(RefrigSysNum).NumStages = Numbers(3);
    5355           2 :                 if (System(RefrigSysNum).NumStages < 1 || System(RefrigSysNum).NumStages > 2) {
    5356           0 :                     ShowSevereError(state,
    5357           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + System(RefrigSysNum).Name + "\", " +
    5358           0 :                                         cNumericFieldNames(3) + R"( has an invalid value.  Only \"1\" or \"2\" compressor stages are allowed.)");
    5359           0 :                     ErrorsFound = true;
    5360             :                 }
    5361             :             } else {
    5362          37 :                 System(RefrigSysNum).NumStages = 1; // Default for blank
    5363             :             }
    5364             : 
    5365             :             // Intercooler type
    5366             :             // None (0) for single-stage compression systems
    5367             :             // Flash intercooler (1) or coil-and-shell intercooler (2) for two-stage compression systems
    5368          39 :             AlphaNum = 12;
    5369          39 :             if (!lAlphaBlanks(AlphaNum)) {
    5370           2 :                 if (UtilityRoutines::SameString(Alphas(AlphaNum), "None")) {
    5371           0 :                     System(RefrigSysNum).IntercoolerType = 0;
    5372           2 :                 } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "Flash Intercooler")) {
    5373           1 :                     System(RefrigSysNum).IntercoolerType = 1;
    5374           1 :                 } else if (UtilityRoutines::SameString(Alphas(AlphaNum), "Shell-and-Coil Intercooler")) {
    5375           1 :                     System(RefrigSysNum).IntercoolerType = 2;
    5376             :                 } else {
    5377           0 :                     ShowSevereError(state,
    5378           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + System(RefrigSysNum).Name + "\", Invalid " +
    5379           0 :                                         cAlphaFieldNames(AlphaNum) + " specified.");
    5380           0 :                     ShowContinueError(state, "\"" + Alphas(AlphaNum) + "\" is not a recognized intercooler type.");
    5381           0 :                     ErrorsFound = true;
    5382             :                 }
    5383             :             } else {
    5384          37 :                 System(RefrigSysNum).IntercoolerType = 0; // Default for blank
    5385             :             }
    5386             : 
    5387          39 :             if (System(RefrigSysNum).NumStages == 1 && (System(RefrigSysNum).IntercoolerType == 1 || System(RefrigSysNum).IntercoolerType == 2)) {
    5388           0 :                 ShowSevereError(state,
    5389           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + System(RefrigSysNum).Name +
    5390             :                                     "\", A single-stage compression system");
    5391           0 :                 ShowContinueError(state, "has been specified with an intercooler.  Verify that the number of compressor stages");
    5392           0 :                 ShowContinueError(state, "and the intercooler type are consistent.");
    5393           0 :                 ErrorsFound = true;
    5394          39 :             } else if (System(RefrigSysNum).NumStages == 2 && System(RefrigSysNum).IntercoolerType == 0) {
    5395           0 :                 ShowSevereError(
    5396           0 :                     state, std::string{RoutineName} + CurrentModuleObject + "=\"" + System(RefrigSysNum).Name + "\", A two-stage compression system");
    5397           0 :                 ShowContinueError(state, "has been specified without an intercooler.  Verify that the number of compressor stages");
    5398           0 :                 ShowContinueError(state, "and the intercooler type are consistent.");
    5399           0 :                 ErrorsFound = true;
    5400             :             }
    5401             : 
    5402             :             // Shell-and-coil intercooler effectiveness
    5403          39 :             if (!lNumericBlanks(4)) {
    5404           1 :                 System(RefrigSysNum).IntercoolerEffectiveness = Numbers(4);
    5405           1 :                 if (System(RefrigSysNum).IntercoolerEffectiveness < 0.0 || System(RefrigSysNum).IntercoolerEffectiveness > 1.0) {
    5406           0 :                     ShowWarningError(state,
    5407           0 :                                      std::string{RoutineName} + CurrentModuleObject + "=\"" + System(RefrigSysNum).Name +
    5408             :                                          "\", The specified value for the");
    5409           0 :                     ShowContinueError(
    5410             :                         state,
    5411           0 :                         format("{} = {:.2R} is invalid.  This value must be", cNumericFieldNames(4), System(RefrigSysNum).IntercoolerEffectiveness));
    5412           0 :                     ShowContinueError(state, "between 0.0 and 1.0.  The default value of 0.8 will be used.");
    5413           0 :                     System(RefrigSysNum).IntercoolerEffectiveness = 0.8;
    5414             :                 }
    5415             :             } else {
    5416          38 :                 System(RefrigSysNum).IntercoolerEffectiveness = 0.8;
    5417             :             }
    5418             : 
    5419             :             // Read the high-stage compressor info, if two-stage compression has been specified.
    5420          39 :             AlphaNum = 13;
    5421          39 :             int NumHiStageCompressorsSys = 0;
    5422          39 :             if (System(RefrigSysNum).NumStages == 2) {
    5423           2 :                 if (lAlphaBlanks(AlphaNum)) {
    5424             :                     // blank input where must have high-stage compressor or compressor list input.
    5425           0 :                     ShowSevereError(state,
    5426           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + System(RefrigSysNum).Name + "\", " +
    5427           0 :                                         cAlphaFieldNames(AlphaNum) + " must be input for two-stage compression systems.");
    5428           0 :                     ErrorsFound = true;
    5429             :                 } else { //     Entry for Alphas(AlphaNum) can be either a compressor name or a compressorlist name
    5430           2 :                     int ListNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), CompressorLists);
    5431           2 :                     int CompNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), Compressor);
    5432           2 :                     if ((ListNum == 0) && (CompNum == 0)) { // name doesn't match either a compressor or a compressor list
    5433           0 :                         ShowSevereError(state,
    5434           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + System(RefrigSysNum).Name + "\", " +
    5435           0 :                                             cAlphaFieldNames(AlphaNum) + " has an invalid or undefined value=\"" + Alphas(AlphaNum) + "\".");
    5436           0 :                         ErrorsFound = true;
    5437           2 :                     } else if ((ListNum != 0) && (CompNum != 0)) { // have compressor list and compressor with same name
    5438           0 :                         ShowSevereError(state,
    5439           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + System(RefrigSysNum).Name + "\", " +
    5440           0 :                                             cAlphaFieldNames(AlphaNum) +
    5441           0 :                                             " has a non-unique name used for both Compressor and CompressorList name: \"" + Alphas(AlphaNum) + "\".");
    5442           0 :                         ErrorsFound = true;
    5443           2 :                     } else if (ListNum != 0) {
    5444           2 :                         NumHiStageCompressorsSys = CompressorLists(ListNum).NumCompressors;
    5445           2 :                         System(RefrigSysNum).NumHiStageCompressors = NumHiStageCompressorsSys;
    5446           2 :                         if (!allocated(System(RefrigSysNum).HiStageCompressorNum))
    5447           2 :                             System(RefrigSysNum).HiStageCompressorNum.allocate(NumHiStageCompressorsSys);
    5448           2 :                         System(RefrigSysNum).HiStageCompressorNum({1, NumHiStageCompressorsSys}) =
    5449           4 :                             CompressorLists(ListNum).CompItemNum({1, NumHiStageCompressorsSys});
    5450           0 :                     } else if (CompNum != 0) {
    5451           0 :                         NumHiStageCompressorsSys = 1;
    5452           0 :                         System(RefrigSysNum).NumHiStageCompressors = 1;
    5453           0 :                         if (!allocated(System(RefrigSysNum).HiStageCompressorNum))
    5454           0 :                             System(RefrigSysNum).HiStageCompressorNum.allocate(NumHiStageCompressorsSys);
    5455           0 :                         System(RefrigSysNum).HiStageCompressorNum(NumHiStageCompressorsSys) = CompNum;
    5456             :                     }
    5457             :                 }
    5458             :             }
    5459             : 
    5460             :             // Determine intercooler pressure and temperature at design conditions
    5461          39 :             if (System(RefrigSysNum).NumStages == 2) {
    5462           6 :                 Real64 PCond = FluidProperties::GetSatPressureRefrig(state,
    5463           2 :                                                                      System(RefrigSysNum).RefrigerantName,
    5464           2 :                                                                      Condenser(System(RefrigSysNum).CondenserNum(1)).RatedTCondense,
    5465           2 :                                                                      System(RefrigSysNum).RefIndex,
    5466           2 :                                                                      RoutineName);
    5467           6 :                 Real64 PEvap = FluidProperties::GetSatPressureRefrig(
    5468           8 :                     state, System(RefrigSysNum).RefrigerantName, System(RefrigSysNum).TEvapDesign, System(RefrigSysNum).RefIndex, RoutineName);
    5469           2 :                 System(RefrigSysNum).PIntercooler = std::sqrt(PCond * PEvap);
    5470           6 :                 System(RefrigSysNum).TIntercooler = FluidProperties::GetSatTemperatureRefrig(
    5471           6 :                     state, System(RefrigSysNum).RefrigerantName, System(RefrigSysNum).PIntercooler, System(RefrigSysNum).RefIndex, RoutineName);
    5472             :             } // NumStages
    5473             : 
    5474             :             // Sum capacity of single-stage compressors or low-stage compressors if two-stage system
    5475          39 :             Real64 NominalTotalCompCap = 0.0;
    5476         199 :             for (int CompIndex = 1; CompIndex <= NumCompressorsSys; ++CompIndex) {
    5477         160 :                 int CompNum = System(RefrigSysNum).CompressorNum(CompIndex);
    5478         160 :                 if (!Compressor(CompNum).TransFlag) {          //  Subcritical Compressor
    5479         160 :                     if (System(RefrigSysNum).NumStages == 1) { //  Single-stage compression
    5480         616 :                         Compressor(CompNum).NomCap = Curve::CurveValue(state,
    5481         154 :                                                                        Compressor(CompNum).CapacityCurvePtr,
    5482         154 :                                                                        System(RefrigSysNum).TEvapDesign,
    5483         154 :                                                                        Condenser(System(RefrigSysNum).CondenserNum(1)).RatedTCondense);
    5484         154 :                         NominalTotalCompCap += Compressor(CompNum).NomCap;
    5485         154 :                         ++Compressor(CompNum).NumSysAttach;
    5486             :                     } else { //  Two-stage compression, low-stage compressors
    5487          24 :                         Compressor(CompNum).NomCap = Curve::CurveValue(
    5488          18 :                             state, Compressor(CompNum).CapacityCurvePtr, System(RefrigSysNum).TEvapDesign, System(RefrigSysNum).TIntercooler);
    5489           6 :                         NominalTotalCompCap += Compressor(CompNum).NomCap;
    5490           6 :                         ++Compressor(CompNum).NumSysAttach;
    5491             :                     }    // NumStages
    5492             :                 } else { //  Transcritical compressor attached to subcritical refigeration cycle
    5493           0 :                     ShowSevereError(state,
    5494           0 :                                     std::string{RoutineName} + CurrentModuleObject +
    5495             :                                         ". A transcritical compressor is attached to a subcritical refrigeration system.");
    5496           0 :                     ShowContinueError(state,
    5497             :                                       "Check input to ensure that subcritical compressors are connected only to subcritical systems and "
    5498             :                                       "transcritical compressors are connected only to transcritical systems.");
    5499           0 :                     ErrorsFound = true;
    5500             :                 } // .NOT. Compressor(CompNum)%TransFlag
    5501             :             }
    5502             : 
    5503          39 :             Real64 NominalTotalHiStageCompCap(0.0); // Total of nominal high-stage compressor capacities, used for rough input check (W)
    5504             : 
    5505             :             // Sum capacity of high-stage compressors if two stage system
    5506          39 :             if (System(RefrigSysNum).NumStages == 2) {
    5507          10 :                 for (int CompIndex = 1; CompIndex <= NumHiStageCompressorsSys; ++CompIndex) {
    5508           8 :                     int CompNum = System(RefrigSysNum).HiStageCompressorNum(CompIndex);
    5509           8 :                     if (!Compressor(CompNum).TransFlag) { //  Subcritical Compressor
    5510          32 :                         Compressor(CompNum).NomCap = Curve::CurveValue(state,
    5511           8 :                                                                        Compressor(CompNum).CapacityCurvePtr,
    5512           8 :                                                                        System(RefrigSysNum).TIntercooler,
    5513           8 :                                                                        Condenser(System(RefrigSysNum).CondenserNum(1)).RatedTCondense);
    5514           8 :                         NominalTotalHiStageCompCap += Compressor(CompNum).NomCap;
    5515           8 :                         ++Compressor(CompNum).NumSysAttach;
    5516             :                     } else { //  Transcritical compressor attached to subcritical refigeration cycle
    5517           0 :                         ShowSevereError(state,
    5518           0 :                                         std::string{RoutineName} + CurrentModuleObject +
    5519             :                                             ". A transcritical compressor is attached to a subcritical refrigeration system.");
    5520           0 :                         ShowContinueError(state,
    5521             :                                           "Check input to ensure that subcritical compressors are connected only to subcritical systems and "
    5522             :                                           "transcritical compressors are connected only to transcritical systems.");
    5523           0 :                         ErrorsFound = true;
    5524             :                     }
    5525             :                 }
    5526             :             } // NumStages
    5527             : 
    5528             :             // Compare the rated capacity of compressor, condenser, and cases.
    5529             :             // Note, rated capacities can be far off from operating capacities, but rough check.
    5530          39 :             Real64 NominalCondCap = Condenser(System(RefrigSysNum).CondenserNum(1)).RatedCapacity;
    5531          39 :             if (System(RefrigSysNum).SystemRejectHeatToZone) NominalCondCap *= 2.0;
    5532          39 :             if (System(RefrigSysNum).NumStages == 1) { // Single-stage system
    5533          37 :                 if ((NominalTotalCompCap < (0.7 * NominalTotalCoolingCap)) || (NominalCondCap < (1.3 * NominalTotalCoolingCap))) {
    5534           3 :                     ShowWarningError(state,
    5535           3 :                                      format("{}=\"{}\", You may wish to check the system sizing. Total nominal cooling capacity is {:.0R}W. "
    5536             :                                             "Condenser capacity is {:.0R}W. Nominal compressor capacity is {:.0R}W.",
    5537             :                                             CurrentModuleObject,
    5538           1 :                                             System(RefrigSysNum).Name,
    5539             :                                             NominalTotalCoolingCap,
    5540             :                                             NominalCondCap,
    5541           1 :                                             NominalTotalCompCap));
    5542             :                 }
    5543           2 :             } else if (System(RefrigSysNum).NumStages == 2) { // Two-stage system
    5544           2 :                 if ((NominalTotalHiStageCompCap < (0.7 * NominalTotalCoolingCap)) || (NominalCondCap < (1.3 * NominalTotalCoolingCap))) {
    5545           0 :                     ShowWarningError(state,
    5546           0 :                                      format("{}=\"{}\", You may wish to check the system sizing. Total nominal cooling capacity is {:.0R}W. "
    5547             :                                             "Condenser capacity is {:.0R}W. Nominal compressor capacity is {:.0R}W.",
    5548             :                                             CurrentModuleObject,
    5549           0 :                                             System(RefrigSysNum).Name,
    5550             :                                             NominalTotalCoolingCap,
    5551             :                                             NominalCondCap,
    5552           0 :                                             NominalTotalCompCap));
    5553             :                 }
    5554             :             } // NumStages
    5555             : 
    5556             :         } // Refrigeration systems
    5557             : 
    5558             :         // Assign coilflags to compressors, condensers, and subcoolers (coils calc on sys time step, all other refrig loads on zone time step, so
    5559             :         // can't mix on one system) need to do here once again after all cascade condensers and cascade sink systems have been identified
    5560          54 :         for (RefrigSysNum = 1; RefrigSysNum <= state.dataRefrigCase->NumRefrigSystems; ++RefrigSysNum) {
    5561             :             // assign flags to all condensers to match system below condenser (system rejecting heat to cascade condenser)
    5562          39 :             int CondNum = System(RefrigSysNum).CondenserNum(1); // right now only have one condenser per system
    5563          39 :             Condenser(CondNum).CoilFlag = System(RefrigSysNum).CoilFlag;
    5564         199 :             for (int CompIndex = 1; CompIndex <= System(RefrigSysNum).NumCompressors; ++CompIndex) {
    5565         160 :                 int CompNum = System(RefrigSysNum).CompressorNum(CompIndex);
    5566         160 :                 Compressor(CompNum).CoilFlag = System(RefrigSysNum).CoilFlag;
    5567             :             }
    5568             : 
    5569             :         } // assign coil flags to all condensers
    5570             : 
    5571             :         // Finished setting cascade condenser coilflags to match system rejecting heat to the cascade condenser
    5572             :         // Now have to see if there's a mismatch in the coilflag with the system absorbing heat from the cascade condenser
    5573             :         // Note a system can cool multiple cascade condensers.  If so, need to be sure all are consistent - all coil or all non-coil(called case
    5574             :         // here) check for consistency of loads (coils calc on sys time step, all others on zone time step, so can't mix on one system)
    5575          54 :         for (RefrigSysNum = 1; RefrigSysNum <= state.dataRefrigCase->NumRefrigSystems;
    5576             :              ++RefrigSysNum) { // check flags for systems reflect all cascade loads
    5577          39 :             if (System(RefrigSysNum).NumCascadeLoads == 0) continue;
    5578           1 :             if (System(RefrigSysNum).CoilFlag) { // system already identified as serving coils
    5579           0 :                 for (int CondID = 1; CondID <= state.dataRefrigCase->NumRefrigCondensers; ++CondID) {
    5580           0 :                     if (Condenser(CondID).CondenserType != DataHeatBalance::RefrigCondenserType::Cascade) continue;
    5581           0 :                     if (RefrigSysNum != Condenser(CondID).CascadeSinkSystemID) continue; // this condenser is not a cascade load on this system
    5582           0 :                     if (!Condenser(CondID).CoilFlag) {
    5583             :                         // would mean system already serving coil loads and this condenser cooling system with case-type loads
    5584           0 :                         ShowSevereError(state,
    5585           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + System(RefrigSysNum).Name +
    5586             :                                             "\", Serves an inconsistent mixture of loads. Coil-type loads are served on a different time step than "
    5587           0 :                                             "case or walkin loads. Compare loads on system served by cascade condenser \"" +
    5588           0 :                                             Condenser(CondID).Name);
    5589           0 :                         ErrorsFound = true;
    5590             :                     }
    5591             :                 }    // CondID
    5592             :             } else { // %coilflag == false, so no coil loads prev identified directly or through secondary loop
    5593             :                 // Flag to help verify load type with loads served by systems cooled by cascade condensers
    5594           1 :                 bool CaseLoads = false;
    5595           1 :                 int NumCascadeLoadsChecked = 0;
    5596           4 :                 for (int CondID = 1; CondID <= state.dataRefrigCase->NumRefrigCondensers; ++CondID) { // look at All cascade condenser loads on system
    5597           3 :                     if (Condenser(CondID).CondenserType != DataHeatBalance::RefrigCondenserType::Cascade) continue;
    5598           1 :                     if (RefrigSysNum != Condenser(CondID).CascadeSinkSystemID) continue; // this condenser is not a cascade load on this system
    5599           1 :                     ++NumCascadeLoadsChecked;
    5600           1 :                     if ((CaseLoads) && (!Condenser(CondID).CoilFlag) && (!System(RefrigSysNum).CoilFlag)) continue;
    5601             :                     // all loads to date are case-type and properly flagged with consistent coilflags
    5602             :                     //(note caseloads could be true if prev cascade load checked is serving a case-type system)
    5603           1 :                     if (NumCascadeLoadsChecked == 1) {
    5604           1 :                         if (Condenser(CondID).CoilFlag) {
    5605           0 :                             System(RefrigSysNum).CoilFlag = true;
    5606             :                             // setting system coilflag if 1st cascade condenser served has coils (system has no case-type loads up to this point)
    5607             :                         } else { // condenser is not serving coils, but case-type loads
    5608           1 :                             CaseLoads = true;
    5609             :                             // system coilflag already set to false
    5610             :                         }    // Condenser%CoilFlag
    5611             :                     } else { // numcascadeloadschecked > 1
    5612           0 :                         if (System(RefrigSysNum).CoilFlag != Condenser(CondID).CoilFlag) {
    5613           0 :                             ShowSevereError(state,
    5614           0 :                                             std::string{RoutineName} + CurrentModuleObject + "=\"" + System(RefrigSysNum).Name +
    5615             :                                                 "\", Serves an inconsistent mixture of loads. Coil-type loads are served on a different time step "
    5616           0 :                                                 "than case or walkin loads. Compare loads on system served by cascade condenser \"" +
    5617           0 :                                                 Condenser(CondID).Name);
    5618           0 :                             ErrorsFound = true;
    5619             :                         }
    5620             :                     } // numcascadeloadschecked > 1
    5621             :                 }     // CondID
    5622             :             }         //(System%coilflag)
    5623             :         }             // Refrigeration systems checking coilflag consistency with cascade condenser loads
    5624             : 
    5625             :     } //(NumRefrigSystems > 0)
    5626             : 
    5627             :     // after the systems have been read, can finish the mechanical subcooler/system interactions
    5628             :     // System%NumMechSCServed=0
    5629         771 :     if (state.dataRefrigCase->NumSimulationSubcoolers > 0) {
    5630           3 :         for (int SubcoolerNum = 1; SubcoolerNum <= state.dataRefrigCase->NumSimulationSubcoolers; ++SubcoolerNum) {
    5631           2 :             if (Subcooler(SubcoolerNum).subcoolerType == SubcoolerType::LiquidSuction) continue;
    5632           1 :             Subcooler(SubcoolerNum).MechSourceSysID =
    5633           2 :                 state.dataInputProcessing->inputProcessor->getObjectItemNum(state, "Refrigeration:System", Subcooler(SubcoolerNum).MechSourceSys);
    5634           1 :             if (Subcooler(SubcoolerNum).MechSourceSysID == 0) {
    5635           0 :                 ShowSevereError(state,
    5636           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + Subcooler(SubcoolerNum).Name +
    5637           0 :                                     "\", Mechanical Subcooler has an invalid Source Refrigeration:System=\"" + Subcooler(SubcoolerNum).MechSourceSys +
    5638             :                                     "\".");
    5639           0 :                 ErrorsFound = true;
    5640             :             } else {
    5641           1 :                 if (System(Subcooler(SubcoolerNum).MechSourceSysID).CoilFlag != Subcooler(SubcoolerNum).CoilFlag) {
    5642           0 :                     ShowSevereError(state,
    5643           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + System(RefrigSysNum).Name +
    5644             :                                         "\", Serves an inconsistent mixture of loads. Coil-type loads are served on a different time step than case "
    5645           0 :                                         "or walkin loads. Compare loads on system served by mechanical subcooler \"" +
    5646           0 :                                         Subcooler(SubcoolerNum).Name);
    5647           0 :                     ErrorsFound = true;
    5648             :                 }
    5649             :             } // error check
    5650             :         }     // numsubcoolers
    5651             : 
    5652           3 :         for (RefrigSysNum = 1; RefrigSysNum <= state.dataRefrigCase->NumRefrigSystems; ++RefrigSysNum) {
    5653           6 :             for (int SubcoolerNum = 1; SubcoolerNum <= state.dataRefrigCase->NumSimulationSubcoolers; ++SubcoolerNum) {
    5654           4 :                 if (Subcooler(SubcoolerNum).subcoolerType == SubcoolerType::LiquidSuction) continue;
    5655           2 :                 if (Subcooler(SubcoolerNum).MechSourceSysID == RefrigSysNum) {
    5656           1 :                     ++System(RefrigSysNum).NumMechSCServed;
    5657             :                 }
    5658             :             }
    5659           2 :             if (System(RefrigSysNum).NumMechSCServed > 0) {
    5660           1 :                 if (!allocated(System(RefrigSysNum).MechSCLoad))
    5661           1 :                     System(RefrigSysNum).MechSCLoad.allocate(state.dataRefrigCase->NumSimulationSubcoolers);
    5662             :             }
    5663             :         }
    5664             :     } // NumSimulationSubcoolers > 0
    5665             : 
    5666             :     // **********  READ TRANSCRITICAL REFRIGERATION SYSTEMS  **********
    5667             : 
    5668         771 :     if (state.dataRefrigCase->NumTransRefrigSystems > 0) {
    5669           1 :         CurrentModuleObject = "Refrigeration:TranscriticalSystem";
    5670           2 :         for (int TransRefrigSysNum = 1; TransRefrigSysNum <= state.dataRefrigCase->NumTransRefrigSystems; ++TransRefrigSysNum) {
    5671           1 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
    5672             :                                                                      CurrentModuleObject,
    5673             :                                                                      TransRefrigSysNum,
    5674             :                                                                      Alphas,
    5675             :                                                                      NumAlphas,
    5676             :                                                                      Numbers,
    5677             :                                                                      NumNumbers,
    5678             :                                                                      IOStatus,
    5679             :                                                                      lNumericBlanks,
    5680             :                                                                      lAlphaBlanks,
    5681             :                                                                      cAlphaFieldNames,
    5682             :                                                                      cNumericFieldNames);
    5683           1 :             UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound);
    5684             : 
    5685           1 :             TransSystem(TransRefrigSysNum).Name = Alphas(1);
    5686             : 
    5687             :             // Read refrigerant for this system
    5688           1 :             AlphaNum = 8;
    5689           1 :             TransSystem(TransRefrigSysNum).RefrigerantName = Alphas(AlphaNum);
    5690             :             // error messages for refrigerants already found in fluidproperties
    5691             : 
    5692             :             // Read Transcritical System Type:  SingleStage or TwoStage
    5693           1 :             if (lAlphaBlanks(2)) {
    5694             :                 // No system type specified
    5695           0 :                 ShowSevereError(state,
    5696           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + TransSystem(TransRefrigSysNum).Name +
    5697             :                                     "\", has no system type specified.");
    5698           0 :                 ShowContinueError(state, R"(  System type must be specified as "SingleStage" or "TwoStage".)");
    5699           0 :                 ErrorsFound = true;
    5700             :             }
    5701           1 :             if (UtilityRoutines::SameString(Alphas(2), "SingleStage")) {
    5702           0 :                 TransSystem(TransRefrigSysNum).TransSysType = 1;
    5703           1 :             } else if (UtilityRoutines::SameString(Alphas(2), "TwoStage")) {
    5704           1 :                 TransSystem(TransRefrigSysNum).TransSysType = 2;
    5705             :             } else {
    5706           0 :                 ShowSevereError(state,
    5707           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + TransSystem(TransRefrigSysNum).Name +
    5708           0 :                                     "\", has an incorrect System Type specified as \"" + Alphas(2) + "\".");
    5709           0 :                 ShowContinueError(state, R"(  System type must be specified as "SingleStage" or "TwoStage".)");
    5710           0 :                 ErrorsFound = true;
    5711             :             }
    5712             : 
    5713             :             // Read all loads (display cases and walk-ins) on this Transcritical System
    5714           1 :             if (lAlphaBlanks(3) && lAlphaBlanks(4)) {
    5715             :                 // No loads specified - display error
    5716           0 :                 ShowSevereError(state,
    5717           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + TransSystem(TransRefrigSysNum).Name + "\", has no loads.");
    5718           0 :                 ShowContinueError(
    5719           0 :                     state, "  The system must have at least one of: " + cAlphaFieldNames(3) + " or " + cAlphaFieldNames(4) + " objects attached.");
    5720           0 :                 ErrorsFound = true;
    5721           1 :             } else if (lAlphaBlanks(3) && TransSystem(TransRefrigSysNum).TransSysType == 1) {
    5722             :                 // No medium temperature loads specified for a SingleStage system - display error
    5723           0 :                 ShowSevereError(state,
    5724           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + TransSystem(TransRefrigSysNum).Name +
    5725             :                                     R"(", is a "SingleStage" system but no medium temperature loads are specified.)");
    5726           0 :                 ShowContinueError(state, "  The system must have at least one " + cAlphaFieldNames(3) + " object attached.");
    5727           0 :                 ErrorsFound = true;
    5728           1 :             } else if (lAlphaBlanks(4) && TransSystem(TransRefrigSysNum).TransSysType == 2) {
    5729             :                 // No low temperature loads specified for a TwoStage system - display error
    5730           0 :                 ShowSevereError(state,
    5731           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + TransSystem(TransRefrigSysNum).Name +
    5732             :                                     R"(", is a "TwoStage" system but no low temperature loads are specified.)");
    5733           0 :                 ShowContinueError(state, "  The system must have at least one " + cAlphaFieldNames(4) + " object attached.");
    5734           0 :                 ErrorsFound = true;
    5735             :             }
    5736             : 
    5737           1 :             int NumCasesMT = 0;
    5738           1 :             TransSystem(TransRefrigSysNum).NumCasesMT = 0;
    5739           1 :             int NumCasesLT = 0;
    5740           1 :             TransSystem(TransRefrigSysNum).NumCasesLT = 0;
    5741           1 :             int NumWalkInsMT = 0;
    5742           1 :             TransSystem(TransRefrigSysNum).NumWalkInsMT = 0;
    5743           1 :             int NumWalkInsLT = 0;
    5744           1 :             TransSystem(TransRefrigSysNum).NumWalkInsLT = 0;
    5745           1 :             Real64 NominalTotalCaseCapMT = 0.0;
    5746           1 :             Real64 NominalTotalCaseCapLT = 0.0;
    5747           1 :             Real64 NominalTotalWalkInCapMT = 0.0;
    5748           1 :             Real64 NominalTotalWalkInCapLT = 0.0;
    5749             :             Real64 NominalTotalCoolingCap;
    5750           1 :             TransSystem(TransRefrigSysNum).RefInventory = 0.0;
    5751             : 
    5752             :             //   Check for Medium Temperature Case or Walk-In or CaseAndWalkInList names
    5753           1 :             AlphaNum = 3;
    5754             : 
    5755           1 :             if (!lAlphaBlanks(AlphaNum)) {
    5756             : 
    5757             :                 // Entry for Alphas(AlphaNum) can be either a Case, WalkIn or CaseAndWalkInList name
    5758           1 :                 int CaseAndWalkInListNum = 0;
    5759           1 :                 int CaseNum = 0;
    5760           1 :                 int WalkInNum = 0;
    5761           1 :                 if (state.dataRefrigCase->NumSimulationCaseAndWalkInLists > 0)
    5762           1 :                     CaseAndWalkInListNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), CaseAndWalkInList);
    5763           1 :                 if (state.dataRefrigCase->NumSimulationCases > 0) CaseNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), RefrigCase);
    5764           1 :                 if (state.dataRefrigCase->NumSimulationWalkIns > 0) WalkInNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), WalkIn);
    5765           1 :                 int NumNameMatches = 0;
    5766           1 :                 if (CaseAndWalkInListNum != 0) ++NumNameMatches;
    5767           1 :                 if (CaseNum != 0) ++NumNameMatches;
    5768           1 :                 if (WalkInNum != 0) ++NumNameMatches;
    5769             : 
    5770           1 :                 if (NumNameMatches != 1) { // name must uniquely point to a list or a single case or walkin or coil
    5771           0 :                     ErrorsFound = true;
    5772           0 :                     if (NumNameMatches == 0) {
    5773           0 :                         ShowSevereError(state,
    5774           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + TransSystem(TransRefrigSysNum).Name +
    5775           0 :                                             "\", has an invalid " + cAlphaFieldNames(AlphaNum) + ": " + Alphas(AlphaNum));
    5776           0 :                     } else if (NumNameMatches > 1) {
    5777           0 :                         ShowSevereError(state,
    5778           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + TransSystem(TransRefrigSysNum).Name +
    5779           0 :                                             "\",  has a non-unique name that could be either a " + cAlphaFieldNames(AlphaNum) + ": " +
    5780           0 :                                             Alphas(AlphaNum));
    5781             :                     }                                   // num matches = 0 or > 1
    5782           1 :                 } else if (CaseAndWalkInListNum != 0) { // Name points to a CaseAndWalkInList
    5783           1 :                     NumCasesMT = CaseAndWalkInList(CaseAndWalkInListNum).NumCases;
    5784           1 :                     NumWalkInsMT = CaseAndWalkInList(CaseAndWalkInListNum).NumWalkIns;
    5785           1 :                     TransSystem(TransRefrigSysNum).NumCasesMT = NumCasesMT;
    5786           1 :                     TransSystem(TransRefrigSysNum).NumWalkInsMT = NumWalkInsMT;
    5787           1 :                     if (NumCasesMT > 0) {
    5788           1 :                         if (!allocated(TransSystem(TransRefrigSysNum).CaseNumMT)) TransSystem(TransRefrigSysNum).CaseNumMT.allocate(NumCasesMT);
    5789           1 :                         TransSystem(TransRefrigSysNum).CaseNumMT({1, NumCasesMT}) =
    5790           2 :                             CaseAndWalkInList(CaseAndWalkInListNum).CaseItemNum({1, NumCasesMT});
    5791             :                     }
    5792           1 :                     if (NumWalkInsMT > 0) {
    5793           0 :                         if (!allocated(TransSystem(TransRefrigSysNum).WalkInNumMT)) TransSystem(TransRefrigSysNum).WalkInNumMT.allocate(NumWalkInsMT);
    5794           0 :                         TransSystem(TransRefrigSysNum).WalkInNumMT({1, NumWalkInsMT}) =
    5795           0 :                             CaseAndWalkInList(CaseAndWalkInListNum).WalkInItemNum({1, NumWalkInsMT});
    5796             :                     }
    5797           0 :                 } else if (CaseNum != 0) { // Name points to a case
    5798           0 :                     NumCasesMT = 1;
    5799           0 :                     TransSystem(TransRefrigSysNum).NumCasesMT = 1;
    5800           0 :                     if (!allocated(TransSystem(TransRefrigSysNum).CaseNumMT)) TransSystem(TransRefrigSysNum).CaseNumMT.allocate(NumCasesMT);
    5801           0 :                     TransSystem(TransRefrigSysNum).CaseNumMT(NumCases) = CaseNum;
    5802           0 :                 } else if (WalkInNum != 0) { // Name points to a walkin
    5803           0 :                     NumWalkInsMT = 1;
    5804           0 :                     TransSystem(TransRefrigSysNum).NumWalkInsMT = 1;
    5805           0 :                     if (!allocated(TransSystem(TransRefrigSysNum).WalkInNumMT)) TransSystem(TransRefrigSysNum).WalkInNumMT.allocate(NumWalkInsMT);
    5806           0 :                     TransSystem(TransRefrigSysNum).WalkInNumMT(NumWalkIns) = WalkInNum;
    5807             :                 } // NumNameMatches /= 1
    5808             :             }     // blank input for cases, walkins, or caseandwalkinlist
    5809             : 
    5810           1 :             if (NumCasesMT > 0) {
    5811             :                 // Find lowest design evap T
    5812             :                 // Sum rated capacity of all MT cases on system
    5813           4 :                 for (int caseIndex = 1; caseIndex <= NumCasesMT; ++caseIndex) {
    5814             :                     // mark all cases on system as used by this system - checking for unused or non-unique cases
    5815           3 :                     int CaseNum = TransSystem(TransRefrigSysNum).CaseNumMT(caseIndex);
    5816           3 :                     ++RefrigCase(CaseNum).NumSysAttach;
    5817           3 :                     NominalTotalCaseCapMT += RefrigCase(CaseNum).DesignRatedCap;
    5818           3 :                     TransSystem(TransRefrigSysNum).RefInventory += RefrigCase(CaseNum).DesignRefrigInventory;
    5819           3 :                     if (caseIndex == 1) { // look for lowest case design evap T for system
    5820           1 :                         TransSystem(TransRefrigSysNum).TEvapDesignMT = RefrigCase(CaseNum).EvapTempDesign;
    5821             :                     } else {
    5822           2 :                         TransSystem(TransRefrigSysNum).TEvapDesignMT =
    5823           2 :                             min(RefrigCase(CaseNum).EvapTempDesign, TransSystem(TransRefrigSysNum).TEvapDesignMT);
    5824             :                     }
    5825             :                 } // CaseIndex=1,NumCases
    5826             :             }     // NumcasesMT > 0
    5827             : 
    5828           1 :             if (NumWalkInsMT > 0) {
    5829           0 :                 for (int WalkInIndex = 1; WalkInIndex <= NumWalkInsMT; ++WalkInIndex) {
    5830           0 :                     int WalkInID = TransSystem(TransRefrigSysNum).WalkInNumMT(WalkInIndex);
    5831             :                     // mark all WalkIns on rack as used by this system (checking for unused or non-unique WalkIns)
    5832           0 :                     ++WalkIn(WalkInID).NumSysAttach;
    5833           0 :                     NominalTotalWalkInCapMT += WalkIn(WalkInID).DesignRatedCap;
    5834           0 :                     TransSystem(TransRefrigSysNum).RefInventory += WalkIn(WalkInID).DesignRefrigInventory;
    5835             :                     // Defrost capacity is treated differently by compressor racks and detailed systems,
    5836             :                     //  so this value may be adjusted (or warnings issued) after the walkin is assigned
    5837             :                     //  to either the rack or system.
    5838             :                     // for walkins served by detailed system, need capacity for both fluid and electric types.
    5839           0 :                     if (WalkIn(WalkInID).DefrostCapacity <= -98.0) {
    5840             :                         // - 99 used as a flag for blank input error message for detailed systems
    5841           0 :                         ShowSevereError(state,
    5842           0 :                                         std::string{RoutineName} + "Refrigeration:WalkIn=\"" + WalkIn(WalkInID).Name +
    5843             :                                             "\", Defrost capacity must be greater than or equal to 0 W for electric and hotfluid defrost types");
    5844           0 :                         ErrorsFound = true;
    5845             :                     }
    5846             :                     // Find design evaporating temperature for system by getting min design evap for ALL loads
    5847           0 :                     if ((WalkInIndex == 1) && (TransSystem(TransRefrigSysNum).NumCasesMT == 0)) {
    5848             :                         // note use walk in index, not walkinid here to get
    5849             :                         // first walkin on this suction group/system
    5850           0 :                         TransSystem(TransRefrigSysNum).TEvapDesignMT = WalkIn(WalkInID).TEvapDesign;
    5851             :                     } else {
    5852           0 :                         TransSystem(TransRefrigSysNum).TEvapDesignMT =
    5853           0 :                             min(WalkIn(WalkInID).TEvapDesign, TransSystem(TransRefrigSysNum).TEvapDesignMT);
    5854             :                     }
    5855             :                 } // WalkInIndex=1,NumWalkIns
    5856             :             }     // NumWalkInsMT > 0
    5857             : 
    5858             :             //   Check for Low Temperature Case or Walk-In or CaseAndWalkInList names
    5859           1 :             AlphaNum = 4;
    5860           1 :             if (!lAlphaBlanks(AlphaNum)) {
    5861             : 
    5862             :                 // Entry for Alphas(AlphaNum) can be either a Case, WalkIn or CaseAndWalkInList name
    5863           1 :                 int CaseAndWalkInListNum = 0;
    5864           1 :                 int CaseNum = 0;
    5865           1 :                 int WalkInNum = 0;
    5866           1 :                 if (state.dataRefrigCase->NumSimulationCaseAndWalkInLists > 0)
    5867           1 :                     CaseAndWalkInListNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), CaseAndWalkInList);
    5868           1 :                 if (state.dataRefrigCase->NumSimulationCases > 0) CaseNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), RefrigCase);
    5869           1 :                 if (state.dataRefrigCase->NumSimulationWalkIns > 0) WalkInNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), WalkIn);
    5870           1 :                 int NumNameMatches = 0;
    5871           1 :                 if (CaseAndWalkInListNum != 0) ++NumNameMatches;
    5872           1 :                 if (CaseNum != 0) ++NumNameMatches;
    5873           1 :                 if (WalkInNum != 0) ++NumNameMatches;
    5874             : 
    5875           1 :                 if (NumNameMatches != 1) { // name must uniquely point to a list or a single case or walkin or coil
    5876           0 :                     ErrorsFound = true;
    5877           0 :                     if (NumNameMatches == 0) {
    5878           0 :                         ShowSevereError(state,
    5879           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + TransSystem(TransRefrigSysNum).Name +
    5880           0 :                                             "\", has an invalid " + cAlphaFieldNames(AlphaNum) + ": " + Alphas(AlphaNum));
    5881           0 :                     } else if (NumNameMatches > 1) {
    5882           0 :                         ShowSevereError(state,
    5883           0 :                                         std::string{RoutineName} + CurrentModuleObject + "=\"" + TransSystem(TransRefrigSysNum).Name +
    5884           0 :                                             "\",  has a non-unique name that could be either a " + cAlphaFieldNames(AlphaNum) + ": " +
    5885           0 :                                             Alphas(AlphaNum));
    5886             :                     }                                   // num matches = 0 or > 1
    5887           1 :                 } else if (CaseAndWalkInListNum != 0) { // Name points to a CaseAndWalkInList
    5888           1 :                     NumCasesLT = CaseAndWalkInList(CaseAndWalkInListNum).NumCases;
    5889           1 :                     NumWalkInsLT = CaseAndWalkInList(CaseAndWalkInListNum).NumWalkIns;
    5890           1 :                     TransSystem(TransRefrigSysNum).NumCasesLT = NumCasesLT;
    5891           1 :                     TransSystem(TransRefrigSysNum).NumWalkInsLT = NumWalkInsLT;
    5892           1 :                     if (NumCasesLT > 0) {
    5893           1 :                         if (!allocated(TransSystem(TransRefrigSysNum).CaseNumLT)) TransSystem(TransRefrigSysNum).CaseNumLT.allocate(NumCasesLT);
    5894           1 :                         TransSystem(TransRefrigSysNum).CaseNumLT({1, NumCasesLT}) =
    5895           2 :                             CaseAndWalkInList(CaseAndWalkInListNum).CaseItemNum({1, NumCasesLT});
    5896             :                     }
    5897           1 :                     if (NumWalkInsLT > 0) {
    5898           1 :                         if (!allocated(TransSystem(TransRefrigSysNum).WalkInNumLT)) TransSystem(TransRefrigSysNum).WalkInNumLT.allocate(NumWalkInsLT);
    5899           1 :                         TransSystem(TransRefrigSysNum).WalkInNumLT({1, NumWalkInsLT}) =
    5900           2 :                             CaseAndWalkInList(CaseAndWalkInListNum).WalkInItemNum({1, NumWalkInsLT});
    5901             :                     }
    5902           0 :                 } else if (CaseNum != 0) { // Name points to a case
    5903           0 :                     NumCasesLT = 1;
    5904           0 :                     TransSystem(TransRefrigSysNum).NumCasesLT = 1;
    5905           0 :                     if (!allocated(TransSystem(TransRefrigSysNum).CaseNumLT)) TransSystem(TransRefrigSysNum).CaseNumLT.allocate(NumCasesLT);
    5906           0 :                     TransSystem(TransRefrigSysNum).CaseNumLT(NumCases) = CaseNum;
    5907           0 :                 } else if (WalkInNum != 0) { // Name points to a walkin
    5908           0 :                     NumWalkInsLT = 1;
    5909           0 :                     TransSystem(TransRefrigSysNum).NumWalkInsLT = 1;
    5910           0 :                     if (!allocated(TransSystem(TransRefrigSysNum).WalkInNumLT)) TransSystem(TransRefrigSysNum).WalkInNumLT.allocate(NumWalkInsLT);
    5911           0 :                     TransSystem(TransRefrigSysNum).WalkInNumLT(NumWalkIns) = WalkInNum;
    5912             :                 } // NumNameMatches /= 1
    5913             :             }     // blank input for cases, walkins, or caseandwalkinlist
    5914             : 
    5915           1 :             if (NumCasesLT > 0) {
    5916             :                 // Find lowest design evap T
    5917             :                 // Sum rated capacity of all LT cases on system
    5918           5 :                 for (int caseIndex = 1; caseIndex <= NumCasesLT; ++caseIndex) {
    5919             :                     // mark all cases on system as used by this system - checking for unused or non-unique cases
    5920           4 :                     int CaseNum = TransSystem(TransRefrigSysNum).CaseNumLT(caseIndex);
    5921           4 :                     ++RefrigCase(CaseNum).NumSysAttach;
    5922           4 :                     NominalTotalCaseCapLT += RefrigCase(CaseNum).DesignRatedCap;
    5923           4 :                     TransSystem(TransRefrigSysNum).RefInventory += RefrigCase(CaseNum).DesignRefrigInventory;
    5924           4 :                     if (caseIndex == 1) { // look for lowest case design evap T for system
    5925           1 :                         TransSystem(TransRefrigSysNum).TEvapDesignLT = RefrigCase(CaseNum).EvapTempDesign;
    5926             :                     } else {
    5927           3 :                         TransSystem(TransRefrigSysNum).TEvapDesignLT =
    5928           3 :                             min(RefrigCase(CaseNum).EvapTempDesign, TransSystem(TransRefrigSysNum).TEvapDesignLT);
    5929             :                     }
    5930             :                 } // CaseIndex=1,NumCases
    5931             :             }     // NumcasesLT > 0
    5932             : 
    5933           1 :             if (NumWalkInsLT > 0) {
    5934           2 :                 for (int WalkInIndex = 1; WalkInIndex <= NumWalkInsLT; ++WalkInIndex) {
    5935           1 :                     int WalkInID = TransSystem(TransRefrigSysNum).WalkInNumLT(WalkInIndex);
    5936             :                     // mark all WalkIns on rack as used by this system (checking for unused or non-unique WalkIns)
    5937           1 :                     ++WalkIn(WalkInID).NumSysAttach;
    5938           1 :                     NominalTotalWalkInCapLT += WalkIn(WalkInID).DesignRatedCap;
    5939           1 :                     TransSystem(TransRefrigSysNum).RefInventory += WalkIn(WalkInID).DesignRefrigInventory;
    5940             :                     // Defrost capacity is treated differently by compressor racks and detailed systems,
    5941             :                     //  so this value may be adjusted (or warnings issued) after the walkin is assigned
    5942             :                     //  to either the rack or system.
    5943             :                     // for walkins served by detailed system, need capacity for both fluid and electric types.
    5944           1 :                     if (WalkIn(WalkInID).DefrostCapacity <= -98.0) {
    5945             :                         // - 99 used as a flag for blank input error message for detailed systems
    5946           0 :                         ShowSevereError(state,
    5947           0 :                                         std::string{RoutineName} + "Refrigeration:WalkIn=\"" + WalkIn(WalkInID).Name +
    5948             :                                             "\", Defrost capacity must be greater than or equal to 0 W for electric and hotfluid defrost types");
    5949           0 :                         ErrorsFound = true;
    5950             :                     }
    5951             :                     // Find design evaporating temperature for system by getting min design evap for ALL loads
    5952           1 :                     if ((WalkInIndex == 1) && (TransSystem(TransRefrigSysNum).NumCasesLT == 0)) {
    5953             :                         // note use walk in index, not walkinid here to get
    5954             :                         // first walkin on this suction group/system
    5955           0 :                         TransSystem(TransRefrigSysNum).TEvapDesignLT = WalkIn(WalkInID).TEvapDesign;
    5956             :                     } else {
    5957           1 :                         TransSystem(TransRefrigSysNum).TEvapDesignLT =
    5958           1 :                             min(WalkIn(WalkInID).TEvapDesign, TransSystem(TransRefrigSysNum).TEvapDesignLT);
    5959             :                     }
    5960             :                 } // WalkInIndex=1,NumWalkIns
    5961             :             }     // NumWalkInsMT > 0
    5962             : 
    5963           1 :             NominalTotalCoolingCap = NominalTotalCaseCapMT + NominalTotalCaseCapLT + NominalTotalWalkInCapMT + NominalTotalWalkInCapLT;
    5964             : 
    5965             :             // Read Gas Cooler
    5966             :             // currently assumes one gas cooler per refrigeration system and but multiple systems allowed per gas cooler
    5967           1 :             AlphaNum = 5;
    5968           1 :             int NumGasCoolers = 1;
    5969           1 :             if (!allocated(TransSystem(TransRefrigSysNum).GasCoolerNum)) TransSystem(TransRefrigSysNum).GasCoolerNum.allocate(NumGasCoolers);
    5970           1 :             TransSystem(TransRefrigSysNum).NumGasCoolers = 1;
    5971             :             // Find gascooler number
    5972           1 :             int GCNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), GasCooler);
    5973             : 
    5974           1 :             if (GCNum == 0) { //  Invalid Gas Cooler attached to Transcritical Refrigeration System
    5975           0 :                 ShowSevereError(state,
    5976           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + TransSystem(TransRefrigSysNum).Name + "\", has an invalid " +
    5977           0 :                                     cAlphaFieldNames(AlphaNum) + " defined as \"" + Alphas(AlphaNum) + "\".");
    5978           0 :                 ErrorsFound = true;
    5979           1 :             } else if (GCNum != 0) { //  Gas Cooler attached to Transcritical Refrigeration System
    5980           1 :                 TransSystem(TransRefrigSysNum).GasCoolerNum(NumGasCoolers) = GCNum;
    5981           1 :                 TransSystem(TransRefrigSysNum).NumGasCoolers = 1;
    5982             :                 // Now take care of case where multiple systems share a gas cooler
    5983           1 :                 ++GasCooler(GCNum).NumSysAttach;
    5984           1 :                 GasCooler(GCNum).SysNum(GasCooler(GCNum).NumSysAttach) = TransRefrigSysNum;
    5985           1 :                 TransSystem(TransRefrigSysNum).RefInventory +=
    5986           1 :                     GasCooler(GCNum).RefReceiverInventory + GasCooler(GCNum).RefPipingInventory + GasCooler(GCNum).RefOpCharge;
    5987           1 :                 if (GasCooler(GCNum).GasCoolerRejectHeatToZone) TransSystem(TransRefrigSysNum).SystemRejectHeatToZone = true;
    5988             :             }
    5989             : 
    5990             :             // Read High Pressure Compressor
    5991           1 :             AlphaNum = 6;
    5992           1 :             int NumCompressorsSys = 0;
    5993           1 :             if (lAlphaBlanks(AlphaNum)) {
    5994             :                 // blank input where must have compressor or compressor list input.
    5995           0 :                 ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + ' ' + cAlphaFieldNames(AlphaNum) + "\" : must be input.");
    5996           0 :                 ErrorsFound = true;
    5997             :             } else { //     Entry for Alphas(AlphaNum) can be either a compressor name or a compressorlist name
    5998           1 :                 int ListNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), CompressorLists);
    5999           1 :                 int CompNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), Compressor);
    6000           1 :                 if ((ListNum == 0) && (CompNum == 0)) { // name doesn't match either a compressor or a compressor list
    6001           0 :                     ShowSevereError(state,
    6002           0 :                                     std::string{RoutineName} + CurrentModuleObject + ", \"" + cAlphaFieldNames(AlphaNum) +
    6003           0 :                                         "\", has an invalid or undefined value=\"" + Alphas(AlphaNum) + "\".");
    6004           0 :                     ErrorsFound = true;
    6005           1 :                 } else if ((ListNum != 0) && (CompNum != 0)) { // have compressor list and compressor with same name
    6006           0 :                     ShowSevereError(state,
    6007           0 :                                     std::string{RoutineName} + CurrentModuleObject + ' ' + cAlphaFieldNames(AlphaNum) +
    6008           0 :                                         ", has a non-unique name used for both Compressor and CompressorList name: \"" + Alphas(AlphaNum) + "\".");
    6009           0 :                     ErrorsFound = true;
    6010           1 :                 } else if (ListNum != 0) {
    6011           1 :                     NumCompressorsSys = CompressorLists(ListNum).NumCompressors;
    6012           1 :                     TransSystem(TransRefrigSysNum).NumCompressorsHP = NumCompressorsSys;
    6013           1 :                     if (!allocated(TransSystem(TransRefrigSysNum).CompressorNumHP))
    6014           1 :                         TransSystem(TransRefrigSysNum).CompressorNumHP.allocate(NumCompressorsSys);
    6015           1 :                     TransSystem(TransRefrigSysNum).CompressorNumHP({1, NumCompressorsSys}) =
    6016           2 :                         CompressorLists(ListNum).CompItemNum({1, NumCompressorsSys});
    6017           0 :                 } else if (CompNum != 0) {
    6018           0 :                     NumCompressorsSys = 1;
    6019           0 :                     TransSystem(TransRefrigSysNum).NumCompressorsHP = 1;
    6020           0 :                     if (!allocated(TransSystem(TransRefrigSysNum).CompressorNumHP))
    6021           0 :                         TransSystem(TransRefrigSysNum).CompressorNumHP.allocate(NumCompressorsSys);
    6022           0 :                     TransSystem(TransRefrigSysNum).CompressorNumHP(NumCompressorsSys) = CompNum;
    6023             :                 }
    6024             :                 // Sum rated capacity of all HP compressors on system
    6025           1 :                 NominalTotalCompCapHP = 0.0;
    6026           4 :                 for (int CompIndex = 1; CompIndex <= NumCompressorsSys; ++CompIndex) {
    6027           3 :                     CompNum = TransSystem(TransRefrigSysNum).CompressorNumHP(CompIndex);
    6028             : 
    6029           3 :                     if (Compressor(CompNum).TransFlag) { //  Calculate nominal capacity of transcritical Compressor
    6030             :                         Real64 GCOutletH =
    6031           9 :                             FluidProperties::GetSupHeatEnthalpyRefrig(state,
    6032           3 :                                                                       TransSystem(TransRefrigSysNum).RefrigerantName,
    6033           3 :                                                                       GasCooler(TransSystem(TransRefrigSysNum).GasCoolerNum(1)).RatedOutletT,
    6034           3 :                                                                       GasCooler(TransSystem(TransRefrigSysNum).GasCoolerNum(1)).RatedOutletP,
    6035             :                                                                       RefrigIndex,
    6036           3 :                                                                       RoutineNameNoColon);
    6037           9 :                         Compressor(CompNum).NomCap = Curve::CurveValue(
    6038           6 :                             state, Compressor(CompNum).TransCapacityCurvePtr, TransSystem(TransRefrigSysNum).TEvapDesignMT, GCOutletH);
    6039           3 :                         NominalTotalCompCapHP += Compressor(CompNum).NomCap;
    6040           3 :                         ++Compressor(CompNum).NumSysAttach;
    6041             :                     } else { //  Subcritical compressor attached to transcritical system - show error
    6042           0 :                         ShowSevereError(state,
    6043           0 :                                         std::string{RoutineName} + CurrentModuleObject +
    6044           0 :                                             ", No transcritical CO2 compressors are attached to the transcritical refrigeration system, \"" +
    6045           0 :                                             TransSystem(TransRefrigSysNum).Name + "\".");
    6046           0 :                         ErrorsFound = true;
    6047             :                     }
    6048             :                 }
    6049             :             }
    6050             : 
    6051             :             // Read Low Pressure Compressor
    6052           1 :             AlphaNum = 7;
    6053           1 :             NumCompressorsSys = 0;
    6054             : 
    6055           1 :             if ((lAlphaBlanks(AlphaNum)) && (TransSystem(TransRefrigSysNum).TransSysType == 2)) {
    6056             :                 // TwoStage system type is specified but low pressure compressor input is blank
    6057           0 :                 ShowSevereError(state,
    6058           0 :                                 std::string{RoutineName} + CurrentModuleObject + ", The transcritical refrigeration system, \"" +
    6059           0 :                                     TransSystem(TransRefrigSysNum).Name + R"(", is specified to be "TwoStage", however, the ")" +
    6060           0 :                                     cAlphaFieldNames(AlphaNum) + "\" is not given.");
    6061           0 :                 ErrorsFound = true;
    6062           1 :             } else if ((!(lAlphaBlanks(AlphaNum))) && (TransSystem(TransRefrigSysNum).TransSysType == 1)) {
    6063             :                 // SingleStage system type with low pressure compressors specified. Ignore low pressure compressors
    6064           0 :                 ShowWarningError(state,
    6065           0 :                                  std::string{RoutineName} + CurrentModuleObject + ", The transcritical refrigeration system, \"" +
    6066           0 :                                      TransSystem(TransRefrigSysNum).Name + R"(", is specified to be \"SingleStage", however, a")" +
    6067           0 :                                      cAlphaFieldNames(AlphaNum) +
    6068             :                                      "\" was found.  The low pressure compressors will be ignored and will not simulated.");
    6069           1 :             } else if ((!(lAlphaBlanks(AlphaNum))) && (TransSystem(TransRefrigSysNum).TransSysType == 2)) {
    6070             :                 // TwoStage system with low pressure compressors specified
    6071           1 :                 int ListNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), CompressorLists);
    6072           1 :                 int CompNum = UtilityRoutines::FindItemInList(Alphas(AlphaNum), Compressor);
    6073           1 :                 if ((ListNum == 0) && (CompNum == 0)) { // name doesn't match either a compressor or a compressor list
    6074           0 :                     ShowSevereError(state,
    6075           0 :                                     std::string{RoutineName} + CurrentModuleObject + ", \"" + cAlphaFieldNames(AlphaNum) +
    6076           0 :                                         "\", has an invalid or undefined value=\"" + Alphas(AlphaNum) + "\".");
    6077           0 :                     ErrorsFound = true;
    6078           1 :                 } else if ((ListNum != 0) && (CompNum != 0)) { // have compressor list and compressor with same name
    6079           0 :                     ShowSevereError(state,
    6080           0 :                                     std::string{RoutineName} + CurrentModuleObject + ' ' + cAlphaFieldNames(AlphaNum) +
    6081           0 :                                         ", has a non-unique name used for both Compressor and CompressorList name: \"" + Alphas(AlphaNum) + "\".");
    6082           0 :                     ErrorsFound = true;
    6083           1 :                 } else if (ListNum != 0) {
    6084           1 :                     NumCompressorsSys = CompressorLists(ListNum).NumCompressors;
    6085           1 :                     TransSystem(TransRefrigSysNum).NumCompressorsLP = NumCompressorsSys;
    6086           1 :                     if (!allocated(TransSystem(TransRefrigSysNum).CompressorNumLP))
    6087           1 :                         TransSystem(TransRefrigSysNum).CompressorNumLP.allocate(NumCompressorsSys);
    6088           1 :                     TransSystem(TransRefrigSysNum).CompressorNumLP({1, NumCompressorsSys}) =
    6089           2 :                         CompressorLists(ListNum).CompItemNum({1, NumCompressorsSys});
    6090           0 :                 } else if (CompNum != 0) {
    6091           0 :                     NumCompressorsSys = 1;
    6092           0 :                     TransSystem(TransRefrigSysNum).NumCompressorsLP = 1;
    6093           0 :                     if (!allocated(TransSystem(TransRefrigSysNum).CompressorNumLP))
    6094           0 :                         TransSystem(TransRefrigSysNum).CompressorNumLP.allocate(NumCompressorsSys);
    6095           0 :                     TransSystem(TransRefrigSysNum).CompressorNumLP(NumCompressorsSys) = CompNum;
    6096             :                 }
    6097             :                 // Sum rated capacity of all LP compressors on system
    6098           1 :                 NominalTotalCompCapLP = 0.0;
    6099           4 :                 for (int CompIndex = 1; CompIndex <= NumCompressorsSys; ++CompIndex) {
    6100           3 :                     CompNum = TransSystem(TransRefrigSysNum).CompressorNumLP(CompIndex);
    6101           3 :                     if (TransSystem(TransRefrigSysNum).TransSysType == 2) { //  Calculate capacity of LP compressors
    6102          12 :                         Compressor(CompNum).NomCap = Curve::CurveValue(state,
    6103           3 :                                                                        Compressor(CompNum).CapacityCurvePtr,
    6104           3 :                                                                        TransSystem(TransRefrigSysNum).TEvapDesignLT,
    6105           3 :                                                                        TransSystem(TransRefrigSysNum).TEvapDesignMT);
    6106           3 :                         NominalTotalCompCapLP += Compressor(CompNum).NomCap;
    6107           3 :                         ++Compressor(CompNum).NumSysAttach;
    6108             :                     }
    6109             :                 }
    6110             :             }
    6111             : 
    6112             :             // Read Receiver Pressure
    6113           1 :             if (!lNumericBlanks(1)) {
    6114           1 :                 TransSystem(TransRefrigSysNum).PReceiver = Numbers(1);
    6115             :             } else { // Default value receiver pressure = 4000000 Pa
    6116           0 :                 TransSystem(TransRefrigSysNum).PReceiver = 4.0e6;
    6117             :             }
    6118             : 
    6119             :             // Check receiver temperature against minimum condensing temperature (from gas cooler input) and design evaporator temperatures
    6120           2 :             TransSystem(TransRefrigSysNum).TReceiver = FluidProperties::GetSatTemperatureRefrig(
    6121           2 :                 state, TransSystem(TransRefrigSysNum).RefrigerantName, TransSystem(TransRefrigSysNum).PReceiver, RefrigIndex, RoutineNameNoColon);
    6122           1 :             if (TransSystem(TransRefrigSysNum).TReceiver > GasCooler(TransSystem(TransRefrigSysNum).GasCoolerNum(NumGasCoolers)).MinCondTemp) {
    6123           0 :                 ShowWarningError(state,
    6124           0 :                                  format("{}{}=\"{}: The receiver temperature ({:.2R}C) is greater than the minimum condensing temperature "
    6125             :                                         "specified for subcritical operation ({:.2R}C).",
    6126             :                                         RoutineName,
    6127             :                                         CurrentModuleObject,
    6128           0 :                                         TransSystem(TransRefrigSysNum).Name,
    6129           0 :                                         TransSystem(TransRefrigSysNum).TReceiver,
    6130           0 :                                         GasCooler(TransSystem(TransRefrigSysNum).GasCoolerNum(NumGasCoolers)).MinCondTemp));
    6131           0 :                 ShowContinueError(state, "  The minimum condensing temperature will be set at 5C greater than the receiver temperature.");
    6132           0 :                 GasCooler(TransSystem(TransRefrigSysNum).GasCoolerNum(NumGasCoolers)).MinCondTemp = TransSystem(TransRefrigSysNum).TReceiver + 5.0;
    6133             :             }
    6134           1 :             if (NominalTotalCompCapLP > 0.0) {
    6135           1 :                 if (TransSystem(TransRefrigSysNum).TReceiver <= TransSystem(TransRefrigSysNum).TEvapDesignLT) {
    6136           0 :                     ShowSevereError(state,
    6137           0 :                                     format("{}{}=\"{}: The receiver temperature ({:.2R}C) is less than the design evaporator temperature for the "
    6138             :                                            "low temperature loads ({:.2R}C).",
    6139             :                                            RoutineName,
    6140             :                                            CurrentModuleObject,
    6141           0 :                                            TransSystem(TransRefrigSysNum).Name,
    6142           0 :                                            TransSystem(TransRefrigSysNum).TReceiver,
    6143           0 :                                            TransSystem(TransRefrigSysNum).TEvapDesignLT));
    6144           0 :                     ShowContinueError(state,
    6145             :                                       "  Ensure that the receiver temperature is sufficiently greater than the design evaporator temperature for "
    6146             :                                       "the low temperature loads.");
    6147           0 :                     ShowContinueError(state,
    6148             :                                       "  A receiver pressure between 3.0 MPa to 4.0 MPa will typically result in an adequate receiver temperature.");
    6149           0 :                     ErrorsFound = true;
    6150             :                 }
    6151             :             }
    6152           1 :             if (NominalTotalCompCapHP > 0.0) {
    6153           1 :                 if (TransSystem(TransRefrigSysNum).TReceiver <= TransSystem(TransRefrigSysNum).TEvapDesignMT) {
    6154           0 :                     ShowSevereError(state,
    6155           0 :                                     format("{}{}=\"{}: The receiver temperature ({:.2R}C) is less than the design evaporator temperature for the "
    6156             :                                            "medium temperature loads ({:.2R}C).",
    6157             :                                            RoutineName,
    6158             :                                            CurrentModuleObject,
    6159           0 :                                            TransSystem(TransRefrigSysNum).Name,
    6160           0 :                                            TransSystem(TransRefrigSysNum).TReceiver,
    6161           0 :                                            TransSystem(TransRefrigSysNum).TEvapDesignMT));
    6162           0 :                     ShowContinueError(state,
    6163             :                                       "  Ensure that the receiver temperature is sufficiently greater than the design evaporator temperature for "
    6164             :                                       "the medium temperature loads.");
    6165           0 :                     ShowContinueError(state,
    6166             :                                       "  A receiver pressure between 3.0 MPa to 4.0 MPa will typically result in an adequate receiver temperature.");
    6167           0 :                     ErrorsFound = true;
    6168             :                 }
    6169             :             }
    6170             : 
    6171             :             // Read subcooler effectiveness
    6172           1 :             if (!lNumericBlanks(2)) {
    6173           1 :                 TransSystem(TransRefrigSysNum).SCEffectiveness = Numbers(2);
    6174             :             } else { // Default value effectiveness = 0.4
    6175           0 :                 TransSystem(TransRefrigSysNum).PReceiver = 0.4;
    6176             :             }
    6177             :             // Check subcooler effectiveness value, must be value between 0 and 1
    6178           1 :             if ((TransSystem(TransRefrigSysNum).SCEffectiveness < 0) || (TransSystem(TransRefrigSysNum).SCEffectiveness > 1)) {
    6179           0 :                 ShowSevereError(state,
    6180           0 :                                 std::string{RoutineName} + CurrentModuleObject + "=\"" + TransSystem(TransRefrigSysNum).Name +
    6181             :                                     ": The value for subcooler effectivness is invalid.  The subcooler effectivenss must be a value greater than or "
    6182             :                                     "equal to zero and less than or equal to one.");
    6183           0 :                 ErrorsFound = true;
    6184             :             }
    6185             : 
    6186             :             // Suction piping heat gain - optional
    6187             :             //  Input UA and identify the Zone containing the bulk of the suction piping
    6188             :             //  This Zone ID will be used to determine the temperature used for suction piping heat gain.
    6189             :             //  The pipe heat gains are also counted as cooling credit for the zone.
    6190             :             //  Zone Id is only required if Sum UA Suction Piping >0.0
    6191             :             //  Get the Zone and zone node numbers from the zone name entered by the user
    6192           1 :             AlphaNum = 9; // Medium temperature suction piping
    6193           1 :             TransSystem(TransRefrigSysNum).SumUASuctionPipingMT = 0.0;
    6194           1 :             if (!lNumericBlanks(3) && !lAlphaBlanks(AlphaNum)) {
    6195           0 :                 TransSystem(TransRefrigSysNum).SumUASuctionPipingMT = Numbers(3);
    6196           0 :                 TransSystem(TransRefrigSysNum).SuctionPipeActualZoneNumMT =
    6197           0 :                     UtilityRoutines::FindItemInList(Alphas(AlphaNum), state.dataHeatBal->Zone);
    6198           0 :                 TransSystem(TransRefrigSysNum).SuctionPipeZoneNodeNumMT =
    6199           0 :                     DataZoneEquipment::GetSystemNodeNumberForZone(state, TransSystem(TransRefrigSysNum).SuctionPipeActualZoneNumMT);
    6200           0 :                 if (TransSystem(TransRefrigSysNum).SuctionPipeZoneNodeNumMT == 0) {
    6201           0 :                     ShowSevereError(state,
    6202           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + TransSystem(TransRefrigSysNum).Name +
    6203           0 :                                         "\", System Node Number not found for " + cAlphaFieldNames(AlphaNum) + " = \"" + Alphas(AlphaNum) +
    6204           0 :                                         "\" even though " + cNumericFieldNames(3) + " is greater than zero.");
    6205           0 :                     ShowContinueError(state,
    6206             :                                       "  The medium temperature suction piping heat gain cannot be calculated unless a Zone is defined to "
    6207             :                                       "deterimine the environmental temperature surrounding the piping.");
    6208           0 :                     ErrorsFound = true;
    6209             :                 } else {
    6210           0 :                     state.dataRefrigCase->RefrigPresentInZone(TransSystem(TransRefrigSysNum).SuctionPipeActualZoneNumMT) = true;
    6211             :                 }
    6212           1 :             } else if (!lNumericBlanks(3) && lAlphaBlanks(AlphaNum)) {
    6213           0 :                 ShowWarningError(state,
    6214           0 :                                  std::string{RoutineName} + CurrentModuleObject + "=\"" + TransSystem(TransRefrigSysNum).Name + "\" " +
    6215           0 :                                      cAlphaFieldNames(AlphaNum) + " not found even though " + cNumericFieldNames(3) + " is greater than zero.");
    6216           0 :                 ShowContinueError(state,
    6217             :                                   "  The medium temperature suction piping heat gain will not be calculated unless a Zone is defined to "
    6218             :                                   "determine the environmental temperature surrounding the piping.");
    6219           1 :             } else if (lNumericBlanks(3) && !lAlphaBlanks(AlphaNum)) {
    6220           0 :                 ShowWarningError(state,
    6221           0 :                                  std::string{RoutineName} + CurrentModuleObject + "=\"" + TransSystem(TransRefrigSysNum).Name + "\" " +
    6222           0 :                                      cAlphaFieldNames(AlphaNum) + " will not be used and suction piping heat gain will not be calculated because " +
    6223           0 :                                      cNumericFieldNames(3) + " was blank.");
    6224             :             } // Medium temperature suction piping heat gains
    6225             : 
    6226           1 :             AlphaNum = 10; // Low temperature suction piping
    6227           1 :             TransSystem(TransRefrigSysNum).SumUASuctionPipingLT = 0.0;
    6228           1 :             if (!lNumericBlanks(4) && !lAlphaBlanks(AlphaNum)) {
    6229           0 :                 TransSystem(TransRefrigSysNum).SumUASuctionPipingLT = Numbers(4);
    6230           0 :                 TransSystem(TransRefrigSysNum).SuctionPipeActualZoneNumLT =
    6231           0 :                     UtilityRoutines::FindItemInList(Alphas(AlphaNum), state.dataHeatBal->Zone);
    6232           0 :                 TransSystem(TransRefrigSysNum).SuctionPipeZoneNodeNumLT =
    6233           0 :                     DataZoneEquipment::GetSystemNodeNumberForZone(state, TransSystem(TransRefrigSysNum).SuctionPipeActualZoneNumLT);
    6234           0 :                 if (TransSystem(TransRefrigSysNum).SuctionPipeZoneNodeNumLT == 0) {
    6235           0 :                     ShowSevereError(state,
    6236           0 :                                     std::string{RoutineName} + CurrentModuleObject + "=\"" + TransSystem(TransRefrigSysNum).Name +
    6237           0 :                                         "\", System Node Number not found for " + cAlphaFieldNames(AlphaNum) + " = \"" + Alphas(AlphaNum) +
    6238           0 :                                         "\" even though " + cNumericFieldNames(4) + " is greater than zero.");
    6239           0 :                     ShowContinueError(state,
    6240             :                                       "  The low temperature suction piping heat gain cannot be calculated unless a Zone is defined to "
    6241             :                                       "deterimine the environmental temperature surrounding the piping.");
    6242           0 :                     ErrorsFound = true;
    6243             :                 } else {
    6244           0 :                     state.dataRefrigCase->RefrigPresentInZone(TransSystem(TransRefrigSysNum).SuctionPipeActualZoneNumLT) = true;
    6245             :                 }
    6246           1 :             } else if (!lNumericBlanks(4) && lAlphaBlanks(AlphaNum)) {
    6247           0 :                 ShowWarningError(state,
    6248           0 :                                  std::string{RoutineName} + CurrentModuleObject + "=\"" + TransSystem(TransRefrigSysNum).Name + "\" " +
    6249           0 :                                      cAlphaFieldNames(AlphaNum) + " not found even though " + cNumericFieldNames(4) + " is greater than zero.");
    6250           0 :                 ShowContinueError(state,
    6251             :                                   "  The low temperature suction piping heat gain will not be calculated unless a Zone is defined to determine "
    6252             :                                   "the environmental temperature surrounding the piping.");
    6253           1 :             } else if (lNumericBlanks(4) && !lAlphaBlanks(AlphaNum)) {
    6254           0 :                 ShowWarningError(state,
    6255           0 :                                  std::string{RoutineName} + CurrentModuleObject + "=\"" + TransSystem(TransRefrigSysNum).Name + "\" " +
    6256           0 :                                      cAlphaFieldNames(AlphaNum) + " will not be used and suction piping heat gain will not be calculated because " +
    6257           0 :                                      cNumericFieldNames(4) + " was blank.");
    6258             :             } // Low temperature suction piping heat gains
    6259             : 
    6260           1 :             AlphaNum = 11;
    6261           1 :             if (!lAlphaBlanks(AlphaNum)) TransSystem(TransRefrigSysNum).EndUseSubcategory = Alphas(AlphaNum);
    6262             : 
    6263             :             // Compare the rated capacity of compressor, condenser, and cases.
    6264             :             // Note, rated capacities can be far off from operating capacities, but rough check.
    6265           1 :             Real64 NominalCondCap = GasCooler(TransSystem(TransRefrigSysNum).GasCoolerNum(1)).RatedCapacity;
    6266           1 :             Real64 NominalTotalCompCap = NominalTotalCompCapHP + NominalTotalCompCapLP;
    6267           1 :             if ((NominalTotalCompCap < (0.7 * NominalTotalCoolingCap)) || (NominalCondCap < (1.3 * NominalTotalCoolingCap))) {
    6268           0 :                 ShowWarningError(state,
    6269           0 :                                  CurrentModuleObject + "=\"" + TransSystem(TransRefrigSysNum).Name + "\", You may wish to check the system sizing.");
    6270           0 :                 ShowContinueError(
    6271             :                     state,
    6272           0 :                     format("Total nominal cooling capacity is {:.0R}W. Condenser capacity is {:.0R}W. Nominal compressor capacity is {:.0R}W.",
    6273             :                            NominalTotalCoolingCap,
    6274             :                            NominalCondCap,
    6275           0 :                            NominalTotalCompCap));
    6276             :             }
    6277             : 
    6278             :         } // Transcritical refrigeration systems
    6279             : 
    6280             :     } //(NumTransRefrigSystems > 0)
    6281             : 
    6282         771 :     DayValues.deallocate();
    6283         771 :     Alphas.deallocate();
    6284         771 :     Numbers.deallocate();
    6285         771 :     cAlphaFieldNames.deallocate();
    6286         771 :     cNumericFieldNames.deallocate();
    6287         771 :     lAlphaBlanks.deallocate();
    6288         771 :     lNumericBlanks.deallocate();
    6289             : 
    6290         771 :     if (state.dataRefrigCase->NumSimulationCases > 0) {
    6291             :         // Find unused and non-unique display case objects to report in eio and err file and sum
    6292             :         //    all HVAC RA fractions and write error message if greater than 1 for any zone
    6293         694 :         for (int ZoneIndex = 1; ZoneIndex <= state.dataGlobal->NumOfZones; ++ZoneIndex) { // numofzones from dataglobals
    6294         659 :             Real64 TempRAFraction = CaseRAFraction(ZoneIndex).TotalCaseRAFraction;
    6295        2753 :             for (int CaseNum = 1; CaseNum <= state.dataRefrigCase->NumSimulationCases; ++CaseNum) {
    6296             :                 // TempRaFraction already includes contributions from ALL cases in zone
    6297             :                 // Want to delete portion from unused cases (numsysattach = 0)that will never be simulated
    6298        2094 :                 if (RefrigCase(CaseNum).ActualZoneNum != ZoneIndex || RefrigCase(CaseNum).NumSysAttach > 0) continue;
    6299           0 :                 TempRAFraction -= RefrigCase(CaseNum).RAFrac;
    6300             :             } // NumSimulationCases
    6301         659 :             if (TempRAFraction > 1.0) {
    6302           0 :                 ShowSevereError(state,
    6303           0 :                                 std::string{RoutineName} + ": Refrigeration:Case, Refrigerated case return air fraction for all cases in zone=\"" +
    6304           0 :                                     CaseRAFraction(ZoneIndex).ZoneName + "\" is greater than 1.0.");
    6305             :                 // check in comment, can't use "currentModuleObject" because not in get input subroutine where that is known
    6306           0 :                 ErrorsFound = true;
    6307             :             }
    6308             :         } // ZoneIndex=1,DataGlobals::NumOfZones
    6309             : 
    6310          35 :         CaseRAFraction.deallocate(); // only used for input check just completed
    6311             :         // check for cases not connected to systems and cases connected
    6312             :         // more than once (twice in a system or to more than one system)
    6313             : 
    6314          35 :         state.dataRefrigCase->NumUnusedRefrigCases = 0;
    6315         219 :         for (int CaseNum = 1; CaseNum <= state.dataRefrigCase->NumSimulationCases; ++CaseNum) {
    6316         184 :             if (RefrigCase(CaseNum).NumSysAttach == 1) continue;
    6317           0 :             if (RefrigCase(CaseNum).NumSysAttach < 1) {
    6318           0 :                 ++state.dataRefrigCase->NumUnusedRefrigCases;
    6319           0 :                 if (state.dataGlobal->DisplayExtraWarnings) {
    6320             :                     //  individual case names listed if DataGlobals::DisplayExtraWarnings option selected
    6321           0 :                     ShowWarningError(state, std::string{RoutineName} + ": Refrigeration:Case=\"" + RefrigCase(CaseNum).Name + "\" unused. ");
    6322             :                 } // display extra warnings - give a list of unused cases
    6323             :             }     // unused case
    6324           0 :             if (RefrigCase(CaseNum).NumSysAttach > 1) {
    6325           0 :                 ErrorsFound = true;
    6326           0 :                 ShowSevereError(state,
    6327           0 :                                 std::string{RoutineName} + ": Refrigeration:Case=\"" + RefrigCase(CaseNum).Name +
    6328             :                                     "\", Same refrigerated case name referenced ");
    6329           0 :                 ShowContinueError(state, " by more than one refrigeration system and/or compressor rack.");
    6330             :             } // if looking for same case attached to multiple systems/racks
    6331             :         }     // NumSimulationCases
    6332             : 
    6333          35 :         if ((state.dataRefrigCase->NumUnusedRefrigCases > 0) && (!state.dataGlobal->DisplayExtraWarnings)) {
    6334             :             //  write to error file,
    6335             :             //  summary number of unused cases given if DataGlobals::DisplayExtraWarnings option not selected
    6336           0 :             ShowWarningError(state,
    6337           0 :                              format("Refrigeration:Case -> {} unused refrigerated case(s) found during input processing.",
    6338           0 :                                     state.dataRefrigCase->NumUnusedRefrigCases));
    6339           0 :             ShowContinueError(state, "  These refrigerated cases are in the input file but are not connected to a ");
    6340           0 :             ShowContinueError(state, "  Refrigeration:CompressorRack, Refrigeration:System, or Refrigeration:SecondarySystem object.");
    6341           0 :             ShowContinueError(state, "  These unused refrigeration cases will not be simulated.");
    6342           0 :             ShowContinueError(state, "  Use Output:Diagnostics,DisplayUnusedObjects; to see them. ");
    6343             :         } // NumUnusedRefrigCases
    6344             :     }     // numsimulation cases > 0
    6345             : 
    6346         771 :     if (state.dataRefrigCase->NumSimulationCompressors > 0) {
    6347             :         // check for compressors not connected to systems and compressors connected more than once
    6348             :         // (twice in a system or to more than one system)
    6349          15 :         state.dataRefrigCase->NumUnusedCompressors = 0;
    6350         189 :         for (int CompNum = 1; CompNum <= state.dataRefrigCase->NumSimulationCompressors; ++CompNum) {
    6351         174 :             if (Compressor(CompNum).NumSysAttach == 1) continue;
    6352           0 :             if (Compressor(CompNum).NumSysAttach < 1) {
    6353           0 :                 ++state.dataRefrigCase->NumUnusedCompressors;
    6354           0 :                 if (state.dataGlobal->DisplayExtraWarnings) {
    6355             :                     //  individual compressor names listed if DataGlobals::DisplayExtraWarnings option selected
    6356           0 :                     ShowWarningError(state, std::string{RoutineName} + ": Refrigeration:Compressor=\"" + Compressor(CompNum).Name + "\" unused. ");
    6357             :                 } // display extra warnings - give a list of unused compressors
    6358             :             }     // unused compressor
    6359           0 :             if (Compressor(CompNum).NumSysAttach > 1) {
    6360           0 :                 ErrorsFound = true;
    6361           0 :                 ShowSevereError(state,
    6362           0 :                                 std::string{RoutineName} + ": Refrigeration:Compressor=\"" + Compressor(CompNum).Name +
    6363             :                                     "\", Same refrigeration compressor name referenced");
    6364           0 :                 ShowContinueError(state, " by more than one refrigeration system.");
    6365             :             } // looking for same compressor attached to multiple systems/racks
    6366             :         }     // NumSimulationCompressors
    6367             : 
    6368          15 :         if ((state.dataRefrigCase->NumUnusedCompressors > 0) && (!state.dataGlobal->DisplayExtraWarnings)) {
    6369             :             //  write to error file,
    6370             :             //  summary number of unused compressors given if DataGlobals::DisplayExtraWarnings option not selected
    6371           0 :             ShowWarningError(state,
    6372           0 :                              format("Refrigeration:Compressor -> {} unused refrigeration compressor(s) found during input processing.",
    6373           0 :                                     state.dataRefrigCase->NumUnusedCompressors));
    6374           0 :             ShowContinueError(state,
    6375             :                               "  Those refrigeration compressors are in the input file but are not connected to a Refrigeration:System object.");
    6376           0 :             ShowContinueError(state, "   These unused refrigeration compressors will not be simulated.");
    6377           0 :             ShowContinueError(state, "   Use Output:Diagnostics,DisplayUnusedObjects; to see them. ");
    6378             :         } // NumUnusedCompressors
    6379             :     }     // NumSimulationCompressors > 0
    6380             : 
    6381         771 :     int NumUnusedWalkIns = 0;
    6382         771 :     if (state.dataRefrigCase->NumSimulationWalkIns > 0) {
    6383             :         // check for refrigeration WalkIns not connected to any systems and
    6384             :         //  refrigeration WalkIns connected more than once
    6385          28 :         for (int WalkInNum = 1; WalkInNum <= state.dataRefrigCase->NumSimulationWalkIns; ++WalkInNum) {
    6386          15 :             if (WalkIn(WalkInNum).NumSysAttach == 1) continue;
    6387           0 :             if (WalkIn(WalkInNum).NumSysAttach < 1) {
    6388           0 :                 ++NumUnusedWalkIns;
    6389           0 :                 if (state.dataGlobal->DisplayExtraWarnings) {
    6390             :                     //  individual walkin names listed if DataGlobals::DisplayExtraWarnings option selected
    6391           0 :                     ShowWarningError(state, std::string{RoutineName} + ": Refrigeration:WalkIn=\"" + WalkIn(WalkInNum).Name + "\" unused. ");
    6392             :                 } // display extra warnings - give a list of unused WalkIns
    6393             :             }     // unused walkin
    6394           0 :             if (WalkIn(WalkInNum).NumSysAttach > 1) {
    6395           0 :                 ErrorsFound = true;
    6396           0 :                 ShowSevereError(state,
    6397           0 :                                 std::string{RoutineName} + ": Refrigeration:WalkIn=\"" + WalkIn(WalkInNum).Name +
    6398             :                                     "\", Same Refrigeration WalkIn name referenced");
    6399           0 :                 ShowContinueError(state, " by more than one refrigeration system and/or compressor rack.");
    6400             :             } // if looking for same walk in attached to multiple systems/racks
    6401             :         }     // NumSimulationWalkIns
    6402             : 
    6403          13 :         if ((NumUnusedWalkIns > 0) && (!state.dataGlobal->DisplayExtraWarnings)) {
    6404             :             //  write to error file,
    6405             :             //  summary number of unused walkins given if DataGlobals::DisplayExtraWarnings option not selected
    6406           0 :             ShowWarningError(
    6407             :                 state,
    6408           0 :                 format("{}Refrigeration:WalkIn -> {} unused refrigeration WalkIns found during input processing.", RoutineName, NumUnusedWalkIns));
    6409           0 :             ShowContinueError(state, "   Those refrigeration WalkIns are in the input file but are not connected to a ");
    6410           0 :             ShowContinueError(state, "   Refrigeration:CompressorRack, Refrigeration:System or Refrigeration:SecondarySystem object.");
    6411           0 :             ShowContinueError(state, "   These unused refrigeration WalkIns will not be simulated.");
    6412           0 :             ShowContinueError(state, "   Use Output:Diagnostics,DisplayUnusedObjects; to see them. ");
    6413             :         } // NumUnusedWalkIns
    6414             :     }     // NumSimulationWalkIns > 0
    6415             : 
    6416         771 :     if (state.dataRefrigCase->NumSimulationRefrigAirChillers > 0) {
    6417             :         // check for air chillers not connected to any systems and
    6418             :         //  air chillers connected more than once
    6419           1 :         state.dataRefrigCase->NumUnusedCoils = 0;
    6420          84 :         for (int CoilNum = 1; CoilNum <= state.dataRefrigCase->NumSimulationRefrigAirChillers; ++CoilNum) {
    6421          83 :             if (WarehouseCoil(CoilNum).NumSysAttach == 1) continue;
    6422           0 :             if (WarehouseCoil(CoilNum).NumSysAttach < 1) {
    6423           0 :                 ++NumUnusedWalkIns;
    6424           0 :                 if (state.dataGlobal->DisplayExtraWarnings) {
    6425             :                     //  individual walkin names listed if DataGlobals::DisplayExtraWarnings option selected
    6426           0 :                     ShowWarningError(state, std::string{RoutineName} + ": Refrigeration:AirChiller=\"" + WarehouseCoil(CoilNum).Name + "\" unused. ");
    6427             :                 } // display extra warnings - give a list of unused chillers
    6428             :             }     // unused chiller
    6429           0 :             if (WarehouseCoil(CoilNum).NumSysAttach > 1) {
    6430           0 :                 ErrorsFound = true;
    6431           0 :                 ShowSevereError(state,
    6432           0 :                                 std::string{RoutineName} + ": Refrigeration:AirChiller=\"" + WarehouseCoil(CoilNum).Name +
    6433             :                                     "\", Same Refrigeration Air Chiller name referenced");
    6434           0 :                 ShowContinueError(state, " by more than one refrigeration system and/or compressor rack.");
    6435             :             } // if looking for same walk in attached to multiple systems/racks
    6436             :         }     // NumSimulationRefrigAirchillers
    6437             : 
    6438           1 :         if ((state.dataRefrigCase->NumUnusedCoils > 0) && (!state.dataGlobal->DisplayExtraWarnings)) {
    6439             :             //  write to error file,
    6440             :             //  summary number of unused air chillers given if DataGlobals::DisplayExtraWarnings option not selected
    6441           0 :             ShowWarningError(state,
    6442           0 :                              format("{}Refrigeration:AirChiller -> {} unused refrigeration air chillers found during input processing.",
    6443             :                                     RoutineName,
    6444           0 :                                     state.dataRefrigCase->NumUnusedCoils));
    6445           0 :             ShowContinueError(state, "   Those refrigeration air chillers are in the input file but are not connected to a ");
    6446           0 :             ShowContinueError(state, "   Refrigeration:CompressorRack, Refrigeration:System or Refrigeration:SecondarySystem object.");
    6447           0 :             ShowContinueError(state, "   These unused refrigeration air chillers will not be simulated.");
    6448           0 :             ShowContinueError(state, "   Use Output:Diagnostics,DisplayUnusedObjects; to see them. ");
    6449             :         } // NumUnusedAirChllerss
    6450             :     }     // NumSimulationAirChillers > 0
    6451             : 
    6452         771 :     if (state.dataRefrigCase->NumSimulationSecondarySystems > 0) {
    6453             :         // check for refrigeration Secondarys not connected to detailed systems and
    6454             :         //  refrigeration Secondarys connected more than once
    6455           1 :         state.dataRefrigCase->NumUnusedSecondarys = 0;
    6456           3 :         for (int SecondaryNum = 1; SecondaryNum <= state.dataRefrigCase->NumSimulationSecondarySystems; ++SecondaryNum) {
    6457           2 :             if (Secondary(SecondaryNum).NumSysAttach == 1) continue;
    6458           0 :             if (Secondary(SecondaryNum).NumSysAttach < 1) {
    6459           0 :                 ++state.dataRefrigCase->NumUnusedSecondarys;
    6460           0 :                 if (state.dataGlobal->DisplayExtraWarnings) {
    6461             :                     //  individual secondary names listed if DataGlobals::DisplayExtraWarnings option selected
    6462           0 :                     ShowWarningError(state, std::string{RoutineName} + ": Refrigeration:Secondary=\"" + Secondary(SecondaryNum).Name + "\" unused. ");
    6463             :                 } // display extra warnings - give a list of unused Secondaries
    6464             :             }     // unused secondary
    6465           0 :             if (Secondary(SecondaryNum).NumSysAttach > 1) {
    6466           0 :                 ErrorsFound = true;
    6467           0 :                 ShowSevereError(state,
    6468           0 :                                 std::string{RoutineName} + ": Refrigeration:Secondary=\"" + Secondary(SecondaryNum).Name +
    6469             :                                     "\", Same Refrigeration Secondary name referenced");
    6470           0 :                 ShowContinueError(state, "   by more than one refrigeration system");
    6471             :             } // looking for same secondary loop attached to multiple systems/racks
    6472             :         }     // NumSimulationSecondarys
    6473             : 
    6474           1 :         if ((state.dataRefrigCase->NumUnusedSecondarys > 0) && (!state.dataGlobal->DisplayExtraWarnings)) {
    6475             :             //  write to error file,
    6476             :             //  summary number of unused secondaries given if DataGlobals::DisplayExtraWarnings option not selected
    6477           0 :             ShowWarningError(state,
    6478           0 :                              format("{}Refrigeration:Secondary -> {} unused refrigeration Secondary Loops found during input processing.",
    6479             :                                     RoutineName,
    6480           0 :                                     state.dataRefrigCase->NumUnusedSecondarys));
    6481           0 :             ShowContinueError(state, "  Those refrigeration Secondary Loops are in the input file but are not connected to a refrigeration system.");
    6482           0 :             ShowContinueError(state, "   These unused refrigeration secondaries will not be simulated.");
    6483           0 :             ShowContinueError(state, "   Use Output:Diagnostics,DisplayUnusedObjects; to see them. ");
    6484             :         } // NumUnusedSecondarys
    6485             :     }     // NumSimulationSecondarySystems > 0
    6486             : 
    6487         771 :     if (state.dataRefrigCase->NumRefrigCondensers > 0) {
    6488             :         // Check for presence of shared condensers and for unused condensers
    6489             :         //     - determines number of loops through refrigeration simulation
    6490             :         //       because of dependence of performance on total condenser load
    6491          14 :         state.dataRefrigCase->NumSimulationSharedCondensers = 0;
    6492          14 :         state.dataRefrigCase->NumUnusedCondensers = 0;
    6493          51 :         for (int CondNum = 1; CondNum <= state.dataRefrigCase->NumRefrigCondensers; ++CondNum) {
    6494          37 :             if (Condenser(CondNum).NumSysAttach == 1) continue;
    6495           2 :             if (Condenser(CondNum).NumSysAttach < 1) {
    6496           0 :                 ++state.dataRefrigCase->NumUnusedCondensers;
    6497           0 :                 if (state.dataGlobal->DisplayExtraWarnings) {
    6498             :                     //  individual condenser names listed if DataGlobals::DisplayExtraWarnings option selected
    6499           0 :                     ShowWarningError(state, std::string{RoutineName} + ": Refrigeration:Condenser=\"" + Condenser(CondNum).Name + "\" unused. ");
    6500             :                 } // display extra warnings - give a list of unused condensers
    6501             :             }     // unused condenser
    6502           2 :             if (Condenser(CondNum).NumSysAttach > 1) {
    6503           2 :                 ++state.dataRefrigCase->NumSimulationSharedCondensers;
    6504             :             } // looking for shared condensers
    6505             :         }     // CondNum
    6506             : 
    6507          14 :         if ((state.dataRefrigCase->NumUnusedCondensers > 0) && (!state.dataGlobal->DisplayExtraWarnings)) {
    6508             :             //  write to error file,
    6509             :             //  summary number of unused condensers given if DataGlobals::DisplayExtraWarnings option not selected
    6510           0 :             ShowWarningError(state,
    6511           0 :                              format("{}Refrigeration condenser -> {} unused refrigeration condensers found during input processing.",
    6512             :                                     RoutineName,
    6513           0 :                                     state.dataRefrigCase->NumUnusedCondensers));
    6514           0 :             ShowContinueError(state, "  Those refrigeration condensers are in the input file but are not connected to a refrigeration system.");
    6515           0 :             ShowContinueError(state, "   These unused refrigeration condensers will not be simulated.");
    6516           0 :             ShowContinueError(state, "   Use Output:Diagnostics,DisplayUnusedObjects; to see them. ");
    6517             :         } // NumUnusedCondensers and displayextra warnings
    6518             :     }     // DataHeatBalance::NumRefrigCondensers > 0
    6519             : 
    6520         771 :     if (state.dataRefrigCase->NumSimulationGasCooler > 0) {
    6521             :         // Check for presence of shared gas coolers and for unused gas coolers
    6522           1 :         state.dataRefrigCase->NumSimulationSharedGasCoolers = 0;
    6523           1 :         state.dataRefrigCase->NumUnusedGasCoolers = 0;
    6524           2 :         for (int GCNum = 1; GCNum <= state.dataRefrigCase->NumSimulationGasCooler; ++GCNum) {
    6525           1 :             if (GasCooler(GCNum).NumSysAttach == 1) continue;
    6526           0 :             if (GasCooler(GCNum).NumSysAttach < 1) {
    6527           0 :                 ++state.dataRefrigCase->NumUnusedGasCoolers;
    6528           0 :                 if (state.dataGlobal->DisplayExtraWarnings) {
    6529             :                     //  individual gas cooler names listed if DataGlobals::DisplayExtraWarnings option selected
    6530           0 :                     ShowWarningError(state, std::string{RoutineName} + ": Refrigeration:GasCooler=\"" + GasCooler(GCNum).Name + "\" unused. ");
    6531             :                 } // display extra warnings - give a list of unused gas coolers
    6532             :             }     // unused gas cooler
    6533           0 :             if (GasCooler(GCNum).NumSysAttach > 1) {
    6534           0 :                 ++state.dataRefrigCase->NumSimulationSharedGasCoolers;
    6535             :             } // looking for shared gas coolers
    6536             :         }     // GCNum
    6537             : 
    6538           1 :         if ((state.dataRefrigCase->NumUnusedGasCoolers > 0) && (!state.dataGlobal->DisplayExtraWarnings)) {
    6539             :             //  write to error file,
    6540             :             //  summary number of unused gas coolers given if DataGlobals::DisplayExtraWarnings option not selected
    6541           0 :             ShowWarningError(state,
    6542           0 :                              format("{}Refrigeration gas cooler -> {} unused refrigeration gas cooler(s) found during input processing.",
    6543             :                                     RoutineName,
    6544           0 :                                     state.dataRefrigCase->NumUnusedGasCoolers));
    6545           0 :             ShowContinueError(state, "  These refrigeration gas coolers are in the input file but are not connected to a refrigeration system.");
    6546           0 :             ShowContinueError(state, "  These unused refrigeration gas coolers will not be simulated.");
    6547           0 :             ShowContinueError(state, "  Use Output:Diagnostics,DisplayUnusedObjects; to see them. ");
    6548             :         } // NumUnusedGasCoolers and displayextra warnings
    6549             :     }     // NumSimulationGasCooler > 0
    6550             : 
    6551             :     // echo input to eio file.
    6552         771 :     ReportRefrigerationComponents(state);
    6553             : 
    6554         771 :     if (ErrorsFound) {
    6555           0 :         ShowFatalError(state, std::string{RoutineName} + " Previous errors cause program termination");
    6556             :     }
    6557         771 : }
    6558             : 
    6559         771 : void SetupReportInput(EnergyPlusData &state)
    6560             : {
    6561             :     // SUBROUTINE INFORMATION:
    6562             :     //       AUTHOR         Richard Raustad, FSEC
    6563             :     //       DATE WRITTEN   Oct/Nov 2004
    6564             :     //       MODIFIED       Hudson, ORNL July 2007, Stovall, ORNL, 2008 and 09
    6565             :     //       MODIFIED       Fricke, ORNL, Fall 2011, added transcritical CO2 refrigeration system variables
    6566             :     //       RE-ENGINEERED  na
    6567             : 
    6568             :     // PURPOSE OF THIS SUBROUTINE:
    6569             :     // Set up the report variables.
    6570             : 
    6571         771 :     auto &RefrigCase(state.dataRefrigCase->RefrigCase);
    6572         771 :     auto &RefrigRack(state.dataRefrigCase->RefrigRack);
    6573         771 :     auto &System(state.dataRefrigCase->System);
    6574         771 :     auto &TransSystem(state.dataRefrigCase->TransSystem);
    6575         771 :     auto &Condenser(state.dataRefrigCase->Condenser);
    6576         771 :     auto &Compressor(state.dataRefrigCase->Compressor);
    6577         771 :     auto &GasCooler(state.dataRefrigCase->GasCooler);
    6578         771 :     auto &Subcooler(state.dataRefrigCase->Subcooler);
    6579         771 :     auto &Secondary(state.dataRefrigCase->Secondary);
    6580         771 :     auto &WalkIn(state.dataRefrigCase->WalkIn);
    6581         771 :     auto &WarehouseCoil(state.dataRefrigCase->WarehouseCoil);
    6582         771 :     auto &CoilSysCredit(state.dataRefrigCase->CoilSysCredit);
    6583         771 :     auto &CaseWIZoneReport(state.dataRefrigCase->CaseWIZoneReport);
    6584             : 
    6585        1542 :     std::string Walkin_and_zone_name; // concat name for walk-in/zone credit reporting
    6586             : 
    6587         771 :     if (state.dataRefrigCase->NumSimulationCases > 0) {
    6588             :         // Setup Report Variables for simulated Refrigerated Case (do not report unused cases)
    6589             :         // CurrentModuleObject='Refrigeration:Case'
    6590         219 :         for (int caseNum = 1; caseNum <= state.dataRefrigCase->NumSimulationCases; ++caseNum) {
    6591         184 :             if (RefrigCase(caseNum).NumSysAttach == 1) {
    6592         736 :                 SetupOutputVariable(state,
    6593             :                                     "Refrigeration Case Evaporator Total Cooling Rate",
    6594             :                                     OutputProcessor::Unit::W,
    6595         184 :                                     RefrigCase(caseNum).TotalCoolingLoad,
    6596             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6597             :                                     OutputProcessor::SOVStoreType::Average,
    6598         368 :                                     RefrigCase(caseNum).Name);
    6599         920 :                 SetupOutputVariable(state,
    6600             :                                     "Refrigeration Case Evaporator Total Cooling Energy",
    6601             :                                     OutputProcessor::Unit::J,
    6602         184 :                                     RefrigCase(caseNum).TotalCoolingEnergy,
    6603             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6604             :                                     OutputProcessor::SOVStoreType::Summed,
    6605         184 :                                     RefrigCase(caseNum).Name,
    6606             :                                     _,
    6607             :                                     "ENERGYTRANSFER",
    6608             :                                     "REFRIGERATION",
    6609             :                                     _,
    6610             :                                     "Building",
    6611         368 :                                     RefrigCase(caseNum).ZoneName);
    6612         736 :                 SetupOutputVariable(state,
    6613             :                                     "Refrigeration Case Evaporator Sensible Cooling Rate",
    6614             :                                     OutputProcessor::Unit::W,
    6615         184 :                                     RefrigCase(caseNum).SensCoolingEnergyRate,
    6616             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6617             :                                     OutputProcessor::SOVStoreType::Average,
    6618         368 :                                     RefrigCase(caseNum).Name);
    6619         736 :                 SetupOutputVariable(state,
    6620             :                                     "Refrigeration Case Evaporator Sensible Cooling Energy",
    6621             :                                     OutputProcessor::Unit::J,
    6622         184 :                                     RefrigCase(caseNum).SensCoolingEnergy,
    6623             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6624             :                                     OutputProcessor::SOVStoreType::Summed,
    6625         368 :                                     RefrigCase(caseNum).Name);
    6626         736 :                 SetupOutputVariable(state,
    6627             :                                     "Refrigeration Case Evaporator Latent Cooling Rate",
    6628             :                                     OutputProcessor::Unit::W,
    6629         184 :                                     RefrigCase(caseNum).LatCoolingEnergyRate,
    6630             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6631             :                                     OutputProcessor::SOVStoreType::Average,
    6632         368 :                                     RefrigCase(caseNum).Name);
    6633         736 :                 SetupOutputVariable(state,
    6634             :                                     "Refrigeration Case Evaporator Latent Cooling Energy",
    6635             :                                     OutputProcessor::Unit::J,
    6636         184 :                                     RefrigCase(caseNum).LatCoolingEnergy,
    6637             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6638             :                                     OutputProcessor::SOVStoreType::Summed,
    6639         368 :                                     RefrigCase(caseNum).Name);
    6640             : 
    6641         736 :                 SetupOutputVariable(state,
    6642             :                                     "Refrigeration Case Zone Sensible Cooling Rate",
    6643             :                                     OutputProcessor::Unit::W,
    6644         184 :                                     RefrigCase(caseNum).SensZoneCreditCoolRate,
    6645             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6646             :                                     OutputProcessor::SOVStoreType::Average,
    6647         368 :                                     RefrigCase(caseNum).Name);
    6648         736 :                 SetupOutputVariable(state,
    6649             :                                     "Refrigeration Case Zone Sensible Cooling Energy",
    6650             :                                     OutputProcessor::Unit::J,
    6651         184 :                                     RefrigCase(caseNum).SensZoneCreditCool,
    6652             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6653             :                                     OutputProcessor::SOVStoreType::Summed,
    6654         368 :                                     RefrigCase(caseNum).Name);
    6655         736 :                 SetupOutputVariable(state,
    6656             :                                     "Refrigeration Case Zone Sensible Heating Rate",
    6657             :                                     OutputProcessor::Unit::W,
    6658         184 :                                     RefrigCase(caseNum).SensZoneCreditHeatRate,
    6659             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6660             :                                     OutputProcessor::SOVStoreType::Average,
    6661         368 :                                     RefrigCase(caseNum).Name);
    6662         736 :                 SetupOutputVariable(state,
    6663             :                                     "Refrigeration Case Zone Sensible Heating Energy",
    6664             :                                     OutputProcessor::Unit::J,
    6665         184 :                                     RefrigCase(caseNum).SensZoneCreditHeat,
    6666             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6667             :                                     OutputProcessor::SOVStoreType::Summed,
    6668         368 :                                     RefrigCase(caseNum).Name);
    6669             : 
    6670         736 :                 SetupOutputVariable(state,
    6671             :                                     "Refrigeration Case Zone Latent Rate",
    6672             :                                     OutputProcessor::Unit::W,
    6673         184 :                                     RefrigCase(caseNum).LatZoneCreditRate,
    6674             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6675             :                                     OutputProcessor::SOVStoreType::Average,
    6676         368 :                                     RefrigCase(caseNum).Name);
    6677         736 :                 SetupOutputVariable(state,
    6678             :                                     "Refrigeration Case Zone Latent Energy",
    6679             :                                     OutputProcessor::Unit::J,
    6680         184 :                                     RefrigCase(caseNum).LatZoneCredit,
    6681             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6682             :                                     OutputProcessor::SOVStoreType::Summed,
    6683         368 :                                     RefrigCase(caseNum).Name);
    6684             : 
    6685         736 :                 SetupOutputVariable(state,
    6686             :                                     "Refrigeration Case Return Air Sensible Cooling Rate",
    6687             :                                     OutputProcessor::Unit::W,
    6688         184 :                                     RefrigCase(caseNum).SensHVACCreditCoolRate,
    6689             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6690             :                                     OutputProcessor::SOVStoreType::Average,
    6691         368 :                                     RefrigCase(caseNum).Name);
    6692         736 :                 SetupOutputVariable(state,
    6693             :                                     "Refrigeration Case Return Air Sensible Cooling Energy",
    6694             :                                     OutputProcessor::Unit::J,
    6695         184 :                                     RefrigCase(caseNum).SensHVACCreditCool,
    6696             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6697             :                                     OutputProcessor::SOVStoreType::Summed,
    6698         368 :                                     RefrigCase(caseNum).Name);
    6699         736 :                 SetupOutputVariable(state,
    6700             :                                     "Refrigeration Case Return Air Sensible Heating Rate",
    6701             :                                     OutputProcessor::Unit::W,
    6702         184 :                                     RefrigCase(caseNum).SensHVACCreditHeatRate,
    6703             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6704             :                                     OutputProcessor::SOVStoreType::Average,
    6705         368 :                                     RefrigCase(caseNum).Name);
    6706         736 :                 SetupOutputVariable(state,
    6707             :                                     "Refrigeration Case Return Air Sensible Heating Energy",
    6708             :                                     OutputProcessor::Unit::J,
    6709         184 :                                     RefrigCase(caseNum).SensHVACCreditHeat,
    6710             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6711             :                                     OutputProcessor::SOVStoreType::Summed,
    6712         368 :                                     RefrigCase(caseNum).Name);
    6713             : 
    6714         736 :                 SetupOutputVariable(state,
    6715             :                                     "Refrigeration Case Return Air Latent Rate",
    6716             :                                     OutputProcessor::Unit::W,
    6717         184 :                                     RefrigCase(caseNum).LatHVACCreditRate,
    6718             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6719             :                                     OutputProcessor::SOVStoreType::Average,
    6720         368 :                                     RefrigCase(caseNum).Name);
    6721         736 :                 SetupOutputVariable(state,
    6722             :                                     "Refrigeration Case Return Air Latent Energy",
    6723             :                                     OutputProcessor::Unit::J,
    6724         184 :                                     RefrigCase(caseNum).LatHVACCredit,
    6725             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6726             :                                     OutputProcessor::SOVStoreType::Summed,
    6727         368 :                                     RefrigCase(caseNum).Name);
    6728             : 
    6729         736 :                 SetupOutputVariable(state,
    6730             :                                     "Refrigeration Case Evaporator Fan Electricity Rate",
    6731             :                                     OutputProcessor::Unit::W,
    6732         184 :                                     RefrigCase(caseNum).ElecFanPower,
    6733             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6734             :                                     OutputProcessor::SOVStoreType::Average,
    6735         368 :                                     RefrigCase(caseNum).Name);
    6736         920 :                 SetupOutputVariable(state,
    6737             :                                     "Refrigeration Case Evaporator Fan Electricity Energy",
    6738             :                                     OutputProcessor::Unit::J,
    6739         184 :                                     RefrigCase(caseNum).ElecFanConsumption,
    6740             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6741             :                                     OutputProcessor::SOVStoreType::Summed,
    6742         184 :                                     RefrigCase(caseNum).Name,
    6743             :                                     _,
    6744             :                                     "ELECTRICITY",
    6745             :                                     "REFRIGERATION",
    6746             :                                     "General",
    6747             :                                     "Building",
    6748         368 :                                     RefrigCase(caseNum).ZoneName);
    6749         736 :                 SetupOutputVariable(state,
    6750             :                                     "Refrigeration Case Lighting Electricity Rate",
    6751             :                                     OutputProcessor::Unit::W,
    6752         184 :                                     RefrigCase(caseNum).ElecLightingPower,
    6753             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6754             :                                     OutputProcessor::SOVStoreType::Average,
    6755         368 :                                     RefrigCase(caseNum).Name);
    6756         920 :                 SetupOutputVariable(state,
    6757             :                                     "Refrigeration Case Lighting Electricity Energy",
    6758             :                                     OutputProcessor::Unit::J,
    6759         184 :                                     RefrigCase(caseNum).ElecLightingConsumption,
    6760             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6761             :                                     OutputProcessor::SOVStoreType::Summed,
    6762         184 :                                     RefrigCase(caseNum).Name,
    6763             :                                     _,
    6764             :                                     "ELECTRICITY",
    6765             :                                     "REFRIGERATION",
    6766             :                                     "General",
    6767             :                                     "Building",
    6768         368 :                                     RefrigCase(caseNum).ZoneName);
    6769             : 
    6770             :                 // Report defrost energy curve value only for cases having electric or hot-gas defrost with temperature termination
    6771         350 :                 if (RefrigCase(caseNum).defrostType == RefCaseDefrostType::ElectricTerm ||
    6772         166 :                     RefrigCase(caseNum).defrostType == RefCaseDefrostType::HotFluidTerm) {
    6773         232 :                     SetupOutputVariable(state,
    6774             :                                         "Refrigeration Case Defrost Energy Correction Curve Value",
    6775             :                                         OutputProcessor::Unit::None,
    6776          58 :                                         RefrigCase(caseNum).DefEnergyCurveValue,
    6777             :                                         OutputProcessor::SOVTimeStepType::Zone,
    6778             :                                         OutputProcessor::SOVStoreType::Average,
    6779         116 :                                         RefrigCase(caseNum).Name);
    6780             :                 }
    6781             : 
    6782         736 :                 SetupOutputVariable(state,
    6783             :                                     "Refrigeration Case Latent Credit Curve Value",
    6784             :                                     OutputProcessor::Unit::None,
    6785         184 :                                     RefrigCase(caseNum).LatEnergyCurveValue,
    6786             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6787             :                                     OutputProcessor::SOVStoreType::Average,
    6788         368 :                                     RefrigCase(caseNum).Name);
    6789             : 
    6790             :                 // Report only for cases having anti-sweat heaters
    6791         184 :                 if (RefrigCase(caseNum).AntiSweatControlType > ASHtrCtrlType::None) {
    6792         316 :                     SetupOutputVariable(state,
    6793             :                                         "Refrigeration Case Anti Sweat Electricity Rate",
    6794             :                                         OutputProcessor::Unit::W,
    6795          79 :                                         RefrigCase(caseNum).ElecAntiSweatPower,
    6796             :                                         OutputProcessor::SOVTimeStepType::Zone,
    6797             :                                         OutputProcessor::SOVStoreType::Average,
    6798         158 :                                         RefrigCase(caseNum).Name);
    6799         395 :                     SetupOutputVariable(state,
    6800             :                                         "Refrigeration Case Anti Sweat Electricity Energy",
    6801             :                                         OutputProcessor::Unit::J,
    6802          79 :                                         RefrigCase(caseNum).ElecAntiSweatConsumption,
    6803             :                                         OutputProcessor::SOVTimeStepType::Zone,
    6804             :                                         OutputProcessor::SOVStoreType::Summed,
    6805          79 :                                         RefrigCase(caseNum).Name,
    6806             :                                         _,
    6807             :                                         "ELECTRICITY",
    6808             :                                         "REFRIGERATION",
    6809             :                                         "General",
    6810             :                                         "Building",
    6811         158 :                                         RefrigCase(caseNum).ZoneName);
    6812             :                 }
    6813             : 
    6814             :                 // Report only for cases using electric defrost
    6815             : 
    6816         525 :                 if (RefrigCase(caseNum).defrostType == RefCaseDefrostType::Electric ||
    6817         341 :                     RefrigCase(caseNum).defrostType == RefCaseDefrostType::ElectricOnDemand ||
    6818         157 :                     RefrigCase(caseNum).defrostType == RefCaseDefrostType::ElectricTerm) {
    6819         180 :                     SetupOutputVariable(state,
    6820             :                                         "Refrigeration Case Defrost Electricity Rate",
    6821             :                                         OutputProcessor::Unit::W,
    6822          45 :                                         RefrigCase(caseNum).ElecDefrostPower,
    6823             :                                         OutputProcessor::SOVTimeStepType::Zone,
    6824             :                                         OutputProcessor::SOVStoreType::Average,
    6825          90 :                                         RefrigCase(caseNum).Name);
    6826         225 :                     SetupOutputVariable(state,
    6827             :                                         "Refrigeration Case Defrost Electricity Energy",
    6828             :                                         OutputProcessor::Unit::J,
    6829          45 :                                         RefrigCase(caseNum).ElecDefrostConsumption,
    6830             :                                         OutputProcessor::SOVTimeStepType::Zone,
    6831             :                                         OutputProcessor::SOVStoreType::Summed,
    6832          45 :                                         RefrigCase(caseNum).Name,
    6833             :                                         _,
    6834             :                                         "ELECTRICITY",
    6835             :                                         "REFRIGERATION",
    6836             :                                         "General",
    6837             :                                         "Building",
    6838          90 :                                         RefrigCase(caseNum).ZoneName);
    6839             :                 }
    6840             : 
    6841             :                 // register refrigeration case credits as internal gains
    6842         184 :                 if (RefrigCase(caseNum).ActualZoneNum > 0) {
    6843        1288 :                     SetupZoneInternalGain(state,
    6844         184 :                                           RefrigCase(caseNum).ActualZoneNum,
    6845         184 :                                           RefrigCase(caseNum).Name,
    6846             :                                           DataHeatBalance::IntGainType::RefrigerationCase,
    6847         184 :                                           &RefrigCase(caseNum).SensZoneCreditRate,
    6848         184 :                                           &RefrigCase(caseNum).SensHVACCreditRate,
    6849             :                                           nullptr,
    6850         184 :                                           &RefrigCase(caseNum).LatZoneCreditRate,
    6851         184 :                                           &RefrigCase(caseNum).LatHVACCreditRate,
    6852             :                                           nullptr,
    6853             :                                           nullptr,
    6854         184 :                                           RefrigCase(caseNum).ZoneRANode);
    6855             :                 }
    6856             :             } // END IF (.NOT. RefrigCase(CaseNum)%unusedCase)
    6857             :         }
    6858             :     } // NumSimulationCases > 0
    6859             : 
    6860         771 :     if (state.dataRefrigCase->NumSimulationWalkIns > 0) {
    6861             :         // Setup Report Variables for simulated  Walk In (do not report unused WalkIns)
    6862             :         // CurrentModuleObject='Refrigeration:WalkIn'
    6863          28 :         for (int walkInNum = 1; walkInNum <= state.dataRefrigCase->NumSimulationWalkIns; ++walkInNum) {
    6864          15 :             if (WalkIn(walkInNum).NumSysAttach == 1) { // ensure no unuseds reported
    6865          60 :                 SetupOutputVariable(state,
    6866             :                                     "Refrigeration Walk In Evaporator Total Cooling Rate",
    6867             :                                     OutputProcessor::Unit::W,
    6868          15 :                                     WalkIn(walkInNum).TotalCoolingLoad,
    6869             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6870             :                                     OutputProcessor::SOVStoreType::Average,
    6871          30 :                                     WalkIn(walkInNum).Name);
    6872          60 :                 SetupOutputVariable(state,
    6873             :                                     "Refrigeration Walk In Evaporator Total Cooling Energy",
    6874             :                                     OutputProcessor::Unit::J,
    6875          15 :                                     WalkIn(walkInNum).TotalCoolingEnergy,
    6876             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6877             :                                     OutputProcessor::SOVStoreType::Summed,
    6878          30 :                                     WalkIn(walkInNum).Name);
    6879          60 :                 SetupOutputVariable(state,
    6880             :                                     "Refrigeration Walk In Evaporator Sensible Cooling Rate",
    6881             :                                     OutputProcessor::Unit::W,
    6882          15 :                                     WalkIn(walkInNum).TotSensCoolingEnergyRate,
    6883             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6884             :                                     OutputProcessor::SOVStoreType::Average,
    6885          30 :                                     WalkIn(walkInNum).Name);
    6886          60 :                 SetupOutputVariable(state,
    6887             :                                     "Refrigeration Walk In Evaporator Sensible Cooling Energy",
    6888             :                                     OutputProcessor::Unit::J,
    6889          15 :                                     WalkIn(walkInNum).TotSensCoolingEnergy,
    6890             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6891             :                                     OutputProcessor::SOVStoreType::Summed,
    6892          30 :                                     WalkIn(walkInNum).Name);
    6893          60 :                 SetupOutputVariable(state,
    6894             :                                     "Refrigeration Walk In Evaporator Latent Cooling Rate",
    6895             :                                     OutputProcessor::Unit::W,
    6896          15 :                                     WalkIn(walkInNum).TotLatCoolingEnergyRate,
    6897             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6898             :                                     OutputProcessor::SOVStoreType::Average,
    6899          30 :                                     WalkIn(walkInNum).Name);
    6900          60 :                 SetupOutputVariable(state,
    6901             :                                     "Refrigeration Walk In Evaporator Latent Cooling Energy",
    6902             :                                     OutputProcessor::Unit::J,
    6903          15 :                                     WalkIn(walkInNum).TotLatCoolingEnergy,
    6904             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6905             :                                     OutputProcessor::SOVStoreType::Summed,
    6906          30 :                                     WalkIn(walkInNum).Name);
    6907          60 :                 SetupOutputVariable(state,
    6908             :                                     "Refrigeration Walk In Ancillary Electricity Rate",
    6909             :                                     OutputProcessor::Unit::W,
    6910          15 :                                     WalkIn(walkInNum).TotalElecPower,
    6911             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6912             :                                     OutputProcessor::SOVStoreType::Average,
    6913          30 :                                     WalkIn(walkInNum).Name);
    6914          60 :                 SetupOutputVariable(state,
    6915             :                                     "Refrigeration Walk In Ancillary Electricity Energy",
    6916             :                                     OutputProcessor::Unit::J,
    6917          15 :                                     WalkIn(walkInNum).TotalElecConsumption,
    6918             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6919             :                                     OutputProcessor::SOVStoreType::Summed,
    6920          30 :                                     WalkIn(walkInNum).Name);
    6921          60 :                 SetupOutputVariable(state,
    6922             :                                     "Refrigeration Walk In Fan Electricity Rate",
    6923             :                                     OutputProcessor::Unit::W,
    6924          15 :                                     WalkIn(walkInNum).ElecFanPower,
    6925             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6926             :                                     OutputProcessor::SOVStoreType::Average,
    6927          30 :                                     WalkIn(walkInNum).Name);
    6928          60 :                 SetupOutputVariable(state,
    6929             :                                     "Refrigeration Walk In Fan Electricity Energy",
    6930             :                                     OutputProcessor::Unit::J,
    6931          15 :                                     WalkIn(walkInNum).ElecFanConsumption,
    6932             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6933             :                                     OutputProcessor::SOVStoreType::Summed,
    6934          15 :                                     WalkIn(walkInNum).Name,
    6935             :                                     _,
    6936             :                                     "ELECTRICITY",
    6937             :                                     "REFRIGERATION",
    6938             :                                     "General",
    6939          15 :                                     "Building");
    6940          60 :                 SetupOutputVariable(state,
    6941             :                                     "Refrigeration Walk In Lighting Electricity Rate",
    6942             :                                     OutputProcessor::Unit::W,
    6943          15 :                                     WalkIn(walkInNum).ElecLightingPower,
    6944             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6945             :                                     OutputProcessor::SOVStoreType::Average,
    6946          30 :                                     WalkIn(walkInNum).Name);
    6947          60 :                 SetupOutputVariable(state,
    6948             :                                     "Refrigeration Walk In Lighting Electricity Energy",
    6949             :                                     OutputProcessor::Unit::J,
    6950          15 :                                     WalkIn(walkInNum).ElecLightingConsumption,
    6951             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6952             :                                     OutputProcessor::SOVStoreType::Summed,
    6953          15 :                                     WalkIn(walkInNum).Name,
    6954             :                                     _,
    6955             :                                     "ELECTRICITY",
    6956             :                                     "REFRIGERATION",
    6957             :                                     "General",
    6958          15 :                                     "Building");
    6959          60 :                 SetupOutputVariable(state,
    6960             :                                     "Refrigeration Walk In Heater Electricity Rate",
    6961             :                                     OutputProcessor::Unit::W,
    6962          15 :                                     WalkIn(walkInNum).ElecHeaterPower,
    6963             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6964             :                                     OutputProcessor::SOVStoreType::Average,
    6965          30 :                                     WalkIn(walkInNum).Name);
    6966          60 :                 SetupOutputVariable(state,
    6967             :                                     "Refrigeration Walk In Heater Electricity Energy",
    6968             :                                     OutputProcessor::Unit::J,
    6969          15 :                                     WalkIn(walkInNum).ElecHeaterConsumption,
    6970             :                                     OutputProcessor::SOVTimeStepType::Zone,
    6971             :                                     OutputProcessor::SOVStoreType::Summed,
    6972          15 :                                     WalkIn(walkInNum).Name,
    6973             :                                     _,
    6974             :                                     "ELECTRICITY",
    6975             :                                     "REFRIGERATION",
    6976             :                                     "General",
    6977          15 :                                     "Building");
    6978             : 
    6979             :                 // Report only for WalkIns using electric defrost
    6980          15 :                 if (WalkIn(walkInNum).defrostType == WalkinClrDefrostType::Elec) {
    6981          52 :                     SetupOutputVariable(state,
    6982             :                                         "Refrigeration Walk In Defrost Electricity Rate",
    6983             :                                         OutputProcessor::Unit::W,
    6984          13 :                                         WalkIn(walkInNum).ElecDefrostPower,
    6985             :                                         OutputProcessor::SOVTimeStepType::Zone,
    6986             :                                         OutputProcessor::SOVStoreType::Average,
    6987          26 :                                         WalkIn(walkInNum).Name);
    6988          52 :                     SetupOutputVariable(state,
    6989             :                                         "Refrigeration Walk In Defrost Electricity Energy",
    6990             :                                         OutputProcessor::Unit::J,
    6991          13 :                                         WalkIn(walkInNum).ElecDefrostConsumption,
    6992             :                                         OutputProcessor::SOVTimeStepType::Zone,
    6993             :                                         OutputProcessor::SOVStoreType::Summed,
    6994          13 :                                         WalkIn(walkInNum).Name,
    6995             :                                         _,
    6996             :                                         "ELECTRICITY",
    6997             :                                         "REFRIGERATION",
    6998             :                                         "General",
    6999          13 :                                         "Building");
    7000             :                 }
    7001             : 
    7002             :                 // Report walkin variables that are specified for each zone exposed to the walkin
    7003             :                 // For "IDOut" variable in SetupOutputVariable, need to create a single name that includes
    7004             :                 //    both the walk-in name and the zone name - see "Walkin_and_zone_name" concatination
    7005             :                 //    This new variable name is important if using an rvi file!
    7006          30 :                 for (int zoneId = 1; zoneId <= WalkIn(walkInNum).NumZones; ++zoneId) {
    7007             : 
    7008          15 :                     Walkin_and_zone_name = WalkIn(walkInNum).Name + "InZone" + WalkIn(walkInNum).ZoneName(zoneId);
    7009             : 
    7010          30 :                     SetupOutputVariable(state,
    7011             :                                         "Refrigeration Walk In Zone Sensible Cooling Rate",
    7012             :                                         OutputProcessor::Unit::W,
    7013          15 :                                         WalkIn(walkInNum).SensZoneCreditCoolRate(zoneId),
    7014             :                                         OutputProcessor::SOVTimeStepType::Zone,
    7015             :                                         OutputProcessor::SOVStoreType::Average,
    7016          15 :                                         Walkin_and_zone_name);
    7017          30 :                     SetupOutputVariable(state,
    7018             :                                         "Refrigeration Walk In Zone Sensible Cooling Energy",
    7019             :                                         OutputProcessor::Unit::J,
    7020          15 :                                         WalkIn(walkInNum).SensZoneCreditCool(zoneId),
    7021             :                                         OutputProcessor::SOVTimeStepType::Zone,
    7022             :                                         OutputProcessor::SOVStoreType::Summed,
    7023          15 :                                         Walkin_and_zone_name);
    7024          30 :                     SetupOutputVariable(state,
    7025             :                                         "Refrigeration Walk In Zone Sensible Heating Rate",
    7026             :                                         OutputProcessor::Unit::W,
    7027          15 :                                         WalkIn(walkInNum).SensZoneCreditHeatRate(zoneId),
    7028             :                                         OutputProcessor::SOVTimeStepType::Zone,
    7029             :                                         OutputProcessor::SOVStoreType::Average,
    7030          15 :                                         Walkin_and_zone_name);
    7031          30 :                     SetupOutputVariable(state,
    7032             :                                         "Refrigeration Walk In Zone Sensible Heating Energy",
    7033             :                                         OutputProcessor::Unit::J,
    7034          15 :                                         WalkIn(walkInNum).SensZoneCreditHeat(zoneId),
    7035             :                                         OutputProcessor::SOVTimeStepType::Zone,
    7036             :                                         OutputProcessor::SOVStoreType::Summed,
    7037          15 :                                         Walkin_and_zone_name);
    7038          30 :                     SetupOutputVariable(state,
    7039             :                                         "Refrigeration Walk In Zone Latent Rate",
    7040             :                                         OutputProcessor::Unit::W,
    7041          15 :                                         WalkIn(walkInNum).LatZoneCreditRate(zoneId),
    7042             :                                         OutputProcessor::SOVTimeStepType::Zone,
    7043             :                                         OutputProcessor::SOVStoreType::Average,
    7044          15 :                                         Walkin_and_zone_name);
    7045          30 :                     SetupOutputVariable(state,
    7046             :                                         "Refrigeration Walk In Zone Latent Energy",
    7047             :                                         OutputProcessor::Unit::J,
    7048          15 :                                         WalkIn(walkInNum).LatZoneCredit(zoneId),
    7049             :                                         OutputProcessor::SOVTimeStepType::Zone,
    7050             :                                         OutputProcessor::SOVStoreType::Summed,
    7051          15 :                                         Walkin_and_zone_name);
    7052             : 
    7053          15 :                     if (WalkIn(walkInNum).ZoneNum(zoneId) > 0)
    7054          30 :                         SetupZoneInternalGain(state,
    7055          15 :                                               WalkIn(walkInNum).ZoneNum(zoneId),
    7056             :                                               Walkin_and_zone_name,
    7057             :                                               DataHeatBalance::IntGainType::RefrigerationWalkIn,
    7058          15 :                                               &WalkIn(walkInNum).SensZoneCreditRate(zoneId),
    7059             :                                               nullptr,
    7060             :                                               nullptr,
    7061          15 :                                               &WalkIn(walkInNum).LatZoneCreditRate(zoneId));
    7062             : 
    7063             :                 } // ZoneID
    7064             :             }     //(.NOT.  WalkIn( WalkInNum)%unusedWalkIn)
    7065             :         }         // NumSimulationWalkIns
    7066             :     }             // NumSimulationWalkIns > 0
    7067             : 
    7068         771 :     if (state.dataRefrigCase->NumSimulationRefrigAirChillers > 0) {
    7069             :         // Setup Report Variables for simulated Warehouse coils (do not report unused warehouse coils)
    7070             :         // CurrentModuleObject='Refrigeration:AirChiller'
    7071          84 :         for (int coilNum = 1; coilNum <= state.dataRefrigCase->NumSimulationRefrigAirChillers; ++coilNum) {
    7072          83 :             if (WarehouseCoil(coilNum).NumSysAttach == 1) { // ensure no unuseds reported
    7073         332 :                 SetupOutputVariable(state,
    7074             :                                     "Refrigeration Zone Air Chiller Total Cooling Rate",
    7075             :                                     OutputProcessor::Unit::W,
    7076          83 :                                     WarehouseCoil(coilNum).TotalCoolingLoad,
    7077             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7078             :                                     OutputProcessor::SOVStoreType::Average,
    7079         166 :                                     WarehouseCoil(coilNum).Name);
    7080         332 :                 SetupOutputVariable(state,
    7081             :                                     "Refrigeration Zone Air Chiller Total Cooling Energy",
    7082             :                                     OutputProcessor::Unit::J,
    7083          83 :                                     WarehouseCoil(coilNum).TotalCoolingEnergy,
    7084             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7085             :                                     OutputProcessor::SOVStoreType::Summed,
    7086         166 :                                     WarehouseCoil(coilNum).Name);
    7087         332 :                 SetupOutputVariable(state,
    7088             :                                     "Refrigeration Zone Air Chiller Sensible Cooling Rate",
    7089             :                                     OutputProcessor::Unit::W,
    7090          83 :                                     WarehouseCoil(coilNum).SensCoolingEnergyRate,
    7091             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7092             :                                     OutputProcessor::SOVStoreType::Average,
    7093         166 :                                     WarehouseCoil(coilNum).Name);
    7094         332 :                 SetupOutputVariable(state,
    7095             :                                     "Refrigeration Zone Air Chiller Sensible Cooling Energy",
    7096             :                                     OutputProcessor::Unit::J,
    7097          83 :                                     WarehouseCoil(coilNum).SensCoolingEnergy,
    7098             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7099             :                                     OutputProcessor::SOVStoreType::Summed,
    7100         166 :                                     WarehouseCoil(coilNum).Name);
    7101         332 :                 SetupOutputVariable(state,
    7102             :                                     "Refrigeration Zone Air Chiller Latent Cooling Rate",
    7103             :                                     OutputProcessor::Unit::W,
    7104          83 :                                     WarehouseCoil(coilNum).LatCreditRate,
    7105             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7106             :                                     OutputProcessor::SOVStoreType::Average,
    7107         166 :                                     WarehouseCoil(coilNum).Name);
    7108         332 :                 SetupOutputVariable(state,
    7109             :                                     "Refrigeration Zone Air Chiller Latent Cooling Energy",
    7110             :                                     OutputProcessor::Unit::J,
    7111          83 :                                     WarehouseCoil(coilNum).LatCreditEnergy,
    7112             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7113             :                                     OutputProcessor::SOVStoreType::Summed,
    7114         166 :                                     WarehouseCoil(coilNum).Name);
    7115         332 :                 SetupOutputVariable(state,
    7116             :                                     "Refrigeration Zone Air Chiller Water Removed Mass Flow Rate",
    7117             :                                     OutputProcessor::Unit::kg_s,
    7118          83 :                                     WarehouseCoil(coilNum).LatKgPerS_ToZone,
    7119             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7120             :                                     OutputProcessor::SOVStoreType::Average,
    7121         166 :                                     WarehouseCoil(coilNum).Name);
    7122         332 :                 SetupOutputVariable(state,
    7123             :                                     "Refrigeration Zone Air Chiller Total Electricity Rate",
    7124             :                                     OutputProcessor::Unit::W,
    7125          83 :                                     WarehouseCoil(coilNum).TotalElecPower,
    7126             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7127             :                                     OutputProcessor::SOVStoreType::Average,
    7128         166 :                                     WarehouseCoil(coilNum).Name);
    7129         332 :                 SetupOutputVariable(state,
    7130             :                                     "Refrigeration Zone Air Chiller Total Electricity Energy",
    7131             :                                     OutputProcessor::Unit::J,
    7132          83 :                                     WarehouseCoil(coilNum).TotalElecConsumption,
    7133             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7134             :                                     OutputProcessor::SOVStoreType::Summed,
    7135         166 :                                     WarehouseCoil(coilNum).Name); // components are metered seperately
    7136         332 :                 SetupOutputVariable(state,
    7137             :                                     "Refrigeration Zone Air Chiller Fan Electricity Rate",
    7138             :                                     OutputProcessor::Unit::W,
    7139          83 :                                     WarehouseCoil(coilNum).ElecFanPower,
    7140             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7141             :                                     OutputProcessor::SOVStoreType::Average,
    7142         166 :                                     WarehouseCoil(coilNum).Name);
    7143         332 :                 SetupOutputVariable(state,
    7144             :                                     "Refrigeration Zone Air Chiller Fan Electric Energy",
    7145             :                                     OutputProcessor::Unit::J,
    7146          83 :                                     WarehouseCoil(coilNum).ElecFanConsumption,
    7147             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7148             :                                     OutputProcessor::SOVStoreType::Summed,
    7149          83 :                                     WarehouseCoil(coilNum).Name,
    7150             :                                     _,
    7151             :                                     "ELECTRICITY",
    7152             :                                     "REFRIGERATION",
    7153             :                                     "General",
    7154          83 :                                     "Building");
    7155         332 :                 SetupOutputVariable(state,
    7156             :                                     "Refrigeration Zone Air Chiller Heater Electricity Rate",
    7157             :                                     OutputProcessor::Unit::W,
    7158          83 :                                     WarehouseCoil(coilNum).ElecHeaterPower,
    7159             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7160             :                                     OutputProcessor::SOVStoreType::Average,
    7161         166 :                                     WarehouseCoil(coilNum).Name);
    7162         332 :                 SetupOutputVariable(state,
    7163             :                                     "Refrigeration Zone Air Chiller Heater Electricity Energy",
    7164             :                                     OutputProcessor::Unit::J,
    7165          83 :                                     WarehouseCoil(coilNum).ElecHeaterConsumption,
    7166             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7167             :                                     OutputProcessor::SOVStoreType::Summed,
    7168          83 :                                     WarehouseCoil(coilNum).Name,
    7169             :                                     _,
    7170             :                                     "ELECTRICITY",
    7171             :                                     "REFRIGERATION",
    7172             :                                     "General",
    7173          83 :                                     "Building");
    7174         332 :                 SetupOutputVariable(state,
    7175             :                                     "Refrigeration Zone Air Chiller Sensible Heat Ratio",
    7176             :                                     OutputProcessor::Unit::None,
    7177          83 :                                     WarehouseCoil(coilNum).SensHeatRatio,
    7178             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7179             :                                     OutputProcessor::SOVStoreType::Average,
    7180         166 :                                     WarehouseCoil(coilNum).Name);
    7181         332 :                 SetupOutputVariable(state,
    7182             :                                     "Refrigeration Zone Air Chiller Frost Accumulation Mass",
    7183             :                                     OutputProcessor::Unit::kg,
    7184          83 :                                     WarehouseCoil(coilNum).KgFrost,
    7185             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7186             :                                     OutputProcessor::SOVStoreType::Average,
    7187         166 :                                     WarehouseCoil(coilNum).Name);
    7188         332 :                 SetupOutputVariable(state,
    7189             :                                     "Refrigeration Zone Air Chiller Zone Total Cooling Rate",
    7190             :                                     OutputProcessor::Unit::W,
    7191          83 :                                     WarehouseCoil(coilNum).ReportTotalCoolCreditRate,
    7192             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7193             :                                     OutputProcessor::SOVStoreType::Average,
    7194         166 :                                     WarehouseCoil(coilNum).Name);
    7195         332 :                 SetupOutputVariable(state,
    7196             :                                     "Refrigeration Zone Air Chiller Zone Total Cooling Energy",
    7197             :                                     OutputProcessor::Unit::J,
    7198          83 :                                     WarehouseCoil(coilNum).ReportTotalCoolCreditEnergy,
    7199             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7200             :                                     OutputProcessor::SOVStoreType::Summed,
    7201         166 :                                     WarehouseCoil(coilNum).Name);
    7202         332 :                 SetupOutputVariable(state,
    7203             :                                     "Refrigeration Zone Air Chiller Zone Sensible Cooling Rate",
    7204             :                                     OutputProcessor::Unit::W,
    7205          83 :                                     WarehouseCoil(coilNum).ReportSensCoolCreditRate,
    7206             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7207             :                                     OutputProcessor::SOVStoreType::Average,
    7208         166 :                                     WarehouseCoil(coilNum).Name);
    7209         332 :                 SetupOutputVariable(state,
    7210             :                                     "Refrigeration Zone Air Chiller Zone Sensible Cooling Energy",
    7211             :                                     OutputProcessor::Unit::J,
    7212          83 :                                     WarehouseCoil(coilNum).ReportSensCoolCreditEnergy,
    7213             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7214             :                                     OutputProcessor::SOVStoreType::Summed,
    7215         166 :                                     WarehouseCoil(coilNum).Name);
    7216         332 :                 SetupOutputVariable(state,
    7217             :                                     "Refrigeration Zone Air Chiller Zone Heating Rate",
    7218             :                                     OutputProcessor::Unit::W,
    7219          83 :                                     WarehouseCoil(coilNum).ReportHeatingCreditRate,
    7220             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7221             :                                     OutputProcessor::SOVStoreType::Average,
    7222         166 :                                     WarehouseCoil(coilNum).Name);
    7223         332 :                 SetupOutputVariable(state,
    7224             :                                     "Refrigeration Zone Air Chiller Zone Heating Energy",
    7225             :                                     OutputProcessor::Unit::J,
    7226          83 :                                     WarehouseCoil(coilNum).ReportHeatingCreditEnergy,
    7227             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7228             :                                     OutputProcessor::SOVStoreType::Summed,
    7229         166 :                                     WarehouseCoil(coilNum).Name);
    7230             : 
    7231             :                 // Report only for Warehouse coils using electric defrost
    7232          83 :                 if (WarehouseCoil(coilNum).defrostType == DefrostType::Elec) {
    7233         328 :                     SetupOutputVariable(state,
    7234             :                                         "Refrigeration Zone Air Chiller Defrost Electricity Rate",
    7235             :                                         OutputProcessor::Unit::W,
    7236          82 :                                         WarehouseCoil(coilNum).ElecDefrostPower,
    7237             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    7238             :                                         OutputProcessor::SOVStoreType::Average,
    7239         164 :                                         WarehouseCoil(coilNum).Name);
    7240         328 :                     SetupOutputVariable(state,
    7241             :                                         "Refrigeration Zone Air Chiller Defrost Electricity Energy",
    7242             :                                         OutputProcessor::Unit::J,
    7243          82 :                                         WarehouseCoil(coilNum).ElecDefrostConsumption,
    7244             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    7245             :                                         OutputProcessor::SOVStoreType::Summed,
    7246          82 :                                         WarehouseCoil(coilNum).Name,
    7247             :                                         _,
    7248             :                                         "ELECTRICITY",
    7249             :                                         "REFRIGERATION",
    7250             :                                         "General",
    7251          82 :                                         "Building");
    7252             :                 } // electric defrost coil
    7253             :             }     //(.NOT.  WarehouseCoil(CoilNum)%unusedWarehouseCoil)
    7254             :         }         // NumSimulationWarehouseCoils
    7255             :     }             // NumSimulationRefrigAirChillers > 0
    7256             : 
    7257             :     // There are no report variables for Chiller sets because they are
    7258             :     // used to pass the demand to the coils, but are NOT used to provide the
    7259             :     // cooling energy to the zone (because more than one set may cool a zone)
    7260             : 
    7261             :     // Report sum of all refrigeration interactions with each zone
    7262             : 
    7263        5585 :     for (int zoneID = 1; zoneID <= state.dataGlobal->NumOfZones; ++zoneID) {
    7264        4814 :         if (state.dataRefrigCase->RefrigPresentInZone(zoneID)) {
    7265          68 :             if (state.dataRefrigCase->HaveCasesOrWalkins) {
    7266         232 :                 SetupOutputVariable(state,
    7267             :                                     "Refrigeration Zone Case and Walk In Total Sensible Cooling Rate",
    7268             :                                     OutputProcessor::Unit::W,
    7269          58 :                                     state.dataHeatBal->RefrigCaseCredit(zoneID).SenCaseCreditToZone,
    7270             :                                     OutputProcessor::SOVTimeStepType::Zone,
    7271             :                                     OutputProcessor::SOVStoreType::Average,
    7272         116 :                                     state.dataHeatBal->Zone(zoneID).Name);
    7273         232 :                 SetupOutputVariable(state,
    7274             :                                     "Refrigeration Zone Case and Walk In Total Sensible Cooling Energy",
    7275             :                                     OutputProcessor::Unit::J,
    7276          58 :                                     CaseWIZoneReport(zoneID).SenCaseCreditToZoneEnergy,
    7277             :                                     OutputProcessor::SOVTimeStepType::Zone,
    7278             :                                     OutputProcessor::SOVStoreType::Summed,
    7279         116 :                                     state.dataHeatBal->Zone(zoneID).Name);
    7280         232 :                 SetupOutputVariable(state,
    7281             :                                     "Refrigeration Zone Case and Walk In Heating Rate",
    7282             :                                     OutputProcessor::Unit::W,
    7283          58 :                                     CaseWIZoneReport(zoneID).HeatingToZoneRate,
    7284             :                                     OutputProcessor::SOVTimeStepType::Zone,
    7285             :                                     OutputProcessor::SOVStoreType::Average,
    7286         116 :                                     state.dataHeatBal->Zone(zoneID).Name);
    7287         232 :                 SetupOutputVariable(state,
    7288             :                                     "Refrigeration Zone Case and Walk In Heating Energy",
    7289             :                                     OutputProcessor::Unit::J,
    7290          58 :                                     CaseWIZoneReport(zoneID).HeatingToZoneEnergy,
    7291             :                                     OutputProcessor::SOVTimeStepType::Zone,
    7292             :                                     OutputProcessor::SOVStoreType::Summed,
    7293         116 :                                     state.dataHeatBal->Zone(zoneID).Name);
    7294         232 :                 SetupOutputVariable(state,
    7295             :                                     "Refrigeration Zone Case and Walk In Sensible Cooling Rate",
    7296             :                                     OutputProcessor::Unit::W,
    7297          58 :                                     CaseWIZoneReport(zoneID).SenCoolingToZoneRate,
    7298             :                                     OutputProcessor::SOVTimeStepType::Zone,
    7299             :                                     OutputProcessor::SOVStoreType::Average,
    7300         116 :                                     state.dataHeatBal->Zone(zoneID).Name);
    7301         232 :                 SetupOutputVariable(state,
    7302             :                                     "Refrigeration Zone Case and Walk In Sensible Cooling Energy",
    7303             :                                     OutputProcessor::Unit::J,
    7304          58 :                                     CaseWIZoneReport(zoneID).SenCoolingToZoneEnergy,
    7305             :                                     OutputProcessor::SOVTimeStepType::Zone,
    7306             :                                     OutputProcessor::SOVStoreType::Summed,
    7307         116 :                                     state.dataHeatBal->Zone(zoneID).Name);
    7308         232 :                 SetupOutputVariable(state,
    7309             :                                     "Refrigeration Zone Case and Walk In Total Latent Cooling Rate",
    7310             :                                     OutputProcessor::Unit::W,
    7311          58 :                                     CaseWIZoneReport(zoneID).LatCoolingToZoneRate,
    7312             :                                     OutputProcessor::SOVTimeStepType::Zone,
    7313             :                                     OutputProcessor::SOVStoreType::Average,
    7314         116 :                                     state.dataHeatBal->Zone(zoneID).Name);
    7315         232 :                 SetupOutputVariable(state,
    7316             :                                     "Refrigeration Zone Case and Walk In Total Latent Cooling Energy",
    7317             :                                     OutputProcessor::Unit::J,
    7318          58 :                                     CaseWIZoneReport(zoneID).LatCoolingToZoneEnergy,
    7319             :                                     OutputProcessor::SOVTimeStepType::Zone,
    7320             :                                     OutputProcessor::SOVStoreType::Summed,
    7321         116 :                                     state.dataHeatBal->Zone(zoneID).Name);
    7322         232 :                 SetupOutputVariable(state,
    7323             :                                     "Refrigeration Zone Case and Walk In Total Cooling Rate",
    7324             :                                     OutputProcessor::Unit::W,
    7325          58 :                                     CaseWIZoneReport(zoneID).TotCoolingToZoneRate,
    7326             :                                     OutputProcessor::SOVTimeStepType::Zone,
    7327             :                                     OutputProcessor::SOVStoreType::Average,
    7328         116 :                                     state.dataHeatBal->Zone(zoneID).Name);
    7329         232 :                 SetupOutputVariable(state,
    7330             :                                     "Refrigeration Zone Case and Walk In Total Cooling Energy",
    7331             :                                     OutputProcessor::Unit::J,
    7332          58 :                                     CaseWIZoneReport(zoneID).TotCoolingToZoneEnergy,
    7333             :                                     OutputProcessor::SOVTimeStepType::Zone,
    7334             :                                     OutputProcessor::SOVStoreType::Summed,
    7335         116 :                                     state.dataHeatBal->Zone(zoneID).Name);
    7336         232 :                 SetupOutputVariable(state,
    7337             :                                     "Refrigeration Zone Case and Walk In Total Heat Transfer Rate",
    7338             :                                     OutputProcessor::Unit::W,
    7339          58 :                                     CaseWIZoneReport(zoneID).TotHtXferToZoneRate,
    7340             :                                     OutputProcessor::SOVTimeStepType::Zone,
    7341             :                                     OutputProcessor::SOVStoreType::Average,
    7342         116 :                                     state.dataHeatBal->Zone(zoneID).Name);
    7343         232 :                 SetupOutputVariable(state,
    7344             :                                     "Refrigeration Zone Case and Walk In Total Heat Transfer Energy",
    7345             :                                     OutputProcessor::Unit::J,
    7346          58 :                                     CaseWIZoneReport(zoneID).TotHtXferToZoneEnergy,
    7347             :                                     OutputProcessor::SOVTimeStepType::Zone,
    7348             :                                     OutputProcessor::SOVStoreType::Summed,
    7349         116 :                                     state.dataHeatBal->Zone(zoneID).Name);
    7350             :             } // HaveCasesOrWalkIns
    7351             : 
    7352          68 :             if (state.dataRefrigCase->HaveChillers) {
    7353          40 :                 SetupOutputVariable(state,
    7354             :                                     "Refrigeration Zone Air Chiller Sensible Heat Transfer Rate",
    7355             :                                     OutputProcessor::Unit::W,
    7356          10 :                                     CoilSysCredit(zoneID).SenCreditToZoneRate,
    7357             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7358             :                                     OutputProcessor::SOVStoreType::Average,
    7359          20 :                                     state.dataHeatBal->Zone(zoneID).Name);
    7360          40 :                 SetupOutputVariable(state,
    7361             :                                     "Refrigeration Zone Air Chiller Sensible Heat Transfer Energy",
    7362             :                                     OutputProcessor::Unit::J,
    7363          10 :                                     CoilSysCredit(zoneID).SenCreditToZoneEnergy,
    7364             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7365             :                                     OutputProcessor::SOVStoreType::Summed,
    7366          20 :                                     state.dataHeatBal->Zone(zoneID).Name);
    7367          40 :                 SetupOutputVariable(state,
    7368             :                                     "Refrigeration Zone Air Chiller Sensible Cooling Rate",
    7369             :                                     OutputProcessor::Unit::W,
    7370          10 :                                     CoilSysCredit(zoneID).ReportSenCoolingToZoneRate,
    7371             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7372             :                                     OutputProcessor::SOVStoreType::Average,
    7373          20 :                                     state.dataHeatBal->Zone(zoneID).Name);
    7374          40 :                 SetupOutputVariable(state,
    7375             :                                     "Refrigeration Zone Air Chiller Sensible Cooling Energy",
    7376             :                                     OutputProcessor::Unit::J,
    7377          10 :                                     CoilSysCredit(zoneID).ReportSenCoolingToZoneEnergy,
    7378             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7379             :                                     OutputProcessor::SOVStoreType::Summed,
    7380          20 :                                     state.dataHeatBal->Zone(zoneID).Name);
    7381          40 :                 SetupOutputVariable(state,
    7382             :                                     "Refrigeration Zone Air Chiller Latent Cooling Rate",
    7383             :                                     OutputProcessor::Unit::W,
    7384          10 :                                     CoilSysCredit(zoneID).ReportLatCreditToZoneRate,
    7385             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7386             :                                     OutputProcessor::SOVStoreType::Average,
    7387          20 :                                     state.dataHeatBal->Zone(zoneID).Name);
    7388          40 :                 SetupOutputVariable(state,
    7389             :                                     "Refrigeration Zone Air Chiller Latent Cooling Energy",
    7390             :                                     OutputProcessor::Unit::J,
    7391          10 :                                     CoilSysCredit(zoneID).ReportLatCreditToZoneEnergy,
    7392             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7393             :                                     OutputProcessor::SOVStoreType::Summed,
    7394          20 :                                     state.dataHeatBal->Zone(zoneID).Name);
    7395          40 :                 SetupOutputVariable(state,
    7396             :                                     "Refrigeration Zone Air Chiller Water Removed Mass Flow Rate",
    7397             :                                     OutputProcessor::Unit::kg_s,
    7398          10 :                                     CoilSysCredit(zoneID).ReportH2ORemovedKgPerS_FromZoneRate,
    7399             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7400             :                                     OutputProcessor::SOVStoreType::Average,
    7401          20 :                                     state.dataHeatBal->Zone(zoneID).Name);
    7402          40 :                 SetupOutputVariable(state,
    7403             :                                     "Refrigeration Zone Air Chiller Total Cooling Rate",
    7404             :                                     OutputProcessor::Unit::W,
    7405          10 :                                     CoilSysCredit(zoneID).ReportTotCoolingToZoneRate,
    7406             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7407             :                                     OutputProcessor::SOVStoreType::Average,
    7408          20 :                                     state.dataHeatBal->Zone(zoneID).Name);
    7409          40 :                 SetupOutputVariable(state,
    7410             :                                     "Refrigeration Zone Air Chiller Total Cooling Energy",
    7411             :                                     OutputProcessor::Unit::J,
    7412          10 :                                     CoilSysCredit(zoneID).ReportTotCoolingToZoneEnergy,
    7413             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7414             :                                     OutputProcessor::SOVStoreType::Summed,
    7415          20 :                                     state.dataHeatBal->Zone(zoneID).Name);
    7416          40 :                 SetupOutputVariable(state,
    7417             :                                     "Refrigeration Zone Air Chiller Heating Rate",
    7418             :                                     OutputProcessor::Unit::W,
    7419          10 :                                     CoilSysCredit(zoneID).ReportHeatingToZoneRate,
    7420             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7421             :                                     OutputProcessor::SOVStoreType::Average,
    7422          20 :                                     state.dataHeatBal->Zone(zoneID).Name);
    7423          40 :                 SetupOutputVariable(state,
    7424             :                                     "Refrigeration Zone Air Chiller Heating Energy",
    7425             :                                     OutputProcessor::Unit::J,
    7426          10 :                                     CoilSysCredit(zoneID).ReportHeatingToZoneEnergy,
    7427             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7428             :                                     OutputProcessor::SOVStoreType::Summed,
    7429          20 :                                     state.dataHeatBal->Zone(zoneID).Name);
    7430             :             } // HaveChillers
    7431             :         }     // RefrigPresentInZone(ZoneID)
    7432             :     }         // ZoneID
    7433             : 
    7434         771 :     if (state.dataRefrigCase->NumSimulationSecondarySystems > 0) {
    7435             :         // CurrentModuleObject='Refrigeration:SecondarySystem'
    7436           3 :         for (int secondNum = 1; secondNum <= state.dataRefrigCase->NumSimulationSecondarySystems; ++secondNum) {
    7437           2 :             if (Secondary(secondNum).NumSysAttach == 1) {
    7438           2 :                 if (Secondary(secondNum).CoilFlag) { // secondary system serves chillers and is solved on HVAC time step
    7439           0 :                     SetupOutputVariable(state,
    7440             :                                         "Refrigeration Air Chiller Secondary Loop Pump Electricity Rate",
    7441             :                                         OutputProcessor::Unit::W,
    7442           0 :                                         Secondary(secondNum).PumpPowerTotal,
    7443             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    7444             :                                         OutputProcessor::SOVStoreType::Average,
    7445           0 :                                         Secondary(secondNum).Name);
    7446           0 :                     SetupOutputVariable(state,
    7447             :                                         "Refrigeration Air Chiller Secondary Loop Pump Electricity Energy",
    7448             :                                         OutputProcessor::Unit::J,
    7449           0 :                                         Secondary(secondNum).PumpElecEnergyTotal,
    7450             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    7451             :                                         OutputProcessor::SOVStoreType::Summed,
    7452           0 :                                         Secondary(secondNum).Name,
    7453             :                                         _,
    7454             :                                         "ELECTRICITY",
    7455             :                                         "REFRIGERATION",
    7456           0 :                                         Secondary(secondNum).EndUseSubcategory,
    7457           0 :                                         "Plant");
    7458           0 :                     SetupOutputVariable(state,
    7459             :                                         "Refrigeration Air Chiller Secondary Loop Load Heat Transfer Rate",
    7460             :                                         OutputProcessor::Unit::W,
    7461           0 :                                         Secondary(secondNum).TotalRefrigLoad,
    7462             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    7463             :                                         OutputProcessor::SOVStoreType::Average,
    7464           0 :                                         Secondary(secondNum).Name);
    7465           0 :                     SetupOutputVariable(state,
    7466             :                                         "Refrigeration Air Chiller Secondary Loop Load Heat Transfer Energy",
    7467             :                                         OutputProcessor::Unit::J,
    7468           0 :                                         Secondary(secondNum).TotalRefrigEnergy,
    7469             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    7470             :                                         OutputProcessor::SOVStoreType::Summed,
    7471           0 :                                         Secondary(secondNum).Name);
    7472           0 :                     SetupOutputVariable(state,
    7473             :                                         "Refrigeration Air Chiller Secondary Loop Total Heat Transfer Rate",
    7474             :                                         OutputProcessor::Unit::W,
    7475           0 :                                         Secondary(secondNum).TotalCoolingLoad,
    7476             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    7477             :                                         OutputProcessor::SOVStoreType::Average,
    7478           0 :                                         Secondary(secondNum).Name);
    7479           0 :                     SetupOutputVariable(state,
    7480             :                                         "Refrigeration Air Chiller Secondary Loop Total Heat Transfer Energy",
    7481             :                                         OutputProcessor::Unit::J,
    7482           0 :                                         Secondary(secondNum).TotalCoolingEnergy,
    7483             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    7484             :                                         OutputProcessor::SOVStoreType::Summed,
    7485           0 :                                         Secondary(secondNum).Name);
    7486           0 :                     SetupOutputVariable(state,
    7487             :                                         "Refrigeration Air Chiller Secondary Loop Estimated Refrigerant Inventory Mass",
    7488             :                                         OutputProcessor::Unit::kg,
    7489           0 :                                         Secondary(secondNum).RefInventory,
    7490             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    7491             :                                         OutputProcessor::SOVStoreType::Average,
    7492           0 :                                         Secondary(secondNum).Name);
    7493           0 :                     SetupOutputVariable(state,
    7494             :                                         "Refrigeration Air Chiller Secondary Loop Volume Flow Rate",
    7495             :                                         OutputProcessor::Unit::m3_s,
    7496           0 :                                         Secondary(secondNum).FlowVolActual,
    7497             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    7498             :                                         OutputProcessor::SOVStoreType::Average,
    7499           0 :                                         Secondary(secondNum).Name);
    7500           0 :                     SetupOutputVariable(state,
    7501             :                                         "Refrigeration Air Chiller Secondary Loop Pipe Heat Gain Rate",
    7502             :                                         OutputProcessor::Unit::W,
    7503           0 :                                         Secondary(secondNum).DistPipeHeatGain,
    7504             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    7505             :                                         OutputProcessor::SOVStoreType::Average,
    7506           0 :                                         Secondary(secondNum).Name);
    7507           0 :                     SetupOutputVariable(state,
    7508             :                                         "Refrigeration Air Chiller Secondary Loop Pipe Heat Gain Energy",
    7509             :                                         OutputProcessor::Unit::J,
    7510           0 :                                         Secondary(secondNum).DistPipeHeatGainEnergy,
    7511             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    7512             :                                         OutputProcessor::SOVStoreType::Summed,
    7513           0 :                                         Secondary(secondNum).Name);
    7514           0 :                     SetupOutputVariable(state,
    7515             :                                         "Refrigeration Air Chiller Secondary Loop Receiver Heat Gain Rate",
    7516             :                                         OutputProcessor::Unit::W,
    7517           0 :                                         Secondary(secondNum).ReceiverHeatGain,
    7518             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    7519             :                                         OutputProcessor::SOVStoreType::Average,
    7520           0 :                                         Secondary(secondNum).Name);
    7521           0 :                     SetupOutputVariable(state,
    7522             :                                         "Refrigeration Air Chiller Secondary Loop Receiver Heat Gain Energy",
    7523             :                                         OutputProcessor::Unit::J,
    7524           0 :                                         Secondary(secondNum).ReceiverHeatGainEnergy,
    7525             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    7526             :                                         OutputProcessor::SOVStoreType::Summed,
    7527           0 :                                         Secondary(secondNum).Name);
    7528             :                 } else { // Secondary loop serves cases and walk-ins on zone(load) time step
    7529           8 :                     SetupOutputVariable(state,
    7530             :                                         "Refrigeration Secondary Loop Pump Electricity Rate",
    7531             :                                         OutputProcessor::Unit::W,
    7532           2 :                                         Secondary(secondNum).PumpPowerTotal,
    7533             :                                         OutputProcessor::SOVTimeStepType::Zone,
    7534             :                                         OutputProcessor::SOVStoreType::Average,
    7535           4 :                                         Secondary(secondNum).Name);
    7536          10 :                     SetupOutputVariable(state,
    7537             :                                         "Refrigeration Secondary Loop Pump Electricity Energy",
    7538             :                                         OutputProcessor::Unit::J,
    7539           2 :                                         Secondary(secondNum).PumpElecEnergyTotal,
    7540             :                                         OutputProcessor::SOVTimeStepType::Zone,
    7541             :                                         OutputProcessor::SOVStoreType::Summed,
    7542           2 :                                         Secondary(secondNum).Name,
    7543             :                                         _,
    7544             :                                         "ELECTRICITY",
    7545             :                                         "REFRIGERATION",
    7546           2 :                                         Secondary(secondNum).EndUseSubcategory,
    7547           2 :                                         "Plant");
    7548           8 :                     SetupOutputVariable(state,
    7549             :                                         "Refrigeration Secondary Loop Load Heat Transfer Rate",
    7550             :                                         OutputProcessor::Unit::W,
    7551           2 :                                         Secondary(secondNum).TotalRefrigLoad,
    7552             :                                         OutputProcessor::SOVTimeStepType::Zone,
    7553             :                                         OutputProcessor::SOVStoreType::Average,
    7554           4 :                                         Secondary(secondNum).Name);
    7555           8 :                     SetupOutputVariable(state,
    7556             :                                         "Refrigeration Secondary Loop Load Heat Transfer Energy",
    7557             :                                         OutputProcessor::Unit::J,
    7558           2 :                                         Secondary(secondNum).TotalRefrigEnergy,
    7559             :                                         OutputProcessor::SOVTimeStepType::Zone,
    7560             :                                         OutputProcessor::SOVStoreType::Summed,
    7561           4 :                                         Secondary(secondNum).Name);
    7562           8 :                     SetupOutputVariable(state,
    7563             :                                         "Refrigeration Secondary Loop Total Heat Transfer Rate",
    7564             :                                         OutputProcessor::Unit::W,
    7565           2 :                                         Secondary(secondNum).TotalCoolingLoad,
    7566             :                                         OutputProcessor::SOVTimeStepType::Zone,
    7567             :                                         OutputProcessor::SOVStoreType::Average,
    7568           4 :                                         Secondary(secondNum).Name);
    7569           8 :                     SetupOutputVariable(state,
    7570             :                                         "Refrigeration Secondary Loop Total Heat Transfer Energy",
    7571             :                                         OutputProcessor::Unit::J,
    7572           2 :                                         Secondary(secondNum).TotalCoolingEnergy,
    7573             :                                         OutputProcessor::SOVTimeStepType::Zone,
    7574             :                                         OutputProcessor::SOVStoreType::Summed,
    7575           4 :                                         Secondary(secondNum).Name);
    7576           8 :                     SetupOutputVariable(state,
    7577             :                                         "Refrigeration Secondary Loop Estimated Refrigerant Inventory Mass",
    7578             :                                         OutputProcessor::Unit::kg,
    7579           2 :                                         Secondary(secondNum).RefInventory,
    7580             :                                         OutputProcessor::SOVTimeStepType::Zone,
    7581             :                                         OutputProcessor::SOVStoreType::Average,
    7582           4 :                                         Secondary(secondNum).Name);
    7583           8 :                     SetupOutputVariable(state,
    7584             :                                         "Refrigeration Secondary Loop Volume Flow Rate",
    7585             :                                         OutputProcessor::Unit::m3_s,
    7586           2 :                                         Secondary(secondNum).FlowVolActual,
    7587             :                                         OutputProcessor::SOVTimeStepType::Zone,
    7588             :                                         OutputProcessor::SOVStoreType::Average,
    7589           4 :                                         Secondary(secondNum).Name);
    7590           8 :                     SetupOutputVariable(state,
    7591             :                                         "Refrigeration Secondary Loop Pipe Heat Gain Rate",
    7592             :                                         OutputProcessor::Unit::W,
    7593           2 :                                         Secondary(secondNum).DistPipeHeatGain,
    7594             :                                         OutputProcessor::SOVTimeStepType::Zone,
    7595             :                                         OutputProcessor::SOVStoreType::Average,
    7596           4 :                                         Secondary(secondNum).Name);
    7597           8 :                     SetupOutputVariable(state,
    7598             :                                         "Refrigeration Secondary Loop Pipe Heat Gain Energy",
    7599             :                                         OutputProcessor::Unit::J,
    7600           2 :                                         Secondary(secondNum).DistPipeHeatGainEnergy,
    7601             :                                         OutputProcessor::SOVTimeStepType::Zone,
    7602             :                                         OutputProcessor::SOVStoreType::Summed,
    7603           4 :                                         Secondary(secondNum).Name);
    7604           8 :                     SetupOutputVariable(state,
    7605             :                                         "Refrigeration Secondary Loop Receiver Heat Gain Rate",
    7606             :                                         OutputProcessor::Unit::W,
    7607           2 :                                         Secondary(secondNum).ReceiverHeatGain,
    7608             :                                         OutputProcessor::SOVTimeStepType::Zone,
    7609             :                                         OutputProcessor::SOVStoreType::Average,
    7610           4 :                                         Secondary(secondNum).Name);
    7611           8 :                     SetupOutputVariable(state,
    7612             :                                         "Refrigeration Secondary Loop Receiver Heat Gain Energy",
    7613             :                                         OutputProcessor::Unit::J,
    7614           2 :                                         Secondary(secondNum).ReceiverHeatGainEnergy,
    7615             :                                         OutputProcessor::SOVTimeStepType::Zone,
    7616             :                                         OutputProcessor::SOVStoreType::Summed,
    7617           4 :                                         Secondary(secondNum).Name);
    7618             :                 } // NOT coilflag so on Zone timestep
    7619           2 :                 if (Secondary(secondNum).ReceiverZoneNum > 0) {
    7620           3 :                     SetupZoneInternalGain(state,
    7621           1 :                                           Secondary(secondNum).ReceiverZoneNum,
    7622           1 :                                           Secondary(secondNum).Name,
    7623             :                                           DataHeatBalance::IntGainType::RefrigerationSecondaryReceiver,
    7624           1 :                                           &Secondary(secondNum).ReceiverZoneHeatGain);
    7625             :                 }
    7626           2 :                 if (Secondary(secondNum).DistPipeZoneNum > 0) {
    7627           6 :                     SetupZoneInternalGain(state,
    7628           2 :                                           Secondary(secondNum).DistPipeZoneNum,
    7629           2 :                                           Secondary(secondNum).Name,
    7630             :                                           DataHeatBalance::IntGainType::RefrigerationSecondaryPipe,
    7631           2 :                                           &Secondary(secondNum).DistPipeZoneHeatGain);
    7632             :                 }
    7633             :             } // not an unused
    7634             :         }     // NumSimulationSecondarySystems
    7635             :     }         // NumSimulationSecondarySystems > 0
    7636             : 
    7637             :     // Setup Report Variables for Refrigeration Compressor Rack
    7638         771 :     if (state.dataRefrigCase->NumRefrigeratedRacks > 0) {
    7639             :         // CurrentModuleObject='Refrigeration:CompressorRack'
    7640          89 :         for (int rackNum = 1; rackNum <= state.dataRefrigCase->NumRefrigeratedRacks; ++rackNum) {
    7641          59 :             if (RefrigRack(rackNum).CoilFlag) { // rack serves chillers and is solved on HVAC time step
    7642           0 :                 SetupOutputVariable(state,
    7643             :                                     "Refrigeration Air Chiller Compressor Rack Electricity Rate",
    7644             :                                     OutputProcessor::Unit::W,
    7645           0 :                                     RefrigRack(rackNum).RackCompressorPower,
    7646             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7647             :                                     OutputProcessor::SOVStoreType::Average,
    7648           0 :                                     RefrigRack(rackNum).Name);
    7649           0 :                 SetupOutputVariable(state,
    7650             :                                     "Refrigeration Air Chiller Compressor Rack Electricity Energy",
    7651             :                                     OutputProcessor::Unit::J,
    7652           0 :                                     RefrigRack(rackNum).RackElecConsumption,
    7653             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7654             :                                     OutputProcessor::SOVStoreType::Summed,
    7655           0 :                                     RefrigRack(rackNum).Name,
    7656             :                                     _,
    7657             :                                     "ELECTRICITY",
    7658             :                                     "REFRIGERATION",
    7659           0 :                                     RefrigRack(rackNum).EndUseSubcategory,
    7660           0 :                                     "Plant");
    7661           0 :                 SetupOutputVariable(state,
    7662             :                                     "Refrigeration Air Chiller Compressor Rack Condenser Fan Electricity Rate",
    7663             :                                     OutputProcessor::Unit::W,
    7664           0 :                                     RefrigRack(rackNum).ActualCondenserFanPower,
    7665             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7666             :                                     OutputProcessor::SOVStoreType::Average,
    7667           0 :                                     RefrigRack(rackNum).Name);
    7668           0 :                 SetupOutputVariable(state,
    7669             :                                     "Refrigeration Air Chiller Compressor Rack Condenser Fan Electricity Energy",
    7670             :                                     OutputProcessor::Unit::J,
    7671           0 :                                     RefrigRack(rackNum).CondenserFanConsumption,
    7672             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7673             :                                     OutputProcessor::SOVStoreType::Summed,
    7674           0 :                                     RefrigRack(rackNum).Name,
    7675             :                                     _,
    7676             :                                     "ELECTRICITY",
    7677             :                                     "REFRIGERATION",
    7678           0 :                                     RefrigRack(rackNum).EndUseSubcategory,
    7679           0 :                                     "Plant");
    7680           0 :                 SetupOutputVariable(state,
    7681             :                                     "Refrigeration Air Chiller Compressor Rack Total Heat Transfer Rate",
    7682             :                                     OutputProcessor::Unit::W,
    7683           0 :                                     RefrigRack(rackNum).RackCapacity,
    7684             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7685             :                                     OutputProcessor::SOVStoreType::Average,
    7686           0 :                                     RefrigRack(rackNum).Name);
    7687           0 :                 SetupOutputVariable(state,
    7688             :                                     "Refrigeration Air Chiller Compressor Rack Total Heat Transfer Energy",
    7689             :                                     OutputProcessor::Unit::J,
    7690           0 :                                     RefrigRack(rackNum).RackCoolingEnergy,
    7691             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7692             :                                     OutputProcessor::SOVStoreType::Summed,
    7693           0 :                                     RefrigRack(rackNum).Name,
    7694             :                                     _,
    7695             :                                     "ENERGYTRANSFER",
    7696             :                                     "REFRIGERATION",
    7697           0 :                                     RefrigRack(rackNum).EndUseSubcategory,
    7698           0 :                                     "Plant");
    7699           0 :                 SetupOutputVariable(state,
    7700             :                                     "Refrigeration Air Chiller Compressor Rack COP",
    7701             :                                     OutputProcessor::Unit::W_W,
    7702           0 :                                     RefrigRack(rackNum).RackCompressorCOP,
    7703             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7704             :                                     OutputProcessor::SOVStoreType::Average,
    7705           0 :                                     RefrigRack(rackNum).Name);
    7706             : 
    7707           0 :                 if (RefrigRack(rackNum).CondenserType == DataHeatBalance::RefrigCondenserType::Evap) {
    7708           0 :                     SetupOutputVariable(state,
    7709             :                                         "Refrigeration Air Chiller Compressor Rack Evaporative Condenser Pump Electricity Rate",
    7710             :                                         OutputProcessor::Unit::W,
    7711           0 :                                         RefrigRack(rackNum).ActualEvapPumpPower,
    7712             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    7713             :                                         OutputProcessor::SOVStoreType::Average,
    7714           0 :                                         RefrigRack(rackNum).Name);
    7715           0 :                     SetupOutputVariable(state,
    7716             :                                         "Refrigeration Air Chiller Compressor Rack Evaporative Condenser Pump Electricity Energy",
    7717             :                                         OutputProcessor::Unit::J,
    7718           0 :                                         RefrigRack(rackNum).EvapPumpConsumption,
    7719             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    7720             :                                         OutputProcessor::SOVStoreType::Summed,
    7721           0 :                                         RefrigRack(rackNum).Name,
    7722             :                                         _,
    7723             :                                         "ELECTRICITY",
    7724             :                                         "REFRIGERATION",
    7725           0 :                                         RefrigRack(rackNum).EndUseSubcategory,
    7726           0 :                                         "Plant");
    7727           0 :                     SetupOutputVariable(state,
    7728             :                                         "Refrigeration Air Chiller Compressor Rack Evaporative Condenser Basin Heater Electricity Rate",
    7729             :                                         OutputProcessor::Unit::W,
    7730           0 :                                         RefrigRack(rackNum).BasinHeaterPower,
    7731             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    7732             :                                         OutputProcessor::SOVStoreType::Average,
    7733           0 :                                         RefrigRack(rackNum).Name);
    7734           0 :                     SetupOutputVariable(state,
    7735             :                                         "Refrigeration Air Chiller Compressor Rack Evaporative Condenser Basin Heater Electricity Energy",
    7736             :                                         OutputProcessor::Unit::J,
    7737           0 :                                         RefrigRack(rackNum).BasinHeaterConsumption,
    7738             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    7739             :                                         OutputProcessor::SOVStoreType::Summed,
    7740           0 :                                         RefrigRack(rackNum).Name,
    7741             :                                         _,
    7742             :                                         "ELECTRICITY",
    7743             :                                         "REFRIGERATION",
    7744           0 :                                         RefrigRack(rackNum).EndUseSubcategory,
    7745           0 :                                         "Plant");
    7746           0 :                     SetupOutputVariable(state,
    7747             :                                         "Refrigeration Air Chiller Compressor Rack Evaporative Condenser Water Volume Flow Rate",
    7748             :                                         OutputProcessor::Unit::m3_s,
    7749           0 :                                         RefrigRack(rackNum).EvapWaterConsumpRate,
    7750             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    7751             :                                         OutputProcessor::SOVStoreType::Average,
    7752           0 :                                         RefrigRack(rackNum).Name);
    7753           0 :                     SetupOutputVariable(state,
    7754             :                                         "Refrigeration Air Chiller Compressor Rack Evaporative Condenser Water Volume",
    7755             :                                         OutputProcessor::Unit::m3,
    7756           0 :                                         RefrigRack(rackNum).EvapWaterConsumption,
    7757             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    7758             :                                         OutputProcessor::SOVStoreType::Summed,
    7759           0 :                                         RefrigRack(rackNum).Name,
    7760             :                                         _,
    7761             :                                         "Water",
    7762             :                                         "REFRIGERATION",
    7763           0 :                                         RefrigRack(rackNum).EndUseSubcategory,
    7764           0 :                                         "Plant");
    7765             :                 } // Evap condenser
    7766             : 
    7767           0 :                 if (RefrigRack(rackNum).HeatRejectionLocation == HeatRejLocation::Zone) {
    7768           0 :                     SetupOutputVariable(state,
    7769             :                                         "Refrigeration Air Chiller Compressor Rack Zone Sensible Heating Rate",
    7770             :                                         OutputProcessor::Unit::W,
    7771           0 :                                         RefrigRack(rackNum).SensZoneCreditHeatRate,
    7772             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    7773             :                                         OutputProcessor::SOVStoreType::Average,
    7774           0 :                                         RefrigRack(rackNum).Name);
    7775           0 :                     SetupOutputVariable(state,
    7776             :                                         "Refrigeration Air Chiller Compressor Rack Zone Sensible Heating Energy",
    7777             :                                         OutputProcessor::Unit::J,
    7778           0 :                                         RefrigRack(rackNum).SensZoneCreditHeat,
    7779             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    7780             :                                         OutputProcessor::SOVStoreType::Summed,
    7781           0 :                                         RefrigRack(rackNum).Name);
    7782             : 
    7783           0 :                     SetupOutputVariable(state,
    7784             :                                         "Refrigeration Air Chiller Compressor Rack Return Air Sensible Heating Rate",
    7785             :                                         OutputProcessor::Unit::W,
    7786           0 :                                         RefrigRack(rackNum).SensHVACCreditHeatRate,
    7787             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    7788             :                                         OutputProcessor::SOVStoreType::Average,
    7789           0 :                                         RefrigRack(rackNum).Name);
    7790           0 :                     SetupOutputVariable(state,
    7791             :                                         "Refrigeration Air Chiller Compressor Rack Return Air Sensible Heating Energy",
    7792             :                                         OutputProcessor::Unit::J,
    7793           0 :                                         RefrigRack(rackNum).SensHVACCreditHeat,
    7794             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    7795             :                                         OutputProcessor::SOVStoreType::Summed,
    7796           0 :                                         RefrigRack(rackNum).Name);
    7797             : 
    7798           0 :                     SetupZoneInternalGain(state,
    7799           0 :                                           RefrigCase(RefrigRack(rackNum).CaseNum(1)).ActualZoneNum,
    7800           0 :                                           RefrigRack(rackNum).Name,
    7801             :                                           DataHeatBalance::IntGainType::RefrigerationCompressorRack,
    7802           0 :                                           &RefrigRack(rackNum).SensZoneCreditHeatRate,
    7803           0 :                                           &RefrigRack(rackNum).SensHVACCreditHeatRate);
    7804             : 
    7805             :                 } // LocationZone
    7806             : 
    7807             :             } else { // Rack serves cases and walkins on zone (load) time step
    7808             : 
    7809         236 :                 SetupOutputVariable(state,
    7810             :                                     "Refrigeration Compressor Rack Electricity Rate",
    7811             :                                     OutputProcessor::Unit::W,
    7812          59 :                                     RefrigRack(rackNum).RackCompressorPower,
    7813             :                                     OutputProcessor::SOVTimeStepType::Zone,
    7814             :                                     OutputProcessor::SOVStoreType::Average,
    7815         118 :                                     RefrigRack(rackNum).Name);
    7816         295 :                 SetupOutputVariable(state,
    7817             :                                     "Refrigeration Compressor Rack Electricity Energy",
    7818             :                                     OutputProcessor::Unit::J,
    7819          59 :                                     RefrigRack(rackNum).RackElecConsumption,
    7820             :                                     OutputProcessor::SOVTimeStepType::Zone,
    7821             :                                     OutputProcessor::SOVStoreType::Summed,
    7822          59 :                                     RefrigRack(rackNum).Name,
    7823             :                                     _,
    7824             :                                     "ELECTRICITY",
    7825             :                                     "REFRIGERATION",
    7826          59 :                                     RefrigRack(rackNum).EndUseSubcategory,
    7827          59 :                                     "Plant");
    7828         236 :                 SetupOutputVariable(state,
    7829             :                                     "Refrigeration Compressor Rack Condenser Fan Electricity Rate",
    7830             :                                     OutputProcessor::Unit::W,
    7831          59 :                                     RefrigRack(rackNum).ActualCondenserFanPower,
    7832             :                                     OutputProcessor::SOVTimeStepType::Zone,
    7833             :                                     OutputProcessor::SOVStoreType::Average,
    7834         118 :                                     RefrigRack(rackNum).Name);
    7835         295 :                 SetupOutputVariable(state,
    7836             :                                     "Refrigeration Compressor Rack Condenser Fan Electricity Energy",
    7837             :                                     OutputProcessor::Unit::J,
    7838          59 :                                     RefrigRack(rackNum).CondenserFanConsumption,
    7839             :                                     OutputProcessor::SOVTimeStepType::Zone,
    7840             :                                     OutputProcessor::SOVStoreType::Summed,
    7841          59 :                                     RefrigRack(rackNum).Name,
    7842             :                                     _,
    7843             :                                     "ELECTRICITY",
    7844             :                                     "REFRIGERATION",
    7845          59 :                                     RefrigRack(rackNum).EndUseSubcategory,
    7846          59 :                                     "Plant");
    7847         236 :                 SetupOutputVariable(state,
    7848             :                                     "Refrigeration Compressor Rack Total Heat Transfer Rate",
    7849             :                                     OutputProcessor::Unit::W,
    7850          59 :                                     RefrigRack(rackNum).RackCapacity,
    7851             :                                     OutputProcessor::SOVTimeStepType::Zone,
    7852             :                                     OutputProcessor::SOVStoreType::Average,
    7853         118 :                                     RefrigRack(rackNum).Name);
    7854         295 :                 SetupOutputVariable(state,
    7855             :                                     "Refrigeration Compressor Rack Total Heat Transfer Energy",
    7856             :                                     OutputProcessor::Unit::J,
    7857          59 :                                     RefrigRack(rackNum).RackCoolingEnergy,
    7858             :                                     OutputProcessor::SOVTimeStepType::Zone,
    7859             :                                     OutputProcessor::SOVStoreType::Summed,
    7860          59 :                                     RefrigRack(rackNum).Name,
    7861             :                                     _,
    7862             :                                     "ENERGYTRANSFER",
    7863             :                                     "REFRIGERATION",
    7864          59 :                                     RefrigRack(rackNum).EndUseSubcategory,
    7865          59 :                                     "Plant");
    7866         236 :                 SetupOutputVariable(state,
    7867             :                                     "Refrigeration Compressor Rack COP",
    7868             :                                     OutputProcessor::Unit::W_W,
    7869          59 :                                     RefrigRack(rackNum).RackCompressorCOP,
    7870             :                                     OutputProcessor::SOVTimeStepType::Zone,
    7871             :                                     OutputProcessor::SOVStoreType::Average,
    7872         118 :                                     RefrigRack(rackNum).Name);
    7873             : 
    7874          59 :                 if (RefrigRack(rackNum).CondenserType == DataHeatBalance::RefrigCondenserType::Evap) {
    7875           8 :                     SetupOutputVariable(state,
    7876             :                                         "Refrigeration Compressor Rack Evaporative Condenser Pump Electricity Rate",
    7877             :                                         OutputProcessor::Unit::W,
    7878           2 :                                         RefrigRack(rackNum).ActualEvapPumpPower,
    7879             :                                         OutputProcessor::SOVTimeStepType::Zone,
    7880             :                                         OutputProcessor::SOVStoreType::Average,
    7881           4 :                                         RefrigRack(rackNum).Name);
    7882          10 :                     SetupOutputVariable(state,
    7883             :                                         "Refrigeration Compressor Rack Evaporative Condenser Pump Electricity Energy",
    7884             :                                         OutputProcessor::Unit::J,
    7885           2 :                                         RefrigRack(rackNum).EvapPumpConsumption,
    7886             :                                         OutputProcessor::SOVTimeStepType::Zone,
    7887             :                                         OutputProcessor::SOVStoreType::Summed,
    7888           2 :                                         RefrigRack(rackNum).Name,
    7889             :                                         _,
    7890             :                                         "ELECTRICITY",
    7891             :                                         "REFRIGERATION",
    7892           2 :                                         RefrigRack(rackNum).EndUseSubcategory,
    7893           2 :                                         "Plant");
    7894           8 :                     SetupOutputVariable(state,
    7895             :                                         "Refrigeration Compressor Rack Evaporative Condenser Basin Heater Electricity Rate",
    7896             :                                         OutputProcessor::Unit::W,
    7897           2 :                                         RefrigRack(rackNum).BasinHeaterPower,
    7898             :                                         OutputProcessor::SOVTimeStepType::Zone,
    7899             :                                         OutputProcessor::SOVStoreType::Average,
    7900           4 :                                         RefrigRack(rackNum).Name);
    7901          10 :                     SetupOutputVariable(state,
    7902             :                                         "Refrigeration Compressor Rack Evaporative Condenser Basin Heater Electricity Energy",
    7903             :                                         OutputProcessor::Unit::J,
    7904           2 :                                         RefrigRack(rackNum).BasinHeaterConsumption,
    7905             :                                         OutputProcessor::SOVTimeStepType::Zone,
    7906             :                                         OutputProcessor::SOVStoreType::Summed,
    7907           2 :                                         RefrigRack(rackNum).Name,
    7908             :                                         _,
    7909             :                                         "ELECTRICITY",
    7910             :                                         "REFRIGERATION",
    7911           2 :                                         RefrigRack(rackNum).EndUseSubcategory,
    7912           2 :                                         "Plant");
    7913           8 :                     SetupOutputVariable(state,
    7914             :                                         "Refrigeration Compressor Rack Evaporative Condenser Water Volume Flow Rate",
    7915             :                                         OutputProcessor::Unit::m3_s,
    7916           2 :                                         RefrigRack(rackNum).EvapWaterConsumpRate,
    7917             :                                         OutputProcessor::SOVTimeStepType::Zone,
    7918             :                                         OutputProcessor::SOVStoreType::Average,
    7919           4 :                                         RefrigRack(rackNum).Name);
    7920          10 :                     SetupOutputVariable(state,
    7921             :                                         "Refrigeration Compressor Rack Evaporative Condenser Water Volume",
    7922             :                                         OutputProcessor::Unit::m3,
    7923           2 :                                         RefrigRack(rackNum).EvapWaterConsumption,
    7924             :                                         OutputProcessor::SOVTimeStepType::Zone,
    7925             :                                         OutputProcessor::SOVStoreType::Summed,
    7926           2 :                                         RefrigRack(rackNum).Name,
    7927             :                                         _,
    7928             :                                         "Water",
    7929             :                                         "REFRIGERATION",
    7930           2 :                                         RefrigRack(rackNum).EndUseSubcategory,
    7931           2 :                                         "Plant");
    7932             :                 } // condenser evap
    7933             : 
    7934          59 :                 if (RefrigRack(rackNum).HeatRejectionLocation == HeatRejLocation::Zone) {
    7935         108 :                     SetupOutputVariable(state,
    7936             :                                         "Refrigeration Compressor Rack Zone Sensible Heating Rate",
    7937             :                                         OutputProcessor::Unit::W,
    7938          27 :                                         RefrigRack(rackNum).SensZoneCreditHeatRate,
    7939             :                                         OutputProcessor::SOVTimeStepType::Zone,
    7940             :                                         OutputProcessor::SOVStoreType::Average,
    7941          54 :                                         RefrigRack(rackNum).Name);
    7942         108 :                     SetupOutputVariable(state,
    7943             :                                         "Refrigeration Compressor Rack Zone Sensible Heating Energy",
    7944             :                                         OutputProcessor::Unit::J,
    7945          27 :                                         RefrigRack(rackNum).SensZoneCreditHeat,
    7946             :                                         OutputProcessor::SOVTimeStepType::Zone,
    7947             :                                         OutputProcessor::SOVStoreType::Summed,
    7948          54 :                                         RefrigRack(rackNum).Name);
    7949             : 
    7950         108 :                     SetupOutputVariable(state,
    7951             :                                         "Refrigeration Compressor Rack Return Air Sensible Heating Rate",
    7952             :                                         OutputProcessor::Unit::W,
    7953          27 :                                         RefrigRack(rackNum).SensHVACCreditHeatRate,
    7954             :                                         OutputProcessor::SOVTimeStepType::Zone,
    7955             :                                         OutputProcessor::SOVStoreType::Average,
    7956          54 :                                         RefrigRack(rackNum).Name);
    7957         108 :                     SetupOutputVariable(state,
    7958             :                                         "Refrigeration Compressor Rack Return Air Sensible Heating Energy",
    7959             :                                         OutputProcessor::Unit::J,
    7960          27 :                                         RefrigRack(rackNum).SensHVACCreditHeat,
    7961             :                                         OutputProcessor::SOVTimeStepType::Zone,
    7962             :                                         OutputProcessor::SOVStoreType::Summed,
    7963          54 :                                         RefrigRack(rackNum).Name);
    7964         108 :                     SetupZoneInternalGain(state,
    7965          27 :                                           RefrigCase(RefrigRack(rackNum).CaseNum(1)).ActualZoneNum,
    7966          27 :                                           RefrigRack(rackNum).Name,
    7967             :                                           DataHeatBalance::IntGainType::RefrigerationCompressorRack,
    7968          27 :                                           &RefrigRack(rackNum).SensZoneCreditHeatRate,
    7969          27 :                                           &RefrigRack(rackNum).SensHVACCreditHeatRate);
    7970             : 
    7971             :                 } // location zone
    7972             :             }     // Serves coils or case/walkin loads
    7973             : 
    7974          59 :             if (RefrigRack(rackNum).CondenserType == DataHeatBalance::RefrigCondenserType::Water) { // on HVAC time step no matter what
    7975           4 :                 SetupOutputVariable(state,
    7976             :                                     "Refrigeration Compressor Rack Condenser Mass Flow Rate",
    7977             :                                     OutputProcessor::Unit::kg_s,
    7978           1 :                                     RefrigRack(rackNum).MassFlowRate,
    7979             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7980             :                                     OutputProcessor::SOVStoreType::Average,
    7981           2 :                                     RefrigRack(rackNum).Name);
    7982             : 
    7983           4 :                 SetupOutputVariable(state,
    7984             :                                     "Refrigeration Compressor Rack Condenser Heat Transfer Rate",
    7985             :                                     OutputProcessor::Unit::W,
    7986           1 :                                     RefrigRack(rackNum).CondLoad,
    7987             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7988             :                                     OutputProcessor::SOVStoreType::Average,
    7989           2 :                                     RefrigRack(rackNum).Name);
    7990             : 
    7991           4 :                 SetupOutputVariable(state,
    7992             :                                     "Refrigeration Compressor Rack Condenser Heat Transfer Energy",
    7993             :                                     OutputProcessor::Unit::J,
    7994           1 :                                     RefrigRack(rackNum).CondEnergy,
    7995             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    7996             :                                     OutputProcessor::SOVStoreType::Summed,
    7997           1 :                                     RefrigRack(rackNum).Name,
    7998             :                                     _,
    7999             :                                     "ENERGYTRANSFER",
    8000             :                                     "Heating",
    8001             :                                     _,
    8002           1 :                                     "Plant");
    8003             : 
    8004             :             } // Condenser cooling water
    8005             :         }     // Refrigerated Racks
    8006             :     }         // NumRefrigeratedRacks > 0
    8007             : 
    8008         771 :     if (state.dataRefrigCase->NumRefrigSystems > 0) {
    8009             :         // CurrentModuleObject='Refrigeration:System'
    8010          53 :         for (int refrigSysNum = 1; refrigSysNum <= state.dataRefrigCase->NumRefrigSystems; ++refrigSysNum) {
    8011          39 :             if (System(refrigSysNum).CoilFlag) { // system serves chillers and is solved on HVAC time step
    8012           9 :                 if (System(refrigSysNum).NumStages == 1) {
    8013          36 :                     SetupOutputVariable(state,
    8014             :                                         "Refrigeration Air Chiller System Total Compressor Electricity Rate",
    8015             :                                         OutputProcessor::Unit::W,
    8016           9 :                                         System(refrigSysNum).TotCompPower,
    8017             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8018             :                                         OutputProcessor::SOVStoreType::Average,
    8019          18 :                                         System(refrigSysNum).Name);
    8020          36 :                     SetupOutputVariable(state,
    8021             :                                         "Refrigeration Air Chiller System Total Compressor Electricity Energy",
    8022             :                                         OutputProcessor::Unit::J,
    8023           9 :                                         System(refrigSysNum).TotCompElecConsump,
    8024             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8025             :                                         OutputProcessor::SOVStoreType::Summed,
    8026          18 :                                         System(refrigSysNum).Name);
    8027           0 :                 } else if (System(refrigSysNum).NumStages == 2) {
    8028           0 :                     SetupOutputVariable(state,
    8029             :                                         "Refrigeration Air Chiller System Total Low Stage Compressor Electricity Rate",
    8030             :                                         OutputProcessor::Unit::W,
    8031           0 :                                         System(refrigSysNum).TotCompPower,
    8032             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8033             :                                         OutputProcessor::SOVStoreType::Average,
    8034           0 :                                         System(refrigSysNum).Name);
    8035           0 :                     SetupOutputVariable(state,
    8036             :                                         "Refrigeration Air Chiller System Total Low Stage Compressor Electricity Energy",
    8037             :                                         OutputProcessor::Unit::J,
    8038           0 :                                         System(refrigSysNum).TotCompElecConsump,
    8039             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8040             :                                         OutputProcessor::SOVStoreType::Summed,
    8041           0 :                                         System(refrigSysNum).Name);
    8042           0 :                     SetupOutputVariable(state,
    8043             :                                         "Refrigeration Air Chiller System Total High Stage Compressor Electricity Rate",
    8044             :                                         OutputProcessor::Unit::W,
    8045           0 :                                         System(refrigSysNum).TotHiStageCompPower,
    8046             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8047             :                                         OutputProcessor::SOVStoreType::Average,
    8048           0 :                                         System(refrigSysNum).Name);
    8049           0 :                     SetupOutputVariable(state,
    8050             :                                         "Refrigeration Air Chiller System Total High Stage Compressor Electricity Energy",
    8051             :                                         OutputProcessor::Unit::J,
    8052           0 :                                         System(refrigSysNum).TotHiStageCompElecConsump,
    8053             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8054             :                                         OutputProcessor::SOVStoreType::Summed,
    8055           0 :                                         System(refrigSysNum).Name);
    8056           0 :                     SetupOutputVariable(state,
    8057             :                                         "Refrigeration Air Chiller System Total Low and High Stage Compressor Electricity Energy",
    8058             :                                         OutputProcessor::Unit::J,
    8059           0 :                                         System(refrigSysNum).TotCompElecConsumpTwoStage,
    8060             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8061             :                                         OutputProcessor::SOVStoreType::Summed,
    8062           0 :                                         System(refrigSysNum).Name);
    8063             :                 } // NumStages
    8064          36 :                 SetupOutputVariable(state,
    8065             :                                     "Refrigeration Air Chiller System Average Compressor COP",
    8066             :                                     OutputProcessor::Unit::W_W,
    8067           9 :                                     System(refrigSysNum).AverageCompressorCOP,
    8068             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    8069             :                                     OutputProcessor::SOVStoreType::Average,
    8070          18 :                                     System(refrigSysNum).Name);
    8071          36 :                 SetupOutputVariable(state,
    8072             :                                     "Refrigeration Air Chiller System Total Air Chiller Heat Transfer Rate",
    8073             :                                     OutputProcessor::Unit::W,
    8074           9 :                                     System(refrigSysNum).TotalCoolingLoad,
    8075             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    8076             :                                     OutputProcessor::SOVStoreType::Average,
    8077          18 :                                     System(refrigSysNum).Name);
    8078          36 :                 SetupOutputVariable(state,
    8079             :                                     "Refrigeration Air Chiller System Total Case and Walk In Heat Transfer Energy",
    8080             :                                     OutputProcessor::Unit::J,
    8081           9 :                                     System(refrigSysNum).TotalCoolingEnergy,
    8082             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    8083             :                                     OutputProcessor::SOVStoreType::Summed,
    8084          18 :                                     System(refrigSysNum).Name);
    8085          36 :                 SetupOutputVariable(state,
    8086             :                                     "Refrigeration Air Chiller System Total Transferred Load Heat Transfer Rate",
    8087             :                                     OutputProcessor::Unit::W,
    8088           9 :                                     System(refrigSysNum).TotTransferLoad,
    8089             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    8090             :                                     OutputProcessor::SOVStoreType::Average,
    8091          18 :                                     System(refrigSysNum).Name);
    8092          36 :                 SetupOutputVariable(state,
    8093             :                                     "Refrigeration Air Chiller System Total Transferred Load Heat Transfer Energy",
    8094             :                                     OutputProcessor::Unit::J,
    8095           9 :                                     System(refrigSysNum).TotTransferEnergy,
    8096             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    8097             :                                     OutputProcessor::SOVStoreType::Summed,
    8098          18 :                                     System(refrigSysNum).Name);
    8099          36 :                 SetupOutputVariable(state,
    8100             :                                     "Refrigeration Air Chiller System Total Suction Pipe Heat Gain Rate",
    8101             :                                     OutputProcessor::Unit::W,
    8102           9 :                                     System(refrigSysNum).PipeHeatLoad,
    8103             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    8104             :                                     OutputProcessor::SOVStoreType::Average,
    8105          18 :                                     System(refrigSysNum).Name);
    8106          36 :                 SetupOutputVariable(state,
    8107             :                                     "Refrigeration Air Chiller System Total Suction Pipe Heat Gain Energy",
    8108             :                                     OutputProcessor::Unit::J,
    8109           9 :                                     System(refrigSysNum).PipeHeatEnergy,
    8110             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    8111             :                                     OutputProcessor::SOVStoreType::Summed,
    8112          18 :                                     System(refrigSysNum).Name);
    8113           9 :                 if (System(refrigSysNum).NumStages == 1) {
    8114          36 :                     SetupOutputVariable(state,
    8115             :                                         "Refrigeration Air Chiller System Total Compressor Heat Transfer Rate",
    8116             :                                         OutputProcessor::Unit::W,
    8117           9 :                                         System(refrigSysNum).TotCompCapacity,
    8118             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8119             :                                         OutputProcessor::SOVStoreType::Average,
    8120          18 :                                         System(refrigSysNum).Name);
    8121          36 :                     SetupOutputVariable(state,
    8122             :                                         "Refrigeration Air Chiller System Total Compressor Heat Transfer Energy",
    8123             :                                         OutputProcessor::Unit::J,
    8124           9 :                                         System(refrigSysNum).TotCompCoolingEnergy,
    8125             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8126             :                                         OutputProcessor::SOVStoreType::Summed,
    8127          18 :                                         System(refrigSysNum).Name); // indiv compressors go to meter, not system sum
    8128           0 :                 } else if (System(refrigSysNum).NumStages == 2) {
    8129           0 :                     SetupOutputVariable(state,
    8130             :                                         "Refrigeration Air Chiller System Total Low Stage Compressor Heat Transfer Rate",
    8131             :                                         OutputProcessor::Unit::W,
    8132           0 :                                         System(refrigSysNum).TotCompCapacity,
    8133             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8134             :                                         OutputProcessor::SOVStoreType::Average,
    8135           0 :                                         System(refrigSysNum).Name);
    8136           0 :                     SetupOutputVariable(state,
    8137             :                                         "Refrigeration Air Chiller System Total Low Stage Compressor Heat Transfer Energy",
    8138             :                                         OutputProcessor::Unit::J,
    8139           0 :                                         System(refrigSysNum).TotCompCoolingEnergy,
    8140             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8141             :                                         OutputProcessor::SOVStoreType::Summed,
    8142           0 :                                         System(refrigSysNum).Name); // indiv compressors go to meter, not system sum
    8143           0 :                     SetupOutputVariable(state,
    8144             :                                         "Refrigeration Air Chiller System Total High Stage Compressor Heat Transfer Rate",
    8145             :                                         OutputProcessor::Unit::W,
    8146           0 :                                         System(refrigSysNum).TotHiStageCompCapacity,
    8147             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8148             :                                         OutputProcessor::SOVStoreType::Average,
    8149           0 :                                         System(refrigSysNum).Name);
    8150           0 :                     SetupOutputVariable(state,
    8151             :                                         "Refrigeration Air Chiller System Total High Stage Compressor Heat Transfer Energy",
    8152             :                                         OutputProcessor::Unit::J,
    8153           0 :                                         System(refrigSysNum).TotHiStageCompCoolingEnergy,
    8154             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8155             :                                         OutputProcessor::SOVStoreType::Summed,
    8156           0 :                                         System(refrigSysNum).Name); // indiv compressors go to meter, not system sum
    8157             :                 }                                                   // NumStages
    8158          36 :                 SetupOutputVariable(state,
    8159             :                                     "Refrigeration Air Chiller System Net Rejected Heat Transfer Rate",
    8160             :                                     OutputProcessor::Unit::W,
    8161           9 :                                     System(refrigSysNum).NetHeatRejectLoad,
    8162             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    8163             :                                     OutputProcessor::SOVStoreType::Average,
    8164          18 :                                     System(refrigSysNum).Name);
    8165          36 :                 SetupOutputVariable(state,
    8166             :                                     "Refrigeration Air Chiller System Net Rejected Heat Transfer Energy",
    8167             :                                     OutputProcessor::Unit::J,
    8168           9 :                                     System(refrigSysNum).NetHeatRejectEnergy,
    8169             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    8170             :                                     OutputProcessor::SOVStoreType::Summed,
    8171          18 :                                     System(refrigSysNum).Name);
    8172          36 :                 SetupOutputVariable(state,
    8173             :                                     "Refrigeration Air Chiller System Estimated Refrigerant Inventory Mass",
    8174             :                                     OutputProcessor::Unit::kg,
    8175           9 :                                     System(refrigSysNum).RefInventory,
    8176             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    8177             :                                     OutputProcessor::SOVStoreType::Average,
    8178          18 :                                     System(refrigSysNum).Name);
    8179           9 :                 if (System(refrigSysNum).NumStages == 1) {
    8180          36 :                     SetupOutputVariable(state,
    8181             :                                         "Refrigeration Air Chiller System Estimated Refrigerant Mass Flow Rate",
    8182             :                                         OutputProcessor::Unit::kg_s,
    8183           9 :                                         System(refrigSysNum).RefMassFlowComps,
    8184             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8185             :                                         OutputProcessor::SOVStoreType::Average,
    8186          18 :                                         System(refrigSysNum).Name);
    8187           0 :                 } else if (System(refrigSysNum).NumStages == 2) {
    8188           0 :                     SetupOutputVariable(state,
    8189             :                                         "Refrigeration Air Chiller System Estimated Low Stage Refrigerant Mass Flow Rate",
    8190             :                                         OutputProcessor::Unit::kg_s,
    8191           0 :                                         System(refrigSysNum).RefMassFlowComps,
    8192             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8193             :                                         OutputProcessor::SOVStoreType::Average,
    8194           0 :                                         System(refrigSysNum).Name);
    8195           0 :                     SetupOutputVariable(state,
    8196             :                                         "Refrigeration Air Chiller System Estimated High Stage Refrigerant Mass Flow Rate",
    8197             :                                         OutputProcessor::Unit::kg_s,
    8198           0 :                                         System(refrigSysNum).RefMassFlowHiStageComps,
    8199             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8200             :                                         OutputProcessor::SOVStoreType::Average,
    8201           0 :                                         System(refrigSysNum).Name);
    8202             :                 } // NumStages
    8203           9 :                 if (System(refrigSysNum).NumStages == 2) {
    8204           0 :                     SetupOutputVariable(state,
    8205             :                                         "Refrigeration Air Chiller System Intercooler Temperature",
    8206             :                                         OutputProcessor::Unit::C,
    8207           0 :                                         System(refrigSysNum).TIntercooler,
    8208             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8209             :                                         OutputProcessor::SOVStoreType::Average,
    8210           0 :                                         System(refrigSysNum).Name);
    8211           0 :                     SetupOutputVariable(state,
    8212             :                                         "Refrigeration Air Chiller System Intercooler Pressure",
    8213             :                                         OutputProcessor::Unit::Pa,
    8214           0 :                                         System(refrigSysNum).PIntercooler,
    8215             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8216             :                                         OutputProcessor::SOVStoreType::Average,
    8217           0 :                                         System(refrigSysNum).Name);
    8218             :                 }
    8219          36 :                 SetupOutputVariable(state,
    8220             :                                     "Refrigeration Air Chiller System Condensing Temperature",
    8221             :                                     OutputProcessor::Unit::C,
    8222           9 :                                     System(refrigSysNum).TCondense,
    8223             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    8224             :                                     OutputProcessor::SOVStoreType::Average,
    8225          18 :                                     System(refrigSysNum).Name);
    8226          36 :                 SetupOutputVariable(state,
    8227             :                                     "Refrigeration Air Chiller System Evaporating Temperature",
    8228             :                                     OutputProcessor::Unit::C,
    8229           9 :                                     System(refrigSysNum).TEvapNeeded,
    8230             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    8231             :                                     OutputProcessor::SOVStoreType::Average,
    8232          18 :                                     System(refrigSysNum).Name);
    8233          36 :                 SetupOutputVariable(state,
    8234             :                                     "Refrigeration Air Chiller System Suction Temperature",
    8235             :                                     OutputProcessor::Unit::C,
    8236           9 :                                     System(refrigSysNum).TCompIn,
    8237             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    8238             :                                     OutputProcessor::SOVStoreType::Average,
    8239          18 :                                     System(refrigSysNum).Name);
    8240          36 :                 SetupOutputVariable(state,
    8241             :                                     "Refrigeration Air Chiller System TXV Liquid Temperature",
    8242             :                                     OutputProcessor::Unit::C,
    8243           9 :                                     System(refrigSysNum).TLiqInActual,
    8244             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    8245             :                                     OutputProcessor::SOVStoreType::Average,
    8246          18 :                                     System(refrigSysNum).Name);
    8247          36 :                 SetupOutputVariable(state,
    8248             :                                     "Refrigeration Air Chiller System Liquid Suction Subcooler Heat Transfer Rate",
    8249             :                                     OutputProcessor::Unit::W,
    8250           9 :                                     System(refrigSysNum).LSHXTrans,
    8251             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    8252             :                                     OutputProcessor::SOVStoreType::Average,
    8253          18 :                                     System(refrigSysNum).Name);
    8254          36 :                 SetupOutputVariable(state,
    8255             :                                     "Refrigeration Air Chiller System Liquid Suction Subcooler Heat Transfer Energy",
    8256             :                                     OutputProcessor::Unit::J,
    8257           9 :                                     System(refrigSysNum).LSHXTransEnergy,
    8258             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    8259             :                                     OutputProcessor::SOVStoreType::Summed,
    8260          18 :                                     System(refrigSysNum).Name);
    8261             :             } else { // NOT System(SysNum)%CoilFlag, so serving loads on zone timestep
    8262          30 :                 if (System(refrigSysNum).NumStages == 1) {
    8263         112 :                     SetupOutputVariable(state,
    8264             :                                         "Refrigeration System Total Compressor Electricity Rate",
    8265             :                                         OutputProcessor::Unit::W,
    8266          28 :                                         System(refrigSysNum).TotCompPower,
    8267             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8268             :                                         OutputProcessor::SOVStoreType::Average,
    8269          56 :                                         System(refrigSysNum).Name);
    8270         112 :                     SetupOutputVariable(state,
    8271             :                                         "Refrigeration System Total Compressor Electricity Energy",
    8272             :                                         OutputProcessor::Unit::J,
    8273          28 :                                         System(refrigSysNum).TotCompElecConsump,
    8274             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8275             :                                         OutputProcessor::SOVStoreType::Summed,
    8276          56 :                                         System(refrigSysNum).Name);
    8277           2 :                 } else if (System(refrigSysNum).NumStages == 2) {
    8278           8 :                     SetupOutputVariable(state,
    8279             :                                         "Refrigeration System Total Low Stage Compressor Electricity Rate",
    8280             :                                         OutputProcessor::Unit::W,
    8281           2 :                                         System(refrigSysNum).TotCompPower,
    8282             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8283             :                                         OutputProcessor::SOVStoreType::Average,
    8284           4 :                                         System(refrigSysNum).Name);
    8285           8 :                     SetupOutputVariable(state,
    8286             :                                         "Refrigeration System Total Low Stage Compressor Electricity Energy",
    8287             :                                         OutputProcessor::Unit::J,
    8288           2 :                                         System(refrigSysNum).TotCompElecConsump,
    8289             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8290             :                                         OutputProcessor::SOVStoreType::Summed,
    8291           4 :                                         System(refrigSysNum).Name);
    8292           8 :                     SetupOutputVariable(state,
    8293             :                                         "Refrigeration System Total High Stage Compressor Electricity Rate",
    8294             :                                         OutputProcessor::Unit::W,
    8295           2 :                                         System(refrigSysNum).TotHiStageCompPower,
    8296             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8297             :                                         OutputProcessor::SOVStoreType::Average,
    8298           4 :                                         System(refrigSysNum).Name);
    8299           8 :                     SetupOutputVariable(state,
    8300             :                                         "Refrigeration System Total High Stage Compressor Electricity Energy",
    8301             :                                         OutputProcessor::Unit::J,
    8302           2 :                                         System(refrigSysNum).TotHiStageCompElecConsump,
    8303             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8304             :                                         OutputProcessor::SOVStoreType::Summed,
    8305           4 :                                         System(refrigSysNum).Name);
    8306           8 :                     SetupOutputVariable(state,
    8307             :                                         "Refrigeration System Total Low and High Stage Compressor Electricity Energy",
    8308             :                                         OutputProcessor::Unit::J,
    8309           2 :                                         System(refrigSysNum).TotCompElecConsumpTwoStage,
    8310             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8311             :                                         OutputProcessor::SOVStoreType::Summed,
    8312           4 :                                         System(refrigSysNum).Name);
    8313             :                 } // NumStages
    8314         120 :                 SetupOutputVariable(state,
    8315             :                                     "Refrigeration System Average Compressor COP",
    8316             :                                     OutputProcessor::Unit::W_W,
    8317          30 :                                     System(refrigSysNum).AverageCompressorCOP,
    8318             :                                     OutputProcessor::SOVTimeStepType::Zone,
    8319             :                                     OutputProcessor::SOVStoreType::Average,
    8320          60 :                                     System(refrigSysNum).Name);
    8321         120 :                 SetupOutputVariable(state,
    8322             :                                     "Refrigeration System Total Cases and Walk Ins Heat Transfer Rate",
    8323             :                                     OutputProcessor::Unit::W,
    8324          30 :                                     System(refrigSysNum).TotalCoolingLoad,
    8325             :                                     OutputProcessor::SOVTimeStepType::Zone,
    8326             :                                     OutputProcessor::SOVStoreType::Average,
    8327          60 :                                     System(refrigSysNum).Name);
    8328         120 :                 SetupOutputVariable(state,
    8329             :                                     "Refrigeration System Total Cases and Walk Ins Heat Transfer Energy",
    8330             :                                     OutputProcessor::Unit::J,
    8331          30 :                                     System(refrigSysNum).TotalCoolingEnergy,
    8332             :                                     OutputProcessor::SOVTimeStepType::Zone,
    8333             :                                     OutputProcessor::SOVStoreType::Summed,
    8334          60 :                                     System(refrigSysNum).Name);
    8335         120 :                 SetupOutputVariable(state,
    8336             :                                     "Refrigeration System Total Transferred Load Heat Transfer Rate",
    8337             :                                     OutputProcessor::Unit::W,
    8338          30 :                                     System(refrigSysNum).TotTransferLoad,
    8339             :                                     OutputProcessor::SOVTimeStepType::Zone,
    8340             :                                     OutputProcessor::SOVStoreType::Average,
    8341          60 :                                     System(refrigSysNum).Name);
    8342         120 :                 SetupOutputVariable(state,
    8343             :                                     "Refrigeration System Total Transferred Load Heat Transfer Energy",
    8344             :                                     OutputProcessor::Unit::J,
    8345          30 :                                     System(refrigSysNum).TotTransferEnergy,
    8346             :                                     OutputProcessor::SOVTimeStepType::Zone,
    8347             :                                     OutputProcessor::SOVStoreType::Summed,
    8348          60 :                                     System(refrigSysNum).Name);
    8349         120 :                 SetupOutputVariable(state,
    8350             :                                     "Refrigeration System Total Suction Pipe Heat Gain Rate",
    8351             :                                     OutputProcessor::Unit::W,
    8352          30 :                                     System(refrigSysNum).PipeHeatLoad,
    8353             :                                     OutputProcessor::SOVTimeStepType::Zone,
    8354             :                                     OutputProcessor::SOVStoreType::Average,
    8355          60 :                                     System(refrigSysNum).Name);
    8356         120 :                 SetupOutputVariable(state,
    8357             :                                     "Refrigeration System Total Suction Pipe Heat Gain Energy",
    8358             :                                     OutputProcessor::Unit::J,
    8359          30 :                                     System(refrigSysNum).PipeHeatEnergy,
    8360             :                                     OutputProcessor::SOVTimeStepType::Zone,
    8361             :                                     OutputProcessor::SOVStoreType::Summed,
    8362          60 :                                     System(refrigSysNum).Name);
    8363          30 :                 if (System(refrigSysNum).NumStages == 1) {
    8364         112 :                     SetupOutputVariable(state,
    8365             :                                         "Refrigeration System Total Compressor Heat Transfer Rate",
    8366             :                                         OutputProcessor::Unit::W,
    8367          28 :                                         System(refrigSysNum).TotCompCapacity,
    8368             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8369             :                                         OutputProcessor::SOVStoreType::Average,
    8370          56 :                                         System(refrigSysNum).Name);
    8371         112 :                     SetupOutputVariable(state,
    8372             :                                         "Refrigeration System Total Compressor Heat Transfer Energy",
    8373             :                                         OutputProcessor::Unit::J,
    8374          28 :                                         System(refrigSysNum).TotCompCoolingEnergy,
    8375             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8376             :                                         OutputProcessor::SOVStoreType::Summed,
    8377          56 :                                         System(refrigSysNum).Name); // indiv compressors go to meter, not system sum
    8378           2 :                 } else if (System(refrigSysNum).NumStages == 2) {
    8379           8 :                     SetupOutputVariable(state,
    8380             :                                         "Refrigeration System Total Low Stage Compressor Heat Transfer Rate",
    8381             :                                         OutputProcessor::Unit::W,
    8382           2 :                                         System(refrigSysNum).TotCompCapacity,
    8383             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8384             :                                         OutputProcessor::SOVStoreType::Average,
    8385           4 :                                         System(refrigSysNum).Name);
    8386           8 :                     SetupOutputVariable(state,
    8387             :                                         "Refrigeration System Total Low Stage Compressor Heat Transfer Energy",
    8388             :                                         OutputProcessor::Unit::J,
    8389           2 :                                         System(refrigSysNum).TotCompCoolingEnergy,
    8390             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8391             :                                         OutputProcessor::SOVStoreType::Summed,
    8392           4 :                                         System(refrigSysNum).Name); // indiv compressors go to meter, not system sum
    8393           8 :                     SetupOutputVariable(state,
    8394             :                                         "Refrigeration System Total High Stage Compressor Heat Transfer Rate",
    8395             :                                         OutputProcessor::Unit::W,
    8396           2 :                                         System(refrigSysNum).TotHiStageCompCapacity,
    8397             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8398             :                                         OutputProcessor::SOVStoreType::Average,
    8399           4 :                                         System(refrigSysNum).Name);
    8400           8 :                     SetupOutputVariable(state,
    8401             :                                         "Refrigeration System Total High Stage Compressor Heat Transfer Energy",
    8402             :                                         OutputProcessor::Unit::J,
    8403           2 :                                         System(refrigSysNum).TotHiStageCompCoolingEnergy,
    8404             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8405             :                                         OutputProcessor::SOVStoreType::Summed,
    8406           4 :                                         System(refrigSysNum).Name); // indiv compressors go to meter, not system sum
    8407             :                 }                                                   // NumStages
    8408         120 :                 SetupOutputVariable(state,
    8409             :                                     "Refrigeration System Net Rejected Heat Transfer Rate",
    8410             :                                     OutputProcessor::Unit::W,
    8411          30 :                                     System(refrigSysNum).NetHeatRejectLoad,
    8412             :                                     OutputProcessor::SOVTimeStepType::Zone,
    8413             :                                     OutputProcessor::SOVStoreType::Average,
    8414          60 :                                     System(refrigSysNum).Name);
    8415         120 :                 SetupOutputVariable(state,
    8416             :                                     "Refrigeration System Net Rejected Heat Transfer Energy",
    8417             :                                     OutputProcessor::Unit::J,
    8418          30 :                                     System(refrigSysNum).NetHeatRejectEnergy,
    8419             :                                     OutputProcessor::SOVTimeStepType::Zone,
    8420             :                                     OutputProcessor::SOVStoreType::Summed,
    8421          60 :                                     System(refrigSysNum).Name);
    8422         120 :                 SetupOutputVariable(state,
    8423             :                                     "Refrigeration System Estimated Refrigerant Inventory Mass",
    8424             :                                     OutputProcessor::Unit::kg,
    8425          30 :                                     System(refrigSysNum).RefInventory,
    8426             :                                     OutputProcessor::SOVTimeStepType::Zone,
    8427             :                                     OutputProcessor::SOVStoreType::Average,
    8428          60 :                                     System(refrigSysNum).Name);
    8429          30 :                 if (System(refrigSysNum).NumStages == 1) {
    8430         112 :                     SetupOutputVariable(state,
    8431             :                                         "Refrigeration System Estimated Refrigerant Mass Flow Rate",
    8432             :                                         OutputProcessor::Unit::kg_s,
    8433          28 :                                         System(refrigSysNum).RefMassFlowComps,
    8434             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8435             :                                         OutputProcessor::SOVStoreType::Average,
    8436          56 :                                         System(refrigSysNum).Name);
    8437           2 :                 } else if (System(refrigSysNum).NumStages == 2) {
    8438           8 :                     SetupOutputVariable(state,
    8439             :                                         "Refrigeration System Estimated Low Stage Refrigerant Mass Flow Rate",
    8440             :                                         OutputProcessor::Unit::kg_s,
    8441           2 :                                         System(refrigSysNum).RefMassFlowComps,
    8442             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8443             :                                         OutputProcessor::SOVStoreType::Average,
    8444           4 :                                         System(refrigSysNum).Name);
    8445           8 :                     SetupOutputVariable(state,
    8446             :                                         "Refrigeration System Estimated High Stage Refrigerant Mass Flow Rate",
    8447             :                                         OutputProcessor::Unit::kg_s,
    8448           2 :                                         System(refrigSysNum).RefMassFlowHiStageComps,
    8449             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8450             :                                         OutputProcessor::SOVStoreType::Average,
    8451           4 :                                         System(refrigSysNum).Name);
    8452             :                 } // NumStages
    8453          30 :                 if (System(refrigSysNum).NumStages == 2) {
    8454           8 :                     SetupOutputVariable(state,
    8455             :                                         "Refrigeration System Intercooler Temperature",
    8456             :                                         OutputProcessor::Unit::C,
    8457           2 :                                         System(refrigSysNum).TIntercooler,
    8458             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8459             :                                         OutputProcessor::SOVStoreType::Average,
    8460           4 :                                         System(refrigSysNum).Name);
    8461           8 :                     SetupOutputVariable(state,
    8462             :                                         "Refrigeration System Intercooler Pressure",
    8463             :                                         OutputProcessor::Unit::Pa,
    8464           2 :                                         System(refrigSysNum).PIntercooler,
    8465             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8466             :                                         OutputProcessor::SOVStoreType::Average,
    8467           4 :                                         System(refrigSysNum).Name);
    8468             :                 }
    8469         120 :                 SetupOutputVariable(state,
    8470             :                                     "Refrigeration System Condensing Temperature",
    8471             :                                     OutputProcessor::Unit::C,
    8472          30 :                                     System(refrigSysNum).TCondense,
    8473             :                                     OutputProcessor::SOVTimeStepType::Zone,
    8474             :                                     OutputProcessor::SOVStoreType::Average,
    8475          60 :                                     System(refrigSysNum).Name);
    8476         120 :                 SetupOutputVariable(state,
    8477             :                                     "Refrigeration System Evaporating Temperature",
    8478             :                                     OutputProcessor::Unit::C,
    8479          30 :                                     System(refrigSysNum).TEvapNeeded,
    8480             :                                     OutputProcessor::SOVTimeStepType::Zone,
    8481             :                                     OutputProcessor::SOVStoreType::Average,
    8482          60 :                                     System(refrigSysNum).Name);
    8483         120 :                 SetupOutputVariable(state,
    8484             :                                     "Refrigeration System Suction Pipe Suction Temperature",
    8485             :                                     OutputProcessor::Unit::C,
    8486          30 :                                     System(refrigSysNum).TCompIn,
    8487             :                                     OutputProcessor::SOVTimeStepType::Zone,
    8488             :                                     OutputProcessor::SOVStoreType::Average,
    8489          60 :                                     System(refrigSysNum).Name);
    8490         120 :                 SetupOutputVariable(state,
    8491             :                                     "Refrigeration System Thermostatic Expansion Valve Liquid Temperature",
    8492             :                                     OutputProcessor::Unit::C,
    8493          30 :                                     System(refrigSysNum).TLiqInActual,
    8494             :                                     OutputProcessor::SOVTimeStepType::Zone,
    8495             :                                     OutputProcessor::SOVStoreType::Average,
    8496          60 :                                     System(refrigSysNum).Name);
    8497         120 :                 SetupOutputVariable(state,
    8498             :                                     "Refrigeration System Liquid Suction Subcooler Heat Transfer Rate",
    8499             :                                     OutputProcessor::Unit::W,
    8500          30 :                                     System(refrigSysNum).LSHXTrans,
    8501             :                                     OutputProcessor::SOVTimeStepType::Zone,
    8502             :                                     OutputProcessor::SOVStoreType::Average,
    8503          60 :                                     System(refrigSysNum).Name);
    8504         120 :                 SetupOutputVariable(state,
    8505             :                                     "Refrigeration System Liquid Suction Subcooler Heat Transfer Energy",
    8506             :                                     OutputProcessor::Unit::J,
    8507          30 :                                     System(refrigSysNum).LSHXTransEnergy,
    8508             :                                     OutputProcessor::SOVTimeStepType::Zone,
    8509             :                                     OutputProcessor::SOVStoreType::Summed,
    8510          60 :                                     System(refrigSysNum).Name);
    8511             :             } // System(coilflag)
    8512             : 
    8513          39 :             if (System(refrigSysNum).SystemRejectHeatToZone) {
    8514           3 :                 if (Condenser(System(refrigSysNum).CondenserNum(1)).InletAirZoneNum > 0)
    8515           9 :                     SetupZoneInternalGain(state,
    8516           3 :                                           Condenser(System(refrigSysNum).CondenserNum(1)).InletAirZoneNum,
    8517           3 :                                           System(refrigSysNum).Name,
    8518             :                                           DataHeatBalance::IntGainType::RefrigerationSystemAirCooledCondenser,
    8519           3 :                                           &System(refrigSysNum).NetHeatRejectLoad);
    8520             : 
    8521           3 :                 if (System(refrigSysNum).SuctionPipeActualZoneNum > 0)
    8522           0 :                     SetupZoneInternalGain(state,
    8523           0 :                                           System(refrigSysNum).SuctionPipeActualZoneNum,
    8524           0 :                                           System(refrigSysNum).Name,
    8525             :                                           DataHeatBalance::IntGainType::RefrigerationSystemSuctionPipe,
    8526           0 :                                           &System(refrigSysNum).PipeHeatLoad);
    8527             :             }
    8528             :         } // numrefrigsystems
    8529             : 
    8530             :         // Report Compressor ENERGY here, not on system level for meters.
    8531         182 :         for (int compNum = 1; compNum <= state.dataRefrigCase->NumSimulationCompressors; ++compNum) {
    8532             :             // CurrentModuleObject='Refrigeration:Compressor'
    8533         168 :             if (Compressor(compNum).NumSysAttach == 1) { // only set up reports for compressors that are used once and only once
    8534         168 :                 if (Compressor(compNum).CoilFlag) {      // Compressor serving system with chillers on HVAC time step
    8535         284 :                     SetupOutputVariable(state,
    8536             :                                         "Refrigeration Air Chiller System Compressor Electricity Rate",
    8537             :                                         OutputProcessor::Unit::W,
    8538          71 :                                         Compressor(compNum).Power,
    8539             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8540             :                                         OutputProcessor::SOVStoreType::Average,
    8541         142 :                                         Compressor(compNum).Name);
    8542         355 :                     SetupOutputVariable(state,
    8543             :                                         "Refrigeration Air Chiller System Compressor Electricity Energy",
    8544             :                                         OutputProcessor::Unit::J,
    8545          71 :                                         Compressor(compNum).ElecConsumption,
    8546             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8547             :                                         OutputProcessor::SOVStoreType::Summed,
    8548          71 :                                         Compressor(compNum).Name,
    8549             :                                         _,
    8550             :                                         "ELECTRICITY",
    8551             :                                         "REFRIGERATION",
    8552          71 :                                         Compressor(compNum).EndUseSubcategory,
    8553          71 :                                         "Plant");
    8554         284 :                     SetupOutputVariable(state,
    8555             :                                         "Refrigeration Air Chiller System Compressor Heat Transfer Rate",
    8556             :                                         OutputProcessor::Unit::W,
    8557          71 :                                         Compressor(compNum).Capacity,
    8558             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8559             :                                         OutputProcessor::SOVStoreType::Average,
    8560         142 :                                         Compressor(compNum).Name);
    8561         284 :                     SetupOutputVariable(state,
    8562             :                                         "Refrigeration Air Chiller System Compressor Heat Transfer Energy",
    8563             :                                         OutputProcessor::Unit::J,
    8564          71 :                                         Compressor(compNum).CoolingEnergy,
    8565             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8566             :                                         OutputProcessor::SOVStoreType::Summed,
    8567         142 :                                         Compressor(compNum).Name);
    8568         284 :                     SetupOutputVariable(state,
    8569             :                                         "Refrigeration Air Chiller System Compressor Runtime Fraction",
    8570             :                                         OutputProcessor::Unit::None,
    8571          71 :                                         Compressor(compNum).LoadFactor,
    8572             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8573             :                                         OutputProcessor::SOVStoreType::Average,
    8574         142 :                                         Compressor(compNum).Name);
    8575             :                 } else { // serve cases/walkins on zone time step
    8576         388 :                     SetupOutputVariable(state,
    8577             :                                         "Refrigeration Compressor Electricity Rate",
    8578             :                                         OutputProcessor::Unit::W,
    8579          97 :                                         Compressor(compNum).Power,
    8580             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8581             :                                         OutputProcessor::SOVStoreType::Average,
    8582         194 :                                         Compressor(compNum).Name);
    8583         485 :                     SetupOutputVariable(state,
    8584             :                                         "Refrigeration Compressor Electricity Energy",
    8585             :                                         OutputProcessor::Unit::J,
    8586          97 :                                         Compressor(compNum).ElecConsumption,
    8587             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8588             :                                         OutputProcessor::SOVStoreType::Summed,
    8589          97 :                                         Compressor(compNum).Name,
    8590             :                                         _,
    8591             :                                         "ELECTRICITY",
    8592             :                                         "REFRIGERATION",
    8593          97 :                                         Compressor(compNum).EndUseSubcategory,
    8594          97 :                                         "Plant");
    8595         388 :                     SetupOutputVariable(state,
    8596             :                                         "Refrigeration Compressor Heat Transfer Rate",
    8597             :                                         OutputProcessor::Unit::W,
    8598          97 :                                         Compressor(compNum).Capacity,
    8599             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8600             :                                         OutputProcessor::SOVStoreType::Average,
    8601         194 :                                         Compressor(compNum).Name);
    8602         388 :                     SetupOutputVariable(state,
    8603             :                                         "Refrigeration Compressor Heat Transfer Energy",
    8604             :                                         OutputProcessor::Unit::J,
    8605          97 :                                         Compressor(compNum).CoolingEnergy,
    8606             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8607             :                                         OutputProcessor::SOVStoreType::Summed,
    8608         194 :                                         Compressor(compNum).Name);
    8609         388 :                     SetupOutputVariable(state,
    8610             :                                         "Refrigeration Compressor Runtime Fraction",
    8611             :                                         OutputProcessor::Unit::None,
    8612          97 :                                         Compressor(compNum).LoadFactor,
    8613             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8614             :                                         OutputProcessor::SOVStoreType::Average,
    8615         194 :                                         Compressor(compNum).Name);
    8616             :                 } // Serve coils on HVAC time step or cases/walkins on Zone time step
    8617             :             }     // NumSysAttach
    8618             :         }         // CompNum on NumSimulationCompressors
    8619             : 
    8620             :         // Report Variables for Refrigeration Condensers
    8621          51 :         for (int condNum = 1; condNum <= state.dataRefrigCase->NumRefrigCondensers; ++condNum) {
    8622             :             // CurrentModuleObject='Refrigeration:Condenser:*'
    8623          37 :             if (Condenser(condNum).CoilFlag) { // Condenser serving system with chillers on HVAC time step
    8624          36 :                 SetupOutputVariable(state,
    8625             :                                     "Refrigeration Air Chiller System Condenser Heat Transfer Rate",
    8626             :                                     OutputProcessor::Unit::W,
    8627           9 :                                     Condenser(condNum).CondLoad,
    8628             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    8629             :                                     OutputProcessor::SOVStoreType::Average,
    8630          18 :                                     Condenser(condNum).Name);
    8631          36 :                 SetupOutputVariable(state,
    8632             :                                     "Refrigeration Air Chiller System Condenser Heat Transfer Energy",
    8633             :                                     OutputProcessor::Unit::J,
    8634           9 :                                     Condenser(condNum).CondEnergy,
    8635             :                                     OutputProcessor::SOVTimeStepType::HVAC,
    8636             :                                     OutputProcessor::SOVStoreType::Summed,
    8637          18 :                                     Condenser(condNum).Name);
    8638             : 
    8639           9 :                 if (Condenser(condNum).CondenserType != DataHeatBalance::RefrigCondenserType::Cascade) {
    8640          36 :                     SetupOutputVariable(state,
    8641             :                                         "Refrigeration Air Chiller System Condenser Total Recovered Heat Transfer Rate",
    8642             :                                         OutputProcessor::Unit::W,
    8643           9 :                                         Condenser(condNum).TotalHeatRecoveredLoad,
    8644             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8645             :                                         OutputProcessor::SOVStoreType::Average,
    8646          18 :                                         Condenser(condNum).Name);
    8647          36 :                     SetupOutputVariable(state,
    8648             :                                         "Refrigeration Air Chiller System Condenser Total Recovered Heat Transfer Energy",
    8649             :                                         OutputProcessor::Unit::J,
    8650           9 :                                         Condenser(condNum).TotalHeatRecoveredEnergy,
    8651             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8652             :                                         OutputProcessor::SOVStoreType::Summed,
    8653          18 :                                         Condenser(condNum).Name);
    8654          36 :                     SetupOutputVariable(state,
    8655             :                                         "Refrigeration Air Chiller System Condenser Non Refrigeration Recovered Heat Transfer Rate",
    8656             :                                         OutputProcessor::Unit::W,
    8657           9 :                                         Condenser(condNum).ExternalHeatRecoveredLoad,
    8658             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8659             :                                         OutputProcessor::SOVStoreType::Average,
    8660          18 :                                         Condenser(condNum).Name);
    8661          36 :                     SetupOutputVariable(state,
    8662             :                                         "Refrigeration Air Chiller System Condenser Non Refrigeration Recovered Heat Transfer Energy",
    8663             :                                         OutputProcessor::Unit::J,
    8664           9 :                                         Condenser(condNum).ExternalEnergyRecovered,
    8665             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8666             :                                         OutputProcessor::SOVStoreType::Summed,
    8667          18 :                                         Condenser(condNum).Name);
    8668          36 :                     SetupOutputVariable(state,
    8669             :                                         "Refrigeration Air Chiller System Condenser Defrost Recovered Heat Transfer Rate",
    8670             :                                         OutputProcessor::Unit::W,
    8671           9 :                                         Condenser(condNum).InternalHeatRecoveredLoad,
    8672             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8673             :                                         OutputProcessor::SOVStoreType::Average,
    8674          18 :                                         Condenser(condNum).Name);
    8675          36 :                     SetupOutputVariable(state,
    8676             :                                         "Refrigeration Air Chiller System Condenser Defrost Recovered Heat Transfer Energy",
    8677             :                                         OutputProcessor::Unit::J,
    8678           9 :                                         Condenser(condNum).InternalEnergyRecovered,
    8679             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8680             :                                         OutputProcessor::SOVStoreType::Summed,
    8681          18 :                                         Condenser(condNum).Name);
    8682             :                 } // not cascade because recovered energy on cascade systems passed up to higher temperature system
    8683             : 
    8684           9 :                 if (Condenser(condNum).CondenserType == DataHeatBalance::RefrigCondenserType::Air) {
    8685          36 :                     SetupOutputVariable(state,
    8686             :                                         "Refrigeration Air Chiller System Condenser Fan Electricity Rate",
    8687             :                                         OutputProcessor::Unit::W,
    8688           9 :                                         Condenser(condNum).ActualFanPower,
    8689             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8690             :                                         OutputProcessor::SOVStoreType::Average,
    8691          18 :                                         Condenser(condNum).Name);
    8692          45 :                     SetupOutputVariable(state,
    8693             :                                         "Refrigeration Air Chiller System Condenser Fan Electricity Energy",
    8694             :                                         OutputProcessor::Unit::J,
    8695           9 :                                         Condenser(condNum).FanElecEnergy,
    8696             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8697             :                                         OutputProcessor::SOVStoreType::Summed,
    8698           9 :                                         Condenser(condNum).Name,
    8699             :                                         _,
    8700             :                                         "ELECTRICITY",
    8701             :                                         "REFRIGERATION",
    8702           9 :                                         Condenser(condNum).EndUseSubcategory,
    8703           9 :                                         "Plant");
    8704             :                 } // Air cooled
    8705             : 
    8706           9 :                 if (Condenser(condNum).CondenserType == DataHeatBalance::RefrigCondenserType::Evap) {
    8707           0 :                     SetupOutputVariable(state,
    8708             :                                         "Refrigeration Air Chiller System Condenser Fan Electricity Rate",
    8709             :                                         OutputProcessor::Unit::W,
    8710           0 :                                         Condenser(condNum).ActualFanPower,
    8711             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8712             :                                         OutputProcessor::SOVStoreType::Average,
    8713           0 :                                         Condenser(condNum).Name);
    8714           0 :                     SetupOutputVariable(state,
    8715             :                                         "Refrigeration Air Chiller System Condenser Fan Electricity Energy",
    8716             :                                         OutputProcessor::Unit::J,
    8717           0 :                                         Condenser(condNum).FanElecEnergy,
    8718             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8719             :                                         OutputProcessor::SOVStoreType::Summed,
    8720           0 :                                         Condenser(condNum).Name,
    8721             :                                         _,
    8722             :                                         "ELECTRICITY",
    8723             :                                         "REFRIGERATION",
    8724           0 :                                         Condenser(condNum).EndUseSubcategory,
    8725           0 :                                         "Plant");
    8726           0 :                     SetupOutputVariable(state,
    8727             :                                         "Refrigeration Air Chiller System Condenser Pump Electricity Rate",
    8728             :                                         OutputProcessor::Unit::W,
    8729           0 :                                         Condenser(condNum).ActualEvapPumpPower,
    8730             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8731             :                                         OutputProcessor::SOVStoreType::Average,
    8732           0 :                                         Condenser(condNum).Name);
    8733           0 :                     SetupOutputVariable(state,
    8734             :                                         "Refrigeration Air Chiller System Condenser Pump Electricity Energy",
    8735             :                                         OutputProcessor::Unit::J,
    8736           0 :                                         Condenser(condNum).EvapPumpConsumption,
    8737             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8738             :                                         OutputProcessor::SOVStoreType::Summed,
    8739           0 :                                         Condenser(condNum).Name,
    8740             :                                         _,
    8741             :                                         "ELECTRICITY",
    8742             :                                         "REFRIGERATION",
    8743           0 :                                         Condenser(condNum).EndUseSubcategory,
    8744           0 :                                         "Plant");
    8745           0 :                     SetupOutputVariable(state,
    8746             :                                         "Refrigeration Air Chiller System Condenser Basin Heater Electricity Rate",
    8747             :                                         OutputProcessor::Unit::W,
    8748           0 :                                         Condenser(condNum).BasinHeaterPower,
    8749             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8750             :                                         OutputProcessor::SOVStoreType::Average,
    8751           0 :                                         Condenser(condNum).Name);
    8752           0 :                     SetupOutputVariable(state,
    8753             :                                         "Refrigeration Air Chiller System Condenser Basin Heater Electricity Energy",
    8754             :                                         OutputProcessor::Unit::J,
    8755           0 :                                         Condenser(condNum).BasinHeaterConsumption,
    8756             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8757             :                                         OutputProcessor::SOVStoreType::Summed,
    8758           0 :                                         Condenser(condNum).Name,
    8759             :                                         _,
    8760             :                                         "ELECTRICITY",
    8761             :                                         "REFRIGERATION",
    8762           0 :                                         Condenser(condNum).EndUseSubcategory,
    8763           0 :                                         "Plant");
    8764           0 :                     SetupOutputVariable(state,
    8765             :                                         "Refrigeration Air Chiller System Condenser Evaporated Water Volume Flow Rate",
    8766             :                                         OutputProcessor::Unit::m3_s,
    8767           0 :                                         Condenser(condNum).EvapWaterConsumpRate,
    8768             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8769             :                                         OutputProcessor::SOVStoreType::Average,
    8770           0 :                                         Condenser(condNum).Name);
    8771           0 :                     SetupOutputVariable(state,
    8772             :                                         "Refrigeration Air Chiller System Condenser Evaporated Water Volume",
    8773             :                                         OutputProcessor::Unit::m3,
    8774           0 :                                         Condenser(condNum).EvapWaterConsumption,
    8775             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8776             :                                         OutputProcessor::SOVStoreType::Summed,
    8777           0 :                                         Condenser(condNum).Name,
    8778             :                                         _,
    8779             :                                         "Water",
    8780             :                                         "REFRIGERATION",
    8781           0 :                                         Condenser(condNum).EndUseSubcategory,
    8782           0 :                                         "Plant");
    8783             :                 } // Evaporative Condenser Variables
    8784             : 
    8785           9 :                 if (Condenser(condNum).CondenserType == DataHeatBalance::RefrigCondenserType::Water) {
    8786           0 :                     SetupOutputVariable(state,
    8787             :                                         "Refrigeration Air Chiller System Condenser Fluid Mass Flow Rate",
    8788             :                                         OutputProcessor::Unit::kg_s,
    8789           0 :                                         Condenser(condNum).MassFlowRate,
    8790             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8791             :                                         OutputProcessor::SOVStoreType::Average,
    8792           0 :                                         Condenser(condNum).Name);
    8793             : 
    8794             :                 } // Water-cooled Condenser variables
    8795             : 
    8796             :             } else { // Serving loads/systems with cases and walkins on zone time step
    8797             : 
    8798         112 :                 SetupOutputVariable(state,
    8799             :                                     "Refrigeration System Condenser Heat Transfer Rate",
    8800             :                                     OutputProcessor::Unit::W,
    8801          28 :                                     Condenser(condNum).CondLoad,
    8802             :                                     OutputProcessor::SOVTimeStepType::Zone,
    8803             :                                     OutputProcessor::SOVStoreType::Average,
    8804          56 :                                     Condenser(condNum).Name);
    8805         112 :                 SetupOutputVariable(state,
    8806             :                                     "Refrigeration System Condenser Heat Transfer Energy",
    8807             :                                     OutputProcessor::Unit::J,
    8808          28 :                                     Condenser(condNum).CondEnergy,
    8809             :                                     OutputProcessor::SOVTimeStepType::Zone,
    8810             :                                     OutputProcessor::SOVStoreType::Summed,
    8811          56 :                                     Condenser(condNum).Name);
    8812             : 
    8813          28 :                 if (Condenser(condNum).CondenserType != DataHeatBalance::RefrigCondenserType::Cascade) {
    8814         108 :                     SetupOutputVariable(state,
    8815             :                                         "Refrigeration System Condenser Total Recovered Heat Transfer Rate",
    8816             :                                         OutputProcessor::Unit::W,
    8817          27 :                                         Condenser(condNum).TotalHeatRecoveredLoad,
    8818             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8819             :                                         OutputProcessor::SOVStoreType::Average,
    8820          54 :                                         Condenser(condNum).Name);
    8821         108 :                     SetupOutputVariable(state,
    8822             :                                         "Refrigeration System Condenser Total Recovered Heat Transfer Energy",
    8823             :                                         OutputProcessor::Unit::J,
    8824          27 :                                         Condenser(condNum).TotalHeatRecoveredEnergy,
    8825             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8826             :                                         OutputProcessor::SOVStoreType::Summed,
    8827          54 :                                         Condenser(condNum).Name);
    8828         108 :                     SetupOutputVariable(state,
    8829             :                                         "Refrigeration System Condenser Non Refrigeration Recovered Heat Transfer Rate",
    8830             :                                         OutputProcessor::Unit::W,
    8831          27 :                                         Condenser(condNum).ExternalHeatRecoveredLoad,
    8832             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8833             :                                         OutputProcessor::SOVStoreType::Average,
    8834          54 :                                         Condenser(condNum).Name);
    8835         108 :                     SetupOutputVariable(state,
    8836             :                                         "Refrigeration System Condenser Non Refrigeration Recovered Heat Transfer Energy",
    8837             :                                         OutputProcessor::Unit::J,
    8838          27 :                                         Condenser(condNum).ExternalEnergyRecovered,
    8839             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8840             :                                         OutputProcessor::SOVStoreType::Summed,
    8841          54 :                                         Condenser(condNum).Name);
    8842         108 :                     SetupOutputVariable(state,
    8843             :                                         "Refrigeration System Condenser Defrost Recovered Heat Transfer Rate",
    8844             :                                         OutputProcessor::Unit::W,
    8845          27 :                                         Condenser(condNum).InternalHeatRecoveredLoad,
    8846             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8847             :                                         OutputProcessor::SOVStoreType::Average,
    8848          54 :                                         Condenser(condNum).Name);
    8849         108 :                     SetupOutputVariable(state,
    8850             :                                         "Refrigeration System Condenser Defrost Recovered Heat Transfer Energy",
    8851             :                                         OutputProcessor::Unit::J,
    8852          27 :                                         Condenser(condNum).InternalEnergyRecovered,
    8853             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8854             :                                         OutputProcessor::SOVStoreType::Summed,
    8855          54 :                                         Condenser(condNum).Name);
    8856             :                 } // not cascade because recovered energy on cascade systems passed up to higher temperature system
    8857             : 
    8858          28 :                 if (Condenser(condNum).CondenserType == DataHeatBalance::RefrigCondenserType::Air) {
    8859          92 :                     SetupOutputVariable(state,
    8860             :                                         "Refrigeration System Condenser Fan Electricity Rate",
    8861             :                                         OutputProcessor::Unit::W,
    8862          23 :                                         Condenser(condNum).ActualFanPower,
    8863             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8864             :                                         OutputProcessor::SOVStoreType::Average,
    8865          46 :                                         Condenser(condNum).Name);
    8866         115 :                     SetupOutputVariable(state,
    8867             :                                         "Refrigeration System Condenser Fan Electricity Energy",
    8868             :                                         OutputProcessor::Unit::J,
    8869          23 :                                         Condenser(condNum).FanElecEnergy,
    8870             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8871             :                                         OutputProcessor::SOVStoreType::Summed,
    8872          23 :                                         Condenser(condNum).Name,
    8873             :                                         _,
    8874             :                                         "ELECTRICITY",
    8875             :                                         "REFRIGERATION",
    8876          23 :                                         Condenser(condNum).EndUseSubcategory,
    8877          23 :                                         "Plant");
    8878             :                 } // Air cooled
    8879             : 
    8880          28 :                 if (Condenser(condNum).CondenserType == DataHeatBalance::RefrigCondenserType::Evap) {
    8881          12 :                     SetupOutputVariable(state,
    8882             :                                         "Refrigeration System Condenser Fan Electricity Rate",
    8883             :                                         OutputProcessor::Unit::W,
    8884           3 :                                         Condenser(condNum).ActualFanPower,
    8885             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8886             :                                         OutputProcessor::SOVStoreType::Average,
    8887           6 :                                         Condenser(condNum).Name);
    8888          15 :                     SetupOutputVariable(state,
    8889             :                                         "Refrigeration System Condenser Fan Electricity Energy",
    8890             :                                         OutputProcessor::Unit::J,
    8891           3 :                                         Condenser(condNum).FanElecEnergy,
    8892             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8893             :                                         OutputProcessor::SOVStoreType::Summed,
    8894           3 :                                         Condenser(condNum).Name,
    8895             :                                         _,
    8896             :                                         "ELECTRICITY",
    8897             :                                         "REFRIGERATION",
    8898           3 :                                         Condenser(condNum).EndUseSubcategory,
    8899           3 :                                         "Plant");
    8900          12 :                     SetupOutputVariable(state,
    8901             :                                         "Refrigeration System Condenser Pump Electricity Rate",
    8902             :                                         OutputProcessor::Unit::W,
    8903           3 :                                         Condenser(condNum).ActualEvapPumpPower,
    8904             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8905             :                                         OutputProcessor::SOVStoreType::Average,
    8906           6 :                                         Condenser(condNum).Name);
    8907          15 :                     SetupOutputVariable(state,
    8908             :                                         "Refrigeration System Condenser Pump Electricity Energy",
    8909             :                                         OutputProcessor::Unit::J,
    8910           3 :                                         Condenser(condNum).EvapPumpConsumption,
    8911             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8912             :                                         OutputProcessor::SOVStoreType::Summed,
    8913           3 :                                         Condenser(condNum).Name,
    8914             :                                         _,
    8915             :                                         "ELECTRICITY",
    8916             :                                         "REFRIGERATION",
    8917           3 :                                         Condenser(condNum).EndUseSubcategory,
    8918           3 :                                         "Plant");
    8919          12 :                     SetupOutputVariable(state,
    8920             :                                         "Refrigeration System Condenser Basin Heater Electricity Rate",
    8921             :                                         OutputProcessor::Unit::W,
    8922           3 :                                         Condenser(condNum).BasinHeaterPower,
    8923             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8924             :                                         OutputProcessor::SOVStoreType::Average,
    8925           6 :                                         Condenser(condNum).Name);
    8926          15 :                     SetupOutputVariable(state,
    8927             :                                         "Refrigeration System Condenser Basin Heater Electricity Energy",
    8928             :                                         OutputProcessor::Unit::J,
    8929           3 :                                         Condenser(condNum).BasinHeaterConsumption,
    8930             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8931             :                                         OutputProcessor::SOVStoreType::Summed,
    8932           3 :                                         Condenser(condNum).Name,
    8933             :                                         _,
    8934             :                                         "ELECTRICITY",
    8935             :                                         "REFRIGERATION",
    8936           3 :                                         Condenser(condNum).EndUseSubcategory,
    8937           3 :                                         "Plant");
    8938          12 :                     SetupOutputVariable(state,
    8939             :                                         "Refrigeration System Condenser Evaporated Water Volume Flow Rate",
    8940             :                                         OutputProcessor::Unit::m3_s,
    8941           3 :                                         Condenser(condNum).EvapWaterConsumpRate,
    8942             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8943             :                                         OutputProcessor::SOVStoreType::Average,
    8944           6 :                                         Condenser(condNum).Name);
    8945          15 :                     SetupOutputVariable(state,
    8946             :                                         "Refrigeration System Condenser Evaporated Water Volume",
    8947             :                                         OutputProcessor::Unit::m3,
    8948           3 :                                         Condenser(condNum).EvapWaterConsumption,
    8949             :                                         OutputProcessor::SOVTimeStepType::Zone,
    8950             :                                         OutputProcessor::SOVStoreType::Summed,
    8951           3 :                                         Condenser(condNum).Name,
    8952             :                                         _,
    8953             :                                         "Water",
    8954             :                                         "REFRIGERATION",
    8955           3 :                                         Condenser(condNum).EndUseSubcategory,
    8956           3 :                                         "Plant");
    8957             :                 } // Evaporative Condenser Variables
    8958             : 
    8959          28 :                 if (Condenser(condNum).CondenserType == DataHeatBalance::RefrigCondenserType::Water) {
    8960           4 :                     SetupOutputVariable(state,
    8961             :                                         "Refrigeration System Condenser Water Mass Flow Rate",
    8962             :                                         OutputProcessor::Unit::kg_s,
    8963           1 :                                         Condenser(condNum).MassFlowRate,
    8964             :                                         OutputProcessor::SOVTimeStepType::HVAC,
    8965             :                                         OutputProcessor::SOVStoreType::Average,
    8966           2 :                                         Condenser(condNum).Name);
    8967             : 
    8968             :                 } // Water-cooled Condenser variables
    8969             :             }     // Condenser%CoilFlag to distinguish HVAC vs Zone time steps
    8970             :         }         // CondNum on DataHeatBalance::NumRefrigCondensers
    8971             : 
    8972          14 :         if (state.dataRefrigCase->NumSimulationSubcoolers > 0) {
    8973           3 :             for (int subcoolNum = 1; subcoolNum <= state.dataRefrigCase->NumSimulationSubcoolers; ++subcoolNum) {
    8974             :                 // CurrentModuleObject='Refrigeration:Subcooler'
    8975           2 :                 if (Subcooler(subcoolNum).CoilFlag) { // Subcooler serving system with chillers on HVAC time step
    8976           0 :                     if (Subcooler(subcoolNum).subcoolerType == SubcoolerType::Mechanical) {
    8977           0 :                         SetupOutputVariable(state,
    8978             :                                             "Refrigeration Air Chiller System Mechanical Subcooler Heat Transfer Rate",
    8979             :                                             OutputProcessor::Unit::W,
    8980           0 :                                             Subcooler(subcoolNum).MechSCTransLoad,
    8981             :                                             OutputProcessor::SOVTimeStepType::Zone,
    8982             :                                             OutputProcessor::SOVStoreType::Average,
    8983           0 :                                             Subcooler(subcoolNum).Name);
    8984           0 :                         SetupOutputVariable(state,
    8985             :                                             "Refrigeration Air Chiller System Mechanical Subcooler Heat Transfer Energy",
    8986             :                                             OutputProcessor::Unit::J,
    8987           0 :                                             Subcooler(subcoolNum).MechSCTransEnergy,
    8988             :                                             OutputProcessor::SOVTimeStepType::Zone,
    8989             :                                             OutputProcessor::SOVStoreType::Summed,
    8990           0 :                                             Subcooler(subcoolNum).Name);
    8991             :                     }
    8992             :                 } else { // Subcooler on system serving cases and/or walkins
    8993           2 :                     if (Subcooler(subcoolNum).subcoolerType == SubcoolerType::Mechanical) {
    8994           4 :                         SetupOutputVariable(state,
    8995             :                                             "Refrigeration System Mechanical Subcooler Heat Transfer Rate",
    8996             :                                             OutputProcessor::Unit::W,
    8997           1 :                                             Subcooler(subcoolNum).MechSCTransLoad,
    8998             :                                             OutputProcessor::SOVTimeStepType::HVAC,
    8999             :                                             OutputProcessor::SOVStoreType::Average,
    9000           2 :                                             Subcooler(subcoolNum).Name);
    9001           4 :                         SetupOutputVariable(state,
    9002             :                                             "Refrigeration System Mechanical Subcooler Heat Transfer Energy",
    9003             :                                             OutputProcessor::Unit::J,
    9004           1 :                                             Subcooler(subcoolNum).MechSCTransEnergy,
    9005             :                                             OutputProcessor::SOVTimeStepType::HVAC,
    9006             :                                             OutputProcessor::SOVStoreType::Summed,
    9007           2 :                                             Subcooler(subcoolNum).Name);
    9008             :                     }
    9009             :                 } // Subcoolers on system serving chillers
    9010             :             }     // Subcoolnum on NumSimulationSubcoolers
    9011             :         }         // NumSimulationSubcoolers > 0
    9012             : 
    9013             :     } // NumRefrigSystems > 0
    9014             : 
    9015         771 :     if (state.dataRefrigCase->NumTransRefrigSystems > 0) {
    9016             :         // CurrentModuleObject='Refrigeration:TranscriticalSystem'
    9017           2 :         for (int refrigSysNum = 1; refrigSysNum <= state.dataRefrigCase->NumTransRefrigSystems; ++refrigSysNum) {
    9018             :             // for both SingleStage and TwoStage systems (medium temperature loads present)
    9019           4 :             SetupOutputVariable(state,
    9020             :                                 "Refrigeration Transcritical System Total High Pressure Compressor Electricity Rate",
    9021             :                                 OutputProcessor::Unit::W,
    9022           1 :                                 TransSystem(refrigSysNum).TotCompPowerHP,
    9023             :                                 OutputProcessor::SOVTimeStepType::Zone,
    9024             :                                 OutputProcessor::SOVStoreType::Average,
    9025           2 :                                 TransSystem(refrigSysNum).Name);
    9026           4 :             SetupOutputVariable(state,
    9027             :                                 "Refrigeration Transcritical System Total High Pressure Compressor Electricity Energy",
    9028             :                                 OutputProcessor::Unit::J,
    9029           1 :                                 TransSystem(refrigSysNum).TotCompElecConsumpHP,
    9030             :                                 OutputProcessor::SOVTimeStepType::Zone,
    9031             :                                 OutputProcessor::SOVStoreType::Summed,
    9032           2 :                                 TransSystem(refrigSysNum).Name);
    9033           4 :             SetupOutputVariable(state,
    9034             :                                 "Refrigeration Transcritical System Total Compressor Electricity Energy",
    9035             :                                 OutputProcessor::Unit::J,
    9036           1 :                                 TransSystem(refrigSysNum).TotCompElecConsump,
    9037             :                                 OutputProcessor::SOVTimeStepType::Zone,
    9038             :                                 OutputProcessor::SOVStoreType::Summed,
    9039           2 :                                 TransSystem(refrigSysNum).Name);
    9040           4 :             SetupOutputVariable(state,
    9041             :                                 "Refrigeration Transcritical System Average COP",
    9042             :                                 OutputProcessor::Unit::W_W,
    9043           1 :                                 TransSystem(refrigSysNum).AverageCompressorCOP,
    9044             :                                 OutputProcessor::SOVTimeStepType::Zone,
    9045             :                                 OutputProcessor::SOVStoreType::Average,
    9046           2 :                                 TransSystem(refrigSysNum).Name);
    9047           4 :             SetupOutputVariable(state,
    9048             :                                 "Refrigeration Transcritical System Medium Temperature Cases and Walk Ins Heat Transfer Rate",
    9049             :                                 OutputProcessor::Unit::W,
    9050           1 :                                 TransSystem(refrigSysNum).TotalCoolingLoadMT,
    9051             :                                 OutputProcessor::SOVTimeStepType::Zone,
    9052             :                                 OutputProcessor::SOVStoreType::Average,
    9053           2 :                                 TransSystem(refrigSysNum).Name);
    9054           4 :             SetupOutputVariable(state,
    9055             :                                 "Refrigeration Transcritical System Medium Temperature Cases and Walk Ins Heat Transfer Energy",
    9056             :                                 OutputProcessor::Unit::J,
    9057           1 :                                 TransSystem(refrigSysNum).TotalCoolingEnergyMT,
    9058             :                                 OutputProcessor::SOVTimeStepType::Zone,
    9059             :                                 OutputProcessor::SOVStoreType::Summed,
    9060           2 :                                 TransSystem(refrigSysNum).Name);
    9061           4 :             SetupOutputVariable(state,
    9062             :                                 "Refrigeration Transcritical System Total Cases and Walk Ins Heat Transfer Energy",
    9063             :                                 OutputProcessor::Unit::J,
    9064           1 :                                 TransSystem(refrigSysNum).TotalCoolingEnergy,
    9065             :                                 OutputProcessor::SOVTimeStepType::Zone,
    9066             :                                 OutputProcessor::SOVStoreType::Summed,
    9067           2 :                                 TransSystem(refrigSysNum).Name);
    9068           4 :             SetupOutputVariable(state,
    9069             :                                 "Refrigeration Transcritical System Medium Temperature Suction Pipe Heat Transfer Rate",
    9070             :                                 OutputProcessor::Unit::W,
    9071           1 :                                 TransSystem(refrigSysNum).PipeHeatLoadMT,
    9072             :                                 OutputProcessor::SOVTimeStepType::Zone,
    9073             :                                 OutputProcessor::SOVStoreType::Average,
    9074           2 :                                 TransSystem(refrigSysNum).Name);
    9075           4 :             SetupOutputVariable(state,
    9076             :                                 "Refrigeration Transcritical System Medium Temperature Suction Pipe Heat Transfer Energy",
    9077             :                                 OutputProcessor::Unit::J,
    9078           1 :                                 TransSystem(refrigSysNum).PipeHeatEnergyMT,
    9079             :                                 OutputProcessor::SOVTimeStepType::Zone,
    9080             :                                 OutputProcessor::SOVStoreType::Summed,
    9081           2 :                                 TransSystem(refrigSysNum).Name);
    9082           4 :             SetupOutputVariable(state,
    9083             :                                 "Refrigeration Transcritical System High Pressure Compressor Heat Transfer Rate",
    9084             :                                 OutputProcessor::Unit::W,
    9085           1 :                                 TransSystem(refrigSysNum).TotCompCapacityHP,
    9086             :                                 OutputProcessor::SOVTimeStepType::Zone,
    9087             :                                 OutputProcessor::SOVStoreType::Average,
    9088           2 :                                 TransSystem(refrigSysNum).Name);
    9089           4 :             SetupOutputVariable(state,
    9090             :                                 "Refrigeration Transcritical System High Pressure Compressor Heat Transfer Energy",
    9091             :                                 OutputProcessor::Unit::J,
    9092           1 :                                 TransSystem(refrigSysNum).TotCompCoolingEnergyHP,
    9093             :                                 OutputProcessor::SOVTimeStepType::Zone,
    9094             :                                 OutputProcessor::SOVStoreType::Summed,
    9095           2 :                                 TransSystem(refrigSysNum).Name); // indiv compressors go to meter, not system sum
    9096           4 :             SetupOutputVariable(state,
    9097             :                                 "Refrigeration Transcritical System Net Rejected Heat Transfer Rate",
    9098             :                                 OutputProcessor::Unit::W,
    9099           1 :                                 TransSystem(refrigSysNum).NetHeatRejectLoad,
    9100             :                                 OutputProcessor::SOVTimeStepType::Zone,
    9101             :                                 OutputProcessor::SOVStoreType::Average,
    9102           2 :                                 TransSystem(refrigSysNum).Name);
    9103           4 :             SetupOutputVariable(state,
    9104             :                                 "Refrigeration Transcritical System Net Rejected Heat Transfer Energy",
    9105             :                                 OutputProcessor::Unit::J,
    9106           1 :                                 TransSystem(refrigSysNum).NetHeatRejectEnergy,
    9107             :                                 OutputProcessor::SOVTimeStepType::Zone,
    9108             :                                 OutputProcessor::SOVStoreType::Summed,
    9109           2 :                                 TransSystem(refrigSysNum).Name);
    9110           4 :             SetupOutputVariable(state,
    9111             :                                 "Refrigeration Transcritical System Estimated Refrigerant Inventory Mass",
    9112             :                                 OutputProcessor::Unit::kg,
    9113           1 :                                 TransSystem(refrigSysNum).RefInventory,
    9114             :                                 OutputProcessor::SOVTimeStepType::Zone,
    9115             :                                 OutputProcessor::SOVStoreType::Average,
    9116           2 :                                 TransSystem(refrigSysNum).Name);
    9117           4 :             SetupOutputVariable(state,
    9118             :                                 "Refrigeration Transcritical System Refrigerant Mass Flow Rate",
    9119             :                                 OutputProcessor::Unit::kg_s,
    9120           1 :                                 TransSystem(refrigSysNum).RefMassFlowComps,
    9121             :                                 OutputProcessor::SOVTimeStepType::Zone,
    9122             :                                 OutputProcessor::SOVStoreType::Average,
    9123           2 :                                 TransSystem(refrigSysNum).Name);
    9124           4 :             SetupOutputVariable(state,
    9125             :                                 "Refrigeration Transcritical System Medium Temperature Evaporating Temperature",
    9126             :                                 OutputProcessor::Unit::C,
    9127           1 :                                 TransSystem(refrigSysNum).TEvapNeededMT,
    9128             :                                 OutputProcessor::SOVTimeStepType::Zone,
    9129             :                                 OutputProcessor::SOVStoreType::Average,
    9130           2 :                                 TransSystem(refrigSysNum).Name);
    9131           4 :             SetupOutputVariable(state,
    9132             :                                 "Refrigeration Transcritical System Medium Temperature Suction Temperature",
    9133             :                                 OutputProcessor::Unit::C,
    9134           1 :                                 TransSystem(refrigSysNum).TCompInHP,
    9135             :                                 OutputProcessor::SOVTimeStepType::Zone,
    9136             :                                 OutputProcessor::SOVStoreType::Average,
    9137           2 :                                 TransSystem(refrigSysNum).Name);
    9138           1 :             if (TransSystem(refrigSysNum).TransSysType == 2) { // for TwoStage system only (low temperature loads present)
    9139           4 :                 SetupOutputVariable(state,
    9140             :                                     "Refrigeration Transcritical System Low Pressure Compressor Electricity Rate",
    9141             :                                     OutputProcessor::Unit::W,
    9142           1 :                                     TransSystem(refrigSysNum).TotCompPowerLP,
    9143             :                                     OutputProcessor::SOVTimeStepType::Zone,
    9144             :                                     OutputProcessor::SOVStoreType::Average,
    9145           2 :                                     TransSystem(refrigSysNum).Name);
    9146           4 :                 SetupOutputVariable(state,
    9147             :                                     "Refrigeration Transcritical System Low Pressure Compressor Electricity Energy",
    9148             :                                     OutputProcessor::Unit::J,
    9149           1 :                                     TransSystem(refrigSysNum).TotCompElecConsumpLP,
    9150             :                                     OutputProcessor::SOVTimeStepType::Zone,
    9151             :                                     OutputProcessor::SOVStoreType::Summed,
    9152           2 :                                     TransSystem(refrigSysNum).Name);
    9153           4 :                 SetupOutputVariable(state,
    9154             :                                     "Refrigeration Transcritical System Low Temperature Cases and Walk Ins Heat Transfer Rate",
    9155             :                                     OutputProcessor::Unit::W,
    9156           1 :                                     TransSystem(refrigSysNum).TotalCoolingLoadLT,
    9157             :                                     OutputProcessor::SOVTimeStepType::Zone,
    9158             :                                     OutputProcessor::SOVStoreType::Average,
    9159           2 :                                     TransSystem(refrigSysNum).Name);
    9160           4 :                 SetupOutputVariable(state,
    9161             :                                     "Refrigeration Transcritical System Low Temperature Cases and Walk Ins Heat Transfer Energy",
    9162             :                                     OutputProcessor::Unit::J,
    9163           1 :                                     TransSystem(refrigSysNum).TotalCoolingEnergyLT,
    9164             :                                     OutputProcessor::SOVTimeStepType::Zone,
    9165             :                                     OutputProcessor::SOVStoreType::Summed,
    9166           2 :                                     TransSystem(refrigSysNum).Name);
    9167           4 :                 SetupOutputVariable(state,
    9168             :                                     "Refrigeration Transcritical System Low Temperature Suction Pipe Heat Transfer Rate",
    9169             :                                     OutputProcessor::Unit::W,
    9170           1 :                                     TransSystem(refrigSysNum).PipeHeatLoadLT,
    9171             :                                     OutputProcessor::SOVTimeStepType::Zone,
    9172             :                                     OutputProcessor::SOVStoreType::Average,
    9173           2 :                                     TransSystem(refrigSysNum).Name);
    9174           4 :                 SetupOutputVariable(state,
    9175             :                                     "Refrigeration Transcritical System Low Temperature Suction Pipe Heat Transfer Energy",
    9176             :                                     OutputProcessor::Unit::J,
    9177           1 :                                     TransSystem(refrigSysNum).PipeHeatEnergyLT,
    9178             :                                     OutputProcessor::SOVTimeStepType::Zone,
    9179             :                                     OutputProcessor::SOVStoreType::Summed,
    9180           2 :                                     TransSystem(refrigSysNum).Name);
    9181           4 :                 SetupOutputVariable(state,
    9182             :                                     "Refrigeration Transcritical System Low Pressure Compressor Heat Transfer Rate",
    9183             :                                     OutputProcessor::Unit::W,
    9184           1 :                                     TransSystem(refrigSysNum).TotCompCapacityLP,
    9185             :                                     OutputProcessor::SOVTimeStepType::Zone,
    9186             :                                     OutputProcessor::SOVStoreType::Average,
    9187           2 :                                     TransSystem(refrigSysNum).Name);
    9188           4 :                 SetupOutputVariable(state,
    9189             :                                     "Refrigeration Transcritical System Low Pressure Compressor Heat Transfer Energy",
    9190             :                                     OutputProcessor::Unit::J,
    9191           1 :                                     TransSystem(refrigSysNum).TotCompCoolingEnergyLP,
    9192             :                                     OutputProcessor::SOVTimeStepType::Zone,
    9193             :                                     OutputProcessor::SOVStoreType::Summed,
    9194           2 :                                     TransSystem(refrigSysNum).Name); // indiv compressors go to meter, not system sum
    9195           4 :                 SetupOutputVariable(state,
    9196             :                                     "Refrigeration Transcritical System Low Temperature Evaporating Temperature",
    9197             :                                     OutputProcessor::Unit::C,
    9198           1 :                                     TransSystem(refrigSysNum).TEvapNeededLT,
    9199             :                                     OutputProcessor::SOVTimeStepType::Zone,
    9200             :                                     OutputProcessor::SOVStoreType::Average,
    9201           2 :                                     TransSystem(refrigSysNum).Name);
    9202           4 :                 SetupOutputVariable(state,
    9203             :                                     "Refrigeration Transcritical System Low Temperature Suction Temperature",
    9204             :                                     OutputProcessor::Unit::C,
    9205           1 :                                     TransSystem(refrigSysNum).TCompInLP,
    9206             :                                     OutputProcessor::SOVTimeStepType::Zone,
    9207             :                                     OutputProcessor::SOVStoreType::Average,
    9208           2 :                                     TransSystem(refrigSysNum).Name);
    9209             :             } // (TransSystem(RefrigSysNum)%TransSysType == 2)
    9210             : 
    9211           1 :             if (TransSystem(refrigSysNum).SystemRejectHeatToZone) {
    9212           0 :                 if (GasCooler(TransSystem(refrigSysNum).GasCoolerNum(1)).InletAirZoneNum > 0)
    9213           0 :                     SetupZoneInternalGain(state,
    9214           0 :                                           GasCooler(TransSystem(refrigSysNum).GasCoolerNum(1)).InletAirZoneNum,
    9215           0 :                                           TransSystem(refrigSysNum).Name,
    9216             :                                           DataHeatBalance::IntGainType::RefrigerationTransSysAirCooledGasCooler,
    9217           0 :                                           &TransSystem(refrigSysNum).NetHeatRejectLoad);
    9218             :             } // (TransSystem(RefrigSysNum)%SystemRejectHeatToZone)
    9219           1 :             if (TransSystem(refrigSysNum).SuctionPipeActualZoneNumMT > 0) {
    9220           0 :                 SetupZoneInternalGain(state,
    9221           0 :                                       TransSystem(refrigSysNum).SuctionPipeActualZoneNumMT,
    9222           0 :                                       TransSystem(refrigSysNum).Name,
    9223             :                                       DataHeatBalance::IntGainType::RefrigerationTransSysSuctionPipeMT,
    9224           0 :                                       &TransSystem(refrigSysNum).PipeHeatLoadMT);
    9225             :             } // TransSystem(RefrigSysNum)%SuctionPipeActualZoneNumMT > 0
    9226           1 :             if (TransSystem(refrigSysNum).SuctionPipeActualZoneNumLT > 0) {
    9227           0 :                 SetupZoneInternalGain(state,
    9228           0 :                                       TransSystem(refrigSysNum).SuctionPipeActualZoneNumLT,
    9229           0 :                                       TransSystem(refrigSysNum).Name,
    9230             :                                       DataHeatBalance::IntGainType::RefrigerationTransSysSuctionPipeLT,
    9231           0 :                                       &TransSystem(refrigSysNum).PipeHeatLoadLT);
    9232             :             } // TransSystem(RefrigSysNum)%SuctionPipeActualZoneNumLT > 0
    9233             : 
    9234             :             // Report Compressor ENERGY here, not on system level for meters.
    9235             :             // LP compressors
    9236           4 :             for (int compIndex = 1; compIndex <= TransSystem(refrigSysNum).NumCompressorsLP; ++compIndex) {
    9237           3 :                 int compNum = TransSystem(refrigSysNum).CompressorNumLP(compIndex);
    9238             :                 // CurrentModuleObject='Refrigeration:Compressor'
    9239           3 :                 if (Compressor(compNum).NumSysAttach == 1) { // only set up reports for compressors that are used once and only once
    9240          12 :                     SetupOutputVariable(state,
    9241             :                                         "Refrigeration Compressor Electricity Rate",
    9242             :                                         OutputProcessor::Unit::W,
    9243           3 :                                         Compressor(compNum).Power,
    9244             :                                         OutputProcessor::SOVTimeStepType::Zone,
    9245             :                                         OutputProcessor::SOVStoreType::Average,
    9246           6 :                                         Compressor(compNum).Name);
    9247          15 :                     SetupOutputVariable(state,
    9248             :                                         "Refrigeration Compressor Electricity Energy",
    9249             :                                         OutputProcessor::Unit::J,
    9250           3 :                                         Compressor(compNum).ElecConsumption,
    9251             :                                         OutputProcessor::SOVTimeStepType::Zone,
    9252             :                                         OutputProcessor::SOVStoreType::Summed,
    9253           3 :                                         Compressor(compNum).Name,
    9254             :                                         _,
    9255             :                                         "ELECTRICITY",
    9256             :                                         "REFRIGERATION",
    9257           3 :                                         Compressor(compNum).EndUseSubcategory,
    9258           3 :                                         "Plant");
    9259          12 :                     SetupOutputVariable(state,
    9260             :                                         "Refrigeration Compressor Heat Transfer Rate",
    9261             :                                         OutputProcessor::Unit::W,
    9262           3 :                                         Compressor(compNum).Capacity,
    9263             :                                         OutputProcessor::SOVTimeStepType::Zone,
    9264             :                                         OutputProcessor::SOVStoreType::Average,
    9265           6 :                                         Compressor(compNum).Name);
    9266          12 :                     SetupOutputVariable(state,
    9267             :                                         "Refrigeration Compressor Heat Transfer Energy",
    9268             :                                         OutputProcessor::Unit::J,
    9269           3 :                                         Compressor(compNum).CoolingEnergy,
    9270             :                                         OutputProcessor::SOVTimeStepType::Zone,
    9271             :                                         OutputProcessor::SOVStoreType::Summed,
    9272           6 :                                         Compressor(compNum).Name);
    9273          12 :                     SetupOutputVariable(state,
    9274             :                                         "Refrigeration Compressor Runtime Fraction",
    9275             :                                         OutputProcessor::Unit::None,
    9276           3 :                                         Compressor(compNum).LoadFactor,
    9277             :                                         OutputProcessor::SOVTimeStepType::Zone,
    9278             :                                         OutputProcessor::SOVStoreType::Average,
    9279           6 :                                         Compressor(compNum).Name);
    9280             :                 } // NumSysAttach
    9281             :             }     // TransSystem(RefrigSysNum)%NumCompressorsLP
    9282             : 
    9283             :             // HP compressors
    9284           4 :             for (int compIndex = 1; compIndex <= TransSystem(refrigSysNum).NumCompressorsHP; ++compIndex) {
    9285           3 :                 int compNum = TransSystem(refrigSysNum).CompressorNumHP(compIndex);
    9286             :                 // CurrentModuleObject='Refrigeration:Compressor'
    9287           3 :                 if (Compressor(compNum).NumSysAttach == 1) { // only set up reports for compressors that are used once and only once
    9288          12 :                     SetupOutputVariable(state,
    9289             :                                         "Refrigeration Compressor Electricity Rate",
    9290             :                                         OutputProcessor::Unit::W,
    9291           3 :                                         Compressor(compNum).Power,
    9292             :                                         OutputProcessor::SOVTimeStepType::Zone,
    9293             :                                         OutputProcessor::SOVStoreType::Average,
    9294           6 :                                         Compressor(compNum).Name);
    9295          15 :                     SetupOutputVariable(state,
    9296             :                                         "Refrigeration Compressor Electricity Energy",
    9297             :                                         OutputProcessor::Unit::J,
    9298           3 :                                         Compressor(compNum).ElecConsumption,
    9299             :                                         OutputProcessor::SOVTimeStepType::Zone,
    9300             :                                         OutputProcessor::SOVStoreType::Summed,
    9301           3 :                                         Compressor(compNum).Name,
    9302             :                                         _,
    9303             :                                         "ELECTRICITY",
    9304             :                                         "REFRIGERATION",
    9305           3 :                                         Compressor(compNum).EndUseSubcategory,
    9306           3 :                                         "Plant");
    9307          12 :                     SetupOutputVariable(state,
    9308             :                                         "Refrigeration Compressor Heat Transfer Rate",
    9309             :                                         OutputProcessor::Unit::W,
    9310           3 :                                         Compressor(compNum).Capacity,
    9311             :                                         OutputProcessor::SOVTimeStepType::Zone,
    9312             :                                         OutputProcessor::SOVStoreType::Average,
    9313           6 :                                         Compressor(compNum).Name);
    9314          12 :                     SetupOutputVariable(state,
    9315             :                                         "Refrigeration Compressor Heat Transfer Energy",
    9316             :                                         OutputProcessor::Unit::J,
    9317           3 :                                         Compressor(compNum).CoolingEnergy,
    9318             :                                         OutputProcessor::SOVTimeStepType::Zone,
    9319             :                                         OutputProcessor::SOVStoreType::Summed,
    9320           6 :                                         Compressor(compNum).Name);
    9321          12 :                     SetupOutputVariable(state,
    9322             :                                         "Refrigeration Compressor Runtime Fraction",
    9323             :                                         OutputProcessor::Unit::None,
    9324           3 :                                         Compressor(compNum).LoadFactor,
    9325             :                                         OutputProcessor::SOVTimeStepType::Zone,
    9326             :                                         OutputProcessor::SOVStoreType::Average,
    9327           6 :                                         Compressor(compNum).Name);
    9328             :                 } // NumSysAttach
    9329             :             }     // TransSystem(RefrigSysNum)%NumCompressorsHP
    9330             : 
    9331             :         } // NumTransRefrigSystems
    9332             :     }     // (NumTransRefrigSystems > 0)
    9333             : 
    9334         771 :     if (state.dataRefrigCase->NumSimulationGasCooler > 0) {
    9335           2 :         for (int GCNum = 1; GCNum <= state.dataRefrigCase->NumSimulationGasCooler; ++GCNum) {
    9336             :             // CurrentModuleObject='Refrigeration:GasCooler:AirCooled'
    9337           4 :             SetupOutputVariable(state,
    9338             :                                 "Refrigeration Transcritical System Gas Cooler Heat Transfer Rate",
    9339             :                                 OutputProcessor::Unit::W,
    9340           1 :                                 GasCooler(GCNum).GasCoolerLoad,
    9341             :                                 OutputProcessor::SOVTimeStepType::Zone,
    9342             :                                 OutputProcessor::SOVStoreType::Average,
    9343           2 :                                 GasCooler(GCNum).Name);
    9344           4 :             SetupOutputVariable(state,
    9345             :                                 "Refrigeration Transcritical System Gas Cooler Heat Transfer Energy",
    9346             :                                 OutputProcessor::Unit::J,
    9347           1 :                                 GasCooler(GCNum).GasCoolerEnergy,
    9348             :                                 OutputProcessor::SOVTimeStepType::Zone,
    9349             :                                 OutputProcessor::SOVStoreType::Summed,
    9350           2 :                                 GasCooler(GCNum).Name);
    9351           4 :             SetupOutputVariable(state,
    9352             :                                 "Refrigeration Transcritical System Gas Cooler Fan Electricity Rate",
    9353             :                                 OutputProcessor::Unit::W,
    9354           1 :                                 GasCooler(GCNum).ActualFanPower,
    9355             :                                 OutputProcessor::SOVTimeStepType::Zone,
    9356             :                                 OutputProcessor::SOVStoreType::Average,
    9357           2 :                                 GasCooler(GCNum).Name);
    9358           5 :             SetupOutputVariable(state,
    9359             :                                 "Refrigeration Transcritical System Gas Cooler Fan Electricity Energy",
    9360             :                                 OutputProcessor::Unit::J,
    9361           1 :                                 GasCooler(GCNum).FanElecEnergy,
    9362             :                                 OutputProcessor::SOVTimeStepType::Zone,
    9363             :                                 OutputProcessor::SOVStoreType::Summed,
    9364           1 :                                 GasCooler(GCNum).Name,
    9365             :                                 _,
    9366             :                                 "ELECTRICITY",
    9367             :                                 "REFRIGERATION",
    9368           1 :                                 GasCooler(GCNum).EndUseSubcategory,
    9369           1 :                                 "Plant");
    9370           4 :             SetupOutputVariable(state,
    9371             :                                 "Refrigeration Transcritical System Gas Cooler Outlet Temperature",
    9372             :                                 OutputProcessor::Unit::C,
    9373           1 :                                 GasCooler(GCNum).TGasCoolerOut,
    9374             :                                 OutputProcessor::SOVTimeStepType::Zone,
    9375             :                                 OutputProcessor::SOVStoreType::Average,
    9376           2 :                                 GasCooler(GCNum).Name);
    9377           4 :             SetupOutputVariable(state,
    9378             :                                 "Refrigeration Transcritical System Gas Cooler Outlet Pressure",
    9379             :                                 OutputProcessor::Unit::Pa,
    9380           1 :                                 GasCooler(GCNum).PGasCoolerOut,
    9381             :                                 OutputProcessor::SOVTimeStepType::Zone,
    9382             :                                 OutputProcessor::SOVStoreType::Average,
    9383           2 :                                 GasCooler(GCNum).Name);
    9384           4 :             SetupOutputVariable(state,
    9385             :                                 "Refrigeration Transcritical System Gas Cooler Defrost Recovered Heat Transfer Rate",
    9386             :                                 OutputProcessor::Unit::W,
    9387           1 :                                 GasCooler(GCNum).InternalHeatRecoveredLoad,
    9388             :                                 OutputProcessor::SOVTimeStepType::Zone,
    9389             :                                 OutputProcessor::SOVStoreType::Average,
    9390           2 :                                 GasCooler(GCNum).Name);
    9391           4 :             SetupOutputVariable(state,
    9392             :                                 "Refrigeration Transcritical System Gas Cooler Defrost Recovered Heat Transfer Energy",
    9393             :                                 OutputProcessor::Unit::J,
    9394           1 :                                 GasCooler(GCNum).InternalEnergyRecovered,
    9395             :                                 OutputProcessor::SOVTimeStepType::Zone,
    9396             :                                 OutputProcessor::SOVStoreType::Summed,
    9397           2 :                                 GasCooler(GCNum).Name);
    9398             :         } // GCNum on NumSimulationGasCooler
    9399             :     }     // (NumSimulationGasCooler >0)
    9400         771 : }
    9401             : 
    9402      469693 : void InitRefrigeration(EnergyPlusData &state)
    9403             : {
    9404             :     // SUBROUTINE INFORMATION:
    9405             :     //       AUTHOR         Richard Raustad, FSEC
    9406             :     //       DATE WRITTEN   Oct/Nov 2004
    9407             :     //       MODIFIED       Hudson, ORNL July 2007, Stovall, ORNL, 2008
    9408             :     //       RE-ENGINEERED  na
    9409             : 
    9410             :     // PURPOSE OF THIS SUBROUTINE:
    9411             :     // Initialize (zero) global variables before simulating compressor racks and refrigerated cases
    9412             :     // Several variables in this module are accumulative.  For example, unmet compressor loads are carried over
    9413             :     // to the next time step. Ice loads are accumulated until melted by a defrost.  Because this module can be
    9414             :     // called multiple times during any single time step, these summations need to be saved ONLY on the last time
    9415             :     // through any given time step.
    9416             : 
    9417             :     // It is necessary to decrease the condenser load by the amount of heat used elsewhere
    9418             :     //   via desuperheating water heaters and heating coils.
    9419             :     //   Because the refrigeration system is solved before the HVAC time step loops, the
    9420             :     //   refrigeration system must use the values lagged from the previous time step. In
    9421             :     //   terms of energy, this should balance out and is preferable to not making the correction,
    9422             :     //   in which case the condenser cooling water/air/fan energy are charged with energy
    9423             :     //   loads that have been accounted elsewhere.  For consistency, the lagged value must be used,
    9424             :     //   even if the Zone time step is repeated.  Therefore, the lagged variables are saved
    9425             :     //   here for use during successive iterations of same zone/load time step.
    9426             : 
    9427             :     // METHODOLOGY EMPLOYED:
    9428             :     // Global variables for Case Credit are located in DataHeatBalance. To Zone variables are used in the Air Heat
    9429             :     // Balance in ZoneTempPredictorCorrector to calculate the zone load. To HVAC variables are used in
    9430             :     // ZoneEquipmentManager to add the portion of case credits attributed to the HVAC system to the zone return air node.
    9431             : 
    9432             :     // Because we can't know apriori whether or not the time step will be repeated, we save the most recent
    9433             :     // addition/subtraction to/from each accumulating variable.  If the time step is repeated,
    9434             :     // this most recent addition/subtraction is reversed before the rest of the refrigeration simulation begins.
    9435             : 
    9436             :     // Used to adjust accumulative variables when time step is repeated
    9437             : 
    9438      469693 :     auto &RefrigCase(state.dataRefrigCase->RefrigCase);
    9439      469693 :     auto &RefrigRack(state.dataRefrigCase->RefrigRack);
    9440      469693 :     auto &System(state.dataRefrigCase->System);
    9441      469693 :     auto &TransSystem(state.dataRefrigCase->TransSystem);
    9442      469693 :     auto &Condenser(state.dataRefrigCase->Condenser);
    9443      469693 :     auto &Compressor(state.dataRefrigCase->Compressor);
    9444      469693 :     auto &GasCooler(state.dataRefrigCase->GasCooler);
    9445      469693 :     auto &Secondary(state.dataRefrigCase->Secondary);
    9446      469693 :     auto &WalkIn(state.dataRefrigCase->WalkIn);
    9447      469693 :     auto &WarehouseCoil(state.dataRefrigCase->WarehouseCoil);
    9448      469693 :     auto &CoilSysCredit(state.dataRefrigCase->CoilSysCredit);
    9449      469693 :     auto &CaseWIZoneReport(state.dataRefrigCase->CaseWIZoneReport);
    9450             : 
    9451             :     // Zero display case, air-coil, and walk-in cooler credits (summed by zone)
    9452             :     // to 0 each zone or sys time step
    9453             :     // These 'casecredit' variables are also used to transfer energy from zone-located
    9454             :     // compressor-rack condenser heat rejection, heat absorption by distribution piping,
    9455             :     // suction piping, and receiver shells to zone
    9456      469693 :     if (state.dataGlobal->NumOfZones > 0) {
    9457      469693 :         if (state.dataRefrigCase->UseSysTimeStep) {
    9458     5297415 :             for (int i = CoilSysCredit.l(), e = CoilSysCredit.u(); i <= e; ++i) {
    9459     4944254 :                 CoilSysCredit(i).reset();
    9460             :             }
    9461             :         } // UseSysTimeStep = true
    9462             : 
    9463             :         // Can arrive here when load call to refrigeration looks for cases/walkin systems and usetimestep is false
    9464      699866 :         if ((!state.dataRefrigCase->UseSysTimeStep) &&
    9465      119423 :             ((state.dataRefrigCase->NumSimulationCases > 0) || (state.dataRefrigCase->NumSimulationWalkIns > 0))) {
    9466             : 
    9467     3206655 :             for (auto &credit : state.dataHeatBal->RefrigCaseCredit) {
    9468     3093014 :                 credit.reset();
    9469             :             }
    9470     3206655 :             for (auto &zoneReport : CaseWIZoneReport) {
    9471     3093014 :                 zoneReport.reset();
    9472             :             }
    9473             :         }
    9474             :     }
    9475             : 
    9476      469693 :     if (state.dataRefrigCase->NumSimulationCases > 0) {
    9477             :         // RefrigCase ALLOCATED to NumSimulationCases
    9478      659467 :         for (auto &refrig : RefrigCase) {
    9479      545826 :             refrig.reset_init();
    9480             :         }
    9481             :     } // NumSimulationCases
    9482             : 
    9483      469693 :     if (state.dataRefrigCase->NumSimulationWalkIns > 0) {
    9484             :         // WalkIn ALLOCATED to NumSimulationWalkIns
    9485       83632 :         for (int i = WalkIn.l(), e = WalkIn.u(); i <= e; ++i) {
    9486       48317 :             WalkIn(i).reset_init();
    9487             :         }
    9488             :     }
    9489             : 
    9490      469693 :     if (state.dataRefrigCase->HaveChillers) {
    9491             :         // HaveChillers is TRUE when NumSimulationRefrigAirChillers > 0
    9492             :         // WarehouseCoil ALLOCATED to NumSimulationRefrigAirChillers
    9493    29908368 :         for (int i = WarehouseCoil.l(), e = WarehouseCoil.u(); i <= e; ++i) {
    9494    29552316 :             WarehouseCoil(i).reset_init();
    9495             :         }
    9496             :     }
    9497             : 
    9498      469693 :     if (state.dataRefrigCase->HaveRefrigRacks) {
    9499             :         // HaveRefrigRacks TRUE when NumRefrigeratedRacks > 0
    9500             :         // RefrigRack ALLOCATED to NumRefrigeratedRacks
    9501      295653 :         for (int i = RefrigRack.l(), e = RefrigRack.u(); i <= e; ++i) {
    9502      201098 :             RefrigRack(i).reset_init();
    9503             :         }
    9504      295653 :         for (auto &e : state.dataHeatBal->HeatReclaimRefrigeratedRack)
    9505      201098 :             e.AvailCapacity = 0.0;
    9506             :         // Note don't reset basin heat to zero when no load because heater would remain on
    9507             :         // RefrigRack.BasinHeaterPower = 0.0;
    9508             :         // RefrigRack.BasinHeaterConsumption = 0.0;
    9509             :     }
    9510             : 
    9511      469693 :     if (state.dataRefrigCase->NumRefrigCondensers > 0) {
    9512             :         // Condenser ALLOCATED to DataHeatBalance::NumRefrigCondensers
    9513     3670521 :         for (int i = Condenser.l(), e = Condenser.u(); i <= e; ++i) {
    9514     3279154 :             Condenser(i).reset_init();
    9515             :         }
    9516             :         // N don't reset basin heat to zero when no load because heater would remain on
    9517     3670521 :         for (auto &e : state.dataHeatBal->HeatReclaimRefrigCondenser) {
    9518     3279154 :             e.AvailCapacity = 0.0;
    9519     3279154 :             e.AvailTemperature = 0.0;
    9520             :         }
    9521             :     }
    9522             : 
    9523      469693 :     if (state.dataRefrigCase->NumSimulationGasCooler > 0) {
    9524             :         // GasCooler ALLOCATED to NumSimulationGasCooler
    9525        4056 :         for (int i = GasCooler.l(), e = GasCooler.u(); i <= e; ++i) {
    9526        2028 :             GasCooler(i).reset_init();
    9527             :         }
    9528             :     }
    9529             : 
    9530      469693 :     if (state.dataRefrigCase->NumSimulationCompressors > 0) {
    9531             :         // Compressor ALLOCATED to NumSimulationCompressors
    9532    25953569 :         for (int i = Compressor.l(), e = Compressor.u(); i <= e; ++i) {
    9533    25560174 :             Compressor(i).reset_init();
    9534             :         }
    9535             :     }
    9536             : 
    9537      469693 :     if (state.dataRefrigCase->HaveDetailedRefrig) {
    9538             :         // HaveDetailedRefrig is TRUE when NumRefrigSystems > 0
    9539             :         // System is ALLOCATED to NumRefrigSystems
    9540     3674577 :         for (int i = System.l(), e = System.u(); i <= e; ++i) {
    9541     3283210 :             System(i).reset_init();
    9542             :         }
    9543             :     }
    9544             : 
    9545      469693 :     if (state.dataRefrigCase->HaveDetailedTransRefrig) {
    9546             :         // HaveDetailedTransRefrig is TRUE when NumTransRefrigSystems > 0
    9547             :         // TransSystem is ALLOCATED to NumTransRefrigSystems
    9548        4056 :         for (int i = TransSystem.l(), e = TransSystem.u(); i <= e; ++i) {
    9549        2028 :             TransSystem(i).reset_init();
    9550             :         }
    9551             :     }
    9552             : 
    9553      469693 :     if (state.dataRefrigCase->NumSimulationSecondarySystems > 0) {
    9554             :         // Secondary is ALLOCATED to NumSimulationSecondarySystems
    9555        6084 :         for (int i = Secondary.l(), e = Secondary.u(); i <= e; ++i) {
    9556        4056 :             Secondary(i).reset_init();
    9557             :         }
    9558             :     }
    9559             : 
    9560             :     // Accumulative and carry-over variables are not zeroed at start of each time step, only at begining of environment
    9561      469693 :     if (state.dataGlobal->BeginEnvrnFlag && state.dataRefrigCase->InitRefrigerationMyBeginEnvrnFlag) {
    9562         299 :         if (state.dataRefrigCase->NumSimulationCases > 0) {
    9563        1608 :             for (int i = RefrigCase.l(), e = RefrigCase.u(); i <= e; ++i) {
    9564        1315 :                 RefrigCase(i).reset_init_accum();
    9565             :             }
    9566             :         }
    9567         299 :         if (state.dataRefrigCase->NumRefrigSystems > 0) {
    9568         360 :             for (auto &e : System)
    9569         262 :                 e.UnmetEnergy = 0.0;
    9570             :         }
    9571         299 :         if (state.dataRefrigCase->NumSimulationWalkIns > 0) {
    9572         210 :             for (auto &e : WalkIn) {
    9573         118 :                 e.KgFrost = 0.0;
    9574         118 :                 e.StoredEnergy = 0.0;
    9575             :             }
    9576         210 :             for (int walkInID = 1; walkInID <= state.dataRefrigCase->NumSimulationWalkIns; ++walkInID) {
    9577         118 :                 WalkIn(walkInID).IceTemp = WalkIn(walkInID).TEvapDesign;
    9578             :             }
    9579             :         }
    9580         299 :         if (state.dataRefrigCase->NumSimulationRefrigAirChillers > 0) {
    9581         504 :             for (auto &e : WarehouseCoil) {
    9582         498 :                 e.KgFrost = 0.0;
    9583         498 :                 e.KgFrostSaved = 0.0;
    9584             :             }
    9585         504 :             for (int coilID = 1; coilID <= state.dataRefrigCase->NumSimulationRefrigAirChillers; ++coilID) {
    9586         498 :                 WarehouseCoil(coilID).IceTemp = WarehouseCoil(coilID).TEvapDesign;
    9587         498 :                 WarehouseCoil(coilID).IceTempSaved = WarehouseCoil(coilID).TEvapDesign;
    9588             :             }
    9589             :         }
    9590         299 :         if (state.dataRefrigCase->NumSimulationSecondarySystems > 0) {
    9591          18 :             for (auto &e : Secondary)
    9592          12 :                 e.UnmetEnergy = 0.0;
    9593             :         }
    9594         299 :         if (state.dataRefrigCase->NumRefrigeratedRacks > 0) {
    9595         745 :             for (auto &e : state.dataHeatBal->HeatReclaimRefrigeratedRack) {
    9596         496 :                 e.HVACDesuperheaterReclaimedHeatTotal = 0.0;
    9597         496 :                 e.WaterHeatingDesuperheaterReclaimedHeatTotal = 0.0;
    9598             :             }
    9599         745 :             for (auto &e : RefrigRack) {
    9600         496 :                 e.LaggedUsedWaterHeater = 0.0;
    9601         496 :                 e.LaggedUsedHVACCoil = 0.0;
    9602             :             }
    9603             :         }
    9604         299 :         if (state.dataRefrigCase->NumRefrigCondensers > 0) {
    9605         348 :             for (auto &e : state.dataHeatBal->HeatReclaimRefrigCondenser) {
    9606         250 :                 e.HVACDesuperheaterReclaimedHeatTotal = 0.0;
    9607         250 :                 e.WaterHeatingDesuperheaterReclaimedHeatTotal = 0.0;
    9608             :             }
    9609         348 :             for (auto &e : Condenser) {
    9610         250 :                 e.LaggedUsedWaterHeater = 0.0;
    9611         250 :                 e.LaggedUsedHVACCoil = 0.0;
    9612             :             }
    9613             :         }
    9614         561 :         for (int systemId = 1; systemId <= state.dataRefrigCase->NumRefrigSystems; ++systemId) {
    9615         262 :             if (allocated(System(systemId).MechSCLoad)) System(systemId).MechSCLoad = 0.0;
    9616         262 :             System(systemId).LSHXTrans = 0.0;
    9617         262 :             System(systemId).LSHXTransEnergy = 0.0;
    9618             :         }
    9619             : 
    9620         299 :         if (state.dataGlobal->NumOfTimeStepInHour > 0.0) state.dataRefrigCase->TimeStepFraction = 1.0 / double(state.dataGlobal->NumOfTimeStepInHour);
    9621         299 :         state.dataRefrigCase->InitRefrigerationMyBeginEnvrnFlag = false;
    9622             : 
    9623             :     } // ( DataGlobals::BeginEnvrnFlag && MyBeginEnvrnFlag )
    9624             : 
    9625      469693 :     if (!state.dataGlobal->BeginEnvrnFlag) state.dataRefrigCase->InitRefrigerationMyBeginEnvrnFlag = true;
    9626             : 
    9627             :     // Avoid multiplying accumulation if go through zone/load time step more than once.
    9628      469693 :     if (!state.dataGlobal->WarmupFlag) { // because no accumulation is done during warm up
    9629             :         // Can arrive here when load call to refrigeration looks for cases/walkin systems and usetimestep is .FALSE.
    9630       61152 :         if ((!state.dataRefrigCase->UseSysTimeStep) &&
    9631       13920 :             ((state.dataRefrigCase->NumSimulationCases > 0) || (state.dataRefrigCase->NumSimulationWalkIns > 0))) {
    9632             :             // Used to determine whether the zone time step is a repetition
    9633       13536 :             Real64 MyCurrentTime = (state.dataGlobal->HourOfDay - 1) + state.dataGlobal->TimeStep * state.dataRefrigCase->TimeStepFraction;
    9634       13536 :             if (std::abs(MyCurrentTime - state.dataRefrigCase->MyCurrentTimeSaved) < MySmallNumber) {
    9635             :                 // If the time step is repeated, need to return to correct values at start of time step
    9636           0 :                 if (state.dataRefrigCase->NumSimulationCases > 0) {
    9637           0 :                     for (int caseID = 1; caseID <= state.dataRefrigCase->NumSimulationCases; ++caseID) {
    9638           0 :                         RefrigCase(caseID).DefrostEnergy = RefrigCase(caseID).DefrostEnergySaved;
    9639           0 :                         RefrigCase(caseID).StockingEnergy = RefrigCase(caseID).StockingEnergySaved;
    9640           0 :                         RefrigCase(caseID).WarmEnvEnergy = RefrigCase(caseID).WarmEnvEnergySaved;
    9641           0 :                         RefrigCase(caseID).KgFrost = RefrigCase(caseID).KgFrostSaved;
    9642           0 :                         RefrigCase(caseID).StoredEnergy = RefrigCase(caseID).StoredEnergySaved;
    9643             :                     } // CaseID
    9644             :                 }     // NumSimulationCases
    9645           0 :                 if (state.dataRefrigCase->NumSimulationWalkIns > 0) {
    9646           0 :                     for (int walkInID = 1; walkInID <= state.dataRefrigCase->NumSimulationWalkIns; ++walkInID) {
    9647           0 :                         WalkIn(walkInID).KgFrost = WalkIn(walkInID).KgFrostSaved;
    9648           0 :                         WalkIn(walkInID).StoredEnergy = WalkIn(walkInID).StoredEnergySaved;
    9649           0 :                         WalkIn(walkInID).IceTemp = WalkIn(walkInID).IceTempSaved;
    9650             :                     }
    9651             :                 }
    9652           0 :                 if (state.dataRefrigCase->NumRefrigSystems > 0) {
    9653           0 :                     for (int systemID = 1; systemID <= state.dataRefrigCase->NumRefrigSystems; ++systemID) {
    9654           0 :                         if (System(systemID).CoilFlag) continue;
    9655           0 :                         System(systemID).UnmetEnergy = System(systemID).UnmetEnergySaved;
    9656             :                     }
    9657             :                 }
    9658           0 :                 if (state.dataRefrigCase->NumTransRefrigSystems > 0) {
    9659           0 :                     for (int systemID = 1; systemID <= state.dataRefrigCase->NumTransRefrigSystems; ++systemID) {
    9660           0 :                         TransSystem(systemID).UnmetEnergyMT = TransSystem(systemID).UnmetEnergySavedMT;
    9661           0 :                         TransSystem(systemID).UnmetEnergyLT = TransSystem(systemID).UnmetEnergySavedLT;
    9662             :                     }
    9663             :                 }
    9664           0 :                 if (state.dataRefrigCase->NumSimulationSecondarySystems > 0) {
    9665           0 :                     for (int secondID = 1; secondID <= state.dataRefrigCase->NumSimulationSecondarySystems; ++secondID) {
    9666           0 :                         if (Secondary(secondID).CoilFlag) continue;
    9667           0 :                         Secondary(secondID).UnmetEnergy = Secondary(secondID).UnmetEnergySaved;
    9668             :                     }
    9669             :                 }
    9670             : 
    9671             :             } else {
    9672             :                 // First time through this Zone time step, so set saved values to those in place at start of this time step
    9673       13536 :                 state.dataRefrigCase->MyCurrentTimeSaved = MyCurrentTime;
    9674       13536 :                 if (state.dataRefrigCase->NumSimulationCases > 0) {
    9675       76608 :                     for (int caseID = 1; caseID <= state.dataRefrigCase->NumSimulationCases; ++caseID) {
    9676       63072 :                         RefrigCase(caseID).DefrostEnergySaved = RefrigCase(caseID).DefrostEnergy;
    9677       63072 :                         RefrigCase(caseID).StockingEnergySaved = RefrigCase(caseID).StockingEnergy;
    9678       63072 :                         RefrigCase(caseID).WarmEnvEnergySaved = RefrigCase(caseID).WarmEnvEnergy;
    9679       63072 :                         RefrigCase(caseID).KgFrostSaved = RefrigCase(caseID).KgFrost;
    9680       63072 :                         RefrigCase(caseID).StoredEnergySaved = RefrigCase(caseID).StoredEnergy;
    9681             :                     } // caseid
    9682             :                 }     // numsimulationcases
    9683       13536 :                 if (state.dataRefrigCase->NumSimulationWalkIns > 0) {
    9684       11520 :                     for (int walkInID = 1; walkInID <= state.dataRefrigCase->NumSimulationWalkIns; ++walkInID) {
    9685        6624 :                         WalkIn(walkInID).KgFrostSaved = WalkIn(walkInID).KgFrost;
    9686        6624 :                         WalkIn(walkInID).StoredEnergySaved = WalkIn(walkInID).StoredEnergy;
    9687        6624 :                         WalkIn(walkInID).IceTempSaved = WalkIn(walkInID).IceTemp;
    9688             :                     }
    9689             :                 }
    9690       13536 :                 if (state.dataRefrigCase->NumRefrigSystems > 0) {
    9691       15840 :                     for (int systemID = 1; systemID <= state.dataRefrigCase->NumRefrigSystems; ++systemID) {
    9692       10944 :                         if (System(systemID).CoilFlag) continue;
    9693       10944 :                         System(systemID).UnmetEnergySaved = System(systemID).UnmetEnergy;
    9694             :                     }
    9695             :                 }
    9696       13536 :                 if (state.dataRefrigCase->NumTransRefrigSystems > 0) {
    9697         576 :                     for (int systemID = 1; systemID <= state.dataRefrigCase->NumTransRefrigSystems; ++systemID) {
    9698         288 :                         TransSystem(systemID).UnmetEnergySavedMT = TransSystem(systemID).UnmetEnergyMT;
    9699         288 :                         TransSystem(systemID).UnmetEnergySavedLT = TransSystem(systemID).UnmetEnergyLT;
    9700             :                     }
    9701             :                 }
    9702       13536 :                 if (state.dataRefrigCase->NumSimulationSecondarySystems > 0) {
    9703         864 :                     for (int secondID = 1; secondID <= state.dataRefrigCase->NumSimulationSecondarySystems; ++secondID) {
    9704         576 :                         if (Secondary(secondID).CoilFlag) continue;
    9705         576 :                         Secondary(secondID).UnmetEnergySaved = Secondary(secondID).UnmetEnergy;
    9706             :                     }
    9707             :                 }
    9708             :                 // Following lagged variables set for consistency to value calculated prev time through HVAC time step loops
    9709       13536 :                 if (allocated(state.dataHeatBal->HeatReclaimRefrigeratedRack)) {
    9710       32736 :                     for (int IRack = 1; IRack <= state.dataRefrigCase->NumRefrigeratedRacks; ++IRack) {
    9711       21792 :                         RefrigRack(IRack).LaggedUsedHVACCoil =
    9712       21792 :                             state.dataHeatBal->HeatReclaimRefrigeratedRack(IRack).HVACDesuperheaterReclaimedHeatTotal;
    9713       21792 :                         RefrigRack(IRack).LaggedUsedWaterHeater =
    9714       21792 :                             state.dataHeatBal->HeatReclaimRefrigeratedRack(IRack).WaterHeatingDesuperheaterReclaimedHeatTotal;
    9715             :                     }
    9716             :                 }
    9717       13536 :                 if (allocated(state.dataHeatBal->HeatReclaimRefrigCondenser)) {
    9718       15264 :                     for (int ICond = 1; ICond <= state.dataRefrigCase->NumRefrigCondensers; ++ICond) {
    9719       10368 :                         Condenser(ICond).LaggedUsedHVACCoil =
    9720       10368 :                             state.dataHeatBal->HeatReclaimRefrigCondenser(ICond).HVACDesuperheaterReclaimedHeatTotal;
    9721       10368 :                         Condenser(ICond).LaggedUsedWaterHeater =
    9722       10368 :                             state.dataHeatBal->HeatReclaimRefrigCondenser(ICond).WaterHeatingDesuperheaterReclaimedHeatTotal;
    9723             :                     }
    9724             :                 }
    9725             :             } // repeating same time step
    9726             : 
    9727             :         } else { // using UseSysTimeStep as a flag for a chiller system
    9728             : 
    9729             :             // Used to determine whether the system time step is a repetition
    9730       20352 :             Real64 MyStepStartTime = state.dataGlobal->CurrentTime - state.dataGlobal->TimeStepZone + state.dataHVACGlobal->SysTimeElapsed;
    9731       20352 :             if (std::abs(MyStepStartTime - state.dataRefrigCase->MyStepStartTimeSaved) < MySmallNumber) {
    9732             :                 // If the time step is repeated, need to return to correct values at start of time step
    9733       19499 :                 if (state.dataRefrigCase->NumSimulationRefrigAirChillers > 0) {
    9734     1637916 :                     for (int coilID = 1; coilID <= state.dataRefrigCase->NumSimulationRefrigAirChillers; ++coilID) {
    9735     1618417 :                         WarehouseCoil(coilID).KgFrost = WarehouseCoil(coilID).KgFrostSaved;
    9736     1618417 :                         WarehouseCoil(coilID).IceTemp = WarehouseCoil(coilID).IceTempSaved;
    9737             :                     }
    9738             :                 }
    9739             :             } else { // First time through this system time step or hvac loop,
    9740             :                 // so set saved values to those in place at start of this time step
    9741         853 :                 state.dataRefrigCase->MyStepStartTimeSaved = MyStepStartTime;
    9742         853 :                 if (state.dataRefrigCase->NumSimulationRefrigAirChillers > 0) {
    9743       71652 :                     for (int coilID = 1; coilID <= state.dataRefrigCase->NumSimulationRefrigAirChillers; ++coilID) {
    9744       70799 :                         WarehouseCoil(coilID).KgFrostSaved = WarehouseCoil(coilID).KgFrost;
    9745       70799 :                         WarehouseCoil(coilID).IceTempSaved = WarehouseCoil(coilID).IceTemp;
    9746             :                     }
    9747             :                 }
    9748             :                 // Following lagged variables set for consistency to value calculated prev time through HVAC time step loops
    9749         853 :                 if (allocated(state.dataHeatBal->HeatReclaimRefrigeratedRack)) {
    9750           0 :                     for (int IRack = 1; IRack <= state.dataRefrigCase->NumRefrigeratedRacks; ++IRack) {
    9751           0 :                         RefrigRack(IRack).LaggedUsedHVACCoil =
    9752           0 :                             state.dataHeatBal->HeatReclaimRefrigeratedRack(IRack).HVACDesuperheaterReclaimedHeatTotal;
    9753           0 :                         RefrigRack(IRack).LaggedUsedWaterHeater =
    9754           0 :                             state.dataHeatBal->HeatReclaimRefrigeratedRack(IRack).WaterHeatingDesuperheaterReclaimedHeatTotal;
    9755             :                     }
    9756             :                 }
    9757         853 :                 if (allocated(state.dataHeatBal->HeatReclaimRefrigCondenser)) {
    9758        8530 :                     for (int ICond = 1; ICond <= state.dataRefrigCase->NumRefrigCondensers; ++ICond) {
    9759        7677 :                         Condenser(ICond).LaggedUsedHVACCoil =
    9760        7677 :                             state.dataHeatBal->HeatReclaimRefrigCondenser(ICond).HVACDesuperheaterReclaimedHeatTotal;
    9761        7677 :                         Condenser(ICond).LaggedUsedWaterHeater =
    9762        7677 :                             state.dataHeatBal->HeatReclaimRefrigCondenser(ICond).WaterHeatingDesuperheaterReclaimedHeatTotal;
    9763             :                     }
    9764             :                 }
    9765             :             } // if first time
    9766             :         }     //(.NOT. UseSysTimeStep)
    9767             : 
    9768             :     } // warm up flag
    9769             : 
    9770      469693 :     if (state.dataGlobal->AnyEnergyManagementSystemInModel) {
    9771       26130 :         if (state.dataRefrigCase->NumRefrigSystems > 0) {
    9772       19503 :             for (int systemID = 1; systemID <= state.dataRefrigCase->NumRefrigSystems; ++systemID) {
    9773       13002 :                 if (System(systemID).EMSOverrideOnTCondenseMin) {
    9774           0 :                     System(systemID).TCondenseMin = System(systemID).EMSOverrideValueTCondenseMin;
    9775             :                 } else {
    9776       13002 :                     System(systemID).TCondenseMin = System(systemID).TCondenseMinInput;
    9777             :                 }
    9778             :             }
    9779             :         }
    9780             :     }
    9781      469693 : }
    9782             : 
    9783       71108 : void InitRefrigerationPlantConnections(EnergyPlusData &state)
    9784             : {
    9785             : 
    9786             :     // SUBROUTINE INFORMATION:
    9787             :     //       AUTHOR         B. Griffith
    9788             :     //       DATE WRITTEN   Dec 2010
    9789             :     //       MODIFIED       na
    9790             :     //       RE-ENGINEERED  na
    9791             : 
    9792             :     // PURPOSE OF THIS SUBROUTINE:
    9793             :     // do inits that should only occur when component model routines
    9794             :     // are entered from plant, for water cooled Condensers and Refrigeration Racks
    9795             : 
    9796             :     static constexpr std::string_view RoutineName("InitRefrigerationPlantConnections");
    9797             : 
    9798       71108 :     auto &RefrigRack(state.dataRefrigCase->RefrigRack);
    9799       71108 :     auto &Condenser(state.dataRefrigCase->Condenser);
    9800             : 
    9801             :     // initialize plant topology information, if applicable
    9802       71108 :     if (state.dataRefrigCase->MyReferPlantScanFlag && allocated(state.dataPlnt->PlantLoop)) {
    9803           4 :         for (int RefCondLoop = 1; RefCondLoop <= state.dataRefrigCase->NumRefrigCondensers; ++RefCondLoop) {
    9804           2 :             if (Condenser(RefCondLoop).CondenserType != DataHeatBalance::RefrigCondenserType::Water) continue;
    9805             : 
    9806           1 :             bool errFlag = false;
    9807           3 :             PlantUtilities::ScanPlantLoopsForObject(state,
    9808           1 :                                                     Condenser(RefCondLoop).Name,
    9809             :                                                     DataPlant::PlantEquipmentType::RefrigSystemWaterCondenser,
    9810           1 :                                                     Condenser(RefCondLoop).plantLoc,
    9811             :                                                     errFlag,
    9812             :                                                     _,
    9813             :                                                     _,
    9814             :                                                     _,
    9815             :                                                     _,
    9816             :                                                     _);
    9817           1 :             if (errFlag) {
    9818           0 :                 ShowFatalError(state, "InitRefrigerationPlantConnections: Program terminated due to previous condition(s).");
    9819             :             }
    9820             : 
    9821           2 :             Real64 rho = FluidProperties::GetDensityGlycol(state,
    9822           1 :                                                            state.dataPlnt->PlantLoop(Condenser(RefCondLoop).plantLoc.loopNum).FluidName,
    9823             :                                                            20.0,
    9824           1 :                                                            state.dataPlnt->PlantLoop(Condenser(RefCondLoop).plantLoc.loopNum).FluidIndex,
    9825           1 :                                                            RoutineName);
    9826             : 
    9827           1 :             if (Condenser(RefCondLoop).FlowType == CndsrFlowType::ConstantFlow) {
    9828           0 :                 Condenser(RefCondLoop).MassFlowRateMax = Condenser(RefCondLoop).DesVolFlowRate * rho;
    9829           1 :             } else if (Condenser(RefCondLoop).FlowType == CndsrFlowType::VariableFlow) {
    9830           1 :                 Condenser(RefCondLoop).MassFlowRateMax = Condenser(RefCondLoop).VolFlowRateMax * rho;
    9831             :             }
    9832             :         }
    9833             : 
    9834           6 :         for (int RefCompRackLoop = 1; RefCompRackLoop <= state.dataRefrigCase->NumRefrigeratedRacks; ++RefCompRackLoop) {
    9835           4 :             if (RefrigRack(RefCompRackLoop).CondenserType != DataHeatBalance::RefrigCondenserType::Water) continue;
    9836             : 
    9837           1 :             bool errFlag = false;
    9838           3 :             PlantUtilities::ScanPlantLoopsForObject(state,
    9839           1 :                                                     RefrigRack(RefCompRackLoop).Name,
    9840             :                                                     DataPlant::PlantEquipmentType::RefrigerationWaterCoolRack,
    9841           1 :                                                     RefrigRack(RefCompRackLoop).plantLoc,
    9842             :                                                     errFlag,
    9843             :                                                     _,
    9844             :                                                     _,
    9845             :                                                     _,
    9846             :                                                     _,
    9847             :                                                     _);
    9848           1 :             if (errFlag) {
    9849           0 :                 ShowFatalError(state, "InitRefrigerationPlantConnections: Program terminated due to previous condition(s).");
    9850             :             }
    9851             : 
    9852           2 :             Real64 rho = FluidProperties::GetDensityGlycol(state,
    9853           1 :                                                            state.dataPlnt->PlantLoop(RefrigRack(RefCompRackLoop).plantLoc.loopNum).FluidName,
    9854             :                                                            20.0,
    9855           1 :                                                            state.dataPlnt->PlantLoop(RefrigRack(RefCompRackLoop).plantLoc.loopNum).FluidIndex,
    9856           1 :                                                            RoutineName);
    9857             : 
    9858           1 :             if (RefrigRack(RefCompRackLoop).FlowType == CndsrFlowType::ConstantFlow) {
    9859           0 :                 RefrigRack(RefCompRackLoop).MassFlowRateMax = RefrigRack(RefCompRackLoop).DesVolFlowRate * rho;
    9860           1 :             } else if (RefrigRack(RefCompRackLoop).FlowType == CndsrFlowType::VariableFlow) {
    9861           1 :                 RefrigRack(RefCompRackLoop).MassFlowRateMax = RefrigRack(RefCompRackLoop).VolFlowRateMax * rho;
    9862             :             }
    9863             :         }
    9864             : 
    9865           2 :         state.dataRefrigCase->MyReferPlantScanFlag = false;
    9866       71106 :     } else if (state.dataRefrigCase->MyReferPlantScanFlag && !state.dataGlobal->AnyPlantInModel) {
    9867           0 :         state.dataRefrigCase->MyReferPlantScanFlag = false;
    9868             :     }
    9869             : 
    9870       71108 :     if (state.dataGlobal->BeginEnvrnFlag && state.dataRefrigCase->InitRefrigerationPlantConnectionsMyBeginEnvrnFlag) {
    9871             : 
    9872             :         // do plant inits, if applicable
    9873          12 :         if (!state.dataRefrigCase->MyReferPlantScanFlag) {
    9874          24 :             for (int RefCondLoop = 1; RefCondLoop <= state.dataRefrigCase->NumRefrigCondensers; ++RefCondLoop) {
    9875          12 :                 if (Condenser(RefCondLoop).CondenserType != DataHeatBalance::RefrigCondenserType::Water) continue;
    9876             : 
    9877          12 :                 Real64 rho = FluidProperties::GetDensityGlycol(state,
    9878           6 :                                                                state.dataPlnt->PlantLoop(Condenser(RefCondLoop).plantLoc.loopNum).FluidName,
    9879             :                                                                20.0,
    9880           6 :                                                                state.dataPlnt->PlantLoop(Condenser(RefCondLoop).plantLoc.loopNum).FluidIndex,
    9881           6 :                                                                RoutineName);
    9882             : 
    9883           6 :                 if (Condenser(RefCondLoop).FlowType == CndsrFlowType::ConstantFlow) {
    9884           0 :                     Condenser(RefCondLoop).MassFlowRateMax = Condenser(RefCondLoop).DesVolFlowRate * rho;
    9885           6 :                 } else if (Condenser(RefCondLoop).FlowType == CndsrFlowType::VariableFlow) {
    9886           6 :                     Condenser(RefCondLoop).MassFlowRateMax = Condenser(RefCondLoop).VolFlowRateMax * rho;
    9887             :                 }
    9888             : 
    9889          18 :                 PlantUtilities::InitComponentNodes(
    9890          18 :                     state, 0.0, Condenser(RefCondLoop).MassFlowRateMax, Condenser(RefCondLoop).InletNode, Condenser(RefCondLoop).OutletNode);
    9891             :             }
    9892          36 :             for (int RefCompRackLoop = 1; RefCompRackLoop <= state.dataRefrigCase->NumRefrigeratedRacks; ++RefCompRackLoop) {
    9893          24 :                 if (RefrigRack(RefCompRackLoop).CondenserType != DataHeatBalance::RefrigCondenserType::Water) continue;
    9894             : 
    9895          12 :                 Real64 rho = FluidProperties::GetDensityGlycol(state,
    9896           6 :                                                                state.dataPlnt->PlantLoop(RefrigRack(RefCompRackLoop).plantLoc.loopNum).FluidName,
    9897             :                                                                20.0,
    9898           6 :                                                                state.dataPlnt->PlantLoop(RefrigRack(RefCompRackLoop).plantLoc.loopNum).FluidIndex,
    9899           6 :                                                                RoutineName);
    9900             : 
    9901           6 :                 if (RefrigRack(RefCompRackLoop).FlowType == CndsrFlowType::ConstantFlow) {
    9902           0 :                     RefrigRack(RefCompRackLoop).MassFlowRateMax = RefrigRack(RefCompRackLoop).DesVolFlowRate * rho;
    9903           6 :                 } else if (RefrigRack(RefCompRackLoop).FlowType == CndsrFlowType::VariableFlow) {
    9904           6 :                     RefrigRack(RefCompRackLoop).MassFlowRateMax = RefrigRack(RefCompRackLoop).VolFlowRateMax * rho;
    9905             :                 }
    9906             : 
    9907          18 :                 PlantUtilities::InitComponentNodes(state,
    9908             :                                                    0.0,
    9909           6 :                                                    RefrigRack(RefCompRackLoop).MassFlowRateMax,
    9910           6 :                                                    RefrigRack(RefCompRackLoop).InletNode,
    9911           6 :                                                    RefrigRack(RefCompRackLoop).OutletNode);
    9912             :             }
    9913             :         }
    9914          12 :         state.dataRefrigCase->InitRefrigerationPlantConnectionsMyBeginEnvrnFlag = false;
    9915             : 
    9916             :     } //(DataGlobals::BeginEnvrnFlag .AND. MyBeginEnvrnFlag)
    9917             : 
    9918       71108 :     if (!state.dataGlobal->BeginEnvrnFlag) state.dataRefrigCase->InitRefrigerationPlantConnectionsMyBeginEnvrnFlag = true;
    9919       71108 : }
    9920             : 
    9921      200582 : void RefrigRackData::CalcRackSystem(EnergyPlusData &state)
    9922             : {
    9923             : 
    9924             :     // SUBROUTINE INFORMATION:
    9925             :     //       AUTHOR         Richard Raustad, FSEC
    9926             :     //       DATE WRITTEN   Oct/Nov 2004
    9927             :     //       MODIFIED       Shirey, FSEC Dec 2004; Hudson, ORNL Feb 2007, July 2007
    9928             :     //       RE-ENGINEERED  na
    9929             : 
    9930             :     // PURPOSE OF THIS SUBROUTINE:
    9931             :     // Calculate compressor rack load, power, energy consumption, and condenser fan/pump power and consumption
    9932             : 
    9933             :     // METHODOLOGY EMPLOYED:
    9934             :     // Loop through cases attached to each rack and determine total load on compressor rack
    9935             : 
    9936             :     // REFERENCES:
    9937             :     // "Impact of ASHRAE Standard 62-1989 on Florida Supermarkets",
    9938             :     //  Florida Solar Energy Center, FSEC-CR-910-96, Final Report, Oct. 1996
    9939             : 
    9940             :     Real64 COPFTempOutput;          // Curve value for COPFTemp curve object
    9941             :     Real64 CondenserFrac;           // Fraction of condenser power as a function of outdoor temperature
    9942             :     Real64 TotalHeatRejectedToZone; // Total compressor and condenser fan heat rejected to zone (based on CaseRAFactor)
    9943             :     int HeatRejectZoneNum;          // Index to zone where heat is rejected
    9944             :     int HeatRejectZoneNodeNum;      // Index to zone where heat is rejected
    9945             :     Real64 OutWbTemp;               // Outdoor wet bulb temp at condenser air inlet node [C]
    9946             :     Real64 OutDbTemp;               // Outdoor dry bulb temp at condenser air inlet node [C]
    9947             :     Real64 EffectTemp;              // Effective outdoor temp when using evap condenser cooling [C]
    9948             :     Real64 HumRatIn;                // Humidity ratio of inlet air to condenser [kg/kg]
    9949             :     Real64 HumRatOut;               // Humidity ratio of outlet air from condenser (assumed saturated) [kg/kg]
    9950             :     Real64 BPress;                  // Barometric pressure at condenser air inlet node [Pa]
    9951             :     bool EvapAvail;                 // Control for evap condenser availability
    9952             : 
    9953      200582 :     auto &RefrigCase(state.dataRefrigCase->RefrigCase);
    9954      200582 :     auto &WalkIn(state.dataRefrigCase->WalkIn);
    9955      200582 :     auto &WarehouseCoil(state.dataRefrigCase->WarehouseCoil);
    9956      200582 :     auto &AirChillerSet(state.dataRefrigCase->AirChillerSet);
    9957             : 
    9958      200582 :     state.dataRefrigCase->TotalRackDeliveredCapacity = 0.0;
    9959      200582 :     state.dataRefrigCase->CompressorCOPactual = 0.0;
    9960      200582 :     state.dataRefrigCase->TotalCompressorPower = 0.0;
    9961      200582 :     state.dataRefrigCase->TotalCondenserFanPower = 0.0;
    9962      200582 :     state.dataRefrigCase->TotalCondenserPumpPower = 0.0;
    9963      200582 :     state.dataRefrigCase->TotalBasinHeatPower = 0.0;
    9964      200582 :     state.dataRefrigCase->TotalCondenserHeat = 0.0;
    9965      200582 :     TotalHeatRejectedToZone = 0.0;
    9966      200582 :     state.dataRefrigCase->TotalEvapWaterUseRate = 0.0;
    9967      200582 :     state.dataRefrigCase->RackSenCreditToZone = 0.0;
    9968      200582 :     state.dataRefrigCase->RackSenCreditToHVAC = 0.0;
    9969      200582 :     CondenserFrac = 0.0;
    9970      200582 :     EvapAvail = true;
    9971      200582 :     HeatRejectZoneNum = 0;
    9972      200582 :     HeatRejectZoneNodeNum = 0;
    9973             : 
    9974             :     // Loads for chiller sets are set in call to zone equipment element "SimAirChillerSet"
    9975             :     // (all chiller coils within a set are located in the same zone)
    9976             :     // (note non-zone, such as refrigeration, and zone equip, such as airchillersets, called at diff times)
    9977             :     // Loads are then defined for each chiller coil within the set in "CalculateAirChillerSet"
    9978             :     // In that subroutine, dispatch coils within each set in order specified for each zone
    9979             :     //  Below will assign loads to refrigeration system or secondary loop
    9980             :     // Note that this routine will go through all refrigeration systems, but loads for multiple systems
    9981             :     // with interactions will not be known for the intital calls with first HVAC time step. They will,
    9982             :     // however, be repeated when the last chiller set is called from ZoneEquipmentManager
    9983             :     // that's why important where init goes, don't want to zero out data should keep
    9984      200582 :     if (state.dataRefrigCase->UseSysTimeStep) {
    9985           0 :         for (int CoilSetIndex = 1; CoilSetIndex <= state.dataRefrigCase->NumRefrigChillerSets; ++CoilSetIndex) {
    9986           0 :             AirChillerSet(CoilSetIndex).CalculateAirChillerSets(state);
    9987             :         }
    9988             :     }
    9989             : 
    9990      200582 :     if (this->NumCoils > 0) {
    9991           0 :         for (int CoilIndex = 1; CoilIndex <= this->NumCoils; ++CoilIndex) {
    9992           0 :             int CoilID = this->CoilNum(CoilIndex);
    9993             :             // already CALLed CalculateCoil(CoilID) in CoilSet specified order
    9994             :             // increment TotalCoolingLoad for Compressors/condenser on each system
    9995           0 :             state.dataRefrigCase->TotalRackDeliveredCapacity += WarehouseCoil(CoilID).TotalCoolingLoad;
    9996             :             //      System(SysNum)%TotalCondDefrostCredit=System(SysNum)%TotalCondDefrostCredit + WarehouseCoil(CoilID)%HotDefrostCondCredit
    9997             :         } // NumCoils systems
    9998             :     }     // System(SysNum)%NumCoils > 0
    9999             : 
   10000      200582 :     if (this->NumCases > 0) {
   10001      519222 :         for (int caseNum = 1; caseNum <= this->NumCases; ++caseNum) {
   10002      318640 :             int CaseID = this->CaseNum(caseNum);
   10003      318640 :             RefrigCase(CaseID).CalculateCase(state);
   10004             : 
   10005             :             //   add evaporator load for all cases connected to rack
   10006      318640 :             state.dataRefrigCase->TotalRackDeliveredCapacity += RefrigCase(CaseID).TotalCoolingLoad;
   10007             : 
   10008             :             //   sensible and latent case credits already calculated in "CalculateCase"
   10009             :             //   Now need to calculate amount of condenser heat rejection that should be applied to zone
   10010             :             //                                     (used when HeatRejectionLocation = LocationZone)
   10011             :             //   if walk-ins are served by rack, user must specify heat rejection zone and 100% of heat
   10012             :             //   rejection goes to that zone - that is, no heat rejection goes to the HVAC return air
   10013      318640 :             if (this->HeatRejectionLocation == HeatRejLocation::Zone) {
   10014       74982 :                 if (this->NumWalkIns == 0) {
   10015       74982 :                     TotalHeatRejectedToZone += RefrigCase(CaseID).TotalCoolingLoad * (1.0 - state.dataRefrigCase->CaseRAFactor);
   10016             :                     //  CaseRAFactor is a module variable calculated in CalculateCase
   10017             :                     //   find zone number of first case on rack (all cases are in the same zone
   10018             :                     //  if HeatRejectionLocation = LocationZone and no walk-ins)
   10019       74982 :                     HeatRejectZoneNum = RefrigCase(this->CaseNum(1)).ActualZoneNum;
   10020       74982 :                     HeatRejectZoneNodeNum = RefrigCase(this->CaseNum(1)).ZoneNodeNum;
   10021             :                 } else { // have walk ins so no reduction in condenser heat rejection for caseRA factor
   10022           0 :                     TotalHeatRejectedToZone += RefrigCase(CaseID).TotalCoolingLoad;
   10023             :                 } // no walk ins
   10024             :             }
   10025             :         } // NumCases
   10026             :     }     // Numcases on rack > 0
   10027             : 
   10028      200582 :     if (this->NumWalkIns > 0) {
   10029           0 :         for (int WalkInIndex = 1; WalkInIndex <= this->NumWalkIns; ++WalkInIndex) {
   10030           0 :             int WalkInID = this->WalkInNum(WalkInIndex);
   10031           0 :             WalkIn(WalkInID).CalculateWalkIn(state);
   10032           0 :             state.dataRefrigCase->TotalRackDeliveredCapacity += WalkIn(WalkInID).TotalCoolingLoad;
   10033           0 :             if (this->HeatRejectionLocation == HeatRejLocation::Zone) {
   10034           0 :                 TotalHeatRejectedToZone += WalkIn(WalkInID).TotalCoolingLoad;
   10035           0 :                 HeatRejectZoneNum = this->HeatRejectionZoneNum;
   10036           0 :                 HeatRejectZoneNodeNum = this->HeatRejectionZoneNodeNum;
   10037             :             } // reject heat to zone
   10038             :         }     // WalkInIndex
   10039             :     }         // NumWalkIns>0
   10040             : 
   10041      200582 :     if (this->HeatRejectionLocation == HeatRejLocation::Zone) {
   10042       74982 :         COPFTempOutput = Curve::CurveValue(state, this->COPFTempPtr, state.dataLoopNodes->Node(HeatRejectZoneNodeNum).Temp);
   10043       74982 :         EvapAvail = false;
   10044             :     } else {
   10045      125600 :         if (this->OutsideAirNodeNum != 0) {
   10046      123578 :             OutDbTemp = state.dataLoopNodes->Node(this->OutsideAirNodeNum).Temp;
   10047      123578 :             BPress = state.dataLoopNodes->Node(this->OutsideAirNodeNum).Press;
   10048             :         } else {
   10049        2022 :             OutDbTemp = state.dataEnvrn->OutDryBulbTemp;
   10050        2022 :             BPress = state.dataEnvrn->OutBaroPress;
   10051             :         }
   10052      125600 :         EffectTemp = OutDbTemp;
   10053             : 
   10054             :         // IF schedule exists, evap condenser can be scheduled OFF
   10055             :         // Check schedule to determine evap condenser availability
   10056      125600 :         if (this->EvapSchedPtr > 0 && ScheduleManager::GetCurrentScheduleValue(state, this->EvapSchedPtr) == 0) EvapAvail = false;
   10057             : 
   10058             :         // Evaporative condensers will have their water flow shut off in cold months to avoid
   10059             :         //  'spectacular' icing problems.  Ideally, the user will use the evaporative schedule input
   10060             :         //  to set such a schedule.  However, sometimes, users will use a single input deck to model
   10061             :         //  one building in multiple climates, and may not think to put in such a schedule in the colder
   10062             :         //  climates.  To accommodate such applications, the variable EvapCutOutTdb is used as an extra
   10063             :         //  check.
   10064      125600 :         if (OutDbTemp < EvapCutOutTdb) EvapAvail = false;
   10065             : 
   10066      125600 :         if (this->CondenserType == DataHeatBalance::RefrigCondenserType::Evap && EvapAvail) {
   10067             :             // determine temps for evap cooling
   10068        2026 :             if (this->OutsideAirNodeNum != 0) {
   10069        2026 :                 HumRatIn = state.dataLoopNodes->Node(this->OutsideAirNodeNum).HumRat;
   10070             :             } else {
   10071           0 :                 HumRatIn = state.dataEnvrn->OutHumRat;
   10072             :             } // outsideairnode
   10073        2026 :             OutWbTemp = Psychrometrics::PsyTwbFnTdbWPb(state, OutDbTemp, HumRatIn, BPress);
   10074        2026 :             EffectTemp = OutWbTemp + (1.0 - this->EvapEffect) * (OutDbTemp - OutWbTemp);
   10075             :         } // evapAvail
   10076             : 
   10077             :         // Obtain water-cooled condenser inlet/outlet temps
   10078      125600 :         if (this->CondenserType == DataHeatBalance::RefrigCondenserType::Water) {
   10079        2022 :             this->InletTemp = state.dataLoopNodes->Node(this->InletNode).Temp;
   10080        2022 :             EffectTemp = state.dataLoopNodes->Node(this->InletNode).Temp + 5.0; // includes approach temp
   10081        2022 :             if (this->InletTemp < this->InletTempMin) {
   10082           0 :                 if (this->LowTempWarnIndex == 0) {
   10083           0 :                     ShowWarningMessage(state, "Refrigeration:CompressorRack: " + this->Name);
   10084           0 :                     ShowContinueError(state,
   10085             :                                       "Water-cooled condenser inlet temp lower than minimum allowed temp. Check returning water temperature "
   10086             :                                       "and/or minimum temperature setpoints.");
   10087             :                 } // LowTempWarnIndex
   10088           0 :                 ShowRecurringWarningErrorAtEnd(state,
   10089           0 :                                                "Refrigeration Compressor Rack " + this->Name +
   10090             :                                                    " - Condenser inlet temp lower than minimum allowed ... continues",
   10091             :                                                this->LowTempWarnIndex);
   10092             :                 // END IF  !LowTempWarn
   10093             :             } // InletTempMin
   10094             :         }     // DataHeatBalance::RefrigCondenserType::Water
   10095             : 
   10096      125600 :         COPFTempOutput = Curve::CurveValue(state, this->COPFTempPtr, EffectTemp);
   10097             :     } // Location Zone
   10098             : 
   10099      200582 :     state.dataRefrigCase->CompressorCOPactual = this->RatedCOP * COPFTempOutput;
   10100             : 
   10101      200582 :     if (state.dataRefrigCase->CompressorCOPactual > 0.0) {
   10102      200582 :         state.dataRefrigCase->TotalCompressorPower = state.dataRefrigCase->TotalRackDeliveredCapacity / state.dataRefrigCase->CompressorCOPactual;
   10103      200582 :         state.dataRefrigCase->TotalCondenserHeat = state.dataRefrigCase->TotalCompressorPower + state.dataRefrigCase->TotalRackDeliveredCapacity;
   10104             :     } else {
   10105           0 :         if (this->ShowCOPWarning) {
   10106           0 :             ShowWarningError(state, "Refrigeration:CompressorRack: " + this->Name);
   10107           0 :             ShowContinueError(state, " The calculated COP has a value of zero or is negative. Refer to Engineering Documentation for");
   10108           0 :             ShowContinueError(state, " further explanation of Compressor Rack COP as a Function of Temperature Curve.");
   10109           0 :             this->ShowCOPWarning = false;
   10110             :         }
   10111             :     }
   10112             : 
   10113             :     // calculate condenser fan usage here if not water-cooled; if water-cooled, fan is in separate tower object
   10114             :     // fan loads > 0 only if the connected cases are operating
   10115      200582 :     if (state.dataRefrigCase->TotalRackDeliveredCapacity > 0.0 && this->CondenserType != DataHeatBalance::RefrigCondenserType::Water) {
   10116      196344 :         if (this->TotCondFTempPtr != 0) {
   10117      104742 :             if (this->HeatRejectionLocation == HeatRejLocation::Zone) {
   10118       15356 :                 CondenserFrac =
   10119       30712 :                     max(0.0, min(1.0, Curve::CurveValue(state, this->TotCondFTempPtr, state.dataLoopNodes->Node(HeatRejectZoneNodeNum).Temp)));
   10120       15356 :                 state.dataRefrigCase->TotalCondenserFanPower = this->CondenserFanPower * CondenserFrac;
   10121       15356 :                 state.dataHeatBal->RefrigCaseCredit(HeatRejectZoneNum).SenCaseCreditToZone += this->CondenserFanPower * CondenserFrac;
   10122             :             } else {
   10123       89386 :                 CondenserFrac = max(0.0, min(1.0, Curve::CurveValue(state, this->TotCondFTempPtr, EffectTemp)));
   10124       89386 :                 state.dataRefrigCase->TotalCondenserFanPower = this->CondenserFanPower * CondenserFrac;
   10125             :             } // location zone
   10126             :         } else {
   10127       91602 :             CondenserFrac = 1.0;
   10128       91602 :             state.dataRefrigCase->TotalCondenserFanPower = this->CondenserFanPower * CondenserFrac;
   10129             :         } // TotCondFTempPtr
   10130             :     }     // Cooling Water type
   10131             : 
   10132             :     // calculate evap water use and water pump power, if applicable
   10133             :     // assumes pump runs whenever evap cooling is available to minimize scaling
   10134      200582 :     if (this->CondenserType == DataHeatBalance::RefrigCondenserType::Evap && EvapAvail) {
   10135        2026 :         state.dataRefrigCase->TotalCondenserPumpPower = this->EvapPumpPower;
   10136        2026 :         HumRatOut = Psychrometrics::PsyWFnTdbTwbPb(state, EffectTemp, OutWbTemp, BPress);
   10137        6078 :         state.dataRefrigCase->TotalEvapWaterUseRate = this->CondenserAirFlowRate * CondenserFrac *
   10138        8104 :                                                       Psychrometrics::PsyRhoAirFnPbTdbW(state, BPress, OutDbTemp, HumRatIn) * (HumRatOut - HumRatIn) /
   10139        2026 :                                                       Psychrometrics::RhoH2O(EffectTemp);
   10140             :     } // evapAvail
   10141             :     // calculate basin water heater load
   10142      200582 :     if (this->CondenserType == DataHeatBalance::RefrigCondenserType::Evap) {
   10143        4044 :         if ((state.dataRefrigCase->TotalRackDeliveredCapacity == 0.0) && (EvapAvail) && (OutDbTemp < this->BasinHeaterSetPointTemp)) {
   10144           0 :             state.dataRefrigCase->TotalBasinHeatPower = max(0.0, this->BasinHeaterPowerFTempDiff * (this->BasinHeaterSetPointTemp - OutDbTemp));
   10145             :             // provide warning if no heater power exists
   10146           0 :             if (state.dataRefrigCase->TotalBasinHeatPower == 0.0) {
   10147           0 :                 if (this->EvapFreezeWarnIndex == 0) {
   10148           0 :                     ShowWarningMessage(
   10149           0 :                         state, "Refrigeration Compressor Rack " + this->Name + " - Evap cooling of condenser underway with no basin heater power");
   10150           0 :                     ShowContinueError(state, "and condenser inlet air dry-bulb temp at or below the basin heater setpoint temperature.");
   10151           0 :                     ShowContinueErrorTimeStamp(state, "Continuing simulation.");
   10152             :                 } // EvapFreezeWarnIndex == 0
   10153           0 :                 ShowRecurringWarningErrorAtEnd(state,
   10154           0 :                                                "Refrigeration Compressor Rack " + this->Name +
   10155             :                                                    " - Evap cooling of condenser underway with no basin heater power ... continues",
   10156             :                                                this->EvapFreezeWarnIndex);
   10157             :                 // END IF
   10158             :             } // TotalBasinHeatPower == 0 when at outdoor freezing conditions
   10159             :         }     // cap
   10160             :     }         // evap condenser type
   10161             : 
   10162             :     // add in compressor and condenser fan power to rack heat rejection variables if the heat rejection location is to the zone
   10163             :     //   if walk-ins are served by rack, user must specify heat rejection zone and 100% of heat
   10164             :     //   rejection goes to that zone - that is, no condenser heat rejection goes to the HVAC return air
   10165      200582 :     if (this->HeatRejectionLocation == HeatRejLocation::Zone) {
   10166      149964 :         state.dataRefrigCase->TotalCondenserHeat = state.dataRefrigCase->TotalRackDeliveredCapacity + state.dataRefrigCase->TotalCompressorPower +
   10167       74982 :                                                    state.dataRefrigCase->TotalCondenserFanPower;
   10168       74982 :         if (HeatRejectZoneNum > 0 && state.dataRefrigCase->TotalRackDeliveredCapacity > 0.0) {
   10169       74346 :             if (this->NumWalkIns == 0) {
   10170             :                 //       rack report variables for condenser heat to Zone and/or HVAC
   10171             :                 //       The difference between TotalHeatRejectedToZone and TotalRackDeliveredCapacity is the heat sent to return air
   10172       74346 :                 state.dataRefrigCase->RackSenCreditToZone =
   10173       74346 :                     state.dataRefrigCase->TotalCondenserHeat * (TotalHeatRejectedToZone / state.dataRefrigCase->TotalRackDeliveredCapacity);
   10174       74346 :                 state.dataRefrigCase->RackSenCreditToHVAC = state.dataRefrigCase->TotalCondenserHeat - state.dataRefrigCase->RackSenCreditToZone;
   10175             :             } else { // walkins present and no rack heat rejection goes to return air
   10176           0 :                 state.dataRefrigCase->RackSenCreditToZone = state.dataRefrigCase->TotalCondenserHeat;
   10177           0 :                 state.dataRefrigCase->RackSenCreditToHVAC = 0.0;
   10178             :             } // walkins present
   10179             :             //     Update globals for use in Air Heat Balance and Zone Equipment Manager
   10180       74346 :             state.dataHeatBal->RefrigCaseCredit(HeatRejectZoneNum).SenCaseCreditToZone += state.dataRefrigCase->RackSenCreditToZone;
   10181             : 
   10182       74346 :             state.dataHeatBal->RefrigCaseCredit(HeatRejectZoneNum).SenCaseCreditToHVAC += state.dataRefrigCase->RackSenCreditToHVAC;
   10183             :         } // zone # > 0 and tot del cap > 0
   10184             :     }     // rack heat rejection to zone
   10185      200582 : }
   10186             : 
   10187      200582 : void RefrigRackData::ReportRackSystem(EnergyPlusData &state, int const RackNum)
   10188             : {
   10189             : 
   10190             :     // SUBROUTINE INFORMATION:
   10191             :     //       AUTHOR         Richard Raustad, FSEC
   10192             :     //       DATE WRITTEN   Oct/Nov 2004
   10193             :     //       MODIFIED       Hudson, ORNL Feb 2007, July 2007
   10194             :     //       RE-ENGINEERED  na
   10195             : 
   10196             :     // PURPOSE OF THIS SUBROUTINE:
   10197             :     // To report compressor rack variables
   10198             : 
   10199      200582 :     Real64 LocalTimeStep = state.dataGlobal->TimeStepZone;
   10200      200582 :     if (state.dataRefrigCase->UseSysTimeStep) LocalTimeStep = state.dataHVACGlobal->TimeStepSys;
   10201             : 
   10202      200582 :     this->RackCompressorPower = state.dataRefrigCase->TotalCompressorPower;
   10203      200582 :     this->RackElecConsumption = state.dataRefrigCase->TotalCompressorPower * LocalTimeStep * DataGlobalConstants::SecInHour;
   10204      200582 :     this->ActualCondenserFanPower = state.dataRefrigCase->TotalCondenserFanPower;
   10205      200582 :     this->CondenserFanConsumption = state.dataRefrigCase->TotalCondenserFanPower * LocalTimeStep * DataGlobalConstants::SecInHour;
   10206      200582 :     this->RackCapacity = state.dataRefrigCase->TotalRackDeliveredCapacity;
   10207      200582 :     this->RackCoolingEnergy = state.dataRefrigCase->TotalRackDeliveredCapacity * LocalTimeStep * DataGlobalConstants::SecInHour;
   10208      200582 :     this->RackCompressorCOP = state.dataRefrigCase->CompressorCOPactual;
   10209      200582 :     this->SensHVACCreditHeatRate = state.dataRefrigCase->RackSenCreditToHVAC;
   10210      200582 :     this->SensHVACCreditHeat = state.dataRefrigCase->RackSenCreditToHVAC * LocalTimeStep * DataGlobalConstants::SecInHour;
   10211      200582 :     this->SensZoneCreditHeatRate = state.dataRefrigCase->RackSenCreditToZone;
   10212      200582 :     this->SensZoneCreditHeat = state.dataRefrigCase->RackSenCreditToZone * LocalTimeStep * DataGlobalConstants::SecInHour;
   10213      200582 :     this->EvapWaterConsumpRate = state.dataRefrigCase->TotalEvapWaterUseRate;
   10214      200582 :     this->EvapWaterConsumption = state.dataRefrigCase->TotalEvapWaterUseRate * LocalTimeStep * DataGlobalConstants::SecInHour;
   10215      200582 :     this->ActualEvapPumpPower = state.dataRefrigCase->TotalCondenserPumpPower;
   10216      200582 :     this->EvapPumpConsumption = state.dataRefrigCase->TotalCondenserPumpPower * LocalTimeStep * DataGlobalConstants::SecInHour;
   10217      200582 :     this->BasinHeaterPower = state.dataRefrigCase->TotalBasinHeatPower;
   10218      200582 :     this->BasinHeaterConsumption = state.dataRefrigCase->TotalBasinHeatPower * LocalTimeStep * DataGlobalConstants::SecInHour;
   10219      200582 :     this->CondLoad = state.dataRefrigCase->TotalCondenserHeat;
   10220      200582 :     this->CondEnergy = state.dataRefrigCase->TotalCondenserHeat * LocalTimeStep * DataGlobalConstants::SecInHour;
   10221             :     // Set total rack heat rejection used for heat reclaim. Do not allow heat reclaim on stand alone (indoor) display cases.
   10222      200582 :     if (this->HeatRejectionLocation == HeatRejLocation::Zone) {
   10223       74982 :         state.dataHeatBal->HeatReclaimRefrigeratedRack(RackNum).AvailCapacity = 0.0;
   10224             :     } else {
   10225      125600 :         state.dataHeatBal->HeatReclaimRefrigeratedRack(RackNum).AvailCapacity =
   10226      125600 :             state.dataRefrigCase->TotalRackDeliveredCapacity * (1.0 + 1.0 / state.dataRefrigCase->CompressorCOPactual);
   10227             :     }
   10228             : 
   10229             :     // set water system demand request (if needed)
   10230      200582 :     if (this->EvapWaterSupplyMode == WaterSupply::FromTank) {
   10231        2022 :         int DemandARRID = this->EvapWaterTankDemandARRID;
   10232        2022 :         int RackTankID = this->EvapWaterSupTankID;
   10233        2022 :         state.dataWaterData->WaterStorage(RackTankID).VdotRequestDemand(DemandARRID) = this->EvapWaterConsumpRate;
   10234             :     }
   10235             : 
   10236      200582 :     SumZoneImpacts(state);
   10237      200582 : }
   10238             : 
   10239      544436 : void RefrigCaseData::CalculateCase(EnergyPlusData &state) // Absolute pointer to refrigerated case
   10240             : {
   10241             : 
   10242             :     // SUBROUTINE INFORMATION:
   10243             :     //       AUTHOR         Richard Raustad and Don Shirey, FSEC
   10244             :     //       DATE WRITTEN   Oct/Nov 2004
   10245             :     //       MODIFIED       Therese Stovall, ORNL, May 2008
   10246             :     //       RE-ENGINEERED  na
   10247             : 
   10248             :     // PURPOSE OF THIS SUBROUTINE:
   10249             :     // To model refrigerated cases.
   10250             : 
   10251             :     // METHODOLOGY EMPLOYED:
   10252             :     // Case performance is based on a latent component calculated using a user input curve object. The sensible
   10253             :     // component is made up of all equipment loads (fan, light, anti-sweat) and the sensible case credit
   10254             :     // calculated during initialization. A master schedule is used for the refrigerated case operation and
   10255             :     // additional schedules control the lights and defrost operation.
   10256             :     // The fan is assumed to be off for Hot-Gas and Electric defrost.
   10257             : 
   10258             :     // Unmet loads are accumulated to be met the following time step.  This usually occurs only during the
   10259             :     // defrost period, so the case calls for full capacity at the end of defrost to make up for the sensible
   10260             :     // case gains during the defrost period. This feature is also used if needed for restocking loads.
   10261             : 
   10262             :     // REFERENCES:
   10263             : 
   10264             :     // "Calculation of Humidity Effects on Energy Requirements of Refrigerated Display Cases",
   10265             :     //  R. H. Howell, Ph. D., P.E., ASHRAE Paper, 3687 (CH-93-16-4) (RP-596)
   10266             : 
   10267             :     // "Effects of Store Relative Humidity on Refrigerated Display Case Performance",
   10268             :     //  R. H. Howell, Ph. D., P.E., ASHRAE Paper, 3686 (CH-93-16-1) (RP-596)
   10269             : 
   10270             :     // "Analysis of Supermarket Dehumidification Alternatives",
   10271             :     //  Electric Power Research Institute, EPRI TR-100352, Project 2891-03 Final Report, Nov. 1992.
   10272             : 
   10273             :     // "Impact of ASHRAE Standard 62-1989 on Florida Supermarkets",
   10274             :     //  Florida Solar Energy Center, FSEC-CR-910-96, Final Report, Oct. 1996
   10275             : 
   10276      544436 :     Real64 CaseCreditFraction(0.0);      // Reduction in case credits due to e.g., reduced door openings at night
   10277      544436 :     Real64 DefrostSchedule(0.0);         // Display case defrost schedule
   10278      544436 :     Real64 DefrostDripDownSchedule(0.0); // Display case drip-down schedule (allows coil to drain after defrost)
   10279      544436 :     Real64 DefrostRatio(0.0);            // ratio of defrost energy at current zone temp/humrat to defrost
   10280             :     //    capacity at design condition
   10281      544436 :     Real64 LatentRatio(0.0); // ratio of latent capacity at current zone temp/humrat to
   10282             :     //    latent capacity at design condition
   10283      544436 :     Real64 LatentCap_Actual(0.0);   // Refrigerated case latent capacity at specific operating conditions
   10284      544436 :     Real64 LatentCaseCredit(0.0);   // Latent case credit delivered to zone (W)
   10285      544436 :     Real64 SensibleCap_Actual(0.0); // Refrigerated case sensible capacity at specific operating conditions
   10286      544436 :     Real64 SensibleLoadPrime(0.0);  // Sensible load due to cond, conv, rad, infil (W)
   10287      544436 :     Real64 TotalCap_Actual(0.0);    // Refrigerated case total capacity at specific operating conditions
   10288      544436 :     Real64 TotalLightingLoad(0.0);  // Total lighting energy rate (W)
   10289      544436 :     Real64 TotalFan(0.0);           // Total fan energy rate (W)
   10290      544436 :     Real64 TotalAntiSweat(0.0);     // Total anti-sweat heater energy rate (W)
   10291             : 
   10292             :     // Refrigerated display case defrost type (parameters)
   10293             :     // DefNone             = 0
   10294             :     // DefOffCycle         = 1
   10295             :     // DefHotFluid           = 2
   10296             :     // DefHotFluidOnDemand   = 3 (not available)
   10297             :     // DefHotFluidTerm       = 4
   10298             :     // DefElectric         = 5
   10299             :     // DefElectricOnDemand = 6 (not available)
   10300             :     // DefElectricTerm     = 7
   10301             : 
   10302      544436 :     state.dataRefrigCase->CaseRAFactor = 0.0;
   10303             : 
   10304             :     // Zone relative humidity (%)
   10305     2177744 :     Real64 ZoneRHPercent = Psychrometrics::PsyRhFnTdbWPb(state,
   10306      544436 :                                                          state.dataLoopNodes->Node(this->ZoneNodeNum).Temp,
   10307      544436 :                                                          state.dataLoopNodes->Node(this->ZoneNodeNum).HumRat,
   10308      544436 :                                                          state.dataEnvrn->OutBaroPress) *
   10309      544436 :                            100.0;
   10310             : 
   10311             :     // Zone dew point (C)
   10312      544436 :     Real64 ZoneDewPoint = Psychrometrics::PsyTdpFnWPb(state, state.dataLoopNodes->Node(this->ZoneNodeNum).HumRat, state.dataEnvrn->OutBaroPress);
   10313             : 
   10314             :     // Display case operating temperature
   10315      544436 :     Real64 TCase = this->Temperature;
   10316             : 
   10317             :     // GET ALL SCHEDULES (note all schedules can be fractions if on/off a portion of time step)
   10318             :     // case schedule should be coincident with the zone time step otherwise the simulation proceeds
   10319             : 
   10320             :     // Current value of case operating (availability) schedule
   10321      544436 :     Real64 CaseSchedule = ScheduleManager::GetCurrentScheduleValue(state, this->SchedPtr);
   10322      544436 :     if (CaseSchedule <= 0) return;
   10323             :     // get defrost schedule
   10324      544436 :     if (this->defrostType > RefCaseDefrostType::None) {
   10325      441380 :         DefrostSchedule = ScheduleManager::GetCurrentScheduleValue(state, this->DefrostSchedPtr);
   10326      441380 :         DefrostDripDownSchedule = ScheduleManager::GetCurrentScheduleValue(state, this->DefrostDripDownSchedPtr);
   10327             :         // next statement In case user doesn't understand concept of drip down schedule
   10328      441380 :         DefrostDripDownSchedule = max(DefrostDripDownSchedule, DefrostSchedule);
   10329             :     } else {
   10330      103056 :         DefrostSchedule = 0.0;
   10331      103056 :         DefrostDripDownSchedule = 0.0;
   10332             :     }
   10333             : 
   10334      544436 :     Real64 StockingSchedule(0.0); // Current value of product stocking schedule (W/m)
   10335             : 
   10336             :     // get product stocking schedule and load due to product stocking, if no schedule exists load is 0
   10337      544436 :     if (this->StockingSchedPtr > 0) {
   10338      544436 :         StockingSchedule = ScheduleManager::GetCurrentScheduleValue(state, this->StockingSchedPtr);
   10339             :     } else {
   10340           0 :         StockingSchedule = 0.0;
   10341             :     }
   10342             :     // get lighting schedule and total load due to lighting
   10343      544436 :     Real64 LightingSchedule = ScheduleManager::GetCurrentScheduleValue(state, this->LightingSchedPtr);
   10344             : 
   10345             :     // if case credit reduction fraction schedule exists, modify both sensible and latent case credits
   10346             :     // according to schedule - used to account for variable case envelope, such as night covers.
   10347      544436 :     if (this->CaseCreditFracSchedPtr != 0) {
   10348      345946 :         CaseCreditFraction = ScheduleManager::GetCurrentScheduleValue(state, this->CaseCreditFracSchedPtr);
   10349             :     } else {
   10350      198490 :         CaseCreditFraction = 1.0;
   10351             :     }
   10352             : 
   10353             :     // CALCULATE AUX LOADS DUE TO LIGHTS, FAN AND STOCKING
   10354      544436 :     TotalLightingLoad = this->DesignLighting * LightingSchedule;
   10355             : 
   10356             :     // Lighting energy to case
   10357      544436 :     Real64 TotalLightToCase = TotalLightingLoad * this->LightingFractionToCase;
   10358             : 
   10359             :     // Lighting energy to zone
   10360      544436 :     Real64 TotalLightToZone = TotalLightingLoad - TotalLightToCase;
   10361             :     // cycle fan according to defrost schedule
   10362             :     // turn fan on for none or off-cycle defrost types
   10363      544436 :     if (this->defrostType == RefCaseDefrostType::None || this->defrostType == RefCaseDefrostType::OffCycle) {
   10364      261170 :         TotalFan = this->DesignFanPower;
   10365             :     } else {
   10366      283266 :         TotalFan = this->DesignFanPower * (1.0 - DefrostDripDownSchedule);
   10367             :     }
   10368             :     // get  load due to product stocking
   10369             :     // accumulate stocking loads for reporting to help evaluate any cumulative unmet loads problems
   10370             :     // only accumulate energy during actual simulation (so same if DD's are switched)
   10371             : 
   10372             :     // Total load due to stocking case product (W)
   10373      544436 :     Real64 StockingLoad = StockingSchedule * this->Length;
   10374      544436 :     if (!state.dataGlobal->WarmupFlag) {
   10375       63072 :         Real64 DeltaStockingEnergy = (StockingLoad * state.dataGlobal->TimeStepZoneSec);
   10376       63072 :         this->StockingEnergy += DeltaStockingEnergy;
   10377             :     } // warm up
   10378             :     // CALCULTE ALL LOADS INFLUENCED BY ZONE TEMPERATURE AND RH
   10379             :     // Anti-sweat heater capacity
   10380      544436 :     switch (this->AntiSweatControlType) {
   10381      344678 :     case ASHtrCtrlType::None: {
   10382      344678 :         TotalAntiSweat = 0.0;
   10383      344678 :     } break;
   10384           0 :     case ASHtrCtrlType::Constant: {
   10385           0 :         TotalAntiSweat = this->AntiSweatPower;
   10386           0 :     } break;
   10387      103516 :     case ASHtrCtrlType::Linear: {
   10388      103516 :         TotalAntiSweat =
   10389      103516 :             this->AntiSweatPower * min(1.0, max(0.0, 1.0 - (this->RatedAmbientRH - ZoneRHPercent) / (this->RatedAmbientRH - this->HumAtZeroAS)));
   10390      103516 :         TotalAntiSweat = max(this->MinimumASPower, TotalAntiSweat);
   10391      103516 :     } break;
   10392           0 :     case ASHtrCtrlType::DewPoint: {
   10393           0 :         TotalAntiSweat = this->AntiSweatPower * min(1.0, max(0.0, (ZoneDewPoint - TCase) / (this->RatedAmbientDewPoint - TCase)));
   10394           0 :         TotalAntiSweat = max(this->MinimumASPower, TotalAntiSweat);
   10395           0 :     } break;
   10396       96242 :     case ASHtrCtrlType::HeatBalance: {
   10397       96242 :         if (this->Rcase > 0.0) {
   10398      192484 :             TotalAntiSweat = (((ZoneDewPoint - state.dataLoopNodes->Node(this->ZoneNodeNum).Temp) * this->Height / Rair) +
   10399       96242 :                               ((ZoneDewPoint - TCase) * this->Height / this->Rcase));
   10400       96242 :             TotalAntiSweat = min(this->AntiSweatPower, max(this->MinimumASPower, TotalAntiSweat));
   10401             :         } else {
   10402           0 :             TotalAntiSweat = 0.0;
   10403             :         }
   10404       96242 :     } break;
   10405           0 :     default: {
   10406             :         // should never execute this CASE statement
   10407           0 :         TotalAntiSweat = 0.0;
   10408           0 :     } break;
   10409             :     }
   10410      544436 :     TotalAntiSweat *= this->Length;
   10411             : 
   10412             :     // Anti-sweat heater energy to case
   10413      544436 :     Real64 TotalASHeaterToCase = this->ASHeaterFractionToCase * TotalAntiSweat;
   10414             : 
   10415             :     // Anti-sweat heater energy to zone
   10416      544436 :     Real64 TotalASHeaterToZone = TotalAntiSweat - TotalASHeaterToCase;
   10417             : 
   10418             :     // latent capacity correction term at off-design conditions
   10419      544436 :     switch (this->LatentEnergyCurveType) {
   10420      443468 :     case EnergyEqnForm::CaseTemperatureMethod: {
   10421      443468 :         Real64 LatCapModFrac = Curve::CurveValue(state, this->LatCapCurvePtr, TCase);
   10422      443468 :         LatentRatio = max(0.0, (1.0 - (this->RatedAmbientRH - ZoneRHPercent) * LatCapModFrac));
   10423      443468 :     } break;
   10424       49064 :     case EnergyEqnForm::RHCubic: {
   10425       49064 :         LatentRatio = max(0.0, Curve::CurveValue(state, this->LatCapCurvePtr, ZoneRHPercent));
   10426       49064 :     } break;
   10427       51904 :     case EnergyEqnForm::DPCubic: {
   10428       51904 :         LatentRatio = max(0.0, Curve::CurveValue(state, this->LatCapCurvePtr, ZoneDewPoint));
   10429       51904 :     } break;
   10430           0 :     default:
   10431           0 :         break;
   10432             :     }
   10433             : 
   10434             :     // calculate latent case load (assumes no moisture load due to stocking)
   10435             :     // assume sensible case credits continue to accumulate in case during defrost/dripdown,
   10436             :     //    but latent credits/load and capacity only applied outside dripdownschedule
   10437             : 
   10438             :     // Latent load placed on case at actual zone conditions (W)
   10439      544436 :     Real64 LatentLoad = this->DesignLatentCap * LatentRatio * CaseCreditFraction * (1.0 - DefrostDripDownSchedule);
   10440      544436 :     LatentCaseCredit = -LatentLoad;
   10441             :     // adjust sensible loads and case credit for actual zone temperature
   10442             :     // If zone temp rises above rated ambient temperature, total load can exceed case design capacity,
   10443             :     // so unmet cooling loads are accumulated to meet in the next time step. (Case credit fraction allows
   10444             :     //  extra insulation, e.g. night covers, or imitating a better insulated walk-in cooler)
   10445             : 
   10446             :     // used to look at extra sensible load due to excursions in zone T
   10447      544436 :     Real64 ZoneTempFactor = (state.dataLoopNodes->Node(ZoneNodeNum).Temp - TCase) / (this->RatedAmbientTemp - TCase);
   10448      544436 :     SensibleLoadPrime = this->DesignSensCaseCredit * ZoneTempFactor * CaseCreditFraction;
   10449             : 
   10450             :     // Sensible load due to heaters, lighting (W)
   10451      544436 :     Real64 SensibleLoadAux = TotalLightToCase + TotalASHeaterToCase + TotalFan + StockingLoad;
   10452             : 
   10453             :     // Total sensible load on case, may not = capacity applied (W)
   10454      544436 :     Real64 SensibleLoadTotal = SensibleLoadPrime + SensibleLoadAux;
   10455             :     // include lighting and anti-sweat power not attributed to case load to sensible case credit
   10456             : 
   10457             :     // Sensible case credit delivered to zone (W)
   10458      544436 :     Real64 SensibleCaseCredit = TotalLightToZone + TotalASHeaterToZone - SensibleLoadPrime;
   10459             : 
   10460             :     // FROST:  keep track of frost build up on evaporator coil
   10461             :     // avoid accumulation during warm-up to avoid reverse dd test problem
   10462      544436 :     if (!state.dataGlobal->WarmupFlag) {
   10463       63072 :         Real64 DeltaFreezeKgFrost = LatentLoad * state.dataGlobal->TimeStepZoneSec / IcetoVaporEnthalpy;
   10464       63072 :         this->KgFrost += DeltaFreezeKgFrost;
   10465             :     }
   10466             : 
   10467      544436 :     if (TCase > TempTooHotToFrost) this->KgFrost = 0.0;
   10468             : 
   10469      544436 :     Real64 DefrostLoad_Actual(0.0); // heat load on case due to defrost (W)
   10470      544436 :     Real64 DefrostCap_Actual(0.0);  // power used to defrost (W)
   10471             : 
   10472             :     // DEFROST CALCULATIONS
   10473      544436 :     if (DefrostSchedule > 0.0) {
   10474       11593 :         if (this->defrostType != RefCaseDefrostType::None && this->defrostType != RefCaseDefrostType::OffCycle) {
   10475        8537 :             DefrostCap_Actual = this->DesignDefrostCap * DefrostSchedule;
   10476        8537 :             if (this->defrostType == RefCaseDefrostType::ElectricTerm || this->defrostType == RefCaseDefrostType::HotFluidTerm) {
   10477             :                 // calculate correction term for temperature termination defrost control
   10478        3952 :                 switch (this->DefrostEnergyCurveType) {
   10479        3952 :                 case EnergyEqnForm::CaseTemperatureMethod: {
   10480        3952 :                     Real64 DefCapModFrac = Curve::CurveValue(state, this->DefCapCurvePtr, TCase);
   10481        3952 :                     DefrostRatio = max(0.0, (1.0 - (this->RatedAmbientRH - ZoneRHPercent) * DefCapModFrac));
   10482        3952 :                 } break;
   10483           0 :                 case EnergyEqnForm::RHCubic: {
   10484           0 :                     DefrostRatio = max(0.0, Curve::CurveValue(state, this->DefCapCurvePtr, ZoneRHPercent));
   10485           0 :                 } break;
   10486           0 :                 case EnergyEqnForm::DPCubic: {
   10487           0 :                     DefrostRatio = max(0.0, Curve::CurveValue(state, this->DefCapCurvePtr, ZoneDewPoint));
   10488           0 :                 } break;
   10489           0 :                 case EnergyEqnForm::None: {
   10490           0 :                     DefrostRatio = 1.0;
   10491           0 :                 } break;
   10492           0 :                 default:
   10493           0 :                     break;
   10494             :                 }
   10495        3952 :                 DefrostCap_Actual *= DefrostRatio;
   10496             :             }
   10497             : 
   10498             :             // frost load at start of time step (kg of ice)
   10499        8537 :             Real64 StartFrostKg = this->KgFrost;
   10500             : 
   10501             :             // Energy form of defrost capacity (J)
   10502        8537 :             Real64 defrostEnergy = DefrostCap_Actual * state.dataGlobal->TimeStepZoneSec;
   10503             : 
   10504             :             // Frost melted by defrost during a time step (kg)
   10505        8537 :             Real64 FrostMeltedKg = min(defrostEnergy / IceMeltEnthalpy, StartFrostKg);
   10506        8537 :             this->KgFrost -= FrostMeltedKg;
   10507             : 
   10508             :             // Reduce defrost heat load on case by amount of ice melted during time step
   10509             :             // However, don't reduce the defrost capacity applied
   10510             : 
   10511        8537 :             DefrostLoad_Actual =
   10512        8537 :                 DefrostCap_Actual - FrostMeltedKg * IceMeltEnthalpy / state.dataGlobal->TimeStepZone / DataGlobalConstants::SecInHour;
   10513             : 
   10514        8537 :             if (!state.dataGlobal->WarmupFlag) { // avoid reverse dd test problems
   10515             :                 // keep running total of defrost energy above that needed to melt frost for use in evaluating
   10516             :                 //      problems of excessive unmet loads
   10517         992 :                 this->DeltaDefrostEnergy = max(0.0, (defrostEnergy - (FrostMeltedKg * IceMeltEnthalpy)));
   10518         992 :                 this->DefrostEnergy += this->DeltaDefrostEnergy;
   10519             :             }
   10520             :             // If hot brine or hot gas is used for defrost, need to reduce condenser load
   10521             :             // Note this condenser credit is not applied in compressor-rack systems.
   10522       13849 :             if (this->defrostType != RefCaseDefrostType::Electric && this->defrostType != RefCaseDefrostType::ElectricOnDemand &&
   10523        5312 :                 this->defrostType != RefCaseDefrostType::ElectricTerm)
   10524        3952 :                 this->HotDefrostCondCredit = DefrostCap_Actual * DefrostSchedule;
   10525             :         } else { // no defrost or off-cycle defrost
   10526        3056 :             DefrostCap_Actual = 0.0;
   10527        3056 :             DefrostLoad_Actual = 0.0;
   10528        3056 :             this->KgFrost = 0.0;
   10529             :             // Off-Cycle defrost is assumed to melt all the ice
   10530             :         } // defrost type
   10531             : 
   10532             :     } else { // DefrostSchedule = 0, so no defrost load or capacity
   10533      532843 :         DefrostLoad_Actual = 0.0;
   10534      532843 :         DefrostCap_Actual = 0.0;
   10535             :     } // Defrost calculations
   10536             : 
   10537             :     //*** See if capacity meets load and manage accumulated stored energy ***********************************
   10538             :     // total load on case at zone conditions (W)
   10539      544436 :     Real64 TotalLoad_Actual = SensibleLoadTotal + LatentLoad + DefrostLoad_Actual;
   10540             : 
   10541             :     // Rate needed to serve all stored energy during single time step (W)
   10542      544436 :     Real64 StoredEnergyRate = this->StoredEnergy / state.dataGlobal->TimeStepZone / DataGlobalConstants::SecInHour;
   10543      544436 :     Real64 LoadRequested = TotalLoad_Actual + StoredEnergyRate;
   10544             : 
   10545             :     // prorate available cooling capacity for portion of time off due to drip down.
   10546      544436 :     Real64 CapAvail = this->DesignRatedCap * (1.0 - DefrostDripDownSchedule);
   10547      544436 :     if (CapAvail >= LoadRequested) {
   10548             :         // Have more at least as much capacity available as needed, even counting stored energy
   10549      520041 :         TotalCap_Actual = LoadRequested;
   10550      520041 :         SensibleCap_Actual = SensibleLoadTotal + StoredEnergyRate;
   10551      520041 :         LatentCap_Actual = LatentLoad;
   10552      520041 :         this->StoredEnergy = 0.0;
   10553             :     } else {
   10554             :         // Don't have as much capacity as needed (during dripdown or period following dripdown)
   10555       24395 :         TotalCap_Actual = CapAvail;
   10556       24395 :         LatentCap_Actual = min(LatentLoad, CapAvail); // Latent load should never be > capavail, but just in case...
   10557       24395 :         SensibleCap_Actual = TotalCap_Actual - LatentCap_Actual;
   10558       24395 :         if (!state.dataGlobal->WarmupFlag) this->StoredEnergy += (TotalLoad_Actual - CapAvail) * state.dataGlobal->TimeStepZoneSec;
   10559             :     } // CapAvail vs Load requested
   10560             : 
   10561             :     // Reset DefrostLoad_Actual to zero for non-electric defrost types, for reporting purposes
   10562      997282 :     if (this->defrostType != RefCaseDefrostType::Electric && this->defrostType != RefCaseDefrostType::ElectricOnDemand &&
   10563      452846 :         this->defrostType != RefCaseDefrostType::ElectricTerm)
   10564      403782 :         DefrostCap_Actual = 0.0;
   10565             : 
   10566      544436 :     Real64 caseRAFraction = min(0.8, this->RAFrac);
   10567      544436 :     state.dataRefrigCase->CaseRAFactor = (1.0 - ((0.8 - caseRAFraction) / 0.8)) * 0.5;
   10568             : 
   10569             :     // Update globals for use in ZoneTemperaturePredictorCorrector (Air Heat Balance) and
   10570             :     //   Zone Equipment Manager. Sum case credits to zone and case credits to HVAC
   10571             : 
   10572             :     //** this needs a moisture variable NonAirSystemMoistureResponse (equivalent of NonAirSystemResponse) to properly
   10573             :     //** allocate moisture to the zone when the HVAC system is off.
   10574             : 
   10575             :     // Amount of sensible case credit applied to zone load (W)
   10576      544436 :     Real64 CaseSenCreditToZone = SensibleCaseCredit * (1.0 - state.dataRefrigCase->CaseRAFactor);
   10577             : 
   10578             :     // Amount of latent case credit applied to zone load (W)
   10579      544436 :     Real64 CaseLatCreditToZone = LatentCaseCredit * (1.0 - state.dataRefrigCase->CaseRAFactor);
   10580             : 
   10581             :     // Amount of sensible case credit applied to HVAC RA duct (W)
   10582      544436 :     Real64 CaseSenCreditToHVAC = SensibleCaseCredit * state.dataRefrigCase->CaseRAFactor;
   10583             : 
   10584             :     // Amount of latent case credit applied to HVAC RA duct (W)
   10585      544436 :     Real64 CaseLatCreditToHVAC = LatentCaseCredit * state.dataRefrigCase->CaseRAFactor;
   10586             : 
   10587      544436 :     state.dataHeatBal->RefrigCaseCredit(this->ActualZoneNum).SenCaseCreditToZone += CaseSenCreditToZone;
   10588      544436 :     state.dataHeatBal->RefrigCaseCredit(this->ActualZoneNum).LatCaseCreditToZone += CaseLatCreditToZone;
   10589      544436 :     state.dataHeatBal->RefrigCaseCredit(this->ActualZoneNum).SenCaseCreditToHVAC += CaseSenCreditToHVAC;
   10590      544436 :     state.dataHeatBal->RefrigCaseCredit(this->ActualZoneNum).LatCaseCreditToHVAC += CaseLatCreditToHVAC;
   10591             : 
   10592             :     // ReportRefrigeratedCase(CaseID)
   10593      544436 :     this->TotalCoolingLoad = TotalCap_Actual;
   10594      544436 :     this->TotalCoolingEnergy = TotalCap_Actual * state.dataGlobal->TimeStepZoneSec;
   10595      544436 :     this->SensCoolingEnergyRate = SensibleCap_Actual;
   10596      544436 :     this->SensCoolingEnergy = SensibleCap_Actual * state.dataGlobal->TimeStepZoneSec;
   10597      544436 :     this->LatCoolingEnergyRate = LatentCap_Actual;
   10598      544436 :     this->LatCoolingEnergy = LatentCap_Actual * state.dataGlobal->TimeStepZoneSec;
   10599             : 
   10600      544436 :     this->SensZoneCreditRate = CaseSenCreditToZone; // both positive or negative
   10601             :     // This rate can be positive or negative, split into separate output variables and always report positive value
   10602      544436 :     if (CaseSenCreditToZone <= 0.0) {
   10603      504107 :         this->SensZoneCreditCoolRate = -CaseSenCreditToZone;
   10604      504107 :         this->SensZoneCreditCool = -CaseSenCreditToZone * state.dataGlobal->TimeStepZoneSec;
   10605      504107 :         this->SensZoneCreditHeatRate = 0.0;
   10606      504107 :         this->SensZoneCreditHeat = 0.0;
   10607             :     } else {
   10608       40329 :         this->SensZoneCreditHeatRate = CaseSenCreditToZone;
   10609       40329 :         this->SensZoneCreditHeat = CaseSenCreditToZone * state.dataGlobal->TimeStepZoneSec;
   10610       40329 :         this->SensZoneCreditCoolRate = 0.0;
   10611       40329 :         this->SensZoneCreditCool = 0.0;
   10612             :     }
   10613             : 
   10614             :     // This rate should always be negative
   10615      544436 :     this->LatZoneCreditRate = CaseLatCreditToZone;
   10616      544436 :     this->LatZoneCredit = CaseLatCreditToZone * state.dataGlobal->TimeStepZoneSec;
   10617             : 
   10618      544436 :     this->SensHVACCreditRate = CaseSenCreditToHVAC;
   10619             :     // This rate can be positive or negative, split into separate output variables and always report positive value
   10620      544436 :     if (CaseSenCreditToHVAC <= 0.0) {
   10621      506108 :         this->SensHVACCreditCoolRate = -CaseSenCreditToHVAC;
   10622      506108 :         this->SensHVACCreditCool = -CaseSenCreditToHVAC * state.dataGlobal->TimeStepZoneSec;
   10623      506108 :         this->SensHVACCreditHeatRate = 0.0;
   10624      506108 :         this->SensHVACCreditHeat = 0.0;
   10625             :     } else {
   10626       38328 :         this->SensHVACCreditHeatRate = CaseSenCreditToHVAC;
   10627       38328 :         this->SensHVACCreditHeat = CaseSenCreditToHVAC * state.dataGlobal->TimeStepZoneSec;
   10628       38328 :         this->SensHVACCreditCoolRate = 0.0;
   10629       38328 :         this->SensHVACCreditCool = 0.0;
   10630             :     }
   10631             : 
   10632             :     // This rate should always be negative
   10633      544436 :     this->LatHVACCreditRate = CaseLatCreditToHVAC;
   10634      544436 :     this->LatHVACCredit = CaseLatCreditToHVAC * state.dataGlobal->TimeStepZoneSec;
   10635             : 
   10636      544436 :     this->ElecFanPower = TotalFan;
   10637      544436 :     this->ElecFanConsumption = TotalFan * state.dataGlobal->TimeStepZoneSec;
   10638      544436 :     this->ElecAntiSweatPower = TotalAntiSweat;
   10639      544436 :     this->ElecAntiSweatConsumption = TotalAntiSweat * state.dataGlobal->TimeStepZoneSec;
   10640      544436 :     this->ElecLightingPower = TotalLightingLoad;
   10641      544436 :     this->ElecLightingConsumption = TotalLightingLoad * state.dataGlobal->TimeStepZoneSec;
   10642      544436 :     this->ElecDefrostPower = DefrostCap_Actual;
   10643      544436 :     this->ElecDefrostConsumption = DefrostCap_Actual * state.dataGlobal->TimeStepZoneSec;
   10644             : 
   10645      544436 :     this->DefEnergyCurveValue = DefrostRatio;
   10646      544436 :     this->LatEnergyCurveValue = LatentRatio;
   10647             : 
   10648             :     //**************************************************************************************************
   10649             :     // Cap Energy and Kg Frost to avoid floating overflow errors
   10650             :     // 1-time warning is issued. It should be rare but could happen with unrealistic inputs.
   10651             : 
   10652             :     // Collect extra sensible load above design for possible warning if that is determining factor in
   10653             :     // excessively large stored energy
   10654      544436 :     if ((ZoneTempFactor * CaseCreditFraction) > 1.0) {
   10655      151938 :         if (!state.dataGlobal->WarmupFlag) {
   10656       14917 :             Real64 DeltaWarmEnvEnergy = (SensibleLoadPrime - this->DesignSensCaseCredit) * state.dataGlobal->TimeStepZoneSec;
   10657       14917 :             this->WarmEnvEnergy += DeltaWarmEnvEnergy;
   10658             :         }
   10659             :     }
   10660             : 
   10661      544436 :     if (this->DefrostEnergy > MyLargeNumber) this->DefrostEnergy = MyLargeNumber;
   10662      544436 :     if (this->WarmEnvEnergy > MyLargeNumber) this->WarmEnvEnergy = MyLargeNumber;
   10663      544436 :     if (this->StockingEnergy > MyLargeNumber) this->StockingEnergy = MyLargeNumber;
   10664      544436 :     if (this->StoredEnergy > MyLargeNumber) {
   10665           0 :         this->StoredEnergy = MyLargeNumber;
   10666           0 :         if (this->ShowStoreEnergyWarning) {
   10667           0 :             ShowWarningError(state, "Refrigeration:Case: " + this->Name);
   10668           0 :             if (this->StockingEnergy >= this->DefrostEnergy) {
   10669           0 :                 if (this->StockingEnergy >= this->WarmEnvEnergy) {
   10670           0 :                     ShowContinueError(state, " This case has insufficient capacity to meet excess energy associated with stocking.");
   10671           0 :                     ShowContinueError(state, " Refer to documentation for further explanation of product stocking requirements and");
   10672           0 :                     ShowContinueError(state, " Total Cooling Capacity.");
   10673             :                 } else {
   10674           0 :                     ShowContinueError(state,
   10675             :                                       " This case has insufficient capacity to meet excess energy associated with a zone enviroment temperature "
   10676             :                                       "greater than the design ambient for the case.");
   10677           0 :                     ShowContinueError(state, " Refer to documentation for further explanation of ");
   10678           0 :                     ShowContinueError(state, " Total Cooling Capacity.");
   10679             :                 } // Stocking energy > warm environment energy
   10680             :             } else {
   10681           0 :                 if (this->DefrostEnergy >= this->WarmEnvEnergy) {
   10682           0 :                     ShowContinueError(state, " This case has insufficient capacity to meet excess energy associated with defrost.");
   10683           0 :                     ShowContinueError(state, " Refer to documentation for further explanation of defrost control requirements and");
   10684           0 :                     ShowContinueError(state, " recommendations regarding Total Cooling Capacity, Sensible Heat Ratio, and Defrost Capacity.");
   10685             :                 } else {
   10686           0 :                     ShowContinueError(state,
   10687             :                                       " This case has insufficient capacity to meet excess energy associated with a zone enviroment temperature "
   10688             :                                       "greater than the design ambient for the case.");
   10689           0 :                     ShowContinueError(state, " Refer to documentation for further explanation of ");
   10690           0 :                     ShowContinueError(state, " Total Cooling Capacity.");
   10691             :                 }                                 // defrost energy > warm environment energy
   10692             :             }                                     // stock > defrost ELSE
   10693           0 :             this->ShowStoreEnergyWarning = false; // only give this warning once for any one case
   10694             :         }                                         // showstoreenergy warning true
   10695             :     }                                             // stored energy > large number
   10696             : 
   10697      544436 :     if (this->KgFrost > MyLargeNumber) {
   10698           0 :         this->KgFrost = MyLargeNumber;
   10699           0 :         if (this->ShowFrostWarning) {
   10700           0 :             ShowWarningError(state, "Refrigeration:Case: " + this->Name);
   10701           0 :             ShowContinueError(state, " This case has insufficient defrost capacity to remove the excess frost accumulation.");
   10702           0 :             ShowContinueError(state, " Refer to documentation for further explanation of product stocking requirements and");
   10703           0 :             ShowContinueError(state, " recommendations regarding Total Cooling Capacity, Sensible Heat Ratio, and Latent Heat Ratio.");
   10704           0 :             this->ShowFrostWarning = false;
   10705             :         }
   10706             :     }
   10707             : }
   10708             : 
   10709           1 : PlantComponent *RefrigCondenserData::factory(EnergyPlusData &state, std::string const &objectName)
   10710             : {
   10711             :     // Process the input data for boilers if it hasn't been done already
   10712           1 :     if (state.dataRefrigCase->GetRefrigerationInputFlag) {
   10713           0 :         CheckRefrigerationInput(state);
   10714           0 :         state.dataRefrigCase->GetRefrigerationInputFlag = false;
   10715             :     }
   10716             :     // Now look for this particular object in list
   10717           2 :     for (auto &obj : state.dataRefrigCase->Condenser) {
   10718           2 :         if (obj.Name == objectName) {
   10719           1 :             return &obj;
   10720             :         }
   10721             :     }
   10722             :     // If we didn't find it, fatal
   10723             :     ShowFatalError(state, "LocalRefrigCondenserFactory: Error getting inputs for object named: " + objectName); // LCOV_EXCL_LINE
   10724             :     // Shut up the compiler
   10725             :     return nullptr; // LCOV_EXCL_LINE
   10726             : }
   10727             : 
   10728           5 : void RefrigCondenserData::onInitLoopEquip(EnergyPlusData &state, [[maybe_unused]] const PlantLocation &calledFromLocation)
   10729             : {
   10730           5 :     InitRefrigeration(state);
   10731           5 :     InitRefrigerationPlantConnections(state);
   10732           5 : }
   10733             : 
   10734       35069 : void RefrigCondenserData::simulate(EnergyPlusData &state,
   10735             :                                    [[maybe_unused]] const PlantLocation &calledFromLocation,
   10736             :                                    bool const FirstHVACIteration,
   10737             :                                    [[maybe_unused]] Real64 &CurLoad,
   10738             :                                    [[maybe_unused]] bool const RunFlag)
   10739             : {
   10740             : 
   10741             :     // SUBROUTINE INFORMATION:
   10742             :     //       AUTHOR         Randy Hudson, ORNL
   10743             :     //       DATE WRITTEN   July 2007
   10744             :     //       MODIFIED       Therese Stovall, ORNL May 2008
   10745             :     //                      Brent Griffith, NREL Oct 2010, generalize fluid properties
   10746             :     //                        plant upgrades, moved where called from to SimPlantEquip from ManageNonZoneEquipment
   10747             :     //       RE-ENGINEERED  na
   10748             : 
   10749             :     // PURPOSE OF THIS SUBROUTINE:
   10750             :     // Simulates the water-cooled refrigeration condenser object.
   10751             :     // Modified to add condensers for detailed refrigeration systems and to
   10752             :     // avoid double-counting heat rejection that has been used in desuperheater
   10753             :     // hvac coils or water heaters.
   10754             : 
   10755             :     // METHODOLOGY EMPLOYED:
   10756             :     // Called from SimPlantEquip in PlantLoopEquipment , previously was called from Non-Zone Equipment Manager
   10757             :     // Flow is requested and the actual available flow is set.  The outlet temperature is calculated.
   10758             : 
   10759             :     static constexpr std::string_view RoutineName("SimRefrigCondenser");
   10760       35069 :     int PlantInletNode(0);
   10761       35069 :     int PlantOutletNode(0);
   10762       35069 :     PlantLocation PlantLoc{};
   10763             : 
   10764       35069 :     InitRefrigerationPlantConnections(state);
   10765             : 
   10766       70138 :     std::string TypeName;
   10767       70138 :     std::string ErrIntro;
   10768             : 
   10769             :     // set variables depending upon system type
   10770       35069 :     PlantInletNode = this->InletNode;
   10771       35069 :     PlantOutletNode = this->OutletNode;
   10772       35069 :     PlantLoc = this->plantLoc;
   10773             : 
   10774       35069 :     state.dataRefrigCase->TotalCondenserHeat = this->CondLoad;
   10775       35069 :     TypeName = "Refrigeration:Condenser:WaterCooled";
   10776       35069 :     ErrIntro = "Condenser for refrigeration system ";
   10777             : 
   10778             :     // Current condenser is water cooled
   10779             :     // Make demand request on first HVAC iteration
   10780             : 
   10781             :     // get cooling fluid properties
   10782       70138 :     Real64 rho = FluidProperties::GetDensityGlycol(state,
   10783       35069 :                                                    state.dataPlnt->PlantLoop(PlantLoc.loopNum).FluidName,
   10784             :                                                    this->InletTemp,
   10785       35069 :                                                    state.dataPlnt->PlantLoop(PlantLoc.loopNum).FluidIndex,
   10786       35069 :                                                    RoutineName);
   10787       70138 :     Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state,
   10788       35069 :                                                        state.dataPlnt->PlantLoop(PlantLoc.loopNum).FluidName,
   10789             :                                                        this->InletTemp,
   10790       35069 :                                                        state.dataPlnt->PlantLoop(PlantLoc.loopNum).FluidIndex,
   10791       35069 :                                                        RoutineName);
   10792             : 
   10793       35069 :     if (this->FlowType == CndsrFlowType::VariableFlow && state.dataRefrigCase->TotalCondenserHeat > 0.0) {
   10794             : 
   10795       34688 :         this->OutletTemp = ScheduleManager::GetCurrentScheduleValue(state, this->OutletTempSchedPtr);
   10796             : 
   10797       34688 :         if (this->OutletTemp == this->InletTemp) {
   10798             : 
   10799           0 :             if (this->HighInletWarnIndex == 0) {
   10800           0 :                 ShowSevereError(
   10801           0 :                     state, ErrIntro + ", \"" + this->Name + "\" : has inlet water temp equal to desired outlet temp. Excessive flow resulting. ");
   10802           0 :                 ShowContinueError(state, "cooling water is not cold enough to reach desired outlet temperature");
   10803             :             }
   10804           0 :             ShowRecurringWarningErrorAtEnd(state,
   10805           0 :                                            ErrIntro + ", \"" + this->Name + "\" : has inlet water temp equal to desired outlet temp.... continues. ",
   10806             :                                            this->HighInletWarnIndex);
   10807           0 :             this->VolFlowRate = 9999.0;
   10808           0 :             this->MassFlowRate = this->VolFlowRate * rho;
   10809             :         } else {
   10810       34688 :             Real64 DeltaT = this->OutletTemp - this->InletTemp;
   10811       34688 :             this->MassFlowRate = state.dataRefrigCase->TotalCondenserHeat / Cp / DeltaT;
   10812             :             // Check for maximum flow in the component
   10813       34688 :             if (this->MassFlowRate > this->MassFlowRateMax) {
   10814           0 :                 if (this->HighFlowWarnIndex == 0) {
   10815           0 :                     ShowWarningMessage(state, TypeName + this->Name);
   10816           0 :                     ShowContinueError(state, "Requested condenser water mass flow rate greater than maximum allowed value. ");
   10817           0 :                     ShowContinueError(state, "Flow reset to maximum value.");
   10818             :                 } // HighFlowWarnIndex
   10819           0 :                 ShowRecurringWarningErrorAtEnd(
   10820           0 :                     state, ErrIntro + this->Name + " - Flow rate higher than maximum allowed ... continues", this->HighFlowWarnIndex);
   10821             :                 // END IF
   10822           0 :                 this->MassFlowRate = this->MassFlowRateMax;
   10823             :             }
   10824             :         } // compare outlet T to inlet T
   10825             : 
   10826         381 :     } else if (this->FlowType == CndsrFlowType::ConstantFlow && state.dataRefrigCase->TotalCondenserHeat > 0.0) {
   10827             :         // this part for constant flow condition
   10828           0 :         this->VolFlowRate = this->DesVolFlowRate;
   10829           0 :         this->MassFlowRate = this->VolFlowRate * rho;
   10830             : 
   10831         381 :     } else if (state.dataRefrigCase->TotalCondenserHeat == 0.0) {
   10832         381 :         this->MassFlowRate = 0.0;
   10833             : 
   10834             :     } // on flow type
   10835             :     // check against plant, might get changed.
   10836       35069 :     PlantUtilities::SetComponentFlowRate(state, this->MassFlowRate, PlantInletNode, PlantOutletNode, PlantLoc);
   10837             : 
   10838       35069 :     this->VolFlowRate = this->MassFlowRate / rho;
   10839             : 
   10840       35069 :     if (this->MassFlowRate > 0) {
   10841       32490 :         this->OutletTemp = state.dataRefrigCase->TotalCondenserHeat / (this->MassFlowRate * Cp) + state.dataLoopNodes->Node(PlantInletNode).Temp;
   10842             :     } else {
   10843        2579 :         this->OutletTemp = this->InletTemp;
   10844        2579 :         if ((state.dataRefrigCase->TotalCondenserHeat > 0.0) && (!FirstHVACIteration)) {
   10845             : 
   10846          48 :             ShowRecurringWarningErrorAtEnd(
   10847             :                 state,
   10848          32 :                 TypeName + this->Name +
   10849             :                     "Water-cooled condenser has no cooling water flow. Heat is not being rejected from compressor rack condenser.",
   10850             :                 this->NoFlowWarnIndex);
   10851             :         }
   10852             :     }
   10853             :     // Check outlet water temp for max value
   10854       35069 :     if (this->OutletTemp > this->OutletTempMax) {
   10855           0 :         if (this->HighTempWarnIndex == 0) {
   10856           0 :             ShowWarningMessage(state, TypeName + this->Name);
   10857           0 :             ShowContinueError(state,
   10858             :                               "Water-cooled condenser outlet temp higher than maximum allowed temp. Check flow rates and/or temperature setpoints.");
   10859             :         }
   10860           0 :         ShowRecurringWarningErrorAtEnd(
   10861           0 :             state, ErrIntro + this->Name + " - Condenser outlet temp higher than maximum allowed ... continues", this->HighTempWarnIndex);
   10862             :     }
   10863             : 
   10864       35069 :     this->UpdateCondenser(state);
   10865       35069 : }
   10866             : 
   10867           1 : PlantComponent *RefrigRackData::factory(EnergyPlusData &state, std::string const &objectName)
   10868             : {
   10869             :     // Process the input data for boilers if it hasn't been done already
   10870           1 :     if (state.dataRefrigCase->GetRefrigerationInputFlag) {
   10871           0 :         CheckRefrigerationInput(state);
   10872           0 :         state.dataRefrigCase->GetRefrigerationInputFlag = false;
   10873             :     }
   10874             :     // Now look for this particular object in list
   10875           2 :     for (auto &obj : state.dataRefrigCase->RefrigRack) {
   10876           2 :         if (obj.Name == objectName) {
   10877           1 :             return &obj;
   10878             :         }
   10879             :     }
   10880             :     // If we didn't find it, fatal
   10881             :     ShowFatalError(state, "LocalRefrigRackFactory: Error getting inputs for object named: " + objectName); // LCOV_EXCL_LINE
   10882             :     // Shut up the compiler
   10883             :     return nullptr; // LCOV_EXCL_LINE
   10884             : }
   10885             : 
   10886           5 : void RefrigRackData::onInitLoopEquip(EnergyPlusData &state, [[maybe_unused]] const PlantLocation &calledFromLocation)
   10887             : {
   10888           5 :     InitRefrigeration(state);
   10889           5 :     InitRefrigerationPlantConnections(state);
   10890           5 : }
   10891             : 
   10892       36029 : void RefrigRackData::simulate(EnergyPlusData &state,
   10893             :                               [[maybe_unused]] const PlantLocation &calledFromLocation,
   10894             :                               bool const FirstHVACIteration,
   10895             :                               [[maybe_unused]] Real64 &CurLoad,
   10896             :                               [[maybe_unused]] bool const RunFlag)
   10897             : {
   10898             : 
   10899             :     // SUBROUTINE INFORMATION:
   10900             :     //       AUTHOR         Randy Hudson, ORNL
   10901             :     //       DATE WRITTEN   July 2007
   10902             :     //       MODIFIED       Therese Stovall, ORNL May 2008
   10903             :     //                      Brent Griffith, NREL Oct 2010, generalize fluid properties
   10904             :     //                        plant upgrades, moved where called from to SimPlantEquip from ManageNonZoneEquipment
   10905             :     //       RE-ENGINEERED  na
   10906             : 
   10907             :     // PURPOSE OF THIS SUBROUTINE:
   10908             :     // Simulates the water-cooled refrigeration condenser object.
   10909             :     // Modified to add condensers for detailed refrigeration systems and to
   10910             :     // avoid double-counting heat rejection that has been used in desuperheater
   10911             :     // hvac coils or water heaters.
   10912             : 
   10913             :     // METHODOLOGY EMPLOYED:
   10914             :     // Called from SimPlantEquip in PlantLoopEquipment , previously was called from Non-Zone Equipment Manager
   10915             :     // Flow is requested and the actual available flow is set.  The outlet temperature is calculated.
   10916             : 
   10917             :     static constexpr std::string_view RoutineName("SimRefrigCondenser");
   10918       36029 :     int PlantInletNode(0);
   10919       36029 :     int PlantOutletNode(0);
   10920       36029 :     PlantLocation PlantLoc{};
   10921             : 
   10922       36029 :     InitRefrigerationPlantConnections(state);
   10923             : 
   10924       72058 :     std::string TypeName;
   10925       72058 :     std::string ErrIntro;
   10926             : 
   10927             :     // set variables depending upon system type
   10928       36029 :     PlantInletNode = this->InletNode;
   10929       36029 :     PlantOutletNode = this->OutletNode;
   10930       36029 :     PlantLoc = this->plantLoc;
   10931             : 
   10932       36029 :     state.dataRefrigCase->TotalCondenserHeat =
   10933       36029 :         state.dataHeatBal->HeatReclaimRefrigeratedRack(this->MyIdx).AvailCapacity - this->LaggedUsedWaterHeater - this->LaggedUsedHVACCoil;
   10934       36029 :     TypeName = "Refrigeration:CompressorRack:";
   10935       36029 :     ErrIntro = "Condenser for refrigeration rack ";
   10936             : 
   10937             :     // Current condenser is water cooled
   10938             :     // Make demand request on first HVAC iteration
   10939             : 
   10940             :     // get cooling fluid properties
   10941       72058 :     Real64 rho = FluidProperties::GetDensityGlycol(state,
   10942       36029 :                                                    state.dataPlnt->PlantLoop(PlantLoc.loopNum).FluidName,
   10943             :                                                    this->InletTemp,
   10944       36029 :                                                    state.dataPlnt->PlantLoop(PlantLoc.loopNum).FluidIndex,
   10945       36029 :                                                    RoutineName);
   10946       72058 :     Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state,
   10947       36029 :                                                        state.dataPlnt->PlantLoop(PlantLoc.loopNum).FluidName,
   10948             :                                                        this->InletTemp,
   10949       36029 :                                                        state.dataPlnt->PlantLoop(PlantLoc.loopNum).FluidIndex,
   10950       36029 :                                                        RoutineName);
   10951             : 
   10952       36029 :     if (this->FlowType == CndsrFlowType::VariableFlow && state.dataRefrigCase->TotalCondenserHeat > 0.0) {
   10953       35648 :         this->OutletTemp = ScheduleManager::GetCurrentScheduleValue(state, this->OutletTempSchedPtr);
   10954             : 
   10955       35648 :         if (this->OutletTemp == this->InletTemp) {
   10956             : 
   10957           0 :             if (this->HighInletWarnIndex == 0) {
   10958           0 :                 ShowSevereError(
   10959           0 :                     state, ErrIntro + ", \"" + this->Name + "\" : has inlet water temp equal to desired outlet temp. Excessive flow resulting. ");
   10960           0 :                 ShowContinueError(state, "cooling water is not cold enough to reach desired outlet temperature");
   10961             :             }
   10962           0 :             ShowRecurringWarningErrorAtEnd(state,
   10963           0 :                                            ErrIntro + ", \"" + this->Name + "\" : has inlet water temp equal to desired outlet temp.... continues. ",
   10964             :                                            this->HighInletWarnIndex);
   10965           0 :             this->VolFlowRate = 9999.0;
   10966           0 :             this->MassFlowRate = this->VolFlowRate * rho;
   10967             :         } else {
   10968       35648 :             Real64 DeltaT = this->OutletTemp - this->InletTemp;
   10969       35648 :             this->MassFlowRate = state.dataRefrigCase->TotalCondenserHeat / Cp / DeltaT;
   10970             :             // Check for maximum flow in the component
   10971       35648 :             if (this->MassFlowRate > this->MassFlowRateMax) {
   10972           0 :                 if (this->HighFlowWarnIndex == 0) {
   10973           0 :                     ShowWarningMessage(state, TypeName + this->Name);
   10974           0 :                     ShowContinueError(state, "Requested condenser water mass flow rate greater than maximum allowed value. ");
   10975           0 :                     ShowContinueError(state, "Flow reset to maximum value.");
   10976             :                 } // HighFlowWarnIndex
   10977           0 :                 ShowRecurringWarningErrorAtEnd(
   10978           0 :                     state, ErrIntro + this->Name + " - Flow rate higher than maximum allowed ... continues", this->HighFlowWarnIndex);
   10979             :                 // END IF
   10980           0 :                 this->MassFlowRate = this->MassFlowRateMax;
   10981             :             }
   10982             :         } // compare outlet T to inlet T
   10983             : 
   10984         381 :     } else if (this->FlowType == CndsrFlowType::ConstantFlow && state.dataRefrigCase->TotalCondenserHeat > 0.0) {
   10985             :         // this part for constant flow condition
   10986           0 :         this->VolFlowRate = this->DesVolFlowRate;
   10987           0 :         this->MassFlowRate = this->VolFlowRate * rho;
   10988             : 
   10989         381 :     } else if (state.dataRefrigCase->TotalCondenserHeat == 0.0) {
   10990         381 :         this->MassFlowRate = 0.0;
   10991             : 
   10992             :     } // on flow type
   10993             :     // check against plant, might get changed.
   10994       36029 :     PlantUtilities::SetComponentFlowRate(state, this->MassFlowRate, PlantInletNode, PlantOutletNode, PlantLoc);
   10995             : 
   10996       36029 :     this->VolFlowRate = this->MassFlowRate / rho;
   10997             : 
   10998       36029 :     if (this->MassFlowRate > 0) {
   10999       33390 :         this->OutletTemp = state.dataRefrigCase->TotalCondenserHeat / (this->MassFlowRate * Cp) + state.dataLoopNodes->Node(PlantInletNode).Temp;
   11000             :     } else {
   11001        2639 :         this->OutletTemp = this->InletTemp;
   11002        2639 :         if ((state.dataRefrigCase->TotalCondenserHeat > 0.0) && (!FirstHVACIteration)) {
   11003             : 
   11004          48 :             ShowRecurringWarningErrorAtEnd(
   11005             :                 state,
   11006          32 :                 TypeName + this->Name +
   11007             :                     "Water-cooled condenser has no cooling water flow. Heat is not being rejected from compressor rack condenser.",
   11008             :                 this->NoFlowWarnIndex);
   11009             :         }
   11010             :     }
   11011             :     // Check outlet water temp for max value
   11012       36029 :     if (this->OutletTemp > this->OutletTempMax) {
   11013           0 :         if (this->HighTempWarnIndex == 0) {
   11014           0 :             ShowWarningMessage(state, TypeName + this->Name);
   11015           0 :             ShowContinueError(state,
   11016             :                               "Water-cooled condenser outlet temp higher than maximum allowed temp. Check flow rates and/or temperature setpoints.");
   11017             :         }
   11018           0 :         ShowRecurringWarningErrorAtEnd(
   11019           0 :             state, ErrIntro + this->Name + " - Condenser outlet temp higher than maximum allowed ... continues", HighTempWarnIndex);
   11020             :     }
   11021             : 
   11022       36029 :     this->UpdateCondenser(state);
   11023       36029 : }
   11024             : 
   11025       35069 : void RefrigCondenserData::UpdateCondenser(EnergyPlusData &state)
   11026             : {
   11027             : 
   11028             :     // SUBROUTINE INFORMATION:
   11029             :     //       AUTHOR         Randy Hudson, ORNL
   11030             :     //       DATE WRITTEN   July 2007
   11031             :     //       MODIFIED       na
   11032             :     //       RE-ENGINEERED  na
   11033             : 
   11034             :     // PURPOSE OF THIS SUBROUTINE:
   11035             :     // Updates the node variables with local variables.
   11036             : 
   11037             :     // Pass all variables from inlet to outlet node
   11038       35069 :     PlantUtilities::SafeCopyPlantNode(state, this->InletNode, this->OutletNode);
   11039             : 
   11040             :     // Set outlet node variables that are possibly changed
   11041       35069 :     state.dataLoopNodes->Node(this->OutletNode).Temp = this->OutletTemp;
   11042       35069 : }
   11043           0 : void RefrigCondenserData::oneTimeInit([[maybe_unused]] EnergyPlusData &state)
   11044             : {
   11045           0 : }
   11046           1 : void RefrigCondenserData::oneTimeInit_new([[maybe_unused]] EnergyPlusData &state)
   11047             : {
   11048           1 : }
   11049             : 
   11050       36029 : void RefrigRackData::UpdateCondenser(EnergyPlusData &state)
   11051             : {
   11052             : 
   11053             :     // SUBROUTINE INFORMATION:
   11054             :     //       AUTHOR         Randy Hudson, ORNL
   11055             :     //       DATE WRITTEN   July 2007
   11056             :     //       MODIFIED       na
   11057             :     //       RE-ENGINEERED  na
   11058             : 
   11059             :     // PURPOSE OF THIS SUBROUTINE:
   11060             :     // Updates the node variables with local variables.
   11061             : 
   11062             :     // Pass all variables from inlet to outlet node
   11063       36029 :     PlantUtilities::SafeCopyPlantNode(state, this->InletNode, this->OutletNode);
   11064             : 
   11065             :     // Set outlet node variables that are possibly changed
   11066       36029 :     state.dataLoopNodes->Node(this->OutletNode).Temp = this->OutletTemp;
   11067       36029 : }
   11068           0 : void RefrigRackData::oneTimeInit([[maybe_unused]] EnergyPlusData &state)
   11069             : {
   11070           0 : }
   11071             : 
   11072           1 : void RefrigRackData::oneTimeInit_new([[maybe_unused]] EnergyPlusData &state)
   11073             : {
   11074           1 : }
   11075             : 
   11076      388373 : void SimulateDetailedRefrigerationSystems(EnergyPlusData &state)
   11077             : {
   11078             : 
   11079             :     // SUBROUTINE INFORMATION:
   11080             :     //       AUTHOR         Therese Stovall, ORNL, Assisted by Hugh Henderson
   11081             :     //       DATE WRITTEN   Spring 2008
   11082             :     //       Based upon ManageRefrigeratedCaseRacks by Richard Raustad, FSEC
   11083             :     //          Oct/Nov 2004, and MODIFIED by Shirey, FSEC Dec 2004
   11084             :     //       RE-ENGINEERED  na
   11085             : 
   11086             :     // PURPOSE OF THIS SUBROUTINE:
   11087             :     // This subroutine is called to simulate detailed refrigeration systems
   11088             : 
   11089             :     // METHODOLOGY EMPLOYED:
   11090             :     // Each refrigeration system is modeled by first simulating the attached refrigerated cases.  The sum
   11091             :     // of the total heat transfer for all attached cases determines the load on the compressor rack.
   11092             :     // Iterations are used here to account for load transfer between independent refrigeration systems
   11093             :     // via mechanical subcoolers.
   11094             :     // The logical variable, UseSysTimeStep, determines whether we are evaluating only systems driven by
   11095             :     // ZoneEquipmentManager on the system time step, or only system driven by HVACManager on the zone time step.
   11096             : 
   11097             :     static constexpr std::string_view RoutineName("SimulateDetailedRefrigerationSystems");
   11098      388373 :     Real64 constexpr MaxDelTFloatFrac(0.5); // max fraction allowed for difference between case and evaporator temperature
   11099             : 
   11100      388373 :     auto &RefrigCase(state.dataRefrigCase->RefrigCase);
   11101      388373 :     auto &System(state.dataRefrigCase->System);
   11102      388373 :     auto &Condenser(state.dataRefrigCase->Condenser);
   11103      388373 :     auto &Subcooler(state.dataRefrigCase->Subcooler);
   11104      388373 :     auto &Secondary(state.dataRefrigCase->Secondary);
   11105      388373 :     auto &WalkIn(state.dataRefrigCase->WalkIn);
   11106      388373 :     auto &WarehouseCoil(state.dataRefrigCase->WarehouseCoil);
   11107      388373 :     auto &AirChillerSet(state.dataRefrigCase->AirChillerSet);
   11108      388373 :     auto &CoilSysCredit(state.dataRefrigCase->CoilSysCredit);
   11109             : 
   11110      388373 :     Real64 LocalTimeStep = state.dataGlobal->TimeStepZone;
   11111      388373 :     if (state.dataRefrigCase->UseSysTimeStep) LocalTimeStep = state.dataHVACGlobal->TimeStepSys;
   11112             : 
   11113             :     // Cascade condenser assumes a constant approach delta T (Tcond - Tevap), not f(load)
   11114             : 
   11115             :     // Loads for chiller sets are set in call to zone equipment element "SimAirChillerSet"
   11116             :     // (all chiller coils within a set are located in the same zone)
   11117             :     // (note non-zone, such as refrigeration, and zone equip, such as airchillersets, called at diff times)
   11118             :     // Loads are then defined for each chiller coil within the set in "CalculateAirChillerSet"
   11119             :     // In that subroutine, dispatch coils within each set in order specified for each zone
   11120             :     //  Below will assign loads to refrigeration system or secondary loop
   11121             :     // Note that this routine will go through all refrigeration systems, but loads for multiple systems
   11122             :     // with interactions will not be known for the intital calls with first HVAC time step. They will,
   11123             :     // however, be repeated when the last chiller set is called from ZoneEquipmentManager
   11124             :     // that's why important where init goes, don't want to zero out data should keep
   11125      388373 :     if (state.dataRefrigCase->UseSysTimeStep) {
   11126     3884705 :         for (int CoilSetIndex = 1; CoilSetIndex <= state.dataRefrigCase->NumRefrigChillerSets; ++CoilSetIndex) {
   11127     3531550 :             AirChillerSet(CoilSetIndex).CalculateAirChillerSets(state);
   11128             :         }
   11129             :     }
   11130             : 
   11131             :     // Do refrigeration system loop outside of iterative solution to initialize time step and
   11132             :     //  calculate case, walk-in, and secondary loop loads (that won't change during balance
   11133             :     //  of refrigeration system iterations) and prepare initial estimates for the iterative system solution
   11134     3645292 :     for (int SysNum = 1; SysNum <= state.dataRefrigCase->NumRefrigSystems; ++SysNum) {
   11135             :         // Only do those systems appropriate for this analysis, supermarket type on load time step or coil type on sys time step
   11136     9692233 :         if (((!state.dataRefrigCase->UseSysTimeStep) && (!System(SysNum).CoilFlag)) ||
   11137     6356790 :             ((state.dataRefrigCase->UseSysTimeStep) && (System(SysNum).CoilFlag))) {
   11138     3256919 :             if (System(SysNum).NumCases > 0) {
   11139      256970 :                 for (int CaseIndex = 1; CaseIndex <= System(SysNum).NumCases; ++CaseIndex) {
   11140      197488 :                     int CaseID = System(SysNum).CaseNum(CaseIndex);
   11141      197488 :                     RefrigCase(CaseID).CalculateCase(state);
   11142             :                     //  TevapDesign calc in Get Input to meet lowest evap temp of any load on the system.
   11143             :                     //  Tevap needed is either fixed at this design value,
   11144             :                     //  or allowed to float to meet lowest T needed among all loads served by the system
   11145             :                     //  (Floating Tevap = Design Tevap unless load <= Design cap)
   11146      197488 :                     if (System(SysNum).CompSuctControl == CompressorSuctionPressureCtrl::ConstantSuctionTemperature) {
   11147      183334 :                         System(SysNum).TEvapNeeded = System(SysNum).TEvapDesign;
   11148             :                     } else { // calculate floating T evap
   11149       14154 :                         Real64 LoadFrac = min(1.0, (RefrigCase(CaseID).TotalCoolingLoad / RefrigCase(CaseID).DesignRatedCap));
   11150       14154 :                         Real64 MaxTEvap = RefrigCase(CaseID).Temperature -
   11151       14154 :                                           (RefrigCase(CaseID).Temperature - RefrigCase(CaseID).EvapTempDesign) * max(LoadFrac, MaxDelTFloatFrac);
   11152             :                         // Compare Tevap for this case to max allowed for all previous cases on this suction group and set at the MINIMUM of the
   11153             :                         // two
   11154       14154 :                         if (CaseIndex == 1) { // note use case index, not caseid here to get first case on this suction group/system
   11155        4044 :                             System(SysNum).TEvapNeeded = MaxTEvap;
   11156             :                         } else {
   11157       10110 :                             System(SysNum).TEvapNeeded = min(MaxTEvap, System(SysNum).TEvapNeeded);
   11158             :                         }
   11159             :                     } // floating or constant evap temperature
   11160             :                     // increment TotalCoolingLoad for Compressors/condenser on each system and defrost condenser credits for heat recovery
   11161      197488 :                     System(SysNum).TotalCoolingLoad += RefrigCase(CaseID).TotalCoolingLoad;
   11162      197488 :                     System(SysNum).TotalCondDefrostCredit += RefrigCase(CaseID).HotDefrostCondCredit;
   11163             :                 } // NumCases
   11164             :             }     // Num of cases > 0
   11165             : 
   11166     3256919 :             if (System(SysNum).NumWalkIns > 0) {
   11167       88300 :                 for (int WalkInIndex = 1; WalkInIndex <= System(SysNum).NumWalkIns; ++WalkInIndex) {
   11168       44150 :                     int WalkInID = System(SysNum).WalkInNum(WalkInIndex);
   11169       44150 :                     WalkIn(WalkInID).CalculateWalkIn(state);
   11170       44150 :                     if (System(SysNum).CompSuctControl == CompressorSuctionPressureCtrl::ConstantSuctionTemperature) {
   11171       42128 :                         System(SysNum).TEvapNeeded = System(SysNum).TEvapDesign;
   11172             :                     } else { // calculate floating T evap
   11173        2022 :                         Real64 LoadFrac = min(1.0, (WalkIn(WalkInID).TotalCoolingLoad / WalkIn(WalkInID).DesignRatedCap));
   11174        2022 :                         Real64 MaxTEvap = WalkIn(WalkInID).Temperature -
   11175        2022 :                                           (WalkIn(WalkInID).Temperature - WalkIn(WalkInID).TEvapDesign) * max(LoadFrac, MaxDelTFloatFrac);
   11176             :                         //  Compare maxTevap for this walk in to max allowed for cases and for all
   11177             :                         //  previous walk ins on this suction group and set at the MINIMUM of the two
   11178        2022 :                         if (WalkInIndex == 1 && System(SysNum).NumCases == 0) {
   11179           0 :                             System(SysNum).TEvapNeeded = MaxTEvap;
   11180             :                         } else {
   11181        2022 :                             System(SysNum).TEvapNeeded = min(MaxTEvap, System(SysNum).TEvapNeeded);
   11182             :                         }
   11183             :                     } // floating or constant evap temperature
   11184             :                     // increment TotalCoolingLoad for Compressors/condenser on each system
   11185       44150 :                     System(SysNum).TotalCoolingLoad += WalkIn(WalkInID).TotalCoolingLoad;
   11186       44150 :                     System(SysNum).TotalCondDefrostCredit += WalkIn(WalkInID).HotDefrostCondCredit;
   11187             :                 } // NumWalkIns systems
   11188             :             }     // System(SysNum)%NumWalkIns > 0
   11189             : 
   11190     3256919 :             if (System(SysNum).NumCoils > 0) {
   11191    32490260 :                 for (int CoilIndex = 1; CoilIndex <= System(SysNum).NumCoils; ++CoilIndex) {
   11192    29311865 :                     int CoilID = System(SysNum).CoilNum(CoilIndex);
   11193             :                     // already CALLed CalculateCoil(CoilID) in CoilSet specified order
   11194    29311865 :                     if (System(SysNum).CompSuctControl == CompressorSuctionPressureCtrl::ConstantSuctionTemperature) {
   11195    29311865 :                         System(SysNum).TEvapNeeded = System(SysNum).TEvapDesign;
   11196             :                     } else { // calculate floating T evap
   11197             :                         // for now, override floating Tevap if coils on system, warning was printed in input to let user know
   11198           0 :                         System(SysNum).TEvapNeeded = System(SysNum).TEvapDesign;
   11199             :                     } // floating or constant evap temperature
   11200             :                     // increment TotalCoolingLoad for Compressors/condenser on each system
   11201    29311865 :                     System(SysNum).TotalCoolingLoad += WarehouseCoil(CoilID).TotalCoolingLoad;
   11202    29311865 :                     System(SysNum).TotalCondDefrostCredit += WarehouseCoil(CoilID).HotDefrostCondCredit;
   11203             :                 } // NumCoils systems
   11204             :             }     // System(SysNum)%NumCoils > 0
   11205             : 
   11206     3256919 :             if (System(SysNum).NumSecondarys > 0) {
   11207        8088 :                 for (int SecondIndex = 1; SecondIndex <= System(SysNum).NumSecondarys; ++SecondIndex) {
   11208        4044 :                     int SecondID = System(SysNum).SecondaryNum(SecondIndex);
   11209        4044 :                     Secondary(SecondID).CalculateSecondary(state, SecondID);
   11210        4044 :                     if (System(SysNum).CompSuctControl == CompressorSuctionPressureCtrl::ConstantSuctionTemperature) {
   11211        4044 :                         System(SysNum).TEvapNeeded = System(SysNum).TEvapDesign;
   11212             :                     } else { // check for lowest T evap design among the secondary systems and
   11213             :                         //  Compare Tevap for this second to max allowed for cases, walk ins, and
   11214             :                         //  for all previous secondary loops on this suction group and set
   11215             :                         //  at the MINIMUM (note secondary loops control capacity with
   11216             :                         //  brine flow rate, so don't float above their design evap temperature)
   11217           0 :                         if (SecondIndex == 1 && System(SysNum).NumNonCascadeLoads == 0) {
   11218           0 :                             System(SysNum).TEvapNeeded = Secondary(SecondID).TEvapDesign;
   11219             :                         } else {
   11220           0 :                             System(SysNum).TEvapNeeded = min(Secondary(SecondID).TEvapDesign, System(SysNum).TEvapNeeded);
   11221             :                         }
   11222             :                     } // floating or constant evap temperature
   11223             :                     // increment TotalCoolingLoad for Compressors/condenser on each system
   11224        4044 :                     System(SysNum).SumSecondaryLoopLoad += Secondary(SecondID).TotalCoolingLoad;
   11225        4044 :                     System(SysNum).TotalCondDefrostCredit += Secondary(SecondID).HotDefrostCondCredit;
   11226             :                 } // NumSecondarys systems
   11227             :             }     // System(SysNum)%NumSecondarys > 0
   11228             : 
   11229             :             // add suction pipe heat gains (W) if input by user
   11230             :             // Suction pipe heat gains aren't included in the reported total system load, but are heat gains that must be met in
   11231             :             //  condenser and compressor loads. However, secondary dist piping and receiver gains are included
   11232             :             //  in the total secondary system loads.
   11233     3256919 :             System(SysNum).PipeHeatLoad = 0.0;
   11234     3256919 :             if (System(SysNum).SumUASuctionPiping > MySmallNumber) {
   11235        4044 :                 Real64 SuctionPipeZoneTemp = state.dataLoopNodes->Node(System(SysNum).SuctionPipeZoneNodeNum)
   11236        4044 :                                                  .Temp; // Temperature for zone identified as environment for suction pipe heat gains, C
   11237        4044 :                 System(SysNum).PipeHeatLoad = System(SysNum).SumUASuctionPiping * (SuctionPipeZoneTemp - System(SysNum).TEvapNeeded);
   11238             :                 // pipe heat load is a positive number (ie. heat absorbed by pipe, so needs to be subtracted
   11239             :                 //     from refrigcasecredit (- for cooling zone, + for heating zone)
   11240        4044 :                 int SuctionPipeActualZoneNum = System(SysNum).SuctionPipeActualZoneNum;
   11241        4044 :                 if (state.dataRefrigCase->UseSysTimeStep) {
   11242           0 :                     CoilSysCredit(SuctionPipeActualZoneNum).SenCreditToZoneRate -= System(SysNum).PipeHeatLoad;
   11243           0 :                     CoilSysCredit(SuctionPipeActualZoneNum).ReportSenCoolingToZoneRate = -CoilSysCredit(SuctionPipeActualZoneNum).SenCreditToZoneRate;
   11244             :                 }
   11245             :                 // Can arrive here when load call to refrigeration looks for cases/walkin systems and usetimestep is .FALSE.
   11246       12132 :                 if ((!state.dataRefrigCase->UseSysTimeStep) &&
   11247        4044 :                     ((state.dataRefrigCase->NumSimulationCases > 0) || (state.dataRefrigCase->NumSimulationWalkIns > 0))) {
   11248        4044 :                     state.dataHeatBal->RefrigCaseCredit(SuctionPipeActualZoneNum).SenCaseCreditToZone -= System(SysNum).PipeHeatLoad;
   11249             :                 } // UseSysTimeStep
   11250             :             }
   11251             :         } //(((.NOT. UseSysTimeStep).AND.(.NOT. System(SysNum)%CoilFlag)).OR.((UseSysTimeStep).AND.(System(SysNum)%CoilFlag)))
   11252             :     }     // SysNum
   11253             : 
   11254             :     // Need to know if mechanical subcoolers or cascade condensers or shared condensers
   11255             :     //    are present. If so, energy transfer between
   11256             :     //    detailed refrigeration systems requires additional iteration at this level.
   11257             : 
   11258      388373 :     int StartMechSubcoolLoop(3); // if no mechanical subcoolers transfer energy between system,
   11259     1547426 :     if ((state.dataRefrigCase->NumSimulationMechSubcoolers > 0) || (state.dataRefrigCase->NumSimulationCascadeCondensers > 0) ||
   11260     1152987 :         (state.dataRefrigCase->NumSimulationSharedCondensers > 0) || (state.dataRefrigCase->NumSimulationRefrigAirChillers > 0))
   11261      361243 :         StartMechSubcoolLoop = 1;
   11262             : 
   11263      388373 :     bool FirstSCLoop = true; // Flag first time through multi-system loop used when mech subcoolers present
   11264             : 
   11265     1499232 :     for (int LoopNum = StartMechSubcoolLoop; LoopNum <= 3;
   11266             :          ++LoopNum) { // Note, for cascade cond loads compared requiring 5 iterations to 3, no difference.
   11267             : 
   11268    10760964 :         for (int SysNum = 1; SysNum <= state.dataRefrigCase->NumRefrigSystems; ++SysNum) {
   11269             :             // Only do those systems appropriate for this analysis, supermarket type on load time step or coil type on sys time step
   11270    28835395 :             if (((!state.dataRefrigCase->UseSysTimeStep) && (!System(SysNum).CoilFlag)) ||
   11271    19070370 :                 ((state.dataRefrigCase->UseSysTimeStep) && (System(SysNum).CoilFlag))) {
   11272     9650105 :                 System(SysNum).SumMechSCLoad = 0.0;
   11273     9650105 :                 System(SysNum).SumCascadeLoad = 0.0;
   11274     9650105 :                 System(SysNum).SumCascadeCondCredit = 0.0;
   11275     9650105 :                 System(SysNum).SumMechSCBenefit = 0.0;
   11276             : 
   11277     9650105 :                 if ((state.dataRefrigCase->NumSimulationMechSubcoolers > 0) && (!FirstSCLoop)) {
   11278             :                     // This loop places load on system providing mechanical subcooling
   11279       24264 :                     for (int SubcoolID = 1; SubcoolID <= state.dataRefrigCase->NumSimulationSubcoolers; ++SubcoolID) {
   11280       16176 :                         if (Subcooler(SubcoolID).subcoolerType == SubcoolerType::LiquidSuction) continue;
   11281        8088 :                         if (Subcooler(SubcoolID).MechSourceSysID != SysNum) continue;
   11282             :                         // don't have summechscload until second subcooler pass, set to zero on first pass
   11283        4044 :                         System(SysNum).SumMechSCLoad += System(SysNum).MechSCLoad(SubcoolID);
   11284             :                         // subcooler should not drive Tevap for supplying system,
   11285             :                         //    but check to see if T controlled can be met or if Tevap is at a higher temperature
   11286        4044 :                         if (Subcooler(SubcoolID).MechControlTliqOut < System(SysNum).TEvapNeeded) {
   11287           0 :                             ShowWarningError(state, "Refrigeration:System: " + System(SysNum).Name);
   11288           0 :                             ShowContinueError(state, " Evaporating temperature greater than the controlled ");
   11289           0 :                             ShowContinueError(state, " liquid outlet temperature for SUBCOOLER:" + Subcooler(SubcoolID).Name);
   11290             :                         }
   11291             :                     } // SubcoolId
   11292             : 
   11293        8088 :                     if (System(SysNum).NumSubcoolers > 0) {
   11294       12132 :                         for (int SubcoolerIndex = 1; SubcoolerIndex <= System(SysNum).NumSubcoolers; ++SubcoolerIndex) {
   11295        8088 :                             int SubcoolID = System(SysNum).SubcoolerNum(SubcoolerIndex);
   11296        8088 :                             if (Subcooler(SubcoolID).subcoolerType == SubcoolerType::LiquidSuction) continue;
   11297        4044 :                             System(SysNum).SumMechSCBenefit = Subcooler(SubcoolID).MechSCTransLoad;
   11298             :                         } // subcoolerindex
   11299             :                     }     // System(sysid)%numsubcoolers > 0
   11300             :                 }         // NumSimulationMechSubcoolers > 0 and not first loop
   11301             : 
   11302             :                 // This loop places load on system absorbing heat from cascade condenser and &
   11303             :                 //     condenser heat reclaim credits from hot gas/brine defrosts
   11304     9650105 :                 if ((System(SysNum).NumCascadeLoads > 0) && (!FirstSCLoop)) {
   11305        8088 :                     for (int CascadeLoadIndex = 1; CascadeLoadIndex <= System(SysNum).NumCascadeLoads; ++CascadeLoadIndex) {
   11306        4044 :                         int CascadeLoadID = System(SysNum).CascadeLoadNum(CascadeLoadIndex);
   11307        4044 :                         if (System(SysNum).CompSuctControl == CompressorSuctionPressureCtrl::ConstantSuctionTemperature) {
   11308        4044 :                             System(SysNum).TEvapNeeded = System(SysNum).TEvapDesign;
   11309             :                         } else { // check for lowest T evap design among the CascadeLoad systems and
   11310             :                             //  Compare Tevap for this Cascade to max allowed for cases, walk ins, and
   11311             :                             //  for all previous CascadeLoad loops on this suction group and set
   11312             :                             //  at the MINIMUM
   11313           0 :                             if (Condenser(CascadeLoadID).CascadeTempControl == CascadeCndsrTempCtrlType::TempSet) {
   11314             :                                 // if float then set tevap based upon other loads
   11315           0 :                                 if (CascadeLoadIndex == 1 && System(SysNum).NumNonCascadeLoads == 0) {
   11316           0 :                                     System(SysNum).TEvapNeeded = Condenser(CascadeLoadID).CascadeRatedEvapTemp;
   11317             :                                 } else {
   11318           0 :                                     System(SysNum).TEvapNeeded = min(Condenser(CascadeLoadID).CascadeRatedEvapTemp, System(SysNum).TEvapNeeded);
   11319             :                                 }
   11320             :                             }
   11321             :                         } // floating or constant system evap temperature
   11322             :                         // increment Cascade condenser Loads for Compressors/condenser on each system
   11323             :                         // place any defrost credits on the same system absorbing the cascade condenser load
   11324             :                         // (CascadeSysID identifies the condenser producing the defrost credits, that is, the lower temp system)
   11325        4044 :                         System(SysNum).SumCascadeLoad += Condenser(CascadeLoadID).CondLoad;
   11326        4044 :                         System(SysNum).SumCascadeCondCredit += System(Condenser(CascadeLoadID).CascadeSysID).TotalCondDefrostCredit;
   11327             : 
   11328             :                     } // NumCascadeLoads
   11329             :                 }     // System(SysNum)%NumCascadeLoads > 0
   11330             : 
   11331             :                 // only calc detailed system if have load (could be zero first time through if only load is cascade condenser)
   11332    28950315 :                 System(SysNum).TotalSystemLoad = System(SysNum).TotalCoolingLoad + System(SysNum).SumSecondaryLoopLoad +
   11333    19300210 :                                                  System(SysNum).SumMechSCLoad + System(SysNum).SumCascadeLoad;
   11334     9650105 :                 if (System(SysNum).TotalSystemLoad > 0.0) {
   11335    27234942 :                     System(SysNum).CpSatVapEvap = FluidProperties::GetSatSpecificHeatRefrig(
   11336    27234942 :                         state, System(SysNum).RefrigerantName, System(SysNum).TEvapNeeded, 1.0, System(SysNum).RefIndex, RoutineName);
   11337     9078314 :                     System(SysNum).HCaseOut =
   11338    27234942 :                         FluidProperties::GetSatEnthalpyRefrig(
   11339    36313256 :                             state, System(SysNum).RefrigerantName, System(SysNum).TEvapNeeded, 1.0, System(SysNum).RefIndex, RoutineName) +
   11340     9078314 :                         System(SysNum).CpSatVapEvap * CaseSuperheat;
   11341             :                     // Establish estimates to start solution loop
   11342     9078314 :                     switch (Condenser(System(SysNum).CondenserNum(1)).CondenserType) {
   11343     9054050 :                     case DataHeatBalance::RefrigCondenserType::Air: {
   11344     9054050 :                         System(SysNum).TCondense = state.dataEnvrn->OutDryBulbTemp + 16.7;
   11345             :                         // 16.7C is delta T at rating point for air-cooled condensers, just estimate, so ok for zone-located condensers
   11346     9054050 :                     } break;
   11347       16176 :                     case DataHeatBalance::RefrigCondenserType::Evap: {
   11348       16176 :                         System(SysNum).TCondense = state.dataEnvrn->OutDryBulbTemp + 15.0;
   11349             :                         // 15C is delta T at rating point for evap-cooled condensers
   11350       16176 :                     } break;
   11351        2022 :                     case DataHeatBalance::RefrigCondenserType::Water: {
   11352             :                         // define starting estimate at temperature of water exiting condenser
   11353        2022 :                         System(SysNum).TCondense = state.dataLoopNodes->Node(Condenser(System(SysNum).CondenserNum(1)).OutletNode).Temp;
   11354        2022 :                     } break;
   11355        6066 :                     case DataHeatBalance::RefrigCondenserType::Cascade: {
   11356             :                         //?Don't need estimate for cascade condenser because it doesn't iterate?
   11357        6066 :                     } break;
   11358           0 :                     default:
   11359           0 :                         break;
   11360             :                     }
   11361             : 
   11362             :                     // Produce first time step estimates, assume no subcoolers
   11363    27234942 :                     System(SysNum).HSatLiqCond = FluidProperties::GetSatEnthalpyRefrig(
   11364    27234942 :                         state, System(SysNum).RefrigerantName, System(SysNum).TCondense, 0.0, System(SysNum).RefIndex, RoutineName);
   11365    27234942 :                     System(SysNum).CpSatLiqCond = FluidProperties::GetSatSpecificHeatRefrig(
   11366    27234942 :                         state, System(SysNum).RefrigerantName, System(SysNum).TCondense, 0.0, System(SysNum).RefIndex, RoutineName);
   11367     9078314 :                     System(SysNum).HCaseIn =
   11368     9078314 :                         System(SysNum).HSatLiqCond - System(SysNum).CpSatLiqCond * Condenser(System(SysNum).CondenserNum(1)).RatedSubcool;
   11369     9078314 :                     System(SysNum).RefMassFlowtoLoads = System(SysNum).TotalSystemLoad / (System(SysNum).HCaseOut - System(SysNum).HCaseIn);
   11370     9078314 :                     System(SysNum).RefMassFlowComps = System(SysNum).RefMassFlowtoLoads;
   11371             : 
   11372     9078314 :                     if (System(SysNum).NumStages == 2) { // Two-stage compression system
   11373             :                         // Initial guess for high-stage mass flow rate in two-stage compression systems
   11374        4044 :                         System(SysNum).RefMassFlowHiStageComps = System(SysNum).RefMassFlowComps / 0.65;
   11375             :                     }
   11376             : 
   11377     9078314 :                     System(SysNum).CalcDetailedSystem(state, SysNum);
   11378             : 
   11379             :                     bool DeRate; // If true, need to derate aircoils because load can't be met by system
   11380             : 
   11381             :                     // With air chiller coils, don't use unmet energy, instead reduce capacity on coils to match avail compressor/cond capacity
   11382             :                     // current loads on compressor, exclusive of unmet loads from prev time steps
   11383             :                     Real64 CurrentLoads =
   11384     9078314 :                         System(SysNum).TotalSystemLoad + System(SysNum).LSHXTrans; // because compressor capacity rated from txv to comp inlet
   11385     9078314 :                     if ((System(SysNum).CoilFlag) && (CurrentLoads > (System(SysNum).TotCompCapacity * 1.001))) {
   11386       91454 :                         DeRate = true;
   11387       91454 :                         FinalRateCoils(state, DeRate, SourceType::DetailedSystem, SysNum, CurrentLoads, System(SysNum).TotCompCapacity);
   11388       91454 :                         System(SysNum).TotalCoolingLoad = 0.0;
   11389       91454 :                         System(SysNum).TotalCondDefrostCredit = 0.0;
   11390     1127583 :                         for (int CoilIndex = 1; CoilIndex <= System(SysNum).NumCoils; ++CoilIndex) {
   11391     1036129 :                             int CoilID = System(SysNum).CoilNum(CoilIndex);
   11392             :                             // already CALLed CalculateCoil(CoilID) in CoilSet specified order
   11393     1036129 :                             if (System(SysNum).CompSuctControl == CompressorSuctionPressureCtrl::ConstantSuctionTemperature) {
   11394     1036129 :                                 System(SysNum).TEvapNeeded = System(SysNum).TEvapDesign;
   11395             :                             } else { // calculate floating T evap
   11396           0 :                                 System(SysNum).TEvapNeeded = System(SysNum).TEvapDesign;
   11397           0 :                                 ShowWarningError(state, "Refrigeration:System: " + System(SysNum).Name);
   11398           0 :                                 ShowContinueError(state, " Floating evaporator temperature model not yet available for warehouse coil systems. ");
   11399             :                             } // floating or constant evap temperature
   11400             :                             // increment TotalCoolingLoad for Compressors/condenser on each system
   11401     1036129 :                             System(SysNum).TotalCoolingLoad += WarehouseCoil(CoilID).TotalCoolingLoad;
   11402     1036129 :                             System(SysNum).TotalCondDefrostCredit += WarehouseCoil(CoilID).HotDefrostCondCredit;
   11403             :                         } // NumCoils systems
   11404       91454 :                         if (System(SysNum).NumStages == 2 &&
   11405           0 :                             System(SysNum).TotHiStageCompCapacity <
   11406           0 :                                 (System(SysNum).TotalCoolingLoad + System(SysNum).LSHXTrans + System(SysNum).TotCompPower)) {
   11407           0 :                             ShowRecurringWarningErrorAtEnd(state,
   11408           0 :                                                            "Refrigeration:System: " + System(SysNum).Name +
   11409             :                                                                ":The specified high-stage compressors for this system are unable to meet the sum "
   11410             :                                                                "of the refrigeration loads, ",
   11411           0 :                                                            System(SysNum).HiStageWarnIndex1);
   11412           0 :                             ShowRecurringContinueErrorAtEnd(
   11413           0 :                                 state, " subcooler loads (if any), and low-stage compressor loads for this sytem.", System(SysNum).HiStageWarnIndex2);
   11414             :                         } // Hi-stage capacity<(load+LSHX load + lo-stage compressor load)
   11415             :                     }     // CoilFlag (Numcoils > 0) and load > capacity
   11416             : 
   11417             :                 } // System(SysNum)%TotalSystemLoad > 0
   11418             :             }     //(((.NOT. UseSysTimeStep).AND.(.NOT. System(SysNum)%CoilFlag)).OR.((UseSysTimeStep).AND.(System(SysNum)%CoilFlag)))
   11419             :         }         // SysNum over NumRefrigSystems
   11420     1110859 :         FirstSCLoop = false;
   11421             :     } // LoopNum, three times for buildings with multiple detailed systems connected with mechanical subcoolers
   11422             :     // or cascade condensers or shared condensers or warehouse coils that might need to be de-rated
   11423             : 
   11424             :     // Dealing with unmet load has to be done outside iterative loop
   11425     3645292 :     for (int SysNum = 1; SysNum <= state.dataRefrigCase->NumRefrigSystems; ++SysNum) {
   11426             :         // Only do those systems appropriate for this analysis, supermarket type on load time step or coil type on sys time step
   11427     9770757 :         if ((((!state.dataRefrigCase->UseSysTimeStep) && (!System(SysNum).CoilFlag)) ||
   11428    12870628 :              ((state.dataRefrigCase->UseSysTimeStep) && (System(SysNum).CoilFlag))) &&
   11429     3256919 :             (!state.dataGlobal->WarmupFlag)) {
   11430             :             Real64 CurrentLoads =
   11431      192384 :                 System(SysNum).TotalSystemLoad + System(SysNum).LSHXTrans; // because compressor capacity rated from txv to comp inlet
   11432      192384 :             Real64 CurrentHiStageLoads(0.0);                               // Current loads on high-stage compressor, exclusive of unmet loads from
   11433      192384 :             if (System(SysNum).NumStages == 2) {
   11434         576 :                 CurrentHiStageLoads = CurrentLoads + System(SysNum).TotCompPower;
   11435             :             } // NumStages==2
   11436      192384 :             if (System(SysNum).CoilFlag) {
   11437             :                 // don't use 'unmet energy' with air chillers, see 'derate'
   11438      181440 :                 System(SysNum).UnmetEnergy = 0.0;
   11439      181440 :                 System(SysNum).UnmetHiStageEnergy = 0.0;
   11440             :             } else {
   11441             :                 // Meeting current and possibly some portion of the previously unmet energy
   11442             :                 // perhaps future interest in reporting percent of installed capacity used(or number of compressors) ?
   11443             :                 // If the system compressors were unable to meet the current loads, save energy to be met in succeeding time step
   11444             :                 // Note the unmet energy is turned into a rate and applied to the system load at the start of calccompressor
   11445       10944 :                 System(SysNum).UnmetEnergy += (CurrentLoads - System(SysNum).TotCompCapacity) * state.dataGlobal->TimeStepZoneSec;
   11446       10944 :                 if (System(SysNum).NumStages == 2) {
   11447         576 :                     System(SysNum).UnmetHiStageEnergy +=
   11448         576 :                         (CurrentHiStageLoads - System(SysNum).TotHiStageCompCapacity) * state.dataGlobal->TimeStepZoneSec;
   11449             :                 }
   11450       10944 :                 if (System(SysNum).UnmetEnergy > MyLargeNumber) {
   11451           0 :                     System(SysNum).UnmetEnergy = MyLargeNumber;
   11452           0 :                     if (state.dataRefrigCase->ShowUnmetEnergyWarning(SysNum)) {
   11453           0 :                         ShowWarningError(state, "Refrigeration:System: " + System(SysNum).Name);
   11454           0 :                         ShowContinueError(state, " The specified compressors for this system are unable to meet ");
   11455           0 :                         ShowContinueError(state, " the sum of the refrigerated case loads and subcooler loads (if any) for this sytem.");
   11456           0 :                         state.dataRefrigCase->ShowUnmetEnergyWarning(SysNum) = false;
   11457             :                     } // show warning
   11458             :                 }     // > mylarge number
   11459       10944 :                 if (System(SysNum).UnmetHiStageEnergy > MyLargeNumber) {
   11460           0 :                     System(SysNum).UnmetHiStageEnergy = MyLargeNumber;
   11461           0 :                     if (state.dataRefrigCase->ShowHiStageUnmetEnergyWarning(SysNum)) {
   11462           0 :                         ShowWarningError(state, "Refrigeration:System: " + System(SysNum).Name);
   11463           0 :                         ShowContinueError(state, " The specified high-stage compressors for this system are unable to meet ");
   11464           0 :                         ShowContinueError(state, " the sum of the refrigerated case loads, subcooler loads (if any) and ");
   11465           0 :                         ShowContinueError(state, " low-stage compressor loads for this sytem.");
   11466           0 :                         state.dataRefrigCase->ShowHiStageUnmetEnergyWarning(SysNum) = false;
   11467             :                     } // show warning
   11468             :                 }     // > mylarge number
   11469             :             }         // numcoils > 0
   11470             : 
   11471             :             // Zone-located air-cooled condenser reject heat also has to be outside iterative loop
   11472      192384 :             if (System(SysNum).SystemRejectHeatToZone) {
   11473         864 :                 int CondInletAirZoneNum = Condenser(System(SysNum).CondenserNum(1)).InletAirZoneNum;
   11474         864 :                 if (state.dataRefrigCase->UseSysTimeStep) {
   11475           0 :                     CoilSysCredit(CondInletAirZoneNum).SenCreditToZoneRate += System(SysNum).NetHeatRejectLoad; // Adding heat is positive
   11476           0 :                     CoilSysCredit(CondInletAirZoneNum).ReportSenCoolingToZoneRate = -CoilSysCredit(CondInletAirZoneNum).SenCreditToZoneRate;
   11477             :                 }
   11478             :                 // Can arrive here when load call to refrigeration looks for cases/walkin systems and usetimestep is .FALSE.
   11479        2592 :                 if ((!state.dataRefrigCase->UseSysTimeStep) &&
   11480         864 :                     ((state.dataRefrigCase->NumSimulationCases > 0) || (state.dataRefrigCase->NumSimulationWalkIns > 0))) {
   11481         864 :                     state.dataHeatBal->RefrigCaseCredit(CondInletAirZoneNum).SenCaseCreditToZone +=
   11482         864 :                         System(SysNum).NetHeatRejectLoad; // Adding heat is positive
   11483             :                 }                                         // UseSystimestep
   11484             :             }                                             // Reject heat to zone
   11485             : 
   11486             :             // Report variables
   11487      192384 :             System(SysNum).TotTransferLoad =
   11488      192384 :                 System(SysNum).SumMechSCLoad - System(SysNum).SumMechSCBenefit + System(SysNum).SumSecondaryLoopLoad + System(SysNum).SumCascadeLoad;
   11489      192384 :             System(SysNum).TotTransferEnergy = System(SysNum).TotTransferLoad * LocalTimeStep * DataGlobalConstants::SecInHour;
   11490      192384 :             System(SysNum).PipeHeatEnergy = System(SysNum).PipeHeatLoad * LocalTimeStep * DataGlobalConstants::SecInHour;
   11491      192384 :             System(SysNum).TotalCoolingEnergy = System(SysNum).TotalCoolingLoad * LocalTimeStep * DataGlobalConstants::SecInHour;
   11492             :         } //(((.NOT. UseSysTimeStep).AND.(.NOT. System(SysNum)%CoilFlag)).OR.((UseSysTimeStep).AND.(System(SysNum)%CoilFlag))).and.not
   11493             :           // WarmupFlag
   11494             :     }     // SysNum = 1,NumRefrigSystems
   11495             : 
   11496             :     // Update for sending to zone equipment manager. (note report variables are summed elsewhere)
   11497             :     //   LatOutputProvided = CoilSysCredit(ZoneNum)%LatKgPerS_ToZoneRate
   11498             :     //   SysOutputProvided = CoilSysCredit(ZoneNum)%SenCreditToZoneRate
   11499             :     // Note that case credit is negative for cooling, thus subtract positive value calculated for coil
   11500             :     //   Note this is done whether or not the coils are derated.
   11501      388373 :     if (state.dataRefrigCase->UseSysTimeStep) {
   11502     5297325 :         for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) {
   11503   415310280 :             for (int CoilID = 1; CoilID <= state.dataRefrigCase->NumSimulationRefrigAirChillers; ++CoilID) {
   11504   410366110 :                 if (WarehouseCoil(CoilID).ZoneNum != ZoneNum) continue;
   11505    29311865 :                 CoilSysCredit(ZoneNum).SenCreditToZoneRate -= WarehouseCoil(CoilID).SensCreditRate;
   11506    29311865 :                 CoilSysCredit(ZoneNum).SenCreditToZoneEnergy =
   11507    29311865 :                     CoilSysCredit(ZoneNum).SenCreditToZoneRate * LocalTimeStep * DataGlobalConstants::SecInHour;
   11508    29311865 :                 CoilSysCredit(ZoneNum).LatKgPerS_ToZoneRate -= WarehouseCoil(CoilID).LatKgPerS_ToZone;
   11509    29311865 :                 CoilSysCredit(ZoneNum).LatCreditToZoneRate -= WarehouseCoil(CoilID).LatCreditRate;
   11510    29311865 :                 CoilSysCredit(ZoneNum).LatCreditToZoneEnergy -= WarehouseCoil(CoilID).LatCreditEnergy;
   11511             :             }
   11512             :         }
   11513             :     }
   11514             : 
   11515      388373 :     SumZoneImpacts(state);
   11516      388373 : }
   11517             : 
   11518        2022 : void SimulateDetailedTransRefrigSystems(EnergyPlusData &state)
   11519             : {
   11520             : 
   11521             :     // SUBROUTINE INFORMATION:
   11522             :     //       AUTHOR         Brian A. Fricke, ORNL
   11523             :     //       DATE WRITTEN   Fall 2011
   11524             :     //       RE-ENGINEERED  na
   11525             : 
   11526             :     // PURPOSE OF THIS SUBROUTINE:
   11527             :     // This subroutine is called to simulate detailed transcritical CO2 refrigeration systems
   11528             : 
   11529             :     // METHODOLOGY EMPLOYED:
   11530             :     // Each refrigeration system is modeled by first simulating the attached refrigerated cases and
   11531             :     // walk-ins. The sum of the total heat transfer for all attached cases and walk-ins determines
   11532             :     // the load on the compressors. Iterations are used here to account for sharing of gas coolers
   11533             :     // between independent refrigeration systems.
   11534             : 
   11535             :     static constexpr std::string_view RoutineName("SimulateDetailedTransRefrigSystems");
   11536             : 
   11537        2022 :     auto &RefrigCase(state.dataRefrigCase->RefrigCase);
   11538        2022 :     auto &TransSystem(state.dataRefrigCase->TransSystem);
   11539        2022 :     auto &GasCooler(state.dataRefrigCase->GasCooler);
   11540        2022 :     auto &WalkIn(state.dataRefrigCase->WalkIn);
   11541             : 
   11542        2022 :     int LocalTimeStep = state.dataGlobal->TimeStepZone;
   11543        2022 :     if (state.dataRefrigCase->UseSysTimeStep) LocalTimeStep = state.dataHVACGlobal->TimeStepSys;
   11544             : 
   11545             :     //  Do transcritical CO2 refrigeration system loop outside of iterative solution to initialize time step and
   11546             :     //  calculate case and and walk-ins (that won't change during balance of refrigeration system iterations)
   11547             :     //  and prepare initial estimates for the iterative system solution
   11548             : 
   11549             :     //  TransCritSysFlag = .TRUE.
   11550        4044 :     for (int SysNum = 1; SysNum <= state.dataRefrigCase->NumTransRefrigSystems; ++SysNum) {
   11551             :         // Only do those systems appropriate for this analysis, supermarket type on load time step
   11552        2022 :         if (TransSystem(SysNum).NumCasesMT > 0) {
   11553        8088 :             for (int CaseIndex = 1; CaseIndex <= TransSystem(SysNum).NumCasesMT; ++CaseIndex) {
   11554        6066 :                 int CaseID = TransSystem(SysNum).CaseNumMT(CaseIndex);
   11555        6066 :                 RefrigCase(CaseID).CalculateCase(state);
   11556             :                 //  TEvapDesignMT calc in Get Input to meet lowest evap temp of any MT load on the system.
   11557             :                 //  TEvapNeededMT is fixed at this design value.
   11558        6066 :                 TransSystem(SysNum).TEvapNeededMT = TransSystem(SysNum).TEvapDesignMT;
   11559             :                 // increment TotalCoolingLoad for Compressors/gas cooler on each system and defrost gas cooler credits for heat recovery
   11560        6066 :                 TransSystem(SysNum).TotalCoolingLoadMT += RefrigCase(CaseID).TotalCoolingLoad;
   11561        6066 :                 TransSystem(SysNum).TotalCondDefrostCredit += RefrigCase(CaseID).HotDefrostCondCredit;
   11562             :             } // NumCasesMT
   11563             :         }     // Num of MT cases > 0
   11564             : 
   11565        2022 :         if (TransSystem(SysNum).NumCasesLT > 0) {
   11566       10110 :             for (int CaseIndex = 1; CaseIndex <= TransSystem(SysNum).NumCasesLT; ++CaseIndex) {
   11567        8088 :                 int CaseID = TransSystem(SysNum).CaseNumLT(CaseIndex);
   11568        8088 :                 RefrigCase(CaseID).CalculateCase(state);
   11569             :                 //  TEvapDesignLT calc in Get Input to meet lowest evap temp of any LT load on the system.
   11570             :                 //  TEvapNeededLT is fixed at this design value.
   11571        8088 :                 TransSystem(SysNum).TEvapNeededLT = TransSystem(SysNum).TEvapDesignLT;
   11572             :                 // increment TotalCoolingLoad for Compressors/gas cooler on each system and defrost gas cooler credits for heat recovery
   11573        8088 :                 TransSystem(SysNum).TotalCoolingLoadLT += RefrigCase(CaseID).TotalCoolingLoad;
   11574        8088 :                 TransSystem(SysNum).TotalCondDefrostCredit += RefrigCase(CaseID).HotDefrostCondCredit;
   11575             :             } // NumCasesLT
   11576             :         }     // Num of LT cases > 0
   11577             : 
   11578        2022 :         if (TransSystem(SysNum).NumWalkInsMT > 0) {
   11579           0 :             for (int WalkInIndex = 1; WalkInIndex <= TransSystem(SysNum).NumWalkInsMT; ++WalkInIndex) {
   11580           0 :                 int WalkInID = TransSystem(SysNum).WalkInNumMT(WalkInIndex);
   11581           0 :                 WalkIn(WalkInID).CalculateWalkIn(state);
   11582             :                 //  TEvapDesignMT calc in Get Input to meet lowest evap temp of any MT load on the system.
   11583             :                 //  TEvapNeededMT is fixed at this design value.
   11584           0 :                 TransSystem(SysNum).TEvapNeededMT = TransSystem(SysNum).TEvapDesignMT;
   11585             :                 // increment TotalCoolingLoad for Compressors/gas cooler on each system
   11586           0 :                 TransSystem(SysNum).TotalCoolingLoadMT += WalkIn(WalkInID).TotalCoolingLoad;
   11587           0 :                 TransSystem(SysNum).TotalCondDefrostCredit += WalkIn(WalkInID).HotDefrostCondCredit;
   11588             :             } // NumWalkInsMT systems
   11589             :         }     // TransSystem(SysNum)%NumWalkInsMT > 0
   11590             : 
   11591        2022 :         if (TransSystem(SysNum).NumWalkInsLT > 0) {
   11592        4044 :             for (int WalkInIndex = 1; WalkInIndex <= TransSystem(SysNum).NumWalkInsLT; ++WalkInIndex) {
   11593        2022 :                 int WalkInID = TransSystem(SysNum).WalkInNumLT(WalkInIndex);
   11594        2022 :                 WalkIn(WalkInID).CalculateWalkIn(state);
   11595             :                 //  TEvapDesignLT calc in Get Input to meet lowest evap temp of any LT load on the system.
   11596             :                 //  TEvapNeeded is fixed at this design value.
   11597        2022 :                 TransSystem(SysNum).TEvapNeededLT = TransSystem(SysNum).TEvapDesignLT;
   11598             :                 // increment TotalCoolingLoad for Compressors/gas cooler on each system
   11599        2022 :                 TransSystem(SysNum).TotalCoolingLoadLT += WalkIn(WalkInID).TotalCoolingLoad;
   11600        2022 :                 TransSystem(SysNum).TotalCondDefrostCredit += WalkIn(WalkInID).HotDefrostCondCredit;
   11601             :             } // NumWalkInsLT systems
   11602             :         }     // TransSystem(SysNum)%NumWalkInsLT > 0
   11603             : 
   11604             :         // add suction pipe heat gains (W) if input by user
   11605             :         // Suction pipe heat gains aren't included in the reported total system load, but are heat gains that must be met in
   11606             :         //  gas cooler and compressor loads.
   11607        2022 :         TransSystem(SysNum).PipeHeatLoadMT = 0.0;
   11608        2022 :         if (TransSystem(SysNum).SumUASuctionPipingMT > MySmallNumber) {
   11609           0 :             Real64 SuctionPipeZoneTemp = state.dataLoopNodes->Node(TransSystem(SysNum).SuctionPipeZoneNodeNumMT).Temp;
   11610           0 :             TransSystem(SysNum).PipeHeatLoadMT = TransSystem(SysNum).SumUASuctionPipingMT * (SuctionPipeZoneTemp - TransSystem(SysNum).TEvapNeededMT);
   11611             :             // pipe heat load is a positive number (ie. heat absorbed by pipe, so needs to be subtracted
   11612             :             //   from refrigcasecredit (- for cooling zone, + for heating zone)
   11613           0 :             int SuctionPipeActualZoneNum = TransSystem(SysNum).SuctionPipeActualZoneNumMT;
   11614             :             // Can arrive here when load call to refrigeration looks for cases/walkin systems and usetimestep is .FALSE.
   11615           0 :             if ((!state.dataRefrigCase->UseSysTimeStep) &&
   11616           0 :                 ((state.dataRefrigCase->NumSimulationCases > 0) || (state.dataRefrigCase->NumSimulationWalkIns > 0))) {
   11617           0 :                 state.dataHeatBal->RefrigCaseCredit(SuctionPipeActualZoneNum).SenCaseCreditToZone -= TransSystem(SysNum).PipeHeatLoadMT;
   11618             :             } // UseSysTimeStep
   11619             :         }
   11620             : 
   11621        2022 :         TransSystem(SysNum).PipeHeatLoadLT = 0.0;
   11622        2022 :         if (TransSystem(SysNum).SumUASuctionPipingLT > MySmallNumber) {
   11623           0 :             Real64 SuctionPipeZoneTemp = state.dataLoopNodes->Node(TransSystem(SysNum).SuctionPipeZoneNodeNumLT).Temp;
   11624           0 :             TransSystem(SysNum).PipeHeatLoadLT = TransSystem(SysNum).SumUASuctionPipingLT * (SuctionPipeZoneTemp - TransSystem(SysNum).TEvapNeededLT);
   11625             :             // pipe heat load is a positive number (ie. heat absorbed by pipe, so needs to be subtracted
   11626             :             //   from refrigcasecredit (- for cooling zone, + for heating zone)
   11627           0 :             int SuctionPipeActualZoneNum = TransSystem(SysNum).SuctionPipeActualZoneNumLT;
   11628             :             // Can arrive here when load call to refrigeration looks for cases/walkin systems and usetimestep is .FALSE.
   11629           0 :             if ((!state.dataRefrigCase->UseSysTimeStep) &&
   11630           0 :                 ((state.dataRefrigCase->NumSimulationCases > 0) || (state.dataRefrigCase->NumSimulationWalkIns > 0))) {
   11631           0 :                 state.dataHeatBal->RefrigCaseCredit(SuctionPipeActualZoneNum).SenCaseCreditToZone -= TransSystem(SysNum).PipeHeatLoadLT;
   11632             :             } // UseSysTimeStep
   11633             :         }
   11634             : 
   11635             :     } // SysNum
   11636             : 
   11637             :     // Need to know if shared gas coolers are present. If so, energy
   11638             :     // transfer between detailed transcritical refrigeration systems
   11639             :     // requires additional iteration at this level.
   11640             : 
   11641        2022 :     int StartMechSubcoolLoop(3); // if no mechanical subcoolers transfer energy between system, don't loop
   11642        2022 :     if (state.dataRefrigCase->NumSimulationSharedGasCoolers > 0) StartMechSubcoolLoop = 1;
   11643             : 
   11644        4044 :     for (int LoopNum = StartMechSubcoolLoop; LoopNum <= 3; ++LoopNum) {
   11645        4044 :         for (int SysNum = 1; SysNum <= state.dataRefrigCase->NumTransRefrigSystems; ++SysNum) {
   11646             :             // Only do those systems appropriate for this analysis, supermarket type on load time step or coil type on sys time step
   11647             :             // only calc detailed system if have load
   11648        2022 :             TransSystem(SysNum).TotalSystemLoadMT = TransSystem(SysNum).TotalCoolingLoadMT;
   11649        2022 :             if (TransSystem(SysNum).TransSysType == 2) {
   11650        2022 :                 TransSystem(SysNum).TotalSystemLoadLT = TransSystem(SysNum).TotalCoolingLoadLT;
   11651             :             }
   11652        2022 :             TransSystem(SysNum).TotalSystemLoad = TransSystem(SysNum).TotalSystemLoadLT + TransSystem(SysNum).TotalSystemLoadMT;
   11653        2022 :             if (TransSystem(SysNum).TotalSystemLoad > 0.0) {
   11654        2022 :                 if (TransSystem(SysNum).TransSysType == 2) {
   11655        6066 :                     TransSystem(SysNum).CpSatVapEvapLT = FluidProperties::GetSatSpecificHeatRefrig(state,
   11656        2022 :                                                                                                    TransSystem(SysNum).RefrigerantName,
   11657        2022 :                                                                                                    TransSystem(SysNum).TEvapNeededLT,
   11658             :                                                                                                    1.0,
   11659        2022 :                                                                                                    TransSystem(SysNum).RefIndex,
   11660             :                                                                                                    RoutineName);
   11661        8088 :                     TransSystem(SysNum).HCaseOutLT = FluidProperties::GetSatEnthalpyRefrig(state,
   11662        2022 :                                                                                            TransSystem(SysNum).RefrigerantName,
   11663        2022 :                                                                                            TransSystem(SysNum).TEvapNeededLT,
   11664             :                                                                                            1.0,
   11665        2022 :                                                                                            TransSystem(SysNum).RefIndex,
   11666        2022 :                                                                                            RoutineName) +
   11667        2022 :                                                      TransSystem(SysNum).CpSatVapEvapLT * TransCaseSuperheat;
   11668             :                 }
   11669        6066 :                 TransSystem(SysNum).CpSatVapEvapMT = FluidProperties::GetSatSpecificHeatRefrig(
   11670        6066 :                     state, TransSystem(SysNum).RefrigerantName, TransSystem(SysNum).TEvapNeededMT, 1.0, TransSystem(SysNum).RefIndex, RoutineName);
   11671        8088 :                 TransSystem(SysNum).HCaseOutMT = FluidProperties::GetSatEnthalpyRefrig(state,
   11672        2022 :                                                                                        TransSystem(SysNum).RefrigerantName,
   11673        2022 :                                                                                        TransSystem(SysNum).TEvapNeededMT,
   11674             :                                                                                        1.0,
   11675        2022 :                                                                                        TransSystem(SysNum).RefIndex,
   11676        2022 :                                                                                        RoutineName) +
   11677        2022 :                                                  TransSystem(SysNum).CpSatVapEvapMT * TransCaseSuperheat;
   11678             : 
   11679             :                 // Produce first time step estimates.
   11680             :                 // Assume no subcoolers and neglect flow through bypass.
   11681        6066 :                 TransSystem(SysNum).TReceiver = FluidProperties::GetSatTemperatureRefrig(
   11682        6066 :                     state, TransSystem(SysNum).RefrigerantName, TransSystem(SysNum).PReceiver, TransSystem(SysNum).RefIndex, RoutineName);
   11683        6066 :                 TransSystem(SysNum).HSatLiqReceiver = FluidProperties::GetSatEnthalpyRefrig(
   11684        6066 :                     state, TransSystem(SysNum).RefrigerantName, TransSystem(SysNum).TReceiver, 0.0, TransSystem(SysNum).RefIndex, RoutineName);
   11685        6066 :                 TransSystem(SysNum).CpSatLiqReceiver = FluidProperties::GetSatSpecificHeatRefrig(
   11686        6066 :                     state, TransSystem(SysNum).RefrigerantName, TransSystem(SysNum).TReceiver, 0.0, TransSystem(SysNum).RefIndex, RoutineName);
   11687        2022 :                 TransSystem(SysNum).HCaseInMT = TransSystem(SysNum).HSatLiqReceiver;
   11688        2022 :                 TransSystem(SysNum).HCaseInLT = TransSystem(SysNum).HSatLiqReceiver;
   11689        2022 :                 TransSystem(SysNum).RefMassFlowtoLTLoads = 0.0;
   11690        2022 :                 TransSystem(SysNum).RefMassFlowCompsLP = 0.0;
   11691        2022 :                 TransSystem(SysNum).DelHSubcoolerDis = 0.0;
   11692        2022 :                 TransSystem(SysNum).DelHSubcoolerSuc = 0.0;
   11693        2022 :                 if (TransSystem(SysNum).TransSysType == 2) {
   11694        2022 :                     TransSystem(SysNum).RefMassFlowtoLTLoads =
   11695        2022 :                         TransSystem(SysNum).TotalSystemLoadLT / (TransSystem(SysNum).HCaseOutLT - TransSystem(SysNum).HCaseInLT);
   11696        2022 :                     TransSystem(SysNum).RefMassFlowCompsLP = TransSystem(SysNum).RefMassFlowtoLTLoads;
   11697             :                 } // (TransSystem(SysNum)%TransSysType == 2)
   11698        2022 :                 TransSystem(SysNum).RefMassFlowtoMTLoads =
   11699        2022 :                     TransSystem(SysNum).TotalSystemLoadMT / (TransSystem(SysNum).HCaseOutMT - TransSystem(SysNum).HCaseInMT);
   11700        2022 :                 TransSystem(SysNum).RefMassFlowCompsHP = TransSystem(SysNum).RefMassFlowtoLTLoads + TransSystem(SysNum).RefMassFlowtoMTLoads;
   11701             : 
   11702        2022 :                 TransSystem(SysNum).CalcDetailedTransSystem(state, SysNum);
   11703             :                 //       TransCritSysFlag = .FALSE.
   11704             : 
   11705             :             } // TransSystem(SysNum)%TotalSystemLoad > 0
   11706             :         }     // SysNum over NumRefrigSystems
   11707             :     }         // LoopNum, three times for buildings with multiple detailed systems connected with shared gas coolers
   11708             : 
   11709             :     // Unmet load is done outside iterative loop
   11710        4044 :     for (int SysNum = 1; SysNum <= state.dataRefrigCase->NumTransRefrigSystems; ++SysNum) {
   11711             :         // Only do those systems appropriate for this analysis, supermarket type on load time step or coil type on sys time step
   11712        2022 :         if ((!state.dataRefrigCase->UseSysTimeStep) && (!state.dataGlobal->WarmupFlag)) {
   11713         288 :             Real64 CurrentLoads = TransSystem(SysNum).TotalSystemLoad;
   11714             :             // Meeting current and possibly some portion of the previously unmet energy
   11715             :             // perhaps future interest in reporting percent of installed capacity used(or number of compressors) ?
   11716             :             // If the system compressors were unable to meet the current loads, save energy to be met in succeeding time step
   11717             :             // Note the unmet energy is turned into a rate and applied to the system load at the start of calccompressor
   11718         288 :             TransSystem(SysNum).UnmetEnergy += (CurrentLoads - TransSystem(SysNum).TotCompCapacity) * state.dataGlobal->TimeStepZoneSec;
   11719             : 
   11720         288 :             if (TransSystem(SysNum).UnmetEnergy > MyLargeNumber) {
   11721           0 :                 TransSystem(SysNum).UnmetEnergy = MyLargeNumber;
   11722           0 :                 if (state.dataRefrigCase->ShowUnmetEnergyWarningTrans(SysNum)) {
   11723           0 :                     ShowWarningError(state, "Refrigeration:TranscriticalSystem: " + TransSystem(SysNum).Name);
   11724           0 :                     ShowContinueError(state, " The specified compressors for this system are unable to meet ");
   11725           0 :                     ShowContinueError(state, " the sum of the refrigerated case loads and subcooler loads (if any) for this sytem.");
   11726           0 :                     state.dataRefrigCase->ShowUnmetEnergyWarningTrans(SysNum) = false;
   11727             :                 } // show warning
   11728             :             }     // > mylarge number
   11729             : 
   11730             :             // Zone-located air-cooled gas cooler reject heat also has to be outside iterative loop
   11731         288 :             if (TransSystem(SysNum).SystemRejectHeatToZone) {
   11732           0 :                 int CondInletAirZoneNum = GasCooler(TransSystem(SysNum).GasCoolerNum(1)).InletAirZoneNum;
   11733             :                 // Can arrive here when load call to refrigeration looks for cases/walkin systems and usetimestep is .FALSE.
   11734           0 :                 if ((!state.dataRefrigCase->UseSysTimeStep) &&
   11735           0 :                     ((state.dataRefrigCase->NumSimulationCases > 0) || (state.dataRefrigCase->NumSimulationWalkIns > 0))) {
   11736           0 :                     state.dataHeatBal->RefrigCaseCredit(CondInletAirZoneNum).SenCaseCreditToZone +=
   11737           0 :                         TransSystem(SysNum).NetHeatRejectLoad; // Adding heat is positive
   11738             :                 }                                              // UseSystimestep
   11739             :             }                                                  // Reject heat to zone
   11740             : 
   11741             :             // Report variables
   11742         288 :             TransSystem(SysNum).PipeHeatEnergy =
   11743         288 :                 (TransSystem(SysNum).PipeHeatLoadMT + TransSystem(SysNum).PipeHeatLoadLT) * LocalTimeStep * DataGlobalConstants::SecInHour;
   11744         288 :             TransSystem(SysNum).TotalCoolingEnergy =
   11745         288 :                 (TransSystem(SysNum).TotalCoolingLoadMT + TransSystem(SysNum).TotalCoolingLoadMT) * LocalTimeStep * DataGlobalConstants::SecInHour;
   11746             :         } //(.NOT. UseSysTimeStep).AND. (.not. WarmupFlag)
   11747             :     }     // SysNum = 1,NumTransRefrigSystems
   11748             : 
   11749             :     // Update for sending to zone equipment manager. (note report variables are summed elsewhere)
   11750             : 
   11751        2022 :     SumZoneImpacts(state);
   11752        2022 : }
   11753             : 
   11754     9078314 : void RefrigSystemData::CalcDetailedSystem(EnergyPlusData &state, int const SysNum)
   11755             : {
   11756             : 
   11757             :     // SUBROUTINE INFORMATION:
   11758             :     //       AUTHOR         Therese Stovall, ORNL, Assisted by Hugh Henderson
   11759             :     //       DATE WRITTEN   Spring 2008
   11760             :     //       Using condenser solution algorithms written by Richard Raustad, FSEC
   11761             :     //          Oct/Nov 2004, and MODIFIED by Shirey, FSEC Dec 2004, and Hudson, ORNL in 2007
   11762             :     //       RE-ENGINEERED  na
   11763             : 
   11764             :     // PURPOSE OF THIS SUBROUTINE:
   11765             :     // Find the power and energy needed to meet the refrigeration loads for a particular detailed
   11766             :     // refrigeration system comprised of multiple cases, one condenser, and multiple compressors.
   11767             : 
   11768             :     // METHODOLOGY EMPLOYED:
   11769             :     // Sum the refrigeration loads on the system and determine the required evaporating temperature.
   11770             :     // Using the initial estimate for condensing temperature, dispatch the compressors to
   11771             :     // determine the needed power, energy consumption, and refrigerant mass flow.
   11772             :     // Calculate the condenser fan/pump power and consumption.
   11773             :     // Calculate the condensing temperature as a function of environment and load.
   11774             :     // Resolve the impact of subcooler heat transfer between and among systems
   11775             :     // Iterate until the calculated refrigerant mass flow through the compressors converges, which
   11776             :     // typically requires less than 5 iterations. This was found to be more sensitive than converging
   11777             :     // upon the calculated condensing temperature.
   11778             : 
   11779             :     // REFERENCES:
   11780             :     // "Impact of ASHRAE Standard 62-1989 on Florida Supermarkets",
   11781             :     //  Florida Solar Energy Center, FSEC-CR-910-96, Final Report, Oct. 1996
   11782             : 
   11783             :     // Kyle A. Manske, Performance Optimization of Industrial Refrigeration Systems,
   11784             :     //  A thesis submitted in partial fulfillment of the requirements for the degree of
   11785             :     //  Master of Science, University of Wisconsin-Madison, 1999
   11786             : 
   11787     9078314 :     Real64 constexpr ErrorTol(0.001); // Iterative solution tolerance
   11788             : 
   11789     9078314 :     bool NotBalanced = true;
   11790     9078314 :     int NumIter = 0;
   11791     9078314 :     Real64 ErrorMassFlowComps(0.0);        // Error in calculated low stage compressor mass flow (single- or two-stage systems)
   11792     9078314 :     Real64 ErrorMassFlowHiStageComps(0.0); // Error in calculated high-stage compressor mass flow (two-stage systems only)
   11793             : 
   11794             :     // Balance This Refrigeration System using calculated refrigerant flow
   11795     9078314 :     Real64 MassFlowHiStageCompsStart(0.0); // Mass flow through high-stage compressors (two-stage systems only)
   11796             : 
   11797    65109428 :     while (NotBalanced) {
   11798             :         // Set values for iteration convergence tolerance check
   11799    28015557 :         ++NumIter;
   11800             :         // Mass flow through (low-stage) compressors (single- or two-stage systems)
   11801    28015557 :         Real64 MassFlowCompsStart = this->RefMassFlowComps;
   11802             : 
   11803    28015557 :         if (this->NumStages == 2) { // Two-stage systems
   11804       14160 :             MassFlowHiStageCompsStart = this->RefMassFlowHiStageComps;
   11805             :         }
   11806             : 
   11807    28015557 :         if (this->NumSubcoolers > 0) this->CalculateSubcoolers(state);
   11808    28015557 :         this->CalculateCompressors(state);
   11809    28015557 :         this->CalculateCondensers(state, SysNum);
   11810    28015557 :         this->RefMassFlowtoLoads = this->TotalSystemLoad / (this->HCaseOut - this->HCaseIn);
   11811    28015557 :         if (NumIter < 2) continue;
   11812             :         // Previously did error check on calculated Tcondense, but not sensitive enough
   11813    18937243 :         if ((this->RefMassFlowtoLoads == 0.0) || (MassFlowCompsStart == 0.0)) { //.OR. (MassFlowCasesStart == 0.0)
   11814           0 :             ShowWarningError(state, "Refrigeration:System: " + this->Name + " showing zero refrigeration flow.");
   11815             :         } else {
   11816    18937243 :             ErrorMassFlowComps = std::abs(MassFlowCompsStart - this->RefMassFlowComps) / MassFlowCompsStart;
   11817    18937243 :             if (this->NumStages == 2) { // Two-stage systems
   11818       10116 :                 ErrorMassFlowHiStageComps = std::abs(MassFlowHiStageCompsStart - this->RefMassFlowHiStageComps) / MassFlowCompsStart;
   11819             :             }
   11820             :         } // denominator zero check
   11821    18937243 :         if (NumIter > 20) break;
   11822    18937243 :         if (ErrorMassFlowComps < ErrorTol) {
   11823     9080953 :             if (this->NumStages == 1) {
   11824     9074270 :                 NotBalanced = false;
   11825        6683 :             } else if (this->NumStages == 2 && ErrorMassFlowHiStageComps < ErrorTol) {
   11826        4044 :                 NotBalanced = false;
   11827             :             }
   11828             :         }
   11829             :     } // error check
   11830     9078314 : }
   11831             : 
   11832        2022 : void TransRefrigSystemData::CalcDetailedTransSystem(EnergyPlusData &state, int const SysNum)
   11833             : {
   11834             : 
   11835             :     // SUBROUTINE INFORMATION:
   11836             :     //       AUTHOR         Brian A. Fricke, ORNL
   11837             :     //       DATE WRITTEN   Fall 2011
   11838             :     //       MODIFIED       na
   11839             :     //       RE-ENGINEERED  na
   11840             : 
   11841             :     // PURPOSE OF THIS SUBROUTINE:
   11842             :     // Find the power and energy needed to meet the refrigeration loads for a detailed transcritical
   11843             :     // CO2 refrigeration system comprised of multiple cases and walk-ins, one gas cooler, and
   11844             :     // multiple compressors.
   11845             : 
   11846             :     // METHODOLOGY EMPLOYED:
   11847             :     // Sum the refrigeration loads on the system and determine the required evaporating temperature.
   11848             :     // Dispatch the compressors to determine the needed power, energy consumption, and refrigerant
   11849             :     // mass flow. Calculate the gas cooler fan power and consumption. Calculate the gas cooler
   11850             :     // outlet temperature and pressure as a function of ambient temperature. Iterate until the
   11851             :     // calculated refrigerant mass flow through the receiver bypass converges, which typically
   11852             :     // requires less than 5 iterations.
   11853             : 
   11854        2022 :     Real64 constexpr ErrorTol(0.001); // Iterative solution tolerance
   11855             : 
   11856        2022 :     int NumIter(0);            // Iteration counter
   11857        2022 :     bool NotBalanced(true);    // Flag to indicate convergence, based on system balance
   11858        2022 :     Real64 MassFlowStart(0.5); // Initial refrigerant mass flow through receiver bypass
   11859             :     Real64 ErrorMassFlow;      // Error in calculated refrigerant mass flow through receiver bypass
   11860             : 
   11861       23082 :     while (NotBalanced) {
   11862       10703 :         ++NumIter;
   11863             : 
   11864       10703 :         if (this->NumGasCoolers >= 1) this->CalcGasCooler(state, SysNum);
   11865       10703 :         this->CalculateTransCompressors(state);
   11866       10703 :         if (NumIter < 2) continue;
   11867        8681 :         if ((this->RefMassFlowReceiverBypass == 0.0) || (MassFlowStart == 0.0)) {
   11868           0 :             ShowSevereError(state, "Refrigeration:TranscriticalSystem: " + this->Name + " showing zero refrigerant flow through receiver bypass.");
   11869           0 :             ShowContinueError(state, format("Receiver Bypass Flow = {:.6R}", this->RefMassFlowReceiverBypass));
   11870           0 :             ShowContinueError(state, "Check input file to ensure that refrigeration loads on this system are not zero.");
   11871             :         } else {
   11872        8681 :             ErrorMassFlow = std::abs(MassFlowStart - this->RefMassFlowReceiverBypass) / MassFlowStart;
   11873        8681 :             MassFlowStart = this->RefMassFlowReceiverBypass;
   11874             :         } // denominator zero check
   11875        8681 :         if (NumIter > 20) break;
   11876        8508 :         if (ErrorMassFlow < ErrorTol) NotBalanced = false;
   11877             :     } // error check
   11878        2022 : }
   11879             : 
   11880    28015557 : void RefrigSystemData::CalculateCondensers(EnergyPlusData &state, int const SysNum)
   11881             : {
   11882             : 
   11883             :     // SUBROUTINE INFORMATION:
   11884             :     //       AUTHOR         Therese Stovall and C. R. Hudson, ORNL, Assisted by Hugh Henderson
   11885             :     //       DATE WRITTEN   Spring 2008
   11886             :     //       Using condenser solution algorithms written by Richard Raustad, FSEC
   11887             :     //          Oct/Nov 2004, and MODIFIED by Shirey, FSEC Dec 2004, and Hudson, ORNL in 2007
   11888             :     //       RE-ENGINEERED  na
   11889             : 
   11890             :     // PURPOSE OF THIS SUBROUTINE:
   11891             :     // Find the condenser heat rejection for a particular detailed
   11892             :     // refrigeration system and condensing temperature (part of iterative soln for cond temp).
   11893             : 
   11894             :     // METHODOLOGY EMPLOYED:
   11895             :     // Calculate the condenser fan/pump power and consumption
   11896             :     // using manufacturer's rating data and fan power correlations
   11897             :     // from ASHRAE and evaporative effectiveness based on enthalpy
   11898             :     // similar to work done by Manske.
   11899             : 
   11900             :     // From Heejin Cho, Re variable frequency drive fans,
   11901             :     // "From HVAC forums, I learned that it is common practice to set a
   11902             :     // minimum frequency at 15 or 20 Hz to protect motors from overheating. The
   11903             :     // full speed is at 60 Hz. The ratio of minimum and maximum frequencies
   11904             :     // will correspond to the ratio of minimum and maximum flow rates."
   11905             : 
   11906             :     // REFERENCES:
   11907             :     // "Impact of ASHRAE Standard 62-1989 on Florida Supermarkets",
   11908             :     //  Florida Solar Energy Center, FSEC-CR-910-96, Final Report, Oct. 1996
   11909             : 
   11910             :     // Kyle A. Manske, Performance Optimization of Industrial Refrigeration Systems,
   11911             :     //  A thesis submitted in partial fulfillment of the requirements for the degree of
   11912             :     //  Master of Science, University of Wisconsin-Madison, 1999
   11913             : 
   11914             :     // Lawrence Berkeley Laboratory and Resource Dynamics, Improving Fan System Performance,
   11915             :     //   A Sourcebook for Industry, DOE/GO-102003-1294, April 2003
   11916             : 
   11917    28015557 :     Real64 constexpr BleedRateConstant(5.0E-10); // water purge rate for evaporative
   11918             :     //  condensers (m3/W-s) equal to 3 GPM per 100 tons (BAC Engineering Reference)
   11919             : 
   11920    28015557 :     auto &System(state.dataRefrigCase->System);
   11921    28015557 :     auto &Condenser(state.dataRefrigCase->Condenser);
   11922             : 
   11923             :     int CondID;               // Condenser Number
   11924             :     int CondCreditWarnIndex1; // Used to sum up warning count
   11925             :     int CondCreditWarnIndex2; // Used to sum up warning count
   11926             :     int CondCreditWarnIndex3; // Used to sum up warning count
   11927             :     int CondCreditWarnIndex4; // Used to sum up warning count
   11928             :     int CondCreditWarnIndex5; // Used to sum up warning count
   11929             :     int CondCreditWarnIndex6; // Used to sum up warning count
   11930             :     int CondCreditWarnIndex7; // Used to sum up warning count
   11931             :     int Sysloop;              // counter over number of systems attached to this condenser
   11932             :     int SystemID;             // System number rejecting heat to this condenser
   11933             :     bool EvapAvail;           // Control for evap condenser availability
   11934             : 
   11935             :     Real64 AirVolRatio;                 // Ratio of air volume needed to remove load relative to design load
   11936             :     Real64 AirDensity;                  // Density of air at condenser inlet [kg/m3]
   11937             :     Real64 AirDensityDry;               // Density of dry air at condenser inlet temperature [kg/m3]
   11938             :     Real64 ActualFanPower;              // Fan power after adjustments for partially loaded condenser [W]
   11939             :     Real64 BPress;                      // Barometric pressure at condenser air inlet node [Pa]
   11940             :     Real64 CapFac;                      // Capacity Factor
   11941             :     Real64 Effectiveness;               // for evap condenser, =capacity/max cap, where max cap is cap if Tairout equal Tcondense
   11942             :     Real64 EnthalpyAtTcond;             // enthalpy of saturated air at Tcondense
   11943             :     Real64 EnthalpyAirIn;               // Enthalpy of air entering condenser [J/kg]
   11944             :     Real64 EnthalpyAirOut;              // Enthalpy of air leaving condenser [J/kg]
   11945             :     Real64 FanMinAirFlowRatio;          // Minimum fan air flow ratio
   11946             :     Real64 FanPowerRatio;               // Calculated fan power ratio
   11947    28015557 :     Real64 HRCF(0.0);                   // Heat Rejection Capacity Factor (convention for evap condensers)
   11948             :     Real64 HRCFFullFlow;                // Heat Rejection Capacity Factor at full air flow
   11949             :     Real64 HumRatIn;                    // Humidity ratio of inlet air to condenser [kg/kg]
   11950             :     Real64 HumRatOut;                   // Humidity ratio of outlet air from condenser (assumed saturated) [kg/kg]
   11951    28015557 :     Real64 OutWbTemp(0.0);              // Outdoor wet bulb temp at condenser air inlet node [C]
   11952             :     Real64 OutDbTemp;                   // Outdoor dry bulb temp at condenser air inlet node [C]
   11953             :     Real64 PurgeRate;                   // Rate of water blow-down/bleed/purge in evap condenser (m3/s)
   11954             :     Real64 RatedFanPower;               // local variable equal to input condenser value
   11955             :     Real64 RatedAirFlowRate;            // local variable equal to input condenser value
   11956             :     Real64 SinkTemp;                    // Heat sink temperature used to derate fan power at reduced loads [C]
   11957             :     Real64 TCondCalc;                   // Calculated Condensing temperature
   11958             :     Real64 TotalCondDefrostCreditLocal; // total cond credit from hot gas/brine defr for cases etc. served
   11959             :     //     directly by all systems served by this condenser [W]
   11960             :     Real64 TotalCondDefCredfromSysID;    // cond credit for single system [W]
   11961    28015557 :     Real64 TotalLoadFromThisSystem(0.0); // total heat rejection load from the detailed system id'd in subroutine call [W]
   11962             :     Real64 TotalLoadFromSystems;         // total heat rejection load from all systems served by this condenser [W]
   11963             : 
   11964    28015557 :     Real64 LocalTimeStep = state.dataGlobal->TimeStepZone;
   11965    28015557 :     if (state.dataRefrigCase->UseSysTimeStep) LocalTimeStep = state.dataHVACGlobal->TimeStepSys;
   11966             : 
   11967             :     // Initialize this condenser for this time step
   11968    28015557 :     state.dataRefrigCase->TotalCondenserPumpPower = 0.0;
   11969    28015557 :     state.dataRefrigCase->TotalBasinHeatPower = 0.0;
   11970    28015557 :     state.dataRefrigCase->TotalCondenserHeat = 0.0;
   11971    28015557 :     state.dataRefrigCase->TotalEvapWaterUseRate = 0.0;
   11972    28015557 :     ActualFanPower = 0.0;
   11973    28015557 :     TotalCondDefrostCreditLocal = 0.0;
   11974    28015557 :     TotalLoadFromSystems = 0.0;
   11975    28015557 :     EvapAvail = true;
   11976    28015557 :     CondID = this->CondenserNum(1);
   11977    28015557 :     auto &condenser(Condenser(CondID));
   11978    28015557 :     RatedFanPower = condenser.RatedFanPower;
   11979    28015557 :     RatedAirFlowRate = condenser.RatedAirFlowRate;
   11980    28015557 :     FanMinAirFlowRatio = condenser.FanMinAirFlowRatio;
   11981    28015557 :     CondCreditWarnIndex1 = condenser.CondCreditWarnIndex1;
   11982    28015557 :     CondCreditWarnIndex2 = condenser.CondCreditWarnIndex2;
   11983    28015557 :     CondCreditWarnIndex3 = condenser.CondCreditWarnIndex3;
   11984    28015557 :     CondCreditWarnIndex4 = condenser.CondCreditWarnIndex4;
   11985    28015557 :     CondCreditWarnIndex5 = condenser.CondCreditWarnIndex5;
   11986    28015557 :     CondCreditWarnIndex6 = condenser.CondCreditWarnIndex6;
   11987    28015557 :     CondCreditWarnIndex7 = condenser.CondCreditWarnIndex7;
   11988             : 
   11989             :     // Sum total condenser load and defrost credits for all systems connected to this condenser
   11990             :     //  The system values will match the last time that system was solved, so some of the values may be
   11991             :     //  from the previous overall solution iteration.  However, solution goes through 3 iterations if
   11992             :     //  there are any shared condensers, so that's ok.
   11993    56120379 :     for (Sysloop = 1; Sysloop <= condenser.NumSysAttach; ++Sysloop) {
   11994    28104822 :         SystemID = condenser.SysNum(Sysloop);
   11995    28104822 :         TotalCondDefCredfromSysID = System(SystemID).TotalCondDefrostCredit + System(SystemID).SumCascadeCondCredit;
   11996    28104822 :         TotalCondDefrostCreditLocal += TotalCondDefCredfromSysID;
   11997             :         // total heat rejection load from a single detailed system [W]
   11998             :         Real64 TotalLoadFromSysID =
   11999    28104822 :             System(SystemID).TotalSystemLoad + System(SystemID).TotCompPower + System(SystemID).TotHiStageCompPower + System(SystemID).PipeHeatLoad;
   12000    28104822 :         TotalLoadFromSystems += TotalLoadFromSysID;
   12001    28104822 :         if (SystemID == SysNum) TotalLoadFromThisSystem = TotalLoadFromSysID;
   12002             :     } // Sysloop over every system connected to this condenser
   12003             : 
   12004             :     // for cascade condensers, condenser defrost credit gets passed on to the primary system condenser
   12005    28015557 :     if (condenser.CondenserType == DataHeatBalance::RefrigCondenserType::Cascade) TotalCondDefrostCreditLocal = 0.0;
   12006             : 
   12007             :     // Calculate Total Heat rejection needed.  Assume hermetic compressors - conservative assumption
   12008             :     // Note that heat rejection load carried by desuperheater hvac coils or water heaters is the
   12009             :     // lagged variable from the previous time step because these are calculated after the refrigeration
   12010             :     // system is solved.
   12011    28015557 :     condenser.ExternalHeatRecoveredLoad = condenser.LaggedUsedWaterHeater + condenser.LaggedUsedHVACCoil;
   12012    28015557 :     condenser.InternalHeatRecoveredLoad = TotalCondDefrostCreditLocal;
   12013    28015557 :     condenser.TotalHeatRecoveredLoad = condenser.ExternalHeatRecoveredLoad + TotalCondDefrostCreditLocal;
   12014             : 
   12015    28015557 :     state.dataRefrigCase->TotalCondenserHeat = TotalLoadFromSystems - TotalCondDefrostCreditLocal - condenser.ExternalHeatRecoveredLoad;
   12016    28015557 :     if (state.dataRefrigCase->TotalCondenserHeat < 0.0) {
   12017             : 
   12018           9 :         state.dataRefrigCase->TotalCondenserHeat = 0.0;
   12019           9 :         if (!state.dataGlobal->WarmupFlag) {
   12020          18 :             ShowRecurringWarningErrorAtEnd(state,
   12021          12 :                                            "Refrigeration:System: " + this->Name +
   12022             :                                                ":heat reclaimed(defrost,other purposes) >current condenser load. ",
   12023             :                                            CondCreditWarnIndex1);
   12024           6 :             ShowRecurringContinueErrorAtEnd(
   12025             :                 state, "For heat recovered for defrost: ASHRAE rule of thumb: <= 25% of the load on a rack ", CondCreditWarnIndex2);
   12026           6 :             ShowRecurringContinueErrorAtEnd(
   12027             :                 state, "should be in defrost at the same time. Consider diversifying defrost schedules.", CondCreditWarnIndex3);
   12028           6 :             ShowRecurringContinueErrorAtEnd(
   12029             :                 state,
   12030             :                 "For heat recovered for other purposes: this warning may be an artifact of refrigeration calculation at the load",
   12031             :                 CondCreditWarnIndex4);
   12032           6 :             ShowRecurringContinueErrorAtEnd(
   12033             :                 state,
   12034             :                 "time step and heat recovery at the system time step. In that case, and ONLY if it occurs a large number of times",
   12035             :                 CondCreditWarnIndex5);
   12036           6 :             ShowRecurringContinueErrorAtEnd(
   12037             :                 state, "(relative to the number of time steps in the simulation), there may be a mis-match between the", CondCreditWarnIndex6);
   12038           6 :             ShowRecurringContinueErrorAtEnd(
   12039             :                 state, "operating schedules of the refrigeration system and the heat recovery load.", CondCreditWarnIndex7);
   12040             :         } // not warmup
   12041             :     }     // total condenser heat < 0
   12042             : 
   12043             :     // Water side of water-cooled condensers simulated in SimRefrigCondenser,
   12044             :     //   Here, we just need load and condensing temperatures.
   12045             :     //   Condensing temperature a fixed delta (the rated approach temperature) from inlet water temp so long as above minimum.
   12046             :     //   Note, if condensing temperature falls below minimum, get warning and reset but no change in water-side calculations.
   12047    28015557 :     if (condenser.CondenserType == DataHeatBalance::RefrigCondenserType::Water) {
   12048             :         // Obtain water-cooled condenser inlet/outlet temps
   12049        6066 :         condenser.InletTemp = state.dataLoopNodes->Node(condenser.InletNode).Temp;
   12050        6066 :         TCondCalc = state.dataLoopNodes->Node(condenser.InletNode).Temp + condenser.RatedApproachT;
   12051        6066 :         if ((condenser.InletTemp < condenser.InletTempMin) || (TCondCalc < this->TCondenseMin)) {
   12052           0 :             this->TCondense = this->TCondenseMin;
   12053             :             // condenser.LowTempWarn += 1;
   12054           0 :             if (condenser.LowTempWarnIndex == 0) {
   12055           0 :                 ShowWarningMessage(state, "Refrigeration:Condenser:WaterCooled " + condenser.Name);
   12056           0 :                 ShowContinueError(state,
   12057             :                                   "Water-cooled condenser inlet temp lower than minimum allowed temp. Check returning water temperature and/or "
   12058             :                                   "minimum temperature setpoints relative to minimum allowed condensing temperature.");
   12059             :             }
   12060           0 :             ShowRecurringWarningErrorAtEnd(state,
   12061           0 :                                            "Refrigeration:Condenser:WaterCooled " + condenser.Name +
   12062             :                                                " - Condenser inlet temp lower than minimum allowed ... continues",
   12063             :                                            condenser.LowTempWarnIndex);
   12064             :             // END IF
   12065             :         } else {
   12066        6066 :             this->TCondense = TCondCalc;
   12067             :         }
   12068             : 
   12069    28085218 :     } else if ((condenser.CondenserType == DataHeatBalance::RefrigCondenserType::Air) ||
   12070       75727 :                (condenser.CondenserType == DataHeatBalance::RefrigCondenserType::Evap)) {
   12071             :         // Condensing Temp, fan and other aux loads for air-cooled or evap-cooled
   12072             : 
   12073             :         // The rated capacity of air-cooled condenser was adjusted for elevation in get input step
   12074    27997358 :         CapFac = state.dataRefrigCase->TotalCondenserHeat / condenser.RatedCapacity;
   12075             :         // See whether condenser is at ground level or if other air conditions(ie node) have been specified.
   12076             :         //    Note that air-cooled condensers can draw air from, and reject heat to, a conditioned zone
   12077             :         //    But evaporative condensers cannot.
   12078             :         // Provides effective condensing temperature for air-cooled condenser (or evap if evap is scheduled off)
   12079    27997358 :         if (condenser.InletAirNodeNum != 0) {
   12080    27997358 :             OutDbTemp = state.dataLoopNodes->Node(condenser.InletAirNodeNum).Temp;
   12081    27997358 :             BPress = state.dataLoopNodes->Node(condenser.InletAirNodeNum).Press;
   12082    27997358 :             HumRatIn = state.dataLoopNodes->Node(condenser.InletAirNodeNum).HumRat;
   12083             :         } else {
   12084           0 :             OutDbTemp = state.dataEnvrn->OutDryBulbTemp;
   12085           0 :             BPress = state.dataEnvrn->OutBaroPress;
   12086           0 :             HumRatIn = state.dataEnvrn->OutHumRat;
   12087             :         }
   12088    27997358 :         AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, BPress, OutDbTemp, HumRatIn);
   12089    27997358 :         AirDensityDry = Psychrometrics::PsyRhoAirFnPbTdbW(state, BPress, OutDbTemp, 0.0);
   12090             :         // Evaporative condensers will have their water flow shut off in cold months to avoid
   12091             :         //  'spectacular' icing problems.  Ideally, the user will use the evaporative schedule input
   12092             :         //  to set such a schedule.  However, sometimes, users will use a single input deck to model
   12093             :         //  one building in multiple climates, and may not think to put in such a schedule in the colder
   12094             :         //  climates.  To accomodate such applications, the variable EvapCutOutTdb is used as an extra
   12095             :         //  check.
   12096             : 
   12097    27997358 :         if (OutDbTemp < EvapCutOutTdb) EvapAvail = false;
   12098             : 
   12099             :         // Check schedule to determine evap condenser availability
   12100             :         // IF schedule exists, evap condenser can be scheduled OFF
   12101    28060952 :         if ((condenser.CondenserType == DataHeatBalance::RefrigCondenserType::Evap) && (condenser.EvapSchedPtr > 0) &&
   12102       63594 :             (ScheduleManager::GetCurrentScheduleValue(state, condenser.EvapSchedPtr) == 0))
   12103       32675 :             EvapAvail = false;
   12104             : 
   12105             :         // Calculate condensing temperatures for air-cooled and evap-cooled
   12106    27997358 :         if (condenser.CondenserType == DataHeatBalance::RefrigCondenserType::Evap) {
   12107             :             // Manufacturer's HRCF regressed to produce a function of the form:
   12108             :             // (Tcondense-Twb)=A1 + A2*hrcf + A3/hrcf + A4*Twb
   12109             :             // HRCF defined as rated capacity divided by load
   12110             :             // Apply ARI490 elevation correction factor here for evap condenser, then apply hrcf limits
   12111       63594 :             if (CapFac > 0.0) {
   12112       63594 :                 HRCF = condenser.EvapElevFact / CapFac;
   12113             :                 // Condenser(CondNum)%EvapElevFact=1.0d0-3.074D-5*Elevation
   12114             :             } else {
   12115           0 :                 HRCF = MyLargeNumber;
   12116             :             }
   12117       63594 :             HRCF = min(HRCF, condenser.MaxCapFacEvap);
   12118       63594 :             HRCF = max(HRCF, condenser.MinCapFacEvap);
   12119       63594 :             if (EvapAvail) {
   12120       30919 :                 OutWbTemp = Psychrometrics::PsyTwbFnTdbWPb(state, OutDbTemp, HumRatIn, BPress);
   12121       30919 :                 SinkTemp = OutWbTemp;
   12122             :             } else {         // evaporative condenser with water spray scheduled off so use Tdb
   12123       32675 :                 HRCF /= 3.0; // reference Menske, cap of evap cond operating dry about 1/3 of rated cap
   12124       32675 :                 HRCF = max(HRCF, condenser.MinCapFacEvap);
   12125       32675 :                 SinkTemp = OutDbTemp;
   12126             :             } // evap avail, still in evap condenser
   12127       63594 :             TCondCalc = condenser.EvapCoeff1 + condenser.EvapCoeff2 * HRCF + condenser.EvapCoeff3 / HRCF + (1.0 + condenser.EvapCoeff4) * SinkTemp;
   12128             :         } else { // air-cooled condenser
   12129             :             // MinCondLoad and TempSlope came from condenser capacity curve, using curve backwards
   12130    27933764 :             TCondCalc = OutDbTemp + (state.dataRefrigCase->TotalCondenserHeat - condenser.MinCondLoad) * condenser.TempSlope;
   12131    27933764 :             SinkTemp = OutDbTemp;
   12132             :         } // if evap-cooled condenser
   12133             : 
   12134             :         // Fan energy calculations apply to both air- and evap-cooled condensers
   12135             :         // Compare calculated condensing temps to minimum allowed to determine fan power/operating mode
   12136    27997358 :         if (TCondCalc >= this->TCondenseMin) {
   12137     7935764 :             this->TCondense = TCondCalc;
   12138     7935764 :             ActualFanPower = RatedFanPower;
   12139     7935764 :             AirVolRatio = 1.0;
   12140             : 
   12141             :         } else { // need to reduce fan speed to reduce air flow and keep Tcond at or above Tcond min
   12142    20061594 :             this->TCondense = this->TCondenseMin;
   12143    20061594 :             TCondCalc = this->TCondenseMin;
   12144             :             // recalculate CapFac at current delta T
   12145    20061594 :             if (condenser.CondenserType == DataHeatBalance::RefrigCondenserType::Air) {
   12146             :                 // current maximum condenser capacity at delta T present for minimum condensing temperature [W]
   12147    20046617 :                 Real64 CurMaxCapacity = Curve::CurveValue(state, condenser.CapCurvePtr, (this->TCondenseMin - OutDbTemp));
   12148    20046617 :                 CapFac = state.dataRefrigCase->TotalCondenserHeat / CurMaxCapacity;
   12149    20046617 :                 AirVolRatio = max(FanMinAirFlowRatio, std::pow(CapFac, CondAirVolExponentDry)); // Fans limited by minimum air flow ratio
   12150    20046617 :                 AirVolRatio = min(AirVolRatio, 1.0);
   12151             :             } else { // condenser.CondenserType == DataHeatBalance::RefrigCondenserType::Evap
   12152       14977 :                 HRCFFullFlow = HRCF;
   12153             :                 // if evap condenser need to back calculate the operating capacity using HRCF relationship, given known Tcond
   12154       14977 :                 Real64 QuadBterm = condenser.EvapCoeff1 - (this->TCondense - SinkTemp) + condenser.EvapCoeff4 * SinkTemp;
   12155       14977 :                 Real64 Sqrtterm = pow_2(QuadBterm) - 4.0 * condenser.EvapCoeff2 * condenser.EvapCoeff3;
   12156       14977 :                 if (Sqrtterm < 0.0) { // only happens for very high wet bulb temps
   12157           0 :                     HRCF = condenser.EvapElevFact * condenser.MaxCapFacEvap;
   12158           0 :                     if (!EvapAvail) HRCF /= 3.0;
   12159           0 :                     HRCF = max(HRCF, condenser.MinCapFacEvap);
   12160             :                 } else {
   12161       14977 :                     HRCF = condenser.EvapElevFact * (-QuadBterm - std::sqrt(Sqrtterm)) / (2.0 * condenser.EvapCoeff2);
   12162       14977 :                     if (!EvapAvail) HRCF /= 3.0;
   12163       14977 :                     HRCF = min(HRCF, condenser.MaxCapFacEvap);
   12164       14977 :                     HRCF = max(HRCF, condenser.MinCapFacEvap);
   12165             :                 }                             // sqrtterm
   12166       14977 :                 CapFac = HRCF / HRCFFullFlow; // note, HRCFFullFlow previously limited between min and max,so can't be zero
   12167       14977 :                 if (EvapAvail) {
   12168        5094 :                     AirVolRatio = max(FanMinAirFlowRatio, std::pow(CapFac, CondAirVolExponentEvap)); // Fans limited by minimum air flow ratio
   12169             :                 } else {                                                                             // evap not available
   12170        9883 :                     AirVolRatio = max(FanMinAirFlowRatio, std::pow(CapFac, CondAirVolExponentDry));  // Fans limited by minimum air flow ratio
   12171             :                 }                                                                                    // evap available
   12172       14977 :                 AirVolRatio = min(AirVolRatio, 1.0);
   12173             :             } // condenser type = DataHeatBalance::RefrigCondenserType::Air with else for evap
   12174             : 
   12175    20061594 :             switch (condenser.FanSpeedControlType) {
   12176       71213 :             case FanSpeedCtrlType::VariableSpeed: { // fan power law, adjusted for reality, applies
   12177       71213 :                 FanPowerRatio = std::pow(AirVolRatio, 2.5);
   12178       71213 :                 ActualFanPower = FanPowerRatio * RatedFanPower;
   12179       71213 :             } break;
   12180       29424 :             case FanSpeedCtrlType::ConstantSpeed: {
   12181       29424 :                 ActualFanPower = AirVolRatio * std::exp(1.0 - AirVolRatio) * RatedFanPower;
   12182       29424 :             } break;
   12183           0 :             case FanSpeedCtrlType::ConstantSpeedLinear: {
   12184           0 :                 ActualFanPower = AirVolRatio * RatedFanPower;
   12185           0 :             } break;
   12186    19960957 :             case FanSpeedCtrlType::TwoSpeed: {
   12187             :                 // low speed setting of 1/2 fan speed can give up to 60% of capacity.
   12188             :                 // 1/2 speed corresonds to ~1/8 power consumption (FanHalfSpeedRatio = 1/(2**2.5) = 0.1768)
   12189             :                 // dampers are used to control flow within those two ranges as in FanConstantSpeed
   12190    19960957 :                 Real64 const air_vol_fan_power_fac(std::exp(1.0 - AirVolRatio) * RatedFanPower);
   12191    19960957 :                 ActualFanPower = AirVolRatio * air_vol_fan_power_fac;
   12192    19960957 :                 if (CapFac < CapFac60Percent) ActualFanPower = ((AirVolRatio + 0.4) * FanHalfSpeedRatio) * air_vol_fan_power_fac;
   12193    19960957 :             } break;
   12194           0 :             default:
   12195           0 :                 break;
   12196             :             } // fan speed control type
   12197             :         }     // Tcondense >= Tcondense minimum
   12198             : 
   12199    27997358 :         if ((condenser.CondenserType == DataHeatBalance::RefrigCondenserType::Evap) && (EvapAvail)) {
   12200             :             // calculate evap water use,  need to include bleed down/purge water as well as water
   12201             :             // actually evaporated.  Use BAC Engineering Reference value of 3 gpm/100 tons because it's more
   12202             :             // conservative than the ASHRAE value.
   12203             :             //  Also, based on experience, running the evap water when outdoor T near freezing
   12204             :             //  leads to 'spectacular' ice, so schedule evap off when Tdb <=4 C.
   12205             :             // Calculate bleed/purge rate of water loss as a function of capacity, 3 gpm/100 tons refrigeration
   12206       30919 :             PurgeRate = state.dataRefrigCase->TotalCondenserHeat * BleedRateConstant;
   12207       30919 :             EnthalpyAirIn = Psychrometrics::PsyHFnTdbW(OutDbTemp, HumRatIn);
   12208             :             // calculate effectiveness at rated conditions, so use Tcondcalc)
   12209       30919 :             EnthalpyAtTcond = Psychrometrics::PsyHFnTdbRhPb(state, TCondCalc, 1.0, BPress);
   12210       30919 :             Effectiveness = state.dataRefrigCase->TotalCondenserHeat / (RatedAirFlowRate * AirDensity * (EnthalpyAtTcond - EnthalpyAirIn));
   12211             :             // need to limit max effectiveness for errors due to working beyond limits of HRCF in manuf data
   12212       30919 :             Effectiveness = min(Effectiveness, 0.9);
   12213       30919 :             EnthalpyAirOut = EnthalpyAirIn + Effectiveness * (EnthalpyAtTcond - EnthalpyAirIn);
   12214             :             // Air leaving the evaporative condenser is saturated
   12215       30919 :             Real64 TAirOut = Psychrometrics::PsyTsatFnHPb(state, EnthalpyAirOut, BPress);
   12216       30919 :             HumRatOut = Psychrometrics::PsyWFnTdpPb(state, TAirOut, BPress);
   12217       30919 :             state.dataRefrigCase->TotalEvapWaterUseRate =
   12218       30919 :                 PurgeRate + RatedAirFlowRate * AirVolRatio * AirDensityDry * (HumRatOut - HumRatIn) / Psychrometrics::RhoH2O(OutWbTemp);
   12219             :             // assumes evap water pump runs whenever evap cooling is available to minimize scaling
   12220       30919 :             state.dataRefrigCase->TotalCondenserPumpPower = condenser.EvapPumpPower;
   12221             :             // calculate basin water heater load
   12222       30919 :             if (state.dataRefrigCase->TotalCondenserHeat == 0.0 && OutDbTemp < condenser.BasinHeaterSetPointTemp) {
   12223           0 :                 state.dataRefrigCase->TotalBasinHeatPower =
   12224           0 :                     max(0.0, condenser.BasinHeaterPowerFTempDiff * (condenser.BasinHeaterSetPointTemp - OutDbTemp));
   12225             :                 // provide warning if no heater power exists
   12226           0 :                 if (state.dataRefrigCase->TotalBasinHeatPower == 0.0) {
   12227             :                     // condenser.EvapFreezeWarn = condenser.EvapFreezeWarn + 1;
   12228           0 :                     if (condenser.EvapFreezeWarnIndex == 0) {
   12229           0 :                         ShowWarningMessage(
   12230           0 :                             state, "Refrigeration Condenser " + condenser.Name + " - Evap cooling of condenser underway with no basin heater power");
   12231           0 :                         ShowContinueError(state, "and condenser inlet air dry-bulb temp at or below the basin heater setpoint temperature.");
   12232           0 :                         ShowContinueErrorTimeStamp(state, "Continuing simulation.");
   12233             :                     }
   12234           0 :                     ShowRecurringWarningErrorAtEnd(state,
   12235           0 :                                                    "Refrigeration Condenser " + condenser.Name +
   12236             :                                                        " - Evap cooling of condenser underway with no basin heater power ... continues",
   12237             :                                                    condenser.EvapFreezeWarnIndex);
   12238             :                     // END IF  !freeze warnings <= 5
   12239             :                 } // basin power == 0
   12240             :             }     // no load and cold outside
   12241    27997358 :         }         // EvapAvail
   12242             : 
   12243       12133 :     } else if (condenser.CondenserType ==
   12244             :                DataHeatBalance::RefrigCondenserType::Cascade) { // continuing Condenser type = water, (evap or air), or cascade
   12245             :         // Cascade condenser does not iterate.  Condensing temperature specified as a load on higher temp system
   12246             :         //    or floats to meet other loads on that system
   12247             :         // therese ** future - here and for new phase change heat exchanger - need to handle unmet loads!
   12248             : 
   12249       12133 :         this->TCondense = condenser.RatedTCondense;
   12250             : 
   12251       12133 :         if ((this->NumNonCascadeLoads > 0) && (condenser.CascadeTempControl == CascadeCndsrTempCtrlType::TempFloat)) {
   12252           0 :             this->TCondense = System(condenser.CascadeSinkSystemID).TEvapNeeded + condenser.RatedApproachT;
   12253           0 :             if (this->TCondense < this->TCondenseMin) {
   12254           0 :                 this->TCondense = this->TCondenseMin;
   12255           0 :                 ShowRecurringWarningErrorAtEnd(state,
   12256           0 :                                                "Refrigeration Condenser " + condenser.Name +
   12257             :                                                    " - Cascade condenser floating condensing temperature less than specified minimum condensing "
   12258             :                                                    "temperature. Minimum specified temperature used for system below cascade condenser. No "
   12259             :                                                    "correction made for system absorbing heat rejected by the cascade condenser.",
   12260             :                                                condenser.EvapFreezeWarnIndex);
   12261             :             } // floating condensing temperature less than specified min for system
   12262             :         }     // floating temperature
   12263             :     }         // Condenser type = water, (evap or air), or cascade
   12264             : 
   12265    28015557 :     condenser.ActualFanPower = ActualFanPower;
   12266    28015557 :     condenser.FanElecEnergy = ActualFanPower * LocalTimeStep * DataGlobalConstants::SecInHour;
   12267    28015557 :     condenser.EvapWaterConsumpRate = state.dataRefrigCase->TotalEvapWaterUseRate;
   12268    28015557 :     condenser.EvapWaterConsumption = state.dataRefrigCase->TotalEvapWaterUseRate * LocalTimeStep * DataGlobalConstants::SecInHour;
   12269    28015557 :     condenser.ActualEvapPumpPower = state.dataRefrigCase->TotalCondenserPumpPower;
   12270    28015557 :     condenser.EvapPumpConsumption = state.dataRefrigCase->TotalCondenserPumpPower * LocalTimeStep * DataGlobalConstants::SecInHour;
   12271    28015557 :     condenser.BasinHeaterPower = state.dataRefrigCase->TotalBasinHeatPower;
   12272    28015557 :     condenser.BasinHeaterConsumption = state.dataRefrigCase->TotalBasinHeatPower * LocalTimeStep * DataGlobalConstants::SecInHour;
   12273    28015557 :     condenser.CondLoad = state.dataRefrigCase->TotalCondenserHeat;
   12274    28015557 :     condenser.CondEnergy = state.dataRefrigCase->TotalCondenserHeat * LocalTimeStep * DataGlobalConstants::SecInHour;
   12275    28015557 :     condenser.CondCreditWarnIndex1 = CondCreditWarnIndex1;
   12276    28015557 :     condenser.CondCreditWarnIndex2 = CondCreditWarnIndex2;
   12277    28015557 :     condenser.CondCreditWarnIndex3 = CondCreditWarnIndex3;
   12278    28015557 :     condenser.CondCreditWarnIndex4 = CondCreditWarnIndex4;
   12279    28015557 :     condenser.CondCreditWarnIndex5 = CondCreditWarnIndex5;
   12280    28015557 :     condenser.CondCreditWarnIndex6 = CondCreditWarnIndex6;
   12281    28015557 :     condenser.CondCreditWarnIndex7 = CondCreditWarnIndex7;
   12282    28015557 :     condenser.ExternalEnergyRecovered = condenser.ExternalHeatRecoveredLoad * LocalTimeStep * DataGlobalConstants::SecInHour;
   12283    28015557 :     condenser.InternalEnergyRecovered = condenser.InternalHeatRecoveredLoad * LocalTimeStep * DataGlobalConstants::SecInHour;
   12284    28015557 :     condenser.TotalHeatRecoveredEnergy = condenser.TotalHeatRecoveredLoad * LocalTimeStep * DataGlobalConstants::SecInHour;
   12285    28015557 :     this->NetHeatRejectLoad = state.dataRefrigCase->TotalCondenserHeat * TotalLoadFromThisSystem / TotalLoadFromSystems;
   12286    28015557 :     this->NetHeatRejectEnergy = this->NetHeatRejectLoad * LocalTimeStep * DataGlobalConstants::SecInHour;
   12287             : 
   12288             :     // set water system demand request (if needed)
   12289    28015557 :     if (condenser.EvapWaterSupplyMode == WaterSupply::FromTank) {
   12290       63594 :         state.dataWaterData->WaterStorage(condenser.EvapWaterSupTankID).VdotRequestDemand(condenser.EvapWaterTankDemandARRID) =
   12291       63594 :             condenser.EvapWaterConsumpRate;
   12292             :     }
   12293    28015557 : }
   12294             : 
   12295       10703 : void TransRefrigSystemData::CalcGasCooler(EnergyPlusData &state, int const SysNum)
   12296             : {
   12297             : 
   12298             :     // SUBROUTINE INFORMATION:
   12299             :     //       AUTHOR         Brian A. Fricke, ORNL
   12300             :     //       DATE WRITTEN   Fall 2011
   12301             :     //       MODIFIED       na
   12302             :     //       RE-ENGINEERED  na
   12303             : 
   12304             :     // PURPOSE OF THIS SUBROUTINE:
   12305             :     // Find the gas cooler outlet temperature, the optimum gas cooler pressure, heat rejection,
   12306             :     // fan power, and fan energy for a detailed transcritical CO2 refrigeration system.
   12307             : 
   12308             :     // METHODOLOGY EMPLOYED:
   12309             :     // For a specified gas cooler outlet temperature in transcritical operation, there is an optimal gas cooler
   12310             :     // pressure which produces the highest COP. A curve-fit equation similar to that presented by Ge and Tassou
   12311             :     // (2011) and Sawalha (2008) is used to determine the optimum gas cooler pressure for a given gas cooler
   12312             :     // outlet temperature. In subcritical operation, the condensing temperature and pressure are allowed to
   12313             :     // float with ambient conditions, above the minimum condensing temperature.
   12314             : 
   12315             :     // REFERENCES:
   12316             :     // Ge, Y.T., and S.A. Tassou. 2011. Performance evaluation and optimal design of supermarket refrigeration
   12317             :     //     systems with supermarket model "SuperSim", Part I: Model description and validation. International
   12318             :     //     Journal of Refrigeration 34: 527-539.
   12319             :     // Ge, Y.T., and S.A. Tassou. 2011. Performance evaluation and optimal design of supermarket refrigeration
   12320             :     //     systems with supermarket model "SuperSim", Part II: Model applications. International Journal of
   12321             :     //     Refrigeration 34: 540-549.
   12322             :     // Sawalha, S. 2008. Theoretical evaluation of trans-critical CO2 systems in supermarket refrigeration,
   12323             :     //     Part I: Modeling, simulation and optimization of two system solutions. International Journal of
   12324             :     //     Refrigeration 31: 516-524.
   12325             :     // Sawalha, S. 2008. Theoretical evaluation of trans-critical CO2 systems in supermarket refrigeration,
   12326             :     //     Part II: System modifications and comparisons of different solutions. International Journal of
   12327             :     //     Refrigeration 31: 525-534.
   12328             : 
   12329             :     static constexpr std::string_view RoutineName("RefrigeratedCase:CalcGasCooler");
   12330             : 
   12331       10703 :     auto &TransSystem(state.dataRefrigCase->TransSystem);
   12332       10703 :     auto &GasCooler(state.dataRefrigCase->GasCooler);
   12333             : 
   12334             :     int GasCoolerCreditWarnIndex;       // Warning counter
   12335             :     Real64 ActualFanPower;              // Fan power after adjustments for partially loaded gas cooler [W]
   12336             :     Real64 AirVolRatio;                 // Ratio of air volume needed to remove load relative to design load
   12337             :     Real64 FanMinAirFlowRatio;          // Minimum fan air flow ratio
   12338             :     Real64 FanPowerRatio;               // Calculated fan power ratio
   12339             :     Real64 OutDbTemp;                   // Outdoor dry bulb temperature at gas cooler air inlet node [C]
   12340             :     Real64 RatedFanPower;               // Rated fan power for this gas cooler [W]
   12341             :     Real64 TotalCondDefCredfromSysID;   // Gas cooler defrost credit for single system [W]
   12342             :     Real64 TotalCondDefrostCreditLocal; // Total gas cooler credit from hot gas/brine defrost for cases etc. served
   12343             :     //     directly by all systems served by this gas cooler [W]
   12344             :     Real64 TotalGasCoolerHeat;           // Total gas cooler heat from system [W]
   12345             :     Real64 TotalLoadFromSysID;           // Total heat rejection load from a single detailed system [W]
   12346             :     Real64 TotalLoadFromSystems;         // Total heat rejection load from all systems served by this condenser [W]
   12347       10703 :     Real64 TotalLoadFromThisSystem(0.0); // Total heat rejection load from the detailed system identified in subroutine call [W]
   12348             : 
   12349       10703 :     Real64 LocalTimeStep = state.dataGlobal->TimeStepZone;
   12350       10703 :     if (state.dataRefrigCase->UseSysTimeStep) LocalTimeStep = state.dataHVACGlobal->TimeStepSys;
   12351             : 
   12352             :     // Initialize this gas cooler for this time step
   12353       10703 :     ActualFanPower = 0.0;
   12354       10703 :     TotalCondDefrostCreditLocal = 0.0;
   12355       10703 :     TotalLoadFromSystems = 0.0;
   12356       10703 :     int GasCoolerID = this->GasCoolerNum(1);
   12357       10703 :     RatedFanPower = GasCooler(GasCoolerID).RatedFanPower;
   12358       10703 :     FanMinAirFlowRatio = GasCooler(GasCoolerID).FanMinAirFlowRatio;
   12359       10703 :     GasCoolerCreditWarnIndex = GasCooler(GasCoolerID).GasCoolerCreditWarnIndex;
   12360             : 
   12361       21406 :     for (int Sysloop = 1; Sysloop <= GasCooler(GasCoolerID).NumSysAttach; ++Sysloop) {
   12362       10703 :         int SystemID = GasCooler(GasCoolerID).SysNum(Sysloop);
   12363       10703 :         TotalCondDefCredfromSysID = TransSystem(SystemID).TotalCondDefrostCredit;
   12364       10703 :         TotalCondDefrostCreditLocal += TotalCondDefCredfromSysID;
   12365       32109 :         TotalLoadFromSysID = TransSystem(SystemID).TotalSystemLoadLT + TransSystem(SystemID).TotalSystemLoadMT +
   12366       21406 :                              TransSystem(SystemID).TotCompPowerLP + TransSystem(SystemID).TotCompPowerHP + TransSystem(SystemID).PipeHeatLoadLT +
   12367       10703 :                              TransSystem(SystemID).PipeHeatLoadMT;
   12368       10703 :         TotalLoadFromSystems += TotalLoadFromSysID;
   12369       10703 :         if (SystemID == SysNum) TotalLoadFromThisSystem = TotalLoadFromSysID;
   12370             :     } // Sysloop over every system connected to this gas cooler
   12371             : 
   12372             :     // Calculate Total Heat rejection needed.
   12373       10703 :     GasCooler(GasCoolerID).InternalHeatRecoveredLoad = TotalCondDefrostCreditLocal;
   12374       10703 :     GasCooler(GasCoolerID).TotalHeatRecoveredLoad = TotalCondDefrostCreditLocal;
   12375       10703 :     TotalGasCoolerHeat = TotalLoadFromSystems - TotalCondDefrostCreditLocal;
   12376             : 
   12377       10703 :     if (TotalGasCoolerHeat < 0.0) {
   12378           0 :         TotalGasCoolerHeat = 0.0;
   12379           0 :         if (!state.dataGlobal->WarmupFlag)
   12380           0 :             ShowRecurringWarningErrorAtEnd(state,
   12381           0 :                                            "Refrigeration:TranscriticalSystem: " + this->Name +
   12382             :                                                ":heat reclaimed (defrost,other purposes) is greater than current gas cooler load. ASHRAE rule of "
   12383             :                                                "thumb: <= 25% of the load on a system should be in defrost at the same time. Consider "
   12384             :                                                "diversifying defrost schedules.",
   12385             :                                            GasCoolerCreditWarnIndex);
   12386             :     } // total gas cooler heat < 0
   12387             : 
   12388             :     // The rated capacity of air-cooled gas cooler was adjusted for elevation in get input step
   12389       10703 :     Real64 CapFac = TotalGasCoolerHeat / GasCooler(GasCoolerID).RatedCapacity;
   12390             :     // See whether gas cooler is at ground level or if other air conditions (ie node) have been specified.
   12391             :     // Note that air-cooled gas coolers can draw air from, and reject heat to, a conditioned zone.
   12392       10703 :     if (GasCooler(GasCoolerID).InletAirNodeNum != 0) {
   12393           0 :         OutDbTemp = state.dataLoopNodes->Node(GasCooler(GasCoolerID).InletAirNodeNum).Temp;
   12394             :     } else {
   12395       10703 :         OutDbTemp = state.dataEnvrn->OutDryBulbTemp;
   12396             :     }
   12397             :     // Determine gas cooler outlet temperature and pressure
   12398             :     // Transcritical:  Gas cooler outlet temperature based on ambient temperature and approach temperature.
   12399             :     //                 Determine optimum gas cooler pressure to maximize COP.
   12400             :     // Subcritical:  Allow condensing temperature and pressure to float between minimum condensing temperature and
   12401             :     //               transition temperature.
   12402       10703 :     if (OutDbTemp > GasCooler(GasCoolerID).TransitionTemperature) { // Gas cooler in transcritical operation
   12403        4377 :         GasCooler(GasCoolerID).TGasCoolerOut = OutDbTemp + GasCooler(GasCoolerID).GasCoolerApproachT;
   12404        4377 :         GasCooler(GasCoolerID).PGasCoolerOut = 1.0e5 * (2.3083 * state.dataEnvrn->OutDryBulbTemp + 11.9);
   12405        4377 :         if (GasCooler(GasCoolerID).PGasCoolerOut < 7.5e6) { // Ensure gas cooler pressure is at least 7.5 MPa for transcritical operation
   12406         427 :             GasCooler(GasCoolerID).PGasCoolerOut = 7.5e6;
   12407             :         }
   12408       13131 :         GasCooler(GasCoolerID).HGasCoolerOut = FluidProperties::GetSupHeatEnthalpyRefrig(
   12409        8754 :             state, this->RefrigerantName, GasCooler(GasCoolerID).TGasCoolerOut, GasCooler(GasCoolerID).PGasCoolerOut, this->RefIndex, RoutineName);
   12410        4377 :         GasCooler(GasCoolerID).TransOpFlag = true;
   12411             :     } else { // Gas cooler in subcritical operation
   12412        6326 :         GasCooler(GasCoolerID).TGasCoolerOut = OutDbTemp + GasCooler(GasCoolerID).SubcriticalTempDiff;
   12413        6326 :         if (GasCooler(GasCoolerID).TGasCoolerOut > 30.978) { //  Gas temperature should be less than critical temperature
   12414        1966 :             GasCooler(GasCoolerID).PGasCoolerOut = 7.2e6;    //  Fix the pressure to be subcritical
   12415        3932 :             GasCooler(GasCoolerID).TGasCoolerOut = FluidProperties::GetSatTemperatureRefrig(
   12416        1966 :                 state, this->RefrigerantName, GasCooler(GasCoolerID).PGasCoolerOut, this->RefIndex, RoutineName);
   12417        8720 :         } else if (GasCooler(GasCoolerID).TGasCoolerOut >
   12418        4360 :                    GasCooler(GasCoolerID).MinCondTemp) { //  Allow condensing temperature to float above the minimum
   12419        8720 :             GasCooler(GasCoolerID).PGasCoolerOut = FluidProperties::GetSatPressureRefrig(
   12420        4360 :                 state, this->RefrigerantName, GasCooler(GasCoolerID).TGasCoolerOut, this->RefIndex, RoutineName);
   12421             :         } else { //  Don't allow condensing temperature to drop below minimum
   12422           0 :             GasCooler(GasCoolerID).TGasCoolerOut = GasCooler(GasCoolerID).MinCondTemp;
   12423           0 :             GasCooler(GasCoolerID).PGasCoolerOut = FluidProperties::GetSatPressureRefrig(
   12424           0 :                 state, this->RefrigerantName, GasCooler(GasCoolerID).TGasCoolerOut, this->RefIndex, RoutineName);
   12425             :         }
   12426       12652 :         GasCooler(GasCoolerID).HGasCoolerOut = FluidProperties::GetSatEnthalpyRefrig(
   12427        6326 :             state, this->RefrigerantName, GasCooler(GasCoolerID).TGasCoolerOut, 0.0, this->RefIndex, RoutineName);
   12428        6326 :         GasCooler(GasCoolerID).TransOpFlag = false;
   12429             :     } // (OutDbTemp > TransitionTemperature)
   12430             : 
   12431       10703 :     if (GasCooler(GasCoolerID).TGasCoolerOut < 30.978) {
   12432       14254 :         GasCooler(GasCoolerID).CpGasCoolerOut = FluidProperties::GetSatSpecificHeatRefrig(
   12433        7127 :             state, this->RefrigerantName, GasCooler(GasCoolerID).TGasCoolerOut, 0.0, this->RefIndex, RoutineName);
   12434             :     } else {
   12435        3576 :         GasCooler(GasCoolerID).CpGasCoolerOut = 0.0;
   12436             :     }
   12437             : 
   12438             :     // Gas cooler fan energy calculations
   12439       10703 :     AirVolRatio = max(FanMinAirFlowRatio, std::pow(CapFac, CondAirVolExponentDry)); // Fans limited by minimum air flow ratio
   12440             : 
   12441       10703 :     switch (GasCooler(GasCoolerID).FanSpeedControlType) {
   12442           0 :     case FanSpeedCtrlType::VariableSpeed: { // fan power law, adjusted for reality, applies
   12443           0 :         FanPowerRatio = std::pow(AirVolRatio, 2.5);
   12444           0 :         ActualFanPower = FanPowerRatio * RatedFanPower;
   12445           0 :     } break;
   12446       10703 :     case FanSpeedCtrlType::ConstantSpeed: {
   12447       10703 :         ActualFanPower = AirVolRatio * std::exp(1.0 - AirVolRatio) * RatedFanPower;
   12448       10703 :     } break;
   12449           0 :     case FanSpeedCtrlType::ConstantSpeedLinear: {
   12450           0 :         ActualFanPower = AirVolRatio * RatedFanPower;
   12451           0 :     } break;
   12452           0 :     case FanSpeedCtrlType::TwoSpeed: {
   12453             :         // low speed setting of 1/2 fan speed can give up to 60% of capacity.
   12454             :         // 1/2 speed corresonds to ~1/8 power consumption (FanHalfSpeedRatio = 1/(2**2.5) = 0.1768)
   12455             :         // dampers are used to control flow within those two ranges as in FanConstantSpeed
   12456           0 :         ActualFanPower = AirVolRatio * std::exp(1.0 - AirVolRatio) * RatedFanPower;
   12457           0 :         if (CapFac < CapFac60Percent) ActualFanPower = ((AirVolRatio + 0.4) * (FanHalfSpeedRatio)) * std::exp(1.0 - AirVolRatio) * RatedFanPower;
   12458           0 :     } break;
   12459           0 :     default:
   12460           0 :         break;
   12461             :     } // fan speed control type
   12462             : 
   12463       10703 :     GasCooler(GasCoolerID).ActualFanPower = ActualFanPower;
   12464       10703 :     GasCooler(GasCoolerID).FanElecEnergy = ActualFanPower * LocalTimeStep * DataGlobalConstants::SecInHour;
   12465       10703 :     GasCooler(GasCoolerID).GasCoolerLoad = TotalGasCoolerHeat;
   12466       10703 :     GasCooler(GasCoolerID).GasCoolerEnergy = TotalGasCoolerHeat * LocalTimeStep * DataGlobalConstants::SecInHour;
   12467       10703 :     GasCooler(GasCoolerID).GasCoolerCreditWarnIndex = GasCoolerCreditWarnIndex;
   12468       10703 :     GasCooler(GasCoolerID).InternalEnergyRecovered =
   12469       10703 :         GasCooler(GasCoolerID).InternalHeatRecoveredLoad * LocalTimeStep * DataGlobalConstants::SecInHour;
   12470       10703 :     GasCooler(GasCoolerID).TotalHeatRecoveredEnergy = GasCooler(GasCoolerID).TotalHeatRecoveredLoad * LocalTimeStep * DataGlobalConstants::SecInHour;
   12471       10703 :     this->NetHeatRejectLoad = TotalGasCoolerHeat * TotalLoadFromThisSystem / TotalLoadFromSystems;
   12472       10703 :     this->NetHeatRejectEnergy = this->NetHeatRejectLoad * LocalTimeStep * DataGlobalConstants::SecInHour;
   12473       10703 : }
   12474             : 
   12475    28015557 : void RefrigSystemData::CalculateCompressors(EnergyPlusData &state)
   12476             : {
   12477             : 
   12478             :     // SUBROUTINE INFORMATION:
   12479             :     //       AUTHOR         Therese Stovall, ORNL, Assisted by Hugh Henderson
   12480             :     //       DATE WRITTEN   Spring 2008
   12481             :     //       MODIFIED       Brian Fricke, ORNL, March 2012, added two-stage compression
   12482             :     //       RE-ENGINEERED  na
   12483             : 
   12484             :     // PURPOSE OF THIS SUBROUTINE:
   12485             :     // Find the Compressor power, energy, capacity, and efficiency for a particular detailed
   12486             :     // refrigeration system.  Routine is capable of modeling single-stage and two-stage
   12487             :     // compression refrigeration systems.
   12488             : 
   12489             :     // METHODOLOGY EMPLOYED:
   12490             :     // USe ARI compressor performance curves, the evaporating temperature and condensing temperature
   12491             : 
   12492             :     // REFERENCES:
   12493             :     // "Impact of ASHRAE Standard 62-1989 on Florida Supermarkets",
   12494             :     //  Florida Solar Energy Center, FSEC-CR-910-96, Final Report, Oct. 1996
   12495             : 
   12496             :     // ARI Standard 540, 2004, Standard for Performance Rating of Positive Displacement Refrigerant
   12497             :     //  Compressors and Compressor Units, Air-Conditioning & Refrigeration Institute,Arlington VA
   12498             : 
   12499             :     // SUBROUTINE PARAMETER DEFINITIONS:
   12500             :     // Following constants approp for R22, R134a, R404a, R507, R410a, R407c, future allow input?
   12501             :     //   May want to allow input to reflect larger pipes selected to reduce delta P and increase compressor efficiency.
   12502             :     // NOTE, these DelT...Pipes reflect the decrease in Pressure in the pipes, NOT thermal transfer through the pipe walls.
   12503    28015557 :     Real64 constexpr DelTSuctPipes(1.0);  // Tsat drop corresponding to P drop in suction pipes, ASHRAE 2006 p 2.4 (C)
   12504    28015557 :     Real64 constexpr DelTDischPipes(0.5); // Tsat drop corresponding to P drop in discharge pipes, ASHRAE 2006 p 2.5 (C)
   12505             : 
   12506             :     static constexpr std::string_view RoutineName("RefrigeratedCase:CalculateCompressors");
   12507             :     Real64 CaseEnthalpyChangeRated;   // Enthalpy change in cases at compressor rated cond, J/kg
   12508             :     Real64 CapacityCorrection;        // Capacity at existing subcool/superheat over cap at rated conditions
   12509             :     Real64 CpSatVapCondense;          // Specific heat of vapor at cond temp J/kg-C
   12510             :     Real64 DensityRated;              // Density of inlet gas at rated superheat, m3/kg
   12511             :     Real64 DensityActual;             // Density of superheated gas at compressor inlet, m3/kg
   12512    28015557 :     Real64 HCompInRated(0.0);         // Enthalpy entering compressor at rated superheat, J/kg //Autodesk:Init
   12513    28015557 :     Real64 HCaseInRated(0.0);         // Enthalpy entering cases at rated subcooling, J/kg //Autodesk:Init
   12514             :     Real64 HSatVapCondense;           // Enthalpy of saturated vapor at T condense, J/kg
   12515             :     Real64 HsatVaporforTevapneeded;   // Enthalpy saturated vapor at temperature needed at evaporator
   12516             :     Real64 LFLastComp;                // Load factor for last compressor dispatched
   12517             :     Real64 MassCorrection;            // Mass flow at existing subcool/superheat over cap at rated conditions
   12518             :     Real64 NeededCapacity;            // Sum of case loads and mech subcooler loads on suction group
   12519             :     Real64 PSuction;                  // Suction Pressure
   12520             :     Real64 PCond;                     // Condensing pressure
   12521             :     Real64 PEvap;                     // Evaporating pressure
   12522             :     Real64 TCompOutEstimate;          // Estimated temperature out of the compressor, used to flag whether heat reclaim is reasonable, C
   12523    28015557 :     Real64 TempInRated(0.0);          // Temperature entering compressor at rated superheat, C //Autodesk:Init
   12524             :     Real64 TotalEnthalpyChangeActual; // Actual enthalpy change in cases and cold side of LSHX, J/kg
   12525             :     Real64 TsatforPsuct;              // Tsat for PSuction, C
   12526    28015557 :     Real64 TsatforPdisch(0.0);        // Tsat for Pdischarge, c
   12527             :     int NumComps;                     // Number of low-stage or high-stage compressors in system
   12528             :     Real64 HHiStageCompIn;            // Enthalpy at inlet of high-stage compressor (J/kg)
   12529    28015557 :     Real64 HCaseInRated_base(0.0), HCompInRated_base(0.0); // Autodesk:Tuned Intermediate values for performance tuning
   12530             : 
   12531    28015557 :     auto &Condenser(state.dataRefrigCase->Condenser);
   12532    28015557 :     auto &Compressor(state.dataRefrigCase->Compressor);
   12533             : 
   12534    28015557 :     Real64 LocalTimeStep = state.dataGlobal->TimeStepZone;
   12535    28015557 :     if (state.dataRefrigCase->UseSysTimeStep) LocalTimeStep = state.dataHVACGlobal->TimeStepSys;
   12536    28015557 :     Real64 const LocalTimeStepSec(LocalTimeStep * DataGlobalConstants::SecInHour);
   12537             : 
   12538    28015557 :     int CondID = this->CondenserNum(1);
   12539    28015557 :     auto const &Condenser1(Condenser(CondID));
   12540    28015557 :     Real64 const AccumLoad = max(0.0, (this->UnmetEnergy / LocalTimeStepSec)); // Load due to previously unmet compressor loads
   12541    28015557 :     Real64 const NeededCapacity_base(this->TotalSystemLoad + AccumLoad + this->PipeHeatLoad + this->LSHXTrans);
   12542             : 
   12543             :     // Before dispatching compressors, zero sum of compressor outputs and zero each compressor
   12544    28015557 :     this->TotCompCapacity = 0.0;
   12545    28015557 :     this->RefMassFlowComps = 0.0;
   12546    28015557 :     this->TotCompPower = 0.0;
   12547    28015557 :     if (this->NumStages == 2) {
   12548       14160 :         this->TotHiStageCompCapacity = 0.0;
   12549       14160 :         this->RefMassFlowHiStageComps = 0.0;
   12550       14160 :         this->TotHiStageCompPower = 0.0;
   12551             :     }
   12552             : 
   12553   239480662 :     for (int CompIndex = 1; CompIndex <= this->NumCompressors; ++CompIndex) {
   12554   211465105 :         int CompID = this->CompressorNum(CompIndex);
   12555   211465105 :         auto &Compressor_CompID(Compressor(CompID));
   12556   211465105 :         Compressor_CompID.Power = 0.0;
   12557   211465105 :         Compressor_CompID.MassFlow = 0.0;
   12558   211465105 :         Compressor_CompID.Capacity = 0.0;
   12559   211465105 :         Compressor_CompID.ElecConsumption = 0.0;
   12560   211465105 :         Compressor_CompID.CoolingEnergy = 0.0;
   12561   211465105 :         Compressor_CompID.LoadFactor = 0.0;
   12562             :     }
   12563    28015557 :     if (this->NumStages == 2) {
   12564       70800 :         for (int CompIndex = 1; CompIndex <= this->NumHiStageCompressors; ++CompIndex) {
   12565       56640 :             int CompID = this->HiStageCompressorNum(CompIndex);
   12566       56640 :             auto &Compressor_CompID(Compressor(CompID));
   12567       56640 :             Compressor_CompID.Power = 0.0;
   12568       56640 :             Compressor_CompID.MassFlow = 0.0;
   12569       56640 :             Compressor_CompID.Capacity = 0.0;
   12570       56640 :             Compressor_CompID.ElecConsumption = 0.0;
   12571       56640 :             Compressor_CompID.CoolingEnergy = 0.0;
   12572       56640 :             Compressor_CompID.LoadFactor = 0.0;
   12573             :         }
   12574             :     }
   12575             : 
   12576             :     // Determine properties at case inlet and compressor inlet
   12577    56045274 :     for (int StageIndex = 1; StageIndex <= min(2, this->NumStages); ++StageIndex) {
   12578    28029717 :         if (StageIndex == 1) {                                    // Do single-stage or low-stage calculations
   12579    28015557 :             if (this->NumStages == 1) {                           // Single-stage system
   12580    28001397 :                 NeededCapacity = NeededCapacity_base;             // because compressor capacity rated from txv to comp inlet
   12581    28001397 :                 TsatforPdisch = this->TCondense + DelTDischPipes; // need (Psat of (Tcond + delT corresponding to delP disch Pipes))
   12582    28001397 :                 TsatforPsuct = this->TEvapNeeded - DelTSuctPipes; // need (Psat of (Tevap - delT corresponding to del P suct Pipes))
   12583    28001397 :                 HsatVaporforTevapneeded =
   12584    28001397 :                     FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TEvapNeeded, 1.0, this->RefIndex, RoutineName);
   12585    28001397 :                 this->HSatLiqCond =
   12586    28001397 :                     FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TCondense, 0.0, this->RefIndex, RoutineName);
   12587    28001397 :                 this->CpSatLiqCond =
   12588    28001397 :                     FluidProperties::GetSatSpecificHeatRefrig(state, this->RefrigerantName, this->TCondense, 0.0, this->RefIndex, RoutineName);
   12589             :                 // HCaseIn is a function of the condenser rated subcooling, not the compressor rated subcooling
   12590             :                 // TCompIn needs to include case superheat as well as Temp change from lshx subcoolers
   12591             :                 // Calculate both here unless set previously by subcooler subroutine
   12592             :                 // HCaseOut corresponds to (tevapneeded + case superheat)
   12593             :                 // future - visit how parameter 'casesuperheat' applies when using walk-ins or transfer loads
   12594    28001397 :                 if (this->NumSubcoolers == 0) { // No subcooler on this system
   12595    27976509 :                     this->HCaseIn = this->HSatLiqCond - this->CpSatLiqCond * Condenser1.RatedSubcool;
   12596    27976509 :                     this->TCompIn = this->TEvapNeeded + CaseSuperheat; //+
   12597    27976509 :                     this->TLiqInActual = this->TCondense - Condenser1.RatedSubcool;
   12598    27976509 :                     this->HCompIn = this->HCaseOut;
   12599             :                 } else { // subcooler subroutine has been called to calc TCompIn and HCaseIn
   12600       24888 :                     this->HCompIn = this->HCaseOut + this->CpSatVapEvap * (this->TCompIn - (this->TEvapNeeded + CaseSuperheat));
   12601             :                 } // whether or not subcooler routine used
   12602    28001397 :                 PSuction = FluidProperties::GetSatPressureRefrig(state, this->RefrigerantName, TsatforPsuct, this->RefIndex, RoutineName);
   12603    28001397 :                 NumComps = this->NumCompressors;
   12604             :             } else { // Low-stage side of two-stage system
   12605       14160 :                 PCond = FluidProperties::GetSatPressureRefrig(state, this->RefrigerantName, this->TCondense, this->RefIndex, RoutineName);
   12606       14160 :                 PEvap = FluidProperties::GetSatPressureRefrig(state, this->RefrigerantName, this->TEvapNeeded, this->RefIndex, RoutineName);
   12607       14160 :                 this->PIntercooler = std::sqrt(PCond * PEvap);
   12608       14160 :                 this->TIntercooler =
   12609       14160 :                     FluidProperties::GetSatTemperatureRefrig(state, this->RefrigerantName, this->PIntercooler, this->RefIndex, RoutineName);
   12610       14160 :                 NeededCapacity = NeededCapacity_base;                // because compressor capacity rated from txv to comp inlet
   12611       14160 :                 TsatforPdisch = this->TIntercooler + DelTDischPipes; // need (Psat of (Tinter + delT corresponding to delP disch Pipes))
   12612       14160 :                 TsatforPsuct = this->TEvapNeeded - DelTSuctPipes;    // need (Psat of (Tevap - delT corresponding to del P suct Pipes))
   12613       14160 :                 HsatVaporforTevapneeded =
   12614       14160 :                     FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TEvapNeeded, 1.0, this->RefIndex, RoutineName);
   12615       14160 :                 this->HSatLiqCond =
   12616       14160 :                     FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TCondense, 0.0, this->RefIndex, RoutineName);
   12617       14160 :                 this->CpSatLiqCond =
   12618       14160 :                     FluidProperties::GetSatSpecificHeatRefrig(state, this->RefrigerantName, this->TCondense, 0.0, this->RefIndex, RoutineName);
   12619             :                 // HCaseIn is a function of the condenser rated subcooling, not the compressor rated subcooling
   12620             :                 // TCompIn needs to include case superheat as well as Temp change from lshx subcoolers
   12621             :                 // Calculate both here unless set previously by subcooler subroutine
   12622             :                 // HCaseOut corresponds to (tevapneeded + case superheat)
   12623       14160 :                 if (this->NumSubcoolers == 0) {       // No subcooler on this system
   12624       14160 :                     if (this->IntercoolerType == 1) { // Flash Intercooler
   12625        7080 :                         this->HCaseIn =
   12626        7080 :                             FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TIntercooler, 0.0, this->RefIndex, RoutineName);
   12627        7080 :                         this->TLiqInActual = this->TIntercooler;
   12628        7080 :                     } else if (this->IntercoolerType == 2) { // Shell-and-Coil Intercooler
   12629       14160 :                         this->TLiqInActual = this->TCondense - Condenser1.RatedSubcool -
   12630        7080 :                                              this->IntercoolerEffectiveness * (this->TCondense - Condenser1.RatedSubcool - this->TIntercooler);
   12631        7080 :                         this->HCaseIn = this->HSatLiqCond - this->CpSatLiqCond * (this->TCondense - this->TLiqInActual);
   12632             :                     }                                                  // IntercoolerType
   12633       14160 :                     this->TCompIn = this->TEvapNeeded + CaseSuperheat; //+
   12634       14160 :                     this->HCompIn = this->HCaseOut;
   12635             :                 } else { // subcooler subroutine has been called to calc TCompIn and HCaseIn
   12636           0 :                     this->HCompIn = this->HCaseOut + this->CpSatVapEvap * (this->TCompIn - (this->TEvapNeeded + CaseSuperheat));
   12637             :                 } // whether or not subcooler routine used
   12638       14160 :                 PSuction = FluidProperties::GetSatPressureRefrig(state, this->RefrigerantName, TsatforPsuct, this->RefIndex, RoutineName);
   12639       14160 :                 NumComps = this->NumCompressors;
   12640             :             }    // NumStages
   12641             :         } else { // Two-stage system, high-stage side
   12642       14160 :             NeededCapacity = NeededCapacity_base + this->TotCompPower;
   12643       14160 :             TsatforPdisch = this->TCondense + DelTDischPipes;
   12644       14160 :             TsatforPsuct = this->TIntercooler;
   12645       14160 :             HsatVaporforTevapneeded =
   12646       14160 :                 FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TIntercooler, 1.0, this->RefIndex, RoutineName);
   12647             :             //                HSatLiqCond = FluidProperties::GetSatEnthalpyRefrig(state, RefrigerantName, TCondense, 0.0, RefIndex,
   12648             :             // RoutineName
   12649             :             //);
   12650             :             ////Autodesk:Tuned These don't change for 2nd stage
   12651             :             //                CpSatLiqCond = FluidProperties::GetSatSpecificHeatRefrig(RefrigerantName, TCondense, 0.0, RefIndex,
   12652             :             // RoutineName );
   12653             :             ////Autodesk:Tuned These don't change for 2nd stage
   12654       14160 :             this->HCaseIn = this->HSatLiqCond - this->CpSatLiqCond * Condenser1.RatedSubcool;
   12655       14160 :             this->TCompIn = this->TIntercooler;
   12656             :             //      System(SysNum)%TLiqInActual = System(SysNum)%TCondense-Condenser(System(SysNum)%CondenserNum(1))%RatedSubcool
   12657       14160 :             this->HCompIn = HsatVaporforTevapneeded;
   12658       14160 :             PSuction = FluidProperties::GetSatPressureRefrig(state, this->RefrigerantName, TsatforPsuct, this->RefIndex, RoutineName);
   12659       14160 :             NumComps = this->NumHiStageCompressors;
   12660             :         } // StageIndex
   12661             : 
   12662             :         // dispatch compressors to meet load, note they were listed in compressor list in dispatch order
   12663    28029717 :         DensityActual = FluidProperties::GetSupHeatDensityRefrig(state,
   12664             :                                                                  this->RefrigerantName,
   12665             :                                                                  this->TCompIn,
   12666             :                                                                  PSuction,
   12667             :                                                                  this->RefIndex,
   12668             :                                                                  RoutineName); // Autodesk:Tuned Hoisted out of CompIndex loop
   12669    28029717 :         TotalEnthalpyChangeActual = this->HCompIn - this->HCaseIn;             // Autodesk:Tuned Hoisted out of CompIndex loop
   12670    28029717 :         if (this->NumStages == 2) {                                            // Autodesk:Tuned Hoisted out of CompIndex loop
   12671       28320 :             if (StageIndex == 1) {
   12672       14160 :                 HCaseInRated_base =
   12673       14160 :                     FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TIntercooler, 0.0, this->RefIndex, RoutineName);
   12674       14160 :             } else if (StageIndex == 2) {
   12675       14160 :                 HCompInRated_base =
   12676       14160 :                     FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TIntercooler, 1.0, this->RefIndex, RoutineName);
   12677             :             }
   12678             :         }
   12679    62163658 :         for (int CompIndex = 1; CompIndex <= NumComps; ++CompIndex) {
   12680             :             int CompID;
   12681    61617270 :             if (StageIndex == 1) {
   12682    61594626 :                 CompID = this->CompressorNum(CompIndex);
   12683             :             } else {
   12684       22644 :                 CompID = this->HiStageCompressorNum(CompIndex);
   12685             :             } // StageIndex
   12686    61617270 :             auto &Compressor_CompID(Compressor(CompID));
   12687             : 
   12688             :             // need to use indiv compressor's rated subcool and superheat to adjust capacity to actual conditions
   12689    61617270 :             switch (Compressor_CompID.SubcoolRatingType) {
   12690    54617317 :             case CompRatingType::Subcooling: {
   12691    54617317 :                 if (this->NumStages == 1) { // Single-stage system
   12692    54572370 :                     HCaseInRated = this->HSatLiqCond - this->CpSatLiqCond * Compressor_CompID.RatedSubcool;
   12693       44947 :                 } else if (this->NumStages == 2 && StageIndex == 1) { // Two-stage system, low-stage side
   12694       22303 :                     HCaseInRated = HCaseInRated_base - this->CpSatLiqCond * Compressor_CompID.RatedSubcool;
   12695       22644 :                 } else if (this->NumStages == 2 && StageIndex == 2) { // Two-stage system, high-stage side
   12696       22644 :                     HCaseInRated = this->HSatLiqCond - this->CpSatLiqCond * Compressor_CompID.RatedSubcool;
   12697             :                 } // NumStages
   12698    54617317 :             } break;
   12699     6999953 :             case CompRatingType::LiquidTemperature: { // have rated liquid temperature stored in "RatedSubcool"
   12700     6999953 :                 if (this->NumStages == 1) {           // Single-stage system
   12701     6999953 :                     HCaseInRated = this->HSatLiqCond - this->CpSatLiqCond * (this->TCondense - Compressor_CompID.RatedSubcool);
   12702           0 :                 } else if (this->NumStages == 2 && StageIndex == 1) { // Two-stage system, low-stage side
   12703           0 :                     HCaseInRated = HCaseInRated_base - this->CpSatLiqCond * (this->TIntercooler - Compressor_CompID.RatedSubcool);
   12704           0 :                 } else if (this->NumStages == 2 && StageIndex == 2) { // Two-stage system, high-stage side
   12705           0 :                     HCaseInRated = this->HSatLiqCond - this->CpSatLiqCond * (this->TCondense - Compressor_CompID.RatedSubcool);
   12706             :                 } // NumStages
   12707     6999953 :             } break;
   12708           0 :             default:
   12709           0 :                 break;
   12710             :             } // Compressor SubcoolRatingType
   12711    61617270 :             switch (Compressor_CompID.SuperheatRatingType) {
   12712    61095843 :             case CompRatingType::Superheat: {
   12713    61095843 :                 if (this->NumStages == 1) { // Single-stage system
   12714    61073540 :                     HCompInRated = HsatVaporforTevapneeded + this->CpSatVapEvap * Compressor_CompID.RatedSuperheat;
   12715    61073540 :                     TempInRated = this->TEvapNeeded + Compressor_CompID.RatedSuperheat;
   12716       22303 :                 } else if (this->NumStages == 2 && StageIndex == 1) { // Two-stage system, low-stage side
   12717       22303 :                     HCompInRated = HsatVaporforTevapneeded + this->CpSatVapEvap * Compressor_CompID.RatedSuperheat;
   12718       22303 :                     TempInRated = this->TEvapNeeded + Compressor_CompID.RatedSuperheat;
   12719           0 :                 } else if (this->NumStages == 2 && StageIndex == 2) { // Two-stage system, high-stage side
   12720           0 :                     HCompInRated = HCompInRated_base + this->CpSatVapEvap * Compressor_CompID.RatedSuperheat;
   12721           0 :                     TempInRated = this->TIntercooler + Compressor_CompID.RatedSuperheat;
   12722             :                 } // NumStages
   12723    61095843 :             } break;
   12724      521427 :             case CompRatingType::ReturnGasTemperature: { // have rated compressor inlet temperature stored in "RatedSuperheat"
   12725      521427 :                 if (this->NumStages == 1) {              // Single-stage system
   12726      498783 :                     TempInRated = Compressor_CompID.RatedSuperheat;
   12727      498783 :                     HCompInRated = HsatVaporforTevapneeded + this->CpSatVapEvap * (TempInRated - this->TEvapNeeded);
   12728       22644 :                 } else if (this->NumStages == 2 && StageIndex == 1) { // Two-stage system, low-stage side
   12729           0 :                     TempInRated = Compressor_CompID.RatedSuperheat;
   12730           0 :                     HCompInRated = HsatVaporforTevapneeded + this->CpSatVapEvap * (TempInRated - this->TEvapNeeded);
   12731       22644 :                 } else if (this->NumStages == 2 && StageIndex == 2) { // Two-stage system, high-stage side
   12732       22644 :                     TempInRated = Compressor_CompID.RatedSuperheat;
   12733       22644 :                     HCompInRated = HsatVaporforTevapneeded + this->CpSatVapEvap * (TempInRated - this->TIntercooler);
   12734             :                 } // NumStages
   12735      521427 :             } break;
   12736           0 :             default:
   12737           0 :                 break;
   12738             :             } // Compressor SuperheatRatingType
   12739             : 
   12740    61617270 :             CaseEnthalpyChangeRated = HCompInRated - HCaseInRated;
   12741    61617270 :             DensityRated = FluidProperties::GetSupHeatDensityRefrig(state, this->RefrigerantName, TempInRated, PSuction, this->RefIndex, RoutineName);
   12742             :             //  Adjust capacity and mass flow to reflect the specific volume change due to superheating and
   12743             :             //  the increase in capacity due to extra subcooling
   12744    61617270 :             MassCorrection = DensityActual / DensityRated;
   12745    61617270 :             CapacityCorrection = MassCorrection * TotalEnthalpyChangeActual / CaseEnthalpyChangeRated;
   12746    61617270 :             Compressor_CompID.Power = Curve::CurveValue(state, Compressor_CompID.ElecPowerCurvePtr, TsatforPsuct, TsatforPdisch);
   12747    61617270 :             Compressor_CompID.Capacity =
   12748   123234540 :                 CapacityCorrection * Curve::CurveValue(state, Compressor_CompID.CapacityCurvePtr, TsatforPsuct, TsatforPdisch);
   12749    61617270 :             Compressor_CompID.MassFlow = Compressor_CompID.Capacity / TotalEnthalpyChangeActual;
   12750             : 
   12751             :             // calculate load factor for last compressor addded
   12752             :             // assumes either cycling or part load eff = full load eff for last compressor
   12753    61617270 :             if (StageIndex == 1) { // Single-stage or low-stage compressors
   12754    61594626 :                 if ((this->TotCompCapacity + Compressor_CompID.Capacity) >= NeededCapacity) {
   12755    27469169 :                     LFLastComp = (NeededCapacity - this->TotCompCapacity) / Compressor_CompID.Capacity;
   12756    27469169 :                     Compressor_CompID.Power *= LFLastComp;
   12757    27469169 :                     Compressor_CompID.MassFlow *= LFLastComp;
   12758    27469169 :                     Compressor_CompID.Capacity *= LFLastComp;
   12759    27469169 :                     this->TotCompCapacity += Compressor_CompID.Capacity;
   12760    27469169 :                     this->RefMassFlowComps += Compressor_CompID.MassFlow;
   12761    27469169 :                     this->TotCompPower += Compressor_CompID.Power;
   12762    27469169 :                     Compressor_CompID.ElecConsumption = Compressor_CompID.Power * LocalTimeStepSec;
   12763    27469169 :                     Compressor_CompID.CoolingEnergy = Compressor_CompID.Capacity * LocalTimeStepSec;
   12764    27469169 :                     Compressor_CompID.LoadFactor = LFLastComp;
   12765    27469169 :                     break; // numcomps do
   12766             :                 } else {   //>= needed capacity
   12767    34125457 :                     this->TotCompCapacity += Compressor_CompID.Capacity;
   12768    34125457 :                     this->RefMassFlowComps += Compressor_CompID.MassFlow;
   12769    34125457 :                     this->TotCompPower += Compressor_CompID.Power;
   12770             :                 }    //>= needed capacity
   12771             :             } else { // high-stage compressors (for two-stage systems only)
   12772       22644 :                 if ((this->TotHiStageCompCapacity + Compressor_CompID.Capacity) >= NeededCapacity) {
   12773       14160 :                     LFLastComp = (NeededCapacity - this->TotHiStageCompCapacity) / Compressor_CompID.Capacity;
   12774       14160 :                     Compressor_CompID.Power *= LFLastComp;
   12775       14160 :                     Compressor_CompID.MassFlow *= LFLastComp;
   12776       14160 :                     Compressor_CompID.Capacity *= LFLastComp;
   12777       14160 :                     this->TotHiStageCompCapacity += Compressor_CompID.Capacity;
   12778       14160 :                     this->RefMassFlowHiStageComps += Compressor_CompID.MassFlow;
   12779       14160 :                     this->TotHiStageCompPower += Compressor_CompID.Power;
   12780       14160 :                     this->FlowRatioIntercooler = this->RefMassFlowComps / this->RefMassFlowHiStageComps;
   12781       14160 :                     Compressor_CompID.ElecConsumption = Compressor_CompID.Power * LocalTimeStepSec;
   12782       14160 :                     Compressor_CompID.CoolingEnergy = Compressor_CompID.Capacity * LocalTimeStepSec;
   12783       14160 :                     Compressor_CompID.LoadFactor = LFLastComp;
   12784       14160 :                     break; // numcomps do
   12785             :                 } else {   //>= needed capacity
   12786        8484 :                     this->TotHiStageCompCapacity += Compressor_CompID.Capacity;
   12787        8484 :                     this->RefMassFlowHiStageComps += Compressor_CompID.MassFlow;
   12788        8484 :                     this->TotHiStageCompPower += Compressor_CompID.Power;
   12789             :                 } //>= needed capacity
   12790             :             }     // StageIndex
   12791    34133941 :             Compressor_CompID.ElecConsumption = Compressor_CompID.Power * LocalTimeStepSec;
   12792    34133941 :             Compressor_CompID.CoolingEnergy = Compressor_CompID.Capacity * LocalTimeStepSec;
   12793    34133941 :             Compressor_CompID.LoadFactor = 1.0;
   12794             :         } // NumComps
   12795             :     }
   12796             : 
   12797             :     // Calculate enthalpy at compressor discharge
   12798    28015557 :     if (this->NumStages == 1) { // Single-stage or low-stage compressors
   12799    28001397 :         this->HCompOut = this->HCompIn + this->TotCompPower / this->RefMassFlowComps;
   12800             :         // error found 9/19/2011, was System(SysNum)%TotCompPower*LocalTimeStep*DataGlobals::SecInHour/System(SysNum)%RefMassFlowComps
   12801             :     } else { // High-stage compressors (only for two-stage systems)
   12802       14160 :         HHiStageCompIn = FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TIntercooler, 1.0, this->RefIndex, RoutineName);
   12803       14160 :         this->HCompOut = HHiStageCompIn + this->TotHiStageCompPower / this->RefMassFlowHiStageComps;
   12804             :     }
   12805             : 
   12806             :     // Calculate superheat energy available for desuperheaters
   12807    28015557 :     HSatVapCondense = FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TCondense, 1.0, this->RefIndex, RoutineName);
   12808    28015557 :     CpSatVapCondense = FluidProperties::GetSatSpecificHeatRefrig(state, this->RefrigerantName, this->TCondense, 1.0, this->RefIndex, RoutineName);
   12809    28015557 :     if (this->NumStages == 1) { // Single-stage systems
   12810    28001397 :         state.dataHeatBal->HeatReclaimRefrigCondenser(CondID).AvailCapacity = this->RefMassFlowComps * (this->HCompOut - HSatVapCondense);
   12811             :     } else { // Two-stage systems
   12812       14160 :         state.dataHeatBal->HeatReclaimRefrigCondenser(CondID).AvailCapacity = this->RefMassFlowHiStageComps * (this->HCompOut - HSatVapCondense);
   12813             :     } // NumStages
   12814             : 
   12815             :     // No function available to get Tout as f(Pout, Hout), so use estimate based on constant cp in superheat range...
   12816             :     //  Use average of Tcondense and Tout of condenser as check for whether heat reclaim is reasonable.
   12817    28015557 :     TCompOutEstimate = this->TCondense + (this->HCompOut - HSatVapCondense) / CpSatVapCondense;
   12818             : 
   12819    28015557 :     state.dataHeatBal->HeatReclaimRefrigCondenser(CondID).AvailTemperature = (TsatforPdisch + TCompOutEstimate) / 2.0;
   12820    28015557 :     this->AverageCompressorCOP = this->TotCompCapacity / (this->TotCompPower + this->TotHiStageCompPower);
   12821    28015557 :     this->TotCompElecConsump = this->TotCompPower * LocalTimeStepSec;
   12822    28015557 :     if (this->NumStages == 2) {
   12823       14160 :         this->TotHiStageCompElecConsump = this->TotHiStageCompPower * LocalTimeStepSec;
   12824       14160 :         this->TotCompElecConsumpTwoStage = this->TotCompElecConsump + this->TotHiStageCompElecConsump;
   12825             :     }
   12826    28015557 :     this->TotCompCoolingEnergy = this->TotCompCapacity * LocalTimeStepSec;
   12827    28015557 :     this->TotHiStageCompCoolingEnergy = this->TotHiStageCompCapacity * LocalTimeStepSec;
   12828    28015557 : }
   12829             : 
   12830       10703 : void TransRefrigSystemData::CalculateTransCompressors(EnergyPlusData &state)
   12831             : {
   12832             : 
   12833             :     // SUBROUTINE INFORMATION:
   12834             :     //       AUTHOR         Brian A. Fricke, ORNL
   12835             :     //       DATE WRITTEN   Fall 2011
   12836             :     //       RE-ENGINEERED  na
   12837             : 
   12838             :     // PURPOSE OF THIS SUBROUTINE:
   12839             :     // Find the compressor power, energy, capacity, and efficiency for a detailed transcritical CO2
   12840             :     // refrigeration system.
   12841             : 
   12842             :     // METHODOLOGY EMPLOYED:
   12843             :     // Use AHRI compressor performance curves for subcritical compressor operation, AHRI-style compressor
   12844             :     // performance curves for transcritical compressor operation, the evaporating temperature of the
   12845             :     // medium- and low-temperature loads, and the gas cooler outlet conditions (temperature, pressure
   12846             :     // and enthalpy).
   12847             : 
   12848             :     // REFERENCES:
   12849             :     // ANSI/AHRI. 2004. Standard 540, Standard for Performance Rating of Positive Displacement Refrigerant
   12850             :     //     Comprssors and Compressor Units. Arlington, VA: Air-Conditioning, Heating, and Refrigeration
   12851             :     //     Institute.
   12852             :     // Ge, Y.T., and S.A. Tassou. 2011. Performance evaluation and optimal design of supermarket refrigeration
   12853             :     //     systems with supermarket model "SuperSim", Part I: Model description and validation. International
   12854             :     //     Journal of Refrigeration 34: 527-539.
   12855             :     // Ge, Y.T., and S.A. Tassou. 2011. Performance evaluation and optimal design of supermarket refrigeration
   12856             :     //     systems with supermarket model "SuperSim", Part II: Model applications. International Journal of
   12857             :     //     Refrigeration 34: 540-549.
   12858             :     // Sawalha, S. 2008. Theoretical evaluation of trans-critical CO2 systems in supermarket refrigeration,
   12859             :     //     Part I: Modeling, simulation and optimization of two system solutions. International Journal of
   12860             :     //     Refrigeration 31: 516-524.
   12861             :     // Sawalha, S. 2008. Theoretical evaluation of trans-critical CO2 systems in supermarket refrigeration,
   12862             :     //     Part II: System modifications and comparisons of different solutions. International Journal of
   12863             :     //     Refrigeration 31: 525-534.
   12864             : 
   12865             :     // SUBROUTINE PARAMETER DEFINITIONS:
   12866             :     // Following constants approp for R22, R134a, R404a, R507, R410a, R407c.
   12867             :     // For the same pressure drop, CO2 has a corresponding temperature penalty 5 to 10 times smaller than
   12868             :     // ammonia and R-134a (ASHRAE Handbook of Refrigeration, 2010, p. 3.7).  Ignore pressure drop for CO2 calculations.
   12869             :     // NOTE, these DelT...Pipes reflect the decrease in Pressure in the pipes, NOT thermal transfer through the pipe walls.
   12870             : 
   12871       10703 :     Real64 constexpr ErrorTol(0.001); // Iterative solution tolerance
   12872             : 
   12873             :     static constexpr std::string_view RoutineName("RefrigeratedCase:CalculateTransCompressors");
   12874             :     int Iter;                           // Iteration counter
   12875             :     Real64 CapacityCorrectionMT;        // Capacity at existing subcool/superheat over cap at rated conditions for MT loads
   12876             :     Real64 CaseEnthalpyChangeRatedMT;   // Enthalpy change in medium temperature cases at compressor rated cond, J/kg
   12877             :     Real64 CaseEnthalpyChangeRatedLT;   // Enthalpy change in low temperature cases at compressor rated cond, J/kg
   12878             :     Real64 DensityActualLT;             // Density of superheated gas at LP compressor inlet, m3/kg
   12879             :     Real64 DensityActualMT;             // Density of superheated gas at HP compressor inlet, m3/kg
   12880             :     Real64 DensityRatedHP;              // Density of high pressure compressor inlet gas at rated superheat, m3/kg
   12881             :     Real64 DensityRatedLP;              // Density of low pressure compressor inlet gas at rated superheat, m3/kg
   12882             :     Real64 HCaseInRatedLT;              // Enthalpy entering low temperature cases at rated subcooling, J/kg
   12883             :     Real64 HCaseInRatedMT;              // Enthalpy entering medium temperature cases at rated subcooling, J/kg
   12884       10703 :     Real64 HCompInRatedHP(0.0);         // Enthalpy entering high pressure compressor at rated superheat, J/kg
   12885             :     Real64 HCompInRatedLP;              // Enthalpy entering low pressure compressor at rated superheat, J/kg
   12886             :     Real64 HGCOutlet;                   // Enthalpy at gas cooler outlet, J/kg
   12887             :     Real64 HIdeal;                      // Ideal enthalpy at subcooler (for 100% effectiveness)
   12888             :     Real64 HsatLiqforTevapNeededMT;     // Enthalpy of saturated liquid at MT evaporator, J/kg
   12889             :     Real64 HsatVaporforTevapneededMT;   // Enthlapy of saturated vapor at MT evaporator (transcritical cycle), J/kg
   12890             :     Real64 HsatVaporforTevapneededLT;   // Enthlapy of saturated vapor at LT evaporator (transcritical cycle), J/kg
   12891             :     Real64 LFLastComp;                  // Load factor for last compressor dispatched
   12892             :     Real64 MassCorrectionLT;            // Mass flow at existing subcool/superheat over cap at rated conditions for LT loads
   12893             :     Real64 MassCorrectionMT;            // Mass flow at existing subcool/superheat over cap at rated conditions for MT loads
   12894             :     Real64 NeededCapacityLT;            // Sum of LT case loads and mech subcooler loads (transcritical cycle), W
   12895             :     Real64 NeededCapacityMT;            // Sum of MT case loads and mech subcooler loads (transcritical cycle), W
   12896             :     Real64 PSuctionLT;                  // Suction pressure in low temperature cases, Pa
   12897             :     Real64 PSuctionMT;                  // Suction pressure in medium temperature cases, Pa
   12898             :     Real64 PGCOutlet;                   // Gas cooler outlet pressure, Pa
   12899       10703 :     Real64 QualityReceiver(0.0);        // Refrigerant quality in the receiver
   12900             :     Real64 SubcoolEffect;               // Heat exchanger effectiveness of the subcooler
   12901             :     Real64 TempInRatedHP;               // Temperature entering high pressure compressor at rated superheat, C
   12902             :     Real64 TempInRatedLP;               // Temperature entering low pressure compressor at rated superheat, C
   12903             :     Real64 TsatforPdisLT;               // Low temperature saturated discharge temperature (transcritical cycle), C
   12904             :     Real64 TsatforPdisMT;               // Medium temperature saturated discharge temperature (transcritical cycle), C
   12905             :     Real64 TsatforPsucLT;               // Low temperature saturated suction temperature (transcritical cycle), C
   12906             :     Real64 TsatforPsucMT;               // Medium temperature saturated suction temperature (transcritical cycle), C
   12907             :     Real64 TSubcoolerColdIn;            // Suction gas temperature at the inlet of the subcooler, C
   12908             :     Real64 TotalEnthalpyChangeActualLT; // Actual enthalpy change in LT cases, J/kg
   12909             :     Real64 TotalEnthalpyChangeActualMT; // Actual enthalpy change in MT cases, J/kg
   12910             :     Real64 TotalRefMassFlow;            // Total mass flow through high pressure side of system, kg/s
   12911             :     Real64 Xu;                          // Initial upper guess for iterative search
   12912             :     Real64 Xl;                          // Initial lower guess for iterative search
   12913       10703 :     Real64 Xnew(0.0);                   // New guess for iterative search
   12914             : 
   12915       10703 :     auto &Compressor(state.dataRefrigCase->Compressor);
   12916       10703 :     auto &GasCooler(state.dataRefrigCase->GasCooler);
   12917             : 
   12918       10703 :     Real64 LocalTimeStep = state.dataGlobal->TimeStepZone;
   12919       10703 :     if (state.dataRefrigCase->UseSysTimeStep) LocalTimeStep = state.dataHVACGlobal->TimeStepSys;
   12920             : 
   12921             :     // Determine refrigerating capacity needed
   12922             :     // Load due to previously unmet low temperature compressor loads (transcritical system)
   12923             :     Real64 AccumLoadLT;
   12924       10703 :     NeededCapacityLT = 0.0;
   12925       10703 :     if (this->TransSysType == 2) {
   12926       10703 :         AccumLoadLT = max(0.0, (this->UnmetEnergyLT / LocalTimeStep / DataGlobalConstants::SecInHour));
   12927       10703 :         NeededCapacityLT = this->TotalSystemLoadLT + AccumLoadLT + this->PipeHeatLoadLT;
   12928             :     } // (TransSystem(SysNum)%TransSysType == 2)
   12929             : 
   12930             :     // Load due to previously unmet medium temperature compressor loads (transcritical system)
   12931       10703 :     Real64 AccumLoadMT = max(0.0, (this->UnmetEnergyMT / LocalTimeStep / DataGlobalConstants::SecInHour));
   12932       10703 :     NeededCapacityMT = this->TotalSystemLoadMT + AccumLoadMT + this->PipeHeatLoadMT;
   12933             : 
   12934             :     // Determine refrigerant properties at receiver
   12935       10703 :     this->CpSatLiqReceiver =
   12936       10703 :         FluidProperties::GetSatSpecificHeatRefrig(state, this->RefrigerantName, this->TReceiver, 0.0, this->RefIndex, RoutineName);
   12937             : 
   12938             :     // Enthalpy at the receiver bypass, J/kg
   12939       10703 :     Real64 HReceiverBypass = FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TReceiver, 1.0, this->RefIndex, RoutineName);
   12940             : 
   12941             :     // Determine refrigerant properties at low temperature (LT) loads (if present)
   12942             :     // Dispatch low pressure (LP) compressors as necessary
   12943       10703 :     if (this->TransSysType == 2) { // LT side of TwoStage transcritical system
   12944       10703 :         this->HCaseInLT = this->HSatLiqReceiver;
   12945             :         // TCompInLP and HCompInLP include case superheat plus effect of suction line heat gain
   12946       10703 :         this->TCompInLP = this->TEvapNeededLT + TransCaseSuperheat + this->PipeHeatLoadLT / (this->CpSatVapEvapLT * this->RefMassFlowtoLTLoads);
   12947       10703 :         this->HCompInLP = this->HCaseOutLT + this->PipeHeatLoadLT / this->RefMassFlowtoLTLoads;
   12948       10703 :         TsatforPsucLT = this->TEvapNeededLT;
   12949       10703 :         TsatforPdisLT = this->TEvapNeededMT;
   12950       10703 :         HsatVaporforTevapneededLT =
   12951       10703 :             FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TEvapNeededLT, 1.0, this->RefIndex, RoutineName);
   12952       10703 :         HsatLiqforTevapNeededMT =
   12953       10703 :             FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TEvapNeededMT, 0.0, this->RefIndex, RoutineName);
   12954       10703 :         PSuctionLT = FluidProperties::GetSatPressureRefrig(state, this->RefrigerantName, TsatforPsucLT, this->RefIndex, RoutineName);
   12955       10703 :         DensityActualLT =
   12956       10703 :             FluidProperties::GetSupHeatDensityRefrig(state, this->RefrigerantName, this->TCompInLP, PSuctionLT, this->RefIndex, RoutineName);
   12957       10703 :         TotalEnthalpyChangeActualLT = this->HCompInLP - this->HCaseInLT;
   12958             : 
   12959             :         // Dispatch low pressure (LP) compressors
   12960             :         // Before dispatching LP compressors, zero sum of compressor outputs and zero each compressor
   12961       10703 :         this->TotCompCapacityLP = 0.0;
   12962       10703 :         this->RefMassFlowCompsLP = 0.0;
   12963       10703 :         this->TotCompPowerLP = 0.0;
   12964             : 
   12965       42812 :         for (int CompIndex = 1; CompIndex <= this->NumCompressorsLP; ++CompIndex) {
   12966       32109 :             int CompID = this->CompressorNumLP(CompIndex);
   12967       32109 :             Compressor(CompID).Power = 0.0;
   12968       32109 :             Compressor(CompID).MassFlow = 0.0;
   12969       32109 :             Compressor(CompID).Capacity = 0.0;
   12970       32109 :             Compressor(CompID).ElecConsumption = 0.0;
   12971       32109 :             Compressor(CompID).CoolingEnergy = 0.0;
   12972       32109 :             Compressor(CompID).LoadFactor = 0.0;
   12973             :         }
   12974             : 
   12975       16142 :         for (int CompIndex = 1; CompIndex <= this->NumCompressorsLP; ++CompIndex) {
   12976       16142 :             int CompID = this->CompressorNumLP(CompIndex);
   12977             :             // need to use indiv compressor's rated subcool and superheat to adjust capacity to actual conditions
   12978       16142 :             switch (Compressor(CompID).SubcoolRatingType) {
   12979       16142 :             case CompRatingType::Subcooling: {
   12980       16142 :                 HCaseInRatedLT = HsatLiqforTevapNeededMT - this->CpSatLiqReceiver * Compressor(CompID).RatedSubcool;
   12981       16142 :             } break;
   12982           0 :             case CompRatingType::LiquidTemperature: { // have rated liquid temperature stored in "RatedSubcool"
   12983           0 :                 HCaseInRatedLT = FluidProperties::GetSatEnthalpyRefrig(
   12984           0 :                     state, this->RefrigerantName, Compressor(CompID).RatedSubcool, 0.0, this->RefIndex, RoutineName);
   12985           0 :             } break;
   12986           0 :             default:
   12987           0 :                 break;
   12988             :             }
   12989       16142 :             switch (Compressor(CompID).SuperheatRatingType) {
   12990       16142 :             case CompRatingType::Superheat: {
   12991       16142 :                 HCompInRatedLP = HsatVaporforTevapneededLT + this->CpSatVapEvapLT * Compressor(CompID).RatedSuperheat;
   12992       16142 :                 TempInRatedLP = this->TEvapNeededLT + Compressor(CompID).RatedSuperheat;
   12993       16142 :             } break;
   12994           0 :             case CompRatingType::ReturnGasTemperature: { // have rated compressor inlet temperature stored in
   12995             :                                                          // "CompRatingType::Superheat"
   12996           0 :                 TempInRatedLP = Compressor(CompID).RatedSuperheat;
   12997           0 :                 HCompInRatedLP = FluidProperties::GetSupHeatEnthalpyRefrig(
   12998           0 :                     state, this->RefrigerantName, Compressor(CompID).RatedSuperheat, PSuctionLT, this->RefIndex, RoutineName);
   12999           0 :             } break;
   13000           0 :             default:
   13001           0 :                 break;
   13002             :             }
   13003             : 
   13004       16142 :             CaseEnthalpyChangeRatedLT = HCompInRatedLP - HCaseInRatedLT;
   13005       16142 :             DensityRatedLP =
   13006       16142 :                 FluidProperties::GetSupHeatDensityRefrig(state, this->RefrigerantName, TempInRatedLP, PSuctionLT, this->RefIndex, RoutineName);
   13007             : 
   13008             :             //  Adjust capacity and mass flow to reflect the specific volume change due to superheating and
   13009             :             //  the increase in capacity due to extra subcooling
   13010       16142 :             MassCorrectionLT = DensityActualLT / DensityRatedLP;
   13011             :             // Capacity at existing subcool/superheat over cap at rated conditions for LT loads
   13012       16142 :             Real64 CapacityCorrectionLT = MassCorrectionLT * TotalEnthalpyChangeActualLT / CaseEnthalpyChangeRatedLT;
   13013       16142 :             Compressor(CompID).Power = Curve::CurveValue(state, Compressor(CompID).ElecPowerCurvePtr, TsatforPsucLT, TsatforPdisLT);
   13014       16142 :             Compressor(CompID).Capacity =
   13015       32284 :                 CapacityCorrectionLT * Curve::CurveValue(state, Compressor(CompID).CapacityCurvePtr, TsatforPsucLT, TsatforPdisLT);
   13016       16142 :             Compressor(CompID).MassFlow = Compressor(CompID).Capacity / TotalEnthalpyChangeActualLT;
   13017       16142 :             Compressor(CompID).ElecConsumption = Compressor(CompID).Power * LocalTimeStep * DataGlobalConstants::SecInHour;
   13018       16142 :             Compressor(CompID).CoolingEnergy = Compressor(CompID).Capacity * LocalTimeStep * DataGlobalConstants::SecInHour;
   13019       16142 :             Compressor(CompID).LoadFactor = 1.0;
   13020       16142 :             if ((this->TotCompCapacityLP + Compressor(CompID).Capacity) >= NeededCapacityLT) {
   13021       10703 :                 LFLastComp = (NeededCapacityLT - this->TotCompCapacityLP) / Compressor(CompID).Capacity;
   13022       10703 :                 Compressor(CompID).Power *= LFLastComp;
   13023       10703 :                 Compressor(CompID).MassFlow *= LFLastComp;
   13024       10703 :                 Compressor(CompID).Capacity *= LFLastComp;
   13025       10703 :                 this->TotCompCapacityLP += Compressor(CompID).Capacity;
   13026       10703 :                 this->RefMassFlowCompsLP += Compressor(CompID).MassFlow;
   13027       10703 :                 this->TotCompPowerLP += Compressor(CompID).Power;
   13028       10703 :                 Compressor(CompID).ElecConsumption = Compressor(CompID).Power * LocalTimeStep * DataGlobalConstants::SecInHour;
   13029       10703 :                 Compressor(CompID).CoolingEnergy = Compressor(CompID).Capacity * LocalTimeStep * DataGlobalConstants::SecInHour;
   13030       10703 :                 Compressor(CompID).LoadFactor = LFLastComp;
   13031       10703 :                 break;
   13032             :             } else {
   13033        5439 :                 this->TotCompCapacityLP += Compressor(CompID).Capacity;
   13034        5439 :                 this->RefMassFlowCompsLP += Compressor(CompID).MassFlow;
   13035        5439 :                 this->TotCompPowerLP += Compressor(CompID).Power;
   13036             :             }
   13037             :         } // NumCompressorsLP
   13038       10703 :         this->HCompOutLP = this->HCompInLP + this->TotCompPowerLP / this->RefMassFlowCompsLP;
   13039             :     } // (TransSystem(SysNum)%TransSysType == 2)
   13040             : 
   13041             :     // Determine refrigerant properties at medium temperature (MT) loads
   13042             :     // Dispatch high pressure (HP) compressors as necessary
   13043       10703 :     TsatforPsucMT = this->TEvapNeededMT;
   13044       10703 :     if (GasCooler(this->GasCoolerNum(1)).TransOpFlag) { // Transcritical system is operating in transcritical region
   13045        4377 :         HGCOutlet = GasCooler(this->GasCoolerNum(1)).HGasCoolerOut;
   13046             :     } else { // Transcritical system is operating in subcritical region
   13047        6326 :         TsatforPdisMT = GasCooler(this->GasCoolerNum(1)).TGasCoolerOut;
   13048             :     }
   13049       10703 :     PSuctionMT = FluidProperties::GetSatPressureRefrig(state, this->RefrigerantName, TsatforPsucMT, this->RefIndex, RoutineName);
   13050       10703 :     PGCOutlet = GasCooler(this->GasCoolerNum(1)).PGasCoolerOut;
   13051       10703 :     HsatVaporforTevapneededMT =
   13052       10703 :         FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TEvapNeededMT, 1.0, this->RefIndex, RoutineName);
   13053       10703 :     this->HCaseInMT = this->HSatLiqReceiver;
   13054             :     // Enthalpy of refrigerant after leaving medium temperature loads and low pressure compressors
   13055             : 
   13056             :     // Combined enthalpy from the outlets of the LP compressor and MT loads, J/kg
   13057       21406 :     Real64 HCaseOutLTMT = (this->RefMassFlowtoLTLoads * this->HCompOutLP + this->RefMassFlowtoMTLoads * this->HCaseOutMT + this->PipeHeatLoadMT) /
   13058       10703 :                           (this->RefMassFlowtoLTLoads + this->RefMassFlowtoMTLoads);
   13059             : 
   13060             :     // Total refrigerant flow rate is total flow from LT and MT loads divided by (1-x) where x is the quality of the
   13061             :     // refrigerant entering the receiver.  The receiver bypass flow rate is (x)*(Total Flow).
   13062             :     // Iterate to find the quality of the refrigerant entering the receiver.
   13063       10703 :     Xu = 1.0; // upper bound on quality
   13064       10703 :     Xl = 0.0; // lower bound on quality
   13065       10703 :     if ((GasCooler(this->GasCoolerNum(1)).HGasCoolerOut + this->DelHSubcoolerDis) > this->HSatLiqReceiver) {
   13066       80811 :         for (Iter = 1; Iter <= 15; ++Iter) { // Maximum of 15 iterations to find receiver quality
   13067       80811 :             QualityReceiver = (Xu + Xl) / 2.0;
   13068             :             Real64 Hnew =
   13069       80811 :                 FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TReceiver, QualityReceiver, this->RefIndex, RoutineName);
   13070             : 
   13071             :             // estimated QualityReceiver is too high
   13072       80811 :             if (Hnew > (GasCooler(this->GasCoolerNum(1)).HGasCoolerOut + this->DelHSubcoolerDis)) {
   13073       44590 :                 Xu = QualityReceiver;
   13074             :             } else { // estimated QualityReceiver is too low
   13075       36221 :                 Xl = QualityReceiver;
   13076             :             }
   13077       80811 :             if (std::abs((Hnew - (GasCooler(this->GasCoolerNum(1)).HGasCoolerOut + this->DelHSubcoolerDis)) / Hnew) < ErrorTol) break;
   13078             :         }
   13079       10703 :         TotalRefMassFlow = (this->RefMassFlowtoLTLoads + this->RefMassFlowtoMTLoads) / (1.0 - QualityReceiver);
   13080       10703 :         this->RefMassFlowReceiverBypass = QualityReceiver * TotalRefMassFlow;
   13081             :     } else {
   13082           0 :         this->RefMassFlowReceiverBypass = 0.0;
   13083           0 :         TotalRefMassFlow = (this->RefMassFlowtoLTLoads + this->RefMassFlowtoMTLoads);
   13084             :     } // %HGasCoolerOut > TransSystem(SysNum)%HSatLiqReceiver)
   13085             : 
   13086       21406 :     this->HCompInHP = (HCaseOutLTMT * (this->RefMassFlowtoLTLoads + this->RefMassFlowtoMTLoads) + HReceiverBypass * this->RefMassFlowReceiverBypass) /
   13087       10703 :                       (this->RefMassFlowtoLTLoads + this->RefMassFlowtoMTLoads + this->RefMassFlowReceiverBypass);
   13088             : 
   13089             :     // Iterate to find the suction temperature entering subcooler
   13090       10703 :     Xl = FluidProperties::GetSatTemperatureRefrig(state, this->RefrigerantName, PSuctionMT, this->RefIndex, RoutineName);
   13091       10703 :     Xu = Xl + 50.0;
   13092       55909 :     for (Iter = 1; Iter <= 15; ++Iter) { // Maximum of 15 iterations
   13093       55909 :         Xnew = (Xu + Xl) / 2.0;
   13094       55909 :         Real64 Hnew = FluidProperties::GetSupHeatEnthalpyRefrig(state, this->RefrigerantName, Xnew, PSuctionMT, this->RefIndex, RoutineName);
   13095       55909 :         if (Hnew > this->HCompInHP) { // xnew is too high
   13096       30571 :             Xu = Xnew;
   13097             :         } else { // xnew is too low
   13098       25338 :             Xl = Xnew;
   13099             :         }
   13100       55909 :         if (std::abs((Hnew - this->HCompInHP) / Hnew) < ErrorTol) break;
   13101             :     }
   13102       10703 :     TSubcoolerColdIn = Xnew;
   13103             : 
   13104             :     // Modify receiver inlet enthalpy and HP compressor inlet enthalpy to account for subcooler
   13105       21406 :     HIdeal = FluidProperties::GetSupHeatEnthalpyRefrig(
   13106       10703 :         state, this->RefrigerantName, GasCooler(this->GasCoolerNum(1)).TGasCoolerOut, PSuctionMT, this->RefIndex, RoutineName);
   13107             :     // Only use subcooler if suction gas inlet temperature less than gas cooler outlet temperature
   13108       10703 :     if (TSubcoolerColdIn < GasCooler(this->GasCoolerNum(1)).TGasCoolerOut) {
   13109       10703 :         SubcoolEffect = this->SCEffectiveness;
   13110             :     } else {
   13111           0 :         SubcoolEffect = 0.0;
   13112             :     } // (TSubcoolerColdIn < GasCooler(SysNum)%TGasCoolerOut)
   13113       10703 :     this->DelHSubcoolerSuc = SubcoolEffect * (HIdeal - this->HCompInHP);
   13114       10703 :     this->HCompInHP += this->DelHSubcoolerSuc;
   13115       10703 :     this->DelHSubcoolerDis = -this->DelHSubcoolerSuc;
   13116             : 
   13117             :     // Iterate to find the temperature at the inlet of the high pressure (HP) compressors
   13118       10703 :     Xl = FluidProperties::GetSatTemperatureRefrig(state, this->RefrigerantName, PSuctionMT, this->RefIndex, RoutineName);
   13119       10703 :     Xu = Xl + 50.0;
   13120       53159 :     for (Iter = 1; Iter <= 15; ++Iter) { // Maximum of 15 iterations
   13121       53159 :         Xnew = (Xu + Xl) / 2.0;
   13122       53159 :         Real64 Hnew = FluidProperties::GetSupHeatEnthalpyRefrig(state, this->RefrigerantName, Xnew, PSuctionMT, this->RefIndex, RoutineName);
   13123       53159 :         if (Hnew > this->HCompInHP) { // xnew is too high
   13124       22854 :             Xu = Xnew;
   13125             :         } else { // xnew is too low
   13126       30305 :             Xl = Xnew;
   13127             :         }
   13128       53159 :         if (std::abs((Hnew - this->HCompInHP) / Hnew) < ErrorTol) break;
   13129             :     }
   13130       10703 :     this->TCompInHP = Xnew;
   13131             : 
   13132             :     //  For capacity correction of HP compressors, consider subcooler, receiver, MT loads, LT loads and LP compressors
   13133             :     //  to constitute the "load".  The actual and rated conditions at the exit of the gas cooler and the inlet of the
   13134             :     //  HP compressors are used for capacity correction calculations.
   13135       10703 :     DensityActualMT =
   13136       10703 :         FluidProperties::GetSupHeatDensityRefrig(state, this->RefrigerantName, this->TCompInHP, PSuctionMT, this->RefIndex, RoutineName);
   13137       10703 :     TotalEnthalpyChangeActualMT = this->HCompInHP - GasCooler(this->GasCoolerNum(1)).HGasCoolerOut;
   13138             : 
   13139             :     // Dispatch HP compressors
   13140             :     // Before dispatching HP compressors, zero sum of compressor outputs and zero each compressor
   13141       10703 :     this->TotCompCapacityHP = 0.0;
   13142       10703 :     this->RefMassFlowCompsHP = 0.0;
   13143       10703 :     this->TotCompPowerHP = 0.0;
   13144             : 
   13145       42812 :     for (int CompIndex = 1; CompIndex <= this->NumCompressorsHP; ++CompIndex) {
   13146       32109 :         int CompID = this->CompressorNumHP(CompIndex);
   13147       32109 :         Compressor(CompID).Power = 0.0;
   13148       32109 :         Compressor(CompID).MassFlow = 0.0;
   13149       32109 :         Compressor(CompID).Capacity = 0.0;
   13150       32109 :         Compressor(CompID).ElecConsumption = 0.0;
   13151       32109 :         Compressor(CompID).CoolingEnergy = 0.0;
   13152       32109 :         Compressor(CompID).LoadFactor = 0.0;
   13153             :     }
   13154             : 
   13155             :     // Dispatch High Pressure compressors to meet load, note they were listed in compressor list in dispatch order
   13156       12527 :     for (int CompIndex = 1; CompIndex <= this->NumCompressorsHP; ++CompIndex) {
   13157       12527 :         int CompID = this->CompressorNumHP(CompIndex);
   13158             : 
   13159             :         // Need to use indiv compressor's rated subcool and superheat to adjust capacity to actual conditions
   13160             :         // Transcritical operation requires rated superheat
   13161             :         // Subcritical operation requires rated subcool and rated superheat
   13162       12527 :         switch (Compressor(CompID).SubcoolRatingType) {
   13163       12527 :         case CompRatingType::Subcooling: {
   13164       12527 :             if (!GasCooler(this->GasCoolerNum(1)).TransOpFlag) { // Subcritical operation
   13165       12652 :                 HCaseInRatedMT = GasCooler(this->GasCoolerNum(1)).HGasCoolerOut -
   13166        6326 :                                  GasCooler(this->GasCoolerNum(1)).CpGasCoolerOut * Compressor(CompID).RatedSubcool;
   13167             :             } else { // Transcritical operation
   13168        6201 :                 HCaseInRatedMT = GasCooler(this->GasCoolerNum(1)).HGasCoolerOut;
   13169             :             } // (.NOT.GasCooler(SysNum)%TransOpFlag)
   13170       12527 :         } break;
   13171           0 :         case CompRatingType::LiquidTemperature: {                // have rated liquid temperature stored in "RatedSubcool"
   13172           0 :             if (!GasCooler(this->GasCoolerNum(1)).TransOpFlag) { // Subcritical operation
   13173           0 :                 HCaseInRatedMT = FluidProperties::GetSatEnthalpyRefrig(
   13174           0 :                     state, this->RefrigerantName, Compressor(CompID).RatedSubcool, 0.0, this->RefIndex, RoutineName);
   13175             :             } else { // Transcritical operation
   13176           0 :                 HCaseInRatedMT = GasCooler(this->GasCoolerNum(1)).HGasCoolerOut;
   13177             :             } // (.NOT.GasCooler(SysNum)%TransOpFlag)
   13178           0 :         } break;
   13179           0 :         default:
   13180           0 :             break;
   13181             :         }
   13182       12527 :         switch (Compressor(CompID).SuperheatRatingType) {
   13183       12527 :         case CompRatingType::Superheat: {
   13184       12527 :             HCompInRatedHP = HsatVaporforTevapneededMT + this->CpSatVapEvapMT * Compressor(CompID).RatedSuperheat;
   13185       12527 :             TempInRatedHP = this->TEvapNeededMT + Compressor(CompID).RatedSuperheat;
   13186       12527 :         } break;
   13187           0 :         case CompRatingType::ReturnGasTemperature: { // have rated compressor inlet temperature stored in "RatedSuperheat"
   13188           0 :             TempInRatedHP = Compressor(CompID).RatedSuperheat;
   13189           0 :             HCompInRatedHP = FluidProperties::GetSupHeatEnthalpyRefrig(
   13190           0 :                 state, this->RefrigerantName, Compressor(CompID).RatedSuperheat, PSuctionMT, this->RefIndex, RoutineName);
   13191           0 :         } break;
   13192           0 :         default:
   13193           0 :             break;
   13194             :         }
   13195             : 
   13196       12527 :         CaseEnthalpyChangeRatedMT = HCompInRatedHP - HCaseInRatedMT;
   13197       12527 :         DensityRatedHP =
   13198       12527 :             FluidProperties::GetSupHeatDensityRefrig(state, this->RefrigerantName, TempInRatedHP, PSuctionMT, this->RefIndex, RoutineName);
   13199             :         //  Adjust capacity and mass flow to reflect the specific volume change due to superheating and
   13200             :         //  the increase in capacity due to extra subcooling
   13201       12527 :         MassCorrectionMT = DensityActualMT / DensityRatedHP;
   13202       12527 :         CapacityCorrectionMT = MassCorrectionMT * TotalEnthalpyChangeActualMT / CaseEnthalpyChangeRatedMT;
   13203             : 
   13204       12527 :         if (GasCooler(this->GasCoolerNum(1)).TransOpFlag) { // System is operating in transcritical region
   13205        6201 :             Compressor(CompID).Power = Curve::CurveValue(state, Compressor(CompID).TransElecPowerCurvePtr, TsatforPsucMT, PGCOutlet);
   13206        6201 :             Compressor(CompID).Capacity =
   13207       12402 :                 CapacityCorrectionMT * Curve::CurveValue(state, Compressor(CompID).TransCapacityCurvePtr, TsatforPsucMT, HGCOutlet);
   13208             :         } else { // System is operating in subcritical region
   13209        6326 :             Compressor(CompID).Power = Curve::CurveValue(state, Compressor(CompID).ElecPowerCurvePtr, TsatforPsucMT, TsatforPdisMT);
   13210        6326 :             Compressor(CompID).Capacity =
   13211       12652 :                 CapacityCorrectionMT * Curve::CurveValue(state, Compressor(CompID).CapacityCurvePtr, TsatforPsucMT, TsatforPdisMT);
   13212             :         } // (GasCooler(SysNum)%TransOpFlag)
   13213             :         //  Mass flow through HP compressors is HP compressor refrigerating capacity divided by MT load, LT load and LP compressor power
   13214       12527 :         Compressor(CompID).MassFlow = TotalRefMassFlow * Compressor(CompID).Capacity / (NeededCapacityMT + NeededCapacityLT + this->TotCompPowerLP);
   13215       12527 :         Compressor(CompID).ElecConsumption = Compressor(CompID).Power * LocalTimeStep * DataGlobalConstants::SecInHour;
   13216       12527 :         Compressor(CompID).CoolingEnergy = Compressor(CompID).Capacity * LocalTimeStep * DataGlobalConstants::SecInHour;
   13217       12527 :         Compressor(CompID).LoadFactor = 1.0;
   13218             :         // calculate load factor for last compressor added
   13219             :         // assumes either cycling or part load eff = full load eff for last compressor
   13220       12527 :         if ((this->TotCompCapacityHP + Compressor(CompID).Capacity) >= (NeededCapacityMT + NeededCapacityLT + this->TotCompPowerLP)) {
   13221       10703 :             LFLastComp = ((NeededCapacityMT + NeededCapacityLT + this->TotCompPowerLP) - this->TotCompCapacityHP) / Compressor(CompID).Capacity;
   13222       10703 :             Compressor(CompID).Power *= LFLastComp;
   13223       10703 :             Compressor(CompID).MassFlow *= LFLastComp;
   13224       10703 :             Compressor(CompID).Capacity *= LFLastComp;
   13225       10703 :             this->TotCompCapacityHP += Compressor(CompID).Capacity;
   13226       10703 :             this->RefMassFlowCompsHP += Compressor(CompID).MassFlow;
   13227       10703 :             this->TotCompPowerHP += Compressor(CompID).Power;
   13228       10703 :             Compressor(CompID).ElecConsumption = Compressor(CompID).Power * LocalTimeStep * DataGlobalConstants::SecInHour;
   13229       10703 :             Compressor(CompID).CoolingEnergy = Compressor(CompID).Capacity * LocalTimeStep * DataGlobalConstants::SecInHour;
   13230       10703 :             Compressor(CompID).LoadFactor = LFLastComp;
   13231       10703 :             break;
   13232             :         } else {
   13233        1824 :             this->TotCompCapacityHP += Compressor(CompID).Capacity;
   13234        1824 :             this->RefMassFlowCompsHP += Compressor(CompID).MassFlow;
   13235        1824 :             this->TotCompPowerHP += Compressor(CompID).Power;
   13236             :         }
   13237             : 
   13238             :     } // NumCompressorsHP
   13239             : 
   13240       10703 :     this->HCompOutHP = this->HCompInHP + this->TotCompPowerHP / this->RefMassFlowCompsHP;
   13241       10703 :     this->RefMassFlowComps = this->RefMassFlowCompsLP + this->RefMassFlowCompsHP;
   13242       10703 :     this->TotCompCapacity = this->TotCompCapacityHP + this->TotCompCapacityLP;
   13243       10703 :     this->AverageCompressorCOP = (this->TotCompCapacityHP - this->TotCompPowerLP) / (this->TotCompPowerLP + this->TotCompPowerHP);
   13244       10703 :     this->TotCompElecConsump = (this->TotCompPowerLP + this->TotCompPowerHP) * LocalTimeStep * DataGlobalConstants::SecInHour;
   13245       10703 :     this->TotCompCoolingEnergy = (this->TotCompCapacityLP + this->TotCompCapacityHP) * LocalTimeStep * DataGlobalConstants::SecInHour;
   13246       10703 : }
   13247             : 
   13248       24888 : void RefrigSystemData::CalculateSubcoolers(EnergyPlusData &state)
   13249             : {
   13250             : 
   13251             :     // SUBROUTINE INFORMATION:
   13252             :     //       AUTHOR         Therese Stovall, ORNL, Assisted by Hugh Henderson
   13253             :     //       DATE WRITTEN   Spring 2008
   13254             :     //       MODIFIED       Brian Fricke, ORNL, March 2012, added two-stage compression
   13255             :     //       RE-ENGINEERED  na
   13256             : 
   13257             :     // PURPOSE OF THIS SUBROUTINE:
   13258             :     // Find the subcooler energy exchange and refrigerant states for a particular detailed
   13259             :     // refrigeration system. Use the refrigerant property subroutines in FluidProperties.cc
   13260             : 
   13261             :     // METHODOLOGY EMPLOYED:
   13262             :     // Use refrigerant properties and heat exchanger correlations.  NOTE:  Assumes any Mech subcooler
   13263             :     // immediately follows condenser outlet (after pipe loss) and comes before any LSHX
   13264             : 
   13265             :     // REFERENCES:
   13266             :     // ASHRAE 1006 Section 2: Refrigeration Accessories
   13267             : 
   13268             :     static constexpr std::string_view RoutineName("CalculateSubcoolers");
   13269       24888 :     Real64 TLiqInActualLocal(0.0); // Liquid T in, after condenser, before any mechanical subcooler
   13270             : 
   13271       24888 :     auto &System(state.dataRefrigCase->System);
   13272       24888 :     auto &Condenser(state.dataRefrigCase->Condenser);
   13273       24888 :     auto &Subcooler(state.dataRefrigCase->Subcooler);
   13274             : 
   13275       24888 :     Real64 LocalTimeStep = state.dataGlobal->TimeStepZone;
   13276       24888 :     if (state.dataRefrigCase->UseSysTimeStep) LocalTimeStep = state.dataHVACGlobal->TimeStepSys;
   13277             : 
   13278             :     // HCaseIn has to be recalculated as the starting point for the subcoolers here because
   13279             :     //  of the multiple number of iterations through this subroutine and because Tcondense is evolving.
   13280       24888 :     if (this->NumStages == 1) { // Single-stage compression system
   13281       24888 :         this->HSatLiqCond = FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TCondense, 0.0, this->RefIndex, RoutineName);
   13282       24888 :         this->CpSatLiqCond =
   13283       24888 :             FluidProperties::GetSatSpecificHeatRefrig(state, this->RefrigerantName, this->TCondense, 0.0, this->RefIndex, RoutineName);
   13284       24888 :         this->HCaseIn = this->HSatLiqCond - this->CpSatLiqCond * Condenser(this->CondenserNum(1)).RatedSubcool;
   13285             : 
   13286             :         // Two-stage compression with flash intercooler
   13287           0 :     } else if (this->NumStages == 2 && this->IntercoolerType == 1) {
   13288           0 :         this->HSatLiqCond = FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TCondense, 0.0, this->RefIndex, RoutineName);
   13289           0 :         this->CpSatLiqCond =
   13290           0 :             FluidProperties::GetSatSpecificHeatRefrig(state, this->RefrigerantName, this->TCondense, 0.0, this->RefIndex, RoutineName);
   13291           0 :         this->HCaseIn = FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TIntercooler, 0.0, this->RefIndex, RoutineName);
   13292             : 
   13293             :         // Two-stage compression with shell-and-coil intercooler
   13294           0 :     } else if (this->NumStages == 2 && this->IntercoolerType == 2) {
   13295           0 :         TLiqInActualLocal = this->TCondense - Condenser(this->CondenserNum(1)).RatedSubcool -
   13296           0 :                             this->IntercoolerEffectiveness * (this->TCondense - Condenser(this->CondenserNum(1)).RatedSubcool - this->TIntercooler);
   13297           0 :         this->HSatLiqCond = FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TCondense, 0.0, this->RefIndex, RoutineName);
   13298           0 :         this->CpSatLiqCond =
   13299           0 :             FluidProperties::GetSatSpecificHeatRefrig(state, this->RefrigerantName, this->TCondense, 0.0, this->RefIndex, RoutineName);
   13300           0 :         this->HCaseIn = this->HSatLiqCond - this->CpSatLiqCond * (this->TCondense - TLiqInActualLocal);
   13301             :     } // NumStages and IntercoolerType
   13302             : 
   13303       74664 :     for (int SubcoolerIndex = 1; SubcoolerIndex <= this->NumSubcoolers; ++SubcoolerIndex) {
   13304       49776 :         int SubcoolerID = this->SubcoolerNum(SubcoolerIndex);
   13305             :         // set up local variables for convenience
   13306       49776 :         Real64 DelTLiqDes = Subcooler(SubcoolerID).LiqSuctDesignDelT;
   13307       49776 :         Real64 TVapInDes = Subcooler(SubcoolerID).LiqSuctDesignTvapIn;
   13308       49776 :         Real64 TLiqInDes = Subcooler(SubcoolerID).LiqSuctDesignTliqIn;
   13309       49776 :         Real64 ControlTLiqOut = Subcooler(SubcoolerID).MechControlTliqOut;
   13310       49776 :         Real64 CpLiquid = this->CpSatLiqCond;
   13311       49776 :         Real64 CpVapor = this->CpSatVapEvap;
   13312       49776 :         if (this->NumStages == 1) { // Single-stage compression system
   13313       49776 :             TLiqInActualLocal = this->TCondense - Condenser(this->CondenserNum(1)).RatedSubcool;
   13314             : 
   13315             :             // Two-stage compression with flash intercooler
   13316           0 :         } else if (this->NumStages == 2 && this->IntercoolerType == 1) {
   13317           0 :             TLiqInActualLocal = this->TIntercooler;
   13318             : 
   13319             :             // Two-stage compression with shell-and-coil intercooler
   13320           0 :         } else if (this->NumStages == 2 && this->IntercoolerType == 2) {
   13321           0 :             TLiqInActualLocal =
   13322           0 :                 this->TCondense - Condenser(this->CondenserNum(1)).RatedSubcool -
   13323           0 :                 this->IntercoolerEffectiveness * (this->TCondense - Condenser(this->CondenserNum(1)).RatedSubcool - this->TIntercooler);
   13324             :         } // NumStages and IntercoolerType
   13325             : 
   13326       49776 :         switch (Subcooler(SubcoolerID).subcoolerType) {
   13327             :             // Mechanical subcoolers required to come first in order to take advantage of delT
   13328             :             //  from lshx. taken care of because subcooler ID assigned in that order in input.
   13329       24888 :         case SubcoolerType::Mechanical: {
   13330       24888 :             Real64 mechSCLoad = this->RefMassFlowtoLoads * CpLiquid * (TLiqInActualLocal - ControlTLiqOut);
   13331       24888 :             this->HCaseIn -= CpLiquid * (TLiqInActualLocal - ControlTLiqOut);
   13332             :             // refrigeration benefit to System(sysnum)
   13333             :             // refrigeration load must be assigned properly according to input
   13334       24888 :             int SysProvideID = Subcooler(SubcoolerID).MechSourceSysID;
   13335       24888 :             System(SysProvideID).MechSCLoad(SubcoolerID) = mechSCLoad;
   13336       24888 :             Subcooler(SubcoolerID).MechSCTransLoad = mechSCLoad;
   13337       24888 :             Subcooler(SubcoolerID).MechSCTransEnergy = mechSCLoad * LocalTimeStep * DataGlobalConstants::SecInHour;
   13338             :             // Reset inlet temperature for any LSHX that follows this mech subcooler
   13339       24888 :             TLiqInActualLocal = ControlTLiqOut;
   13340       24888 :             this->TCompIn = this->TEvapNeeded + CaseSuperheat;
   13341       24888 :         } break;
   13342       24888 :         case SubcoolerType::LiquidSuction: {
   13343       24888 :             Real64 LSHXeffectiveness = DelTLiqDes / (TLiqInDes - TVapInDes);
   13344       24888 :             Real64 TVapInActual = this->TEvapNeeded + CaseSuperheat;
   13345       24888 :             Real64 DelTempActual = LSHXeffectiveness * (TLiqInActualLocal - TVapInActual);
   13346       24888 :             TLiqInActualLocal -= DelTempActual;
   13347       24888 :             Real64 SubcoolLoad = this->RefMassFlowtoLoads * CpLiquid * DelTempActual;
   13348       24888 :             Real64 SubcoolerSupHeat = SubcoolLoad / CpVapor / this->RefMassFlowComps;
   13349       24888 :             this->TCompIn = TVapInActual + SubcoolerSupHeat;
   13350       24888 :             this->HCaseIn -= SubcoolLoad / this->RefMassFlowtoLoads;
   13351       24888 :             this->LSHXTrans = SubcoolLoad;
   13352       24888 :             this->LSHXTransEnergy = SubcoolLoad * LocalTimeStep * DataGlobalConstants::SecInHour;
   13353       24888 :         } break;
   13354           0 :         default:
   13355           0 :             break;
   13356             :         }
   13357             : 
   13358       49776 :         this->TLiqInActual = TLiqInActualLocal;
   13359             :     }
   13360       24888 : }
   13361             : 
   13362           2 : void GetRefrigeratedRackIndex(EnergyPlusData &state,
   13363             :                               std::string const &Name,
   13364             :                               int &IndexPtr,
   13365             :                               DataHeatBalance::RefrigSystemType const SysType,
   13366             :                               bool &ErrorsFound,
   13367             :                               std::string_view const ThisObjectType,
   13368             :                               bool const SuppressWarning)
   13369             : {
   13370             : 
   13371             :     // SUBROUTINE INFORMATION:
   13372             :     //       AUTHOR         Richard Raustad
   13373             :     //       DATE WRITTEN   June 2007
   13374             :     //       MODIFIED       Therese Stovall May 2008
   13375             :     //       RE-ENGINEERED  na
   13376             :     // PURPOSE OF THIS SUBROUTINE:
   13377             :     // This subroutine sets an index for a given refrigerated rack or refrigeration condenser
   13378             :     //  -- issues error message if the rack or condenser is not found.
   13379             : 
   13380           2 :     auto &RefrigRack(state.dataRefrigCase->RefrigRack);
   13381           2 :     auto &Condenser(state.dataRefrigCase->Condenser);
   13382             : 
   13383           2 :     CheckRefrigerationInput(state);
   13384             : 
   13385           2 :     switch (SysType) {
   13386           1 :     case DataHeatBalance::RefrigSystemType::Rack: {
   13387           1 :         IndexPtr = UtilityRoutines::FindItemInList(Name, RefrigRack);
   13388           1 :         if (IndexPtr == 0) {
   13389           0 :             if (SuppressWarning) {
   13390             :                 //     No warning printed if only searching for the existence of a refrigerated rack
   13391             :             } else {
   13392           0 :                 if (!ThisObjectType.empty()) {
   13393           0 :                     ShowSevereError(state, fmt::format("{}, GetRefrigeratedRackIndex: Rack not found={}", ThisObjectType, Name));
   13394             :                 } else {
   13395           0 :                     if (!ThisObjectType.empty()) {
   13396           0 :                         ShowSevereError(state, fmt::format("{}, GetRefrigeratedRackIndex: Rack not found={}", ThisObjectType, Name));
   13397             :                     } else {
   13398           0 :                         ShowSevereError(state, "GetRefrigeratedRackIndex: Rack not found=" + Name);
   13399             :                     }
   13400             :                 }
   13401             :             }
   13402           0 :             ErrorsFound = true;
   13403             :         }
   13404           1 :     } break;
   13405           1 :     case DataHeatBalance::RefrigSystemType::Detailed: {
   13406           1 :         IndexPtr = UtilityRoutines::FindItemInList(Name, Condenser);
   13407           1 :         if (IndexPtr == 0) {
   13408           0 :             if (SuppressWarning) {
   13409             :                 //     No warning printed if only searching for the existence of a refrigeration Condenser
   13410             :             } else {
   13411           0 :                 if (!ThisObjectType.empty()) {
   13412           0 :                     ShowSevereError(state, fmt::format("{}, GetRefrigeratedRackIndex: Condenser not found={}", ThisObjectType, Name));
   13413             :                 } else {
   13414           0 :                     ShowSevereError(state, "GetRefrigeratedRackIndex: Condenser not found=" + Name);
   13415             :                 }
   13416             :             }
   13417             :         }
   13418           1 :         ErrorsFound = true;
   13419           1 :     } break;
   13420           0 :     default:
   13421           0 :         break;
   13422             :     }
   13423           2 : }
   13424             : 
   13425         771 : void ReportRefrigerationComponents(EnergyPlusData &state)
   13426             : {
   13427             : 
   13428             :     // SUBROUTINE INFORMATION:
   13429             :     //       AUTHOR         Richard Raustad, FSEC
   13430             :     //       DATE WRITTEN   October 2004
   13431             :     //       MODIFIED       Shirey, FSEC Dec 2004; Lawrie, Mar 2008 - Node names, not numbers.
   13432             :     //       MODIFIED       Stovall - 2008 to 2010, new refrig variables and move orphan reporting to input.
   13433             :     //       MODIFIED       Fricke, ORNL, Fall 2011, added transcritical CO2 refrigeration system variables
   13434             :     //       RE-ENGINEERED  na
   13435             : 
   13436             :     // PURPOSE OF THIS SUBROUTINE:
   13437             :     // To report information from the input deck for refrigerated cases and racks to the eio and err file.
   13438             : 
   13439        1542 :     std::string ChrOut;
   13440        1542 :     std::string ChrOut2;
   13441             : 
   13442         771 :     auto &RefrigCase(state.dataRefrigCase->RefrigCase);
   13443         771 :     auto &RefrigRack(state.dataRefrigCase->RefrigRack);
   13444         771 :     auto &System(state.dataRefrigCase->System);
   13445         771 :     auto &TransSystem(state.dataRefrigCase->TransSystem);
   13446         771 :     auto &Condenser(state.dataRefrigCase->Condenser);
   13447         771 :     auto &Compressor(state.dataRefrigCase->Compressor);
   13448         771 :     auto &GasCooler(state.dataRefrigCase->GasCooler);
   13449         771 :     auto &Subcooler(state.dataRefrigCase->Subcooler);
   13450         771 :     auto &Secondary(state.dataRefrigCase->Secondary);
   13451         771 :     auto &WalkIn(state.dataRefrigCase->WalkIn);
   13452         771 :     auto &WarehouseCoil(state.dataRefrigCase->WarehouseCoil);
   13453         771 :     auto &AirChillerSet(state.dataRefrigCase->AirChillerSet);
   13454             : 
   13455             :     static constexpr std::string_view Format_104(
   13456             :         "! <Refrigeration Compressor Rack>,Compressor Rack Name, # Refrigerated Cases Connected,# WalkIn Coolers "
   13457             :         "Connected, Heat Rejection Location, Condenser Type, COP");
   13458             :     static constexpr std::string_view Format_105(
   13459             :         "!  <Refrigeration Case>,Refrigeration Case Number, Refrigeration Case Name,Zone Name,Zone Node #,Zone "
   13460             :         "Node Name,Capacity (W/m),LHR,Temperature (C),Length (m),Fan (W/m),Installed Lighting (W/m),Anti-Sweat "
   13461             :         "(W/m),Defrost (W/m)");
   13462             :     static constexpr std::string_view Format_108("!  <Refrigeration Compressor>,Compressor Number,Compressor Name,Nominal Capacity (W)");
   13463             :     static constexpr std::string_view Format_109("! <#Refrigeration Compressor Racks>,Number of Refrigeration Compressor Racks");
   13464             :     static constexpr std::string_view Format_117("! <#Detailed Refrigeration Systems>,Number of Detailed Refrigeration Systems");
   13465             :     static constexpr std::string_view Format_118(
   13466             :         "! <Detailed Refrigeration System>,Refrigeration System Name,Refrigerant Used, # Refrigerated Cases "
   13467             :         "Connected, # WalkInCoolers Connected, #Air Chillers Connected, # Secondary Loops Served, # Cascade Condensers "
   13468             :         "Served, # Mechanical Subcoolers Served, # Compressors Connected, # Compression Stages, Intercooler Type, "
   13469             :         "Intercooler Effectiveness, # Subcoolers Connected, Minimum Condensing Temperature (C)");
   13470             :     static constexpr std::string_view Format_119(
   13471             :         "!  <Refrigeration Walk In Cooler>, Walk In Number, Walk In Name,Capacity (W),Temperature (C),Coil Fan "
   13472             :         "(W), Circulating Fan (W), Lighting (W),Heaters (W),Defrost (W), # Zones");
   13473             :     static constexpr std::string_view Format_120(
   13474             :         "! <#Detailed Transcritical Refrigeration Systems>,Number of Detailed Transcritical Refrigeration Systems");
   13475             :     static constexpr std::string_view Format_121(
   13476             :         "! <Detailed Transcritical Refrigeration System>,Transcritical Refrigeration System Name,Refrigerant Used, # "
   13477             :         "Medium Temperature Refrigerated Cases Connected, # Low Temperature Refrigerated Cases Connected, # Medium "
   13478             :         "Temperature WalkInCoolers Connected, # Low Temperature WalkInCoolers Connected, # High Pressure Compressors "
   13479             :         "Connected, # Low Pressure Compressors Connected, Minimum Condensing Temperature (C)");
   13480             :     static constexpr std::string_view Format_123("!  <Secondary Load>, Secondary System Served Name, Secondary Number");
   13481             :     static constexpr std::string_view Format_126(
   13482             :         "!  <Refrigeration Mechanical Subcooler>, Subcooler Number, Subcooler Name, Name of System Providing "
   13483             :         "Cooling, Design Outlet Temperature (C)");
   13484             :     static constexpr std::string_view Format_127("!  <Refrigeration Liquid Suction Subcooler>, Subcooler Number, Subcooler Name, Design Subcooling "
   13485             :                                                  "(DeltaC),Design liquid inlet temperature (C), Design vapor inlet temperature (C)");
   13486             :     static constexpr std::string_view Format_128("!  <Cascade Load>, System Name Connected, Condenser Number, Condenser Name");
   13487             :     static constexpr std::string_view Format_129(
   13488             :         "!  <Refrigeration Condenser:Air-Cooled>,Condenser Number,Condenser Name,Rated Condensing Temperature "
   13489             :         "(C),Rated Capacity (W), Rated Fan Power (W)");
   13490             :     static constexpr std::string_view Format_130(
   13491             :         "!  <Refrigeration Condenser:Water-Cooled>,Condenser Number,Condenser Name,Rated Condensing Temperature "
   13492             :         "(C),Rated Capacity (W), Rated Water Inlet Temperature (C), Rated Water Flow Rate (m3/s)");
   13493             :     static constexpr std::string_view Format_131(
   13494             :         "!  <Refrigeration Condenser:Evaporative-Cooled>,Condenser Number,Condenser Name,Rated Capacity (W), Rated Fan Power (W)");
   13495             :     static constexpr std::string_view Format_132(
   13496             :         "!  <Refrigeration Condenser:Cascade>, Condenser Number, Condenser Name, Condensing Temperature Control "
   13497             :         "Type, Rated Condensing Temperature (C), Capacity (W), Approach Temperature Difference (DeltaC)");
   13498             :     static constexpr std::string_view Format_133(
   13499             :         "! <Secondary Refrigeration System: Fluid Always Liquid>, Secondary Number, Secondary Name, # Refrigerated "
   13500             :         "Cases Connected, # WalkIn Coolers Connected, Fluid Name, Capacity (W),Evap Temperature in Secondary "
   13501             :         "Evaporator (C), Approach Temperature Difference (DeltaC), Temperature Range (DeltaC), TotalPumpPower (W)");
   13502             :     static constexpr std::string_view Format_134(
   13503             :         "!      <Walk-In Surfaces Facing Zone>, ZoneName, Wall/Ceiling Area (m2), UValue (W/m2-C), AreaStockDoors "
   13504             :         "(m2), HeightStockDoors, UValueStockDoors (W/m2-C), AreaGlassDoors (m2), HeightGlassDoors (m),  "
   13505             :         "UValueGlassDoors (W/m2-C)");
   13506             :     static constexpr std::string_view Format_141("!  <Mechanical Subcooler Load>, Subcooler Number, Subcooler Name");
   13507             :     static constexpr std::string_view Format_142("! <#Secondary Refrigeration Systems>,Number of Secondary Refrigeration Systems");
   13508             :     static constexpr std::string_view Format_146(
   13509             :         "! <Secondary Refrigeration System: Liquid Overfeed>, Secondary Number, Secondary Name, # Refrigerated Cases "
   13510             :         "Connected, # WalkIn Coolers Connected, #Air Coils Connected Fluid Name, Capacity (W),Evap Temperature in "
   13511             :         "Secondary Evaporator (C), Approach Temperature Difference (DeltaC), Circulating Rate, TotalPumpPower (W)");
   13512             :     static constexpr std::string_view Format_148("! <#ZoneHVAC/Refrigeration Air Chiller Sets>,Number of ZoneHVAC/Refrigeration Air Chiller Sets");
   13513             :     static constexpr std::string_view Format_149(
   13514             :         "! <ZoneHVAC/Refrigeration Air Chiller Set>,Chiller Set Name, # Air Chillers Connected, Zone Location");
   13515             :     static constexpr std::string_view Format_151(
   13516             :         "!  <Refrigeration Air Chiller>,Refrigeration Chiller Number, Refrigeration Chiller Name,Zone Name,Zone "
   13517             :         "Node #,Zone Node Name,Sensible Capacity (W/C),Sensible Capacity (W),Evaporating Temperature (C),DT1 (C),Fan "
   13518             :         "Power (W),Heater (W),Defrost (W), Air Flow Rate (m3/s)");
   13519             :     static constexpr std::string_view Format_152("!  <Air Chiller Load>, Air Chiller Name, Air Chiller Number, Zone Name,");
   13520             :     static constexpr std::string_view Format_160(
   13521             :         "!  <Refrigeration GasCooler:Air-Cooled>,Gas Cooler Number, Gas Cooler Name, Rated Outlet Pressure "
   13522             :         "(Pa),Rated Outlet Temperature (C), Rated Approach Temperature (C), Rated Capacity (W), Rated Fan Power (W)");
   13523             : 
   13524             :     // write all headers applicable to this simulation
   13525         771 :     if (state.dataRefrigCase->NumRefrigeratedRacks > 0) {
   13526          30 :         print(state.files.eio, "{}\n", Format_109); // Intro to refrigeration case racks
   13527          30 :         print(state.files.eio, "{}\n", Format_104); // Refrigeration Rack header
   13528             :     }                                               //(NumRefrigeratedRacks > 0)
   13529         771 :     if (state.dataRefrigCase->NumRefrigSystems > 0) {
   13530          14 :         print(state.files.eio, "{}\n", Format_117); // Intro to detailed systems
   13531          14 :         print(state.files.eio, "{}\n", Format_118); // Detailed system header
   13532          14 :         print(state.files.eio, "{}\n", Format_108); // Compressor header (Always have compressor if have detailed system)
   13533             :     }                                               //(NumRefrigSystems > 0)
   13534         771 :     if (state.dataRefrigCase->NumSimulationSecondarySystems > 0) {
   13535           1 :         print(state.files.eio, "{}\n", Format_142); // Intro to Secondary systems
   13536           1 :         int CountSecPhase = 0;
   13537           1 :         int CountSecBrine = 0;
   13538           3 :         for (int SecondaryID = 1; SecondaryID <= state.dataRefrigCase->NumSimulationSecondarySystems; ++SecondaryID) {
   13539           2 :             if ((Secondary(SecondaryID).FluidType == SecFluidType::AlwaysLiquid) && (CountSecBrine == 0)) {
   13540           1 :                 print(state.files.eio, "{}\n", Format_133); // Secondary system header for brine type systems
   13541           1 :                 ++CountSecBrine;
   13542             :             }
   13543           2 :             if ((Secondary(SecondaryID).FluidType == SecFluidType::PhaseChange) && (CountSecPhase == 0)) {
   13544           1 :                 print(state.files.eio, "{}\n", Format_146); // Secondary system header for liquid overfeed/phase change systems
   13545           1 :                 ++CountSecPhase;
   13546             :             }
   13547             :         }
   13548           1 :         print(state.files.eio, "{}\n", Format_123); //  Secondary system load header
   13549             :     }                                               //(NumSimulationSecondarySystems > 0)
   13550         771 :     if (state.dataRefrigCase->NumRefrigChillerSets > 0) {
   13551           1 :         print(state.files.eio, "{}\n", Format_148); // Intro to Chiller set
   13552           1 :         print(state.files.eio, "{}\n", Format_149); // Chiller set header
   13553           1 :         print(state.files.eio, "{}\n", Format_151); // Intro to Air Chiller
   13554           1 :         print(state.files.eio, "{}\n", Format_152); // Air chiller header
   13555             :     }                                               //(NumRefrigSystems > 0)
   13556         771 :     if (state.dataRefrigCase->NumSimulationCases > 0) {
   13557          35 :         print(state.files.eio, "{}\n", Format_105); //  Case header
   13558             :     }                                               //(NumSimulationCases > 0)
   13559         771 :     if (state.dataRefrigCase->NumSimulationWalkIns > 0) {
   13560          13 :         print(state.files.eio, "{}\n", Format_119); //  Walk-in header
   13561          13 :         print(state.files.eio, "{}\n", Format_134); //  Walk-in zone-specific header
   13562             :     }                                               //(NumSimulationWalkIns > 0)
   13563         771 :     if (state.dataRefrigCase->NumSimulationCondAir > 0) {
   13564          12 :         print(state.files.eio, "{}\n", Format_129); //  Condenser, Air-Cooled header
   13565             :     }                                               //(NumSimulationCondAir > 0)
   13566         771 :     if (state.dataRefrigCase->NumSimulationCondEvap > 0) {
   13567           2 :         print(state.files.eio, "{}\n", Format_131); //  Condenser, Evaporative-Cooled header
   13568             :     }                                               //(NumSimulationCondEvap > 0)
   13569         771 :     if (state.dataRefrigCase->NumSimulationCondWater > 0) {
   13570           1 :         print(state.files.eio, "{}\n", Format_130); //  Condenser, Water-Cooled header
   13571             :     }                                               //(NumSimulationCondWater > 0)
   13572         771 :     if (state.dataRefrigCase->NumSimulationCascadeCondensers > 0) {
   13573           1 :         print(state.files.eio, "{}\n", Format_132); //  Condenser, Cascade header
   13574           1 :         print(state.files.eio, "{}\n", Format_128); //  Cascade Load header
   13575             :     }                                               //(NumSimulationCascadeCondensers > 0)
   13576         771 :     if (state.dataRefrigCase->NumSimulationMechSubcoolers > 0) {
   13577           1 :         print(state.files.eio, "{}\n", Format_141); //  Mech subcooler loads served header
   13578           1 :         print(state.files.eio, "{}\n", Format_126); //  Mechanical Subcooler header
   13579             :     }                                               //(NumSimulationMechSubcoolers > 0)
   13580         771 :     if ((state.dataRefrigCase->NumSimulationSubcoolers - state.dataRefrigCase->NumSimulationMechSubcoolers) > 0) {
   13581           1 :         print(state.files.eio, "{}\n", Format_127); //  LSHX Subcooler header
   13582             :     }                                               //((NumSimulationSubcoolers - NumSimulationMechSubcoolers) > 0)
   13583             : 
   13584         771 :     if (state.dataRefrigCase->NumTransRefrigSystems > 0) {
   13585           1 :         print(state.files.eio, "{}\n", Format_120); // Intro to detailed transcriticial refrigeration system
   13586           1 :         print(state.files.eio, "{}\n", Format_121); // Detailed system header
   13587           1 :         if (state.dataRefrigCase->NumSimulationCases > 0) {
   13588           1 :             print(state.files.eio, "{}\n", Format_105); //  Case header
   13589             :         }                                               //(NumSimulationCases > 0)
   13590           1 :         if (state.dataRefrigCase->NumSimulationWalkIns > 0) {
   13591           1 :             print(state.files.eio, "{}\n", Format_119); //  Walk-in header
   13592           1 :             print(state.files.eio, "{}\n", Format_134); //  Walk-in zone-specific header
   13593             :         }                                               //(NumSimulationWalkIns > 0)
   13594           1 :         print(state.files.eio, "{}\n", Format_108);     // Compressor header (Always have compressor if have detailed system)
   13595           1 :         if (state.dataRefrigCase->NumSimulationGasCooler > 0) {
   13596           1 :             print(state.files.eio, "{}\n", Format_160); //  Gas Cooler, Air-Cooled header
   13597             :         }                                               //(NumSimulationGasCooler > 0)
   13598             :     }                                                   //(NumTransRefrigSystems > 0)
   13599             : 
   13600         771 :     if (state.dataRefrigCase->NumRefrigeratedRacks > 0) {
   13601          30 :         print(state.files.eio, "#Refrigeration Compressor Racks, {}\n", state.dataRefrigCase->NumRefrigeratedRacks);
   13602          89 :         for (int RackNum = 1; RackNum <= state.dataRefrigCase->NumRefrigeratedRacks; ++RackNum) {
   13603          59 :             if (RefrigRack(RackNum).HeatRejectionLocation == HeatRejLocation::Outdoors) {
   13604          32 :                 ChrOut = "Outdoors";
   13605             :             } else {
   13606          27 :                 ChrOut = "Zone";
   13607             :             }
   13608          59 :             switch (RefrigRack(RackNum).CondenserType) {
   13609          56 :             case DataHeatBalance::RefrigCondenserType::Air: {
   13610          56 :                 ChrOut2 = "Air-Cooled";
   13611          56 :             } break;
   13612           2 :             case DataHeatBalance::RefrigCondenserType::Evap: {
   13613           2 :                 ChrOut2 = "Evap-Cooled";
   13614           2 :             } break;
   13615           1 :             case DataHeatBalance::RefrigCondenserType::Water: {
   13616           1 :                 ChrOut2 = "Water-Cooled";
   13617           1 :             } break;
   13618           0 :             default:
   13619           0 :                 break;
   13620             :             }
   13621         295 :             print(state.files.eio,
   13622             :                   " Refrigeration Compressor Rack,{},{},{},{},{},{:.3R}\n",
   13623          59 :                   RefrigRack(RackNum).Name,
   13624          59 :                   RefrigRack(RackNum).NumCases,
   13625          59 :                   RefrigRack(RackNum).NumWalkIns,
   13626             :                   ChrOut,
   13627             :                   ChrOut2,
   13628         118 :                   RefrigRack(RackNum).RatedCOP);
   13629         149 :             for (int CaseNum = 1; CaseNum <= RefrigRack(RackNum).NumCases; ++CaseNum) {
   13630          90 :                 int CaseID = RefrigRack(RackNum).CaseNum(CaseNum);
   13631          90 :                 if (RefrigCase(CaseID).ZoneNodeNum > 0) {
   13632        1260 :                     print(state.files.eio,
   13633             :                           "   Refrigeration Case,{},{},{},{},{},{:.1R},{:.2R},{:.1R},{:.1R},{:.1R},{:.1R},{:.1R},{:.1R}\n",
   13634             :                           CaseID,
   13635          90 :                           RefrigCase(CaseID).Name,
   13636          90 :                           RefrigCase(CaseID).ZoneName,
   13637          90 :                           RefrigCase(CaseID).ZoneNodeNum,
   13638         180 :                           state.dataLoopNodes->NodeID(RefrigCase(CaseID).ZoneNodeNum),
   13639          90 :                           RefrigCase(CaseID).RateTotCapPerLength,
   13640          90 :                           RefrigCase(CaseID).RatedLHR,
   13641          90 :                           RefrigCase(CaseID).Temperature,
   13642          90 :                           RefrigCase(CaseID).Length,
   13643          90 :                           RefrigCase(CaseID).OperatingFanPower,
   13644          90 :                           RefrigCase(CaseID).LightingPower,
   13645          90 :                           RefrigCase(CaseID).AntiSweatPower,
   13646         180 :                           RefrigCase(CaseID).DefrostPower); // Installed lighting power, may not be rated power
   13647             :                 }
   13648             :             } // numcases
   13649             : 
   13650          59 :             for (int WalkInNum = 1; WalkInNum <= RefrigRack(RackNum).NumWalkIns; ++WalkInNum) {
   13651           0 :                 int WalkInID = RefrigRack(RackNum).WalkInNum(WalkInNum);
   13652           0 :                 print(state.files.eio,
   13653             :                       "   Refrigeration Walk In Cooler,  {},{},{:.1R},{:.1R},{:.1R},{:.1R},{:.1R},{:.1R},{:.1R},{:.1R},{}\n",
   13654             :                       WalkInID,
   13655           0 :                       WalkIn(WalkInID).Name,
   13656           0 :                       WalkIn(WalkInID).DesignRatedCap,
   13657           0 :                       WalkIn(WalkInID).Temperature,
   13658           0 :                       WalkIn(WalkInID).CoilFanPower,
   13659           0 :                       WalkIn(WalkInID).CircFanPower,
   13660           0 :                       WalkIn(WalkInID).ElecFanPower,
   13661           0 :                       WalkIn(WalkInID).DesignLighting,
   13662           0 :                       WalkIn(WalkInID).HeaterPower,
   13663           0 :                       WalkIn(WalkInID).DefrostCapacity,
   13664           0 :                       WalkIn(WalkInID).NumZones);
   13665           0 :                 for (int ZoneID = 1; ZoneID <= WalkIn(WalkInID).NumZones; ++ZoneID) {
   13666           0 :                     print(state.files.eio,
   13667             :                           "      Walk-In Surfaces Facing Zone, {},{:.1R},{:.4R},{:.2R},{:.2R},{:.4R},{:.2R},{:.2R},{:.4R}\n",
   13668           0 :                           WalkIn(WalkInID).ZoneName(ZoneID),
   13669           0 :                           WalkIn(WalkInID).SurfaceArea(ZoneID),
   13670           0 :                           WalkIn(WalkInID).UValue(ZoneID),
   13671           0 :                           WalkIn(WalkInID).AreaStockDr(ZoneID),
   13672           0 :                           WalkIn(WalkInID).HeightStockDr(ZoneID),
   13673           0 :                           WalkIn(WalkInID).UValueStockDr(ZoneID),
   13674           0 :                           WalkIn(WalkInID).AreaGlassDr(ZoneID),
   13675           0 :                           WalkIn(WalkInID).HeightGlassDr(ZoneID),
   13676           0 :                           WalkIn(WalkInID).UValueGlassDr(ZoneID));
   13677             :                 } // zones for walk ins on rack
   13678             :             }     // walk ins on rack
   13679             : 
   13680          59 :             for (int CoilNum = 1; CoilNum <= RefrigRack(RackNum).NumCoils; ++CoilNum) {
   13681           0 :                 int CoilID = RefrigRack(RackNum).CoilNum(CoilNum);
   13682           0 :                 print(state.files.eio, "   Air Chiller Load,{},{},{}\n", WarehouseCoil(CoilID).Name, CoilID, WarehouseCoil(CoilID).ZoneName);
   13683             :             } // numairchillers
   13684             :         }     // numracks
   13685             :     }         //(NumRefrigeratedRacks > 0)
   13686             : 
   13687         771 :     if (state.dataRefrigCase->NumRefrigSystems > 0) {
   13688          14 :         print(state.files.eio, "#Detailed Refrigeration Systems,{}\n", state.dataRefrigCase->NumRefrigSystems);
   13689          53 :         for (int SystemNum = 1; SystemNum <= state.dataRefrigCase->NumRefrigSystems; ++SystemNum) {
   13690         546 :             print(state.files.eio,
   13691             :                   " Detailed Refrigeration System,{},{},{},{},{},{},{},{},{},{},{},{:.2R},{},{:.1R}\n",
   13692          39 :                   System(SystemNum).Name,
   13693          39 :                   System(SystemNum).RefrigerantName,
   13694          39 :                   System(SystemNum).NumCases,
   13695          39 :                   System(SystemNum).NumWalkIns,
   13696          39 :                   System(SystemNum).NumCoils,
   13697          39 :                   System(SystemNum).NumSecondarys,
   13698          39 :                   System(SystemNum).NumCascadeLoads,
   13699          39 :                   System(SystemNum).NumMechSCServed,
   13700          78 :                   System(SystemNum).NumCompressors + System(SystemNum).NumHiStageCompressors,
   13701          39 :                   System(SystemNum).NumStages,
   13702          39 :                   System(SystemNum).IntercoolerType,
   13703          39 :                   System(SystemNum).IntercoolerEffectiveness,
   13704          39 :                   System(SystemNum).NumSubcoolers,
   13705          78 :                   System(SystemNum).TCondenseMin);
   13706             : 
   13707         119 :             for (int CaseNum = 1; CaseNum <= System(SystemNum).NumCases; ++CaseNum) {
   13708          80 :                 int CaseID = System(SystemNum).CaseNum(CaseNum);
   13709          80 :                 if (RefrigCase(CaseID).ZoneNodeNum > 0) {
   13710        1120 :                     print(state.files.eio,
   13711             :                           "   Refrigeration Case,{},{},{},{},{},{:.1R},{:.2R},{:.1R},{:.1R},{:.1R},{:.1R},{:.1R},{:.1R}\n",
   13712             :                           CaseID,
   13713          80 :                           RefrigCase(CaseID).Name,
   13714          80 :                           RefrigCase(CaseID).ZoneName,
   13715          80 :                           RefrigCase(CaseID).ZoneNodeNum,
   13716         160 :                           state.dataLoopNodes->NodeID(RefrigCase(CaseID).ZoneNodeNum),
   13717          80 :                           RefrigCase(CaseID).RateTotCapPerLength,
   13718          80 :                           RefrigCase(CaseID).RatedLHR,
   13719          80 :                           RefrigCase(CaseID).Temperature,
   13720          80 :                           RefrigCase(CaseID).Length,
   13721          80 :                           RefrigCase(CaseID).OperatingFanPower,
   13722          80 :                           RefrigCase(CaseID).LightingPower,
   13723          80 :                           RefrigCase(CaseID).AntiSweatPower,
   13724         160 :                           RefrigCase(CaseID).DefrostPower);
   13725             :                 }
   13726             :             } // NumCases on system
   13727          52 :             for (int WalkInNum = 1; WalkInNum <= System(SystemNum).NumWalkIns; ++WalkInNum) {
   13728          13 :                 int WalkInID = System(SystemNum).WalkInNum(WalkInNum);
   13729         130 :                 print(state.files.eio,
   13730             :                       "   Refrigeration Walk In Cooler,{},{},{:.1R},{:.1R},{:.1R},{:.1R},{:.1R},{:.1R},{:.1R},{}\n",
   13731             :                       WalkInID,
   13732          13 :                       WalkIn(WalkInID).Name,
   13733          13 :                       WalkIn(WalkInID).DesignRatedCap,
   13734          13 :                       WalkIn(WalkInID).Temperature,
   13735          13 :                       WalkIn(WalkInID).CoilFanPower,
   13736          13 :                       WalkIn(WalkInID).CircFanPower,
   13737          13 :                       WalkIn(WalkInID).DesignLighting,
   13738          13 :                       WalkIn(WalkInID).HeaterPower,
   13739          13 :                       WalkIn(WalkInID).DefrostCapacity,
   13740          26 :                       WalkIn(WalkInID).NumZones);
   13741          26 :                 for (int ZoneID = 1; ZoneID <= WalkIn(WalkInID).NumZones; ++ZoneID) {
   13742         130 :                     print(state.files.eio,
   13743             :                           "      Walk-In Surfaces Facing Zone, {},{:.1R},{:.4R},{:.2R},{:.2R},{:.4R},{:.2R},{:.2R},{:.4R}\n",
   13744          13 :                           WalkIn(WalkInID).ZoneName(ZoneID),
   13745          13 :                           WalkIn(WalkInID).SurfaceArea(ZoneID),
   13746          13 :                           WalkIn(WalkInID).UValue(ZoneID),
   13747          13 :                           WalkIn(WalkInID).AreaStockDr(ZoneID),
   13748          13 :                           WalkIn(WalkInID).HeightStockDr(ZoneID),
   13749          13 :                           WalkIn(WalkInID).UValueStockDr(ZoneID),
   13750          13 :                           WalkIn(WalkInID).AreaGlassDr(ZoneID),
   13751          13 :                           WalkIn(WalkInID).HeightGlassDr(ZoneID),
   13752          26 :                           WalkIn(WalkInID).UValueGlassDr(ZoneID));
   13753             :                 } // Num zones for each walk in on system
   13754             :             }     // NumWalkIns on system
   13755             : 
   13756         122 :             for (int CoilNum = 1; CoilNum <= System(SystemNum).NumCoils; ++CoilNum) {
   13757          83 :                 int CoilID = System(SystemNum).CoilNum(CoilNum);
   13758          83 :                 print(state.files.eio, "   Air Chiller Load,{},{},{}\n", WarehouseCoil(CoilID).Name, CoilID, WarehouseCoil(CoilID).ZoneName);
   13759             :             } // numairchillers
   13760             : 
   13761          40 :             for (int CascadeLoadNum = 1; CascadeLoadNum <= System(SystemNum).NumCascadeLoads; ++CascadeLoadNum) {
   13762           1 :                 int CascadeLoadID = System(SystemNum).CascadeLoadNum(CascadeLoadNum);
   13763           3 :                 print(state.files.eio,
   13764             :                       "   Cascade Load,{},{},{}\n",
   13765           1 :                       System(Condenser(CascadeLoadID).CascadeSysID).Name,
   13766             :                       CascadeLoadID,
   13767           2 :                       Condenser(CascadeLoadID).Name);
   13768             :             } // cascade load on detailed system
   13769             : 
   13770          41 :             for (int SecondaryNum = 1; SecondaryNum <= System(SystemNum).NumSecondarys; ++SecondaryNum) {
   13771           2 :                 int SecondaryID = System(SystemNum).SecondaryNum(SecondaryNum);
   13772           2 :                 print(state.files.eio, "   Secondary Load,{},{}\n", Secondary(SecondaryID).Name, SecondaryID);
   13773             :             } // secondary load on detailed system
   13774             : 
   13775          43 :             for (int SubcoolerNum = 1; SubcoolerNum <= state.dataRefrigCase->NumSimulationSubcoolers; ++SubcoolerNum) {
   13776           4 :                 if (Subcooler(SubcoolerNum).MechSourceSysID != SystemNum) continue;
   13777           1 :                 print(state.files.eio, "   Mechanical Subcooler Load, {},{}\n", SubcoolerNum, Subcooler(SubcoolerNum).Name);
   13778             :             } // Num sim subcoolers, looking only for NumSMech Subcoolers served by this system
   13779             : 
   13780          39 :             if (System(SystemNum).NumStages == 1) { // Single-stage compression system
   13781         191 :                 for (int CompressorNum = 1; CompressorNum <= System(SystemNum).NumCompressors; ++CompressorNum) {
   13782         154 :                     int CompID = System(SystemNum).CompressorNum(CompressorNum);
   13783         154 :                     print(state.files.eio, "   Refrigeration Compressor,{},{},{:.0R}\n", CompID, Compressor(CompID).Name, Compressor(CompID).NomCap);
   13784             :                 }                                          // NumCompressors
   13785           2 :             } else if (System(SystemNum).NumStages == 2) { // Two-stage compression system
   13786             :                 // Low-stage compressors
   13787           8 :                 for (int CompressorNum = 1; CompressorNum <= System(SystemNum).NumCompressors; ++CompressorNum) {
   13788           6 :                     int CompID = System(SystemNum).CompressorNum(CompressorNum);
   13789          18 :                     print(state.files.eio,
   13790             :                           "   Refrigeration Low-Stage Compressor,{},{},{:.0R}\n",
   13791             :                           CompID,
   13792           6 :                           Compressor(CompID).Name,
   13793          12 :                           Compressor(CompID).NomCap);
   13794             :                 } // NumCompressors
   13795             :                 // High-stage compressors
   13796          10 :                 for (int CompressorNum = 1; CompressorNum <= System(SystemNum).NumHiStageCompressors; ++CompressorNum) {
   13797           8 :                     int CompID = System(SystemNum).HiStageCompressorNum(CompressorNum);
   13798          24 :                     print(state.files.eio,
   13799             :                           "   Refrigeration High-Stage Compressor,{},{},{:.0R}\n",
   13800             :                           CompID,
   13801           8 :                           Compressor(CompID).Name,
   13802          16 :                           Compressor(CompID).NomCap);
   13803             :                 } // NumHiStageCompressors
   13804             :             }     // NumStages
   13805             : 
   13806          39 :             int CondID = System(SystemNum).CondenserNum(1);
   13807          39 :             switch (Condenser(CondID).CondenserType) {
   13808          33 :             case DataHeatBalance::RefrigCondenserType::Air: {
   13809         165 :                 print(state.files.eio,
   13810             :                       "   Refrigeration Condenser:Air-Cooled,{},{},{:.1R},{:.1R},{:.1R}\n",
   13811             :                       CondID,
   13812          33 :                       Condenser(CondID).Name,
   13813          33 :                       Condenser(CondID).RatedTCondense,
   13814          33 :                       Condenser(CondID).RatedCapacity,
   13815          66 :                       Condenser(CondID).RatedFanPower);
   13816          33 :             } break;
   13817           4 :             case DataHeatBalance::RefrigCondenserType::Evap: {
   13818          16 :                 print(state.files.eio,
   13819             :                       "   Refrigeration Condenser:Evaporative-Cooled,{},{},{:.1R},{:.1R}\n",
   13820             :                       CondID,
   13821           4 :                       Condenser(CondID).Name,
   13822           4 :                       Condenser(CondID).RatedCapacity,
   13823           8 :                       Condenser(CondID).RatedFanPower);
   13824           4 :             } break;
   13825           1 :             case DataHeatBalance::RefrigCondenserType::Water: {
   13826           6 :                 print(state.files.eio,
   13827             :                       "   Refrigeration Condenser:Water-Cooled,{},{},{:.1R},{:.1R},{:.1R},{:.1R}\n",
   13828             :                       CondID,
   13829           1 :                       Condenser(CondID).Name,
   13830           1 :                       Condenser(CondID).RatedTCondense,
   13831           1 :                       Condenser(CondID).RatedCapacity,
   13832           1 :                       Condenser(CondID).InletTemp,
   13833           2 :                       Condenser(CondID).DesVolFlowRate);
   13834           1 :             } break;
   13835           1 :             case DataHeatBalance::RefrigCondenserType::Cascade: {
   13836             : 
   13837           1 :                 switch (Condenser(CondID).CascadeTempControl) {
   13838           1 :                 case CascadeCndsrTempCtrlType::TempSet: {
   13839           1 :                     ChrOut = "Fixed";
   13840           1 :                 } break;
   13841           0 :                 case CascadeCndsrTempCtrlType::TempFloat: {
   13842           0 :                     ChrOut = "Floating";
   13843           0 :                 } break;
   13844           0 :                 default:
   13845           0 :                     break;
   13846             :                 } // cascade temperature control
   13847           5 :                 print(state.files.eio,
   13848             :                       "   Refrigeration Condenser:Cascade,{},{},{},{:.1R},{:.1R},{:.1R}\n",
   13849             :                       CondID,
   13850           1 :                       Condenser(CondID).Name,
   13851             :                       ChrOut,
   13852           1 :                       Condenser(CondID).RatedTCondense,
   13853           1 :                       Condenser(CondID).RatedCapacity,
   13854           2 :                       Condenser(CondID).RatedApproachT);
   13855           1 :             } break;
   13856           0 :             default:
   13857           0 :                 break;
   13858             :             } // condenser type
   13859             : 
   13860          41 :             for (int SubcoolerNum = 1; SubcoolerNum <= System(SystemNum).NumSubcoolers; ++SubcoolerNum) {
   13861           2 :                 int SubcoolerID = System(SystemNum).SubcoolerNum(SubcoolerNum);
   13862           2 :                 switch (Subcooler(SubcoolerID).subcoolerType) {
   13863           1 :                 case SubcoolerType::LiquidSuction: {
   13864           5 :                     print(state.files.eio,
   13865             :                           "   Refrigeration Liquid Suction Subcooler,{},{},{:.1R},{:.1R},{:.1R}\n",
   13866             :                           SubcoolerID,
   13867           1 :                           Subcooler(SubcoolerID).Name,
   13868           1 :                           Subcooler(SubcoolerID).LiqSuctDesignDelT,
   13869           1 :                           Subcooler(SubcoolerID).LiqSuctDesignTliqIn,
   13870           2 :                           Subcooler(SubcoolerID).LiqSuctDesignTvapIn);
   13871           1 :                 } break;
   13872           1 :                 case SubcoolerType::Mechanical: {
   13873           4 :                     print(state.files.eio,
   13874             :                           "   Refrigeration Mechanical Subcooler,{},{},{},{:.1R}\n",
   13875             :                           SubcoolerID,
   13876           1 :                           Subcooler(SubcoolerID).Name,
   13877           1 :                           Subcooler(SubcoolerID).MechSourceSys,
   13878           2 :                           Subcooler(SubcoolerID).MechControlTliqOut);
   13879           1 :                 } break;
   13880           0 :                 default:
   13881           0 :                     break;
   13882             :                 }
   13883             :             } // NumSubcoolers
   13884             : 
   13885             :         } // NumRefrigSystems
   13886             :     }     //(NumRefrigSystems > 0)
   13887             : 
   13888         771 :     if (state.dataRefrigCase->NumTransRefrigSystems > 0) {
   13889           1 :         print(state.files.eio, "#Detailed Transcritical Refrigeration Systems,{}\n", state.dataRefrigCase->NumTransRefrigSystems);
   13890           2 :         for (int TransSystemNum = 1; TransSystemNum <= state.dataRefrigCase->NumTransRefrigSystems; ++TransSystemNum) {
   13891          10 :             print(state.files.eio,
   13892             :                   " Detailed Transcritical Refrigeration System,{},{},{},{},{},{},{},{},{:.1R}\n",
   13893           1 :                   TransSystem(TransSystemNum).Name,
   13894           1 :                   TransSystem(TransSystemNum).RefrigerantName,
   13895           1 :                   TransSystem(TransSystemNum).NumCasesMT,
   13896           1 :                   TransSystem(TransSystemNum).NumCasesLT,
   13897           1 :                   TransSystem(TransSystemNum).NumWalkInsMT,
   13898           1 :                   TransSystem(TransSystemNum).NumWalkInsLT,
   13899           1 :                   TransSystem(TransSystemNum).NumCompressorsHP,
   13900           1 :                   TransSystem(TransSystemNum).NumCompressorsLP,
   13901           2 :                   GasCooler(TransSystem(TransSystemNum).GasCoolerNum(1)).MinCondTemp);
   13902             : 
   13903           4 :             for (int CaseNum = 1; CaseNum <= TransSystem(TransSystemNum).NumCasesMT; ++CaseNum) {
   13904           3 :                 int CaseID = TransSystem(TransSystemNum).CaseNumMT(CaseNum);
   13905           3 :                 if (RefrigCase(CaseID).ZoneNodeNum > 0) {
   13906          42 :                     print(state.files.eio,
   13907             :                           "   Medium Temperature Refrigeration Case,{},{},{},{},{},{:.1R},{:.2R},{:.1R},{:.1R},{:.1R},{:.1R},{:.1R},{:.1R}\n",
   13908             :                           CaseID,
   13909           3 :                           RefrigCase(CaseID).Name,
   13910           3 :                           RefrigCase(CaseID).ZoneName,
   13911           3 :                           RefrigCase(CaseID).ZoneNodeNum,
   13912           6 :                           state.dataLoopNodes->NodeID(RefrigCase(CaseID).ZoneNodeNum),
   13913           3 :                           RefrigCase(CaseID).RateTotCapPerLength,
   13914           3 :                           RefrigCase(CaseID).RatedLHR,
   13915           3 :                           RefrigCase(CaseID).Temperature,
   13916           3 :                           RefrigCase(CaseID).Length,
   13917           3 :                           RefrigCase(CaseID).OperatingFanPower,
   13918           3 :                           RefrigCase(CaseID).LightingPower,
   13919           3 :                           RefrigCase(CaseID).AntiSweatPower,
   13920           6 :                           RefrigCase(CaseID).DefrostPower);
   13921             :                 }
   13922             :             } // NumCasesMT on system
   13923           5 :             for (int CaseNum = 1; CaseNum <= TransSystem(TransSystemNum).NumCasesLT; ++CaseNum) {
   13924           4 :                 int CaseID = TransSystem(TransSystemNum).CaseNumLT(CaseNum);
   13925           4 :                 if (RefrigCase(CaseID).ZoneNodeNum > 0) {
   13926          56 :                     print(state.files.eio,
   13927             :                           "   Low Temperature Refrigeration Case,{},{},{},{},{},{:.1R},{:.2R},{:.1R},{:.1R},{:.1R},{:.1R},{:.1R},{:.1R}\n",
   13928             :                           CaseID,
   13929           4 :                           RefrigCase(CaseID).Name,
   13930           4 :                           RefrigCase(CaseID).ZoneName,
   13931           4 :                           RefrigCase(CaseID).ZoneNodeNum,
   13932           8 :                           state.dataLoopNodes->NodeID(RefrigCase(CaseID).ZoneNodeNum),
   13933           4 :                           RefrigCase(CaseID).RateTotCapPerLength,
   13934           4 :                           RefrigCase(CaseID).RatedLHR,
   13935           4 :                           RefrigCase(CaseID).Temperature,
   13936           4 :                           RefrigCase(CaseID).Length,
   13937           4 :                           RefrigCase(CaseID).OperatingFanPower,
   13938           4 :                           RefrigCase(CaseID).LightingPower,
   13939           4 :                           RefrigCase(CaseID).AntiSweatPower,
   13940           8 :                           RefrigCase(CaseID).DefrostPower);
   13941             :                 }
   13942             :             } // NumCasesLT on system
   13943           1 :             for (int WalkInNum = 1; WalkInNum <= TransSystem(TransSystemNum).NumWalkInsMT; ++WalkInNum) {
   13944           0 :                 int WalkInID = TransSystem(TransSystemNum).WalkInNumMT(WalkInNum);
   13945           0 :                 print(state.files.eio,
   13946             :                       "   Medium Temperature Refrigeration Walk In Cooler,{},{},{:.1R},{:.1R},{:.1R},{:.1R},{:.1R},{:.1R},{}\n",
   13947             :                       WalkInID,
   13948           0 :                       WalkIn(WalkInID).Name,
   13949           0 :                       WalkIn(WalkInID).DesignRatedCap,
   13950           0 :                       WalkIn(WalkInID).Temperature,
   13951           0 :                       WalkIn(WalkInID).CoilFanPower,
   13952           0 :                       WalkIn(WalkInID).CircFanPower,
   13953           0 :                       WalkIn(WalkInID).DesignLighting,
   13954           0 :                       WalkIn(WalkInID).HeaterPower,
   13955           0 :                       WalkIn(WalkInID).DefrostCapacity,
   13956           0 :                       WalkIn(WalkInID).NumZones);
   13957           0 :                 for (int ZoneID = 1; ZoneID <= WalkIn(WalkInID).NumZones; ++ZoneID) {
   13958           0 :                     print(state.files.eio,
   13959             :                           "      Walk-In Surfaces Facing Zone,{},{:.1R},{:.4R},{:.2R},{:.2R},{:.4R},{:.2R},{:.2R},{:.4R}\n",
   13960           0 :                           WalkIn(WalkInID).ZoneName(ZoneID),
   13961           0 :                           WalkIn(WalkInID).SurfaceArea(ZoneID),
   13962           0 :                           WalkIn(WalkInID).UValue(ZoneID),
   13963           0 :                           WalkIn(WalkInID).AreaStockDr(ZoneID),
   13964           0 :                           WalkIn(WalkInID).HeightStockDr(ZoneID),
   13965           0 :                           WalkIn(WalkInID).UValueStockDr(ZoneID),
   13966           0 :                           WalkIn(WalkInID).AreaGlassDr(ZoneID),
   13967           0 :                           WalkIn(WalkInID).HeightGlassDr(ZoneID),
   13968           0 :                           WalkIn(WalkInID).UValueGlassDr(ZoneID));
   13969             :                 } // Num zones for each walk in on system
   13970             :             }     // NumWalkInsMT on system
   13971           2 :             for (int WalkInNum = 1; WalkInNum <= TransSystem(TransSystemNum).NumWalkInsLT; ++WalkInNum) {
   13972           1 :                 int WalkInID = TransSystem(TransSystemNum).WalkInNumLT(WalkInNum);
   13973          10 :                 print(state.files.eio,
   13974             :                       "   Low Temperature Refrigeration Walk In Cooler,{},{},{:.1R},{:.1R},{:.1R},{:.1R},{:.1R},{:.1R},{:.1R},{}\n",
   13975             :                       WalkInID,
   13976           1 :                       WalkIn(WalkInID).Name,
   13977           1 :                       WalkIn(WalkInID).DesignRatedCap,
   13978           1 :                       WalkIn(WalkInID).Temperature,
   13979           1 :                       WalkIn(WalkInID).CoilFanPower,
   13980           1 :                       WalkIn(WalkInID).CircFanPower,
   13981           1 :                       WalkIn(WalkInID).DesignLighting,
   13982           1 :                       WalkIn(WalkInID).HeaterPower,
   13983           1 :                       WalkIn(WalkInID).DefrostCapacity,
   13984           2 :                       WalkIn(WalkInID).NumZones);
   13985           2 :                 for (int ZoneID = 1; ZoneID <= WalkIn(WalkInID).NumZones; ++ZoneID) {
   13986          10 :                     print(state.files.eio,
   13987             :                           "      Walk-In Surfaces Facing Zone,{},{:.1R},{:.4R},{:.2R},{:.2R},{:.4R},{:.2R},{:.2R},{:.4R}\n",
   13988           1 :                           WalkIn(WalkInID).ZoneName(ZoneID),
   13989           1 :                           WalkIn(WalkInID).SurfaceArea(ZoneID),
   13990           1 :                           WalkIn(WalkInID).UValue(ZoneID),
   13991           1 :                           WalkIn(WalkInID).AreaStockDr(ZoneID),
   13992           1 :                           WalkIn(WalkInID).HeightStockDr(ZoneID),
   13993           1 :                           WalkIn(WalkInID).UValueStockDr(ZoneID),
   13994           1 :                           WalkIn(WalkInID).AreaGlassDr(ZoneID),
   13995           1 :                           WalkIn(WalkInID).HeightGlassDr(ZoneID),
   13996           2 :                           WalkIn(WalkInID).UValueGlassDr(ZoneID));
   13997             :                 } // Num zones for each walk in on system
   13998             :             }     // NumWalkInsLT on system
   13999             : 
   14000           4 :             for (int CompressorNum = 1; CompressorNum <= TransSystem(TransSystemNum).NumCompressorsHP; ++CompressorNum) {
   14001           3 :                 int CompID = TransSystem(TransSystemNum).CompressorNumHP(CompressorNum);
   14002           9 :                 print(state.files.eio,
   14003             :                       "   High Pressure Refrigeration Compressor,{},{},{:.0R}\n",
   14004             :                       CompID,
   14005           3 :                       Compressor(CompID).Name,
   14006           6 :                       Compressor(CompID).NomCap);
   14007             :             } // NumCompressorsHP
   14008           4 :             for (int CompressorNum = 1; CompressorNum <= TransSystem(TransSystemNum).NumCompressorsLP; ++CompressorNum) {
   14009           3 :                 int CompID = TransSystem(TransSystemNum).CompressorNumLP(CompressorNum);
   14010           9 :                 print(state.files.eio,
   14011             :                       "   Low Pressure Refrigeration Compressor,{},{},{:.0R}\n",
   14012             :                       CompID,
   14013           3 :                       Compressor(CompID).Name,
   14014           6 :                       Compressor(CompID).NomCap);
   14015             :             } // NumCompressorsLP
   14016             : 
   14017           1 :             if (TransSystem(TransSystemNum).NumGasCoolers >= 1) {
   14018           1 :                 int GasCoolerID = TransSystem(TransSystemNum).GasCoolerNum(1);
   14019           7 :                 print(state.files.eio,
   14020             :                       "   Refrigeration GasCooler:Air-Cooled,{},{},{:.1R},{:.1R},{:.1R},{:.1R},{:.1R}\n",
   14021             :                       GasCoolerID,
   14022           1 :                       GasCooler(GasCoolerID).Name,
   14023           1 :                       GasCooler(GasCoolerID).RatedOutletP,
   14024           1 :                       GasCooler(GasCoolerID).RatedOutletT,
   14025           1 :                       GasCooler(GasCoolerID).RatedApproachT,
   14026           1 :                       GasCooler(GasCoolerID).RatedCapacity,
   14027           2 :                       GasCooler(GasCoolerID).RatedFanPower);
   14028             :             } // System(SystemNum)%NumGasCoolers >= 1
   14029             : 
   14030             :         } // NumTransRefrigSystems
   14031             :     }     //(NumTransRefrigSystems > 0)
   14032             : 
   14033         771 :     if (state.dataRefrigCase->NumSimulationSecondarySystems > 0) {
   14034           1 :         print(state.files.eio, "#Secondary Refrigeration Systems,{}\n", state.dataRefrigCase->NumSimulationSecondarySystems);
   14035           3 :         for (int SecondaryID = 1; SecondaryID <= state.dataRefrigCase->NumSimulationSecondarySystems; ++SecondaryID) {
   14036           2 :             switch (Secondary(SecondaryID).FluidType) {
   14037           1 :             case SecFluidType::AlwaysLiquid: {
   14038          10 :                 print(state.files.eio,
   14039             :                       "Secondary Refrigeration System: Fluid Always Liquid,{},{},{},{},{},{:.1R},{:.2R},{:.2R},{:.3R},{:.3R}\n",
   14040             :                       SecondaryID,
   14041           1 :                       Secondary(SecondaryID).Name,
   14042           1 :                       Secondary(SecondaryID).NumCases,
   14043           1 :                       Secondary(SecondaryID).NumWalkIns,
   14044           1 :                       Secondary(SecondaryID).FluidName,
   14045           1 :                       Secondary(SecondaryID).CoolingLoadRated,
   14046           1 :                       Secondary(SecondaryID).TEvapDesign,
   14047           1 :                       Secondary(SecondaryID).TApproachDifRated,
   14048           1 :                       Secondary(SecondaryID).TRangeDifRated,
   14049           2 :                       Secondary(SecondaryID).PumpTotRatedPower);
   14050           1 :             } break;
   14051           1 :             case SecFluidType::PhaseChange: {
   14052          10 :                 print(state.files.eio,
   14053             :                       "Secondary Refrigeration System: Liquid Overfeed,{},{},{},{},{},{:.1R},{:.2R},{:.2R},{:.3R},{:.3R}\n",
   14054             :                       SecondaryID,
   14055           1 :                       Secondary(SecondaryID).Name,
   14056           1 :                       Secondary(SecondaryID).NumCases,
   14057           1 :                       Secondary(SecondaryID).NumWalkIns,
   14058           1 :                       Secondary(SecondaryID).FluidName,
   14059           1 :                       Secondary(SecondaryID).CoolingLoadRated,
   14060           1 :                       Secondary(SecondaryID).TEvapDesign,
   14061           1 :                       Secondary(SecondaryID).TApproachDifRated,
   14062           1 :                       Secondary(SecondaryID).CircRate,
   14063           2 :                       Secondary(SecondaryID).PumpTotRatedPower);
   14064           1 :             } break;
   14065           0 :             default:
   14066           0 :                 break;
   14067             :             }
   14068           9 :             for (int CaseNum = 1; CaseNum <= Secondary(SecondaryID).NumCases; ++CaseNum) {
   14069           7 :                 int CaseID = Secondary(SecondaryID).CaseNum(CaseNum);
   14070           7 :                 if (RefrigCase(CaseID).ZoneNodeNum > 0) {
   14071          98 :                     print(state.files.eio,
   14072             :                           "  Refrigeration Case,{},{},{},{},{},{:.1R},{:.2R},{:.1R},{:.1R},{:.1R},{:.1R},{:.1R},{:.1R}\n",
   14073             :                           CaseID,
   14074           7 :                           RefrigCase(CaseID).Name,
   14075           7 :                           RefrigCase(CaseID).ZoneName,
   14076           7 :                           RefrigCase(CaseID).ZoneNodeNum,
   14077          14 :                           state.dataLoopNodes->NodeID(RefrigCase(CaseID).ZoneNodeNum),
   14078           7 :                           RefrigCase(CaseID).RateTotCapPerLength,
   14079           7 :                           RefrigCase(CaseID).RatedLHR,
   14080           7 :                           RefrigCase(CaseID).Temperature,
   14081           7 :                           RefrigCase(CaseID).Length,
   14082           7 :                           RefrigCase(CaseID).OperatingFanPower,
   14083           7 :                           RefrigCase(CaseID).LightingPower,
   14084           7 :                           RefrigCase(CaseID).AntiSweatPower,
   14085          14 :                           RefrigCase(CaseID).DefrostPower);
   14086             :                 }
   14087             :             } // NumCases on secondary on secondary system
   14088             : 
   14089           3 :             for (int WalkInNum = 1; WalkInNum <= Secondary(SecondaryID).NumWalkIns; ++WalkInNum) {
   14090           1 :                 int WalkInID = Secondary(SecondaryID).WalkInNum(WalkInNum);
   14091           9 :                 print(state.files.eio,
   14092             :                       "  Walk In,{},{},{:.1R},{:.1R},{:.1R},{:.1R},{:.1R},{:.1R},{:.1R}\n",
   14093             :                       WalkInID,
   14094           1 :                       WalkIn(WalkInID).Name,
   14095           1 :                       WalkIn(WalkInID).DesignRatedCap,
   14096           1 :                       WalkIn(WalkInID).Temperature,
   14097           1 :                       WalkIn(WalkInID).CoilFanPower,
   14098           1 :                       WalkIn(WalkInID).CircFanPower,
   14099           1 :                       WalkIn(WalkInID).DesignLighting,
   14100           1 :                       WalkIn(WalkInID).HeaterPower,
   14101           2 :                       WalkIn(WalkInID).DefrostCapacity);
   14102           2 :                 for (int ZoneID = 1; ZoneID <= WalkIn(WalkInID).NumZones; ++ZoneID) {
   14103          10 :                     print(state.files.eio,
   14104             :                           "    Walk In Surfaces Facing Zone,{},{:.1R},{:.4R},{:.2R},{:.2R},{:.4R},{:.2R},{:.2R},{:.4R}\n",
   14105           1 :                           WalkIn(WalkInID).ZoneName(ZoneID),
   14106           1 :                           WalkIn(WalkInID).SurfaceArea(ZoneID),
   14107           1 :                           WalkIn(WalkInID).UValue(ZoneID),
   14108           1 :                           WalkIn(WalkInID).AreaStockDr(ZoneID),
   14109           1 :                           WalkIn(WalkInID).HeightStockDr(ZoneID),
   14110           1 :                           WalkIn(WalkInID).UValueStockDr(ZoneID),
   14111           1 :                           WalkIn(WalkInID).AreaGlassDr(ZoneID),
   14112           1 :                           WalkIn(WalkInID).HeightGlassDr(ZoneID),
   14113           2 :                           WalkIn(WalkInID).UValueGlassDr(ZoneID));
   14114             :                 } // zones for walk ins on secondary
   14115             :             }     // walk ins on secondary
   14116             : 
   14117           2 :             for (int CoilNum = 1; CoilNum <= Secondary(SecondaryID).NumCoils; ++CoilNum) {
   14118           0 :                 int CoilID = Secondary(SecondaryID).CoilNum(CoilNum);
   14119           0 :                 print(state.files.eio, "   Air Chiller Load,{},{},{}\n", WarehouseCoil(CoilID).Name, CoilID, WarehouseCoil(CoilID).ZoneName);
   14120             :             } // numairchillers
   14121             :         }     // secondary
   14122             :     }         // numsimulationsecondarys
   14123             : 
   14124         771 :     if (state.dataRefrigCase->NumRefrigChillerSets > 0) {
   14125           1 :         print(state.files.eio, "#ZoneHVAC/Refrigeration Air Chiller Sets,{}\n", state.dataRefrigCase->NumRefrigChillerSets);
   14126          11 :         for (int ChillerSetNum = 1; ChillerSetNum <= state.dataRefrigCase->NumRefrigChillerSets; ++ChillerSetNum) {
   14127          40 :             print(state.files.eio,
   14128             :                   "ZoneHVAC/Refrigeration Air Chiller Set,{},{},{},{}\n",
   14129          10 :                   AirChillerSet(ChillerSetNum).Name,
   14130             :                   ChillerSetNum,
   14131          10 :                   AirChillerSet(ChillerSetNum).NumCoils,
   14132          20 :                   AirChillerSet(ChillerSetNum).ZoneName);
   14133             : 
   14134          93 :             for (int CoilNum = 1; CoilNum <= AirChillerSet(ChillerSetNum).NumCoils; ++CoilNum) {
   14135          83 :                 int CoilID = AirChillerSet(ChillerSetNum).CoilNum(CoilNum);
   14136        1162 :                 print(state.files.eio,
   14137             :                       "   Refrigeration Air Chiller,{},{},{},{},{},{:.1R},{:.2R},{:.1R},{:.1R},{:.1R},{:.1R},{:.1R},{:.1R}\n",
   14138             :                       CoilID,
   14139          83 :                       WarehouseCoil(CoilID).Name,
   14140          83 :                       WarehouseCoil(CoilID).ZoneName,
   14141          83 :                       WarehouseCoil(CoilID).ZoneNodeNum,
   14142         166 :                       state.dataLoopNodes->NodeID(WarehouseCoil(CoilID).ZoneNodeNum),
   14143          83 :                       WarehouseCoil(CoilID).UnitLoadFactorSens,
   14144          83 :                       WarehouseCoil(CoilID).RatedSensibleCap,
   14145          83 :                       WarehouseCoil(CoilID).TEvapDesign,
   14146          83 :                       WarehouseCoil(CoilID).RatedTemperatureDif,
   14147          83 :                       WarehouseCoil(CoilID).RatedFanPower,
   14148          83 :                       WarehouseCoil(CoilID).HeaterPower,
   14149          83 :                       WarehouseCoil(CoilID).DefrostCapacity,
   14150         166 :                       WarehouseCoil(CoilID).RatedAirVolumeFlow);
   14151             :             } // numairchillers
   14152             :         }     // DataHeatBalance::NumRefrigChillerSets
   14153             :     }         // DataHeatBalance::NumRefrigChillerSets
   14154         771 : }
   14155             : 
   14156       48194 : void WalkInData::CalculateWalkIn(EnergyPlusData &state) // Absolute pointer to  Walk In
   14157             : {
   14158             : 
   14159             :     // SUBROUTINE INFORMATION:
   14160             :     //       AUTHOR         Therese Stovall, ORNL, May 2009
   14161             :     //       DATE WRITTEN   Oct/Nov 2004
   14162             :     //       MODIFIED       na
   14163             :     //       RE-ENGINEERED  na
   14164             : 
   14165             :     // PURPOSE OF THIS SUBROUTINE:
   14166             :     // To model Walk In Coolers.
   14167             : 
   14168             :     // METHODOLOGY EMPLOYED:
   14169             :     // Walk-in cooler performance is based on the ASHRAE load model, which includes
   14170             :     // infiltration through door openings and sensible loss through walls/ceilings identified
   14171             :     // by the user as sum of UA for each zone. A sub-floor heater is assumed to be sized so that
   14172             :     // the temperature of the slab beneath the floor insulation is the same as the ground
   14173             :     // temperature (to avoid ground freezing and heaving).
   14174             :     // All equipment loads (fan, light, heaters) are modeled as well.  Sensible and latent
   14175             :     // exchange with multiple adjoining zones is included. A master schedule is used for the Walk In operation and
   14176             :     // additional schedules control the lights, defrost, and heater operation.
   14177             : 
   14178             :     // The fan is assumed to be off for Hot-Gas, Hot-Brine, and Electric defrost. The user can choose
   14179             :     // to include the load due to bringing the coil mass up from the evaporating temperature to the melting temperature
   14180             :     //  if they choose.  Otherwise this factor is set to zero.
   14181             : 
   14182             :     // Unmet loads are accumulated to be met the following time step.  This usually occurs during defrost and
   14183             :     // restocking.
   14184             : 
   14185             :     // REFERENCES:
   14186             :     // ASHRAE 2006 Handbook, chapters 13 and 14.
   14187             :     // Gosney, W.B., Olama, G.A.-L., Heat and Enthalpy Gains through Cold Room Doorways,
   14188             :     //     Proceedings of the Institute of Refrigeration, vol. 72, pp 31-41, 1975
   14189             : 
   14190       48194 :     Real64 constexpr DefaultWalkInDoorOpenFactor(0.05); // walk in door open factor (fraction time open)
   14191             : 
   14192             :     static constexpr std::string_view RoutineName("CalculateWalkIn");
   14193       48194 :     Real64 CapApplied(0.0);          // Walk In total capacity at specific operating conditions
   14194       48194 :     Real64 DefrostSchedule(0.0);     // WalkIn defrost schedule, between 0 and 1
   14195       48194 :     Real64 DefrostEnergyNeeded(0.0); // Energy needed to melt all ice, used with temperature termination (J)
   14196       48194 :     Real64 DensityFactorFm(0.0);     // called Fm in ASHRAE 2010 eq 13 page 24.5 for door infiltration
   14197       48194 :     Real64 DensitySqRtFactor(0.0);   // from ASHRAE 2010 eq 12 page 24.4 for door infiltration
   14198             : 
   14199             :     // Current value of WalkIn operating (availability) schedule
   14200       48194 :     Real64 WalkInSchedule = ScheduleManager::GetCurrentScheduleValue(state, this->SchedPtr);
   14201       48194 :     if (WalkInSchedule <= 0) return;
   14202             :     // GET OTHER SCHEDULES
   14203       48194 :     DefrostSchedule = ScheduleManager::GetCurrentScheduleValue(state, this->DefrostSchedPtr);
   14204       48194 :     Real64 DefrostDripDownSchedule = ScheduleManager::GetCurrentScheduleValue(state, this->DefrostDripDownSchedPtr);
   14205             :     // next statement In case user doesn't understand concept of drip down schedule
   14206       48194 :     DefrostDripDownSchedule = max(DefrostDripDownSchedule, DefrostSchedule);
   14207             : 
   14208             :     // next four values optional, so set to default before checking for schedule
   14209       48194 :     Real64 StockingLoad(0.0); // Total load due to stocking WalkIn product (W)
   14210       48194 :     Real64 LightingSchedule = 1.0;
   14211       48194 :     Real64 HeaterSchedule = 1.0;
   14212       48194 :     Real64 CircFanSchedule = 1.0;
   14213       48194 :     if (this->StockingSchedPtr > 0) StockingLoad = ScheduleManager::GetCurrentScheduleValue(state, this->StockingSchedPtr);
   14214       48194 :     if (this->LightingSchedPtr > 0) LightingSchedule = ScheduleManager::GetCurrentScheduleValue(state, this->LightingSchedPtr);
   14215       48194 :     if (this->HeaterSchedPtr > 0) HeaterSchedule = ScheduleManager::GetCurrentScheduleValue(state, this->HeaterSchedPtr);
   14216       48194 :     if (this->CircFanSchedPtr > 0) CircFanSchedule = ScheduleManager::GetCurrentScheduleValue(state, this->CircFanSchedPtr);
   14217             : 
   14218             :     // Set local subroutine variables for convenience
   14219       48194 :     Real64 TWalkIn = this->Temperature; // WalkIn operating temperature (C)
   14220             : 
   14221             :     // Enthalpy of air corresponding to walk in temperature and 90% assumed RH (J/kg)
   14222       48194 :     Real64 EnthalpyAirWalkIn = Psychrometrics::PsyHFnTdbRhPb(state, TWalkIn, 0.9, state.dataEnvrn->OutBaroPress); // assume 90%RH in cooler
   14223             : 
   14224             :     // corresponds to walk in temp and 90% assumed RH(kg water/kg dry air)
   14225       48194 :     Real64 HumRatioAirWalkIn = Psychrometrics::PsyWFnTdbH(state, TWalkIn, EnthalpyAirWalkIn);
   14226       48194 :     Real64 DensityAirWalkIn = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, TWalkIn, HumRatioAirWalkIn);
   14227       48194 :     Real64 Conv = state.dataEnvrn->Latitude * 2.0 * DataGlobalConstants::Pi / 360.0; // Convert DataEnvironment::Latitude to radians
   14228       48194 :     Real64 Gravity = 9.780373 * (1.0 + 0.0052891 * pow_2(std::sin(Conv)) - 0.0000059 * pow_2(std::sin(2.0 * Conv)));
   14229             : 
   14230             :     // CALCULATE ALL LOADS INFLUENCED BY ZONE TEMPERATURE AND RH
   14231             :     // set to zero before summing over zones
   14232       48194 :     Real64 SensibleLoadTotal(0.0); // Total sensible load on WalkIn over all zones (W)
   14233       48194 :     Real64 LatentLoadTotal(0.0);   // total latent load on WalkIn over all zones (W)
   14234       48194 :     Real64 ZoneLatentLoad(0.0);    // Latent WalkIn credit delivered to zone (W)
   14235             : 
   14236       48194 :     this->SensZoneCreditRate = 0.0;
   14237       48194 :     this->SensZoneCreditCoolRate = 0.0;
   14238       48194 :     this->SensZoneCreditCool = 0.0;
   14239       48194 :     this->SensZoneCreditHeatRate = 0.0;
   14240       48194 :     this->SensZoneCreditHeat = 0.0;
   14241       48194 :     this->LatZoneCreditRate = 0.0;
   14242             : 
   14243             :     // Start zone loop:
   14244       96388 :     for (int ZoneID = 1; ZoneID <= this->NumZones; ++ZoneID) {
   14245       48194 :         int zoneNum = this->ZoneNum(ZoneID);
   14246       48194 :         int zoneNodeNum = this->ZoneNodeNum(ZoneID);
   14247       48194 :         Real64 ZoneDryBulb = state.dataLoopNodes->Node(zoneNodeNum).Temp; // Dry Bulb Temperature of adjacent zone
   14248       48194 :         Real64 WalkInLatLoad = -ZoneLatentLoad;                           // Walk in cooler latent load facing particular zone (W)
   14249       48194 :         Real64 DelTemp = ZoneDryBulb - TWalkIn;                           // Difference between zone and walk in temperatures (C)
   14250       48194 :         Real64 StockDoorArea = this->AreaStockDr(ZoneID);
   14251       48194 :         Real64 GlassDoorArea = this->AreaGlassDr(ZoneID);                          // facing a particular zone (m2)
   14252       48194 :         Real64 UAOtherSurfaces = this->SurfaceArea(ZoneID) * this->UValue(ZoneID); // UA for non-door surfaces facing a certain zone (W/C)
   14253       48194 :         Real64 ZInfilSensLoad(0.0);                                                // Sensible load due to infiltration in one zone
   14254       48194 :         Real64 ZdoorSensLoad(0.0);                                                 // Sensible load due to UA delta T through closed door in one zone
   14255             : 
   14256             :         // Derate compared to fully developed flow through 100% open door
   14257       48194 :         Real64 DoorFlowFactor = 0.8;               // see ASHRAE Refrigeration, p13.5, 2006
   14258       48194 :         if (DelTemp <= 11.0) DoorFlowFactor = 1.1; // from ASHRAE Refrigeration Loads
   14259             : 
   14260             :         // Get infiltration loads if either type of door is present in this zone
   14261       48194 :         if (StockDoorArea > 0.0 || GlassDoorArea > 0.0) {
   14262             :             // Zone relative humidity fraction (decimal)
   14263      144582 :             Real64 ZoneRHFrac = Psychrometrics::PsyRhFnTdbWPb(state,
   14264       48194 :                                                               state.dataLoopNodes->Node(zoneNodeNum).Temp,
   14265       48194 :                                                               state.dataLoopNodes->Node(zoneNodeNum).HumRat,
   14266       48194 :                                                               state.dataEnvrn->OutBaroPress,
   14267       48194 :                                                               RoutineName);
   14268             :             // Enthalpy of the air in a particular zone (J/kg)
   14269       48194 :             Real64 EnthalpyZoneAir = Psychrometrics::PsyHFnTdbRhPb(state, ZoneDryBulb, ZoneRHFrac, state.dataEnvrn->OutBaroPress, RoutineName);
   14270       48194 :             Real64 HumRatioZoneAir = Psychrometrics::PsyWFnTdbH(state, ZoneDryBulb, EnthalpyZoneAir, RoutineName);
   14271             :             Real64 DensityZoneAir =
   14272       48194 :                 Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, ZoneDryBulb, HumRatioZoneAir, RoutineName);
   14273       48194 :             if (DensityZoneAir < DensityAirWalkIn) { // usual case when walk in is colder than zone
   14274       48194 :                 DensitySqRtFactor = std::sqrt(1.0 - DensityZoneAir / DensityAirWalkIn);
   14275       48194 :                 DensityFactorFm = std::pow(2.0 / (1.0 + std::pow(DensityAirWalkIn / DensityZoneAir, 0.333)), 1.5);
   14276             :             } else { // temperature inversion with zone colder and/or drier than walk-in, infiltration in reverse direction
   14277             :                 // The enthalpy difference will show whether the energy transport is reversed
   14278             :                 //(same air mass exchange in either direction )
   14279             :                 // That is, these factors establish the magnitude of the exchange air flow, not direction
   14280           0 :                 DensitySqRtFactor = std::sqrt(1.0 - DensityAirWalkIn / DensityZoneAir);
   14281           0 :                 DensityFactorFm = std::pow(2.0 / (1.0 + std::pow(DensityZoneAir / DensityAirWalkIn, 0.333)), 1.5);
   14282             :             } // check for density in zone and in walk-in to avoid taking sqrt of neg number
   14283             : 
   14284       48194 :             Real64 StockDoorInfLoad = 0.0;  // infiltration through stock doors in a particular zone (W)
   14285       48194 :             Real64 StockDoorSensHeat = 0.0; // sensible heat gain through stock doors (UA*delta T) (W)
   14286       48194 :             Real64 DoorProtectEff(0.0);     // Door protection effectiveness
   14287       48194 :             Real64 DrHeight(0.0);           // Door height (m)
   14288       48194 :             Real64 DrArea(0.0);             // Door area (m2)
   14289       48194 :             Real64 FullFlowInfLoad(0.0);    // Total load (lat + sens) due to 100% open doors w/ fully developed flow (W)
   14290             : 
   14291       48194 :             if (StockDoorArea > 0.0) {
   14292       48194 :                 switch (this->StockDoorProtectType(ZoneID)) {
   14293             :                     // Values from ASHRAE Ref p 13.6
   14294       25952 :                 case WIStockDoor::None: {
   14295       25952 :                     DoorProtectEff = 0.0;
   14296       25952 :                 } break;
   14297           0 :                 case WIStockDoor::AirCurtain: {
   14298           0 :                     DoorProtectEff = 0.5;
   14299           0 :                 } break;
   14300       22242 :                 case WIStockDoor::StripCurtain: {
   14301       22242 :                     DoorProtectEff = 0.9;
   14302       22242 :                 } break;
   14303           0 :                 default:
   14304           0 :                     break;
   14305             :                 }
   14306       48194 :                 DrHeight = this->HeightStockDr(ZoneID);
   14307       48194 :                 DrArea = StockDoorArea;
   14308             :                 // if exists, get Stock Door Zone schedule
   14309       48194 :                 Real64 DoorOpenFactor = DefaultWalkInDoorOpenFactor;
   14310       48194 :                 if (this->StockDoorOpenSchedPtr(ZoneID) > 0)
   14311       48194 :                     DoorOpenFactor = ScheduleManager::GetCurrentScheduleValue(state, this->StockDoorOpenSchedPtr(ZoneID));
   14312             : 
   14313       96388 :                 FullFlowInfLoad = 0.221 * DrArea * (EnthalpyZoneAir - EnthalpyAirWalkIn) * DensityAirWalkIn * DensitySqRtFactor *
   14314       48194 :                                   std::sqrt(Gravity * DrHeight) * DensityFactorFm;
   14315       48194 :                 StockDoorInfLoad = FullFlowInfLoad * DoorOpenFactor * DoorFlowFactor * (1.0 - DoorProtectEff);
   14316       48194 :                 StockDoorSensHeat = DrArea * this->UValueStockDr(ZoneID) * DelTemp;
   14317             :             } // have stock doors
   14318             : 
   14319       48194 :             Real64 GlassDoorSensHeat(0.0); // sensible heat gain through glass reach-in doors (UA*delta T) (W)
   14320       48194 :             Real64 GlassDoorInfLoad = 0.0; // infiltration through glass reach-in doors in a particular zone (W)
   14321             : 
   14322       48194 :             if (GlassDoorArea > 0.0) {
   14323           0 :                 DoorProtectEff = 0.5; // Assume glass doors have air curtain
   14324           0 :                 DrHeight = this->HeightGlassDr(ZoneID);
   14325           0 :                 DrArea = GlassDoorArea;
   14326             :                 // get Glass Door Zone schedule
   14327           0 :                 Real64 DoorOpenFactor = DefaultWalkInDoorOpenFactor; // default value
   14328           0 :                 if (this->GlassDoorOpenSchedPtr(ZoneID) > 0)
   14329           0 :                     DoorOpenFactor = ScheduleManager::GetCurrentScheduleValue(state, this->GlassDoorOpenSchedPtr(ZoneID));
   14330             : 
   14331           0 :                 FullFlowInfLoad = 0.221 * DrArea * (EnthalpyZoneAir - EnthalpyAirWalkIn) * DensityAirWalkIn * DensitySqRtFactor *
   14332           0 :                                   std::sqrt(Gravity * DrHeight) * DensityFactorFm;
   14333           0 :                 GlassDoorInfLoad = FullFlowInfLoad * DoorOpenFactor * DoorFlowFactor * (1.0 - DoorProtectEff);
   14334           0 :                 GlassDoorSensHeat = DrArea * this->UValueGlassDr(ZoneID) * DelTemp;
   14335             :             } // have Glass doors
   14336             : 
   14337             :             // assume mass dry air infiltrating into walk-in == mass out into zone,
   14338             :             //                       that is, equal air exchange (ASHRAE 2006 Refrigeration)
   14339       48194 :             Real64 ZoneInfilLoad = -StockDoorInfLoad - GlassDoorInfLoad; // Walk in cooler infiltration load (sens + latent) in certain zone (W)
   14340       48194 :             Real64 MassDryAirRate =
   14341       48194 :                 -ZoneInfilLoad / (EnthalpyZoneAir - EnthalpyAirWalkIn); // Mass dry air infiltrating into/out-of walkin through doors (kg/s)
   14342       48194 :             Real64 WaterRemovRate =
   14343       48194 :                 MassDryAirRate * (HumRatioZoneAir - HumRatioAirWalkIn); // Walk in cooler removes water at this rate in this zone (kg/s)
   14344             :             // Just as with cases,  we assume no latent credit (water removal = 0) to zone or load on cooler during dripdown
   14345             :             // To be consistent with the treatment of refrigerated cases, latent load
   14346             :             //  and latent credit are bothbased on reducing the infiltrating vapor to ice.  (This is
   14347             :             //  slightly greater than if the latent credit were based upon condensing out the water as liquid.)
   14348             :             //  then it would be: ZoneLatentLoad = -WaterRemovRate * WaterToVaporEnthalpy * (1.0d0-DefrostDripDownSchedule)
   14349       48194 :             ZoneLatentLoad = -WaterRemovRate * IcetoVaporEnthalpy * (1.0 - DefrostDripDownSchedule);
   14350       48194 :             ZInfilSensLoad = ZoneInfilLoad - (-WaterRemovRate * IcetoVaporEnthalpy); // done to avoid moving latent to sens during dripdown
   14351       48194 :             ZdoorSensLoad = -GlassDoorSensHeat - StockDoorSensHeat;
   14352       48194 :             WalkInLatLoad = -ZoneLatentLoad;
   14353       48194 :             if (this->TEvapDesign <= 0.0) { // water turned to ice on coil
   14354       48194 :                 WalkInLatLoad = WaterRemovRate * IcetoVaporEnthalpy * (1.0 - DefrostDripDownSchedule);
   14355             :                 // FROST:  keep track of frost build up on evaporator coil
   14356             :                 //         avoid accumulation during warm-up to avoid reverse dd test problem
   14357       48194 :                 if (!state.dataGlobal->WarmupFlag) {
   14358        6624 :                     Real64 FrostChangekg = (WaterRemovRate * state.dataGlobal->TimeStepZoneSec) * (1.0 - DefrostDripDownSchedule);
   14359        6624 :                     this->KgFrost += FrostChangekg;
   14360             :                 }
   14361             :             } // water to ice
   14362             :         }     // No doors
   14363             : 
   14364             :         // Sensible WalkIn credit delivered to a particular zone (W)
   14365       48194 :         Real64 ZoneSensLoad = ZInfilSensLoad + ZdoorSensLoad - UAOtherSurfaces * DelTemp;
   14366       48194 :         Real64 WalkInSensLoad = -ZoneSensLoad; // Walk in cooler sensible load facing particular zone (W)
   14367             : 
   14368             :         // Update globals for use in ZoneTemperaturePredictorCorrector (Air Heat Balance) and
   14369             :         //   Zone Equipment Manager. Sum walk-in credits to zone using existing 'casecredit' variable
   14370             :         //   No return air fractions are applied to walk-ins, and no latent in stocking -
   14371             : 
   14372       48194 :         state.dataHeatBal->RefrigCaseCredit(zoneNum).SenCaseCreditToZone += ZoneSensLoad;
   14373       48194 :         state.dataHeatBal->RefrigCaseCredit(zoneNum).LatCaseCreditToZone += ZoneLatentLoad;
   14374             : 
   14375             :         // Set up report variables for each zone for this walk-in
   14376             :         // Sensible heat exchange can be positive or negative, split into separate output variables and always report positive value
   14377       48194 :         this->SensZoneCreditRate(ZoneID) = ZoneSensLoad;
   14378       48194 :         if (ZoneSensLoad <= 0.0) {
   14379       48194 :             this->SensZoneCreditCoolRate(ZoneID) = -ZoneSensLoad;
   14380       48194 :             this->SensZoneCreditCool(ZoneID) = -ZoneSensLoad * state.dataGlobal->TimeStepZoneSec;
   14381       48194 :             this->SensZoneCreditHeatRate(ZoneID) = 0.0;
   14382       48194 :             this->SensZoneCreditHeat(ZoneID) = 0.0;
   14383             :         } else {
   14384           0 :             this->SensZoneCreditHeatRate(ZoneID) = ZoneSensLoad;
   14385           0 :             this->SensZoneCreditHeat(ZoneID) = ZoneSensLoad * state.dataGlobal->TimeStepZoneSec;
   14386           0 :             this->SensZoneCreditCoolRate(ZoneID) = 0.0;
   14387           0 :             this->SensZoneCreditCool(ZoneID) = 0.0;
   14388             :         }
   14389             :         // This rate should always be negative
   14390       48194 :         this->LatZoneCreditRate(ZoneID) = ZoneLatentLoad;
   14391       48194 :         this->LatZoneCredit(ZoneID) = ZoneLatentLoad * state.dataGlobal->TimeStepZoneSec;
   14392             : 
   14393             :         // Running total over all zones, use later to dispatch capacity
   14394       48194 :         SensibleLoadTotal += WalkInSensLoad;
   14395       48194 :         LatentLoadTotal += WalkInLatLoad;
   14396             : 
   14397             :     } // Do loop over zones for zone-condition-related sensible and latent loads
   14398             : 
   14399             :     // cooling coil fan power default is 375W, = 1/2 HP (Tyler showed 1/3 to 3/4 hp)
   14400             : 
   14401             :     // CALCULATE AUX LOADS DUE TO LIGHTS, FANS AND HEATERS
   14402       48194 :     Real64 LightLoad = this->DesignLighting * LightingSchedule; // Total lighting energy rate (W)
   14403             :     // turn coil fan off during defrost/drip - down period
   14404             : 
   14405             :     // Total fan energy rate (W)
   14406       48194 :     Real64 FanLoad = this->CircFanPower * CircFanSchedule + this->CoilFanPower * (1.0 - DefrostDripDownSchedule);
   14407       48194 :     Real64 HeaterLoad = this->HeaterPower * HeaterSchedule; // Total heater (except defrost) energy rate (W)
   14408             :     // Calculate floor load - using 'DataEnvironment::GroundTemp' assigned in weather manager (can be entered by user if desired)
   14409             :     //    Default value is 18C.
   14410             :     // Total floor energy rate (W)
   14411       48194 :     Real64 FloorLoad = this->FloorArea * this->FloorUValue * (state.dataEnvrn->GroundTemp - TWalkIn);
   14412             : 
   14413             :     Real64 DefrostLoad;
   14414             : 
   14415             :     // DEFROST CALCULATIONS
   14416       48194 :     if ((DefrostSchedule > 0.0) && (this->defrostType != WalkinClrDefrostType::None) && (this->defrostType != WalkinClrDefrostType::OffCycle)) {
   14417         616 :         DefrostLoad = this->DefrostCapacity * DefrostSchedule;                  // W
   14418         616 :         Real64 StartFrostKg = this->KgFrost;                                    // frost load at start of time step (kg of ice)
   14419         616 :         Real64 DefrostEnergy = DefrostLoad * state.dataGlobal->TimeStepZoneSec; // Joules
   14420         616 :         if (this->DefrostControlType == DefrostCtrlType::TempTerm) {
   14421             :             //  Need to turn defrost system off early if controlled by temperature and all ice melted
   14422             :             //  For temperature termination, need to recognize not all defrost heat goes to melt ice
   14423             :             //  Some goes to misc losses (for fluid defrost, some coil areas bare earlier than
   14424             :             //  others and xfer heat to environment)
   14425             :             //  Assume full ice melting satisfies temperature control.
   14426             :             //      (defaults for DefEnergyFraction are :=0.7 for elec, =0.3 for fluids)
   14427           0 :             Real64 AvailDefrostEnergy = this->DefEnergyFraction * DefrostEnergy; // Joules avail to melt ice
   14428           0 :             Real64 IceSensHeatNeeded = 0.0; // Energy to raise frost temperature to 0C, used w/ temp termination (J)
   14429           0 :             if (StartFrostKg > 0.0) {
   14430           0 :                 if (this->IceTemp < 0.0) {
   14431           0 :                     Real64 StartIceTemp = this->IceTemp;                                       // Frost temperature at start of time step [C]
   14432           0 :                     IceSensHeatNeeded = StartFrostKg * SpecificHeatIce * (0.0 - StartIceTemp); // Joules
   14433           0 :                     if (AvailDefrostEnergy >= IceSensHeatNeeded) {
   14434           0 :                         this->IceTemp = 0.0;
   14435           0 :                         AvailDefrostEnergy -= IceSensHeatNeeded; // Joules
   14436             :                     } else {                                     // DefrostEnergy < IceSensHeatNeeded
   14437           0 :                         this->IceTemp = StartIceTemp + AvailDefrostEnergy / (SpecificHeatIce * StartFrostKg);
   14438           0 :                         AvailDefrostEnergy = 0.0;
   14439             :                     } // AvailDefrostEnergy >= IceSensHeatNeeded
   14440             :                 }     // IceTemp < 0,  need to raise temperature of ice
   14441             :                 // Reduce defrost heat load on walkin by amount of ice melted during time step
   14442           0 :                 Real64 FrostChangekg = min(AvailDefrostEnergy / IceMeltEnthalpy, StartFrostKg);
   14443           0 :                 if (FrostChangekg < StartFrostKg) {
   14444           0 :                     DefrostLoad -= FrostChangekg * IceMeltEnthalpy / state.dataGlobal->TimeStepZone / DataGlobalConstants::SecInHour;
   14445           0 :                     if (!state.dataGlobal->WarmupFlag) this->KgFrost = StartFrostKg - FrostChangekg;
   14446             :                     // DefrostSchedule not changed
   14447             :                 } else { // all frost melted during time step, so need to terminate defrost
   14448             :                     //  see Aug 8 page 3 notes
   14449           0 :                     this->KgFrost = 0.0;
   14450           0 :                     DefrostEnergyNeeded = (IceSensHeatNeeded + (FrostChangekg * IceMeltEnthalpy)) /
   14451           0 :                                           this->DefEnergyFraction; // Joules - energy needed including E unavail to melt ice
   14452           0 :                     DefrostSchedule = min(DefrostSchedule, (DefrostEnergyNeeded / (this->DefrostCapacity * state.dataGlobal->TimeStepZoneSec)));
   14453             :                     // reduce load on walkin by energy put into ice melting
   14454           0 :                     DefrostLoad = max(0.0,
   14455           0 :                                       (DefrostSchedule * this->DefrostCapacity -
   14456           0 :                                        (IceSensHeatNeeded + (FrostChangekg * IceMeltEnthalpy)) / state.dataGlobal->TimeStepZoneSec));
   14457           0 :                     this->IceTemp = this->TEvapDesign;
   14458             : 
   14459             :                 }    // frost melted during time step less than amount of ice at start
   14460             :             } else { // no frost present so terminate defrost and reset ice temperature for start of next defrost
   14461           0 :                 DefrostLoad = 0.0;
   14462           0 :                 DefrostSchedule = 0.0;
   14463           0 :                 this->IceTemp = this->TEvapDesign;
   14464             :             } // have frost present
   14465             : 
   14466             :         } else { // Not temperature control type
   14467         616 :             Real64 FrostChangekg = min(DefrostEnergy / IceMeltEnthalpy, StartFrostKg);
   14468             :             // Reduce defrost heat load on walkin by amount of ice melted during time step
   14469         616 :             DefrostLoad -= FrostChangekg * IceMeltEnthalpy / state.dataGlobal->TimeStepZone / DataGlobalConstants::SecInHour;
   14470         616 :             if (!state.dataGlobal->WarmupFlag) this->KgFrost = StartFrostKg - FrostChangekg;
   14471             :             // DefrostSchedule not changed
   14472         616 :         } // Temperature termination control type
   14473             : 
   14474             :     } else { // DefrostSchedule <= 0 or have None or OffCycle
   14475       47578 :         DefrostLoad = 0.0;
   14476             :     } // Defrost calculations
   14477             : 
   14478       48194 :     if (this->defrostType == WalkinClrDefrostType::Elec) {
   14479       35218 :         this->ElecDefrostConsumption = this->DefrostCapacity * DefrostSchedule * state.dataGlobal->TimeStepZoneSec;
   14480       35218 :         this->ElecDefrostPower = this->DefrostCapacity * DefrostSchedule;
   14481             :     } else {
   14482       12976 :         this->ElecDefrostConsumption = 0.0;
   14483       12976 :         this->ElecDefrostPower = 0.0;
   14484             :     }
   14485             : 
   14486             :     // If hot brine or hot gas is used for defrost, need to reduce condenser load by heat reclaimed for defrost
   14487       48194 :     if (this->defrostType == WalkinClrDefrostType::Fluid) this->HotDefrostCondCredit = this->DefrostCapacity * DefrostSchedule;
   14488             : 
   14489             :     // loads reflects that walk ins continue to accumulate loads, even during defrost
   14490             :     // but cap is used to report portion met by active system while operating
   14491             : 
   14492             :     //*** See if capacity meets load and manage accumulated stored energy ***********************************
   14493       48194 :     SensibleLoadTotal += LightLoad + HeaterLoad + FanLoad + StockingLoad + DefrostLoad + FloorLoad;
   14494       48194 :     Real64 LoadTotal = SensibleLoadTotal + LatentLoadTotal; // total load in time step (W)
   14495             : 
   14496             :     // Account for difference between load and capacity. Assume rack or system able to provide
   14497             :     // rated capacity.  If it can't, that unmet energy will be stored and discharged at the system level.
   14498             :     //  Here we are calculating the load the walk-in cooler places on the refrigeration compressor systems.
   14499             :     //  Meet current load to the extent possible.  If extra capacity available,
   14500             :     //  apply it to previously unmet/stored loads.  If capacity less than current load,
   14501             :     //  (e.g. as it is during defrost cycles) save the unmet/stored load to be met in
   14502             :     //  succeeding time steps. This is an artificial way of recognizing that the internal
   14503             :     //  temperature will increase by a small amount during defrost and the system will have to
   14504             :     //  run full out until the temperature is brought back down.
   14505             : 
   14506             :     // Rate needed to serve all stored energy during single time step (W)
   14507       48194 :     Real64 StoredEnergyRate = this->StoredEnergy / state.dataGlobal->TimeStepZone / DataGlobalConstants::SecInHour;
   14508       48194 :     Real64 LoadRequested = LoadTotal + StoredEnergyRate; // Load necessary to meet current and all stored energy needs (W)
   14509             : 
   14510             :     Real64 LatentCapApplied;        // Walk In latent capacity at specific operating conditions
   14511       48194 :     Real64 SensibleCapApplied(0.0); // Walk In sensible capacity at specific operating conditions
   14512             : 
   14513             :     // prorate available cooling capacity for portion of time off due to drip down.
   14514       48194 :     Real64 MaxCap = this->DesignRatedCap * (1.0 - DefrostDripDownSchedule); // Design chilling capacity reduced according to drip-down schedule (W)
   14515             : 
   14516       48194 :     if (MaxCap >= LoadRequested) {
   14517             :         // Have more at least as much capacity available as needed, even counting stored energy
   14518       47160 :         CapApplied = LoadRequested;
   14519       47160 :         SensibleCapApplied = SensibleLoadTotal + StoredEnergyRate;
   14520       47160 :         LatentCapApplied = LatentLoadTotal;
   14521       47160 :         this->StoredEnergy = 0.0;
   14522             :     } else {
   14523             :         // Don't have as much capacity as needed (during dripdown or period following dripdown)
   14524        1034 :         CapApplied = MaxCap;
   14525        1034 :         LatentCapApplied = min(LatentLoadTotal, MaxCap); // Latent load should never be > capavail, but just in case...
   14526        1034 :         SensibleCapApplied = CapApplied - LatentCapApplied;
   14527        1034 :         if (!state.dataGlobal->WarmupFlag) this->StoredEnergy += (LoadTotal - MaxCap) * state.dataGlobal->TimeStepZoneSec;
   14528             :     } // CapAvail vs Load requested
   14529             : 
   14530             :     // ReportWalkIn( WalkInID)
   14531       48194 :     this->TotalCoolingLoad = CapApplied;
   14532       48194 :     this->TotalCoolingEnergy = CapApplied * state.dataGlobal->TimeStepZoneSec;
   14533       48194 :     this->TotSensCoolingEnergyRate = SensibleCapApplied;
   14534       48194 :     this->TotSensCoolingEnergy = SensibleCapApplied * state.dataGlobal->TimeStepZoneSec;
   14535       48194 :     this->TotLatCoolingEnergyRate = LatentCapApplied;
   14536       48194 :     this->TotLatCoolingEnergy = LatentCapApplied * state.dataGlobal->TimeStepZoneSec;
   14537             : 
   14538       48194 :     this->ElecFanPower = FanLoad;
   14539       48194 :     this->ElecFanConsumption = FanLoad * state.dataGlobal->TimeStepZoneSec;
   14540       48194 :     this->ElecHeaterPower = HeaterLoad;
   14541       48194 :     this->ElecHeaterConsumption = HeaterLoad * state.dataGlobal->TimeStepZoneSec;
   14542       48194 :     this->ElecLightingPower = LightLoad;
   14543       48194 :     this->ElecLightingConsumption = LightLoad * state.dataGlobal->TimeStepZoneSec;
   14544       48194 :     this->TotalElecPower = FanLoad + HeaterLoad + LightLoad + this->ElecDefrostPower;
   14545       48194 :     this->TotalElecConsumption = this->TotalElecPower * state.dataGlobal->TimeStepZoneSec;
   14546             : 
   14547             :     //**************************************************************************************************
   14548             :     // Cap Energy and Kg Frost to avoid floating overflow errors
   14549             :     // 1-time warning is issued. It should be rare but could happen with unrealistic inputs.
   14550       48194 :     if (this->StoredEnergy > MyLargeNumber) {
   14551           0 :         this->StoredEnergy = MyLargeNumber;
   14552           0 :         if (this->ShowUnmetWIEnergyWarning) {
   14553           0 :             ShowWarningError(state, "Refrigeration:WalkIn: " + this->Name);
   14554           0 :             ShowContinueError(state, " This walk-in cooler has insufficient capacity to meet the loads");
   14555           0 :             ShowContinueError(state,
   14556           0 :                               "... Occurrence info = " + state.dataEnvrn->EnvironmentName + ", " + state.dataEnvrn->CurMnDy + ' ' +
   14557           0 :                                   General::CreateSysTimeIntervalString(state));
   14558           0 :             ShowContinueError(state, " Refer to documentation for further explanation of Total Cooling Capacity.");
   14559           0 :             this->ShowUnmetWIEnergyWarning = false;
   14560             :         } // ShowStoreEnergyWarning
   14561             :     }     // stored energy > large number
   14562       48194 :     if (this->KgFrost > MyLargeNumber) {
   14563           0 :         this->KgFrost = MyLargeNumber;
   14564           0 :         if (this->ShowWIFrostWarning) {
   14565           0 :             ShowWarningError(state, "Refrigeration:WalkIn: " + this->Name);
   14566           0 :             ShowContinueError(state, " This walkin cooler has insufficient defrost capacity to remove the excess frost accumulation.");
   14567           0 :             ShowContinueError(state, " Check the defrost schedule or defrost capacity. ");
   14568           0 :             ShowContinueError(state,
   14569           0 :                               "... Occurrence info = " + state.dataEnvrn->EnvironmentName + ", " + state.dataEnvrn->CurMnDy + ' ' +
   14570           0 :                                   General::CreateSysTimeIntervalString(state));
   14571           0 :             this->ShowWIFrostWarning = false;
   14572             :         }
   14573             :     }
   14574             : }
   14575             : 
   14576        4044 : void SecondaryLoopData::CalculateSecondary(EnergyPlusData &state, int const SecondaryNum)
   14577             : {
   14578             :     // SUBROUTINE INFORMATION:
   14579             :     //       AUTHOR         Therese Stovall, ORNL
   14580             :     //       DATE WRITTEN   Spring 2009
   14581             :     //       RE-ENGINEERED  na
   14582             : 
   14583             :     // PURPOSE OF THIS SUBROUTINE:
   14584             :     // Find the total cooling load, pump power, and needed primary refrigerant supply temperature
   14585             :     // for a secondary system.
   14586             : 
   14587             :     // METHODOLOGY EMPLOYED:
   14588             :     // Sum the loads for the cases and walk-ins supplied by a secondary loop.
   14589             :     // Calculate the pumping power.
   14590             :     // Assume that the fluid supply and return temperatures are fixed and the
   14591             :     // fluid flow rate is varied to meed the variable load.
   14592             :     // User has been told in IO and Eng ref: for secondary systems/pumps: pump energy is f(viscosity),
   14593             :     //        but since specifying Tcircfluid as steady
   14594             :     //        state in loop, specify power for fluid and system head/resistance at that temp
   14595             :     // ashrae 2006 p4.1 supports 78% eff for pump impellers
   14596             :     //  all power into heat because it would otherwise not be counted in zone
   14597             :     //  if use semihermetic motor, also need to add motor ineff as heat
   14598             : 
   14599             :     // REFERENCES:
   14600             :     // SCE report
   14601             :     //  others
   14602             : 
   14603        4044 :     Real64 constexpr ErrorTol(0.001); // Iterative solution tolerance
   14604             : 
   14605             :     bool AtPartLoad;          // Whether or not need to iterate on pump power
   14606             :     bool DeRate;              // If true, need to derate aircoils because don't carry over unmet energy
   14607             :     int Iter;                 // loop counter
   14608             :     Real64 CpBrine;           // Specific heat (W/kg)
   14609             :     Real64 DensityBrine;      // Density (kg/m3)
   14610             :     Real64 DiffTemp;          // (C)
   14611             :     Real64 distPipeHeatGain;  // Optional (W)
   14612             :     Real64 Error;             // Used in iterative soln for pumps needed to meet load (that has to include pump energy)
   14613             :     Real64 FlowVolNeeded;     // Flow rate needed to meet load (m3/s)
   14614             :     Real64 PartLdFrac;        // Used to ratio pump power
   14615             :     Real64 PartPumpFrac;      // Used to see if part pumps dispatched meets part pump load
   14616             :     Real64 PrevTotalLoad;     // Used in pump energy convergence test
   14617             :     Real64 RefrigerationLoad; // Load for cases and walk-ins served by loop, does not include pump energy (W)
   14618             :     Real64 StoredEnergyRate;  // Used to meet loads unmet in previous time step (related to defrost cycles
   14619             :     //     on cases/walk-ins served)(W)
   14620             :     Real64 TBrineIn;                  // Brine temperature going to heat exchanger, C
   14621             :     Real64 TotalHotDefrostCondCredit; // Used to credit condenser when heat reclaim used for hot gas/brine defrost (W)
   14622             :     Real64 TotalPumpPower;            // Total Pumping power for loop, W
   14623             :     Real64 TotalLoad;                 // Total Cooling Load on secondary loop, W
   14624        4044 :     Real64 TPipesReceiver(0.0);       // Temperature used for contents of pipes and/or receiver in calculating shell losses (C)
   14625             :     Real64 VarFrac;                   // Pump power fraction for variable speed pump, dimensionless
   14626             :     Real64 VolFlowRate;               // Used in dispatching pumps to meet load (m3/s)
   14627             : 
   14628        4044 :     auto &RefrigCase(state.dataRefrigCase->RefrigCase);
   14629        4044 :     auto &WalkIn(state.dataRefrigCase->WalkIn);
   14630        4044 :     auto &WarehouseCoil(state.dataRefrigCase->WarehouseCoil);
   14631             : 
   14632        4044 :     Real64 LocalTimeStep = state.dataGlobal->TimeStepZone;
   14633        4044 :     if (state.dataRefrigCase->UseSysTimeStep) LocalTimeStep = state.dataHVACGlobal->TimeStepSys;
   14634             : 
   14635        4044 :     switch (this->FluidType) {
   14636        2022 :     case SecFluidType::AlwaysLiquid: {
   14637        2022 :         CpBrine = this->CpBrineRated;
   14638        2022 :         DensityBrine = this->DensityBrineRated;
   14639        2022 :         TBrineIn = this->TBrineInRated;
   14640        2022 :         TPipesReceiver = this->TBrineAverage;
   14641        2022 :     } break;
   14642        2022 :     case SecFluidType::PhaseChange: {
   14643        2022 :         TPipesReceiver = this->TCondense;
   14644        2022 :     } break;
   14645           0 :     default:
   14646           0 :         break;
   14647             :     } // Fluid type
   14648             : 
   14649             :     // Initialize this secondary for this time step
   14650        4044 :     TotalPumpPower = 0.0;
   14651        4044 :     RefrigerationLoad = 0.0;
   14652        4044 :     TotalHotDefrostCondCredit = 0.0;
   14653        4044 :     FlowVolNeeded = 0.0;
   14654        4044 :     DeRate = false;
   14655             : 
   14656             :     // SCE page 28 gives a delta T for pipe heat gains
   14657             :     //         (.25F each for supply and discharge) for use with mdot*cp.
   14658             :     //          However, another author shows this as a major diff between dx and secondary
   14659             :     //          So - allow the user to include this in his total load, even though he has to do
   14660             :     //          most of the calculations before the input (to get to SumUADistPiping)).
   14661        4044 :     distPipeHeatGain = 0.0;
   14662        4044 :     if (this->SumUADistPiping > MySmallNumber) {
   14663        4044 :         int ZoneNodeNum = this->DistPipeZoneNodeNum;
   14664        4044 :         DiffTemp = state.dataLoopNodes->Node(ZoneNodeNum).Temp - TPipesReceiver;
   14665        4044 :         distPipeHeatGain = DiffTemp * this->SumUADistPiping;
   14666             :         // pipe heat load is a positive number (ie. heat absorbed by pipe, so needs to be subtracted
   14667             :         //     from refrigcasecredit (- for cooling zone, + for heating zone)
   14668        4044 :         this->DistPipeZoneHeatGain = -distPipeHeatGain;
   14669        4044 :         state.dataHeatBal->RefrigCaseCredit(this->DistPipeZoneNum).SenCaseCreditToZone -= distPipeHeatGain;
   14670             :     } // calc distribution piping heat gains
   14671             : 
   14672        4044 :     Real64 receiverHeatGain = 0.0;
   14673        4044 :     if (this->SumUAReceiver > MySmallNumber) {
   14674        2022 :         int ZoneNodeNum = this->ReceiverZoneNodeNum;
   14675        2022 :         DiffTemp = state.dataLoopNodes->Node(ZoneNodeNum).Temp - TPipesReceiver;
   14676        2022 :         receiverHeatGain = DiffTemp * this->SumUAReceiver;
   14677             :         // receiver heat load is a positive number (ie. heat absorbed by receiver, so needs to be subtracted
   14678             :         //     from refrigcasecredit (- for cooling zone, + for heating zone)
   14679        2022 :         this->ReceiverZoneHeatGain = -receiverHeatGain;
   14680        2022 :         state.dataHeatBal->RefrigCaseCredit(this->ReceiverZoneNum).SenCaseCreditToZone -= receiverHeatGain;
   14681             :     } // calc receiver heat gains
   14682             : 
   14683             :     // Sum up all the case and walk-in loads served by the secondary loop
   14684        4044 :     if (this->NumCases > 0) {
   14685       18198 :         for (int caseNum = 1; caseNum <= this->NumCases; ++caseNum) {
   14686       14154 :             int CaseID = this->CaseNum(caseNum);
   14687       14154 :             RefrigCase(CaseID).CalculateCase(state);
   14688             :             // increment TotalCoolingLoad Hot gas/brine defrost credits for each secondary loop
   14689       14154 :             RefrigerationLoad += RefrigCase(CaseID).TotalCoolingLoad;
   14690       14154 :             TotalHotDefrostCondCredit += RefrigCase(CaseID).HotDefrostCondCredit;
   14691             :         } // CaseNum
   14692             :     }     // NumCases > 0
   14693        4044 :     if (this->NumWalkIns > 0) {
   14694        4044 :         for (int WalkInIndex = 1; WalkInIndex <= this->NumWalkIns; ++WalkInIndex) {
   14695        2022 :             int WalkInID = this->WalkInNum(WalkInIndex);
   14696        2022 :             WalkIn(WalkInID).CalculateWalkIn(state);
   14697             :             // increment TotalCoolingLoad for  each system
   14698        2022 :             RefrigerationLoad += WalkIn(WalkInID).TotalCoolingLoad;
   14699        2022 :             TotalHotDefrostCondCredit += WalkIn(WalkInID).HotDefrostCondCredit;
   14700             :         } // NumWalkIns systems
   14701             :     }     // Secondary(SecondaryNum)%NumWalkIns > 0
   14702             : 
   14703        4044 :     if (this->NumCoils > 0) {
   14704           0 :         for (int CoilIndex = 1; CoilIndex <= this->NumCoils; ++CoilIndex) {
   14705           0 :             int CoilID = this->CoilNum(CoilIndex);
   14706             :             // already CALL CalculateCoil(CoilID) for each coil, dispatched in coilset order for each zone
   14707             :             // increment TotalCoolingLoad for each system
   14708             :             //  here will find out if secondary can serve total load, if not will derate coil outout/case credits
   14709           0 :             RefrigerationLoad += WarehouseCoil(CoilID).TotalCoolingLoad;
   14710           0 :             TotalHotDefrostCondCredit += WarehouseCoil(CoilID).HotDefrostCondCredit;
   14711             :         } // NumCoils on secondary system
   14712             :     }     // Secondary(SecondaryNum)%NumCoils > 0
   14713             : 
   14714        4044 :     TotalLoad = RefrigerationLoad + distPipeHeatGain + receiverHeatGain;
   14715        4044 :     AtPartLoad = true;
   14716             :     // Check to see if load is already >+ maxload without pump heat
   14717        4044 :     if (this->FluidType == SecFluidType::AlwaysLiquid) { //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
   14718        2022 :         FlowVolNeeded = TotalLoad / this->HeatExchangeEta / (CpBrine * DensityBrine * (TBrineIn - this->TEvapDesign));
   14719             :         // For brine/glycol systems, find flow volume needed to meet load
   14720             :         // Per ashrae 2006, p4.1, eval mass flow rate to pump at brine return (to chiller) temp
   14721             :         //   because pumps located in return piping
   14722        2022 :         if (FlowVolNeeded >= this->MaxVolFlow) {
   14723             :             // Don't need to iterate on pumps, just set to max.  Will have unmet load this time step (unless coils present)
   14724           4 :             VolFlowRate = this->MaxVolFlow;
   14725           4 :             TotalPumpPower = this->PumpTotRatedPower;
   14726           4 :             TotalLoad += TotalPumpPower * this->PumpPowerToHeat;
   14727           4 :             AtPartLoad = false;
   14728           4 :             if (this->NumCoils > 0) DeRate = true;
   14729             :         }    // flowvolneeded >= maxvolflow
   14730             :     } else { // have SecFluidTypePhaseChange !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
   14731        2022 :         if (TotalLoad >= this->MaxLoad) {
   14732           5 :             TotalPumpPower = this->PumpTotRatedPower;
   14733           5 :             TotalLoad += TotalPumpPower * this->PumpPowerToHeat;
   14734           5 :             VolFlowRate = this->MaxVolFlow;
   14735           5 :             AtPartLoad = false;
   14736           5 :             if (this->NumCoils > 0) DeRate = true;
   14737             :         }
   14738             :     } // fluid type check for max load or max flow       >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
   14739             : 
   14740             :     // If totalLoad < maxload, then need to calculate partial pump load
   14741             :     // Need an iterative soln for pump energy needed to meet total load
   14742             :     //  because that total load has to include pump energy
   14743        4044 :     if (AtPartLoad) {
   14744        7287 :         for (Iter = 1; Iter <= 10; ++Iter) {
   14745        7287 :             if (TotalLoad <= 0.0) {
   14746             :                 // Load on secondary loop is zero (or negative).
   14747             :                 // Set volumetric flow rate and pump power to be zero.
   14748           0 :                 VolFlowRate = 0.0;
   14749           0 :                 TotalPumpPower = 0.0;
   14750           0 :                 break;
   14751             :             }
   14752        7287 :             PrevTotalLoad = TotalLoad;
   14753        7287 :             if (this->FluidType == SecFluidType::AlwaysLiquid) {
   14754        4113 :                 FlowVolNeeded = TotalLoad / this->HeatExchangeEta / (CpBrine * DensityBrine * (TBrineIn - this->TEvapDesign));
   14755        4113 :                 PartLdFrac = FlowVolNeeded / this->MaxVolFlow;
   14756             :             } else {
   14757        3174 :                 PartLdFrac = TotalLoad / this->MaxLoad;
   14758             :             }
   14759        7287 :             if (this->PumpControlType == SecPumpCtrl::Constant) {
   14760        4113 :                 VolFlowRate = 0.0;
   14761        4113 :                 TotalPumpPower = 0.0;
   14762       10022 :                 for (int PumpID = 1; PumpID <= this->NumPumps; ++PumpID) { // dispatch pumps to meet needed flow rate
   14763       10022 :                     if (this->FluidType == SecFluidType::AlwaysLiquid) {   //>>>>>>>>>>>>>>>>>>>>>
   14764       10022 :                         VolFlowRate += this->PumpIncrementFlowVol;
   14765       10022 :                         TotalPumpPower += this->PumpIncrementPower;
   14766       10022 :                         if (VolFlowRate >= FlowVolNeeded) break;
   14767             :                     } else { // fluid type phase change >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
   14768           0 :                         VolFlowRate += this->PumpIncrementFlowVol;
   14769           0 :                         TotalPumpPower += this->PumpIncrementPower;
   14770           0 :                         PartPumpFrac = TotalPumpPower / this->PumpTotRatedPower;
   14771           0 :                         if (PartPumpFrac >= PartLdFrac) break;
   14772             :                     } // fluid type              >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
   14773             :                 }     // Dispatching pumps until fluid flow need is met
   14774             :             } else {  // pump type variable
   14775        3174 :                 VarFrac = max(0.1, Curve::CurveValue(state, this->VarSpeedCurvePtr, PartLdFrac));
   14776        3174 :                 TotalPumpPower = this->PumpTotRatedPower * VarFrac;
   14777        3174 :                 VolFlowRate = this->MaxVolFlow * PartLdFrac;
   14778             :             } // pump type
   14779             : 
   14780        7287 :             TotalLoad = RefrigerationLoad + distPipeHeatGain + receiverHeatGain + TotalPumpPower * this->PumpPowerToHeat;
   14781        7287 :             Error = std::abs((TotalLoad - PrevTotalLoad) / PrevTotalLoad);
   14782        7287 :             if (Error < ErrorTol) break;
   14783             :         } // end iteration on pump energy convergence
   14784             : 
   14785             :         //   IF (Iter >=10 .AND. .NOT. WarmupFlag)THEN
   14786             :         //     If( .not. WarmupFlag) Then
   14787             :         //      Write(OutputFileDebug,707)Month, DataGlobals::CurrentTime, Iter, TotalLoad, TotalPumpPower
   14788             :         //     End If
   14789             :         // 707 format(' in iter loop at 707: ',1x,I2,1x,F5.2,1x,I5,7(F10.5,1x))
   14790             :         //    END IF  !didn't converge
   14791             :     } //(AtPartLoad)
   14792             : 
   14793             :     // If only loads are cases and walk-ins, that is, no air coils:
   14794             :     //  Account for difference between load and capacity on secondary loop. Assume system able to provide
   14795             :     //  rated capacity.  If it can't, that unmet energy will be stored and discharged at the system level.
   14796             :     //  Meet current load to the extent possible.  If extra capacity available,
   14797             :     //  apply it to previously unmet/stored loads.  If capacity less than current load,
   14798             :     //  (e.g. as it may be following defrost cycles on cases or walk-ins served by secondary loop)
   14799             :     //  save the unmet/stored load to be met in succeeding time steps.
   14800        4044 :     if (this->NumCoils == 0) {
   14801        4044 :         StoredEnergyRate = max(0.0, (this->UnmetEnergy / state.dataGlobal->TimeStepZone / DataGlobalConstants::SecInHour));
   14802             :         // Load necessary to meet current and all stored energy needs (W)
   14803        4044 :         Real64 LoadRequested = TotalLoad + StoredEnergyRate;
   14804        4044 :         if (this->MaxLoad > LoadRequested) {
   14805             :             // Have at least as much capacity avail as needed, even counting stored energy
   14806        4030 :             this->TotalCoolingLoad = LoadRequested;
   14807        4030 :             RefrigerationLoad += StoredEnergyRate;
   14808        4030 :             this->UnmetEnergy = 0.0;
   14809             :         } else {
   14810             :             // Don't have as much capacity as needed (likely following defrost periods)
   14811          14 :             this->TotalCoolingLoad = this->MaxLoad;
   14812          14 :             RefrigerationLoad -= (TotalLoad - this->MaxLoad);
   14813          14 :             if (!state.dataGlobal->WarmupFlag) this->UnmetEnergy += ((TotalLoad - this->MaxLoad) * state.dataGlobal->TimeStepZoneSec);
   14814             :         } // load requested greater than MaxLoad
   14815        4044 :         if (this->UnmetEnergy > MyLargeNumber) {
   14816           0 :             this->UnmetEnergy = MyLargeNumber;
   14817           0 :             if (state.dataRefrigCase->ShowUnmetSecondEnergyWarning(SecondaryNum)) {
   14818           0 :                 ShowWarningError(state, "Secondary Refrigeration Loop: " + this->Name);
   14819           0 :                 ShowContinueError(state, " This secondary system has insufficient capacity to meet the refrigeration loads.");
   14820           0 :                 state.dataRefrigCase->ShowUnmetSecondEnergyWarning(SecondaryNum) = false;
   14821             :             }
   14822             :         } //>my large number
   14823             : 
   14824             :     } else { // air coils on secondary loop, no "unmet" energy accounting, just reduce amount of cooling provided to zone by coils
   14825           0 :         DeRate = false;
   14826           0 :         if (TotalLoad > this->MaxLoad) DeRate = true;
   14827           0 :         FinalRateCoils(
   14828             :             state, DeRate, SourceType::SecondarySystem, SecondaryNum, TotalLoad, this->MaxLoad); // assign case credits for coils on this loop
   14829             :         // Bug TotalCoolingLoad not set but used below
   14830             :     } // no air coils on secondary loop
   14831        4044 :     this->PumpPowerTotal = TotalPumpPower;
   14832        4044 :     this->PumpElecEnergyTotal = TotalPumpPower * LocalTimeStep * DataGlobalConstants::SecInHour;
   14833        4044 :     this->TotalRefrigLoad = RefrigerationLoad;
   14834        4044 :     this->TotalRefrigEnergy = RefrigerationLoad * LocalTimeStep * DataGlobalConstants::SecInHour;
   14835        4044 :     this->TotalCoolingEnergy = TotalCoolingLoad * LocalTimeStep * DataGlobalConstants::SecInHour;
   14836        4044 :     this->FlowVolActual = VolFlowRate;
   14837        4044 :     this->HotDefrostCondCredit = TotalHotDefrostCondCredit;
   14838        4044 :     this->DistPipeHeatGain = distPipeHeatGain;
   14839        4044 :     this->DistPipeHeatGainEnergy = distPipeHeatGain * LocalTimeStep * DataGlobalConstants::SecInHour;
   14840        4044 :     this->ReceiverHeatGain = receiverHeatGain;
   14841        4044 :     this->ReceiverHeatGainEnergy = receiverHeatGain * LocalTimeStep * DataGlobalConstants::SecInHour;
   14842        4044 : }
   14843             : 
   14844      590977 : void SumZoneImpacts(EnergyPlusData &state)
   14845             : {
   14846             : 
   14847             :     // SUBROUTINE INFORMATION:
   14848             :     //       AUTHOR         Therese Stovall, ORNL
   14849             :     //       DATE WRITTEN   Spring 2010
   14850             :     //       RE-ENGINEERED  na
   14851             : 
   14852             :     // PURPOSE OF THIS SUBROUTINE:
   14853             :     // Find the total impact of all refrigeration systems on each zone.
   14854             : 
   14855             :     // METHODOLOGY EMPLOYED:
   14856             :     // Calculate the energy from refrigerated case credits arising from interaction between the zone and:
   14857             :     //   refrigerated cases and walk-ins
   14858             :     //   heat rejection from zone-located compressor-racks and zone-located air-cooled condensers
   14859             :     //   heat absorbed by suction piping, secondary loop distribution piping, and
   14860             :     //   secondary receiver shells
   14861             : 
   14862      590977 :     auto &CoilSysCredit(state.dataRefrigCase->CoilSysCredit);
   14863      590977 :     auto &CaseWIZoneReport(state.dataRefrigCase->CaseWIZoneReport);
   14864             : 
   14865      590977 :     if (state.dataRefrigCase->UseSysTimeStep) { // air chillers
   14866     5297325 :         for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) {
   14867     4944170 :             CoilSysCredit(ZoneNum).ReportH2ORemovedKgPerS_FromZoneRate = -CoilSysCredit(ZoneNum).LatKgPerS_ToZoneRate;
   14868     4944170 :             CoilSysCredit(ZoneNum).ReportLatCreditToZoneRate = -CoilSysCredit(ZoneNum).LatCreditToZoneRate;
   14869     4944170 :             CoilSysCredit(ZoneNum).ReportLatCreditToZoneEnergy = -CoilSysCredit(ZoneNum).LatCreditToZoneEnergy;
   14870             :             // Sensible rate can be positive or negative, split into separate output variables and
   14871             :             //   always report positive value
   14872     4944170 :             if (CoilSysCredit(ZoneNum).SenCreditToZoneRate <= 0.0) {
   14873     4552889 :                 CoilSysCredit(ZoneNum).ReportSenCoolingToZoneRate = -CoilSysCredit(ZoneNum).SenCreditToZoneRate;
   14874     4552889 :                 CoilSysCredit(ZoneNum).ReportSenCoolingToZoneEnergy = -CoilSysCredit(ZoneNum).SenCreditToZoneEnergy;
   14875     4552889 :                 CoilSysCredit(ZoneNum).ReportHeatingToZoneRate = 0.0;
   14876     4552889 :                 CoilSysCredit(ZoneNum).ReportHeatingToZoneEnergy = 0.0;
   14877             :             } else {
   14878      391281 :                 CoilSysCredit(ZoneNum).ReportSenCoolingToZoneRate = 0.0;
   14879      391281 :                 CoilSysCredit(ZoneNum).ReportSenCoolingToZoneEnergy = 0.0;
   14880      391281 :                 CoilSysCredit(ZoneNum).ReportHeatingToZoneRate = CoilSysCredit(ZoneNum).SenCreditToZoneRate;
   14881      391281 :                 CoilSysCredit(ZoneNum).ReportHeatingToZoneEnergy = -CoilSysCredit(ZoneNum).SenCreditToZoneEnergy;
   14882             :             }
   14883     4944170 :             CoilSysCredit(ZoneNum).ReportTotCoolingToZoneRate =
   14884     4944170 :                 CoilSysCredit(ZoneNum).ReportLatCreditToZoneRate + CoilSysCredit(ZoneNum).ReportSenCoolingToZoneRate;
   14885     4944170 :             CoilSysCredit(ZoneNum).ReportTotCoolingToZoneEnergy =
   14886     4944170 :                 CoilSysCredit(ZoneNum).ReportLatCreditToZoneEnergy + CoilSysCredit(ZoneNum).ReportSenCoolingToZoneEnergy;
   14887             :         }
   14888             :     } // UseSysTimeStep signals run for air chillers
   14889             : 
   14890             :     // Can arrive here when load call to refrigeration looks for cases/walkin systems and usetimestep is .FALSE.
   14891     1066621 :     if ((!state.dataRefrigCase->UseSysTimeStep) &&
   14892      237822 :         ((state.dataRefrigCase->NumSimulationCases > 0) || (state.dataRefrigCase->NumSimulationWalkIns > 0))) {
   14893     4791398 :         for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) {
   14894     4553576 :             CaseWIZoneReport(ZoneNum).SenCaseCreditToZoneEnergy =
   14895     4553576 :                 state.dataHeatBal->RefrigCaseCredit(ZoneNum).SenCaseCreditToZone * state.dataGlobal->TimeStepZoneSec;
   14896             :             // Latent always negative
   14897     4553576 :             CaseWIZoneReport(ZoneNum).LatCoolingToZoneRate = -state.dataHeatBal->RefrigCaseCredit(ZoneNum).LatCaseCreditToZone;
   14898     4553576 :             CaseWIZoneReport(ZoneNum).LatCoolingToZoneEnergy = CaseWIZoneReport(ZoneNum).LatCoolingToZoneRate * state.dataGlobal->TimeStepZoneSec;
   14899             :             // Sensible rate can be positive or negative, split into separate output variables and
   14900             :             //   always report positive value
   14901     4553576 :             if (state.dataHeatBal->RefrigCaseCredit(ZoneNum).SenCaseCreditToZone <= 0.0) {
   14902     4479230 :                 CaseWIZoneReport(ZoneNum).SenCoolingToZoneRate = -state.dataHeatBal->RefrigCaseCredit(ZoneNum).SenCaseCreditToZone;
   14903     4479230 :                 CaseWIZoneReport(ZoneNum).SenCoolingToZoneEnergy =
   14904     4479230 :                     -state.dataHeatBal->RefrigCaseCredit(ZoneNum).SenCaseCreditToZone * state.dataGlobal->TimeStepZoneSec;
   14905     4479230 :                 CaseWIZoneReport(ZoneNum).HeatingToZoneRate = 0.0;
   14906     4479230 :                 CaseWIZoneReport(ZoneNum).HeatingToZoneEnergy = 0.0;
   14907             :             } else {
   14908       74346 :                 CaseWIZoneReport(ZoneNum).SenCoolingToZoneRate = 0.0;
   14909       74346 :                 CaseWIZoneReport(ZoneNum).SenCoolingToZoneEnergy = 0.0;
   14910       74346 :                 CaseWIZoneReport(ZoneNum).HeatingToZoneRate = state.dataHeatBal->RefrigCaseCredit(ZoneNum).SenCaseCreditToZone;
   14911       74346 :                 CaseWIZoneReport(ZoneNum).HeatingToZoneEnergy =
   14912       74346 :                     state.dataHeatBal->RefrigCaseCredit(ZoneNum).SenCaseCreditToZone * state.dataGlobal->TimeStepZoneSec;
   14913             :             }
   14914     4553576 :             CaseWIZoneReport(ZoneNum).TotCoolingToZoneRate =
   14915     4553576 :                 CaseWIZoneReport(ZoneNum).SenCoolingToZoneRate + CaseWIZoneReport(ZoneNum).LatCoolingToZoneRate;
   14916     4553576 :             CaseWIZoneReport(ZoneNum).TotCoolingToZoneEnergy =
   14917     4553576 :                 CaseWIZoneReport(ZoneNum).SenCoolingToZoneEnergy + CaseWIZoneReport(ZoneNum).LatCoolingToZoneEnergy;
   14918     4553576 :             CaseWIZoneReport(ZoneNum).TotHtXferToZoneRate =
   14919     4553576 :                 state.dataHeatBal->RefrigCaseCredit(ZoneNum).SenCaseCreditToZone + state.dataHeatBal->RefrigCaseCredit(ZoneNum).LatCaseCreditToZone;
   14920     4553576 :             CaseWIZoneReport(ZoneNum).TotHtXferToZoneEnergy = CaseWIZoneReport(ZoneNum).TotHtXferToZoneRate * state.dataGlobal->TimeStepZoneSec;
   14921             :         } // over zones for cases and walkins
   14922             :     }
   14923      590977 : }
   14924             : 
   14925     3391780 : void CheckRefrigerationInput(EnergyPlusData &state)
   14926             : {
   14927             : 
   14928             :     // SUBROUTINE INFORMATION:
   14929             :     //       AUTHOR         Linda Lawrie
   14930             :     //       DATE WRITTEN   Sep 2010 - mining function
   14931             :     //       MODIFIED       na
   14932             :     //       RE-ENGINEERED  na
   14933             : 
   14934             :     // PURPOSE OF THIS SUBROUTINE:
   14935             :     // Provides the structure to get Refrigeration input so that
   14936             :     // it can be called from internally or outside the module.
   14937             : 
   14938     3391780 :     if (state.dataRefrigCase->GetRefrigerationInputFlag) {
   14939             : 
   14940         771 :         GetRefrigerationInput(state);
   14941         771 :         SetupReportInput(state);
   14942         771 :         state.dataRefrigCase->GetRefrigerationInputFlag = false;
   14943             : 
   14944         771 :         if ((!state.dataRefrigCase->HaveCasesOrWalkins) && (!state.dataRefrigCase->HaveChillers)) {
   14945         735 :             state.dataRefrigCase->ManageRefrigeration = false;
   14946         735 :             return;
   14947             :         }
   14948          36 :         if ((!state.dataRefrigCase->HaveDetailedRefrig) && (!state.dataRefrigCase->HaveRefrigRacks) &&
   14949           0 :             (!state.dataRefrigCase->HaveDetailedTransRefrig)) {
   14950           0 :             state.dataRefrigCase->ManageRefrigeration = false;
   14951           0 :             return;
   14952             :         }
   14953             :     } // GetRefrigerationInputFlag
   14954             : }
   14955             : 
   14956      353160 : void SimAirChillerSet(EnergyPlusData &state,
   14957             :                       std::string const &AirChillerSetName,
   14958             :                       int const ZoneNum,
   14959             :                       bool const FirstHVACIteration,
   14960             :                       Real64 &SysOutputProvided,
   14961             :                       Real64 &LatOutputProvided,
   14962             :                       int &AirChillerSetPtr // from ZoneEquipList(CurZoneEqNum)%EquipIndex(EquipPtr)
   14963             : )
   14964             : {
   14965             : 
   14966             :     // SUBROUTINE INFORMATION:
   14967             :     //       AUTHOR         Therese Stovall, ORNL
   14968             :     //       DATE WRITTEN   January 2011
   14969             :     //       MODIFIED       na
   14970             :     //       RE-ENGINEERED  na
   14971             : 
   14972             :     // PURPOSE OF THIS SUBROUTINE:
   14973             :     // Transfers the load requested from the zone to the refrigeration module.
   14974             :     // The load is met, partially met, or not met in the call to the detailed system solution
   14975             :     // METHODOLOGY EMPLOYED:
   14976             :     // Called from Zone Equipment Manager.
   14977             : 
   14978      353160 :     auto &AirChillerSet(state.dataRefrigCase->AirChillerSet);
   14979      353160 :     auto &CoilSysCredit(state.dataRefrigCase->CoilSysCredit);
   14980             : 
   14981             :     int ChillerSetID;
   14982             :     Real64 RemainingOutputToCoolingSP; // Remaining requested load in zone
   14983             : 
   14984      353160 :     CheckRefrigerationInput(state);
   14985             : 
   14986             :     // Find the correct Chiller set
   14987      353160 :     if (AirChillerSetPtr == 0) {
   14988          10 :         ChillerSetID = UtilityRoutines::FindItemInList(AirChillerSetName, AirChillerSet);
   14989          10 :         if (ChillerSetID == 0) {
   14990           0 :             ShowFatalError(state, "SimAirChillerSet: Unit not found=" + AirChillerSetName);
   14991             :         } // chillersetid ==0 because not in list
   14992          10 :         AirChillerSetPtr = ChillerSetID;
   14993             :     } else { // airchllersetpointer passed in call to subroutine not ==0
   14994      353150 :         ChillerSetID = AirChillerSetPtr;
   14995      353150 :         if (ChillerSetID > state.dataRefrigCase->NumRefrigChillerSets || ChillerSetID < 1) {
   14996           0 :             ShowFatalError(state,
   14997           0 :                            format("SimAirChillerSet:  Invalid AirChillerSetPtr passed={}, Number of Units={}, Entered Unit name={}",
   14998             :                                   ChillerSetID,
   14999           0 :                                   state.dataRefrigCase->NumRefrigChillerSets,
   15000           0 :                                   AirChillerSetName));
   15001             :         } // ChillerSetID makes no sense
   15002      353150 :         if (state.dataRefrigCase->CheckChillerSetName(ChillerSetID)) {
   15003          10 :             if (AirChillerSetName != AirChillerSet(ChillerSetID).Name) {
   15004           0 :                 ShowFatalError(state,
   15005           0 :                                format("SimAirChillerSet:  Invalid AirChillerSetPtr passed={}, Unit name={}, stored Unit Name for that index={}",
   15006             :                                       ChillerSetID,
   15007             :                                       AirChillerSetName,
   15008           0 :                                       AirChillerSet(ChillerSetID).Name));
   15009             :             } // name not equal correct name
   15010          10 :             state.dataRefrigCase->CheckChillerSetName(ChillerSetID) = false;
   15011             :         } // CheckChillerSetName logical test
   15012             :     }     //(AirChillerSetPtr == 0 or else not == 0
   15013             : 
   15014      353160 :     if (FirstHVACIteration) {
   15015     1942710 :         for (ChillerSetID = 1; ChillerSetID <= state.dataRefrigCase->NumRefrigChillerSets;
   15016             :              ++ChillerSetID) { // bbb what point of do loop, only set one (airchillersetptr) to zero
   15017     1766100 :             AirChillerSet(AirChillerSetPtr).QZnReqSens = 0.0;
   15018             :         }
   15019             :     } // FirstHVACIteration
   15020             : 
   15021      353160 :     RemainingOutputToCoolingSP = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).RemainingOutputReqToCoolSP;
   15022             :     // RemainingOutputToCoolingSP in Watts, < 0 for cooling demand
   15023             : 
   15024      353160 :     if (RemainingOutputToCoolingSP < 0.0 && state.dataHeatBalFanSys->TempControlType(ZoneNum) != DataHVACGlobals::ThermostatType::SingleHeating) {
   15025      288805 :         AirChillerSet(AirChillerSetPtr).QZnReqSens = RemainingOutputToCoolingSP;
   15026             :     } else {
   15027       64355 :         AirChillerSet(AirChillerSetPtr).QZnReqSens = 0.0;
   15028             :     }
   15029             : 
   15030      353160 :     state.dataRefrigCase->UseSysTimeStep = true;
   15031             : 
   15032      353160 :     ManageRefrigeratedCaseRacks(state);
   15033             : 
   15034      353160 :     state.dataRefrigCase->UseSysTimeStep = false;
   15035             : 
   15036             :     // Return values to Zone Equipment Manager.
   15037      353160 :     LatOutputProvided = CoilSysCredit(ZoneNum).LatKgPerS_ToZoneRate;
   15038      353160 :     SysOutputProvided = CoilSysCredit(ZoneNum).SenCreditToZoneRate;
   15039      353160 : }
   15040             : 
   15041     3531550 : void AirChillerSetData::CalculateAirChillerSets(EnergyPlusData &state)
   15042             : {
   15043             : 
   15044             :     // SUBROUTINE INFORMATION:
   15045             :     //       AUTHOR         Therese Stovall, ORNL
   15046             :     //       DATE WRITTEN   January 2011
   15047             :     //       MODIFIED       na
   15048             :     //       RE-ENGINEERED  na
   15049             : 
   15050             :     // PURPOSE OF THIS SUBROUTINE:
   15051             :     // Transfers the load requested from the zone to the refrigeration module.
   15052             :     // The load is met, partially met, or not met in the next time step when the refrigerated case
   15053             :     // module is called via case credits. Therefore, by definition, the sensible and latent
   15054             :     // output provided are zero.
   15055             :     // METHODOLOGY EMPLOYED:
   15056             :     // Called from Zone Equipment Manager.
   15057             :     //       have however done the variable definitions for in and out.
   15058             : 
   15059     3531550 :     Real64 AirChillerSetSchedule(0.0); // Schedule value for air chiller SET
   15060     3531550 :     Real64 QZNReqSens(0.0);            // Amount of sensible heat needed by the zone, NEGATIVE when cooling needed [W]
   15061     3531550 :     Real64 RemainQZNReqSens(0.0);      // Remaining amount of sensible heat needed by the zone [W]
   15062             : 
   15063     3531550 :     auto &WarehouseCoil(state.dataRefrigCase->WarehouseCoil);
   15064             : 
   15065             :     // Note, all coils in a coil set are in the same zone
   15066             :     // the coils may be served by different detailed systems
   15067             :     // The coils are dispatched to meet the load specified in the previous time step in order listed in coilset object
   15068     3531550 :     AirChillerSetSchedule = ScheduleManager::GetCurrentScheduleValue(state, this->SchedPtr);
   15069             : 
   15070     3531550 :     if (AirChillerSetSchedule <= 0.0) return;
   15071     3531550 :     QZNReqSens = this->QZnReqSens;
   15072     3531550 :     RemainQZNReqSens = QZNReqSens;
   15073             : 
   15074    32843415 :     for (int CoilIndex = 1; CoilIndex <= this->NumCoils; ++CoilIndex) {
   15075    29311865 :         int CoilID = this->CoilNum(CoilIndex);
   15076             : 
   15077    29311865 :         WarehouseCoil(CoilID).CalculateCoil(state, RemainQZNReqSens);
   15078    29311865 :         RemainQZNReqSens += WarehouseCoil(CoilID).SensCreditRate;
   15079             :         // should be a negative minus a negative, so a smaller negative, that is, going toward zero, but senscoolingenergyrate expressed as
   15080             :         // positive  Need to go over all the coils so that the defrosts occur on schedule, even when the chiller isn't called for at that
   15081             :         // particular time step  IF(RemainQZNReqSens >=0.0d0)EXIT  !shouldn't be > 0 because limited by request in calculatecoil
   15082    29311865 :         if (RemainQZNReqSens > 0.0) RemainQZNReqSens = 0.0;
   15083             :     } // CoilIndex
   15084             : }
   15085             : 
   15086       91454 : void FinalRateCoils(EnergyPlusData &state,
   15087             :                     bool const DeRate,                 // True if compressor rack or secondary ht exchanger unable to provide capacity
   15088             :                     SourceType const SystemSourceType, // Secondarysystem or DetailedSystem
   15089             :                     int const SystemID,                // ID for Secondary loop or detailed system calling for derate
   15090             :                     Real64 const InitialTotalLoad,     // Load on system or secondary loop as initially calculated [W]
   15091             :                     Real64 const AvailableTotalLoad    // Load that system or secondary loop is able to serve [W]
   15092             : )
   15093             : {
   15094             : 
   15095             :     // SUBROUTINE INFORMATION:
   15096             :     //       AUTHOR         Therese Stovall, ORNL
   15097             :     //       DATE WRITTEN   January 2011
   15098             :     //       MODIFIED       na
   15099             :     //       RE-ENGINEERED  na
   15100             : 
   15101             :     // PURPOSE OF THIS SUBROUTINE:
   15102             :     // When compressor system, or secondary loop capacity is insufficient to meet coil loads
   15103             :     //   Come back here and derate the coil case credits to show unmet load impact
   15104             :     //   Note that the coil fan, heater, and defrost would be unaffected because they
   15105             :     //   would still be running at level calculated previously
   15106             : 
   15107       91454 :     auto &System(state.dataRefrigCase->System);
   15108       91454 :     auto &WarehouseCoil(state.dataRefrigCase->WarehouseCoil);
   15109             : 
   15110       91454 :     int NumCoils(0);
   15111       91454 :     Real64 DeRateFactor(0.0);        // Ratio of energy available from system or secondary loop
   15112       91454 :     Real64 InitLatCreditEnergy(0.0); // Latent credit energy before derate [W]
   15113       91454 :     Real64 FrostReduction(0.0);      // Change in frost on coils based on derated latent load [kg]
   15114             : 
   15115             :     {
   15116       91454 :         switch (SystemSourceType) {
   15117       91454 :         case SourceType::DetailedSystem:
   15118       91454 :             NumCoils = System(SystemID).NumCoils;
   15119       91454 :             break;
   15120           0 :         case SourceType::SecondarySystem:
   15121           0 :             NumCoils = state.dataRefrigCase->Secondary(SystemID).NumCoils;
   15122           0 :             break;
   15123           0 :         default:
   15124           0 :             assert(false);
   15125             :         }
   15126             :     } // DeRateCoils
   15127             : 
   15128       91454 :     if (DeRate) {
   15129      365816 :         ShowRecurringWarningErrorAtEnd(
   15130             :             state,
   15131      182908 :             "Refrigeration:System chilling WarehouseCoils " + System(SystemID).Name +
   15132             :                 " - Refrigeration system unable to meet load of warehouse coils chilled by system ... continues by derating coil load",
   15133       91454 :             System(SystemID).InsuffCapWarn);
   15134             : 
   15135       91454 :         DeRateFactor = AvailableTotalLoad / InitialTotalLoad;
   15136       91454 :         Real64 const time_step_sec(state.dataHVACGlobal->TimeStepSys * DataGlobalConstants::SecInHour);
   15137     1127583 :         for (int CoilIndex = 1; CoilIndex <= NumCoils; ++CoilIndex) {
   15138     1036129 :             int CoilID = System(SystemID).CoilNum(CoilIndex);
   15139     1036129 :             auto &warehouse_coil(WarehouseCoil(CoilID));
   15140             : 
   15141             :             // need to adjust ice on coil due to reduction in latent load met by coil
   15142     1036129 :             InitLatCreditEnergy = warehouse_coil.LatCreditEnergy;
   15143             : 
   15144     1036129 :             warehouse_coil.TotalCoolingLoad *= DeRateFactor;
   15145     1036129 :             warehouse_coil.TotalCoolingEnergy *= DeRateFactor;
   15146     1036129 :             warehouse_coil.SensCoolingEnergyRate *= DeRateFactor;
   15147     1036129 :             warehouse_coil.SensCoolingEnergy *= DeRateFactor;
   15148     1036129 :             warehouse_coil.LatCreditRate *= DeRateFactor;
   15149     1036129 :             warehouse_coil.LatCreditEnergy *= DeRateFactor;
   15150     1036129 :             warehouse_coil.LatKgPerS_ToZone *= DeRateFactor;
   15151     2072258 :             warehouse_coil.SensCreditRate = warehouse_coil.SensCoolingEnergyRate - warehouse_coil.ElecFanPower - warehouse_coil.ElecHeaterPower -
   15152     1036129 :                                             warehouse_coil.ThermalDefrostPower;
   15153     1036129 :             warehouse_coil.SensCreditEnergy = warehouse_coil.SensCreditRate * time_step_sec;
   15154             : 
   15155     1036129 :             FrostReduction = (InitLatCreditEnergy - warehouse_coil.LatCreditEnergy) / IcetoVaporEnthalpy;
   15156     1036129 :             warehouse_coil.KgFrost = max(0.0, warehouse_coil.KgFrost - FrostReduction);
   15157             : 
   15158     1036129 :             if (warehouse_coil.SensCreditRate >= 0.0) {
   15159      826498 :                 warehouse_coil.ReportSensCoolCreditRate = warehouse_coil.SensCreditRate;
   15160      826498 :                 warehouse_coil.ReportHeatingCreditRate = 0.0;
   15161             :             } else {
   15162      209631 :                 warehouse_coil.ReportSensCoolCreditRate = 0.0;
   15163      209631 :                 warehouse_coil.ReportHeatingCreditRate = -warehouse_coil.SensCreditRate;
   15164             :             }
   15165     1036129 :             warehouse_coil.ReportSensCoolCreditEnergy = warehouse_coil.ReportSensCoolCreditRate * time_step_sec;
   15166     1036129 :             warehouse_coil.ReportHeatingCreditEnergy = warehouse_coil.ReportHeatingCreditRate * time_step_sec;
   15167     1036129 :             warehouse_coil.ReportTotalCoolCreditRate = warehouse_coil.ReportSensCoolCreditRate + warehouse_coil.LatCreditRate;
   15168     1036129 :             warehouse_coil.ReportTotalCoolCreditEnergy = warehouse_coil.ReportSensCoolCreditEnergy + warehouse_coil.LatCreditEnergy;
   15169             :         }
   15170             :     } // DeRate == true
   15171       91454 : }
   15172             : 
   15173    29311865 : void WarehouseCoilData::CalculateCoil(EnergyPlusData &state, Real64 const QZnReq)
   15174             : {
   15175             : 
   15176             :     // SUBROUTINE INFORMATION:
   15177             :     //       AUTHOR         Therese Stovall, ORNL
   15178             :     //       DATE WRITTEN   January 2011
   15179             :     //       MODIFIED       na
   15180             :     //       RE-ENGINEERED  na
   15181             : 
   15182             :     // PURPOSE OF THIS SUBROUTINE:
   15183             :     // Simulates the refrigerated warehouse coil object.
   15184             :     // Note QZnReq < 0 corresponds to cooling needed
   15185             : 
   15186             :     // METHODOLOGY EMPLOYED:
   15187             :     // Called from Calculate Air Chiller Set.
   15188             :     // Air chillers are used to model the type of equipment typically used in
   15189             :     // refrigerated warehouses. For that reason, there is a major difference
   15190             :     // between the air chiller model and those for refrigerated cases or walk-ins.
   15191             :     // For cases and walk-ins, a portion of the model is directed toward
   15192             :     // calculating the amount of refrigeration needed to maintain the refrigerated
   15193             :     // volume at the desired temperature due to heat exchange with the surrounding
   15194             :     // zone, and that zone is conditioned to a nearly constant temperature.
   15195             :     // In a refrigerated warehouse, the refrigeration load is caused by heat exchange
   15196             :     // with a variable external environment.  For that reason, the loads for these
   15197             :     // zones are calculated by the usual EnergyPlus zone heat balance.
   15198             :     // The amount of refrigeration needed to maintain the specified temperature
   15199             :     // setpoints is then passed to the air chiller model, in a similar fashion
   15200             :     // to the load passed to a window air conditioner model. The air chillers
   15201             :     // are therefore solved using the system time step, not the zone time step
   15202             :     // used for cases and walk-ins.
   15203             :     // The air chiller performance is based on three types of manufacturers ratings,
   15204             :     // Unit Load Factor, Total Capacity Map, or a set of European standards.
   15205             :     // Correction factors for material and refrigerant are applied to all of these ratings.
   15206             : 
   15207             :     static constexpr std::string_view TrackMessage("from RefrigeratedCase:CalculateCoil");
   15208             : 
   15209    29311865 :     Real64 CoilSchedule = ScheduleManager::GetCurrentScheduleValue(state, this->SchedPtr); // Current value of Coil operating (availability) schedule
   15210    29311865 :     if (CoilSchedule <= 0.0) return;
   15211             : 
   15212    21523449 :     Real64 DefrostSchedule = ScheduleManager::GetCurrentScheduleValue(state, this->DefrostSchedPtr); // Coil defrost schedule, between 0 and 1
   15213    21523449 :     Real64 DefrostDripDownSchedule = ScheduleManager::GetCurrentScheduleValue(
   15214    21523449 :         state, this->DefrostDripDownSchedPtr); // Coil drip-down schedule (allows coil to drain after defrost)
   15215             :     // next statement In case user doesn't understand concept of drip down schedule
   15216    21523449 :     DefrostDripDownSchedule = max(DefrostDripDownSchedule, DefrostSchedule);
   15217             :     // next value optional, so set to default before checking for schedule
   15218    21523449 :     Real64 HeaterSchedule = 1.0; // zero to one
   15219    21523449 :     if (this->HeaterSchedPtr > 0) HeaterSchedule = ScheduleManager::GetCurrentScheduleValue(state, this->HeaterSchedPtr);
   15220             : 
   15221             :     // Set local subroutine variables for convenience
   15222    21523449 :     auto FanSpeedControlType = this->FanType;
   15223    21523449 :     Real64 AirVolumeFlowRated = this->RatedAirVolumeFlow;   // Coil rated air flow (m3/s)
   15224    21523449 :     Real64 FanPowerRated = this->RatedFanPower;             // (W)
   15225    21523449 :     Real64 HeaterLoad = this->HeaterPower * HeaterSchedule; // Total heater (except defrost) energy rate (W)
   15226    21523449 :     Real64 DefrostCap = this->DefrostCapacity;              // Design defrost capacity of Coil (W)
   15227    21523449 :     Real64 TEvap = this->TEvapDesign;                       // Evaporating temperature in the coil (C)
   15228             : 
   15229    21523449 :     Real64 CoilCapTotEstimate(0.0); // Part of loop to solve for total coil capacity as a function of inlet air conditions (W)
   15230    21523449 :     Real64 AirVolumeFlowMax(0.0);   // Coil air flow limited by drip down schedule (m3/s)
   15231    21523449 :     Real64 CoilCapTotal(0.0);       // Sensible plus latent load (W)
   15232    21523449 :     Real64 CoilInletDensity(0.0);   // Coil air inlet density (kg/m3)
   15233    21523449 :     Real64 CoilInletDryAirCp(0.0);  // Dry air specific heat at coil inlet temperature (J/kg-C)
   15234    21523449 :     Real64 CoilInletHumRatio(0.0);  // Coil air inlet humidity ratio (kg water/kg air)
   15235    21523449 :     Real64 CoilInletTemp(0.0);      // Inlet temperature of air to coil, not mixed zone temperature unless "middle" location selected (C)
   15236    21523449 :     Real64 CoilInletEnthalpy(0.0);  // Coil inlet air enthalpy (J/kg)
   15237    21523449 :     Real64 CoilInletRHFrac(0.0);    // Coil inlet air relative humidity expressed as a fraction (0 to 1)
   15238    21523449 :     Real64 DefrostLoad(0.0);
   15239    21523449 :     Real64 DryAirMassFlowMax(0.0);      // Rated volume flow rate times dry air density adjusted for schedules (kg/s)
   15240    21523449 :     Real64 FanPowerActual(0.0);         // (W)
   15241    21523449 :     Real64 FrostChangekg(0.0);          // Amount of frost added or melted  (kg)
   15242    21523449 :     Real64 latLoadServed(0.0);          // Energy rate used to remove water from zone air (W)
   15243    21523449 :     Real64 SensLoadRequestedGross(0.0); // Gross sensible load removed by coil
   15244    21523449 :     Real64 SensLoadGross(0.0);          // Sensible load met by coil (W)
   15245    21523449 :     Real64 SHR(0.0);                    // Sensible heat ratio, sensible load/total load
   15246    21523449 :     Real64 SHRCorrection(0.0);          // Actual total/sensible load, NOT = Inverse SHR (unless coil efficiency = 1.0)
   15247    21523449 :     Real64 WaterRemovRate(0.0);         // Walk in cooler removes water at this rate in this zone (kg/s)
   15248             : 
   15249    21523449 :     if (DefrostDripDownSchedule == 1.0) {
   15250     2251300 :         AirVolumeFlowMax = 0.0;
   15251     2251300 :         DryAirMassFlowMax = 0.0;
   15252             :     } else { // DefrostDripDownSchedule < 1.0d0, cooling will occur at least part of the time step
   15253             :         // Sensible load requested by zone balance (W)
   15254    19272149 :         Real64 SensLoadRequested = -QZnReq; // here let cooling demand be positive within subroutine
   15255    19272149 :         if (SensLoadRequested <= 0.0) {     // No load so assume control keeps off, except that scheduled defrost still occurs
   15256     9838255 :             AirVolumeFlowMax = 0.0;
   15257     9838255 :             DryAirMassFlowMax = 0.0;
   15258             :         } else {
   15259     9433894 :             SensLoadRequestedGross = SensLoadRequested + HeaterLoad + FanPowerRated;
   15260     9433894 :             Real64 ZoneMixedAirDryBulb = state.dataLoopNodes->Node(this->ZoneNodeNum).Temp;    // (C)
   15261     9433894 :             Real64 ZoneMixedAirHumRatio = state.dataLoopNodes->Node(this->ZoneNodeNum).HumRat; // kg water/kg air in the zone mixed air
   15262             :             Real64 ZoneMixedAirRHFrac =
   15263     9433894 :                 Psychrometrics::PsyRhFnTdbWPb(state, ZoneMixedAirDryBulb, ZoneMixedAirHumRatio, state.dataEnvrn->OutBaroPress, TrackMessage);
   15264             :             Real64 ZoneMixedAirEnthalpy =
   15265     9433894 :                 Psychrometrics::PsyHFnTdbRhPb(state, ZoneMixedAirDryBulb, ZoneMixedAirRHFrac, state.dataEnvrn->OutBaroPress, TrackMessage);
   15266             :             Real64 ZoneMixedAirDensity =
   15267     9433894 :                 Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, ZoneMixedAirDryBulb, ZoneMixedAirHumRatio, TrackMessage);
   15268             :             Real64 ZoneDryAirDensity =
   15269     9433894 :                 Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, ZoneMixedAirDryBulb, 0.0, TrackMessage);
   15270     9433894 :             Real64 DryAirMassFlowRated = AirVolumeFlowRated * ZoneDryAirDensity;
   15271             :             // calc t inlet to coil assuming at middle/mixed point in room  bbb -
   15272             :             //    later need to do for hottest/coolest in room where Tin /= Tzonemixed
   15273             :             // calc RH inlet to coil assuming at middle/mixed point in room
   15274             :             // calc coilcap, sens and latent, available as f(inlet T,RH)
   15275     9433894 :             switch (this->VerticalLocation) {
   15276     9433894 :             case VerticalLoc::Floor:
   15277             :                 // purposely fall through
   15278             :             case VerticalLoc::Ceiling:
   15279             :                 // purposely fall through
   15280             :             case VerticalLoc::Middle:
   15281     9433894 :                 CoilInletTemp = ZoneMixedAirDryBulb;
   15282     9433894 :                 CoilInletEnthalpy = ZoneMixedAirEnthalpy;
   15283     9433894 :                 CoilInletRHFrac = ZoneMixedAirRHFrac;
   15284     9433894 :                 CoilInletDensity = ZoneMixedAirDensity;
   15285     9433894 :                 CoilInletHumRatio = ZoneMixedAirHumRatio;
   15286     9433894 :                 CoilInletDryAirCp = Psychrometrics::PsyCpAirFnW(0.0);
   15287     9433894 :                 break;
   15288           0 :             default:
   15289           0 :                 assert(false);
   15290             :             }
   15291     9433894 :             AirVolumeFlowMax = AirVolumeFlowRated * (1.0 - DefrostDripDownSchedule) * CoilSchedule;
   15292     9433894 :             DryAirMassFlowMax = DryAirMassFlowRated * (1.0 - DefrostDripDownSchedule) * CoilSchedule;
   15293             : 
   15294             :         } // Sens load requested is non-zero
   15295             :     }     // DefrostDripDownSchedule == 1.0d0
   15296             : 
   15297    21523449 :     if (AirVolumeFlowMax > 0.0) {
   15298             : 
   15299             :         Real64 TemperatureDif =
   15300     9433894 :             min(this->MaxTemperatureDif, (CoilInletTemp - TEvap)); // difference between inlet air and evaporating temperature (deltaC)
   15301             : 
   15302     9433894 :         if (this->ratingType == RatingType::RatedCapacityTotal) {
   15303             :             // RatingType = CapacityTotalSpecificConditions, will be doing a table lookup
   15304             :             //    based upon RHInlet, DT1, CoilInletTemperature - see excel files from B. Nelson, CoilCom
   15305             :             //    In the table, X1== inlet air dry bulb temperature
   15306             :             //                  X2== Difference between inlet T and evap T
   15307             :             //                  X3== RH expressed as decimal
   15308     1024425 :             CoilCapTotEstimate = Curve::CurveValue(state, this->SHRCorrectionCurvePtr, CoilInletTemp, TemperatureDif, CoilInletRHFrac) *
   15309      682950 :                                  this->RatedCapTotal * (1.0 - DefrostDripDownSchedule) * CoilSchedule;
   15310             : 
   15311             :         } else { // work with unit load factor (sensible only), function of DT1 (Tair in drybulb-Tevap)
   15312     9092419 :             Real64 SensibleCapacityMax = this->UnitLoadFactorSens * TemperatureDif * (1.0 - DefrostDripDownSchedule) *
   15313             :                                          CoilSchedule; // Sensible capacity adjusted for any time in dripdown state (W)
   15314             : 
   15315     9092419 :             if (SensibleCapacityMax > 0.0) {
   15316     9066999 :                 Real64 ExitTemperatureEstimate =
   15317     9066999 :                     CoilInletTemp - (SensibleCapacityMax / (DryAirMassFlowMax * CoilInletDryAirCp)); // Estimated Air temperature leaving the coil (C)
   15318     9066999 :                 if (ExitTemperatureEstimate <= TEvap) {
   15319           0 :                     ShowWarningError(state, std::string{TrackMessage} + "Refrigeration:AirCoil: " + this->Name);
   15320           0 :                     ShowContinueError(state, " The estimated air outlet temperature is less than the evaporating temperature.");
   15321             :                 }
   15322     9066999 :                 Real64 ExitEnthalpyEstimate = Psychrometrics::PsyHFnTdbRhPb(state,
   15323             :                                                                             ExitTemperatureEstimate,
   15324             :                                                                             1.0,
   15325     9066999 :                                                                             state.dataEnvrn->OutBaroPress,
   15326     9066999 :                                                                             TrackMessage); // Estimated Air enthalpy leaving the coil (J/kg)
   15327     9066999 :                 if (ExitEnthalpyEstimate <= CoilInletEnthalpy) {
   15328     6240953 :                     CoilCapTotEstimate = (CoilInletEnthalpy - ExitEnthalpyEstimate) * AirVolumeFlowMax * CoilInletDensity;
   15329             :                 } else {
   15330             :                     // Assume no water is extracted from flow
   15331     2826046 :                     ExitEnthalpyEstimate = Psychrometrics::PsyHFnTdbW(ExitTemperatureEstimate, CoilInletHumRatio);
   15332     2826046 :                     CoilCapTotEstimate = (CoilInletEnthalpy - ExitEnthalpyEstimate) * AirVolumeFlowMax * CoilInletDensity;
   15333             :                 }
   15334     9066999 :                 if (SensibleCapacityMax > CoilCapTotEstimate) SensibleCapacityMax = CoilCapTotEstimate;
   15335     9066999 :                 if (std::abs(CoilCapTotEstimate) > 0.0) {
   15336     9066259 :                     SHR = SensibleCapacityMax / (CoilCapTotEstimate);
   15337             :                 } else {
   15338             :                     // will occur whenever defrost or dripdown
   15339         740 :                     SHR = 0.0;
   15340             :                 }
   15341             : 
   15342     9066999 :                 switch (this->SHRCorrType) {
   15343     8892344 :                 case SHRCorrectionType::SHR60: {
   15344             :                     // line from y = SHRCorrection60 value to 1. as x(SHR) goes from .6 to 1, from B. Nelson, ASHRAE August 2010
   15345     8892344 :                     Real64 Slope = (this->SHRCorrection60 - 1.0) / (0.6 - 1.0); // Part of linear SHR60 correction factor, dimensionless
   15346     8892344 :                     Real64 Yint = this->SHRCorrection60 - (Slope * 0.6);        // Part of linear SHR60 correction factor, dimensionless
   15347     8892344 :                     SHRCorrection = Slope * SHR + Yint;
   15348     8892344 :                 } break;
   15349           0 :                 case SHRCorrectionType::QuadraticSHR: {
   15350           0 :                     SHRCorrection = Curve::CurveValue(state, this->SHRCorrectionCurvePtr, SHR);
   15351           0 :                 } break;
   15352      174655 :                 case SHRCorrectionType::European: {
   15353             :                     // With European ratings, either start with rated total sensible capacity or rated total capacity
   15354             :                     //    If rated total capacity is used, 'get input'
   15355             :                     //    translated it to rated total sensible capacity using
   15356             :                     //    PARAMETER ::EuropeanWetCoilFactor = (/1.35D0, 1.15D0,  1.05D0,  1.01D0,   1.0D0/)
   15357             :                     //    That sensible capacity rating was then turned to a rated UnitLoadFactor using
   15358             :                     //    the rated temperature difference. That sensible rating was also corrected
   15359             :                     //    for refrigerant and fin material in 'get input' and is given as UnitLoadFactor
   15360             :                     //  The total (sens + latent) capacity is equal to that * DT1 * WetCoilFactor(TcoilIn)
   15361             :                     //    Sensible capacity max already has DT1, just need WetCoilFactor(TcoilIn)
   15362             :                     // PARAMETER ::EuropeanWetCoilFactor = (/1.35D0, 1.15D0,  1.05D0,  1.01D0,   1.0D0/)
   15363             :                     // PARAMETER ::EuropeanAirInletTemp  = (/10.0D0,  0.0D0, -18.0D0, -25.0D0, -34.0D0/)
   15364             :                     // PARAMETER ::EuropeanEvapTemp      = (/ 0.0D0, -8.0D0, -25.0D0, -31.0D0, -40.0D0/)
   15365             :                     // PARAMETER ::EuropeanDT1           = (/10.0D0,  8.0D0,   7.0D0,   7.0D0,   6.0D0/)
   15366      174655 :                     if (CoilInletTemp <= -25.0) {
   15367           0 :                         SHRCorrection = 1.0;
   15368      174655 :                     } else if (CoilInletTemp > -25.0 && CoilInletTemp <= 0.0) {
   15369      398040 :                         SHRCorrection = (EuropeanWetCoilFactor[1] - EuropeanWetCoilFactor[3]) / (EuropeanAirInletTemp[1] - EuropeanAirInletTemp[3]) *
   15370      265360 :                                             (EuropeanAirInletTemp[1] - CoilInletTemp) +
   15371      132680 :                                         EuropeanWetCoilFactor[3];
   15372       41975 :                     } else if (CoilInletTemp > 0.0 && CoilInletTemp <= 5.0) {
   15373       27180 :                         SHRCorrection = (EuropeanWetCoilFactor[0] - EuropeanWetCoilFactor[1]) / (EuropeanAirInletTemp[0] - EuropeanAirInletTemp[1]) *
   15374       18120 :                                             (EuropeanAirInletTemp[0] - CoilInletTemp) +
   15375        9060 :                                         EuropeanWetCoilFactor[1];
   15376       32915 :                     } else if (CoilInletTemp > 5.0) {
   15377       32915 :                         SHRCorrection = EuropeanWetCoilFactor[0];
   15378             :                     } // calc correction as a function of coil inlet temperature
   15379      174655 :                 } break;
   15380           0 :                 default:
   15381           0 :                     break;
   15382             :                 }
   15383     9066999 :                 CoilCapTotEstimate = SHRCorrection * SensibleCapacityMax;
   15384             :             } else { // NOT (SensibleCapacityMax > 0.0d0)
   15385       25420 :                 CoilCapTotEstimate = 0.0;
   15386             :             } //  (SensibleCapacityMax > 0.0d0)
   15387             :         }     // Rating type : CapacityTotalSpecificConditions or Sensible Unit Load Factor
   15388             : 
   15389     9433894 :         if (CoilCapTotEstimate > 0.0) {
   15390     9407254 :             Real64 ExitEnthalpy =
   15391     9407254 :                 CoilInletEnthalpy - (CoilCapTotEstimate / (AirVolumeFlowMax * CoilInletDensity)); // Air enthalpy leaving the coil (J/kg)
   15392     9407254 :             Real64 ExitTemperature = Psychrometrics::PsyTsatFnHPb(
   15393    18814508 :                 state, ExitEnthalpy, state.dataEnvrn->OutBaroPress, TrackMessage); // RH =1.0 at Tsat // Air temperature leaving the coil (C)
   15394     9407254 :             Real64 ExitHumRatio = Psychrometrics::PsyWFnTdbH(state, ExitTemperature, ExitEnthalpy, TrackMessage); // kg water/kg air
   15395     9407254 :             if (ExitHumRatio > CoilInletHumRatio) ExitHumRatio = CoilInletHumRatio;
   15396     9407254 :             WaterRemovRate = DryAirMassFlowMax * (CoilInletHumRatio - ExitHumRatio);
   15397     9407254 :             latLoadServed = WaterRemovRate * IcetoVaporEnthalpy;
   15398     9407254 :             SensLoadGross = CoilCapTotEstimate - latLoadServed;
   15399     9407254 :             FanPowerActual = FanPowerRated;
   15400     9407254 :             if (SensLoadGross < 0.0) {
   15401             :                 // Could rarely happen during initial cooldown of a warm environment
   15402          58 :                 SensLoadGross = 0.0;
   15403          58 :                 latLoadServed = CoilCapTotEstimate;
   15404          58 :                 WaterRemovRate = latLoadServed / IcetoVaporEnthalpy;
   15405             :             }    // SensLoadGross < 0
   15406             :         } else { // NOT (SensibleCapacityMax > 0.0d0)
   15407       26640 :             WaterRemovRate = 0.0;
   15408       26640 :             latLoadServed = 0.0;
   15409       26640 :             SensLoadGross = 0.0;
   15410       26640 :             FanPowerActual = 0.0;
   15411             :         } //(CoilCapTotEstimate > 0.0d0)
   15412             : 
   15413     9433894 :         Real64 FanPowerMax = FanPowerRated * (1.0 - DefrostDripDownSchedule); // Total fan energy rate, limited by dripdown period (W)
   15414     9433894 :         if (SensLoadGross > SensLoadRequestedGross) {                         // part load operation
   15415             :             // don't need full chiller power, reduce fan speed to reduce air flow
   15416             :             // move fan to part power if need to
   15417     3698715 :             Real64 CapFac = SensLoadRequestedGross / SensLoadGross; // used to reduce fan power when don't need full coil capacity
   15418     3698715 :             Real64 AirVolRatio = max(this->FanMinAirFlowRatio, std::pow(CapFac, EvaporatorAirVolExponent)); // used when operating at part load
   15419             :             // Fans limited by minimum air flow ratio
   15420             : 
   15421     3698715 :             switch (FanSpeedControlType) {
   15422           0 :             case FanSpeedCtrlType::VariableSpeed: {                // fan power law, adjusted for reality, applies
   15423           0 :                 Real64 FanPowerRatio = std::pow(AirVolRatio, 2.5); // Used for variable speed fans, dimensionless
   15424           0 :                 FanPowerActual = FanPowerRatio * FanPowerMax;
   15425           0 :             } break;
   15426     3698715 :             case FanSpeedCtrlType::ConstantSpeed: {
   15427     3698715 :                 FanPowerActual = AirVolRatio * std::exp(1.0 - AirVolRatio) * FanPowerMax;
   15428     3698715 :             } break;
   15429           0 :             case FanSpeedCtrlType::ConstantSpeedLinear: { // e.g., on-off control
   15430           0 :                 FanPowerActual = AirVolRatio * FanPowerMax;
   15431           0 :             } break;
   15432           0 :             case FanSpeedCtrlType::TwoSpeed: {
   15433             :                 // low speed setting of 1/2 fan speed can give up to 60% of capacity.
   15434             :                 // 1/2 speed corresonds to ~1/8 power consumption (FanHalfSpeedRatio = 1/(2**2.5) = 0.1768)
   15435             :                 // dampers are used to control flow within those two ranges as in FanConstantSpeed
   15436           0 :                 if (CapFac < CapFac60Percent) {
   15437           0 :                     FanPowerActual = ((AirVolRatio + 0.4) * (FanHalfSpeedRatio)) * std::exp(1.0 - AirVolRatio) * FanPowerMax;
   15438             :                 } else {
   15439           0 :                     FanPowerActual = AirVolRatio * std::exp(1.0 - AirVolRatio) * FanPowerMax;
   15440             :                 } // capfac60percent
   15441           0 :             } break;
   15442           0 :             default:
   15443           0 :                 break;
   15444             :             } // fan speed control type
   15445             : 
   15446             :             // reduce latent capacity according to value called for for sensible  - recalc latent.
   15447             :             //   recalc coilcaptotal
   15448     3698715 :             WaterRemovRate *= AirVolRatio;
   15449     3698715 :             latLoadServed = WaterRemovRate * IcetoVaporEnthalpy;
   15450     3698715 :             SensLoadGross = SensLoadRequestedGross;
   15451             :         } else { // at full load
   15452     5735179 :             FanPowerActual = FanPowerMax;
   15453             :         } // part load and sensload served > 0.
   15454             : 
   15455     9433894 :         CoilCapTotal = SensLoadGross + latLoadServed;
   15456     9433894 :         if (CoilCapTotal > 0.0) {
   15457     9407254 :             SHR = SensLoadGross / CoilCapTotal;
   15458             :         } else {
   15459       26640 :             SHR = 0.0;
   15460             :         } //(CoilCapTotal > 0.0d0)
   15461             : 
   15462             :         // now handle ice on coil and defrost because defrost energy not into melting ice goes into sensible load
   15463             :         // FROST:  keep track of frost build up on evaporator coil
   15464             :         //         avoid accumulation during warm-up to avoid reverse dd test problem
   15465     9433894 :         if (!state.dataGlobal->WarmupFlag) {
   15466      464071 :             FrostChangekg = (WaterRemovRate * state.dataHVACGlobal->TimeStepSys * DataGlobalConstants::SecInHour);
   15467      464071 :             this->KgFrost += FrostChangekg;
   15468             :         }
   15469             : 
   15470             :     } else { // NOT (AirVolumeFlowMax > 0.0d0)
   15471    12089555 :         WaterRemovRate = 0.0;
   15472    12089555 :         latLoadServed = 0.0;
   15473    12089555 :         SensLoadGross = 0.0;
   15474    12089555 :         FanPowerActual = 0.0;
   15475             :     } //(AirVolumeFlowMax > 0.0d0)
   15476             : 
   15477             :     // DEFROST CALCULATIONS   ***** need to reduce sensible heat to zone from
   15478             :     //                     defrost by amount used to melt ice. Last two elements
   15479             :     //                     in starting IF are there to mimic temperature override
   15480             :     //                     on the coils that stops defrost if the coils get above
   15481             :     //                     a certain temperature (such as when there's no load and no ice)
   15482    21523449 :     if ((DefrostSchedule > 0.0) && (this->defrostType != DefrostType::None) && (this->defrostType != DefrostType::OffCycle)) {
   15483     2679780 :         DefrostLoad = DefrostCap * DefrostSchedule; // Part of the defrost that is a heat load on the zone (W)
   15484     2679780 :         Real64 DefrostEnergy = DefrostLoad * state.dataHVACGlobal->TimeStepSys * DataGlobalConstants::SecInHour; // Joules
   15485     2679780 :         Real64 StartFrostKg = this->KgFrost; // frost load at start of time step (kg of ice)
   15486             : 
   15487     2679780 :         if (this->DefrostControlType == DefrostCtrlType::TempTerm) {
   15488             :             //  Need to turn defrost system off early if controlled by temperature and all ice melted
   15489             :             //  For temperature termination, need to recognize not all defrost heat goes to melt ice
   15490             :             //  Some goes to misc losses (for fluid defrost, some coil areas bare earlier than
   15491             :             //  others and xfer heat to environment)
   15492             :             //  Assume full ice melting satisfies temperature control.
   15493             :             //      (defaults for DefEnergyFraction are :=0.7 for elec, =0.3 for fluids)
   15494       19780 :             Real64 AvailDefrostEnergy = this->DefEnergyFraction * DefrostEnergy; // available to melt ice with temp term control (J)
   15495       19780 :             Real64 IceSensHeatNeeded = 0.0; // Energy to raise frost temperature to 0C, used w/ temp termination (J)
   15496       19780 :             if (StartFrostKg > 0.0) {
   15497         180 :                 if (this->IceTemp < 0.0) {
   15498         160 :                     Real64 StartIceTemp = this->IceTemp;                                       // Frost temperature at start of time step [C]
   15499         160 :                     IceSensHeatNeeded = StartFrostKg * SpecificHeatIce * (0.0 - StartIceTemp); // Joules
   15500         160 :                     if (AvailDefrostEnergy >= IceSensHeatNeeded) {
   15501         160 :                         this->IceTemp = 0.0;
   15502         160 :                         AvailDefrostEnergy -= IceSensHeatNeeded; // Joules
   15503             :                     } else {                                     // DefrostEnergy < IceSensHeatNeeded
   15504           0 :                         this->IceTemp = StartIceTemp + AvailDefrostEnergy / (SpecificHeatIce * StartFrostKg);
   15505           0 :                         AvailDefrostEnergy = 0.0;
   15506             :                     } // AvailDefrostEnergy >= IceSensHeatNeeded
   15507             :                 }     // IceTemp < 0,  need to raise temperature of ice
   15508             :                 // Reduce defrost heat load on walkin by amount of ice melted during time step
   15509         180 :                 FrostChangekg = min(AvailDefrostEnergy / IceMeltEnthalpy, StartFrostKg);
   15510         180 :                 if (FrostChangekg < StartFrostKg) {
   15511          20 :                     DefrostLoad -= FrostChangekg * IceMeltEnthalpy / state.dataHVACGlobal->TimeStepSys / DataGlobalConstants::SecInHour;
   15512          20 :                     if (!state.dataGlobal->WarmupFlag) this->KgFrost = StartFrostKg - FrostChangekg;
   15513             :                     // DefrostSchedule not changed because ice not all melted, temp term not triggered
   15514             :                 } else { // all frost melted during time step, so need to terminate defrost
   15515             :                     //  see Aug 8 2010 page 3 notes
   15516         160 :                     this->KgFrost = 0.0;
   15517         320 :                     Real64 DefrostEnergyNeeded = (IceSensHeatNeeded + (FrostChangekg * IceMeltEnthalpy)) /
   15518         160 :                                                  this->DefEnergyFraction; // Joules - energy needed including E unavail to melt ice
   15519         160 :                     DefrostSchedule = min(DefrostSchedule,
   15520         160 :                                           (DefrostEnergyNeeded / (DefrostCap * state.dataHVACGlobal->TimeStepSys * DataGlobalConstants::SecInHour)));
   15521             :                     // reduce heat load on warehouse by energy put into ice melting
   15522             :                     // Defrost load that actually goes to melting ice (W)
   15523         160 :                     Real64 DefrostRateNeeded = (IceSensHeatNeeded + (FrostChangekg * IceMeltEnthalpy)) /
   15524         160 :                                                (state.dataHVACGlobal->TimeStepSys * DataGlobalConstants::SecInHour);
   15525         160 :                     DefrostLoad = max(0.0, (DefrostSchedule * DefrostCap - DefrostRateNeeded));
   15526         160 :                     this->IceTemp = this->TEvapDesign;
   15527             :                 } // frost melted during time step less than amount of ice at start
   15528             :             } else {
   15529             :                 // no frost present so terminate defrost and reset ice temperature for start of next defrost
   15530             :                 // However, dripdown schedule still prevents/limits cooling capacity during time step
   15531       19600 :                 DefrostLoad = 0.0;
   15532       19600 :                 DefrostSchedule = 0.0;
   15533       19600 :                 this->IceTemp = this->TEvapDesign;
   15534             :             } // have frost present
   15535             : 
   15536             :         } else {
   15537             :             // Not temperature control type, controlled only by schedule
   15538             :             // Reduce defrost heat load on the zone by amount of ice melted during time step
   15539             :             // But DefrostSchedule not changed
   15540     2660000 :             FrostChangekg = max(0.0, min((DefrostEnergy / IceMeltEnthalpy), StartFrostKg));
   15541     2660000 :             DefrostLoad -= FrostChangekg * IceMeltEnthalpy / state.dataHVACGlobal->TimeStepSys / DataGlobalConstants::SecInHour;
   15542     2660000 :             if (!state.dataGlobal->WarmupFlag) this->KgFrost = StartFrostKg - FrostChangekg;
   15543     2679780 :         } // Temperature termination vs. time-clock control type
   15544             : 
   15545             :     } else { // DefrostSchedule <= 0 or have None or OffCycle
   15546    18843669 :         DefrostLoad = 0.0;
   15547             :     } // Defrost calculations
   15548             : 
   15549    21523449 :     Real64 SensLoadFromZone = SensLoadGross - HeaterLoad - DefrostLoad -
   15550             :                               FanPowerActual; // Net sensible load removed from zone after accounting for heaters, fans, defrost [W]
   15551             : 
   15552             :     // ReportWarehouseCoil(CoilID)
   15553    21523449 :     this->ThermalDefrostPower = DefrostLoad;
   15554    21523449 :     if (this->defrostType == DefrostType::Elec) {
   15555    21170294 :         this->ElecDefrostConsumption = DefrostCap * DefrostSchedule * state.dataHVACGlobal->TimeStepSys * DataGlobalConstants::SecInHour;
   15556    21170294 :         this->ElecDefrostPower = DefrostCap * DefrostSchedule;
   15557             :     } else {
   15558      353155 :         this->ElecDefrostConsumption = 0.0;
   15559      353155 :         this->ElecDefrostPower = 0.0;
   15560             :     }
   15561             : 
   15562             :     // If hot brine or hot gas is used for defrost, need to reduce condenser load by heat reclaimed for defrost
   15563    21523449 :     if (this->defrostType == DefrostType::Fluid) this->HotDefrostCondCredit = DefrostCap * DefrostSchedule;
   15564             :     // LatentLoadServed is positive for latent heat removed from zone
   15565             :     // SensLoadFromZone positive for heat REMOVED from zone, switch when do credit to zone
   15566    21523449 :     this->SensCreditRate = SensLoadFromZone;
   15567    21523449 :     this->SensCreditEnergy = SensLoadFromZone * state.dataHVACGlobal->TimeStepSys * DataGlobalConstants::SecInHour;
   15568    21523449 :     this->LatCreditRate = latLoadServed;
   15569    21523449 :     this->LatCreditEnergy = latLoadServed * state.dataHVACGlobal->TimeStepSys * DataGlobalConstants::SecInHour;
   15570    21523449 :     this->LatKgPerS_ToZone = WaterRemovRate;
   15571    21523449 :     this->TotalCoolingLoad = CoilCapTotal;
   15572    21523449 :     this->TotalCoolingEnergy = CoilCapTotal * state.dataHVACGlobal->TimeStepSys * DataGlobalConstants::SecInHour;
   15573    21523449 :     this->SensCoolingEnergyRate = SensLoadGross;
   15574    21523449 :     this->SensCoolingEnergy = SensLoadGross * state.dataHVACGlobal->TimeStepSys * DataGlobalConstants::SecInHour;
   15575    21523449 :     this->SensHeatRatio = SHR;
   15576    21523449 :     this->ElecFanPower = FanPowerActual;
   15577    21523449 :     this->ElecFanConsumption = FanPowerActual * state.dataHVACGlobal->TimeStepSys * DataGlobalConstants::SecInHour;
   15578    21523449 :     this->ElecHeaterPower = HeaterLoad;
   15579    21523449 :     this->ElecHeaterConsumption = HeaterLoad * state.dataHVACGlobal->TimeStepSys * DataGlobalConstants::SecInHour;
   15580             : 
   15581    21523449 :     this->TotalElecPower = FanPowerActual + HeaterLoad + this->ElecDefrostPower;
   15582    21523449 :     this->TotalElecConsumption = this->TotalElecPower * state.dataHVACGlobal->TimeStepSys * DataGlobalConstants::SecInHour;
   15583             : 
   15584    21523449 :     if (this->SensCreditRate >= 0.0) {
   15585    17900433 :         this->ReportSensCoolCreditRate = this->SensCreditRate;
   15586    17900433 :         this->ReportHeatingCreditRate = 0.0;
   15587             :     } else {
   15588     3623016 :         this->ReportSensCoolCreditRate = 0.0;
   15589     3623016 :         this->ReportHeatingCreditRate = -this->SensCreditRate;
   15590             :     }
   15591    21523449 :     this->ReportSensCoolCreditEnergy = this->ReportSensCoolCreditRate * state.dataHVACGlobal->TimeStepSys * DataGlobalConstants::SecInHour;
   15592    21523449 :     this->ReportHeatingCreditEnergy = this->ReportHeatingCreditRate * state.dataHVACGlobal->TimeStepSys * DataGlobalConstants::SecInHour;
   15593    21523449 :     this->ReportTotalCoolCreditRate = this->ReportSensCoolCreditRate + this->LatCreditRate;
   15594    21523449 :     this->ReportTotalCoolCreditEnergy = this->ReportSensCoolCreditEnergy + this->LatCreditEnergy;
   15595             : 
   15596             :     //**************************************************************************************************
   15597             :     // Cap Kg Frost to avoid floating overflow errors
   15598             :     // 1-time warning is issued. It should be rare but could happen with unrealistic inputs.
   15599             : 
   15600    21523449 :     if (this->KgFrost > MyLargeNumber) {
   15601           0 :         this->KgFrost = MyLargeNumber;
   15602           0 :         if (this->ShowCoilFrostWarning) {
   15603           0 :             ShowWarningError(state, "Refrigeration:AirCoil: " + this->Name);
   15604           0 :             ShowContinueError(state, " This refrigerated air coil has insufficient defrost capacity to remove the excess frost accumulation.");
   15605           0 :             ShowContinueError(state, " Check the defrost schedule or defrost capacity. ");
   15606           0 :             ShowContinueErrorTimeStamp(state, "... Occurrence info");
   15607           0 :             this->ShowCoilFrostWarning = false;
   15608             :         }
   15609             :     }
   15610             : }
   15611             : 
   15612     2568509 : void FigureRefrigerationZoneGains(EnergyPlusData &state)
   15613             : {
   15614             : 
   15615             :     // SUBROUTINE INFORMATION:
   15616             :     //       AUTHOR         B. Griffith
   15617             :     //       DATE WRITTEN   Dec 2011
   15618             :     //       MODIFIED       na
   15619             :     //       RE-ENGINEERED  na
   15620             : 
   15621             :     // PURPOSE OF THIS SUBROUTINE:
   15622             :     // initialize zone gain terms at begin environment
   15623             : 
   15624     2568509 :     auto &System(state.dataRefrigCase->System);
   15625     2568509 :     auto &TransSystem(state.dataRefrigCase->TransSystem);
   15626     2568509 :     auto &RefrigRack(state.dataRefrigCase->RefrigRack);
   15627     2568509 :     auto &Secondary(state.dataRefrigCase->Secondary);
   15628     2568509 :     auto &WalkIn(state.dataRefrigCase->WalkIn);
   15629     2568509 :     auto &RefrigCase(state.dataRefrigCase->RefrigCase);
   15630             : 
   15631     2568509 :     CheckRefrigerationInput(state);
   15632             : 
   15633     2568509 :     if (state.dataGlobal->BeginEnvrnFlag && state.dataRefrigCase->FigureRefrigerationZoneGainsMyEnvrnFlag) {
   15634             : 
   15635        6218 :         if (state.dataRefrigCase->NumRefrigSystems > 0) {
   15636         360 :             for (auto &e : System) {
   15637         262 :                 e.PipeHeatLoad = 0.0;
   15638         262 :                 e.NetHeatRejectLoad = 0.0;
   15639             :             }
   15640             :         }
   15641             : 
   15642        6218 :         if (state.dataRefrigCase->NumTransRefrigSystems > 0) {
   15643          12 :             for (auto &e : TransSystem) {
   15644           6 :                 e.PipeHeatLoadMT = 0.0;
   15645           6 :                 e.PipeHeatLoadLT = 0.0;
   15646           6 :                 e.NetHeatRejectLoad = 0.0;
   15647             :             }
   15648             :         }
   15649             : 
   15650        6218 :         if (state.dataRefrigCase->NumRefrigeratedRacks > 0) {
   15651         745 :             for (auto &e : RefrigRack) {
   15652         496 :                 e.SensZoneCreditHeatRate = 0.0;
   15653         496 :                 e.SensHVACCreditHeatRate = 0.0;
   15654             :             }
   15655             :         }
   15656             : 
   15657        6218 :         if (state.dataRefrigCase->NumSimulationSecondarySystems > 0) {
   15658          18 :             for (auto &e : Secondary) {
   15659          12 :                 e.DistPipeZoneHeatGain = 0.0;
   15660          12 :                 e.ReceiverZoneHeatGain = 0.0;
   15661             :             }
   15662             :         }
   15663             : 
   15664        6218 :         if (state.dataRefrigCase->NumSimulationWalkIns > 0) {
   15665         210 :             for (int loop = 1; loop <= state.dataRefrigCase->NumSimulationWalkIns; ++loop) {
   15666         118 :                 WalkIn(loop).SensZoneCreditRate = 0.0;
   15667         118 :                 WalkIn(loop).LatZoneCreditRate = 0.0;
   15668             :             }
   15669             :         }
   15670        6218 :         if (state.dataRefrigCase->NumSimulationCases > 0) {
   15671        1608 :             for (auto &e : RefrigCase) {
   15672        1315 :                 e.SensZoneCreditRate = 0.0;
   15673        1315 :                 e.SensHVACCreditRate = 0.0;
   15674        1315 :                 e.LatZoneCreditRate = 0.0;
   15675        1315 :                 e.LatHVACCreditRate = 0.0;
   15676             :             }
   15677             :         }
   15678        6218 :         state.dataRefrigCase->FigureRefrigerationZoneGainsMyEnvrnFlag = false;
   15679             :     }
   15680     2568509 :     if (!state.dataGlobal->BeginEnvrnFlag) state.dataRefrigCase->FigureRefrigerationZoneGainsMyEnvrnFlag = true;
   15681     2568509 : }
   15682             : 
   15683        2891 : void ZeroHVACValues(EnergyPlusData &state)
   15684             : {
   15685             : 
   15686             :     // SUBROUTINE INFORMATION:
   15687             :     //       AUTHOR         T. Stovall
   15688             :     //       DATE WRITTEN   Aug 2012
   15689             :     //       MODIFIED       na
   15690             :     //       RE-ENGINEERED  na
   15691             : 
   15692             :     // PURPOSE OF THIS SUBROUTINE:
   15693             :     // Reset all values that communicate outside module for HVAC steps
   15694             :     // to zero when called on zone timestep. Otherwise, values may be held over when
   15695             :     // no HVAC load calls module during that zone time step.
   15696             : 
   15697        2891 :     auto &RefrigRack(state.dataRefrigCase->RefrigRack);
   15698        2891 :     auto &Condenser(state.dataRefrigCase->Condenser);
   15699             : 
   15700        2891 :     int DemandARRID(0); // Index to water tank Demand used for evap condenser
   15701             : 
   15702        2891 :     if (state.dataRefrigCase->HaveRefrigRacks) {
   15703             :         // HaveRefrigRacks is TRUE when NumRefrigeratedRAcks > 0
   15704             :         // RefrigRack ALLOCATED to NumRefrigeratedRacks
   15705           0 :         for (int RackNum = 1; RackNum <= state.dataRefrigCase->NumRefrigeratedRacks; ++RackNum) {
   15706           0 :             if (RefrigRack(RackNum).CondenserType == DataHeatBalance::RefrigCondenserType::Water) {
   15707           0 :                 Real64 MassFlowRate = 0.0;
   15708           0 :                 PlantUtilities::SetComponentFlowRate(
   15709           0 :                     state, MassFlowRate, RefrigRack(RackNum).InletNode, RefrigRack(RackNum).OutletNode, RefrigRack(RackNum).plantLoc);
   15710             :             }
   15711           0 :             if (RefrigRack(RackNum).CondenserType == DataHeatBalance::RefrigCondenserType::Evap) {
   15712           0 :                 if (RefrigRack(RackNum).EvapWaterSupplyMode == WaterSupply::FromTank) {
   15713           0 :                     DemandARRID = RefrigRack(RackNum).EvapWaterTankDemandARRID;
   15714           0 :                     int TankID = RefrigRack(RackNum).EvapWaterSupTankID;
   15715           0 :                     state.dataWaterData->WaterStorage(TankID).VdotRequestDemand(DemandARRID) = 0.0;
   15716             :                 }
   15717             :             }
   15718             :         } // RackNum
   15719             :     }     // HaveRefrigRacks
   15720             : 
   15721        2891 :     if (state.dataRefrigCase->NumRefrigCondensers > 0) {
   15722             :         // Condenser ALLOCATED to DataHeatBalance::NumRefrigCondensers
   15723       28910 :         for (int CondID = 1; CondID <= state.dataRefrigCase->NumRefrigCondensers; ++CondID) {
   15724       26019 :             if (Condenser(CondID).CondenserType == DataHeatBalance::RefrigCondenserType::Water) {
   15725           0 :                 Real64 MassFlowRate = 0.0;
   15726           0 :                 PlantUtilities::SetComponentFlowRate(
   15727           0 :                     state, MassFlowRate, Condenser(CondID).InletNode, Condenser(CondID).OutletNode, Condenser(CondID).plantLoc);
   15728             :             }
   15729       26019 :             if (Condenser(CondID).CondenserType == DataHeatBalance::RefrigCondenserType::Evap) {
   15730           0 :                 if (Condenser(CondID).EvapWaterSupplyMode == WaterSupply::FromTank) {
   15731           0 :                     DemandARRID = Condenser(CondID).EvapWaterTankDemandARRID;
   15732           0 :                     int TankID = Condenser(CondID).EvapWaterSupTankID;
   15733           0 :                     state.dataWaterData->WaterStorage(TankID).VdotRequestDemand(DemandARRID) = 0.0;
   15734             :                 }
   15735             :             }
   15736             :         } // ICond
   15737             :     }     // DataHeatBalance::NumRefrigCondensers>0
   15738        2891 : }
   15739             : 
   15740        2313 : } // namespace EnergyPlus::RefrigeratedCase

Generated by: LCOV version 1.13