LCOV - code coverage report
Current view: top level - EnergyPlus - StandardRatings.cc (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 1841 2178 84.5 %
Date: 2023-01-17 19:17:23 Functions: 27 27 100.0 %

          Line data    Source code
       1             : // EnergyPlus, Copyright (c) 1996-2023, The Board of Trustees of the University of Illinois,
       2             : // The Regents of the University of California, through Lawrence Berkeley National Laboratory
       3             : // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
       4             : // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
       5             : // contributors. All rights reserved.
       6             : //
       7             : // NOTICE: This Software was developed under funding from the U.S. Department of Energy and the
       8             : // U.S. Government consequently retains certain rights. As such, the U.S. Government has been
       9             : // granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable,
      10             : // worldwide license in the Software to reproduce, distribute copies to the public, prepare
      11             : // derivative works, and perform publicly and display publicly, and to permit others to do so.
      12             : //
      13             : // Redistribution and use in source and binary forms, with or without modification, are permitted
      14             : // provided that the following conditions are met:
      15             : //
      16             : // (1) Redistributions of source code must retain the above copyright notice, this list of
      17             : //     conditions and the following disclaimer.
      18             : //
      19             : // (2) Redistributions in binary form must reproduce the above copyright notice, this list of
      20             : //     conditions and the following disclaimer in the documentation and/or other materials
      21             : //     provided with the distribution.
      22             : //
      23             : // (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory,
      24             : //     the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be
      25             : //     used to endorse or promote products derived from this software without specific prior
      26             : //     written permission.
      27             : //
      28             : // (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form
      29             : //     without changes from the version obtained under this License, or (ii) Licensee makes a
      30             : //     reference solely to the software portion of its product, Licensee must refer to the
      31             : //     software as "EnergyPlus version X" software, where "X" is the version number Licensee
      32             : //     obtained under this License and may not use a different name for the software. Except as
      33             : //     specifically required in this Section (4), Licensee shall not use in a company name, a
      34             : //     product name, in advertising, publicity, or other promotional activities any name, trade
      35             : //     name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly
      36             : //     similar designation, without the U.S. Department of Energy's prior written consent.
      37             : //
      38             : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
      39             : // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
      40             : // AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
      41             : // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
      42             : // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
      43             : // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
      44             : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
      45             : // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
      46             : // POSSIBILITY OF SUCH DAMAGE.
      47             : 
      48             : // C++ Headers
      49             : #include <string>
      50             : 
      51             : // ObjexxFCL Headers
      52             : #include <ObjexxFCL/Fmath.hh>
      53             : 
      54             : // EnergyPlus Headers
      55             : #include <EnergyPlus/CurveManager.hh>
      56             : #include <EnergyPlus/Data/EnergyPlusData.hh>
      57             : #include <EnergyPlus/DataBranchAirLoopPlant.hh>
      58             : #include <EnergyPlus/DataEnvironment.hh>
      59             : #include <EnergyPlus/DataHVACGlobals.hh>
      60             : #include <EnergyPlus/FluidProperties.hh>
      61             : #include <EnergyPlus/General.hh>
      62             : #include <EnergyPlus/OutputReportPredefined.hh>
      63             : #include <EnergyPlus/Plant/DataPlant.hh>
      64             : #include <EnergyPlus/Psychrometrics.hh>
      65             : #include <EnergyPlus/StandardRatings.hh>
      66             : #include <EnergyPlus/UtilityRoutines.hh>
      67             : 
      68             : namespace EnergyPlus {
      69             : 
      70             : namespace StandardRatings {
      71             : 
      72             :     // MODULE INFORMATION:
      73             :     //       AUTHOR         Chandan Sharma
      74             :     //       DATE WRITTEN   February 2012
      75             :     //       MODIFIED       February 2013, Bereket Nigusse
      76             :     //       RE-ENGINEERED  na
      77             : 
      78             :     // PURPOSE OF THIS MODULE:
      79             :     // This module contains the subroutines required to calculate the following standard ratings of HVAC equipment
      80             :     // 1) Integrated Part Load Value (IPLV) rating for EIR and Reformulated EIR chillers
      81             :     // 2) a) Standard Rated (net) Cooling Capacity
      82             :     //    b) Seasonal Energy Efficiency Ratio (SEER)
      83             :     //    c) Energy Efficiency Ratio (EER),
      84             :     //    d) Integrated Energy Efficiency Ratio (IEER)
      85             :     //       for Air-to-Air Direct Expansion Air Conditioner and Heat Pumps having a single-speed compressor,
      86             :     //       fixed speed indoor supply air fan, and air-cooled condensers.
      87             :     // 3) Heating Seasonal Performance Factor (HSPF) for Air-Source Direct Expansion Heat Pumps having a single-speed compressor,
      88             :     //       fixed speed indoor supply air fan
      89             :     // 4) Seasonal Energy Efficiency Ratio (SEER) for Air-Source Direct Expansion multi-speed compressor Heat Pumps
      90             :     // 5) Heating Seasonal Performance Factor (HSPF) for Air-Source Direct Expansion multi-speed compressor Heat Pumps
      91             :     // METHODOLOGY EMPLOYED:
      92             :     // Using the user specified reference capacity, reference COP and performance curves, the chiller or DX coil models are executed
      93             :     // for standard test conditions as specified in ANSI/AHRI 550/590, 210/240 and 340/360. Then results of the simulated test points
      94             :     // are processed into standard ratings according to standard's procedures.
      95             : 
      96             :     // REFERENCES:
      97             :     // (1) AHRI Standard 550/590-2011:  Standard for Performance Rating of Water-Chilling Packages using the Vapor
      98             :     //                                  Compression Cycle. Arlington, VA:  Air-Conditioning, Heating,
      99             :     //                                  and Refrigeration Institute.
     100             :     // (2) ANSI/AHRI Standard 210/240-2008:  Standard for Performance Rating of Unitary Air-Conditioning and
     101             :     //                                       Air-Source Heat Pumps. Arlington, VA:  Air-Conditioning, Heating
     102             :     //                                       , and Refrigeration Institute.
     103             :     // (3) ANSI/AHRI Standard 340/360-2007:  Standard for Performance Rating of Commercial and Industrial
     104             :     //                                       Unitary Air-Conditioning and Heat Pump Equipment.  Arlington,
     105             :     //                                       VA:  Air-Conditioning, Heating, and Refrigeration Institute.
     106             : 
     107             :     // OTHER NOTES: none
     108             : 
     109             :     // Data
     110             :     Real64 constexpr IndoorCoilInletAirWetBulbTempRated(19.44);     // 19.44C (67F)  Tests A2, B2, B1, and F1
     111             :     Real64 constexpr OutdoorCoilInletAirDryBulbTempRated(35.0);     // 35.00C (95F)  Tests A2, B2, B1, and F1
     112             :     Real64 constexpr OutdoorCoilInletAirDryBulbTempTestA2(35.0);    // 35.00C (95F)  Test A2 (high speed)
     113             :     Real64 constexpr OutdoorCoilInletAirDryBulbTempTestB2(27.78);   // 27.78C (82F)  Test B2 (high speed)
     114             :     Real64 constexpr OutdoorCoilInletAirDryBulbTempTestB1(27.78);   // 27.78C (82F)  Test B1 (Low speed)
     115             :     Real64 constexpr OutdoorCoilInletAirDryBulbTempTestF1(19.44);   // 19.44C (67F)  Test B1 (Low speed)
     116             :     Real64 constexpr OutdoorCoilInletAirDryBulbTempTestEint(30.55); // 30.55 (87F) Test Eint
     117             : 
     118             :     // AHRI Standard 210/240-2008 Performance Test Conditions for Unitary Air-to-Air Air-Conditioning and Heat Pump Equipment
     119             :     // AHRI STANDARD 210/240 - 2023
     120             :     Real64 constexpr CoolingCoilInletAirWetBulbTempRated(19.44); // 19.44C (67F)  Tests A and B
     121             :     // AHRI STANDARD 210/240 - 2023
     122             :     Real64 constexpr OutdoorUnitInletAirDryBulbTempRated(35.0); // 35.00C (95F)  Test A (rated capacity)
     123             : 
     124             :     Real64 constexpr OutdoorUnitInletAirDryBulbTemp(27.78); // 27.78C (82F)  Test B (for SEER)
     125             :     Real64 constexpr AirMassFlowRatioRated(1.0);            // AHRI test is at the design flow rate and hence AirMassFlowRatio is 1.0
     126             :     // AHRI STANDARD 210/240 - 2017
     127             :     Real64 constexpr DefaultFanPowerPerEvapAirFlowRate(773.3); // 365 W/1000 scfm or 773.3 W/(m3/s). The AHRI standard
     128             :     // AHRI STANDARD 210/240 - 2023
     129             :     Real64 constexpr DefaultFanPowerPerEvapAirFlowRateSEER2(934.4); // 441 W/1000 scfm or 934.4 W/(m3/s). The AHRI standard
     130             :     // specifies a nominal/default fan electric power consumption per rated air
     131             :     // volume flow rate to account for indoor fan electric power consumption
     132             :     // when the standard tests are conducted on units that do not have an
     133             :     // indoor air circulating fan. Used if user doesn't enter a specific value.
     134             : 
     135             :     // AHRI STANDARD 210/240 - 2023
     136             :     Real64 constexpr PLRforSEER(0.5); // Part-load ratio for SEER calculation (single speed DX cooling coils)
     137             : 
     138             :     static constexpr std::array<Real64, 4> ReducedPLR = {1.0, 0.75, 0.50, 0.25};               // Reduced Capacity part-load conditions
     139             :     static constexpr std::array<Real64, 4> IEERWeightingFactor = {0.020, 0.617, 0.238, 0.125}; // EER Weighting factors (IEER)
     140             :     Real64 constexpr OADBTempLowReducedCapacityTest(18.3);                                     // Outdoor air dry-bulb temp in degrees C (65F)
     141             :     // Std. AHRI AHRI 340/360 Dry-bulb Temp at reduced capacity, <= 0.444
     142             : 
     143             :     // HSPF AHRI STANDARD 210/240 - 2017
     144             :     int constexpr TotalNumOfStandardDHRs(16);                                                  // Total number of standard design heating requirements
     145             :     static constexpr std::array<Real64, 6> TotalNumOfTemperatureBins = {9, 10, 13, 15, 18, 9}; // Total number of temperature bins for a region
     146             :     static constexpr std::array<Real64, 16> StandardDesignHeatingRequirement = {1465.36,
     147             :                                                                                 2930.71,
     148             :                                                                                 4396.07,
     149             :                                                                                 5861.42,
     150             :                                                                                 7326.78,
     151             :                                                                                 8792.14,
     152             :                                                                                 10257.49,
     153             :                                                                                 11722.85,
     154             :                                                                                 14653.56,
     155             :                                                                                 17584.27,
     156             :                                                                                 20514.98,
     157             :                                                                                 23445.70,
     158             :                                                                                 26376.41,
     159             :                                                                                 29307.12,
     160             :                                                                                 32237.83,
     161             :                                                                                 38099.26};
     162             : 
     163             :     // HSPF2 AHRI STANDARD 210/240 - 2023
     164             :     // BPS: As Fractional Bin hours are not summing up to 1 we using an adjusted array of total number of Temperature Bins per region.
     165             :     // static constexpr std::array<Real64, 6> TotalNumOfTemperatureBinsHSPF2 = {8, 8, 11, 13, 16, 7}; // Total number of temperature bins for each
     166             :     // region
     167             :     static constexpr std::array<Real64, 6> TotalNumOfTemperatureBinsHSPF2 = {9, 10, 13, 15, 18, 9};
     168             : 
     169             :     // Standardized DHRs from ANSI/AHRI 210/240 - 2017
     170             :     Real64 constexpr CorrectionFactor(0.77); // A correction factor which tends to improve the agreement
     171             :     // Slope Adjustment Factor (Cx)  from ANSI/AHRI 210/240 - 2023 (Section 11.2.2 - Table 14)
     172             :     // 1. Variable Speed Load Factor (Cvs) | Variable Speed  Equipment
     173             :     static constexpr std::array<Real64, 6> VariableSpeedLoadFactor = {1.03, 0.99, 1.21, 1.07, 1.08, 1.03};
     174             :     // 2. Heating Load Line Equation Slope Factor (C) | other Equipment types
     175             :     static constexpr std::array<Real64, 6> SpeedLoadFactor = {1.10, 1.06, 1.30, 1.15, 1.16, 1.11};
     176             : 
     177             :     // between calculated and measured building loads, dimensionless.
     178             :     Real64 constexpr CyclicDegradationCoeff(0.25);
     179             :     // For Single Stage Systems, if the optional CFull and DFull tests are not performed, a
     180             :     // default value of 0.20 shall be used for the cooling Degradation Coefficient
     181             :     Real64 constexpr CyclicDegradationCoeffSEER2(0.20); // ANSI/AHRI 210/240 2023 Section 6.1.3.1
     182             : 
     183             :     // Default Heating Degradation Coefficient | HSPF2
     184             :     // ANSI/AHRI Standard 2023 Section 6.1.3.2.1 -> For Single Stage Systems, if the optional H1CFull test or H1CLow is not performed, a default value
     185             :     // of 0.25 shall be used for the heating Degradation Coefficient
     186             :     Real64 constexpr CyclicHeatingDegradationCoeffHSPF2(0.25);
     187             : 
     188             :     // AHRI STANDARD 210/240 - 2017 & 2023
     189             :     static constexpr std::array<Real64, 6> OutdoorDesignTemperature = {2.78, -2.78, -8.33, -15.0, -23.33, -1.11};
     190             : 
     191             :     // (Tzl)the zero-load temperature variation by climate region ANSI/AHRI 210/240 - 2023 (Section 11.2.2 - Table 14)
     192             :     // [ 58 57 56 55 55 57 ] in Fahrenheit
     193             :     static constexpr std::array<Real64, 6> ZoneLoadTemperature = {14.44, 13.89, 13.33, 12.78, 12.78, 13.89};
     194             : 
     195             :     // Outdoor design temperature for a region from ANSI/AHRI 210/240 - 2017 & 2023
     196             :     static constexpr std::array<Real64, 18> OutdoorBinTemperature = {
     197             :         16.67, 13.89, 11.11, 8.33, 5.56, 2.78, 0.00, -2.78, -5.56, -8.33, -11.11, -13.89, -16.67, -19.44, -22.22, -25.00, -27.78, -30.56};
     198             :     int constexpr NumberOfRegions{6};
     199             :     int constexpr NumberOfBins{18};
     200             :     // Fractional bin hours for different bin temperatures from ANSI/AHRI 210/240 - 2017
     201             :     static constexpr std::array<std::array<Real64, NumberOfBins>, NumberOfRegions> FracBinHoursAtOutdoorBinTemp = {
     202             :         {{0.291, 0.239, 0.194, 0.129, 0.081, 0.041, 0.019, 0.005, 0.001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
     203             :          {0.215, 0.189, 0.163, 0.143, 0.112, 0.088, 0.056, 0.024, 0.008, 0.002, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
     204             :          {0.153, 0.142, 0.138, 0.137, 0.135, 0.118, 0.092, 0.047, 0.021, 0.009, 0.005, 0.002, 0.001, 0.0, 0.0, 0.0, 0.0, 0.0},
     205             :          {0.132, 0.111, 0.103, 0.093, 0.1, 0.109, 0.126, 0.087, 0.055, 0.036, 0.026, 0.013, 0.006, 0.002, 0.001, 0.0, 0.0, 0.0},
     206             :          {0.106, 0.092, 0.086, 0.076, 0.078, 0.087, 0.102, 0.094, 0.074, 0.055, 0.047, 0.038, 0.029, 0.018, 0.01, 0.005, 0.002, 0.001},
     207             :          {0.113, 0.206, 0.215, 0.204, 0.141, 0.076, 0.034, 0.008, 0.003, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}}};
     208             : 
     209             :     // Fractional bin hours for different bin temperatures from ANSI/AHRI 210/240 - 2023 (Section 11.2.2 - Table 14)
     210             :     // As the Fractional Bin Hours for each region is not summing up to 1 we're using the adjusted one down below
     211             :     // static constexpr std::array<std::array<Real64, NumberOfBins>, NumberOfRegions> FracBinHoursAtOutdoorBinTempHSPF2 = {
     212             :     //{{0.0, 0.239, 0.194, 0.129, 0.081, 0.041, 0.019, 0.005, 0.001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
     213             :     // {0.0, 0.0, 0.163, 0.143, 0.112, 0.088, 0.056, 0.024, 0.008, 0.002, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
     214             :     // {0.0, 0.0, 0.138, 0.137, 0.135, 0.118, 0.092, 0.047, 0.021, 0.009, 0.005, 0.002, 0.001, 0.0, 0.0, 0.0, 0.0, 0.0},
     215             :     // {0.0, 0.0, 0.103, 0.093, 0.1, 0.109, 0.126, 0.087, 0.055, 0.036, 0.026, 0.013, 0.006, 0.002, 0.001, 0.0, 0.0, 0.0},
     216             :     // {0.0, 0.0, 0.086, 0.076, 0.078, 0.087, 0.102, 0.094, 0.074, 0.055, 0.047, 0.038, 0.029, 0.018, 0.01, 0.005, 0.002, 0.001},
     217             :     // {0.0, 0.0, 0.215, 0.204, 0.141, 0.076, 0.034, 0.008, 0.003, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}}};
     218             :     // Adjusted to sum up to 1
     219             :     static constexpr std::array<std::array<Real64, NumberOfBins>, NumberOfRegions> FracBinHoursAtOutdoorBinTempHSPF2 = {{{0.0,
     220             :                                                                                                                           0.337094499,
     221             :                                                                                                                           0.273624824,
     222             :                                                                                                                           0.181946403,
     223             :                                                                                                                           0.114245416,
     224             :                                                                                                                           0.057827927,
     225             :                                                                                                                           0.026798307,
     226             :                                                                                                                           0.007052186,
     227             :                                                                                                                           0.001410437,
     228             :                                                                                                                           0.0,
     229             :                                                                                                                           0.0,
     230             :                                                                                                                           0.0,
     231             :                                                                                                                           0.0,
     232             :                                                                                                                           0.0,
     233             :                                                                                                                           0.0,
     234             :                                                                                                                           0.0,
     235             :                                                                                                                           0.0,
     236             :                                                                                                                           0.0},
     237             :                                                                                                                          {0.0,
     238             :                                                                                                                           0.0,
     239             :                                                                                                                           0.273489933,
     240             :                                                                                                                           0.239932886,
     241             :                                                                                                                           0.187919463,
     242             :                                                                                                                           0.147651007,
     243             :                                                                                                                           0.093959732,
     244             :                                                                                                                           0.040268456,
     245             :                                                                                                                           0.013422819,
     246             :                                                                                                                           0.003355705,
     247             :                                                                                                                           0.0,
     248             :                                                                                                                           0.0,
     249             :                                                                                                                           0.0,
     250             :                                                                                                                           0.0,
     251             :                                                                                                                           0.0,
     252             :                                                                                                                           0.0,
     253             :                                                                                                                           0.0,
     254             :                                                                                                                           0.0},
     255             :                                                                                                                          {0.0,
     256             :                                                                                                                           0.0,
     257             :                                                                                                                           0.195744681,
     258             :                                                                                                                           0.194326241,
     259             :                                                                                                                           0.191489362,
     260             :                                                                                                                           0.167375887,
     261             :                                                                                                                           0.130496454,
     262             :                                                                                                                           0.066666667,
     263             :                                                                                                                           0.029787234,
     264             :                                                                                                                           0.012765957,
     265             :                                                                                                                           0.007092199,
     266             :                                                                                                                           0.002836879,
     267             :                                                                                                                           0.00141844,
     268             :                                                                                                                           0.0,
     269             :                                                                                                                           0.0,
     270             :                                                                                                                           0.0,
     271             :                                                                                                                           0.0,
     272             :                                                                                                                           0.0},
     273             :                                                                                                                          {0.0,
     274             :                                                                                                                           0.0,
     275             :                                                                                                                           0.136063408,
     276             :                                                                                                                           0.122853369,
     277             :                                                                                                                           0.132100396,
     278             :                                                                                                                           0.143989432,
     279             :                                                                                                                           0.166446499,
     280             :                                                                                                                           0.114927345,
     281             :                                                                                                                           0.072655218,
     282             :                                                                                                                           0.047556143,
     283             :                                                                                                                           0.034346103,
     284             :                                                                                                                           0.017173052,
     285             :                                                                                                                           0.007926024,
     286             :                                                                                                                           0.002642008,
     287             :                                                                                                                           0.001321004,
     288             :                                                                                                                           0.0,
     289             :                                                                                                                           0.0,
     290             :                                                                                                                           0.0},
     291             :                                                                                                                          {0.0,
     292             :                                                                                                                           0.0,
     293             :                                                                                                                           0.10723192,
     294             :                                                                                                                           0.094763092,
     295             :                                                                                                                           0.097256858,
     296             :                                                                                                                           0.108478803,
     297             :                                                                                                                           0.127182045,
     298             :                                                                                                                           0.117206983,
     299             :                                                                                                                           0.092269327,
     300             :                                                                                                                           0.068578554,
     301             :                                                                                                                           0.058603491,
     302             :                                                                                                                           0.047381546,
     303             :                                                                                                                           0.036159601,
     304             :                                                                                                                           0.02244389,
     305             :                                                                                                                           0.012468828,
     306             :                                                                                                                           0.006234414,
     307             :                                                                                                                           0.002493766,
     308             :                                                                                                                           0.001246883},
     309             :                                                                                                                          {0.0,
     310             :                                                                                                                           0.0,
     311             :                                                                                                                           0.315712188,
     312             :                                                                                                                           0.299559471,
     313             :                                                                                                                           0.207048458,
     314             :                                                                                                                           0.111600587,
     315             :                                                                                                                           0.049926579,
     316             :                                                                                                                           0.01174743,
     317             :                                                                                                                           0.004405286,
     318             :                                                                                                                           0.0,
     319             :                                                                                                                           0.0,
     320             :                                                                                                                           0.0,
     321             :                                                                                                                           0.0,
     322             :                                                                                                                           0.0,
     323             :                                                                                                                           0.0,
     324             :                                                                                                                           0.0,
     325             :                                                                                                                           0.0,
     326             :                                                                                                                           0.0}}};
     327             : 
     328             :     // Representative cooling season Outdoor air temperature bin from ANSI/AHRI 210/240-2008
     329             :     int constexpr NumOfOATempBins(8); // number of outdoor temperature bins for cooling season
     330             :     static constexpr std::array<Real64, NumOfOATempBins> OutdoorBinTemperatureSEER = {19.44, 22.22, 25.00, 27.78, 30.56, 33.33, 36.11, 38.89};
     331             :     // Fractional bin hours for different bin temperatures for cooling, from ANSI/AHRI 210/240 - 2008
     332             :     // AHRI STANDARD 210/240 - 2023 | This does sum up to 1
     333             :     static constexpr std::array<Real64, NumOfOATempBins> CoolFracBinHoursAtOutdoorBinTemp = {0.214, 0.231, 0.216, 0.161, 0.104, 0.052, 0.018, 0.004};
     334             : 
     335             :     Real64 constexpr HeatingIndoorCoilInletAirDBTempRated(21.11); // Heating coil entering air dry-bulb temperature in
     336             :     // degrees C (70F) Test H1, H2 and H3
     337             :     // (low and High Speed) Std. AHRI 210/240
     338             :     Real64 constexpr HeatingOutdoorCoilInletAirDBTempH0Test(16.67); // Outdoor air dry-bulb temp in degrees C (47F)
     339             :     // Test H0 (low and High Speed) Std. AHRI 210/240
     340             : 
     341             :     // ANSI/ASHRAE Standard 127-2012 -- Method of Testing for Rating Computer and Data Processing Room Unitary Air Conditioners
     342             :     //  Class 1 23.9C( 75.0F ) 23.9C( 75.0F ) 23.9C( 75.0F ) 23.9C( 75.0F )
     343             :     //  Class 2 29.4C( 85.0F ) 29.4C( 85.0F ) 29.4C( 85.0F ) 29.4C( 85.0F )
     344             :     //  Class 3 35.0C( 95.0F ) 35.0C( 95.0F ) 35.0C( 95.0F ) 35.0C( 95.0F )
     345             :     //  Class 4 40.5C( 105F ) 40.5C( 105F ) 40.5C( 105F ) 40.5C( 105F )
     346             :     static constexpr std::array<Real64, 4> IndoorDBTempClassI2IV = {23.9, 29.4, 35.0, 40.5};
     347             :     Real64 constexpr IndoorTDPA2D(11.1);
     348             :     // 35.0C( 95.0F ) 26.7C( 80.0F ) 18.3C( 65.0F ) 4.4C( 40.0F )
     349             :     static constexpr std::array<Real64, 4> OutdoorDBTempAllClassA2D = {35.0, 26.7, 18.3, 4.4};
     350             : 
     351             :     // Functions
     352             : 
     353          91 :     void CalcChillerIPLV(EnergyPlusData &state,
     354             :                          std::string const &ChillerName,               // Name of Chiller for which IPLV is calculated
     355             :                          DataPlant::PlantEquipmentType ChillerType,    // Type of Chiller - EIR or Reformulated EIR
     356             :                          Real64 const RefCap,                          // Reference capacity of chiller [W]
     357             :                          Real64 const RefCOP,                          // Reference coefficient of performance [W/W]
     358             :                          DataPlant::CondenserType const CondenserType, // Type of Condenser - Air Cooled, Water Cooled or Evap Cooled
     359             :                          int const CapFTempCurveIndex,                 // Index for the total cooling capacity modifier curve
     360             :                          int const EIRFTempCurveIndex,                 // Index for the energy input ratio modifier curve
     361             :                          int const EIRFPLRCurveIndex,                  // Index for the EIR vs part-load ratio curve
     362             :                          Real64 const MinUnloadRat,                    // Minimum unloading ratio
     363             :                          Real64 &IPLV,
     364             :                          Optional<Real64 const> CondVolFlowRate,
     365             :                          Optional_int_const CondLoopNum,
     366             :                          Optional<Real64 const> OpenMotorEff)
     367             :     {
     368             : 
     369             :         // SUBROUTINE INFORMATION:
     370             :         //       AUTHOR         Chandan Sharma, FSEC
     371             :         //       DATE WRITTEN   January 2012
     372             :         //       Modified       na
     373             :         //       RE-ENGINEERED  na
     374             : 
     375             :         // PURPOSE OF THIS SUBROUTINE:
     376             :         //     Calculates Integrated Part Load Value (IPLV) for EIR and reformulated EIR chillers.
     377             :         //     Writes the result to EIO file.
     378             :         // METHODOLOGY EMPLOYED:
     379             :         // (1) Obtains the reference cooling capacity, reference COP and performance curves of the chiller
     380             :         // (2) Evaluates the cooling capacity at AHRI test conditions (Per AHRI 551/591,2011 Table 3)
     381             :         // (3) Evaluates the EIR at AHRI test conditions (Per AHRI 551/591,2011 Table 3)
     382             :         // (4) The EER is evaluated from the total cooling capacity and total electric power
     383             :         //     evaluated at the standard rated test conditions.  The IPLV is a weighted value of the COP evaluated
     384             :         //     at four different capacities of 100%, 75%, 50% and 25%.  The reduced capacity COPs are evaluated
     385             :         //     at different outdoor coil entering temperatures.
     386             :         // REFERENCES:
     387             :         // (1) AHRI Standard 551/591-2011:  Standard for Performance Rating of Water-Chilling Packages using the Vapor
     388             :         //                                  Compression Cycle. Arlington, VA:  Air-Conditioning, Heating,
     389             :         //                                  and Refrigeration Institute.
     390             : 
     391             :         // Using/Aliasing
     392             :         using namespace OutputReportPredefined;
     393             :         using Curve::CurveValue;
     394             :         using Curve::GetCurveName;
     395             :         using FluidProperties::GetDensityGlycol;
     396             :         using FluidProperties::GetSpecificHeatGlycol;
     397             :         using General::SolveRoot;
     398             : 
     399          91 :         Real64 constexpr EvapOutletTemp(6.67); // (44F)
     400          91 :         Real64 constexpr Acc(0.0001);          // Accuracy of result
     401          91 :         int constexpr NumOfReducedCap(4);      // Number of reduced capacity test conditions (100%,75%,50%,and 25%)
     402          91 :         int constexpr IterMax(500);            // Maximum number of iterations
     403             :         static constexpr std::array<Real64, 4> IPLVWeightingFactor = {0.010, 0.42, 0.45, 0.12}; // EER Weighting factors (IPLV)
     404             :         static constexpr std::string_view RoutineName("CalcChillerIPLV");
     405             : 
     406             :         // INTERFACE BLOCK SPECIFICATIONS
     407             :         // na
     408             : 
     409             :         // DERIVED TYPE DEFINITIONS
     410             :         // na
     411             : 
     412             :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
     413          91 :         Real64 AvailChillerCap(0.0);               // Chiller available capacity at current operating conditions [W]
     414          91 :         Real64 EnteringWaterTempReduced(0.0);      // Entering Condenser Water Temperature at reduced conditions [C]
     415          91 :         Real64 EnteringAirDryBulbTempReduced(0.0); // Outdoor unit entering air dry-bulb temperature
     416             :         // at reduced capacity [C]
     417          91 :         Real64 EnteringAirWetBulbTempReduced(0.0); // Outdoor unit entering air wet-bulb temperature
     418             :         // at reduced capacity [C]
     419          91 :         Real64 CondenserInletTemp(0.0);   // Entering Condenser Temperature at reduced conditions [C]
     420          91 :         Real64 CondenserOutletTemp0(0.0); // Lower bound for condenser outlet temperature [C]
     421          91 :         Real64 CondenserOutletTemp1(0.0); // Upper bound for condenser outlet temperature [C]
     422          91 :         Real64 CondenserOutletTemp(0.0);  // Calculated condenser outlet temperature which corresponds
     423             :         // to EnteringWaterTempReduced above [C]
     424          91 :         Real64 Cp(0.0);         // Water specific heat [J/(kg*C)]
     425          91 :         Real64 Rho(0.0);        // Water density [kg/m3]
     426          91 :         Real64 EIR(0.0);        // Inverse of COP at reduced capacity test conditions (100%, 75%, 50%, and 25%)
     427          91 :         Real64 Power(0.0);      // Power at reduced capacity test conditions (100%, 75%, 50%, and 25%)
     428          91 :         Real64 COPReduced(0.0); // COP at reduced capacity test conditions (100%, 75%, 50%, and 25%)
     429          91 :         Real64 LoadFactor(0.0); // Fractional "on" time for last stage at the desired reduced capacity,
     430             :         // (dimensionless)
     431          91 :         Real64 DegradationCoeff(0.0);   // Degradation coeficient, (dimenssionless)
     432          91 :         Real64 ChillerCapFT_rated(0.0); // Chiller capacity fraction at AHRI rated conditions (evaluated as a function of temperature)
     433          91 :         Real64 ChillerCapFT(0.0);       // Chiller capacity fraction (evaluated as a function of temperature)
     434          91 :         Real64 ChillerEIRFT_rated(0.0); // Chiller electric input ratio (EIR = 1 / COP) at AHRI rated conditions as a function of temperature
     435          91 :         Real64 ChillerEIRFT(0.0);       // Chiller electric input ratio (EIR = 1 / COP) as a function of temperature
     436          91 :         Real64 ChillerEIRFPLR(0.0);     // Chiller EIR as a function of part-load ratio (PLR)
     437          91 :         Real64 PartLoadRatio(0.0);      // Part load ratio (PLR) at which chiller is operatign at reduced capacity
     438             :         int RedCapNum;                  // Integer counter for reduced capacity
     439             :         int SolFla;                     // Flag of solver
     440             : 
     441             :         // Initialize local variables
     442          91 :         AvailChillerCap = 0.0;
     443          91 :         EnteringWaterTempReduced = 0.0;
     444          91 :         EnteringAirDryBulbTempReduced = 0.0;
     445          91 :         EnteringAirWetBulbTempReduced = 0.0;
     446          91 :         CondenserInletTemp = 0.0;
     447          91 :         CondenserOutletTemp0 = 0.0;
     448          91 :         CondenserOutletTemp1 = 0.0;
     449          91 :         CondenserOutletTemp = 0.0;
     450          91 :         Cp = 0.0;
     451          91 :         Rho = 0.0;
     452          91 :         IPLV = 0.0;
     453          91 :         EIR = 0.0;
     454          91 :         Power = 0.0;
     455          91 :         COPReduced = 0.0;
     456          91 :         LoadFactor = 0.0;
     457          91 :         DegradationCoeff = 0.0;
     458          91 :         ChillerCapFT_rated = 0.0;
     459          91 :         ChillerCapFT = 0.0;
     460          91 :         ChillerEIRFT_rated = 0.0;
     461          91 :         ChillerEIRFT = 0.0;
     462          91 :         ChillerEIRFPLR = 0.0;
     463          91 :         PartLoadRatio = 0.0;
     464             : 
     465          91 :         CheckCurveLimitsForIPLV(state, ChillerName, ChillerType, CondenserType, CapFTempCurveIndex, EIRFTempCurveIndex);
     466             : 
     467             :         // IPLV calculations:
     468         455 :         for (RedCapNum = 0; RedCapNum < NumOfReducedCap; ++RedCapNum) {
     469         364 :             if (CondenserType == DataPlant::CondenserType::WaterCooled) {
     470             :                 // get the entering water temperature for the reduced capacity test conditions
     471         328 :                 if (ReducedPLR[RedCapNum] > 0.50) {
     472         164 :                     EnteringWaterTempReduced = 8.0 + 22.0 * ReducedPLR[RedCapNum];
     473             :                 } else {
     474         164 :                     EnteringWaterTempReduced = 19.0;
     475             :                 }
     476         328 :                 CondenserInletTemp = EnteringWaterTempReduced;
     477          36 :             } else if (CondenserType == DataPlant::CondenserType::AirCooled) {
     478             :                 // get the outdoor air dry bulb temperature for the reduced capacity test conditions
     479          32 :                 if (ReducedPLR[RedCapNum] > 0.3125) {
     480          24 :                     EnteringAirDryBulbTempReduced = 3.0 + 32.0 * ReducedPLR[RedCapNum];
     481             :                 } else {
     482           8 :                     EnteringAirDryBulbTempReduced = 13.0;
     483             :                 }
     484          32 :                 CondenserInletTemp = EnteringAirDryBulbTempReduced;
     485             :             } else { // EvaporativelyCooled Condenser
     486             :                 // get the outdoor air wet bulb temperature for the reduced capacity test conditions
     487           4 :                 EnteringAirWetBulbTempReduced = 10.0 + 14.0 * ReducedPLR[RedCapNum];
     488           4 :                 CondenserInletTemp = EnteringAirWetBulbTempReduced;
     489             :             }
     490             : 
     491         364 :             if (ChillerType == DataPlant::PlantEquipmentType::Chiller_ElectricEIR) {
     492         204 :                 if (RedCapNum == 0) {
     493             :                     // Get curve modifier values at rated conditions (load = 100%)
     494          51 :                     ChillerCapFT_rated = CurveValue(state, CapFTempCurveIndex, EvapOutletTemp, CondenserInletTemp);
     495          51 :                     ChillerEIRFT_rated = CurveValue(state, EIRFTempCurveIndex, EvapOutletTemp, CondenserInletTemp);
     496             : 
     497             :                     // Report rated capacity and chiller COP
     498          51 :                     PreDefTableEntry(state, state.dataOutRptPredefined->pdchMechRatCap, ChillerName, RefCap * ChillerCapFT_rated);
     499          51 :                     PreDefTableEntry(state, state.dataOutRptPredefined->pdchMechRatEff, ChillerName, RefCOP / ChillerEIRFT_rated);
     500             :                 }
     501             : 
     502             :                 // Get capacity curve info with respect to CW setpoint and entering condenser temps
     503         204 :                 ChillerCapFT = CurveValue(state, CapFTempCurveIndex, EvapOutletTemp, CondenserInletTemp);
     504             : 
     505         204 :                 ChillerEIRFT = CurveValue(state, EIRFTempCurveIndex, EvapOutletTemp, CondenserInletTemp);
     506             : 
     507         204 :                 PartLoadRatio = ReducedPLR[RedCapNum] * ChillerCapFT_rated / ChillerCapFT;
     508             : 
     509         204 :                 if (PartLoadRatio >= MinUnloadRat) {
     510         164 :                     ChillerEIRFPLR = CurveValue(state, EIRFPLRCurveIndex, PartLoadRatio);
     511             :                 } else {
     512          40 :                     ChillerEIRFPLR = CurveValue(state, EIRFPLRCurveIndex, MinUnloadRat);
     513          40 :                     PartLoadRatio = MinUnloadRat;
     514             :                 }
     515             : 
     516         160 :             } else if (ChillerType == DataPlant::PlantEquipmentType::Chiller_ElectricReformEIR) {
     517         320 :                 Cp = GetSpecificHeatGlycol(state,
     518         160 :                                            state.dataPlnt->PlantLoop(CondLoopNum).FluidName,
     519             :                                            EnteringWaterTempReduced,
     520         160 :                                            state.dataPlnt->PlantLoop(CondLoopNum).FluidIndex,
     521             :                                            RoutineName);
     522             : 
     523         320 :                 Rho = GetDensityGlycol(state,
     524         160 :                                        state.dataPlnt->PlantLoop(CondLoopNum).FluidName,
     525             :                                        EnteringWaterTempReduced,
     526         160 :                                        state.dataPlnt->PlantLoop(CondLoopNum).FluidIndex,
     527             :                                        RoutineName);
     528             : 
     529         160 :                 Real64 reducedPLR = ReducedPLR[RedCapNum];
     530         160 :                 CondenserOutletTemp0 = EnteringWaterTempReduced + 0.1;
     531         160 :                 CondenserOutletTemp1 = EnteringWaterTempReduced + 10.0;
     532             : 
     533             :                 // CONST_LAMBDA_CAPTURE Issue, see PR 9670
     534         160 :                 Real64 tmpEvapOutletTemp = EvapOutletTemp;
     535             :                 auto f = [&state,
     536             :                           EnteringWaterTempReduced,
     537             :                           Cp,
     538             :                           reducedPLR,
     539             :                           CondVolFlowRate,
     540             :                           Rho,
     541             :                           CapFTempCurveIndex,
     542             :                           EIRFTempCurveIndex,
     543             :                           EIRFPLRCurveIndex,
     544             :                           RefCap,
     545             :                           RefCOP,
     546             :                           OpenMotorEff,
     547             :                           tmpEvapOutletTemp,
     548        8831 :                           ChillerCapFT_rated](Real64 const CondenserOutletTemp) {
     549         630 :                     Real64 AvailChillerCap(0.0);         // Chiller available capacity at current operating conditions [W]
     550         630 :                     Real64 CondenserInletTemp(0.0);      // Calculated condenser inlet temperature [C]
     551         630 :                     Real64 QEvap(0.0);                   // Rate of heat transfer to the evaporator coil [W]
     552         630 :                     Real64 QCond(0.0);                   // Rate of heat transfer to the condenser coil [W]
     553         630 :                     Real64 Power(0.0);                   // Power at reduced capacity test conditions (100%, 75%, 50%, and 25%)
     554         630 :                     Real64 ReformEIRChillerCapFT(0.0);   // Chiller capacity fraction (evaluated as a function of temperature)
     555         630 :                     Real64 ReformEIRChillerEIRFT(0.0);   // Chiller electric input ratio (EIR = 1 / COP) as a function of temperature
     556         630 :                     Real64 ReformEIRChillerEIRFPLR(0.0); // Chiller EIR as a function of part-load ratio (PLR)
     557         630 :                     Real64 PartLoadRatio(0.0);           // Chiller part load ratio
     558             : 
     559        1260 :                     ReformEIRChillerCapFT = CurveValue(state, CapFTempCurveIndex, tmpEvapOutletTemp, CondenserOutletTemp);
     560             : 
     561        1260 :                     ReformEIRChillerEIRFT = CurveValue(state, EIRFTempCurveIndex, tmpEvapOutletTemp, CondenserOutletTemp);
     562             : 
     563             :                     // Available chiller capacity as a function of temperature
     564         630 :                     AvailChillerCap = RefCap * ReformEIRChillerCapFT;
     565             : 
     566        1260 :                     ReformEIRChillerEIRFPLR = CurveValue(state, EIRFPLRCurveIndex, CondenserOutletTemp, reducedPLR);
     567             : 
     568         630 :                     Power = (AvailChillerCap / RefCOP) * ReformEIRChillerEIRFPLR * ReformEIRChillerEIRFT;
     569             : 
     570         630 :                     if (reducedPLR >= 1.0) {
     571         159 :                         PartLoadRatio = reducedPLR;
     572             :                     } else {
     573         471 :                         PartLoadRatio = reducedPLR * ChillerCapFT_rated / ReformEIRChillerCapFT;
     574             :                     }
     575             : 
     576         630 :                     QEvap = AvailChillerCap * PartLoadRatio;
     577             : 
     578         630 :                     QCond = Power * OpenMotorEff + QEvap;
     579             : 
     580         630 :                     if (CapFTempCurveIndex > DataBranchAirLoopPlant::MassFlowTolerance) {
     581        1890 :                         CondenserInletTemp = CondenserOutletTemp - QCond / (CondVolFlowRate * Rho) / Cp;
     582             :                     }
     583        1260 :                     return (EnteringWaterTempReduced - CondenserInletTemp) / EnteringWaterTempReduced;
     584         320 :                 };
     585             : 
     586         160 :                 General::SolveRoot(state, Acc, IterMax, SolFla, CondenserOutletTemp, f, CondenserOutletTemp0, CondenserOutletTemp1);
     587         160 :                 if (SolFla == -1) {
     588           0 :                     ShowWarningError(state, "Iteration limit exceeded in calculating Reform Chiller IPLV");
     589           0 :                     ShowContinueError(state, "Reformulated Chiller IPLV calculation failed for " + ChillerName);
     590         160 :                 } else if (SolFla == -2) {
     591           0 :                     ShowWarningError(state, "Bad starting values for calculating Reform Chiller IPLV");
     592           0 :                     ShowContinueError(state, "Reformulated Chiller IPLV calculation failed for " + ChillerName);
     593             :                 }
     594             : 
     595         160 :                 if (RedCapNum == 0) {
     596             :                     // Get curve modifier values at rated conditions (load = 100%)
     597          40 :                     ChillerCapFT_rated = CurveValue(state, CapFTempCurveIndex, EvapOutletTemp, CondenserOutletTemp);
     598          40 :                     ChillerEIRFT_rated = CurveValue(state, EIRFTempCurveIndex, EvapOutletTemp, CondenserOutletTemp);
     599             : 
     600             :                     // Report rated capacity and chiller COP
     601          40 :                     PreDefTableEntry(state, state.dataOutRptPredefined->pdchMechRatCap, ChillerName, RefCap * ChillerCapFT_rated);
     602          40 :                     PreDefTableEntry(state, state.dataOutRptPredefined->pdchMechRatEff, ChillerName, RefCOP / ChillerEIRFT_rated);
     603             :                 }
     604             : 
     605         160 :                 ChillerCapFT = CurveValue(state, CapFTempCurveIndex, EvapOutletTemp, CondenserOutletTemp);
     606             : 
     607         160 :                 ChillerEIRFT = CurveValue(state, EIRFTempCurveIndex, EvapOutletTemp, CondenserOutletTemp);
     608             : 
     609         160 :                 PartLoadRatio = ReducedPLR[RedCapNum] * ChillerCapFT_rated / ChillerCapFT;
     610             : 
     611         160 :                 if (PartLoadRatio >= MinUnloadRat) {
     612         157 :                     ChillerEIRFPLR = CurveValue(state, EIRFPLRCurveIndex, CondenserOutletTemp, PartLoadRatio);
     613             :                 } else {
     614           3 :                     ChillerEIRFPLR = CurveValue(state, EIRFPLRCurveIndex, CondenserOutletTemp, MinUnloadRat);
     615           3 :                     PartLoadRatio = MinUnloadRat;
     616             :                 }
     617             :             } else {
     618           0 :                 assert(false);
     619             :             }
     620             : 
     621             :             // Available chiller capacity as a function of temperature
     622         364 :             if (RefCap > 0.0 && RefCOP > 0.0 && ChillerCapFT > 0.0 && ChillerEIRFT > 0.0) {
     623         364 :                 AvailChillerCap = RefCap * ChillerCapFT;
     624         364 :                 Power = (AvailChillerCap / RefCOP) * ChillerEIRFPLR * ChillerEIRFT;
     625         364 :                 EIR = Power / (PartLoadRatio * AvailChillerCap);
     626             : 
     627         364 :                 if (ReducedPLR[RedCapNum] >= MinUnloadRat) {
     628         364 :                     COPReduced = 1.0 / EIR;
     629             :                 } else {
     630           0 :                     LoadFactor = (ReducedPLR[RedCapNum] * RefCap) / (MinUnloadRat * AvailChillerCap);
     631           0 :                     DegradationCoeff = 1.130 - 0.130 * LoadFactor;
     632           0 :                     COPReduced = 1.0 / (DegradationCoeff * EIR);
     633             :                 }
     634         364 :                 IPLV += IPLVWeightingFactor[RedCapNum] * COPReduced;
     635             :             } else {
     636             :                 {
     637           0 :                     if (ChillerType == DataPlant::PlantEquipmentType::Chiller_ElectricEIR) {
     638           0 :                         ShowWarningError(state,
     639           0 :                                          "Chiller:Electric:EIR = " + ChillerName + ":  Integrated Part Load Value (IPLV) cannot be calculated.");
     640           0 :                     } else if (ChillerType == DataPlant::PlantEquipmentType::Chiller_ElectricReformEIR) {
     641             : 
     642           0 :                         ShowWarningError(state,
     643           0 :                                          "Chiller:Electric:ReformulatedEIR = " + ChillerName +
     644             :                                              ":  Integrated Part Load Value (IPLV) cannot be calculated.");
     645             :                     }
     646             :                 }
     647           0 :                 if (RefCap <= 0.0) {
     648           0 :                     ShowContinueError(
     649             :                         state,
     650           0 :                         format(" Check the chiller autosized or user specified capacity. Autosized or specified chiller capacity = {:.2R}", RefCap));
     651             :                 }
     652           0 :                 if (RefCOP <= 0.0) {
     653           0 :                     ShowContinueError(state, format(" Check the chiller reference or rated COP specified. Specified COP = {:.2R}", RefCOP));
     654             :                 }
     655           0 :                 if (ChillerCapFT <= 0.0) {
     656           0 :                     ShowContinueError(state,
     657           0 :                                       format(" Check limits in Cooling Capacity Function of Temperature Curve, Curve Type = {}, Curve Name = {}.",
     658           0 :                                              Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(CapFTempCurveIndex).curveType)],
     659           0 :                                              GetCurveName(state, CapFTempCurveIndex)));
     660           0 :                     ShowContinueError(state, format(" ..ChillerCapFT value at standard test condition = {:.2R}", ChillerCapFT));
     661             :                 }
     662           0 :                 if (ChillerEIRFT <= 0.0) {
     663           0 :                     ShowContinueError(state,
     664           0 :                                       format(" Check limits in EIR Function of Temperature Curve, Curve Type = {}, Curve Name = {}.",
     665           0 :                                              Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(EIRFTempCurveIndex).curveType)],
     666           0 :                                              GetCurveName(state, EIRFTempCurveIndex)));
     667           0 :                     ShowContinueError(state, format(" ..ChillerEIRFT value at standard test condition = {:.2R}", ChillerEIRFT));
     668             :                 }
     669           0 :                 IPLV = 0.0;
     670           0 :                 break;
     671             :             }
     672             :         }
     673             : 
     674             :         // Writes the IPLV value to the EIO file and standard tabular output tables
     675          91 :         ReportChillerIPLV(state, ChillerName, ChillerType, IPLV, IPLV * ConvFromSIToIP);
     676          91 :     }
     677             : 
     678          91 :     void ReportChillerIPLV(EnergyPlusData &state,
     679             :                            std::string const &ChillerName,            // Name of Chiller for which IPLV is calculated
     680             :                            DataPlant::PlantEquipmentType ChillerType, // Type of Chiller - EIR or Reformulated EIR
     681             :                            Real64 const IPLVValueSI,                  // IPLV value in SI units {W/W}
     682             :                            Real64 const IPLVValueIP                   // IPLV value in IP units {Btu/W-h}
     683             :     )
     684             :     {
     685             : 
     686             :         // SUBROUTINE INFORMATION:
     687             :         //       AUTHOR         Chandan Sharma
     688             :         //       DATE WRITTEN   January 2012
     689             :         //       MODIFIED       na
     690             :         //       RE-ENGINEERED  na
     691             : 
     692             :         // PURPOSE OF THIS SUBROUTINE:
     693             :         // This subroutine writes the IPLV values in SI and IP units to
     694             :         // the "eio" and tabular output files for EIR Chillers.
     695             : 
     696             :         // Using/Aliasing
     697             :         using namespace OutputReportPredefined;
     698             : 
     699             :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
     700          91 :         auto &StandardRatingsMyOneTimeFlag = state.dataHVACGlobal->StandardRatingsMyOneTimeFlag;
     701             : 
     702             :         // Formats
     703             : 
     704          91 :         if (StandardRatingsMyOneTimeFlag) {
     705          66 :             print(state.files.eio,
     706             :                   "{}\n",
     707          66 :                   "! <Chiller Standard Rating Information>, Component Type, Component Name, IPLV in SI Units {W/W}, IPLV in IP Units {Btu/W-h}");
     708          66 :             StandardRatingsMyOneTimeFlag = false;
     709             :         }
     710             : 
     711             :         {
     712             :             static constexpr std::string_view Format_991(" Chiller Standard Rating Information, {}, {}, {:.2R}, {:.2R}\n");
     713          91 :             if (ChillerType == DataPlant::PlantEquipmentType::Chiller_ElectricEIR) {
     714             : 
     715          51 :                 print(state.files.eio, Format_991, "Chiller:Electric:EIR", ChillerName, IPLVValueSI, IPLVValueIP);
     716          51 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchMechType, ChillerName, "Chiller:Electric:EIR");
     717             : 
     718          40 :             } else if (ChillerType == DataPlant::PlantEquipmentType::Chiller_ElectricReformEIR) {
     719             : 
     720          40 :                 print(state.files.eio, Format_991, "Chiller:Electric:ReformulatedEIR", ChillerName, IPLVValueSI, IPLVValueIP);
     721          40 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchMechType, ChillerName, "Chiller:Electric:ReformulatedEIR");
     722             :             }
     723             :         }
     724             : 
     725             :         // Note: We don't want unit conversio, here, but it's ok since W/W will convert to itself since the column heading has "SI" as a hint
     726          91 :         PreDefTableEntry(state, state.dataOutRptPredefined->pdchMechIPLVSI, ChillerName, IPLVValueSI, 2);
     727          91 :         PreDefTableEntry(state, state.dataOutRptPredefined->pdchMechIPLVIP, ChillerName, IPLVValueIP, 2);
     728          91 :     }
     729             : 
     730          91 :     void CheckCurveLimitsForIPLV(EnergyPlusData &state,
     731             :                                  std::string const &ChillerName,               // Name of Chiller
     732             :                                  DataPlant::PlantEquipmentType ChillerType,    // Type of Chiller - EIR or ReformulatedEIR
     733             :                                  DataPlant::CondenserType const CondenserType, // Type of Condenser - Air Cooled, Water Cooled or Evap Cooled
     734             :                                  int const CapFTempCurveIndex,                 // Index for the total cooling capacity modifier curve
     735             :                                  int const EIRFTempCurveIndex                  // Index for the energy input ratio modifier curve
     736             :     )
     737             :     {
     738             : 
     739             :         // SUBROUTINE INFORMATION:
     740             :         //       AUTHOR            Chandan Sharma, FSEC
     741             :         //       DATE WRITTEN      January 2012
     742             :         //       MODIFIED          na
     743             :         //       RE-ENGINEERED     na
     744             : 
     745             :         // PURPOSE OF THIS SUBROUTINE:
     746             :         // Checks the limits of the various curves used in EIR chiller and returns .FALSE. if the limits do not include
     747             :         // the standard test condition(s).
     748             : 
     749             :         // Using/Aliasing
     750             :         using Curve::GetCurveMinMaxValues;
     751             :         using Curve::GetCurveName;
     752             : 
     753             :         // Following parameters are taken from AHRI 551/591,2011 Table 3
     754          91 :         Real64 constexpr HighEWTemp(30.0);       // Entering water temp in degrees C at full load capacity (85F)
     755          91 :         Real64 constexpr LowEWTemp(19.0);        // Entering water temp in degrees C at minimum reduced capacity (65F)
     756          91 :         Real64 constexpr OAHighEDBTemp(35.0);    // Outdoor air dry-bulb temp in degrees C at full load capacity (95F)
     757          91 :         Real64 constexpr OAHighEWBTemp(24.0);    // Outdoor air wet-bulb temp in degrees C at full load capacity (75F)
     758          91 :         Real64 constexpr LeavingWaterTemp(6.67); // Evaporator leaving water temperature in degrees C [44 F]
     759             : 
     760             :         //  Minimum and Maximum independent variable limits from Total Cooling Capacity Function of Temperature Curve
     761          91 :         Real64 CapacityLWTempMin(0.0);           // Capacity modifier Min value (leaving water temp), from the Curve:BiQuadratic object
     762          91 :         Real64 CapacityLWTempMax(0.0);           // Capacity modifier Max value (leaving water temp), from the Curve:BiQuadratic object
     763          91 :         Real64 CapacityEnteringCondTempMin(0.0); // Capacity modifier Min value (entering cond temp), from the Curve:BiQuadratic object
     764          91 :         Real64 CapacityEnteringCondTempMax(0.0); // Capacity modifier Max value (entering cond temp), from the Curve:BiQuadratic object
     765             : 
     766             :         //  Minimum and Maximum independent variable limits from Energy Input Ratio (EIR) Function of Temperature Curve
     767          91 :         Real64 EIRLWTempMin(0.0);           // EIR modifier Min value (leaving water temp), from the Curve:BiQuadratic object
     768          91 :         Real64 EIRLWTempMax(0.0);           // EIR modifier Max value (leaving water temp), from the Curve:BiQuadratic object
     769          91 :         Real64 EIREnteringCondTempMin(0.0); // EIR modifier Min value (entering cond temp), from the Curve:BiQuadratic object
     770          91 :         Real64 EIREnteringCondTempMax(0.0); // EIR modifier Max value (entering cond temp), from the Curve:BiQuadratic object
     771             : 
     772          91 :         Real64 HighCondenserEnteringTempLimit(0.0); // High limit of entering condenser temperature
     773          91 :         Real64 LowCondenserEnteringTempLimit(0.0);  // Low limit of entering condenser temperature
     774             : 
     775          91 :         bool CapCurveIPLVLimitsExceeded(false); // Logical for capacity curve temperature limits being exceeded (IPLV calcs)
     776          91 :         bool EIRCurveIPLVLimitsExceeded(false); // Logical for EIR temperature limits being exceeded (IPLV calcs)
     777             : 
     778          91 :         GetCurveMinMaxValues(
     779             :             state, CapFTempCurveIndex, CapacityLWTempMin, CapacityLWTempMax, CapacityEnteringCondTempMin, CapacityEnteringCondTempMax);
     780          91 :         GetCurveMinMaxValues(state, EIRFTempCurveIndex, EIRLWTempMin, EIRLWTempMax, EIREnteringCondTempMin, EIREnteringCondTempMax);
     781             : 
     782          91 :         if (CondenserType == DataPlant::CondenserType::WaterCooled) {
     783          82 :             HighCondenserEnteringTempLimit = HighEWTemp;
     784          82 :             LowCondenserEnteringTempLimit = LowEWTemp;
     785           9 :         } else if (CondenserType == DataPlant::CondenserType::AirCooled) {
     786           8 :             HighCondenserEnteringTempLimit = OAHighEDBTemp;
     787           8 :             LowCondenserEnteringTempLimit = OAHighEDBTemp;
     788             :         } else { // Evaporatively Cooled Condenser
     789           1 :             HighCondenserEnteringTempLimit = OAHighEWBTemp;
     790           1 :             LowCondenserEnteringTempLimit = OAHighEWBTemp;
     791             :         }
     792             : 
     793             :         // Checking the limits of capacity modifying curve for temperatures (IPLV high and low test conditions)
     794         146 :         if (CapacityEnteringCondTempMax < HighCondenserEnteringTempLimit || CapacityEnteringCondTempMin > LowCondenserEnteringTempLimit ||
     795         110 :             CapacityLWTempMax < LeavingWaterTemp || CapacityLWTempMin > LeavingWaterTemp) {
     796          36 :             CapCurveIPLVLimitsExceeded = true;
     797             :         }
     798             :         // Checking the limits of EIR modifying curve for temperatures (IPLV high and low test conditions)
     799         146 :         if (EIREnteringCondTempMax < HighCondenserEnteringTempLimit || EIREnteringCondTempMin > LowCondenserEnteringTempLimit ||
     800         110 :             EIRLWTempMax < LeavingWaterTemp || EIRLWTempMin > LeavingWaterTemp) {
     801          36 :             EIRCurveIPLVLimitsExceeded = true;
     802             :         }
     803             : 
     804             :         // For IPLV:
     805          91 :         if (CapCurveIPLVLimitsExceeded || EIRCurveIPLVLimitsExceeded) {
     806          36 :             if (state.dataGlobal->DisplayExtraWarnings) {
     807             : 
     808           4 :                 if (ChillerType == DataPlant::PlantEquipmentType::Chiller_ElectricEIR) {
     809             : 
     810          12 :                     ShowWarningError(state,
     811           8 :                                      "Chiller:Electric:EIR = " + ChillerName +
     812             :                                          ":  Integrated Part Load Value (IPLV) calculated is not at the AHRI test condition.");
     813           0 :                 } else if (ChillerType == DataPlant::PlantEquipmentType::Chiller_ElectricReformEIR) {
     814             : 
     815           0 :                     ShowWarningError(state,
     816           0 :                                      "Chiller:Electric:ReformulatedEIR = " + ChillerName +
     817             :                                          ":  Integrated Part Load Value (IPLV) calculated is not at the AHRI test condition.");
     818             :                 }
     819           4 :                 if (CapCurveIPLVLimitsExceeded) {
     820          12 :                     ShowContinueError(state,
     821           8 :                                       format(" Check limits in Cooling Capacity Function of Temperature Curve, Curve Type = {}, Curve Name = {}",
     822           4 :                                              Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(CapFTempCurveIndex).curveType)],
     823          12 :                                              GetCurveName(state, CapFTempCurveIndex)));
     824             :                 }
     825           4 :                 if (EIRCurveIPLVLimitsExceeded) {
     826          12 :                     ShowContinueError(state,
     827           8 :                                       format(" Check limits in EIR Function of Temperature Curve, Curve Type = {}, Curve Name = {}",
     828           4 :                                              Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(EIRFTempCurveIndex).curveType)],
     829          12 :                                              GetCurveName(state, EIRFTempCurveIndex)));
     830             :                 }
     831             :             }
     832             :         }
     833          91 :     }
     834             : 
     835         745 :     void CalcDXCoilStandardRating(
     836             :         EnergyPlusData &state,
     837             :         std::string const &DXCoilName,                             // Name of DX coil for which HSPF is calculated
     838             :         std::string const &DXCoilType,                             // Type of DX coil for which HSPF is calculated
     839             :         int const DXCoilType_Num,                                  // Integer Type of DX coil - heating or cooling
     840             :         int const ns,                                              // Number of compressor speeds
     841             :         Array1A<Real64> const RatedTotalCapacity,                  // Reference capacity of DX coil [W]
     842             :         Array1A<Real64> const RatedCOP,                            // Reference coefficient of performance [W/W]
     843             :         Array1A_int const CapFFlowCurveIndex,                      // Index for the capacity as a function of flow fraction modifier curve
     844             :         Array1A_int const CapFTempCurveIndex,                      // Index for the capacity as a function of temperature modifier curve
     845             :         Array1A_int const EIRFFlowCurveIndex,                      // Index for the EIR as a function of flow fraction modifier curve
     846             :         Array1A_int const EIRFTempCurveIndex,                      // Index for the EIR as a function of temperature modifier curve
     847             :         Array1A_int const PLFFPLRCurveIndex,                       // Index for the PLF vs part-load ratio curve
     848             :         Array1A<Real64> const RatedAirVolFlowRate,                 // Reference air flow rate of DX coil [m3/s]
     849             :         Array1A<Real64> const FanPowerPerEvapAirFlowRateFromInput, // Reference fan power per evap air flow rate [W/(m3/s)]
     850             :         Array1A<Real64> const FanPowerPerEvapAirFlowRateFromInput_2023,
     851             :         Optional_int_const
     852             :             RegionNum, // Region number for calculating HSPF of single speed DX heating coil //Autodesk:OPTIONAL Used without PRESENT check
     853             :         Optional<Real64 const> MinOATCompressor, // Minimum OAT for heat pump compressor operation [C] //Autodesk:OPTIONAL Used without PRESENT check
     854             :         Optional<Real64 const>
     855             :             OATempCompressorOn, // The outdoor temperature when the compressor is automatically turned //Autodesk:OPTIONAL Used without PRESENT check
     856             :         Optional_bool_const
     857             :             OATempCompressorOnOffBlank, // Flag used to determine low temperature cut out factor //Autodesk:OPTIONAL Used without PRESENT check
     858             :         Optional<HPdefrostControl const> DefrostControl, // defrost control; 1=timed, 2=on-demand //Autodesk:OPTIONAL Used without PRESENT check
     859             :         Optional_bool_const ASHRAE127StdRprt             // true if user wishes to report ASHRAE 127 standard ratings
     860             :     )
     861             :     {
     862             : 
     863             :         // SUBROUTINE INFORMATION:
     864             :         //       AUTHOR         Bereket Nigusse, Chandan Sharma FSEC
     865             :         //       DATE WRITTEN   February 2010,
     866             :         //                      B. Nigusse, May 2010  Added EER and IEER Calculation
     867             :         //                      C. Sharma, March 2012  Added HSPF Calculation for single speed HP
     868             :         //                      B. Nigusse, August 2012 Added SEER Calculation for Multi-speed HP
     869             :         //                      B. Nigusse, November 2012 Added HSPF Calculation for Multi-speed HP
     870             : 
     871             :         //       RE-ENGINEERED  na
     872             : 
     873             :         // PURPOSE OF THIS SUBROUTINE:
     874             :         //     Calculates:
     875             :         //                 (1) Standard Rated (net) Cooling Capacity
     876             :         //                 (2) Seasonal Energy Efficiency Ratio (SEER)
     877             :         //                 (3) Energy Efficiency Ratio (EER),
     878             :         //                 (4) Integrated Energy Efficiency Ratio (IEER)
     879             :         //                 for Air-to-Air Direct Expansion Air Conditioner and Heat Pumps having a single-speed compressor,
     880             :         //                 fixed speed indoor supply air fan, and air-cooled condensers. Writes the result to EIO file.
     881             :         //                 (5) Heating Seasonal Performance Factor (HSPF) for Air-Source Direct Expansion Heat Pumps having
     882             :         //                  a single-speed compressor, fixed speed indoor supply air fan
     883             :         //                 (6) Standard Rated (net) Cooling Capacity; and
     884             :         //                 (7) Seasonal Energy Efficiency Ratio (SEER) for Air-to-Air Heat Pumps having multi-speed
     885             :         //                     compressor.
     886             :         //                 (8) Heating Seasonal Performance Factor (HSPF) for Air-to-Air Heat Pumps having multi-speed
     887             :         //                     compressor.
     888             :         // METHODOLOGY EMPLOYED:
     889             :         // (A) Methodology for calculating standard ratings for DX air conditioners
     890             :         //     (1) Obtains the rated condition parameters:
     891             :         //         Cooling capacity (User specified or Autosized Value)
     892             :         //         Rated Air volume flow rate through the DX Cooling Coil (User specified or autosized value)
     893             :         //     (2) Evaluates the total cooling coil capacity at AHRI test conditions 26.7C/19.4C/27.8C. Then net
     894             :         //         cooling capacity is determined from the total cooling capacity of the DX coil at the AHRI test
     895             :         //         conditions and accounting for the INDOOR supply air fan heat.
     896             :         //     (3) Calculates the electric power consumed by the DX Coil Unit (compressor + outdoor condenser fan).
     897             :         //         Evaluates the EIR capacity and flow fraction modifiers at 26.7C/19.4C/27.8C. The net electric
     898             :         //         power consumption is determined by adding the indoor fan electric power to the electric power
     899             :         //         consumption by the DX Coil Condenser Fan and Compressor at the AHRI test conditions.
     900             :         //     (4) The EER is evaluated from the total net cooling capacity and total electric power
     901             :         //         evaluated at the standard rated test conditions.  The IEER is a weighted value of the EER evaluated
     902             :         //         at four different capacities of 100%, 75%, 50% and 25%.  The reduced capacity EERs are evaluated
     903             :         //         at different outdoor coil entering air dry-bulb temperatures.
     904             :         // (B) Methodology for calculating standard ratings for DX air air source heat pumps
     905             :         //     (1) Obtains the rated condition parameters:
     906             :         //         heating capacity (User specified or Autosized Value), COP,  Rated Air volume flow rate through the
     907             :         //         DX Cooling Coil (User specified or autosized value) and Fan power per rated air flow rate
     908             :         //     (2) Evaluates the heating coil capacities for AHRI tests H1, H2 and H3 using the performance cuves and
     909             :         //         input values specified at (1) above. Then net heating capacity is determined from the total heating capacity
     910             :         //         of the DX coil at the AHRI test conditions and accounting for the INDOOR supply air fan heat.
     911             :         //     (3) Calculates the electric power consumed by the DX Coil Unit (compressor + outdoor condenser fan).
     912             :         //         The net electric power consumption is determined by adding the indoor fan electric power to the
     913             :         //         electric power consumption by the DX Coil Condenser Fan and Compressor at the AHRI test conditions.
     914             :         //     (4) High Temperature Heating Standard (Net) Rating Capacity and Low Temperature Heating Standard (Net)
     915             :         //         Rating Capacity capacity are determined using tests H1 adn H3 per ANSI/AHRI 210/240 2008.
     916             :         //     (5) The HSPF is evaluated from the total net heating capacity and total electric power
     917             :         //         evaluated at the standard rated test conditions. For user specified region number, the outdoor temperatures
     918             :         //         are Binned (grouped) and fractioanl bin hours for each bin over the entire heating season are taken
     919             :         //         from AHRI 210/240. Then for each bin, building load, heat pump energy adn resistance space heating enegry are
     920             :         //         calculated. The sum of building load divided by sum of heat pump and resistance space heating over the
     921             :         //         entire heating season gives the HSPF. The detailed calculation algorithms of calculating HSPF
     922             :         //         are described in Engineering Reference.
     923             :         // (C) Methodology for calculating standard ratings for Multi-Speed Heat Pumps
     924             :         //     Net Total Cooling Capacity and SEER
     925             :         //     (1) Obtains the rated condition parameters:
     926             :         //         Cooling capacity (User specified or Autosized Value)
     927             :         //         Rated Air volume flow rate through the DX Cooling Coil (User specified or autosized value)
     928             :         //     (2) Evaluates the total cooling coil capacity at AHRI A2 test conditions 26.7C/19.4C/35.0C. Then net
     929             :         //         cooling capacity is determined from the total cooling capacity of the DX coil at the AHRI A2 test
     930             :         //         conditions and accounting for the INDOOR supply air fan effect.  The net total cooling capacity
     931             :         //         is reported at the high (maximum) speed only.
     932             :         //     (3) Calculates the electric power consumed by the DX Coil Unit (compressor + outdoor condenser fan).
     933             :         //         Evaluates the EIR capacity and flow fraction modifiers at A2, B2, B1, and F1 test coditions per
     934             :         //         AHRI/ANSI Std. 210/240 test procedure for multi-speed compressor.  For any inter-
     935             :         //         mediate operating conditions (speed), the successive lower and the higher speed performnace are
     936             :         //         weighed per the standard.  Electric Power consumption is determined by adding the indoor fan
     937             :         //         electric power to the electric power consumption by the outdoor DX Coil Fan and Compressor Power
     938             :         //         at the AHRI test conditions.  The net total cooling capacity is also corrected for the fan heat
     939             :         //         effect for SEER calculation.
     940             :         //     Net Heatingg Capacity and HSPF
     941             :         //     (4) Obtains the rated condition parameters:
     942             :         //         Heating capacity (User specified or Autosized Value)
     943             :         //         Rated Air volume flow rate through the DX Heating Coil (User specified or autosized value)
     944             :         //     (5) Evaluates the heating coil capacity at AHRI H12 test conditions 21.1C/15.6C/8.33C. Then net
     945             :         //         heating capacity is determined from the total heating capacity of the DX coil at the AHRI H12
     946             :         //         test conditions and accounting for the supply supply air fan effect.  The net heating capacity
     947             :         //         is reported at the high (maximum) speed only.
     948             :         //     (6) Calculates the electric power consumed by the DX Coil Unit (compressor + outdoor condenser fan).
     949             :         //         Evaluates the EIR capacity and flow fraction modifiers per AHRI/ANSI Std. 210/240 test procedures
     950             :         //         for two speed compressor (H01, H11, H21, H31, H12, H22, and H32 ). This procedure was modified
     951             :         //         for multispeed heat pumps. For any inter-mediate operating conditions (speed), the successive
     952             :         //         lower and the higher speed performnace are weighed per the standard.
     953             :         //         Electric Power consumption is determined by adding the supply fan electric power to the electric
     954             :         //         power consumption by the outdoor DX Coil Fan and Compressor Power at the AHRI test conditions.
     955             :         //         The net heating capacity is also corrected for the fan heat effect for SEER calculation.
     956             :         // REFERENCES:
     957             :         // (1) ANSI/AHRI Standard 210/240-2008:  Standard for Performance Rating of Unitary Air-Conditioning and
     958             :         //                                       Air-Source Heat Pumps. Arlington, VA:  Air-Conditioning, Heating
     959             :         //                                       , and Refrigeration Institute.
     960             :         // (2) ANSI/AHRI Standard 340/360-2007:  Standard for Performance Rating of Commercial and Industrial
     961             :         //                                       Unitary Air-Conditioning and Heat Pump Equipment.  Arlington,
     962             :         //                                       VA:  Air-Conditioning, Heating, and Refrigeration Institute.
     963             : 
     964             :         // USE STATEMENTS:
     965             : 
     966             :         // Using/Aliasing
     967             :         using Curve::CurveValue;
     968             :         using Curve::GetCurveMinMaxValues;
     969             :         using DataHVACGlobals::CoilDX_CoolingSingleSpeed;
     970             :         using DataHVACGlobals::CoilDX_HeatingEmpirical;
     971             :         using DataHVACGlobals::CoilDX_MultiSpeedCooling;
     972             :         using DataHVACGlobals::CoilDX_MultiSpeedHeating;
     973             : 
     974             :         // Argument array dimensioning
     975         745 :         RatedTotalCapacity.dim(ns);
     976         745 :         RatedCOP.dim(ns);
     977         745 :         CapFFlowCurveIndex.dim(ns);
     978         745 :         CapFTempCurveIndex.dim(ns);
     979         745 :         EIRFFlowCurveIndex.dim(ns);
     980         745 :         EIRFTempCurveIndex.dim(ns);
     981         745 :         PLFFPLRCurveIndex.dim(ns);
     982         745 :         RatedAirVolFlowRate.dim(ns);
     983         745 :         FanPowerPerEvapAirFlowRateFromInput.dim(ns);
     984             : 
     985             :         ////TODO: this will be passed as argument in this method later on
     986             :         // Array1A<Real64> const FanPowerPerEvapAirFlowRateFromInputSEER2;
     987         745 :         FanPowerPerEvapAirFlowRateFromInput_2023.dim(ns);
     988             : 
     989             :         // Locals
     990             :         // SUBROUTINE ARGUMENT DEFINITIONS:
     991             : 
     992             :         // back on, if applicable, following automatic shut off. This field is
     993             :         // used only for HSPF calculation. [C]
     994             : 
     995             :         // SUBROUTINE PARAMETER DEFINITIONS:
     996             : 
     997             :         // INTERFACE BLOCK SPECIFICATIONS
     998             :         // na
     999             : 
    1000             :         // DERIVED TYPE DEFINITIONS
    1001             :         // na
    1002             : 
    1003             :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    1004        1490 :         Array1D<Real64> FanPowerPerEvapAirFlowRate(ns); // Fan power per air volume flow rate through the evaporator coil [W/(m3/s)]
    1005             : 
    1006             :         // Intermediate values calculated from the inputs in the idf file
    1007             :         int spnum; // compressor speed number
    1008             : 
    1009             :         // Calculated and reported to the EIO file
    1010         745 :         Real64 SEER_User(0.0);     // Seasonal Energy Efficiency Ratio using user PLF curve in SI [W/W]
    1011         745 :         Real64 SEER_Standard(0.0); // Seasonal Energy Efficiency Ratio using AHRI 210/240 PLF default curve & C_D in SI [W/W]
    1012         745 :         Real64 EER(0.0);           // Energy Efficiency Ratio in SI [W/W]
    1013         745 :         Real64 IEER(0.0);          // Integerated Energy Efficiency Ratio in SI [W/W]
    1014             : 
    1015             :         // SEER2 ANSI/AHRI 210/240 Standard 2023 Ratings
    1016         745 :         Real64 SEER2_User(0.0);     // Seasonal Energy Efficiency Ratio using user PLF curve in SI [W/W]
    1017         745 :         Real64 SEER2_Standard(0.0); // Seasonal Energy Efficiency Ratio using AHRI 210/240 PLF default curve & C_D in SI [W/W]
    1018         745 :         Real64 EER_2023(0.0);       // Energy Efficiency Ratio in SI [W/W]
    1019         745 :         Real64 IEER_2023(0.0);      // Integerated Energy Efficiency Ratio in SI [W/W]
    1020             : 
    1021         745 :         Real64 HSPF(0.0);                       // Heating Seasonal Performance Factor in SI [W/W]
    1022         745 :         Real64 NetHeatingCapRatedHighTemp(0.0); // Net Rated heating capacity at high temp [W]
    1023         745 :         Real64 NetHeatingCapRatedLowTemp(0.0);  // Net Rated heating capacity at low temp [W]
    1024             : 
    1025             :         // HSPF2 ANSI/AHRI 210/240 Standard 2023 Ratings
    1026         745 :         Real64 HSPF2_2023(0.0);                      // Heating Seasonal Performance Factor in SI [W/W]
    1027         745 :         Real64 NetHeatingCapRatedHighTemp_2023(0.0); // Net Rated heating capacity at high temp [W]
    1028         745 :         Real64 NetHeatingCapRatedLowTemp_2023(0.0);  // Net Rated heating capacity at low temp [W]
    1029             : 
    1030        1490 :         Array1D<Real64> NetCoolingCapRated(ns);    // Net Cooling Coil capacity at Rated conditions, accounting for supply fan heat [W]
    1031        1490 :         Array1D<Real64> NetTotCoolingCapRated(16); // net total cooling capacity of DX Coils for the sixteen ASHRAE Std 127 Test conditions
    1032        1490 :         Array1D<Real64> TotElectricPowerRated(16); // total electric power of DX Coils for the sixteen ASHRAE Std 127 Test conditions
    1033             : 
    1034        1490 :         Array1D<Real64> NetCoolingCapRated_2023(ns);    // Net Cooling Coil capacity at Rated conditions, accounting for supply fan heat [W]
    1035        1490 :         Array1D<Real64> NetTotCoolingCapRated_2023(16); // net total cooling capacity of DX Coils for the sixteen ASHRAE Std 127 Test conditions
    1036        1490 :         Array1D<Real64> TotElectricPowerRated_2023(16); // total electric power of DX Coils for the sixteen ASHRAE Std 127 Test conditions
    1037             : 
    1038         745 :         NetCoolingCapRated = 0.0;
    1039             : 
    1040         745 :         switch (DXCoilType_Num) {
    1041             : 
    1042         604 :         case CoilDX_CoolingSingleSpeed: { // Coil:Cooling:DX:SingleSpeed
    1043             : 
    1044        3020 :             CheckCurveLimitsForStandardRatings(state,
    1045             :                                                DXCoilName,
    1046             :                                                DXCoilType,
    1047             :                                                DXCoilType_Num,
    1048         604 :                                                CapFTempCurveIndex(1),
    1049         604 :                                                CapFFlowCurveIndex(1),
    1050         604 :                                                EIRFTempCurveIndex(1),
    1051         604 :                                                EIRFFlowCurveIndex(1),
    1052         604 :                                                PLFFPLRCurveIndex(1));
    1053             : 
    1054             :             // Calculated Net Cooling Capacity, SEER, SEER Default, EER, and IEER of single speed DX cooling coils
    1055             :             std::map<std::string, Real64> StandarRatingResults = SingleSpeedDXCoolingCoilStandardRatings(state,
    1056             :                                                                                                          DXCoilName,
    1057             :                                                                                                          DXCoilType,
    1058         604 :                                                                                                          CapFTempCurveIndex(1),
    1059         604 :                                                                                                          CapFFlowCurveIndex(1),
    1060         604 :                                                                                                          EIRFTempCurveIndex(1),
    1061         604 :                                                                                                          EIRFFlowCurveIndex(1),
    1062         604 :                                                                                                          PLFFPLRCurveIndex(1),
    1063         604 :                                                                                                          RatedTotalCapacity(1),
    1064         604 :                                                                                                          RatedCOP(1),
    1065         604 :                                                                                                          RatedAirVolFlowRate(1),
    1066         604 :                                                                                                          FanPowerPerEvapAirFlowRateFromInput(1),
    1067        6644 :                                                                                                          FanPowerPerEvapAirFlowRateFromInput_2023(1));
    1068         604 :             NetCoolingCapRated(1) = StandarRatingResults["NetCoolingCapRated"];
    1069         604 :             SEER_User = StandarRatingResults["SEER_User"];
    1070         604 :             SEER_Standard = StandarRatingResults["SEER_Standard"];
    1071         604 :             EER = StandarRatingResults["EER"];
    1072         604 :             IEER = StandarRatingResults["IEER"];
    1073             : 
    1074         604 :             NetCoolingCapRated_2023(1) = StandarRatingResults["NetCoolingCapRated2023"];
    1075         604 :             SEER2_User = StandarRatingResults["SEER2_User"];
    1076         604 :             SEER2_Standard = StandarRatingResults["SEER2_Standard"];
    1077         604 :             EER_2023 = StandarRatingResults["EER_2023"];
    1078             :             // IEER_2023 = StandarRatingResults["IEER_2023"];
    1079             : 
    1080             :             // Writes the net rated cooling capacity, SEER, SEER Default, EER and IEER values to the EIO file and standard tabular output tables
    1081        1812 :             ReportDXCoilRating(state,
    1082             :                                DXCoilType,
    1083             :                                DXCoilName,
    1084             :                                DXCoilType_Num,
    1085         604 :                                NetCoolingCapRated(1),
    1086             :                                SEER_User * ConvFromSIToIP,
    1087             :                                SEER_Standard * ConvFromSIToIP,
    1088             :                                EER,
    1089             :                                EER * ConvFromSIToIP,
    1090             :                                IEER * ConvFromSIToIP,
    1091             :                                NetHeatingCapRatedHighTemp,
    1092             :                                NetHeatingCapRatedLowTemp,
    1093             :                                HSPF * ConvFromSIToIP,
    1094             :                                RegionNum,
    1095         604 :                                false);
    1096             : 
    1097             :             // ANSI/AHRI 210/240 Std. 2023 Ratings
    1098             :             // Writes the net rated cooling capacity, SEER2_USER, SEER2_Standard, EER and IEER values to the EIO file and standard tabular output
    1099             :             // tables
    1100        1812 :             ReportDXCoilRating(state,
    1101             :                                DXCoilType,
    1102             :                                DXCoilName,
    1103             :                                DXCoilType_Num,
    1104         604 :                                NetCoolingCapRated_2023(1),
    1105             :                                SEER2_User * ConvFromSIToIP,
    1106             :                                SEER2_Standard * ConvFromSIToIP,
    1107             :                                EER_2023,
    1108             :                                EER_2023 * ConvFromSIToIP,
    1109             :                                IEER_2023 * ConvFromSIToIP,
    1110             :                                NetHeatingCapRatedHighTemp_2023,
    1111             :                                NetHeatingCapRatedLowTemp_2023,
    1112             :                                HSPF2_2023 * ConvFromSIToIP,
    1113             :                                RegionNum,
    1114         604 :                                true);
    1115             : 
    1116         604 :             if (ASHRAE127StdRprt) {
    1117          72 :                 DXCoolingCoilDataCenterStandardRatings(state,
    1118             :                                                        DXCoilName,
    1119             :                                                        DXCoilType,
    1120           8 :                                                        CapFTempCurveIndex(1),
    1121           8 :                                                        CapFFlowCurveIndex(1),
    1122           8 :                                                        EIRFTempCurveIndex(1),
    1123           8 :                                                        EIRFFlowCurveIndex(1),
    1124           8 :                                                        PLFFPLRCurveIndex(1),
    1125           8 :                                                        RatedTotalCapacity(1),
    1126           8 :                                                        RatedCOP(1),
    1127           8 :                                                        RatedAirVolFlowRate(1),
    1128           8 :                                                        FanPowerPerEvapAirFlowRateFromInput(1),
    1129             :                                                        NetTotCoolingCapRated,
    1130             :                                                        TotElectricPowerRated);
    1131           8 :                 ReportDXCoolCoilDataCenterApplication(state, DXCoilType, DXCoilName, DXCoilType_Num, NetTotCoolingCapRated, TotElectricPowerRated);
    1132             :             }
    1133         604 :             break;
    1134             :         }
    1135          73 :         case CoilDX_HeatingEmpirical: { // Coil:Heating:DX:SingleSpeed
    1136             : 
    1137         365 :             CheckCurveLimitsForStandardRatings(state,
    1138             :                                                DXCoilName,
    1139             :                                                DXCoilType,
    1140             :                                                DXCoilType_Num,
    1141          73 :                                                CapFTempCurveIndex(1),
    1142          73 :                                                CapFFlowCurveIndex(1),
    1143          73 :                                                EIRFTempCurveIndex(1),
    1144          73 :                                                EIRFFlowCurveIndex(1),
    1145          73 :                                                PLFFPLRCurveIndex(1));
    1146             :             // Calculate the standard ratings for single speed DX heating coil
    1147             :             std::map<std::string, Real64> StandardRatingsResults =
    1148             :                 SingleSpeedDXHeatingCoilStandardRatings(state,
    1149          73 :                                                         RatedTotalCapacity(1),
    1150          73 :                                                         RatedCOP(1),
    1151          73 :                                                         CapFFlowCurveIndex(1),
    1152          73 :                                                         CapFTempCurveIndex(1),
    1153          73 :                                                         EIRFFlowCurveIndex(1),
    1154          73 :                                                         EIRFTempCurveIndex(1),
    1155          73 :                                                         RatedAirVolFlowRate(1),
    1156          73 :                                                         FanPowerPerEvapAirFlowRateFromInput(1),
    1157          73 :                                                         FanPowerPerEvapAirFlowRateFromInput_2023(1),
    1158             :                                                         RegionNum,
    1159             :                                                         MinOATCompressor,
    1160             :                                                         OATempCompressorOn,
    1161             :                                                         OATempCompressorOnOffBlank,
    1162         803 :                                                         DefrostControl);
    1163          73 :             NetHeatingCapRatedHighTemp = StandardRatingsResults["NetHeatingCapRated"];
    1164          73 :             NetHeatingCapRatedLowTemp = StandardRatingsResults["NetHeatingCapH3Test"];
    1165          73 :             HSPF = StandardRatingsResults["HSPF"];
    1166             : 
    1167          73 :             NetHeatingCapRatedHighTemp_2023 = StandardRatingsResults["NetHeatingCapRated_2023"];
    1168          73 :             NetHeatingCapRatedLowTemp_2023 = StandardRatingsResults["NetHeatingCapH3Test_2023"];
    1169          73 :             HSPF2_2023 = StandardRatingsResults["HSPF2_2023"];
    1170             : 
    1171             :             // Writes the HSPF value to the EIO file and standard tabular output tables
    1172         219 :             ReportDXCoilRating(state,
    1173             :                                DXCoilType,
    1174             :                                DXCoilName,
    1175             :                                DXCoilType_Num,
    1176          73 :                                NetCoolingCapRated(1),
    1177             :                                SEER_User * ConvFromSIToIP,
    1178             :                                SEER_Standard * ConvFromSIToIP,
    1179             :                                EER,
    1180             :                                EER * ConvFromSIToIP,
    1181             :                                IEER * ConvFromSIToIP,
    1182             :                                NetHeatingCapRatedHighTemp,
    1183             :                                NetHeatingCapRatedLowTemp,
    1184             :                                HSPF * ConvFromSIToIP,
    1185             :                                RegionNum,
    1186          73 :                                false);
    1187             : 
    1188             :             // ANSI/AHRI 210/240 Std. 2023 Ratings
    1189             :             // Writes the HSPF2 value to the EIO file and standard tabular output tables
    1190         219 :             ReportDXCoilRating(state,
    1191             :                                DXCoilType,
    1192             :                                DXCoilName,
    1193             :                                DXCoilType_Num,
    1194          73 :                                NetCoolingCapRated_2023(1),
    1195             :                                SEER2_User * ConvFromSIToIP,
    1196             :                                SEER2_Standard * ConvFromSIToIP,
    1197             :                                EER_2023,
    1198             :                                EER_2023 * ConvFromSIToIP,
    1199             :                                IEER_2023 * ConvFromSIToIP,
    1200             :                                NetHeatingCapRatedHighTemp_2023,
    1201             :                                NetHeatingCapRatedLowTemp_2023,
    1202             :                                HSPF2_2023 * ConvFromSIToIP,
    1203             :                                RegionNum,
    1204          73 :                                true);
    1205          73 :             break;
    1206             :         }
    1207          48 :         case CoilDX_MultiSpeedCooling: { // Coil:Cooling:DX:MultiSpeed,
    1208             : 
    1209         157 :             for (spnum = 1; spnum <= ns; ++spnum) {
    1210         545 :                 CheckCurveLimitsForStandardRatings(state,
    1211             :                                                    DXCoilName,
    1212             :                                                    DXCoilType,
    1213             :                                                    DXCoilType_Num,
    1214         109 :                                                    CapFTempCurveIndex(spnum),
    1215         109 :                                                    CapFFlowCurveIndex(spnum),
    1216         109 :                                                    EIRFTempCurveIndex(spnum),
    1217         109 :                                                    EIRFFlowCurveIndex(spnum),
    1218         109 :                                                    PLFFPLRCurveIndex(spnum));
    1219             :             }
    1220             :             // Calculate the standard ratings for multispeed DX cooling coil
    1221             :             std::map<std::string, Real64> StandardRatingsResult = MultiSpeedDXCoolingCoilStandardRatings(state,
    1222             :                                                                                                          CapFTempCurveIndex,
    1223             :                                                                                                          CapFFlowCurveIndex,
    1224             :                                                                                                          EIRFTempCurveIndex,
    1225             :                                                                                                          EIRFFlowCurveIndex,
    1226             :                                                                                                          PLFFPLRCurveIndex,
    1227             :                                                                                                          RatedTotalCapacity,
    1228             :                                                                                                          RatedCOP,
    1229             :                                                                                                          RatedAirVolFlowRate,
    1230             :                                                                                                          FanPowerPerEvapAirFlowRateFromInput,
    1231             :                                                                                                          FanPowerPerEvapAirFlowRateFromInput_2023,
    1232          96 :                                                                                                          ns);
    1233          48 :             NetCoolingCapRated(ns) = StandardRatingsResult["NetCoolingCapRatedMaxSpeed"];
    1234          48 :             SEER_User = StandardRatingsResult["SEER_User"];
    1235          48 :             SEER_Standard = StandardRatingsResult["SEER_Standard"];
    1236             : 
    1237          48 :             NetCoolingCapRated_2023(ns) = StandardRatingsResult["NetCoolingCapRatedMaxSpeed2023"];
    1238          48 :             SEER2_User = StandardRatingsResult["SEER2_User"];
    1239          48 :             SEER2_Standard = StandardRatingsResult["SEER2_Standard"];
    1240             : 
    1241             :             // Writes the SEER value to the EIO file and standard tabular output tables
    1242          96 :             ReportDXCoilRating(state,
    1243             :                                DXCoilType,
    1244             :                                DXCoilName,
    1245             :                                DXCoilType_Num,
    1246          48 :                                NetCoolingCapRated(ns),
    1247             :                                SEER_User * ConvFromSIToIP,
    1248             :                                SEER_Standard * ConvFromSIToIP,
    1249             :                                0.0,
    1250             :                                0.0,
    1251             :                                0.0,
    1252             :                                0.0,
    1253             :                                0.0,
    1254             :                                0.0,
    1255             :                                0,
    1256             :                                false);
    1257             : 
    1258             :             // Writes the SEER value to the EIO file and standard tabular output tables
    1259          96 :             ReportDXCoilRating(state,
    1260             :                                DXCoilType,
    1261             :                                DXCoilName,
    1262             :                                DXCoilType_Num,
    1263          48 :                                NetCoolingCapRated_2023(ns),
    1264             :                                SEER2_User * ConvFromSIToIP,
    1265             :                                SEER2_Standard * ConvFromSIToIP,
    1266             :                                0.0,
    1267             :                                0.0,
    1268             :                                0.0,
    1269             :                                0.0,
    1270             :                                0.0,
    1271             :                                0.0,
    1272             :                                0,
    1273             :                                true);
    1274             : 
    1275          48 :             break;
    1276             :         }
    1277          20 :         case CoilDX_MultiSpeedHeating: { // Coil:Heating:DX:MultiSpeed
    1278             : 
    1279          82 :             for (spnum = 1; spnum <= ns; ++spnum) {
    1280         310 :                 CheckCurveLimitsForStandardRatings(state,
    1281             :                                                    DXCoilName,
    1282             :                                                    DXCoilType,
    1283             :                                                    DXCoilType_Num,
    1284          62 :                                                    CapFTempCurveIndex(spnum),
    1285          62 :                                                    CapFFlowCurveIndex(spnum),
    1286          62 :                                                    EIRFTempCurveIndex(spnum),
    1287          62 :                                                    EIRFFlowCurveIndex(spnum),
    1288          62 :                                                    PLFFPLRCurveIndex(spnum));
    1289             :             }
    1290             :             // Calculate Net heatig capacity and HSPF & HSPF2 of multispeed DX heating coils
    1291             :             std::map<std::string, Real64> StandardRatingsResult = MultiSpeedDXHeatingCoilStandardRatings(state,
    1292             :                                                                                                          DXCoilName,
    1293             :                                                                                                          DXCoilType,
    1294             :                                                                                                          CapFTempCurveIndex,
    1295             :                                                                                                          CapFFlowCurveIndex,
    1296             :                                                                                                          EIRFTempCurveIndex,
    1297             :                                                                                                          EIRFFlowCurveIndex,
    1298             :                                                                                                          PLFFPLRCurveIndex,
    1299             :                                                                                                          RatedTotalCapacity,
    1300             :                                                                                                          RatedCOP,
    1301             :                                                                                                          RatedAirVolFlowRate,
    1302             :                                                                                                          FanPowerPerEvapAirFlowRateFromInput,
    1303             :                                                                                                          FanPowerPerEvapAirFlowRateFromInput_2023,
    1304             :                                                                                                          ns,
    1305             :                                                                                                          RegionNum,
    1306             :                                                                                                          MinOATCompressor,
    1307             :                                                                                                          OATempCompressorOn,
    1308             :                                                                                                          OATempCompressorOnOffBlank,
    1309          40 :                                                                                                          DefrostControl);
    1310             : 
    1311          20 :             NetHeatingCapRatedHighTemp = StandardRatingsResult["NetHeatingCapRatedHighTemp"];
    1312          20 :             NetHeatingCapRatedLowTemp = StandardRatingsResult["NetHeatingCapRatedLowTemp"];
    1313          20 :             HSPF = StandardRatingsResult["HSPF"];
    1314             : 
    1315          20 :             NetHeatingCapRatedHighTemp_2023 = StandardRatingsResult["NetHeatingCapRatedHighTemp_2023"];
    1316          20 :             NetHeatingCapRatedLowTemp_2023 = StandardRatingsResult["NetHeatingCapRatedLowTemp_2023"];
    1317          20 :             HSPF2_2023 = StandardRatingsResult["HSPF2_2023"];
    1318             : 
    1319             :             // ANSI/AHRI Std. 2017 Ratings
    1320             :             // Writes the HSPF value to the EIO file and standard tabular output tables
    1321          60 :             ReportDXCoilRating(state,
    1322             :                                DXCoilType,
    1323             :                                DXCoilName,
    1324             :                                DXCoilType_Num,
    1325          20 :                                NetCoolingCapRated(ns),
    1326             :                                SEER_User * ConvFromSIToIP,
    1327             :                                SEER_Standard * ConvFromSIToIP,
    1328             :                                EER,
    1329             :                                EER * ConvFromSIToIP,
    1330             :                                IEER * ConvFromSIToIP,
    1331             :                                NetHeatingCapRatedHighTemp,
    1332             :                                NetHeatingCapRatedLowTemp,
    1333             :                                HSPF * ConvFromSIToIP,
    1334             :                                RegionNum,
    1335          20 :                                false);
    1336             : 
    1337             :             // ANSI/AHRI 210/240 Std. 2023 Ratings
    1338             :             // Writes the HSPF2 value to the EIO file and standard tabular output tables
    1339          60 :             ReportDXCoilRating(state,
    1340             :                                DXCoilType,
    1341             :                                DXCoilName,
    1342             :                                DXCoilType_Num,
    1343          20 :                                NetCoolingCapRated(ns),
    1344             :                                SEER_User * ConvFromSIToIP,
    1345             :                                SEER_Standard * ConvFromSIToIP,
    1346             :                                EER,
    1347             :                                EER * ConvFromSIToIP,
    1348             :                                IEER * ConvFromSIToIP,
    1349             :                                NetHeatingCapRatedHighTemp_2023,
    1350             :                                NetHeatingCapRatedLowTemp_2023,
    1351             :                                HSPF2_2023 * ConvFromSIToIP,
    1352             :                                RegionNum,
    1353          20 :                                true);
    1354             : 
    1355          20 :             break;
    1356             :         }
    1357           0 :         default:
    1358           0 :             break; //... other DX Coil types will follow here
    1359             :         }
    1360         745 :     }
    1361             : 
    1362          73 :     Real64 SingleSpeedHeatingHSPF(const Real64 NetHeatingCapRated,
    1363             :                                   Optional_int_const RegionNum,
    1364             :                                   const Real64 NetHeatingCapH3Test,
    1365             :                                   const Real64 ElecPowerH3Test,
    1366             :                                   const Real64 ElecPowerRated,
    1367             :                                   const Real64 NetHeatingCapH2Test,
    1368             :                                   const Real64 ElecPowerH2Test,
    1369             :                                   Optional<Real64 const> MinOATCompressor,
    1370             :                                   Optional_bool_const OATempCompressorOnOffBlank,
    1371             :                                   Optional<Real64 const> OATempCompressorOn,
    1372             :                                   Optional<const HPdefrostControl> DefrostControl)
    1373             :     {
    1374             :         int BinNum;                           // bin number counter
    1375             :         Int64 StandardDHRNum;                 // Integer counter for standardized DHRs
    1376          73 :         Real64 CheckCOP(0.0);                 // Checking COP at an outdoor bin temperature against unity [-]
    1377          73 :         Real64 DesignHeatingRequirement(0.0); // The amount of heating required to maintain a given indoor temperature
    1378             :         // at a particular outdoor design temperature.  [W]
    1379          73 :         Real64 DesignHeatingRequirementMin(0.0); // minimum design heating requirement [W]
    1380          73 :         Real64 FractionalBinHours(0.0);          // Fractional bin hours for the heating season  [-]
    1381          73 :         Real64 BuildingLoad(0.0);                // Building space conditioning load corresponding to an outdoor bin temperature [W]
    1382             : 
    1383          73 :         Real64 HeatingModeLoadFactor(0.0); // Heating mode load factor corresponding to an outdoor bin temperature  [-]
    1384          73 :         Real64 NetHeatingCapReduced(0.0);  // Net Heating Coil capacity corresponding to an outdoor bin temperature [W]
    1385          73 :         Real64 TotalBuildingLoad(0.0);     // Sum of building load over the entire heating season [W]
    1386             : 
    1387          73 :         Real64 TotalElectricalEnergy(0.0); // Sum of electrical energy consumed by the heatpump over the heating season [W]
    1388          73 :         Real64 DemandDeforstCredit(1.0);   // A factor to adjust HSPF if coil has demand defrost control  [-]
    1389             : 
    1390          73 :         Real64 ElectricalPowerConsumption(0.0);            // Electrical power corresponding to an outdoor bin temperature [W]
    1391          73 :         Real64 HeatPumpElectricalEnergy(0.0);              // Heatpump electrical energy corresponding to an outdoor bin temperature [W]
    1392          73 :         Real64 TotalHeatPumpElectricalEnergy(0.0);         // Sum of Heatpump electrical energy over the entire heating season [W]
    1393          73 :         Real64 ResistiveSpaceHeatingElectricalEnergy(0.0); // resistance heating electrical energy corresponding to an
    1394             :         // outdoor bin temperature [W]
    1395          73 :         Real64 TotalResistiveSpaceHeatingElectricalEnergy(0.0); // Sum of resistance heating electrical energy over the
    1396             :         // entire heating season [W]
    1397             :         Real64 PartLoadFactor;
    1398          73 :         Real64 LowTempCutOutFactor(0.0); // Factor which corresponds to compressor operation depending on outdoor temperature
    1399          73 :         Real64 OATempCompressorOff(0.0); // Minimum outdoor air temperature to turn the commpressor off, [C]
    1400          73 :         Real64 HSPF(0.0);
    1401             : 
    1402          73 :         if (RegionNum == 5) {
    1403           0 :             DesignHeatingRequirementMin = NetHeatingCapRated;
    1404             :         } else {
    1405          73 :             DesignHeatingRequirementMin = NetHeatingCapRated * 1.8 * (18.33 - OutdoorDesignTemperature[static_cast<int64_t>(RegionNum) - 1]) / 60.0;
    1406             :         }
    1407             : 
    1408        1168 :         for (StandardDHRNum = 0; StandardDHRNum < TotalNumOfStandardDHRs - 1; ++StandardDHRNum) {
    1409        1620 :             if (StandardDesignHeatingRequirement[StandardDHRNum] <= DesignHeatingRequirementMin &&
    1410         525 :                 StandardDesignHeatingRequirement[StandardDHRNum + 1] >= DesignHeatingRequirementMin) {
    1411         196 :                 if ((DesignHeatingRequirementMin - StandardDesignHeatingRequirement[StandardDHRNum]) >
    1412          98 :                     (StandardDesignHeatingRequirement[StandardDHRNum + 1] - DesignHeatingRequirementMin)) {
    1413          36 :                     DesignHeatingRequirementMin = StandardDesignHeatingRequirement[StandardDHRNum + 1];
    1414             :                 } else {
    1415          62 :                     DesignHeatingRequirementMin = StandardDesignHeatingRequirement[StandardDHRNum];
    1416             :                 }
    1417             :             }
    1418             :         }
    1419          73 :         if (StandardDesignHeatingRequirement[0] >= DesignHeatingRequirementMin) {
    1420           0 :             DesignHeatingRequirement = StandardDesignHeatingRequirement[0];
    1421          73 :         } else if (StandardDesignHeatingRequirement[TotalNumOfStandardDHRs - 1] <= DesignHeatingRequirementMin) {
    1422          11 :             DesignHeatingRequirement = StandardDesignHeatingRequirement[TotalNumOfStandardDHRs - 1];
    1423             :         } else {
    1424          62 :             DesignHeatingRequirement = DesignHeatingRequirementMin;
    1425             :         }
    1426             : 
    1427        1168 :         for (BinNum = 0; BinNum < TotalNumOfTemperatureBins[static_cast<int64_t>(RegionNum) - 1]; ++BinNum) {
    1428             : 
    1429        1095 :             FractionalBinHours = FracBinHoursAtOutdoorBinTemp[static_cast<int64_t>(RegionNum) - 1][BinNum];
    1430             : 
    1431        1095 :             BuildingLoad = (18.33 - OutdoorBinTemperature[BinNum]) / (18.33 - OutdoorDesignTemperature[static_cast<int64_t>(RegionNum) - 1]) *
    1432             :                            CorrectionFactor * DesignHeatingRequirement;
    1433             : 
    1434        1095 :             if ((OutdoorBinTemperature[BinNum] <= -8.33) || (OutdoorBinTemperature[BinNum] >= 7.22)) {
    1435         730 :                 NetHeatingCapReduced =
    1436         730 :                     NetHeatingCapH3Test + (NetHeatingCapRated - NetHeatingCapH3Test) * (OutdoorBinTemperature[BinNum] + 8.33) / (16.67);
    1437         730 :                 ElectricalPowerConsumption = ElecPowerH3Test + (ElecPowerRated - ElecPowerH3Test) * (OutdoorBinTemperature[BinNum] + 8.33) / (16.67);
    1438             :             } else {
    1439         365 :                 NetHeatingCapReduced =
    1440         365 :                     NetHeatingCapH3Test + (NetHeatingCapH2Test - NetHeatingCapH3Test) * (OutdoorBinTemperature[BinNum] + 8.33) / (10.0);
    1441         365 :                 ElectricalPowerConsumption = ElecPowerH3Test + (ElecPowerH2Test - ElecPowerH3Test) * (OutdoorBinTemperature[BinNum] + 8.33) / (10.0);
    1442             :             }
    1443             : 
    1444        1095 :             if (NetHeatingCapReduced != 0.0) {
    1445        1095 :                 HeatingModeLoadFactor = BuildingLoad / NetHeatingCapReduced;
    1446             :             }
    1447             : 
    1448        1095 :             if (HeatingModeLoadFactor > 1.0) {
    1449         432 :                 HeatingModeLoadFactor = 1.0;
    1450             :             }
    1451             : 
    1452        1095 :             PartLoadFactor = 1 - CyclicDegradationCoeff * (1 - HeatingModeLoadFactor);
    1453             : 
    1454        1095 :             if (ElectricalPowerConsumption != 0.0) {
    1455        1095 :                 CheckCOP = NetHeatingCapReduced / ElectricalPowerConsumption;
    1456             :             }
    1457             : 
    1458        1095 :             OATempCompressorOff = MinOATCompressor;
    1459             : 
    1460        1095 :             if (CheckCOP < 1.0) {
    1461         132 :                 LowTempCutOutFactor = 0.0;
    1462             :             } else {
    1463         963 :                 if (!OATempCompressorOnOffBlank) {
    1464          15 :                     if (OutdoorBinTemperature[BinNum] <= OATempCompressorOff) {
    1465           5 :                         LowTempCutOutFactor = 0.0;
    1466          10 :                     } else if (OutdoorBinTemperature[BinNum] > OATempCompressorOff && OutdoorBinTemperature[BinNum] <= OATempCompressorOn) {
    1467           5 :                         LowTempCutOutFactor = 0.5;
    1468             :                     } else {
    1469           5 :                         LowTempCutOutFactor = 1.0;
    1470             :                     }
    1471             :                 } else {
    1472         948 :                     LowTempCutOutFactor = 1.0;
    1473             :                 }
    1474             :             }
    1475             : 
    1476        1095 :             if (PartLoadFactor != 0.0) {
    1477        1095 :                 HeatPumpElectricalEnergy =
    1478        1095 :                     (HeatingModeLoadFactor * ElectricalPowerConsumption * LowTempCutOutFactor) * FractionalBinHours / PartLoadFactor;
    1479             :             }
    1480             : 
    1481        1095 :             ResistiveSpaceHeatingElectricalEnergy =
    1482        1095 :                 (BuildingLoad - HeatingModeLoadFactor * NetHeatingCapReduced * LowTempCutOutFactor) * FractionalBinHours;
    1483             : 
    1484        1095 :             TotalBuildingLoad += (BuildingLoad * FractionalBinHours);
    1485             : 
    1486        1095 :             TotalHeatPumpElectricalEnergy += HeatPumpElectricalEnergy;
    1487             : 
    1488        1095 :             TotalResistiveSpaceHeatingElectricalEnergy += ResistiveSpaceHeatingElectricalEnergy;
    1489             :         }
    1490             : 
    1491          73 :         TotalElectricalEnergy = TotalHeatPumpElectricalEnergy + TotalResistiveSpaceHeatingElectricalEnergy;
    1492             : 
    1493          73 :         if (DefrostControl == HPdefrostControl::Timed) {
    1494          64 :             DemandDeforstCredit = 1.0; // Timed defrost control
    1495             :         } else {
    1496           9 :             DemandDeforstCredit = 1.03; // Demand defrost control
    1497             :         }
    1498             : 
    1499          73 :         if (TotalElectricalEnergy != 0.0) {
    1500          73 :             HSPF = TotalBuildingLoad * DemandDeforstCredit / TotalElectricalEnergy;
    1501             :         }
    1502          73 :         return HSPF;
    1503             :     }
    1504             : 
    1505          73 :     Real64 SingleSpeedHeatingHSPF2(const Real64 NetHeatingCapRated_2023,
    1506             :                                    Optional_int_const RegionNum,
    1507             :                                    const Real64 NetHeatingCapH3Test_2023,
    1508             :                                    const Real64 ElecPowerH3Test2023,
    1509             :                                    const Real64 ElecPowerRated2023,
    1510             :                                    const Real64 NetHeatingCapH2Test2023,
    1511             :                                    const Real64 ElecPowerH2Test2023,
    1512             :                                    Optional<Real64 const> MinOATCompressor,
    1513             :                                    Optional_bool_const OATempCompressorOnOffBlank,
    1514             :                                    Optional<Real64 const> OATempCompressorOn,
    1515             :                                    Optional<const HPdefrostControl> DefrostControl)
    1516             :     {
    1517          73 :         Real64 DesignHeatingRequirement2023(0.0);   // HSPF2 minimum design heating requirement [W]
    1518             :         int BinNum2023;                             // HSPF2 bin number counter
    1519          73 :         Real64 FractionalBinHours2023(0.0);         // HSPF2 Fractional bin hours for the heating season  [-]
    1520          73 :         Real64 BuildingLoad2023(0.0);               // HSPF2 Building space conditioning load corresponding to an outdoor bin temperature [W]
    1521          73 :         Real64 NetHeatingCapReduced2023(0.0);       // HSPF2 Net Heating Coil capacity corresponding to an outdoor bin temperature [W]
    1522          73 :         Real64 ElectricalPowerConsumption2023(0.0); // HSPF2 Electrical power corresponding to an outdoor bin temperature [W]
    1523          73 :         Real64 HeatingModeLoadFactor2023(0.0);      // HSPF2 Heating mode load factor corresponding to an outdoor bin temperature  [-]
    1524             :         Real64 PartLoadFactor2023;
    1525          73 :         Real64 CheckCOP2023(0.0);                              // HSPF2 Checking COP at an outdoor bin temperature against unity [-]
    1526          73 :         Real64 OATempCompressorOff2023(0.0);                   // HSPF2 Minimum outdoor air temperature to turn the commpressor off, [C]
    1527          73 :         Real64 LowTempCutOutFactor2023(0.0);                   // Factor which corresponds to compressor operation depending on outdoor temperature
    1528          73 :         Real64 HeatPumpElectricalEnergy2023(0.0);              // HSPF2 Heatpump electrical energy corresponding to an outdoor bin temperature [W]
    1529          73 :         Real64 ResistiveSpaceHeatingElectricalEnergy2023(0.0); // HSPF2 resistance heating electrical energy corresponding to an
    1530             :         // outdoor bin temperature [W]
    1531          73 :         Real64 TotalBuildingLoad2023(0.0);                          // Sum of building load over the entire heating season [W]
    1532          73 :         Real64 TotalHeatPumpElectricalEnergy2023(0.0);              // HSPF2 Sum of Heatpump electrical energy over the entire heating season [W]
    1533          73 :         Real64 TotalResistiveSpaceHeatingElectricalEnergy2023(0.0); // Sum of resistance heating electrical energy over the
    1534             :         // entire heating season [W]
    1535          73 :         Real64 TotalElectricalEnergy2023(0.0); // HSPF2 Sum of electrical energy consumed by the heatpump over the heating season [W]
    1536          73 :         Real64 DemandDeforstCredit2023(1.0);   // A factor to adjust HSPF2 if coil has demand defrost control  [-]
    1537          73 :         Real64 HSPF2_2023(0.0);
    1538             : 
    1539             :         // For ANSI/AHRI 210/240 Standard 2023 | Concept of DHRI min and max is removed
    1540             :         // Section 11.2.2.1 Equation 11.104  which suggests QAFull is used instead of DHRI min
    1541          73 :         DesignHeatingRequirement2023 = NetHeatingCapRated_2023;
    1542          73 :         Int64 RN = static_cast<int64_t>(RegionNum);
    1543             : 
    1544        1168 :         for (BinNum2023 = 0; BinNum2023 < TotalNumOfTemperatureBinsHSPF2[RN - 1]; ++BinNum2023) {
    1545             : 
    1546        1095 :             FractionalBinHours2023 = FracBinHoursAtOutdoorBinTempHSPF2[RN - 1][BinNum2023];
    1547             : 
    1548        3285 :             BuildingLoad2023 = (ZoneLoadTemperature[RN - 1] - OutdoorBinTemperature[BinNum2023]) /
    1549        2190 :                                (ZoneLoadTemperature[RN - 1] - OutdoorDesignTemperature[RN - 1]) * SpeedLoadFactor[RN - 1] *
    1550             :                                DesignHeatingRequirement2023;
    1551        1095 :             if ((OutdoorBinTemperature[BinNum2023] <= -8.33) || (OutdoorBinTemperature[BinNum2023] >= 7.22)) {
    1552        2190 :                 NetHeatingCapReduced2023 = NetHeatingCapH3Test_2023 + (NetHeatingCapRated_2023 - NetHeatingCapH3Test_2023) *
    1553        1460 :                                                                           (OutdoorBinTemperature[BinNum2023] + 8.33) / (16.67);
    1554         730 :                 ElectricalPowerConsumption2023 =
    1555         730 :                     ElecPowerH3Test2023 + (ElecPowerRated2023 - ElecPowerH3Test2023) * (OutdoorBinTemperature[BinNum2023] + 8.33) / (16.67);
    1556             :             } else {
    1557         365 :                 NetHeatingCapReduced2023 = NetHeatingCapH3Test_2023 +
    1558         365 :                                            (NetHeatingCapH2Test2023 - NetHeatingCapH3Test_2023) * (OutdoorBinTemperature[BinNum2023] + 8.33) / (10.0);
    1559         365 :                 ElectricalPowerConsumption2023 =
    1560         365 :                     ElecPowerH3Test2023 + (ElecPowerH2Test2023 - ElecPowerH3Test2023) * (OutdoorBinTemperature[BinNum2023] + 8.33) / (10.0);
    1561             :             }
    1562        1095 :             if (NetHeatingCapReduced2023 != 0.0) {
    1563        1095 :                 HeatingModeLoadFactor2023 = BuildingLoad2023 / NetHeatingCapReduced2023;
    1564             :             }
    1565             : 
    1566        1095 :             if (HeatingModeLoadFactor2023 > 1.0) {
    1567         511 :                 HeatingModeLoadFactor2023 = 1.0;
    1568             :             }
    1569        1095 :             PartLoadFactor2023 = 1 - CyclicHeatingDegradationCoeffHSPF2 * (1 - HeatingModeLoadFactor2023);
    1570        1095 :             if (ElectricalPowerConsumption2023 != 0.0) {
    1571        1095 :                 CheckCOP2023 = NetHeatingCapReduced2023 / ElectricalPowerConsumption2023;
    1572             :             }
    1573        1095 :             OATempCompressorOff2023 = MinOATCompressor;
    1574        1095 :             if (CheckCOP2023 < 1.0) {
    1575         132 :                 LowTempCutOutFactor2023 = 0.0;
    1576             :             } else {
    1577         963 :                 if (!OATempCompressorOnOffBlank) {
    1578          15 :                     if (OutdoorBinTemperature[BinNum2023] <= OATempCompressorOff2023) {
    1579           5 :                         LowTempCutOutFactor2023 = 0.0;
    1580          20 :                     } else if (OutdoorBinTemperature[BinNum2023] > OATempCompressorOff2023 &&
    1581          10 :                                OutdoorBinTemperature[BinNum2023] <= OATempCompressorOn) {
    1582           5 :                         LowTempCutOutFactor2023 = 0.5;
    1583             :                     } else {
    1584           5 :                         LowTempCutOutFactor2023 = 1.0;
    1585             :                     }
    1586             :                 } else {
    1587         948 :                     LowTempCutOutFactor2023 = 1.0;
    1588             :                 }
    1589             :             }
    1590             : 
    1591        1095 :             if (PartLoadFactor2023 != 0.0) {
    1592        1095 :                 HeatPumpElectricalEnergy2023 = (HeatingModeLoadFactor2023 * ElectricalPowerConsumption2023 * LowTempCutOutFactor2023) *
    1593             :                                                FractionalBinHours2023 / PartLoadFactor2023;
    1594             :             }
    1595             : 
    1596        1095 :             ResistiveSpaceHeatingElectricalEnergy2023 =
    1597        1095 :                 (BuildingLoad2023 - HeatingModeLoadFactor2023 * NetHeatingCapReduced2023 * LowTempCutOutFactor2023) * FractionalBinHours2023;
    1598             : 
    1599        1095 :             TotalBuildingLoad2023 += (BuildingLoad2023 * FractionalBinHours2023);
    1600             : 
    1601        1095 :             TotalHeatPumpElectricalEnergy2023 += HeatPumpElectricalEnergy2023;
    1602             : 
    1603        1095 :             TotalResistiveSpaceHeatingElectricalEnergy2023 += ResistiveSpaceHeatingElectricalEnergy2023;
    1604             :         }
    1605          73 :         TotalElectricalEnergy2023 = TotalHeatPumpElectricalEnergy2023 + TotalResistiveSpaceHeatingElectricalEnergy2023;
    1606             : 
    1607          73 :         if (DefrostControl == HPdefrostControl::Timed) {
    1608          64 :             DemandDeforstCredit2023 = 1.0; // Timed defrost control
    1609             :         } else {
    1610           9 :             DemandDeforstCredit2023 = 1.03; // Demand defrost control
    1611             :         }
    1612             : 
    1613          73 :         if (TotalElectricalEnergy2023 != 0.0) {
    1614          73 :             HSPF2_2023 = TotalBuildingLoad2023 * DemandDeforstCredit2023 / TotalElectricalEnergy2023;
    1615             :         }
    1616          73 :         return HSPF2_2023;
    1617             :     }
    1618             : 
    1619          73 :     std::map<std::string, Real64> SingleSpeedDXHeatingCoilStandardRatings(
    1620             :         EnergyPlusData &state,
    1621             :         Real64 const RatedTotalCapacity,                       // Reference capacity of DX coil [W]
    1622             :         Real64 const RatedCOP,                                 // Reference coefficient of performance [W/W]
    1623             :         int const CapFFlowCurveIndex,                          // Index for the capacity as a function of flow fraction modifier curve
    1624             :         int const CapFTempCurveIndex,                          // Index for the capacity as a function of temperature modifier curve
    1625             :         int const EIRFFlowCurveIndex,                          // Index for the EIR as a function of flow fraction modifier curve
    1626             :         int const EIRFTempCurveIndex,                          // Index for the EIR as a function of temperature modifier curve
    1627             :         Real64 const RatedAirVolFlowRate,                      // Rated air volume flow rate [m3/s]
    1628             :         Real64 const FanPowerPerEvapAirFlowRateFromInput,      // 2017 Fan power per air volume flow rate [W/(m3/s)]
    1629             :         Real64 const FanPowerPerEvapAirFlowRateFromInput_2023, // 2023 Fan power per air volume flow rate [W/(m3/s)]
    1630             :         Optional_int_const RegionNum,                          // Region number for calculating HSPF of single speed DX heating coil
    1631             :         Optional<Real64 const> MinOATCompressor,               // Minimum OAT for heat pump compressor operation [C]
    1632             :         Optional<Real64 const> OATempCompressorOn,             // The outdoor temperature when the compressor is automatically turned
    1633             :         Optional_bool_const OATempCompressorOnOffBlank,        // Flag used to determine low temperature cut out factor
    1634             :         Optional<HPdefrostControl const> DefrostControl        // defrost control; 1=timed, 2=on-demand
    1635             : 
    1636             :     )
    1637             :     {
    1638          73 :         Real64 NetHeatingCapRated(0.0);  // Net Heating Coil capacity at Rated conditions,
    1639          73 :         Real64 NetHeatingCapH3Test(0.0); // Net Heating Coil capacity at H3 test conditions
    1640          73 :         Real64 HSPF(0.0);                // seasonale energy efficiency ratio of multi speed DX cooling coil
    1641             : 
    1642             :         // ANSI/AHRI 210/240 Standard 2023
    1643          73 :         Real64 NetHeatingCapRated_2023(0.0);  // Net Heating Coil capacity at Rated conditions,
    1644          73 :         Real64 NetHeatingCapH3Test_2023(0.0); // Net Heating Coil capacity at H3 test conditions
    1645          73 :         Real64 HSPF2_2023(0.0);               // seasonale energy efficiency ratio of multi speed DX cooling coil
    1646          73 :         std::map<std::string, Real64> StandardRatingsResults;
    1647             :         // SUBROUTINE INFORMATION:
    1648             :         //       AUTHOR         Chandan Sharma
    1649             :         //       DATE WRITTEN   February 2012
    1650             :         //       MODIFIED       B Nigusse, December 2012
    1651             :         //       RE-ENGINEERED  na
    1652             : 
    1653             :         // PURPOSE OF THIS SUBROUTINE:
    1654             :         // na
    1655             : 
    1656             :         // METHODOLOGY EMPLOYED:
    1657             :         // na
    1658             : 
    1659             :         // REFERENCES:
    1660             :         // na
    1661             : 
    1662             :         // Using/Aliasing
    1663             :         using Curve::CurveValue;
    1664             :         using Curve::GetCurveMinMaxValues;
    1665             :         using Curve::GetCurveName;
    1666             : 
    1667             :         // Locals
    1668             :         // SUBROUTINE ARGUMENT DEFINITIONS:
    1669             : 
    1670             :         // back on, if applicable, following automatic shut off. This field is
    1671             :         // used only for HSPF calculation. [C]
    1672             :         // accounting for supply fan heat [W]
    1673             :         // accounting for supply fan heat [W]
    1674             : 
    1675             :         // SUBROUTINE PARAMETER DEFINITIONS:
    1676             :         // na
    1677             :         // INTERFACE BLOCK SPECIFICATIONS
    1678             :         // na
    1679             : 
    1680             :         // DERIVED TYPE DEFINITIONS
    1681             :         // na
    1682             : 
    1683             :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    1684          73 :         Real64 TotalHeatingCapRated(0.0);            // Heating Coil capacity at Rated conditions, without accounting supply fan heat [W]
    1685          73 :         Real64 EIRRated(0.0);                        // EIR at Rated conditions [-]
    1686          73 :         Real64 TotCapTempModFacRated(0.0);           // Total capacity as a function of temerature modifier at rated conditions [-]
    1687          73 :         Real64 EIRTempModFacRated(0.0);              // EIR as a function of temerature modifier at rated conditions [-]
    1688          73 :         Real64 TotalHeatingCapH2Test(0.0);           // Heating Coil capacity at H2 test conditions, without accounting supply fan heat [W]
    1689          73 :         Real64 TotalHeatingCapH3Test(0.0);           // Heating Coil capacity at H3 test conditions, without accounting supply fan heat [W]
    1690          73 :         Real64 CapTempModFacH2Test(0.0);             // Total capacity as a function of temerature modifier at H2 test conditions [-]
    1691          73 :         Real64 EIRTempModFacH2Test(0.0);             // EIR as a function of temerature modifier at H2 test conditions [-]
    1692          73 :         Real64 EIRH2Test(0.0);                       // EIR at H2 test conditions [-]
    1693          73 :         Real64 CapTempModFacH3Test(0.0);             // Total capacity as a function of temerature modifier at H3 test conditions [-]
    1694          73 :         Real64 EIRTempModFacH3Test(0.0);             // EIR as a function of temerature modifier at H3 test conditions [-]
    1695          73 :         Real64 EIRH3Test(0.0);                       // EIR at H3 test conditions [-]
    1696          73 :         Real64 TotCapFlowModFac(0.0);                // Total capacity modifier (function of actual supply air flow vs rated flow)
    1697          73 :         Real64 EIRFlowModFac(0.0);                   // EIR modifier (function of actual supply air flow vs rated flow)
    1698          73 :         Real64 FanPowerPerEvapAirFlowRate(0.0);      // 2017 Fan power per air volume flow rate [W/(m3/s)]
    1699          73 :         Real64 FanPowerPerEvapAirFlowRate_2023(0.0); // 2023 Fan power per air volume flow rate [W/(m3/s)]
    1700             : 
    1701             :         Real64 ElecPowerRated;  // Total system power at Rated conditions accounting for supply fan heat [W]
    1702             :         Real64 ElecPowerH2Test; // Total system power at H2 test conditions accounting for supply fan heat [W]
    1703             :         Real64 ElecPowerH3Test; // Total system power at H3 test conditions accounting for supply fan heat [W]
    1704             : 
    1705             :         // For ANSI/AHRI 210/240 Standard 2023
    1706             :         Real64 ElecPowerRated2023;  // Total system power at Rated conditions accounting for supply fan heat [W]
    1707             :         Real64 ElecPowerH2Test2023; // Total system power at H2 test conditions accounting for supply fan heat [W]
    1708             :         Real64 ElecPowerH3Test2023; // Total system power at H3 test conditions accounting for supply fan heat [W]
    1709             : 
    1710             :         Real64 NetHeatingCapH2Test;     // Net Heating Coil capacity at H2 test conditions accounting for supply fan heat [W]
    1711             :         Real64 NetHeatingCapH2Test2023; // (for 2023 Standard) Net Heating Coil capacity at H2 test conditions accounting for supply fan heat [W]
    1712             : 
    1713             :         // Calculate the supply air fan electric power consumption.  The electric power consumption is estimated
    1714             :         // using either user supplied or AHRI default value for fan power per air volume flow rate
    1715          73 :         if (FanPowerPerEvapAirFlowRateFromInput <= 0.0) {
    1716           0 :             FanPowerPerEvapAirFlowRate = DefaultFanPowerPerEvapAirFlowRate;
    1717             :         } else {
    1718          73 :             FanPowerPerEvapAirFlowRate = FanPowerPerEvapAirFlowRateFromInput;
    1719             :         }
    1720          73 :         if (FanPowerPerEvapAirFlowRateFromInput_2023 <= 0.0) {
    1721           0 :             FanPowerPerEvapAirFlowRate_2023 = DefaultFanPowerPerEvapAirFlowRateSEER2;
    1722             :         } else {
    1723          73 :             FanPowerPerEvapAirFlowRate_2023 = FanPowerPerEvapAirFlowRateFromInput_2023;
    1724             :         }
    1725             : 
    1726          73 :         TotCapFlowModFac = CurveValue(state, CapFFlowCurveIndex, AirMassFlowRatioRated);
    1727          73 :         EIRFlowModFac = CurveValue(state, EIRFFlowCurveIndex, AirMassFlowRatioRated);
    1728             : 
    1729             :         {
    1730          73 :             if (state.dataCurveManager->PerfCurve(CapFTempCurveIndex).numDims == 1) {
    1731          72 :                 TotCapTempModFacRated = CurveValue(state, CapFTempCurveIndex, HeatingOutdoorCoilInletAirDBTempRated);
    1732             : 
    1733          72 :                 CapTempModFacH2Test = CurveValue(state, CapFTempCurveIndex, HeatingOutdoorCoilInletAirDBTempH2Test);
    1734             : 
    1735          72 :                 CapTempModFacH3Test = CurveValue(state, CapFTempCurveIndex, HeatingOutdoorCoilInletAirDBTempH3Test);
    1736             :             } else {
    1737           1 :                 TotCapTempModFacRated =
    1738           2 :                     CurveValue(state, CapFTempCurveIndex, HeatingIndoorCoilInletAirDBTempRated, HeatingOutdoorCoilInletAirDBTempRated);
    1739             : 
    1740           1 :                 CapTempModFacH2Test =
    1741           2 :                     CurveValue(state, CapFTempCurveIndex, HeatingIndoorCoilInletAirDBTempRated, HeatingOutdoorCoilInletAirDBTempH2Test);
    1742             : 
    1743           1 :                 CapTempModFacH3Test =
    1744           2 :                     CurveValue(state, CapFTempCurveIndex, HeatingIndoorCoilInletAirDBTempRated, HeatingOutdoorCoilInletAirDBTempH3Test);
    1745             :             }
    1746             :         }
    1747             : 
    1748             :         {
    1749          73 :             if (state.dataCurveManager->PerfCurve(EIRFTempCurveIndex).numDims == 1) {
    1750          72 :                 EIRTempModFacRated = CurveValue(state, EIRFTempCurveIndex, HeatingOutdoorCoilInletAirDBTempRated);
    1751             : 
    1752          72 :                 EIRTempModFacH2Test = CurveValue(state, EIRFTempCurveIndex, HeatingOutdoorCoilInletAirDBTempH2Test);
    1753             : 
    1754          72 :                 EIRTempModFacH3Test = CurveValue(state, EIRFTempCurveIndex, HeatingOutdoorCoilInletAirDBTempH3Test);
    1755             :             } else {
    1756           1 :                 EIRTempModFacRated =
    1757           2 :                     CurveValue(state, EIRFTempCurveIndex, HeatingIndoorCoilInletAirDBTempRated, HeatingOutdoorCoilInletAirDBTempRated);
    1758             : 
    1759           1 :                 EIRTempModFacH2Test =
    1760           2 :                     CurveValue(state, EIRFTempCurveIndex, HeatingIndoorCoilInletAirDBTempRated, HeatingOutdoorCoilInletAirDBTempH2Test);
    1761             : 
    1762           1 :                 EIRTempModFacH3Test =
    1763           2 :                     CurveValue(state, EIRFTempCurveIndex, HeatingIndoorCoilInletAirDBTempRated, HeatingOutdoorCoilInletAirDBTempH3Test);
    1764             :             }
    1765             :         }
    1766             : 
    1767          73 :         TotalHeatingCapRated = RatedTotalCapacity * TotCapTempModFacRated * TotCapFlowModFac;
    1768          73 :         NetHeatingCapRated = TotalHeatingCapRated + FanPowerPerEvapAirFlowRate * RatedAirVolFlowRate;
    1769          73 :         NetHeatingCapRated_2023 = TotalHeatingCapRated + FanPowerPerEvapAirFlowRate_2023 * RatedAirVolFlowRate;
    1770             : 
    1771          73 :         TotalHeatingCapH2Test = RatedTotalCapacity * CapTempModFacH2Test * TotCapFlowModFac;
    1772          73 :         NetHeatingCapH2Test = TotalHeatingCapH2Test + FanPowerPerEvapAirFlowRate * RatedAirVolFlowRate;
    1773          73 :         NetHeatingCapH2Test2023 = TotalHeatingCapH2Test + FanPowerPerEvapAirFlowRate_2023 * RatedAirVolFlowRate;
    1774             : 
    1775          73 :         TotalHeatingCapH3Test = RatedTotalCapacity * CapTempModFacH3Test * TotCapFlowModFac;
    1776          73 :         NetHeatingCapH3Test = TotalHeatingCapH3Test + FanPowerPerEvapAirFlowRate * RatedAirVolFlowRate;
    1777          73 :         NetHeatingCapH3Test_2023 = TotalHeatingCapH3Test + FanPowerPerEvapAirFlowRate_2023 * RatedAirVolFlowRate;
    1778             : 
    1779             :         // check curves value
    1780         146 :         if (TotCapTempModFacRated < 0.0 || CapTempModFacH2Test < 0.0 || CapTempModFacH3Test < 0.0 || EIRTempModFacRated < 0.0 ||
    1781         146 :             EIRTempModFacH2Test < 0.0 || EIRTempModFacH3Test < 0.0) {
    1782           0 :             if (TotCapTempModFacRated < 0.0) {
    1783           0 :                 ShowSevereError(
    1784             :                     state,
    1785           0 :                     format(" Invalid Total Heating Capacity Function of Temperature Curve value = {:.2R}, Curve Type = {}, Curve Name = {}",
    1786             :                            TotCapTempModFacRated,
    1787           0 :                            Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(CapFTempCurveIndex).curveType)],
    1788           0 :                            GetCurveName(state, CapFTempCurveIndex)));
    1789           0 :                 ShowContinueError(state,
    1790             :                                   " ...Net heating capacity at high temperature is set to zero. The curve value must be > 0. Check the curve.");
    1791           0 :                 NetHeatingCapRated = 0.0;
    1792           0 :                 NetHeatingCapRated_2023 = 0.0;
    1793             :             }
    1794           0 :             if (CapTempModFacH3Test < 0.0) {
    1795           0 :                 ShowSevereError(
    1796             :                     state,
    1797           0 :                     format(" Invalid Total Heating Capacity Function of Temperature Curve value = {:.2R}, Curve Type = {}, Curve Name = {}",
    1798             :                            CapTempModFacH3Test,
    1799           0 :                            Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(CapFTempCurveIndex).curveType)],
    1800           0 :                            GetCurveName(state, CapFTempCurveIndex)));
    1801           0 :                 ShowContinueError(state, " ...Net heating capacity at low temperature is set to zero. The curve value must be > 0. Check the curve.");
    1802           0 :                 NetHeatingCapH3Test = 0.0;
    1803           0 :                 NetHeatingCapH3Test_2023 = 0.0;
    1804             :             }
    1805           0 :             if (CapTempModFacH2Test < 0.0) {
    1806           0 :                 ShowSevereError(
    1807             :                     state,
    1808           0 :                     format(" Invalid Total Heating Capacity Function of Temperature Curve value = {:.2R}, Curve Type = {}, Curve Name = {}",
    1809             :                            CapTempModFacH2Test,
    1810           0 :                            Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(CapFTempCurveIndex).curveType)],
    1811           0 :                            GetCurveName(state, CapFTempCurveIndex)));
    1812           0 :                 ShowContinueError(state, " ...HSPF calculation is incorrect. The curve value must be > 0. Check the curve.");
    1813           0 :                 NetHeatingCapH3Test = 0.0;
    1814           0 :                 NetHeatingCapH3Test_2023 = 0.0;
    1815             :             }
    1816             :             // check EIR curve values
    1817           0 :             if (EIRTempModFacRated < 0.0) {
    1818           0 :                 ShowSevereError(state,
    1819           0 :                                 format(" Invalid EIR Function of Temperature Curve value = {:.2R}, Curve Type = {}, Curve Name = {}",
    1820             :                                        EIRTempModFacRated,
    1821           0 :                                        Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(EIRFTempCurveIndex).curveType)],
    1822           0 :                                        GetCurveName(state, EIRFTempCurveIndex)));
    1823           0 :                 ShowContinueError(state, " ...HSPF calculation is incorrect. The curve value must be > 0. Check the curve.");
    1824             :             }
    1825           0 :             if (EIRTempModFacH2Test < 0.0) {
    1826           0 :                 ShowSevereError(state,
    1827           0 :                                 format(" Invalid EIR Function of Temperature Curve value = {:.2R}, Curve Type = {}, Curve Name = {}",
    1828             :                                        EIRTempModFacH2Test,
    1829           0 :                                        Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(EIRFTempCurveIndex).curveType)],
    1830           0 :                                        GetCurveName(state, EIRFTempCurveIndex)));
    1831           0 :                 ShowContinueError(state, " ...HSPF calculation is incorrect. The curve value must be > 0. Check the curve.");
    1832             :             }
    1833           0 :             if (EIRTempModFacH3Test < 0.0) {
    1834           0 :                 ShowSevereError(state,
    1835           0 :                                 format(" Invalid EIR Function of Temperature Curve value = {:.2R}, Curve Type = {}, Curve Name = {}",
    1836             :                                        EIRTempModFacH3Test,
    1837           0 :                                        Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(EIRFTempCurveIndex).curveType)],
    1838           0 :                                        GetCurveName(state, EIRFTempCurveIndex)));
    1839           0 :                 ShowContinueError(state, " ...HSPF calculation is incorrect. The curve value must be > 0. Check the curve.");
    1840             :             }
    1841           0 :             ShowContinueError(state, " ...HSPF value has been reset to 0.0 and simulation is continuing.");
    1842           0 :             HSPF = 0.0;
    1843           0 :             HSPF2_2023 = 0.0;
    1844             : 
    1845           0 :             StandardRatingsResults["NetHeatingCapRated"] = NetHeatingCapRated;
    1846           0 :             StandardRatingsResults["NetHeatingCapH3Test"] = NetHeatingCapH3Test;
    1847           0 :             StandardRatingsResults["HSPF"] = HSPF;
    1848           0 :             StandardRatingsResults["NetHeatingCapRated_2023"] = NetHeatingCapRated_2023;
    1849           0 :             StandardRatingsResults["NetHeatingCapH3Test_2023"] = NetHeatingCapH3Test_2023;
    1850           0 :             StandardRatingsResults["HSPF2_2023"] = HSPF2_2023;
    1851           0 :             return StandardRatingsResults;
    1852             :         }
    1853             : 
    1854          73 :         if (RatedCOP > 0.0) { // RatedCOP <= 0.0 is trapped in GetInput, but keep this as "safety"
    1855             : 
    1856          73 :             EIRRated = EIRTempModFacRated * EIRFlowModFac / RatedCOP;
    1857          73 :             EIRH2Test = EIRTempModFacH2Test * EIRFlowModFac / RatedCOP;
    1858          73 :             EIRH3Test = EIRTempModFacH3Test * EIRFlowModFac / RatedCOP;
    1859             :         }
    1860             : 
    1861          73 :         ElecPowerRated = EIRRated * TotalHeatingCapRated + FanPowerPerEvapAirFlowRate * RatedAirVolFlowRate;
    1862          73 :         ElecPowerH2Test = EIRH2Test * TotalHeatingCapH2Test + FanPowerPerEvapAirFlowRate * RatedAirVolFlowRate;
    1863          73 :         ElecPowerH3Test = EIRH3Test * TotalHeatingCapH3Test + FanPowerPerEvapAirFlowRate * RatedAirVolFlowRate;
    1864             : 
    1865          73 :         ElecPowerRated2023 = EIRRated * TotalHeatingCapRated + FanPowerPerEvapAirFlowRate_2023 * RatedAirVolFlowRate;
    1866          73 :         ElecPowerH2Test2023 = EIRH2Test * TotalHeatingCapH2Test + FanPowerPerEvapAirFlowRate_2023 * RatedAirVolFlowRate;
    1867          73 :         ElecPowerH3Test2023 = EIRH3Test * TotalHeatingCapH3Test + FanPowerPerEvapAirFlowRate_2023 * RatedAirVolFlowRate;
    1868             : 
    1869          73 :         HSPF2_2023 = SingleSpeedHeatingHSPF2(NetHeatingCapRated_2023,
    1870             :                                              RegionNum,
    1871             :                                              NetHeatingCapH3Test_2023,
    1872             :                                              ElecPowerH3Test2023,
    1873             :                                              ElecPowerRated2023,
    1874             :                                              NetHeatingCapH2Test2023,
    1875             :                                              ElecPowerH2Test2023,
    1876             :                                              MinOATCompressor,
    1877             :                                              OATempCompressorOnOffBlank,
    1878             :                                              OATempCompressorOn,
    1879             :                                              DefrostControl);
    1880             : 
    1881          73 :         HSPF = SingleSpeedHeatingHSPF(NetHeatingCapRated,
    1882             :                                       RegionNum,
    1883             :                                       NetHeatingCapH3Test,
    1884             :                                       ElecPowerH3Test,
    1885             :                                       ElecPowerRated,
    1886             :                                       NetHeatingCapH2Test,
    1887             :                                       ElecPowerH2Test,
    1888             :                                       MinOATCompressor,
    1889             :                                       OATempCompressorOnOffBlank,
    1890             :                                       OATempCompressorOn,
    1891             :                                       DefrostControl);
    1892             : 
    1893          73 :         StandardRatingsResults["NetHeatingCapRated"] = NetHeatingCapRated;
    1894          73 :         StandardRatingsResults["NetHeatingCapH3Test"] = NetHeatingCapH3Test;
    1895          73 :         StandardRatingsResults["HSPF"] = HSPF;
    1896          73 :         StandardRatingsResults["NetHeatingCapRated_2023"] = NetHeatingCapRated_2023;
    1897          73 :         StandardRatingsResults["NetHeatingCapH3Test_2023"] = NetHeatingCapH3Test_2023;
    1898          73 :         StandardRatingsResults["HSPF2_2023"] = HSPF2_2023;
    1899          73 :         return StandardRatingsResults;
    1900             :     }
    1901             : 
    1902         604 :     std::tuple<Real64, Real64> IEERSingleSpeedCooling(EnergyPlus::EnergyPlusData &state,
    1903             :                                                       const int CapFTempCurveIndex,
    1904             :                                                       const Real64 RatedTotalCapacity,
    1905             :                                                       const Real64 TotCapFlowModFac,
    1906             :                                                       const Real64 FanPowerPerEvapAirFlowRate,
    1907             :                                                       const Real64 RatedAirVolFlowRate,
    1908             :                                                       const int EIRFTempCurveIndex,
    1909             :                                                       const Real64 RatedCOP,
    1910             :                                                       const Real64 EIRFlowModFac)
    1911             :     {
    1912             :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    1913         604 :         int constexpr NumOfReducedCap(4);                  // Number of reduced capacity test conditions (100%,75%,50%,and 25%)
    1914         604 :         Real64 TotCapTempModFac(0.0);                      // Total capacity modifier (function of entering wetbulb, outside drybulb) [-]
    1915         604 :         Real64 OutdoorUnitInletAirDryBulbTempReduced(0.0); // Outdoor unit entering air dry-bulb temperature at reduced capacity [C]
    1916         604 :         Real64 NetCoolingCapReduced(0.0);                  // Net Cooling Coil capacity at reduced conditions, accounting for supply fan heat [W]
    1917         604 :         Real64 EIRTempModFac(0.0);                         // EIR modifier (function of entering wetbulb, outside drybulb) [-]
    1918         604 :         Real64 EIR(0.0);                                   // Energy Efficiency Ratio at AHRI test conditions for SEER [-]
    1919         604 :         Real64 LoadFactor(0.0);                            // Fractional "on" time for last stage at the desired reduced capacity, (dimensionless)
    1920         604 :         Real64 DegradationCoeff(0.0);                      // Degradation coeficient, (dimenssionless)
    1921         604 :         Real64 ElecPowerReducedCap(0.0);                   // Net power consumption (Cond Fan+Compressor) at reduced test condition [W]
    1922         604 :         Real64 EERReduced(0.0);                            // EER at reduced capacity test conditions (100%, 75%, 50%, and 25%)
    1923         604 :         Real64 IEER = 0.0;                                 // Integareted energy efficiency ratio of single speed DX cooling coil
    1924         604 :         Real64 NetCoolingCapRated = 0.0;                   // net cooling capacity of single speed DX cooling coil
    1925             : 
    1926             :         // Calculate the net cooling capacity at the rated conditions (19.44C WB and 35.0C DB )
    1927         604 :         TotCapTempModFac = Curve::CurveValue(state, CapFTempCurveIndex, CoolingCoilInletAirWetBulbTempRated, OutdoorUnitInletAirDryBulbTempRated);
    1928         604 :         NetCoolingCapRated = RatedTotalCapacity * TotCapTempModFac * TotCapFlowModFac - FanPowerPerEvapAirFlowRate * RatedAirVolFlowRate;
    1929             :         // RedCapNum : Integer counter for reduced capacity
    1930        3020 :         for (int RedCapNum = 0; RedCapNum < NumOfReducedCap; ++RedCapNum) {
    1931             :             // get the outdoor air dry bulb temperature for the reduced capacity test conditions
    1932        2416 :             if (ReducedPLR[RedCapNum] > 0.444) {
    1933        1812 :                 OutdoorUnitInletAirDryBulbTempReduced = 5.0 + 30.0 * ReducedPLR[RedCapNum];
    1934             :             } else {
    1935         604 :                 OutdoorUnitInletAirDryBulbTempReduced = OADBTempLowReducedCapacityTest;
    1936             :             }
    1937        2416 :             TotCapTempModFac =
    1938        4832 :                 Curve::CurveValue(state, CapFTempCurveIndex, CoolingCoilInletAirWetBulbTempRated, OutdoorUnitInletAirDryBulbTempReduced);
    1939        2416 :             NetCoolingCapReduced = RatedTotalCapacity * TotCapTempModFac * TotCapFlowModFac - FanPowerPerEvapAirFlowRate * RatedAirVolFlowRate;
    1940        2416 :             EIRTempModFac = Curve::CurveValue(state, EIRFTempCurveIndex, CoolingCoilInletAirWetBulbTempRated, OutdoorUnitInletAirDryBulbTempReduced);
    1941        2416 :             if (RatedCOP > 0.0) {
    1942        2416 :                 EIR = EIRTempModFac * EIRFlowModFac / RatedCOP;
    1943             :             } else {
    1944           0 :                 EIR = 0.0;
    1945             :             }
    1946        2416 :             if (NetCoolingCapReduced > 0.0) {
    1947        2416 :                 LoadFactor = ReducedPLR[RedCapNum] * NetCoolingCapRated / NetCoolingCapReduced;
    1948             :             } else {
    1949           0 :                 LoadFactor = 1.0;
    1950             :             }
    1951        2416 :             DegradationCoeff = 1.130 - 0.130 * LoadFactor;
    1952        2416 :             ElecPowerReducedCap = DegradationCoeff * EIR * (RatedTotalCapacity * TotCapTempModFac * TotCapFlowModFac);
    1953        2416 :             EERReduced = (LoadFactor * NetCoolingCapReduced) / (LoadFactor * ElecPowerReducedCap + FanPowerPerEvapAirFlowRate * RatedAirVolFlowRate);
    1954        2416 :             IEER += IEERWeightingFactor[RedCapNum] * EERReduced;
    1955             :         }
    1956         604 :         return std::make_tuple(IEER, NetCoolingCapRated);
    1957             :     }
    1958             : 
    1959        1208 :     Real64 EERSingleSpeedCooling(EnergyPlus::EnergyPlusData &state,
    1960             :                                  const int CapFTempCurveIndex,
    1961             :                                  const Real64 RatedTotalCapacity,
    1962             :                                  const Real64 TotCapFlowModFac,
    1963             :                                  const Real64 FanPowerPerEvapAirFlowRate,
    1964             :                                  const Real64 RatedAirVolFlowRate,
    1965             :                                  const int EIRFTempCurveIndex,
    1966             :                                  const Real64 RatedCOP,
    1967             :                                  const Real64 EIRFlowModFac)
    1968             :     {
    1969             :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    1970        1208 :         Real64 EER = 0.0;                // energy efficiency ratio of single speed DX cooling coil
    1971        1208 :         Real64 TotCapTempModFac(0.0);    // Total capacity modifier (function of entering wetbulb, outside drybulb) [-]
    1972        1208 :         Real64 NetCoolingCapRated(0.0);  // net cooling capacity of single speed DX cooling coil
    1973        1208 :         Real64 EIRTempModFac(0.0);       // EIR modifier (function of entering wetbulb, outside drybulb) [-]
    1974        1208 :         Real64 EIR(0.0);                 // Energy Efficiency Ratio at AHRI test conditions for SEER [-]
    1975        1208 :         Real64 TotalElecPowerRated(0.0); // Net power consumption (Cond Fan+Compressor+Indoor Fan) at Rated test conditions [W]
    1976             :         // Calculate the net cooling capacity at the rated conditions (19.44C WB and 35.0C DB )
    1977        1208 :         TotCapTempModFac = Curve::CurveValue(state, CapFTempCurveIndex, CoolingCoilInletAirWetBulbTempRated, OutdoorUnitInletAirDryBulbTempRated);
    1978        1208 :         NetCoolingCapRated = RatedTotalCapacity * TotCapTempModFac * TotCapFlowModFac - FanPowerPerEvapAirFlowRate * RatedAirVolFlowRate;
    1979             :         // Calculate Energy Efficiency Ratio (EER) at (19.44C WB and 35.0C DB ), ANSI/AHRI Std. 340/360
    1980        1208 :         EIRTempModFac = Curve::CurveValue(state, EIRFTempCurveIndex, CoolingCoilInletAirWetBulbTempRated, OutdoorUnitInletAirDryBulbTempRated);
    1981        1208 :         if (RatedCOP > 0.0) {
    1982             :             // RatedCOP <= 0.0 is trapped in GetInput, but keep this as "safety"
    1983        1208 :             EIR = EIRTempModFac * EIRFlowModFac / RatedCOP;
    1984             :         } else {
    1985           0 :             EIR = 0.0;
    1986             :         }
    1987        1208 :         TotalElecPowerRated = EIR * (RatedTotalCapacity * TotCapTempModFac * TotCapFlowModFac) + FanPowerPerEvapAirFlowRate * RatedAirVolFlowRate;
    1988        1208 :         if (TotalElecPowerRated > 0.0) {
    1989        1208 :             EER = NetCoolingCapRated / TotalElecPowerRated;
    1990             :         } else {
    1991           0 :             EER = 0.0;
    1992             :         }
    1993        1208 :         return EER;
    1994             :     }
    1995             : 
    1996        1208 :     std::tuple<Real64, Real64> SEERSingleStageCalculation(EnergyPlusData &state,
    1997             :                                                           int CapFTempCurveIndex,
    1998             :                                                           Real64 RatedTotalCapacity,
    1999             :                                                           Real64 TotCapFlowModFac,
    2000             :                                                           int EIRFTempCurveIndex,
    2001             :                                                           Real64 EIRFlowModFac,
    2002             :                                                           [[maybe_unused]] int EIRFFlowCurveIndex,
    2003             :                                                           Real64 RatedCOP,
    2004             :                                                           Real64 FanPowerPerEvapAirFlowRate,
    2005             :                                                           Real64 RatedAirVolFlowRate,
    2006             :                                                           int PLFFPLRCurveIndex,
    2007             :                                                           Real64 const CyclicDegradationCoefficient)
    2008             :     {
    2009             :         // SUBROUTINE INFORMATION:
    2010             :         //       AUTHOR         B. Nigusse, FSEC
    2011             :         //       DATE WRITTEN   December 2012
    2012             :         //       MODIFIED
    2013             :         //       RE-ENGINEERED  Brijendra Singh
    2014             : 
    2015             :         // PURPOSE OF THIS SUBROUTINE:
    2016             :         // Calculates the SEER values for single speed based on AHRI 210/230 2017 & 2023
    2017             : 
    2018             :         // METHODOLOGY EMPLOYED:
    2019             :         // na
    2020             : 
    2021             :         // REFERENCES:
    2022             :         // na
    2023             : 
    2024             :         // Locals
    2025             :         // SUBROUTINE ARGUMENT DEFINITIONS:
    2026             : 
    2027             :         // SUBROUTINE PARAMETER DEFINITIONS:
    2028             : 
    2029             :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    2030             :         // SEER calculations:
    2031        1208 :         Real64 TotCapTempModFac(0.0);  // Total capacity modifier (function of entering wetbulb, outside drybulb) [-]
    2032        1208 :         Real64 TotCoolingCapAHRI(0.0); // Total Cooling Coil capacity (gross) at AHRI test conditions [W]
    2033        1208 :         Real64 EIRTempModFac(0.0);     // EIR modifier (function of entering wetbulb, outside drybulb) [-]
    2034        1208 :         Real64 NetCoolingCapAHRI(0.0); // Net Cooling Coil capacity at AHRI TestB conditions, accounting for fan heat [W]
    2035        1208 :         Real64 EIR(0.0);               // Energy Efficiency Ratio at AHRI test conditions for SEER [-]
    2036        1208 :         Real64 TotalElecPower(0.0);    // Net power consumption (Cond Fan+Compressor+Indoor Fan) at AHRI test conditions [W]
    2037        1208 :         Real64 PartLoadFactorUser(
    2038             :             0.0); // Part load factor based on user-input PLF curve and C_D value that accounts for thermal lag at compressor startup [-]
    2039        1208 :         Real64 PartLoadFactorStandard(
    2040             :             0.0); // part-load factor that accounts for the cyclic degradation from AHRI Standard 210/240-2008 default PLF curve and C_D value, [-]
    2041        1208 :         Real64 SEER_User = 0.0;     // seasonal energy efficiency ratio of single speed DX cooling coil, from user-input PLF curve and C_D value
    2042        1208 :         Real64 SEER_Standard = 0.0; // seasonal energy efficiency ratio of single speed DX cooling coil, from user-input PLF curve and C_D value
    2043             : 
    2044        1208 :         TotCapTempModFac = Curve::CurveValue(state, CapFTempCurveIndex, CoolingCoilInletAirWetBulbTempRated, OutdoorUnitInletAirDryBulbTemp);
    2045        1208 :         TotCoolingCapAHRI = RatedTotalCapacity * TotCapTempModFac * TotCapFlowModFac;
    2046        1208 :         EIRTempModFac = Curve::CurveValue(state, EIRFTempCurveIndex, CoolingCoilInletAirWetBulbTempRated, OutdoorUnitInletAirDryBulbTemp);
    2047        1208 :         EIR = (RatedCOP > 0.0) ? EIRTempModFac * EIRFlowModFac / RatedCOP : 0.0;
    2048             : 
    2049             :         // Calculate net cooling capacity
    2050        1208 :         NetCoolingCapAHRI = TotCoolingCapAHRI - FanPowerPerEvapAirFlowRate * RatedAirVolFlowRate;
    2051        1208 :         TotalElecPower = EIR * TotCoolingCapAHRI + FanPowerPerEvapAirFlowRate * RatedAirVolFlowRate;
    2052             :         // Calculate SEER value from the Energy Efficiency Ratio (EER) at the AHRI test conditions and the part load factor.
    2053             :         // First evaluate the Part Load Factor curve at PLR = 0.5 (AHRI Standard 210/240)
    2054        1208 :         PartLoadFactorUser = Curve::CurveValue(state, PLFFPLRCurveIndex, PLRforSEER);
    2055        1208 :         PartLoadFactorStandard = 1.0 - (1 - PLRforSEER) * CyclicDegradationCoefficient;
    2056             : 
    2057        1208 :         if (TotalElecPower > 0.0) {
    2058        1208 :             SEER_User = (NetCoolingCapAHRI / TotalElecPower) * PartLoadFactorUser;
    2059        1208 :             SEER_Standard = (NetCoolingCapAHRI / TotalElecPower) * PartLoadFactorStandard;
    2060             :         }
    2061        1208 :         return std::make_tuple(SEER_User, SEER_Standard);
    2062             :     }
    2063             : 
    2064         604 :     std::map<std::string, Real64> SingleSpeedDXCoolingCoilStandardRatings(
    2065             :         EnergyPlusData &state,
    2066             :         std::string const &DXCoilName,                        // Name of DX coil for which HSPF is calculated
    2067             :         std::string const &DXCoilType,                        // Type of DX coil - heating or cooling
    2068             :         int const CapFTempCurveIndex,                         // Index for the capacity as a function of temperature modifier curve
    2069             :         int const CapFFlowCurveIndex,                         // Index for the capacity as a function of flow fraction modifier curve
    2070             :         int const EIRFTempCurveIndex,                         // Index for the EIR as a function of temperature modifier curve
    2071             :         int const EIRFFlowCurveIndex,                         // Index for the EIR as a function of flow fraction modifier curve
    2072             :         int const PLFFPLRCurveIndex,                          // Index for the EIR vs part-load ratio curve
    2073             :         Real64 const RatedTotalCapacity,                      // Rated gross total cooling capacity
    2074             :         Real64 const RatedCOP,                                // Rated gross COP
    2075             :         Real64 const RatedAirVolFlowRate,                     // air flow rate through the coil at rated condition
    2076             :         Real64 const FanPowerPerEvapAirFlowRateFromInput,     // 2017 Fan power per air volume flow rate through the evaporator coil
    2077             :         Real64 const FanPowerPerEvapAirFlowRateFromInput_2023 // 2023 Fan power per air volume flow rate through the evaportor coil
    2078             :     )
    2079             :     {
    2080             :         // SUBROUTINE INFORMATION:
    2081             :         //       AUTHOR         B. Nigusse, FSEC
    2082             :         //       DATE WRITTEN   December 2012
    2083             :         //       MODIFIED
    2084             :         //       RE-ENGINEERED  na
    2085             : 
    2086             :         // PURPOSE OF THIS SUBROUTINE:
    2087             :         // Calculates the standard ratings net cooling capacity and, SEER, EER and IEER values for single speed
    2088             :         // DX cooling coils at the AHRI standard test condition(s).
    2089             : 
    2090             :         // METHODOLOGY EMPLOYED:
    2091             :         // na
    2092             : 
    2093             :         // REFERENCES:
    2094             :         // na
    2095             : 
    2096             :         // Using/Aliasing
    2097             :         using Curve::CurveValue;
    2098             : 
    2099             :         // Locals
    2100             :         // SUBROUTINE ARGUMENT DEFINITIONS:
    2101             : 
    2102             :         // SUBROUTINE PARAMETER DEFINITIONS:
    2103             : 
    2104             :         // INTERFACE BLOCK SPECIFICATIONS
    2105             :         // na
    2106             : 
    2107             :         // DERIVED TYPE DEFINITIONS
    2108             :         // na
    2109             : 
    2110             :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    2111         604 :         Real64 TotCapFlowModFac(0.0);           // Total capacity modifier f(actual flow vs rated flow) for each speed [-]
    2112         604 :         Real64 EIRFlowModFac(0.0);              // EIR modifier f(actual supply air flow vs rated flow) for each speed [-]
    2113         604 :         Real64 TotCapTempModFac(0.0);           // Total capacity modifier (function of entering wetbulb, outside drybulb) [-]
    2114             :         Real64 FanPowerPerEvapAirFlowRate;      // 2017 Fan power per air volume flow rate through the evaporator coil [W/(m3/s)]
    2115             :         Real64 FanPowerPerEvapAirFlowRate_2023; // 2023 Fan power per air volume flow rate through the evaporator coil [W/(m3/s)]
    2116             : 
    2117         604 :         Real64 NetCoolingCapRated(0.0); // net cooling capacity of single speed DX cooling coil
    2118         604 :         Real64 SEER_User(0.0);          // seasonal energy efficiency ratio of single speed DX cooling coil, from user-input PLF curve and C_D value
    2119         604 :         Real64 SEER_Standard(0.0);      // seasonal energy efficiency ratio of single speed DX cooling coil, from user-input PLF curve and C_D value
    2120         604 :         Real64 EER(0.0);                // energy efficiency ratio of single speed DX cooling coil
    2121         604 :         Real64 IEER(0.0);               // Integareted energy efficiency ratio of single speed DX cooling coil
    2122             : 
    2123         604 :         Real64 NetCoolingCapRated2023(0.0); // net cooling capacity of single speed DX cooling coil
    2124         604 :         Real64 SEER2_User(0.0);     // seasonal energy efficiency ratio of single speed DX cooling coil, from user-input PLF curve and C_D value
    2125         604 :         Real64 SEER2_Standard(0.0); // seasonal energy efficiency ratio of single speed DX cooling coil, from user-input PLF curve and C_D value
    2126         604 :         Real64 EER_2023(0.0);       // energy efficiency ratio of single speed DX cooling coil
    2127             :                                     //        Real64 IEER_2023(0.0);      // Integareted energy efficiency ratio of single speed DX cooling coil
    2128             : 
    2129         604 :         std::map<std::string, Real64> StandarRatingResults;
    2130             :         // StandarRatingResults["NetCoolingCapRated"] = NetCoolingCapRated;
    2131             :         // StandarRatingResults["SEER_User"] = SEER_User;
    2132             :         // StandarRatingResults["SEER_Standard"] = SEER_Standard;
    2133             :         // StandarRatingResults["EER"] = EER;
    2134             :         // StandarRatingResults["IEER"] = IEER;
    2135             :         // StandarRatingResults["NetCoolingCapRated2023"] = NetCoolingCapRated2023;
    2136             :         // StandarRatingResults["SEER2_User"] = SEER2_User;
    2137             :         // StandarRatingResults["SEER2_Standard"] = SEER2_Standard;
    2138             :         // StandarRatingResults["EER_2023"] = EER_2023;
    2139             :         // StandarRatingResults["IEER_2023"] = IEER_2023;
    2140             : 
    2141         604 :         if (FanPowerPerEvapAirFlowRateFromInput <= 0.0) {
    2142           0 :             FanPowerPerEvapAirFlowRate = DefaultFanPowerPerEvapAirFlowRate;
    2143             :         } else {
    2144         604 :             FanPowerPerEvapAirFlowRate = FanPowerPerEvapAirFlowRateFromInput;
    2145             :         }
    2146             : 
    2147         604 :         if (FanPowerPerEvapAirFlowRateFromInput_2023 <= 0.0) {
    2148           0 :             FanPowerPerEvapAirFlowRate_2023 = DefaultFanPowerPerEvapAirFlowRateSEER2;
    2149             :         } else {
    2150         604 :             FanPowerPerEvapAirFlowRate_2023 = FanPowerPerEvapAirFlowRateFromInput_2023;
    2151             :         }
    2152             : 
    2153         604 :         if (RatedTotalCapacity > 0.0) {
    2154             : 
    2155             :             // Standard Rating Cooling (net) Capacity calculations:
    2156         604 :             TotCapFlowModFac = CurveValue(state, CapFFlowCurveIndex, AirMassFlowRatioRated);
    2157         604 :             TotCapTempModFac = CurveValue(state, CapFTempCurveIndex, CoolingCoilInletAirWetBulbTempRated, OutdoorUnitInletAirDryBulbTempRated);
    2158         604 :             NetCoolingCapRated = RatedTotalCapacity * TotCapTempModFac * TotCapFlowModFac - FanPowerPerEvapAirFlowRate * RatedAirVolFlowRate;
    2159         604 :             NetCoolingCapRated2023 = RatedTotalCapacity * TotCapTempModFac * TotCapFlowModFac - FanPowerPerEvapAirFlowRate_2023 * RatedAirVolFlowRate;
    2160         604 :             EIRFlowModFac = Curve::CurveValue(state, EIRFFlowCurveIndex, AirMassFlowRatioRated);
    2161             : 
    2162        1208 :             std::tie(SEER_User, SEER_Standard) = SEERSingleStageCalculation(state,
    2163             :                                                                             CapFTempCurveIndex,
    2164             :                                                                             RatedTotalCapacity,
    2165             :                                                                             TotCapFlowModFac,
    2166             :                                                                             EIRFTempCurveIndex,
    2167             :                                                                             EIRFlowModFac,
    2168             :                                                                             EIRFFlowCurveIndex,
    2169             :                                                                             RatedCOP,
    2170             :                                                                             FanPowerPerEvapAirFlowRate,
    2171             :                                                                             RatedAirVolFlowRate,
    2172             :                                                                             PLFFPLRCurveIndex,
    2173         604 :                                                                             CyclicDegradationCoeff);
    2174         604 :             StandarRatingResults["SEER_User"] = SEER_User;
    2175         604 :             StandarRatingResults["SEER_Standard"] = SEER_Standard;
    2176             : 
    2177        1208 :             std::tie(SEER2_User, SEER2_Standard) = SEERSingleStageCalculation(state,
    2178             :                                                                               CapFTempCurveIndex,
    2179             :                                                                               RatedTotalCapacity,
    2180             :                                                                               TotCapFlowModFac,
    2181             :                                                                               EIRFTempCurveIndex,
    2182             :                                                                               EIRFlowModFac,
    2183             :                                                                               EIRFFlowCurveIndex,
    2184             :                                                                               RatedCOP,
    2185             :                                                                               FanPowerPerEvapAirFlowRate_2023,
    2186             :                                                                               RatedAirVolFlowRate,
    2187             :                                                                               PLFFPLRCurveIndex,
    2188         604 :                                                                               CyclicDegradationCoeffSEER2);
    2189         604 :             StandarRatingResults["SEER2_User"] = SEER2_User;
    2190         604 :             StandarRatingResults["SEER2_Standard"] = SEER2_Standard;
    2191             : 
    2192             :             // EER calculations:
    2193         604 :             EER = EERSingleSpeedCooling(state,
    2194             :                                         CapFTempCurveIndex,
    2195             :                                         RatedTotalCapacity,
    2196             :                                         TotCapFlowModFac,
    2197             :                                         FanPowerPerEvapAirFlowRate,
    2198             :                                         RatedAirVolFlowRate,
    2199             :                                         EIRFTempCurveIndex,
    2200             :                                         RatedCOP,
    2201             :                                         EIRFlowModFac);
    2202         604 :             StandarRatingResults["EER"] = EER;
    2203             : 
    2204             :             // EER2 calculations:
    2205         604 :             EER_2023 = EERSingleSpeedCooling(state,
    2206             :                                              CapFTempCurveIndex,
    2207             :                                              RatedTotalCapacity,
    2208             :                                              TotCapFlowModFac,
    2209             :                                              FanPowerPerEvapAirFlowRate_2023,
    2210             :                                              RatedAirVolFlowRate,
    2211             :                                              EIRFTempCurveIndex,
    2212             :                                              RatedCOP,
    2213             :                                              EIRFlowModFac);
    2214         604 :             StandarRatingResults["EER_2023"] = EER_2023;
    2215             : 
    2216             :             // IEER calculations
    2217        1208 :             std::tie(IEER, NetCoolingCapRated) = IEERSingleSpeedCooling(state,
    2218             :                                                                         CapFTempCurveIndex,
    2219             :                                                                         RatedTotalCapacity,
    2220             :                                                                         TotCapFlowModFac,
    2221             :                                                                         FanPowerPerEvapAirFlowRate,
    2222             :                                                                         RatedAirVolFlowRate,
    2223             :                                                                         EIRFTempCurveIndex,
    2224             :                                                                         RatedCOP,
    2225         604 :                                                                         EIRFlowModFac);
    2226         604 :             StandarRatingResults["IEER"] = IEER;
    2227         604 :             StandarRatingResults["NetCoolingCapRated"] = NetCoolingCapRated;
    2228             : 
    2229             :             // IEER2 Calculations are deprecated in AHRI 2023 Std.
    2230             :             // std::tie(IEER_2023, NetCoolingCapRated2023) = IEERSingleSpeedCooling(state,
    2231             :             //                                                                     CapFTempCurveIndex,
    2232             :             //                                                                     RatedTotalCapacity,
    2233             :             //                                                                     TotCapFlowModFac,
    2234             :             //                                                                     FanPowerPerEvapAirFlowRate_2023,
    2235             :             //                                                                     RatedAirVolFlowRate,
    2236             :             //                                                                     EIRFTempCurveIndex,
    2237             :             //                                                                     RatedCOP,
    2238             :             //                                                                     EIRFlowModFac);
    2239             :             // StandarRatingResults["IEER_2023"] = IEER_2023;
    2240         604 :             StandarRatingResults["NetCoolingCapRated2023"] = NetCoolingCapRated2023;
    2241             : 
    2242             :         } else {
    2243           0 :             ShowSevereError(state,
    2244           0 :                             "Standard Ratings: " + DXCoilType + ' ' + DXCoilName +
    2245             :                                 " has zero rated total cooling capacity. Standard ratings cannot be calculated.");
    2246             :         }
    2247         604 :         return StandarRatingResults;
    2248             :     }
    2249             : 
    2250           8 :     void DXCoolingCoilDataCenterStandardRatings(
    2251             :         EnergyPlusData &state,
    2252             :         std::string const &DXCoilName,                    // Name of DX coil for which HSPF is calculated
    2253             :         std::string const &DXCoilType,                    // Type of DX coil - heating or cooling
    2254             :         int const CapFTempCurveIndex,                     // Index for the capacity as a function of temperature modifier curve
    2255             :         int const CapFFlowCurveIndex,                     // Index for the capacity as a function of flow fraction modifier curve
    2256             :         int const EIRFTempCurveIndex,                     // Index for the EIR as a function of temperature modifier curve
    2257             :         int const EIRFFlowCurveIndex,                     // Index for the EIR as a function of flow fraction modifier curve
    2258             :         [[maybe_unused]] int const PLFFPLRCurveIndex,     // Index for the EIR vs part-load ratio curve
    2259             :         Real64 const RatedTotalCapacity,                  // Rated gross total cooling capacity
    2260             :         Real64 const RatedCOP,                            // Rated gross COP
    2261             :         Real64 const RatedAirVolFlowRate,                 // air flow rate through the coil at rated condition
    2262             :         Real64 const FanPowerPerEvapAirFlowRateFromInput, // Fan power per air volume flow rate through the evaporator coil
    2263             :         Array1D<Real64> &NetCoolingCapRated,              // net cooling capacity of single speed DX cooling coil
    2264             :         Array1D<Real64> &TotElectricPowerRated            // total electric power including supply fan
    2265             :     )
    2266             :     {
    2267             : 
    2268             :         // SUBROUTINE INFORMATION:
    2269             :         //       AUTHOR         B. Nigusse, FSEC
    2270             :         //       DATE WRITTEN   October 2014
    2271             :         //       MODIFIED
    2272             :         //       RE-ENGINEERED  na
    2273             : 
    2274             :         // PURPOSE OF THIS SUBROUTINE:
    2275             :         // Calculates the standard ratings net cooling capacity and total electric power
    2276             :         // for room unitary air conditioners single speed DX cooling coils.
    2277             : 
    2278             :         // METHODOLOGY EMPLOYED:
    2279             :         // na
    2280             : 
    2281             :         // REFERENCES:
    2282             :         // ANSI/ASHRAE Standard 127-2012 - Method of Testing for Rating Computer and Data Processing
    2283             :         //                                 Room Unitary Air Conditioners
    2284             : 
    2285             :         // Using/Aliasing
    2286             :         using Curve::CurveValue;
    2287             :         using Psychrometrics::PsyTwbFnTdbWPb;
    2288             :         using Psychrometrics::PsyWFnTdpPb;
    2289             : 
    2290             :         // Locals
    2291             :         // SUBROUTINE ARGUMENT DEFINITIONS:
    2292             :         // na
    2293             : 
    2294             :         // SUBROUTINE PARAMETER DEFINITIONS:
    2295             :         // na
    2296             : 
    2297             :         // INTERFACE BLOCK SPECIFICATIONS
    2298             :         // na
    2299             : 
    2300             :         // DERIVED TYPE DEFINITIONS
    2301             :         // na
    2302             : 
    2303             :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    2304           8 :         Real64 TotCapFlowModFac(0.0);      // Total capacity modifier f(actual flow vs rated flow) for each speed [-]
    2305           8 :         Real64 EIRFlowModFac(0.0);         // EIR modifier f(actual supply air flow vs rated flow) for each speed [-]
    2306           8 :         Real64 TotCapTempModFac(0.0);      // Total capacity modifier (function of entering wetbulb, outside drybulb) [-]
    2307           8 :         Real64 EIRTempModFac(0.0);         // EIR modifier (function of entering wetbulb, outside drybulb) [-]
    2308           8 :         Real64 TotCoolingCapRated(0.0);    // Total Cooling Coil capacity (gross) at one of the rated test conditions [W]
    2309           8 :         Real64 EIR(0.0);                   // Energy Efficiency Ratio at AHRI test conditions for SEER [-]
    2310             :         Real64 FanPowerPerEvapAirFlowRate; // Fan power per air volume flow rate through the evaporator coil [W/(m3/s)]
    2311             : 
    2312             :         Real64 TWBIndoor;  // indoor air dry bulb temperature
    2313             :         Real64 TDBOutdoor; // outdor air dry bulb temperature
    2314             :         int ClassNum;      // class number (Class I, II, II, IV)
    2315             :         int TestNum;       // test number (Test A, B, C, D)
    2316             :         int Num;           // text number counter
    2317             : 
    2318           8 :         if (FanPowerPerEvapAirFlowRateFromInput <= 0.0) {
    2319           0 :             FanPowerPerEvapAirFlowRate = DefaultFanPowerPerEvapAirFlowRate;
    2320             :         } else {
    2321           8 :             FanPowerPerEvapAirFlowRate = FanPowerPerEvapAirFlowRateFromInput;
    2322             :         }
    2323           8 :         if (RatedTotalCapacity > 0.0) {
    2324             : 
    2325          40 :             for (ClassNum = 1; ClassNum <= 4; ++ClassNum) {
    2326          96 :                 TWBIndoor = PsyTwbFnTdbWPb(state,
    2327          32 :                                            IndoorDBTempClassI2IV[ClassNum - 1],
    2328          32 :                                            PsyWFnTdpPb(state, IndoorTDPA2D, state.dataEnvrn->StdBaroPress),
    2329          32 :                                            state.dataEnvrn->StdBaroPress);
    2330         160 :                 for (TestNum = 1; TestNum <= 4; ++TestNum) {
    2331         128 :                     TDBOutdoor = OutdoorDBTempAllClassA2D[TestNum - 1];
    2332         128 :                     Num = (ClassNum - 1) * 4 + TestNum;
    2333             :                     // Standard Rating Net Cooling Capacity at Test A:
    2334         128 :                     TotCapFlowModFac = CurveValue(state, CapFFlowCurveIndex, AirMassFlowRatioRated);
    2335         128 :                     TotCapTempModFac = CurveValue(state, CapFTempCurveIndex, TWBIndoor, TDBOutdoor);
    2336         128 :                     TotCoolingCapRated = RatedTotalCapacity * TotCapTempModFac * TotCapFlowModFac;
    2337         128 :                     NetCoolingCapRated(Num) = TotCoolingCapRated - FanPowerPerEvapAirFlowRate * RatedAirVolFlowRate;
    2338             :                     // Standard Rating total electric power at Test A:
    2339         128 :                     EIRTempModFac = CurveValue(state, EIRFTempCurveIndex, TWBIndoor, TDBOutdoor);
    2340         128 :                     EIRFlowModFac = CurveValue(state, EIRFFlowCurveIndex, AirMassFlowRatioRated);
    2341         128 :                     EIR = 0.0;
    2342         128 :                     if (RatedCOP > 0.0) {
    2343         128 :                         EIR = EIRTempModFac * EIRFlowModFac / RatedCOP;
    2344             :                     }
    2345             :                     // Calculate net cooling capacity at Test A:
    2346         128 :                     TotElectricPowerRated(Num) = EIR * TotCoolingCapRated + FanPowerPerEvapAirFlowRate * RatedAirVolFlowRate;
    2347             :                 }
    2348             :             }
    2349             :         } else {
    2350           0 :             ShowSevereError(state,
    2351           0 :                             "Standard Ratings: " + DXCoilType + ' ' + DXCoilName +
    2352             :                                 " has zero rated total cooling capacity. Capacity and Power cannot be calculated.");
    2353             :         }
    2354           8 :     }
    2355             : 
    2356          48 :     std::tuple<Real64, Real64, Real64> MultiSpeedDXCoolingCoilSEER(EnergyPlusData &state,
    2357             :                                                                    int const nsp,
    2358             :                                                                    Array1A_int const CapFFlowCurveIndex,
    2359             :                                                                    Array1A<Real64> const RatedTotalCapacity,
    2360             :                                                                    Array1A_int const CapFTempCurveIndex,
    2361             :                                                                    Array1A<Real64> const FanPowerPerEvapAirFlowRateFromInput,
    2362             :                                                                    Array1A<Real64> const RatedAirVolFlowRate,
    2363             :                                                                    Array1A_int const EIRFFlowCurveIndex,
    2364             :                                                                    Array1A<Real64> const RatedCOP,
    2365             :                                                                    Array1A_int EIRFTempCurveIndex,
    2366             :                                                                    Array1A_int const PLFFPLRCurveIndex)
    2367             :     {
    2368             :         // Intermediate values calculated from the inputs in the idf file
    2369          96 :         Array1D<Real64> FanPowerPerEvapAirFlowRate(nsp); // 2017 Fan power per air volume flow rate through the evaporator coil [W/(m3/s)]
    2370          96 :         Array1D<Real64> TotCoolCapTestA2(nsp);           // Total cooling capacity at A2 test condition (High speed)
    2371          96 :         Array1D<Real64> TotCoolCapTestB2(nsp);           // Total cooling capacity at B2 test condition (High speed)
    2372          96 :         Array1D<Real64> TotCoolCapTestB1(nsp);           // Total cooling capacity at B1 test condition (Low speed)
    2373          96 :         Array1D<Real64> TotCoolCapTestF1(nsp);           // Total cooling capacity at F1 test condition (Low speed)
    2374          96 :         Array1D<Real64> OutdoorUnitPowerTestA2(nsp);     // Outdoor Unit electric power at A2 test condition (High speed)
    2375          96 :         Array1D<Real64> OutdoorUnitPowerTestB2(nsp);     // Outdoor Unit electric power at B2 test condition (High speed)
    2376          96 :         Array1D<Real64> OutdoorUnitPowerTestB1(nsp);     // Outdoor Unit electric power at B1 test condition (Low speed)
    2377          96 :         Array1D<Real64> OutdoorUnitPowerTestF1(nsp);     // Outdoor Unit electric power at F1 test condition
    2378             : 
    2379          48 :         Real64 PartLoadRatio(0.0);      // compressor cycling ratio between successive speeds, [-]
    2380          48 :         Real64 PartLoadFactorUser(0.0); // part-load factor based on user-input PLF curve and C_D value that accounts for the cyclic degradation, [-]
    2381          48 :         Real64 PartLoadFactorStandard(
    2382             :             0.0); // part-load factorn that accounts for the cyclic degradation from AHRI standard 210/240 default PLF curve and C_D value, [-]
    2383          48 :         Real64 NetCoolingCapWeighted(0.0);              // net tot cooling cap weighted by the fraction of the binned cooling hours [W]
    2384          48 :         Real64 TotCoolingElecPowerWeighted(0.0);        // net total cooling electric power input weighted by the fraction of the temperature bins
    2385          48 :         Real64 TotCoolingElecPowerWeightedDefault(0.0); // net total cooling electric power input weighted by the fraction of the temperature bins
    2386             :                                                         // from AHRI 201/240 default PLF curve and C_D value,
    2387             : 
    2388             :         // binned cooling hours
    2389          48 :         Real64 BuildingCoolingLoad(0.0);    // Building space cooling load corresponding to an outdoor bin temperature [W]
    2390          48 :         Real64 NetTotCoolCapBinned(0.0);    // Net tot cooling cap corresponding to an outdoor bin temperature [W]
    2391          48 :         Real64 TotCoolElecPowerBinned(0.0); // Total cooling electric power corresponding to an outdoor bin temperature [W]
    2392          48 :         Real64 TotCoolElecPowerBinnedDefault(
    2393             :             0.0); // Total cooling electric power corresponding to an outdoor bin temperature from AHRI 201/240 default PLF curve and C_D value, [W]
    2394          48 :         Real64 LoadFactor(0.0); // "on" time for last stage at the desired reduced capacity, (dimensionless)
    2395             : 
    2396             :         int BinNum;                              // bin number counter
    2397             :         int spnum;                               // compressor speed number
    2398          96 :         Array1D<Real64> NetCoolingCapRated(nsp); // net cooling capacity at each speed
    2399          96 :         Array1D<Real64> TotCapFlowModFac(nsp);   // Total capacity modifier f(actual flow vs rated flow) for each speed [-]
    2400          96 :         Array1D<Real64> EIRFlowModFac(nsp);      // EIR modifier f(actual supply air flow vs rated flow) for each speed [-]
    2401          48 :         Real64 CoolingCapacityLS(0.0);           // cooling capacity of Mult-speed DX coil at lower speed, [W]
    2402          48 :         Real64 CoolingCapacityHS(0.0);           // cooling capacity of Mult-speed DX coil at higher speed, [W]
    2403          48 :         Real64 CoolingElecPowerLS(0.0);          // outdoor unit electric power input at low speed, [W]
    2404          48 :         Real64 CoolingElecPowerHS(0.0);          // outdoor unit electric power input at high speed, [W]
    2405          48 :         Real64 CoolingCapacityMax(0.0);          // cooling capacity of Mult-speed DX coil at max speed, [W]
    2406          48 :         Real64 CoolingElecPowerMax(0.0);         // outdoor unit electric power input at Max speed, [W]
    2407             : 
    2408          48 :         Real64 constexpr SizingFactor(1.10); // sizing factor per AHRI Std 210/240-2008
    2409             : 
    2410          48 :         Real64 NetCoolingCapRatedMaxSpeed = 0.0;
    2411          48 :         Real64 SEER_User = 0.0;
    2412          48 :         Real64 SEER_Standard = 0.0;
    2413             : 
    2414          48 :         NetCoolingCapWeighted = 0.0;
    2415          48 :         TotCoolingElecPowerWeighted = 0.0;
    2416          48 :         TotCoolingElecPowerWeightedDefault = 0.0;
    2417             : 
    2418         157 :         for (int spnum = 1; spnum <= nsp; ++spnum) {
    2419         109 :             FanPowerPerEvapAirFlowRate(spnum) = 0.0;
    2420         109 :             if (FanPowerPerEvapAirFlowRateFromInput(spnum) <= 0.0) {
    2421          64 :                 FanPowerPerEvapAirFlowRate(spnum) = DefaultFanPowerPerEvapAirFlowRate;
    2422             :             } else {
    2423          45 :                 FanPowerPerEvapAirFlowRate(spnum) = FanPowerPerEvapAirFlowRateFromInput(spnum);
    2424             :             }
    2425             :         }
    2426             : 
    2427             :         // Calculate the capacity and power for each speed
    2428         157 :         for (spnum = 1; spnum <= nsp; ++spnum) {
    2429         109 :             TotCapFlowModFac(spnum) = Curve::CurveValue(state, static_cast<int64_t>(CapFFlowCurveIndex(spnum)), AirMassFlowRatioRated);
    2430         109 :             TotCoolCapTestA2(spnum) =
    2431         218 :                 RatedTotalCapacity(spnum) *
    2432         327 :                     Curve::CurveValue(state, CapFTempCurveIndex(spnum), IndoorCoilInletAirWetBulbTempRated, OutdoorCoilInletAirDryBulbTempTestA2) *
    2433         218 :                     TotCapFlowModFac(spnum) -
    2434         109 :                 FanPowerPerEvapAirFlowRate(spnum) * RatedAirVolFlowRate(spnum);
    2435             : 
    2436         109 :             TotCoolCapTestB2(spnum) =
    2437         218 :                 RatedTotalCapacity(spnum) *
    2438         327 :                     Curve::CurveValue(state, CapFTempCurveIndex(spnum), IndoorCoilInletAirWetBulbTempRated, OutdoorCoilInletAirDryBulbTempTestB2) *
    2439         218 :                     TotCapFlowModFac(spnum) -
    2440         109 :                 FanPowerPerEvapAirFlowRate(spnum) * RatedAirVolFlowRate(spnum);
    2441             : 
    2442         109 :             TotCoolCapTestB1(spnum) =
    2443         218 :                 RatedTotalCapacity(spnum) *
    2444         327 :                     Curve::CurveValue(state, CapFTempCurveIndex(spnum), IndoorCoilInletAirWetBulbTempRated, OutdoorCoilInletAirDryBulbTempTestB1) *
    2445         218 :                     TotCapFlowModFac(spnum) -
    2446         109 :                 FanPowerPerEvapAirFlowRate(spnum) * RatedAirVolFlowRate(spnum);
    2447             : 
    2448         109 :             TotCoolCapTestF1(spnum) =
    2449         218 :                 RatedTotalCapacity(spnum) *
    2450         327 :                     Curve::CurveValue(state, CapFTempCurveIndex(spnum), IndoorCoilInletAirWetBulbTempRated, OutdoorCoilInletAirDryBulbTempTestF1) *
    2451         218 :                     TotCapFlowModFac(spnum) -
    2452         109 :                 FanPowerPerEvapAirFlowRate(spnum) * RatedAirVolFlowRate(spnum);
    2453             : 
    2454         109 :             EIRFlowModFac(spnum) = Curve::CurveValue(state, EIRFFlowCurveIndex(spnum), AirMassFlowRatioRated);
    2455         109 :             if (RatedCOP(spnum) > 0.0) {
    2456         109 :                 OutdoorUnitPowerTestA2(spnum) =
    2457         218 :                     TotCoolCapTestA2(spnum) * EIRFlowModFac(spnum) *
    2458         327 :                         Curve::CurveValue(
    2459         218 :                             state, EIRFTempCurveIndex(spnum), IndoorCoilInletAirWetBulbTempRated, OutdoorCoilInletAirDryBulbTempTestA2) /
    2460         218 :                         RatedCOP(spnum) +
    2461         109 :                     FanPowerPerEvapAirFlowRate(spnum) * RatedAirVolFlowRate(spnum);
    2462             : 
    2463         109 :                 OutdoorUnitPowerTestB2(spnum) =
    2464         218 :                     TotCoolCapTestB2(spnum) * EIRFlowModFac(spnum) *
    2465         327 :                         Curve::CurveValue(
    2466         218 :                             state, EIRFTempCurveIndex(spnum), IndoorCoilInletAirWetBulbTempRated, OutdoorCoilInletAirDryBulbTempTestB2) /
    2467         218 :                         RatedCOP(spnum) +
    2468         109 :                     FanPowerPerEvapAirFlowRate(spnum) * RatedAirVolFlowRate(spnum);
    2469             : 
    2470         109 :                 OutdoorUnitPowerTestB1(spnum) =
    2471         218 :                     TotCoolCapTestB1(spnum) * EIRFlowModFac(spnum) *
    2472         327 :                         Curve::CurveValue(
    2473         218 :                             state, EIRFTempCurveIndex(spnum), IndoorCoilInletAirWetBulbTempRated, OutdoorCoilInletAirDryBulbTempTestB1) /
    2474         218 :                         RatedCOP(spnum) +
    2475         109 :                     FanPowerPerEvapAirFlowRate(spnum) * RatedAirVolFlowRate(spnum);
    2476             : 
    2477         109 :                 OutdoorUnitPowerTestF1(spnum) =
    2478         218 :                     TotCoolCapTestF1(spnum) * EIRFlowModFac(spnum) *
    2479         327 :                         Curve::CurveValue(
    2480         218 :                             state, EIRFTempCurveIndex(spnum), IndoorCoilInletAirWetBulbTempRated, OutdoorCoilInletAirDryBulbTempTestF1) /
    2481         218 :                         RatedCOP(spnum) +
    2482         109 :                     FanPowerPerEvapAirFlowRate(spnum) * RatedAirVolFlowRate(spnum);
    2483             :             }
    2484             :         }
    2485             :         // Standard Rating cooling (net) capacity calculations:
    2486          48 :         NetCoolingCapRated(nsp) = TotCoolCapTestA2(nsp);
    2487          48 :         NetCoolingCapRatedMaxSpeed = NetCoolingCapRated(nsp);
    2488             : 
    2489             :         // Calculate the SEER value based on contribution of each outdoor air bin temperature
    2490         432 :         for (BinNum = 0; BinNum < NumOfOATempBins; ++BinNum) {
    2491             :             // Equation 11.60 (AHRI-2017)
    2492         384 :             BuildingCoolingLoad = (OutdoorBinTemperatureSEER[BinNum] - 18.3) / (35.0 - 18.3) * (TotCoolCapTestA2(nsp) / SizingFactor);
    2493             :             // determine the speed number
    2494         768 :             CoolingCapacityMax = TotCoolCapTestB2(nsp) + ((TotCoolCapTestA2(nsp) - TotCoolCapTestB2(nsp)) /
    2495         384 :                                                           (OutdoorCoilInletAirDryBulbTempTestA2 - OutdoorCoilInletAirDryBulbTempTestB2)) *
    2496         384 :                                                              (OutdoorBinTemperatureSEER[BinNum] - OutdoorCoilInletAirDryBulbTempTestB2);
    2497         768 :             CoolingElecPowerMax = OutdoorUnitPowerTestB2(nsp) + ((OutdoorUnitPowerTestA2(nsp) - OutdoorUnitPowerTestB2(nsp)) /
    2498         384 :                                                                  (OutdoorCoilInletAirDryBulbTempTestA2 - OutdoorCoilInletAirDryBulbTempTestB2)) *
    2499         384 :                                                                     (OutdoorBinTemperatureSEER[BinNum] - OutdoorCoilInletAirDryBulbTempTestB2);
    2500             : 
    2501         416 :             for (spnum = 1; spnum <= nsp - 1; ++spnum) {
    2502         832 :                 CoolingCapacityLS = TotCoolCapTestF1(spnum) + ((TotCoolCapTestB1(spnum) - TotCoolCapTestF1(spnum)) /
    2503         416 :                                                                (OutdoorCoilInletAirDryBulbTempTestB1 - OutdoorCoilInletAirDryBulbTempTestF1)) *
    2504         416 :                                                                   (OutdoorBinTemperatureSEER[BinNum] - OutdoorCoilInletAirDryBulbTempTestF1);
    2505         832 :                 CoolingElecPowerLS = OutdoorUnitPowerTestF1(spnum) + ((OutdoorUnitPowerTestB1(spnum) - OutdoorUnitPowerTestF1(spnum)) /
    2506         416 :                                                                       (OutdoorCoilInletAirDryBulbTempTestB1 - OutdoorCoilInletAirDryBulbTempTestF1)) *
    2507         416 :                                                                          (OutdoorBinTemperatureSEER[BinNum] - OutdoorCoilInletAirDryBulbTempTestF1);
    2508         832 :                 CoolingCapacityHS = TotCoolCapTestB2(spnum + 1) + ((TotCoolCapTestA2(spnum + 1) - TotCoolCapTestB2(spnum + 1)) /
    2509         416 :                                                                    (OutdoorCoilInletAirDryBulbTempTestA2 - OutdoorCoilInletAirDryBulbTempTestB2)) *
    2510         416 :                                                                       (OutdoorBinTemperatureSEER[BinNum] - OutdoorCoilInletAirDryBulbTempTestB2);
    2511         416 :                 CoolingElecPowerHS =
    2512         416 :                     OutdoorUnitPowerTestB2(spnum + 1) + ((OutdoorUnitPowerTestA2(spnum + 1) - OutdoorUnitPowerTestB2(spnum + 1)) /
    2513         416 :                                                          (OutdoorCoilInletAirDryBulbTempTestA2 - OutdoorCoilInletAirDryBulbTempTestB2)) *
    2514         416 :                                                             (OutdoorBinTemperatureSEER[BinNum] - OutdoorCoilInletAirDryBulbTempTestB2);
    2515             : 
    2516         416 :                 if (BuildingCoolingLoad <= CoolingCapacityLS) {
    2517         164 :                     PartLoadRatio = min(1.0, BuildingCoolingLoad / CoolingCapacityLS);
    2518         164 :                     NetTotCoolCapBinned = PartLoadRatio * CoolingCapacityLS;
    2519         164 :                     PartLoadFactorUser = Curve::CurveValue(state, PLFFPLRCurveIndex(spnum), PartLoadRatio);
    2520         164 :                     PartLoadFactorStandard = 1.0 - CyclicDegradationCoeff * (1.0 - PartLoadRatio);
    2521         164 :                     TotCoolElecPowerBinned = (PartLoadRatio / PartLoadFactorUser) * CoolingElecPowerLS;
    2522         164 :                     TotCoolElecPowerBinnedDefault = (PartLoadRatio / PartLoadFactorStandard) * CoolingElecPowerLS;
    2523         164 :                     goto SpeedLoop_exit;
    2524         252 :                 } else if ((BuildingCoolingLoad > CoolingCapacityLS) && (BuildingCoolingLoad < CoolingCapacityHS)) {
    2525             :                     // cycle between speed "spnum" and "spnum + 1"
    2526         172 :                     LoadFactor = min(1.0, (CoolingCapacityHS - BuildingCoolingLoad) / (CoolingCapacityHS - CoolingCapacityLS));
    2527         172 :                     LoadFactor = max(0.0, LoadFactor);
    2528         172 :                     NetTotCoolCapBinned = LoadFactor * CoolingCapacityLS + (1.0 - LoadFactor) * CoolingCapacityHS;
    2529         172 :                     TotCoolElecPowerBinned = LoadFactor * CoolingElecPowerLS + (1.0 - LoadFactor) * CoolingElecPowerHS;
    2530         172 :                     TotCoolElecPowerBinnedDefault = TotCoolElecPowerBinned;
    2531             : 
    2532             :                     // TBD:  // Suggestion for improvement as per 2017 Standard MCQ & MCE are differently calculated
    2533             :                     // and so does the load factor for Cooling and Power
    2534             :                     // Real64 LoadFactorQEnt_2023 =
    2535             :                     //     min(1.0, (TotCoolCapTestEint(spnum2023) - CoolingCapacityLS_2023) / (CoolingCapacityHS_2023 - CoolingCapacityLS_2023));
    2536             :                     // LoadFactorQEnt_2023 = max(0.0, LoadFactorQEnt_2023);
    2537             :                     // Real64 LoadFactorPEnt_2023 = min(
    2538             :                     //     1.0, (OutdoorUnitPowerTestEint(spnum2023) - CoolingElecPowerLS_2023) / (CoolingElecPowerHS_2023 -
    2539             :                     //     CoolingElecPowerLS_2023));
    2540             :                     // LoadFactorPEnt_2023 = max(0.0, LoadFactorPEnt_2023);
    2541             : 
    2542             :                     // NetTotCoolCapBinned_2023 = LoadFactorQEnt_2023 * CoolingCapacityHS_2023 + (1.0 - LoadFactorQEnt_2023) * CoolingCapacityLS_2023;
    2543             :                     // TotCoolElecPowerBinned_2023 =
    2544             :                     //     LoadFactorPEnt_2023 * CoolingElecPowerHS_2023 + (1.0 - LoadFactorPEnt_2023) * CoolingElecPowerLS_2023;
    2545             :                     // TotCoolElecPowerBinnedDefault_2023 = TotCoolElecPowerBinned_2023;
    2546         172 :                     goto SpeedLoop_exit;
    2547          80 :                 } else if (BuildingCoolingLoad >= CoolingCapacityMax) {
    2548          48 :                     NetTotCoolCapBinned = CoolingCapacityMax;
    2549          48 :                     TotCoolElecPowerBinned = CoolingElecPowerMax;
    2550          48 :                     TotCoolElecPowerBinnedDefault = CoolingElecPowerMax;
    2551          48 :                     goto SpeedLoop_exit;
    2552             :                 }
    2553             :             }
    2554           0 :         SpeedLoop_exit:;
    2555             : 
    2556         384 :             NetCoolingCapWeighted += NetTotCoolCapBinned * CoolFracBinHoursAtOutdoorBinTemp[BinNum];
    2557         384 :             TotCoolingElecPowerWeighted += TotCoolElecPowerBinned * CoolFracBinHoursAtOutdoorBinTemp[BinNum];
    2558         384 :             TotCoolingElecPowerWeightedDefault += TotCoolElecPowerBinnedDefault * CoolFracBinHoursAtOutdoorBinTemp[BinNum];
    2559             :         }
    2560          48 :         SEER_User = 0.0;
    2561          48 :         SEER_Standard = 0.0;
    2562          48 :         if (TotCoolingElecPowerWeighted > 0.0) {
    2563          48 :             SEER_User = NetCoolingCapWeighted / TotCoolingElecPowerWeighted;
    2564          48 :             SEER_Standard = NetCoolingCapWeighted / TotCoolingElecPowerWeightedDefault;
    2565             :         }
    2566             : 
    2567          96 :         return std::make_tuple(NetCoolingCapRatedMaxSpeed, SEER_User, SEER_Standard);
    2568             :     }
    2569             : 
    2570          48 :     std::tuple<Real64, Real64, Real64> MultiSpeedDXCoolingCoilSEER2(EnergyPlusData &state,
    2571             :                                                                     int const nsp,
    2572             :                                                                     Array1A_int const CapFFlowCurveIndex,
    2573             :                                                                     Array1A<Real64> const RatedTotalCapacity,
    2574             :                                                                     Array1A_int const CapFTempCurveIndex,
    2575             :                                                                     Array1A<Real64> const FanPowerPerEvapAirFlowRateFromInput_2023,
    2576             :                                                                     Array1A<Real64> const RatedAirVolFlowRate,
    2577             :                                                                     Array1A_int const EIRFFlowCurveIndex,
    2578             :                                                                     Array1A<Real64> const RatedCOP,
    2579             :                                                                     Array1A_int EIRFTempCurveIndex,
    2580             :                                                                     Array1A_int const PLFFPLRCurveIndex)
    2581             :     {
    2582             :         // Intermediate values calculated from the inputs in the idf file
    2583             :         // ANSI/AHRI 210/240 Std. 2023
    2584          96 :         Array1D<Real64> FanPowerPerEvapAirFlowRate_2023(nsp); // 2023 Fan power per air volume flow rate through the evaporator coil [W/(m3/s)]
    2585          96 :         Array1D<Real64> Q_A_Full(nsp);                        // Total cooling capacity at A2 test condition (High speed) | q_A_Full
    2586          96 :         Array1D<Real64> Q_B_Full(nsp);                        // Total cooling capacity at B2 test condition (High speed) | q_B_Full
    2587          96 :         Array1D<Real64> Q_B_Low(nsp);                         // Total cooling capacity at B1 test condition (Low speed) | q_B_Low
    2588          96 :         Array1D<Real64> Q_F_Low(nsp);                         // Total cooling capacity at F1 test condition (Low speed) | q_F_Low
    2589          96 :         Array1D<Real64> Q_E_Int(nsp);                         // Total cooling capacity at Eint (Ev) test condition | q_E_Int
    2590          96 :         Array1D<Real64> P_A_Full(nsp);                        // Outdoor Unit electric power at A2 test condition (High speed) | p_A_Full
    2591          96 :         Array1D<Real64> P_B_Full(nsp);                        // Outdoor Unit electric power at B2 test condition (High speed) | p_B_Full
    2592          96 :         Array1D<Real64> P_B_Low(nsp);                         // Outdoor Unit electric power at B1 test condition (Low speed) | p_B_Low
    2593          96 :         Array1D<Real64> P_F_Low(nsp);                         // Outdoor Unit electric power at F1 test condition | p_F_Low
    2594          96 :         Array1D<Real64> P_E_Int(nsp);                         // Outdoor Unit electric power at Eint (Ev) test conditon | p_E_Int
    2595             : 
    2596          48 :         Real64 PartLoadFactorUser_2023(
    2597             :             0.0); // part-load factor based on user-input PLF curve and C_D value that accounts for the cyclic degradation, [-]
    2598             : 
    2599          48 :         Real64 NetCoolingCapWeighted_2023(0.0);         // net tot cooling cap weighted by the fraction of the binned cooling hours [W]
    2600          48 :         Real64 TotCoolingElecPowerWeighted_2023(0.0);   // net total cooling electric power input weighted by the fraction of the temperature bins
    2601          48 :         Real64 TotCoolingElecPowerWeightedDefault(0.0); // net total cooling electric power input weighted by the fraction of the temperature bins
    2602             :                                                         // from AHRI 201/240 default PLF curve and C_D value,
    2603             : 
    2604             :         // binned cooling hours
    2605          48 :         Real64 BuildingCoolingLoad_2023(0.0);    // Building space cooling load corresponding to an outdoor bin temperature [W]
    2606          48 :         Real64 NetTotCoolCapBinned_2023(0.0);    // Net tot cooling cap corresponding to an outdoor bin temperature [W]
    2607          48 :         Real64 TotCoolElecPowerBinned_2023(0.0); // Total cooling electric power corresponding to an outdoor bin temperature [W]
    2608             : 
    2609             :         int spnum;                                    // compressor speed number
    2610          96 :         Array1D<Real64> TotCapFlowModFac(nsp);        // Total capacity modifier f(actual flow vs rated flow) for each speed [-]
    2611          96 :         Array1D<Real64> EIRFlowModFac(nsp);           // EIR modifier f(actual supply air flow vs rated flow) for each speed [-]
    2612          96 :         Array1D<Real64> NetCoolingCapRated_2023(nsp); // net cooling capacity at each speed
    2613          48 :         Real64 q_low(0.0);                            // cooling capacity of Mult-speed DX coil at lower speed, [W]
    2614          48 :         Real64 q_full(0.0);                           // cooling capacity of Mult-speed DX coil at higher speed, [W]
    2615          48 :         Real64 p_low(0.0);                            // outdoor unit electric power input at low speed, [W]
    2616          48 :         Real64 p_full(0.0);                           // outdoor unit electric power input at high speed, [W]
    2617          48 :         Real64 CoolingCapacityMax_2023(0.0);          // cooling capacity of Mult-speed DX coil at max speed, [W]
    2618          48 :         Real64 CoolingElecPowerMax_2023(0.0);         // outdoor unit electric power input at Max speed, [W]
    2619             : 
    2620          48 :         Real64 constexpr SF(1.10); // Sizing Factor as per AHRI Std 210/240-2023 | equation 11.68
    2621          48 :         Real64 constexpr V(1);     // V = 0.93 for Variable Speed Heat Pumps, otherwise V = 1.0
    2622             : 
    2623          48 :         Real64 NetCoolingCapRatedMaxSpeed2023 = 0.0;
    2624          48 :         Real64 SEER2_User = 0.0;
    2625          48 :         Real64 SEER2_Standard = 0.0;
    2626             : 
    2627          48 :         NetCoolingCapWeighted_2023 = 0.0;
    2628          48 :         TotCoolingElecPowerWeighted_2023 = 0.0;
    2629          48 :         TotCoolingElecPowerWeightedDefault = 0.0;
    2630             : 
    2631         157 :         for (int spnum = 1; spnum <= nsp; ++spnum) {
    2632         109 :             FanPowerPerEvapAirFlowRate_2023(spnum) = 0.0;
    2633         109 :             if (FanPowerPerEvapAirFlowRateFromInput_2023(spnum) <= 0.0) {
    2634           0 :                 FanPowerPerEvapAirFlowRate_2023(spnum) = DefaultFanPowerPerEvapAirFlowRateSEER2;
    2635             :             } else {
    2636         109 :                 FanPowerPerEvapAirFlowRate_2023(spnum) = FanPowerPerEvapAirFlowRateFromInput_2023(spnum);
    2637             :             }
    2638             :         }
    2639             : 
    2640             :         // Calculate the capacity and power for each speed
    2641         157 :         for (spnum = 1; spnum <= nsp; ++spnum) {
    2642         109 :             TotCapFlowModFac(spnum) = Curve::CurveValue(state, CapFFlowCurveIndex(spnum), AirMassFlowRatioRated);
    2643             : 
    2644         109 :             Q_A_Full(spnum) =
    2645         218 :                 RatedTotalCapacity(spnum) *
    2646         327 :                     Curve::CurveValue(state, CapFTempCurveIndex(spnum), IndoorCoilInletAirWetBulbTempRated, OutdoorCoilInletAirDryBulbTempTestA2) *
    2647         218 :                     TotCapFlowModFac(spnum) -
    2648         109 :                 FanPowerPerEvapAirFlowRate_2023(spnum) * RatedAirVolFlowRate(spnum);
    2649             : 
    2650         109 :             Q_B_Full(spnum) =
    2651         218 :                 RatedTotalCapacity(spnum) *
    2652         327 :                     Curve::CurveValue(state, CapFTempCurveIndex(spnum), IndoorCoilInletAirWetBulbTempRated, OutdoorCoilInletAirDryBulbTempTestB2) *
    2653         218 :                     TotCapFlowModFac(spnum) -
    2654         109 :                 FanPowerPerEvapAirFlowRate_2023(spnum) * RatedAirVolFlowRate(spnum);
    2655             : 
    2656         109 :             Q_B_Low(spnum) =
    2657         218 :                 RatedTotalCapacity(spnum) *
    2658         327 :                     Curve::CurveValue(state, CapFTempCurveIndex(spnum), IndoorCoilInletAirWetBulbTempRated, OutdoorCoilInletAirDryBulbTempTestB1) *
    2659         218 :                     TotCapFlowModFac(spnum) -
    2660         109 :                 FanPowerPerEvapAirFlowRate_2023(spnum) * RatedAirVolFlowRate(spnum);
    2661             : 
    2662         109 :             Q_F_Low(spnum) =
    2663         218 :                 RatedTotalCapacity(spnum) *
    2664         327 :                     Curve::CurveValue(state, CapFTempCurveIndex(spnum), IndoorCoilInletAirWetBulbTempRated, OutdoorCoilInletAirDryBulbTempTestF1) *
    2665         218 :                     TotCapFlowModFac(spnum) -
    2666         109 :                 FanPowerPerEvapAirFlowRate_2023(spnum) * RatedAirVolFlowRate(spnum);
    2667             : 
    2668         109 :             Q_E_Int(spnum) =
    2669         218 :                 RatedTotalCapacity(spnum) *
    2670         327 :                     Curve::CurveValue(state, CapFTempCurveIndex(spnum), IndoorCoilInletAirWetBulbTempRated, OutdoorCoilInletAirDryBulbTempTestEint) *
    2671         218 :                     TotCapFlowModFac(spnum) -
    2672         109 :                 FanPowerPerEvapAirFlowRate_2023(spnum) * RatedAirVolFlowRate(spnum);
    2673             : 
    2674         109 :             EIRFlowModFac(spnum) = Curve::CurveValue(state, EIRFFlowCurveIndex(spnum), AirMassFlowRatioRated);
    2675         109 :             if (RatedCOP(spnum) > 0.0) {
    2676         109 :                 P_A_Full(spnum) =
    2677         218 :                     Q_A_Full(spnum) * EIRFlowModFac(spnum) *
    2678         327 :                         Curve::CurveValue(
    2679         218 :                             state, EIRFTempCurveIndex(spnum), IndoorCoilInletAirWetBulbTempRated, OutdoorCoilInletAirDryBulbTempTestA2) /
    2680         218 :                         RatedCOP(spnum) +
    2681         109 :                     FanPowerPerEvapAirFlowRate_2023(spnum) * RatedAirVolFlowRate(spnum);
    2682             : 
    2683         109 :                 P_B_Full(spnum) =
    2684         218 :                     Q_B_Full(spnum) * EIRFlowModFac(spnum) *
    2685         327 :                         Curve::CurveValue(
    2686         218 :                             state, EIRFTempCurveIndex(spnum), IndoorCoilInletAirWetBulbTempRated, OutdoorCoilInletAirDryBulbTempTestB2) /
    2687         218 :                         RatedCOP(spnum) +
    2688         109 :                     FanPowerPerEvapAirFlowRate_2023(spnum) * RatedAirVolFlowRate(spnum);
    2689             : 
    2690         327 :                 P_B_Low(spnum) = Q_B_Low(spnum) * EIRFlowModFac(spnum) *
    2691         327 :                                      Curve::CurveValue(
    2692         218 :                                          state, EIRFTempCurveIndex(spnum), IndoorCoilInletAirWetBulbTempRated, OutdoorCoilInletAirDryBulbTempTestB1) /
    2693         218 :                                      RatedCOP(spnum) +
    2694         109 :                                  FanPowerPerEvapAirFlowRate_2023(spnum) * RatedAirVolFlowRate(spnum);
    2695             : 
    2696         327 :                 P_F_Low(spnum) = Q_F_Low(spnum) * EIRFlowModFac(spnum) *
    2697         327 :                                      Curve::CurveValue(
    2698         218 :                                          state, EIRFTempCurveIndex(spnum), IndoorCoilInletAirWetBulbTempRated, OutdoorCoilInletAirDryBulbTempTestF1) /
    2699         218 :                                      RatedCOP(spnum) +
    2700         109 :                                  FanPowerPerEvapAirFlowRate_2023(spnum) * RatedAirVolFlowRate(spnum);
    2701             : 
    2702         109 :                 P_E_Int(spnum) =
    2703         218 :                     Q_E_Int(spnum) * EIRFlowModFac(spnum) *
    2704         327 :                         Curve::CurveValue(
    2705         218 :                             state, EIRFTempCurveIndex(spnum), IndoorCoilInletAirWetBulbTempRated, OutdoorCoilInletAirDryBulbTempTestEint) /
    2706         218 :                         RatedCOP(spnum) +
    2707         109 :                     FanPowerPerEvapAirFlowRate_2023(spnum) * RatedAirVolFlowRate(spnum);
    2708             :             }
    2709             :         }
    2710             :         // Standard Rating cooling (net) capacity calculations:
    2711          48 :         NetCoolingCapRated_2023(nsp) = Q_A_Full(nsp);
    2712          48 :         NetCoolingCapRatedMaxSpeed2023 = NetCoolingCapRated_2023(nsp);
    2713             : 
    2714             :         // Calculate the SEER value based on contribution of each outdoor air bin temperature
    2715          48 :         Real64 q_sum = 0.0;
    2716          48 :         Real64 e_sum = 0.0;
    2717          48 :         Real64 NetCoolingCapWeighted2_2023 = 0.0;
    2718          48 :         Real64 TotCoolingElecPowerWeighted2_2023 = 0.0;
    2719         432 :         for (int BN = 0; BN < NumOfOATempBins; ++BN) {
    2720             :             // Equation 11.67 (AHRI-2023)
    2721         384 :             BuildingCoolingLoad_2023 = ((OutdoorBinTemperatureSEER[BN] - 18.3) / (35.0 - 18.3) * (Q_A_Full(nsp) / SF)) * V;
    2722             :             // determine the speed number
    2723         384 :             CoolingCapacityMax_2023 =
    2724         768 :                 Q_B_Full(nsp) + ((Q_A_Full(nsp) - Q_B_Full(nsp)) / (OutdoorCoilInletAirDryBulbTempTestA2 - OutdoorCoilInletAirDryBulbTempTestB2)) *
    2725         384 :                                     (OutdoorBinTemperatureSEER[BN] - OutdoorCoilInletAirDryBulbTempTestB2);
    2726         384 :             CoolingElecPowerMax_2023 =
    2727         768 :                 P_B_Full(nsp) + ((P_A_Full(nsp) - P_B_Full(nsp)) / (OutdoorCoilInletAirDryBulbTempTestA2 - OutdoorCoilInletAirDryBulbTempTestB2)) *
    2728         384 :                                     (OutdoorBinTemperatureSEER[BN] - OutdoorCoilInletAirDryBulbTempTestB2);
    2729             : 
    2730         384 :             Real64 q(0.0);
    2731         384 :             Real64 e(0.0);
    2732         384 :             for (spnum = 1; spnum <= nsp - 1; ++spnum) {
    2733             :                 // Equation 11.69 (AHRI-2023)
    2734         768 :                 q_low = Q_F_Low(spnum) +
    2735         768 :                         ((Q_B_Low(spnum) - Q_F_Low(spnum)) / (OutdoorCoilInletAirDryBulbTempTestB1 - OutdoorCoilInletAirDryBulbTempTestF1)) *
    2736         384 :                             (OutdoorBinTemperatureSEER[BN] - OutdoorCoilInletAirDryBulbTempTestF1);
    2737             :                 // Equation 11.70 (AHRI-2023)
    2738         768 :                 p_low = P_F_Low(spnum) +
    2739         768 :                         ((P_B_Low(spnum) - P_F_Low(spnum)) / (OutdoorCoilInletAirDryBulbTempTestB1 - OutdoorCoilInletAirDryBulbTempTestF1)) *
    2740         384 :                             (OutdoorBinTemperatureSEER[BN] - OutdoorCoilInletAirDryBulbTempTestF1);
    2741             :                 // Equation 11.71 (AHRI-2023)
    2742         768 :                 q_full = Q_B_Full(spnum + 1) + ((Q_A_Full(spnum + 1) - Q_B_Full(spnum + 1)) /
    2743         384 :                                                 (OutdoorCoilInletAirDryBulbTempTestA2 - OutdoorCoilInletAirDryBulbTempTestB2)) *
    2744         384 :                                                    (OutdoorBinTemperatureSEER[BN] - OutdoorCoilInletAirDryBulbTempTestB2);
    2745             :                 // Equation 11.72 (AHRI-2023)
    2746         768 :                 p_full = P_B_Full(spnum + 1) + ((P_A_Full(spnum + 1) - P_B_Full(spnum + 1)) /
    2747         384 :                                                 (OutdoorCoilInletAirDryBulbTempTestA2 - OutdoorCoilInletAirDryBulbTempTestB2)) *
    2748         384 :                                                    (OutdoorBinTemperatureSEER[BN] - OutdoorCoilInletAirDryBulbTempTestB2);
    2749             : 
    2750             :                 // # Intermediate Capacity
    2751         384 :                 Real64 q_A_full = Q_A_Full[spnum];
    2752         384 :                 Real64 q_B_full = Q_B_Full[spnum];
    2753         384 :                 Real64 q_B_low = Q_B_Low[spnum];
    2754         384 :                 Real64 q_F_low = Q_F_Low[spnum];
    2755         384 :                 Real64 q_E_int = Q_E_Int[spnum];
    2756             :                 // Equation 11.90 (AHRI-2023)
    2757         384 :                 Real64 q_87_low = q_F_low + (q_B_low - q_F_low) * ((OutdoorBinTemperatureSEER[BN] - 19.44 / 27.77 - 19.44));
    2758         384 :                 Real64 q_87_full = q_B_full + (q_A_full - q_B_full) * ((OutdoorBinTemperatureSEER[BN] - 19.44 / 27.77 - 19.44));
    2759             : 
    2760             :                 // Equation 11.96 (AHRI-2023)
    2761         384 :                 Real64 N_Cq = (q_E_int - q_87_low) / (q_87_full - q_87_low);
    2762             :                 // Equation 11.95 (AHRI-2023)
    2763         384 :                 Real64 M_Cq = (q_B_low - q_F_low) / (27.77 - 19.44) * (1. - N_Cq) + (q_A_full - q_B_full) / (35.0 - 27.77) * N_Cq;
    2764             : 
    2765             :                 // # Intermediate Power
    2766         384 :                 Real64 p_A_full = P_A_Full[spnum];
    2767         384 :                 Real64 p_B_full = P_B_Full[spnum];
    2768         384 :                 Real64 p_B_low = P_B_Low[spnum];
    2769         384 :                 Real64 p_F_low = P_F_Low[spnum];
    2770         384 :                 Real64 p_E_int = P_E_Int[spnum];
    2771             :                 // Equation 11.91 (AHRI-2023)
    2772         384 :                 Real64 p_87_low = p_F_low + (p_B_low - p_F_low) * ((OutdoorBinTemperatureSEER[BN] - 19.44 / 27.77 - 19.44));
    2773         384 :                 Real64 p_87_full = p_B_full + (p_A_full - p_B_full) * ((OutdoorBinTemperatureSEER[BN] - 19.44 / 27.77 - 19.44));
    2774             : 
    2775             :                 // Equation 11.99 (AHRI-2023)
    2776         384 :                 Real64 N_CE = (p_E_int - p_87_low) / (p_87_full - p_87_low);
    2777             :                 // Equaition 11.98 (AHRI-2023)
    2778         384 :                 Real64 M_CE = (p_B_low - p_F_low) / (27.77 - 19.44) * (1. - N_CE) + (p_A_full - p_B_full) / (35.0 - 27.77) * N_CE;
    2779             : 
    2780         384 :                 Real64 t = OutdoorBinTemperatureSEER[BN];
    2781         384 :                 Real64 n = CoolFracBinHoursAtOutdoorBinTemp[BN];
    2782         384 :                 Real64 bl = BuildingCoolingLoad_2023;
    2783             : 
    2784             :                 // Equation 11.94 (AHRI-2023)
    2785         384 :                 Real64 q_int = q_E_int + M_Cq * (t - 30.55);
    2786             :                 // Equation 11.97 (AHRI-2023)
    2787         384 :                 Real64 p_int = p_E_int + M_CE * (t - 30.55);
    2788         384 :                 Real64 cop_low = q_low / p_low;
    2789         384 :                 Real64 cop_int = q_int / p_int;
    2790         384 :                 Real64 cop_full = q_full / p_full;
    2791             : 
    2792             :                 // Section 11.2.1.3.1 CASE 1 - Building load is no greater than unit capacity at low speed.
    2793         384 :                 if (bl <= q_low) {
    2794         163 :                     Real64 clf_low = bl / q_low;                                     // Equation 11.75 (AHRI-2023)
    2795         163 :                     Real64 plf_low = 1.0 - CyclicDegradationCoeff * (1.0 - clf_low); // Equation 11.76 (AHRI-2023)
    2796         163 :                     q = clf_low * q_low * n;                                         // Equation 11.73 (AHRI-2023)
    2797         163 :                     e = clf_low * p_low * n / plf_low;                               // Equation 11.74 (AHRI-2023)
    2798             : 
    2799         163 :                     NetTotCoolCapBinned_2023 = clf_low * q_low * CoolFracBinHoursAtOutdoorBinTemp[BN];
    2800         163 :                     PartLoadFactorUser_2023 = Curve::CurveValue(state, PLFFPLRCurveIndex(spnum), clf_low);
    2801         163 :                     TotCoolElecPowerBinned_2023 = (clf_low / PartLoadFactorUser_2023) * p_low * CoolFracBinHoursAtOutdoorBinTemp[BN];
    2802         163 :                     goto SpeedLoop3_exit;
    2803         221 :                 } else if (bl < q_int) {
    2804             :                     // Section 11.2.1.3.2 CASE 2 - Building load can be matched by modulating the compressor speed between low speed & full Speed
    2805         145 :                     Real64 LoadFactorQEnt_2023 = min(1.0, (Q_E_Int(spnum) - q_low) / (q_full - q_low));
    2806         145 :                     LoadFactorQEnt_2023 = max(0.0, LoadFactorQEnt_2023);
    2807         145 :                     Real64 LoadFactorPEnt_2023 = min(1.0, (P_E_Int(spnum) - p_low) / (p_full - p_low));
    2808         145 :                     LoadFactorPEnt_2023 = max(0.0, LoadFactorPEnt_2023);
    2809         145 :                     NetTotCoolCapBinned_2023 = LoadFactorQEnt_2023 * q_full + (1.0 - LoadFactorQEnt_2023) * q_low;
    2810         145 :                     TotCoolElecPowerBinned_2023 = LoadFactorPEnt_2023 * p_full + (1.0 - LoadFactorPEnt_2023) * p_low;
    2811             : 
    2812             :                     // Low Speed
    2813         145 :                     Real64 cop_int_bin = cop_low + (cop_int - cop_low) / (q_int - q_low) * (bl - q_low); // Equation 11.101 (AHRI-2023)
    2814         145 :                     q = bl * n;                                                                          // 11.92 --> n is missing in the print ?
    2815         145 :                     e = q / cop_int_bin;                                                                 // 11.93 --> adjusted to 11.101
    2816         145 :                     goto SpeedLoop3_exit;
    2817          76 :                 } else if (bl <= q_full) {
    2818             :                     // Section 11.2.1.3.2 CASE 2 - Building load can be matched by modulating the compressor speed between low speed & full Speed
    2819           8 :                     Real64 LoadFactorQEnt_2023 = min(1.0, (Q_E_Int(spnum) - q_low) / (q_full - q_low));
    2820           8 :                     LoadFactorQEnt_2023 = max(0.0, LoadFactorQEnt_2023);
    2821           8 :                     Real64 LoadFactorPEnt_2023 = min(1.0, (P_E_Int(spnum) - p_low) / (p_full - p_low));
    2822           8 :                     LoadFactorPEnt_2023 = max(0.0, LoadFactorPEnt_2023);
    2823           8 :                     NetTotCoolCapBinned_2023 = LoadFactorQEnt_2023 * q_full + (1.0 - LoadFactorQEnt_2023) * q_low;
    2824           8 :                     TotCoolElecPowerBinned_2023 = LoadFactorPEnt_2023 * p_full + (1.0 - LoadFactorPEnt_2023) * p_low;
    2825             : 
    2826             :                     // Full Speed
    2827           8 :                     Real64 cop_int_bin = cop_int + (cop_full - cop_int) / (q_full - q_int) * (bl - q_int); // Equation 11.102 (AHRI-2023)
    2828           8 :                     q = bl * n;                                                                            // 11.92 --> n is missing in the print ?
    2829           8 :                     e = q / cop_int_bin;                                                                   // 11.93 --> adjusted to 11.102
    2830           8 :                     goto SpeedLoop3_exit;
    2831             :                 } else { // bl >= q_full
    2832             :                     // Section 11.2.1.3.3 CASE 3 - Building load is equal to or greater than unit capacity at full stage
    2833          68 :                     NetTotCoolCapBinned_2023 = CoolingCapacityMax_2023 * CoolFracBinHoursAtOutdoorBinTemp[BN];
    2834          68 :                     TotCoolElecPowerBinned_2023 = CoolingElecPowerMax_2023 * CoolFracBinHoursAtOutdoorBinTemp[BN];
    2835             : 
    2836          68 :                     q = q_full * n; // Equation 11.88 (AHRI-2023)
    2837          68 :                     e = p_full * n; // Equation 11.89 (AHRI-2023)
    2838          68 :                     goto SpeedLoop3_exit;
    2839             :                 }
    2840             :             }
    2841         384 :         SpeedLoop3_exit:;
    2842         384 :             NetCoolingCapWeighted2_2023 += NetTotCoolCapBinned_2023;
    2843         384 :             TotCoolingElecPowerWeighted2_2023 += TotCoolElecPowerBinned_2023;
    2844         384 :             q_sum += q;
    2845         384 :             e_sum += e;
    2846             :         }
    2847          48 :         SEER2_User = 0.0;
    2848          48 :         SEER2_Standard = 0.0;
    2849          48 :         if (e_sum > 0.0) {
    2850          48 :             SEER2_User = NetCoolingCapWeighted2_2023 / TotCoolingElecPowerWeighted2_2023;
    2851          48 :             SEER2_Standard = q_sum / e_sum; // Equation 11.66 (AHRI-2023)
    2852             :         }
    2853             : 
    2854          96 :         return std::make_tuple(NetCoolingCapRatedMaxSpeed2023, SEER2_User, SEER2_Standard);
    2855             :     }
    2856             : 
    2857          48 :     std::map<std::string, Real64> MultiSpeedDXCoolingCoilStandardRatings(
    2858             :         EnergyPlusData &state,
    2859             :         Array1A_int const CapFTempCurveIndex,                           // Index for the capacity as a function of temperature modifier curve
    2860             :         Array1A_int const CapFFlowCurveIndex,                           // Index for the capacity as a function of flow fraction modifier curve
    2861             :         Array1A_int const EIRFTempCurveIndex,                           // Index for the EIR as a function of temperature modifier curve
    2862             :         Array1A_int const EIRFFlowCurveIndex,                           // Index for the EIR as a function of flow fraction modifier curve
    2863             :         Array1A_int const PLFFPLRCurveIndex,                            // Index for the PLF vs part-load ratio curve
    2864             :         Array1A<Real64> const RatedTotalCapacity,                       // Reference capacity of DX coil [W]
    2865             :         Array1A<Real64> const RatedCOP,                                 // Reference coefficient of performance [W/W]
    2866             :         Array1A<Real64> const RatedAirVolFlowRate,                      // Reference air flow rate of DX coil [m3/s]
    2867             :         Array1A<Real64> const FanPowerPerEvapAirFlowRateFromInput,      // 2017 rated fan power per evap air flow rate [W/(m3/s)]
    2868             :         Array1A<Real64> const FanPowerPerEvapAirFlowRateFromInput_2023, // 2023 rated fan power per evap air flow rate [W/(m3/s)]
    2869             :         int const nsp                                                   // Number of compressor speeds
    2870             :     )
    2871             :     {
    2872             : 
    2873             :         // SUBROUTINE INFORMATION:
    2874             :         //       AUTHOR         B. Nigusse, FSEC
    2875             :         //       DATE WRITTEN   December 2012
    2876             :         //       MODIFIED
    2877             :         //       RE-ENGINEERED  na
    2878             : 
    2879             :         // PURPOSE OF THIS SUBROUTINE:
    2880             :         // Calculates the standard ratings net cooling capacity and SEER values for multi speed DX cooling coils
    2881             :         // at the AHRI standard test condition(s).
    2882             : 
    2883             :         // METHODOLOGY EMPLOYED:
    2884             :         // na
    2885             : 
    2886             :         // REFERENCES:
    2887             :         // na
    2888             : 
    2889             :         // Using/Aliasing
    2890             :         using Curve::CurveValue;
    2891             : 
    2892             :         // Argument array dimensioning
    2893          48 :         CapFTempCurveIndex.dim(nsp);
    2894          48 :         CapFFlowCurveIndex.dim(nsp);
    2895          48 :         EIRFTempCurveIndex.dim(nsp);
    2896          48 :         EIRFFlowCurveIndex.dim(nsp);
    2897          48 :         PLFFPLRCurveIndex.dim(nsp);
    2898          48 :         RatedTotalCapacity.dim(nsp);
    2899          48 :         RatedCOP.dim(nsp);
    2900          48 :         RatedAirVolFlowRate.dim(nsp);
    2901          48 :         FanPowerPerEvapAirFlowRateFromInput.dim(nsp);
    2902             : 
    2903             :         // Locals
    2904             :         // SUBROUTINE ARGUMENT DEFINITIONS:
    2905             : 
    2906             :         // SUBROUTINE PARAMETER DEFINITIONS:
    2907             :         // CHARACTER(len=*), PARAMETER    :: RoutineName='MultiSpeedDXCoolingCoilStandardRatings: ' ! Include trailing blank space
    2908             :         // INTERFACE BLOCK SPECIFICATIONS
    2909             :         // na
    2910             : 
    2911             :         // DERIVED TYPE DEFINITIONS
    2912             :         // na
    2913             : 
    2914             :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    2915             : 
    2916             :         // Intermediate values calculated from the inputs in the idf file
    2917             : 
    2918          48 :         Real64 NetCoolingCapRatedMaxSpeed(0.0); // net cooling capacity at maximum speed
    2919          48 :         Real64 SEER_User(0.0);     // seasonal energy efficiency ratio of multi speed DX cooling coil, from user-input PLF curve and C_D value
    2920          48 :         Real64 SEER_Standard(0.0); // seasonal energy efficiency ratio of multi speed DX cooling coil, from AHRI Std 210/240-2008 default PLF
    2921             :                                    // curve and
    2922             :                                    // C_D value
    2923             : 
    2924             :         // Ratings Based on ANSI/AHRI 210/140
    2925          48 :         Real64 NetCoolingCapRatedMaxSpeed2023(0.0); // net cooling capacity at maximum speed
    2926          48 :         Real64 SEER2_User(0.0);     // seasonal energy efficiency ratio of multi speed DX cooling coil, from user-input PLF curve and C_D value
    2927          48 :         Real64 SEER2_Standard(0.0); // seasonal energy efficiency ratio of multi speed DX cooling coil, from AHRI Std 210/240-2008 default PLF
    2928             :                                     // curve and
    2929             :                                     // C_D value
    2930             : 
    2931          48 :         std::map<std::string, Real64> StandardRatingsResult;
    2932             :         // StandardRatingsResult["NetCoolingCapRatedMaxSpeed"] = NetCoolingCapRatedMaxSpeed;
    2933             :         // StandardRatingsResult["SEER_User"] = SEER_User;
    2934             :         // StandardRatingsResult["SEER_Standard"] = SEER_Standard;
    2935             :         // StandardRatingsResult["NetCoolingCapRatedMaxSpeed2023"] = NetCoolingCapRatedMaxSpeed2023;
    2936             :         // StandardRatingsResult["SEER2_User"] = SEER2_User;
    2937             :         // StandardRatingsResult["SEER2_Standard"] = SEER2_Standard;
    2938             : 
    2939          96 :         std::tie(NetCoolingCapRatedMaxSpeed, SEER_User, SEER_Standard) = MultiSpeedDXCoolingCoilSEER(state,
    2940             :                                                                                                      nsp,
    2941             :                                                                                                      CapFFlowCurveIndex,
    2942             :                                                                                                      RatedTotalCapacity,
    2943             :                                                                                                      CapFTempCurveIndex,
    2944             :                                                                                                      FanPowerPerEvapAirFlowRateFromInput,
    2945             :                                                                                                      RatedAirVolFlowRate,
    2946             :                                                                                                      EIRFFlowCurveIndex,
    2947             :                                                                                                      RatedCOP,
    2948             :                                                                                                      EIRFTempCurveIndex,
    2949          48 :                                                                                                      PLFFPLRCurveIndex);
    2950             : 
    2951             :         // SEER2 Calculations ANSI/AHRI 210/240 Standard 2023
    2952          96 :         std::tie(NetCoolingCapRatedMaxSpeed2023, SEER2_User, SEER2_Standard) = MultiSpeedDXCoolingCoilSEER2(state,
    2953             :                                                                                                             nsp,
    2954             :                                                                                                             CapFFlowCurveIndex,
    2955             :                                                                                                             RatedTotalCapacity,
    2956             :                                                                                                             CapFTempCurveIndex,
    2957             :                                                                                                             FanPowerPerEvapAirFlowRateFromInput_2023,
    2958             :                                                                                                             RatedAirVolFlowRate,
    2959             :                                                                                                             EIRFFlowCurveIndex,
    2960             :                                                                                                             RatedCOP,
    2961             :                                                                                                             EIRFTempCurveIndex,
    2962          48 :                                                                                                             PLFFPLRCurveIndex);
    2963             : 
    2964          48 :         StandardRatingsResult["NetCoolingCapRatedMaxSpeed"] = NetCoolingCapRatedMaxSpeed;
    2965          48 :         StandardRatingsResult["SEER_User"] = SEER_User;
    2966          48 :         StandardRatingsResult["SEER_Standard"] = SEER_Standard;
    2967             : 
    2968          48 :         StandardRatingsResult["NetCoolingCapRatedMaxSpeed2023"] = NetCoolingCapRatedMaxSpeed2023;
    2969          48 :         StandardRatingsResult["SEER2_User"] = SEER2_User;
    2970          48 :         StandardRatingsResult["SEER2_Standard"] = SEER2_Standard;
    2971          48 :         return StandardRatingsResult;
    2972             :     }
    2973             : 
    2974             :     std::tuple<Real64, Real64, Real64>
    2975          20 :     MultiSpedDXHeatingCoilHSPF(EnergyPlusData &state,
    2976             :                                int const nsp,                                           // Number of compressor speed
    2977             :                                Array1A<Real64> const MSFanPowerPerEvapAirFlowRateInput, // 2017 rated fan power per evap air flow rate [W/(m3/s)]
    2978             :                                Array1A_int const CapFTempCurveIndex,           // Index for the capacity as a function of temperature modifier curve
    2979             :                                Array1A_int const CapFFlowCurveIndex,           // Index for the capacity as a function of flow fraction modifier curve
    2980             :                                Array1A<Real64> const RatedTotalCapacity,       // Reference capacity of DX coil [W]
    2981             :                                Array1A<Real64> const RatedAirVolFlowRate,      // Reference air flow rate of DX coil [m3/s]
    2982             :                                Array1A_int const EIRFFlowCurveIndex,           // Index for the EIR as a function of flow fraction modifier curve
    2983             :                                Array1A_int const EIRFTempCurveIndex,           // Index for the EIR as a function of temperature modifier curve
    2984             :                                Array1A<Real64> const RatedCOP,                 // Reference coefficient of performance [W/W]
    2985             :                                Optional_int_const RegionNum,                   // Region number for calculating HSPF of single speed DX heating coil
    2986             :                                Optional<Real64 const> MinOATCompressor,        // Minimum OAT for heat pump compressor operation [C]
    2987             :                                Optional<Real64 const> OATempCompressorOn,      // The outdoor temperature when the compressor is automatically turned
    2988             :                                Optional_bool_const OATempCompressorOnOffBlank, // Flag used to determine low temperature cut out factor
    2989             :                                Optional<HPdefrostControl const> DefrostControl) // defrost control; 1=timed, 2=on-demand
    2990             :     {
    2991             : 
    2992             :         // Intermediate values calculated from the inputs in the idf file
    2993          20 :         Real64 HSPF(0.0);
    2994          20 :         Real64 NetHeatingCapRatedHighTemp(0.0);
    2995          20 :         Real64 NetHeatingCapRatedLowTemp(0.0);
    2996             : 
    2997             :         int BinNum;         // bin number counter
    2998             :         int spnum;          // compressor speed number
    2999             :         int StandardDHRNum; // Integer counter for standardized DHRs
    3000             : 
    3001          40 :         Array1D<Real64> FanPowerPerEvapAirFlowRate(nsp); // Fan power per air volume flow rate through the evaporator coil [W/(m3/s)]
    3002          40 :         Array1D<Real64> TotHeatCapTestH0(nsp);           // Total cooling capacity at A2 test condition (High speed)
    3003          40 :         Array1D<Real64> TotHeatCapTestH1(nsp);           // Total cooling capacity at B2 test condition (High speed)
    3004          40 :         Array1D<Real64> TotHeatCapTestH2(nsp);           // Total cooling capacity at B1 test condition (Low speed)
    3005          40 :         Array1D<Real64> TotHeatCapTestH3(nsp);           // Total cooling capacity at F1 test condition (Low speed)
    3006          40 :         Array1D<Real64> OutdoorUnitPowerTestH0(nsp);     // Outdoor Unit electric power at A2 test condition (High speed)
    3007          40 :         Array1D<Real64> OutdoorUnitPowerTestH1(nsp);     // Outdoor Unit electric power at B2 test condition (High speed)
    3008          40 :         Array1D<Real64> OutdoorUnitPowerTestH2(nsp);     // Outdoor Unit electric power at B1 test condition (Low speed)
    3009          40 :         Array1D<Real64> OutdoorUnitPowerTestH3(nsp);     // Outdoor Unit electric power at F1 test condition (Low speed)
    3010             :         Real64 HeatingCapacityLS;                        // cooling capacity of Mult-speed DX coil at lower speed, [W]
    3011             :         Real64 HeatingCapacityHS;                        // cooling capacity of Mult-speed DX coil at higher speed, [W]
    3012             :         Real64 HeatingElecPowerLS;                       // outdoor unit electric power input at low speed, [W]
    3013             :         Real64 HeatingElecPowerHS;                       // outdoor unit electric power input at high speed, [W]
    3014             :         Real64 HeatingCapacityMax;                       // cooling capacity of Mult-speed DX coil at max speed, [W]
    3015             :         Real64 HeatingElecPowerMax;                      // outdoor unit electric power input at Max speed, [W]
    3016          40 :         Array1D<Real64> TotHeatCapTestH1High(nsp);       // net heating capacity high speed at H1 test conditon, [W]
    3017             : 
    3018             :         // Intermediate values calculated from the inputs in the idf file
    3019          40 :         Array1D<Real64> TotCapFlowModFac(nsp); // Total capacity modifier f(actual flow vs rated flow) for each speed [-]
    3020          40 :         Array1D<Real64> EIRFlowModFac(nsp);    // EIR modifier f(actual supply air flow vs rated flow) for each speed [-]
    3021             : 
    3022          20 :         Real64 TotCapTempModFacH0(0.0); // Tot capacity modifier (function of entering wetbulb, outside drybulb) at H0 Test [-]
    3023          20 :         Real64 EIRTempModFacH0(0.0);    // EIR modifier (function of entering wetbulb, outside drybulb)  at H0 Test[-]
    3024          20 :         Real64 TotCapTempModFacH1(0.0); // Tot capacity modifier (function of entering wetbulb, outside drybulb) at H1 Test [-]
    3025          20 :         Real64 EIRTempModFacH1(0.0);    // EIR modifier (function of entering wetbulb, outside drybulb)  at H1 Test[-]
    3026          20 :         Real64 TotCapTempModFacH2(0.0); // Tot capacity modifier (function of entering wetbulb, outside drybulb) at H2 Test [-]
    3027          20 :         Real64 EIRTempModFacH2(0.0);    // EIR modifier (function of entering wetbulb, outside drybulb)  at H2 Test[-]
    3028          20 :         Real64 TotCapTempModFacH3(0.0); // Tot capacity modifier (function of entering wetbulb, outside drybulb) at H3 Test [-]
    3029          20 :         Real64 EIRTempModFacH3(0.0);    // EIR modifier (function of entering wetbulb, outside drybulb)  at H3 Test[-]
    3030             : 
    3031          20 :         Real64 OATempCompressorOff(0.0); // Minimum outdoor air temperature to turn the commpressor off
    3032          20 :         Real64 PartLoadRatio(0.0);       // compressor cycling ratio between successive speeds, [-]
    3033          20 :         Real64 PartLoadFraction(0.0);    // part-load fraction that account for the cyclic degradation, [-]
    3034             : 
    3035          20 :         Real64 NetHeatingCapWeighted(0.0);       // net total heating cap weighted by the fraction of the binned cooling hours [W]
    3036          20 :         Real64 TotHeatingElecPowerWeighted(0.0); // net total heat pump and resistance heating electric Energy input weighted by
    3037             :         // the fraction of the binned cooling hours
    3038          20 :         Real64 BuildingHeatingLoad(0.0);      // Building space heating load corresponding to an outdoor bin temperature [W]
    3039          20 :         Real64 NetTotHeatCapBinned(0.0);      // Net tot heatinging cap corresponding to an outdoor bin temperature [W]
    3040          20 :         Real64 TotHeatElecPowerBinnedHP(0.0); // Total Heat Pump heating electric power consumption at outdoor bin temp [W]
    3041          20 :         Real64 TotHeatElecPowerBinnedRH(0.0); // Total Resistance heating electric power consumption at outdoor bin temp [W]
    3042             : 
    3043             :         Real64 LoadFactor;               // Fractional "on" time for last stage at the desired reduced capacity, (dimensionless)
    3044          20 :         Real64 LowTempCutOutFactor(0.0); // Factor which corresponds to compressor operation depending on outdoor temperature
    3045             : 
    3046          20 :         Real64 FractionalBinHours(0.0);       // Fractional bin hours for the heating season  [-]
    3047          20 :         Real64 DemandDeforstCredit(1.0);      // A factor to adjust HSPF if coil has demand defrost control  [-]
    3048          20 :         Real64 DesignHeatingRequirement(0.0); // The amount of heating required to maintain a given indoor temperature
    3049             :         // at a particular outdoor design temperature.  [W]
    3050          20 :         Real64 DesignHeatingRequirementMin(0.0); // minimum design heating requirement [W]
    3051          20 :         Real64 DesignHeatingRequirementMax(0.0); // maximum design heating requirement [W]
    3052             : 
    3053          20 :         NetHeatingCapWeighted = 0.0;
    3054          20 :         TotHeatingElecPowerWeighted = 0.0;
    3055             : 
    3056          82 :         for (spnum = 1; spnum <= nsp; ++spnum) {
    3057          62 :             FanPowerPerEvapAirFlowRate(spnum) = 0.0;
    3058          62 :             if (MSFanPowerPerEvapAirFlowRateInput(spnum) <= 0.0) {
    3059           0 :                 FanPowerPerEvapAirFlowRate(spnum) = DefaultFanPowerPerEvapAirFlowRate;
    3060             :             } else {
    3061          62 :                 FanPowerPerEvapAirFlowRate(spnum) = MSFanPowerPerEvapAirFlowRateInput(spnum);
    3062             :             }
    3063             :         }
    3064             : 
    3065             :         // Proceed withe HSPF value calculation
    3066          82 :         for (spnum = 1; spnum <= nsp; ++spnum) {
    3067          62 :             TotCapFlowModFac(spnum) = Curve::CurveValue(state, CapFFlowCurveIndex(spnum), AirMassFlowRatioRated);
    3068             :             {
    3069          62 :                 if (state.dataCurveManager->PerfCurve(CapFTempCurveIndex(spnum)).numDims == 1) {
    3070          44 :                     TotCapTempModFacH0 = Curve::CurveValue(state, CapFTempCurveIndex(spnum), HeatingOutdoorCoilInletAirDBTempH0Test);
    3071          44 :                     TotCapTempModFacH1 = Curve::CurveValue(state, CapFTempCurveIndex(spnum), HeatingOutdoorCoilInletAirDBTempRated);
    3072          44 :                     TotCapTempModFacH2 = Curve::CurveValue(state, CapFTempCurveIndex(spnum), HeatingOutdoorCoilInletAirDBTempH2Test);
    3073          44 :                     TotCapTempModFacH3 = Curve::CurveValue(state, CapFTempCurveIndex(spnum), HeatingOutdoorCoilInletAirDBTempH3Test);
    3074             :                 } else {
    3075          36 :                     TotCapTempModFacH0 = Curve::CurveValue(
    3076          18 :                         state, CapFTempCurveIndex(spnum), HeatingIndoorCoilInletAirDBTempRated, HeatingOutdoorCoilInletAirDBTempH0Test);
    3077          36 :                     TotCapTempModFacH1 = Curve::CurveValue(
    3078          18 :                         state, CapFTempCurveIndex(spnum), HeatingIndoorCoilInletAirDBTempRated, HeatingOutdoorCoilInletAirDBTempRated);
    3079          36 :                     TotCapTempModFacH2 = Curve::CurveValue(
    3080          18 :                         state, CapFTempCurveIndex(spnum), HeatingIndoorCoilInletAirDBTempRated, HeatingOutdoorCoilInletAirDBTempH2Test);
    3081          36 :                     TotCapTempModFacH3 = Curve::CurveValue(
    3082          18 :                         state, CapFTempCurveIndex(spnum), HeatingIndoorCoilInletAirDBTempRated, HeatingOutdoorCoilInletAirDBTempH3Test);
    3083             :                 }
    3084             :             }
    3085             : 
    3086         124 :             TotHeatCapTestH0(spnum) = RatedTotalCapacity(spnum) * TotCapTempModFacH0 * TotCapFlowModFac(spnum) +
    3087          62 :                                       FanPowerPerEvapAirFlowRate(spnum) * RatedAirVolFlowRate(spnum);
    3088         124 :             TotHeatCapTestH1(spnum) = RatedTotalCapacity(spnum) * TotCapTempModFacH1 * TotCapFlowModFac(spnum) +
    3089          62 :                                       FanPowerPerEvapAirFlowRate(spnum) * RatedAirVolFlowRate(spnum);
    3090         124 :             TotHeatCapTestH2(spnum) = RatedTotalCapacity(spnum) * TotCapTempModFacH2 * TotCapFlowModFac(spnum) +
    3091          62 :                                       FanPowerPerEvapAirFlowRate(spnum) * RatedAirVolFlowRate(spnum);
    3092         124 :             TotHeatCapTestH3(spnum) = RatedTotalCapacity(spnum) * TotCapTempModFacH3 * TotCapFlowModFac(spnum) +
    3093          62 :                                       FanPowerPerEvapAirFlowRate(spnum) * RatedAirVolFlowRate(spnum);
    3094             : 
    3095          62 :             EIRFlowModFac(spnum) = Curve::CurveValue(state, EIRFFlowCurveIndex(spnum), AirMassFlowRatioRated);
    3096             : 
    3097             :             {
    3098          62 :                 if (state.dataCurveManager->PerfCurve(EIRFTempCurveIndex(spnum)).numDims == 1) {
    3099          44 :                     EIRTempModFacH0 = Curve::CurveValue(state, EIRFTempCurveIndex(spnum), HeatingOutdoorCoilInletAirDBTempH0Test);
    3100          44 :                     EIRTempModFacH1 = Curve::CurveValue(state, EIRFTempCurveIndex(spnum), HeatingOutdoorCoilInletAirDBTempRated);
    3101          44 :                     EIRTempModFacH2 = Curve::CurveValue(state, EIRFTempCurveIndex(spnum), HeatingOutdoorCoilInletAirDBTempH2Test);
    3102          44 :                     EIRTempModFacH3 = Curve::CurveValue(state, EIRFTempCurveIndex(spnum), HeatingOutdoorCoilInletAirDBTempH3Test);
    3103             :                 } else {
    3104          36 :                     EIRTempModFacH0 = Curve::CurveValue(
    3105          18 :                         state, EIRFTempCurveIndex(spnum), HeatingIndoorCoilInletAirDBTempRated, HeatingOutdoorCoilInletAirDBTempH0Test);
    3106          36 :                     EIRTempModFacH1 = Curve::CurveValue(
    3107          18 :                         state, EIRFTempCurveIndex(spnum), HeatingIndoorCoilInletAirDBTempRated, HeatingOutdoorCoilInletAirDBTempRated);
    3108          36 :                     EIRTempModFacH2 = Curve::CurveValue(
    3109          18 :                         state, EIRFTempCurveIndex(spnum), HeatingIndoorCoilInletAirDBTempRated, HeatingOutdoorCoilInletAirDBTempH2Test);
    3110          36 :                     EIRTempModFacH3 = Curve::CurveValue(
    3111          18 :                         state, EIRFTempCurveIndex(spnum), HeatingIndoorCoilInletAirDBTempRated, HeatingOutdoorCoilInletAirDBTempH3Test);
    3112             :                 }
    3113             :             }
    3114          62 :             if (RatedCOP(spnum) > 0.0) {
    3115         124 :                 OutdoorUnitPowerTestH0(spnum) = TotHeatCapTestH0(spnum) * EIRFlowModFac(spnum) * EIRTempModFacH0 / RatedCOP(spnum) +
    3116          62 :                                                 FanPowerPerEvapAirFlowRate(spnum) * RatedAirVolFlowRate(spnum);
    3117         124 :                 OutdoorUnitPowerTestH1(spnum) = TotHeatCapTestH1(spnum) * EIRFlowModFac(spnum) * EIRTempModFacH1 / RatedCOP(spnum) +
    3118          62 :                                                 FanPowerPerEvapAirFlowRate(spnum) * RatedAirVolFlowRate(spnum);
    3119         124 :                 OutdoorUnitPowerTestH2(spnum) = TotHeatCapTestH2(spnum) * EIRFlowModFac(spnum) * EIRTempModFacH2 / RatedCOP(spnum) +
    3120          62 :                                                 FanPowerPerEvapAirFlowRate(spnum) * RatedAirVolFlowRate(spnum);
    3121         124 :                 OutdoorUnitPowerTestH3(spnum) = TotHeatCapTestH3(spnum) * EIRFlowModFac(spnum) * EIRTempModFacH3 / RatedCOP(spnum) +
    3122          62 :                                                 FanPowerPerEvapAirFlowRate(spnum) * RatedAirVolFlowRate(spnum);
    3123             :             }
    3124             :         }
    3125             : 
    3126             :         // determine the HP capacity at the rated condition (AHRI H1 high speed test Condition); and determine the
    3127             :         // the building heat requirement for the user specified region
    3128          20 :         NetHeatingCapRatedHighTemp = TotHeatCapTestH1(nsp);
    3129          20 :         NetHeatingCapRatedLowTemp = TotHeatCapTestH3(nsp);
    3130             : 
    3131          20 :         if (RegionNum == 5) {
    3132           0 :             DesignHeatingRequirementMin = NetHeatingCapRatedHighTemp;
    3133           0 :             DesignHeatingRequirementMax = 2.20 * NetHeatingCapRatedHighTemp;
    3134             :         } else {
    3135          20 :             DesignHeatingRequirementMin = NetHeatingCapRatedHighTemp * (18.33 - OutdoorDesignTemperature[RegionNum - 1]) / (60.0 / 1.80);
    3136          20 :             DesignHeatingRequirementMax = 2.20 * DesignHeatingRequirementMin;
    3137             :         }
    3138             :         // Set the Design Heating Requirement to nearest standard value (From Table 18, AHRI/ANSI Std 210/240)
    3139         320 :         for (StandardDHRNum = 0; StandardDHRNum < TotalNumOfStandardDHRs - 1; ++StandardDHRNum) {
    3140         300 :             if (DesignHeatingRequirementMin < StandardDesignHeatingRequirement[0]) {
    3141             : 
    3142           0 :                 DesignHeatingRequirement = min(StandardDesignHeatingRequirement[0], DesignHeatingRequirementMax);
    3143             : 
    3144         468 :             } else if (DesignHeatingRequirementMin >= StandardDesignHeatingRequirement[StandardDHRNum] &&
    3145         168 :                        DesignHeatingRequirementMin < StandardDesignHeatingRequirement[StandardDHRNum + 1]) {
    3146          40 :                 if ((DesignHeatingRequirementMin - StandardDesignHeatingRequirement[StandardDHRNum]) >
    3147          20 :                     (StandardDesignHeatingRequirement[StandardDHRNum + 1] - DesignHeatingRequirementMin)) {
    3148             : 
    3149          13 :                     DesignHeatingRequirement = min(StandardDesignHeatingRequirement[StandardDHRNum + 1], DesignHeatingRequirementMax);
    3150             :                 } else {
    3151           7 :                     DesignHeatingRequirement = min(StandardDesignHeatingRequirement[StandardDHRNum], DesignHeatingRequirementMax);
    3152             :                 }
    3153         280 :             } else if (DesignHeatingRequirementMin >= StandardDesignHeatingRequirement[TotalNumOfStandardDHRs - 1]) {
    3154           0 :                 DesignHeatingRequirement = min(StandardDesignHeatingRequirement[StandardDHRNum], DesignHeatingRequirementMax);
    3155             :             }
    3156             :         }
    3157             :         // The minimum temperature below which the compressor is turned off
    3158          20 :         OATempCompressorOff = MinOATCompressor;
    3159             : 
    3160         320 :         for (BinNum = 0; BinNum < TotalNumOfTemperatureBins[RegionNum - 1]; ++BinNum) { // NumOfOATempBins
    3161             : 
    3162         300 :             FractionalBinHours = FracBinHoursAtOutdoorBinTemp[RegionNum - 1][BinNum];
    3163             : 
    3164             :             // Calculate the building heating load
    3165         300 :             BuildingHeatingLoad = (18.33 - OutdoorBinTemperature[BinNum]) / (18.33 - OutdoorDesignTemperature[RegionNum - 1]) * CorrectionFactor *
    3166             :                                   DesignHeatingRequirement;
    3167             : 
    3168         300 :             if ((OutdoorBinTemperature[BinNum] <= -8.33) || (OutdoorBinTemperature[BinNum] >= 7.20)) {
    3169         600 :                 HeatingCapacityMax = TotHeatCapTestH3(nsp) + ((TotHeatCapTestH1(nsp) - TotHeatCapTestH3(nsp)) *
    3170         400 :                                                               (OutdoorBinTemperature[BinNum] - HeatingOutdoorCoilInletAirDBTempH3Test) /
    3171             :                                                               (HeatingOutdoorCoilInletAirDBTempRated - HeatingOutdoorCoilInletAirDBTempH3Test));
    3172         200 :                 HeatingElecPowerMax =
    3173         400 :                     OutdoorUnitPowerTestH3(nsp) + ((OutdoorUnitPowerTestH1(nsp) - OutdoorUnitPowerTestH3(nsp)) *
    3174         400 :                                                    (OutdoorBinTemperature[BinNum] - HeatingOutdoorCoilInletAirDBTempH3Test) /
    3175             :                                                    (HeatingOutdoorCoilInletAirDBTempRated - HeatingOutdoorCoilInletAirDBTempH3Test));
    3176             :             } else {
    3177         300 :                 HeatingCapacityMax = TotHeatCapTestH3(nsp) + ((TotHeatCapTestH2(nsp) - TotHeatCapTestH3(nsp)) *
    3178         200 :                                                               (OutdoorBinTemperature[BinNum] - HeatingOutdoorCoilInletAirDBTempH3Test) /
    3179             :                                                               (HeatingOutdoorCoilInletAirDBTempH2Test - HeatingOutdoorCoilInletAirDBTempH3Test));
    3180         100 :                 HeatingElecPowerMax =
    3181         200 :                     OutdoorUnitPowerTestH3(nsp) + ((OutdoorUnitPowerTestH2(nsp) - OutdoorUnitPowerTestH3(nsp)) *
    3182         200 :                                                    (OutdoorBinTemperature[BinNum] - HeatingOutdoorCoilInletAirDBTempH3Test) /
    3183             :                                                    (HeatingOutdoorCoilInletAirDBTempH2Test - HeatingOutdoorCoilInletAirDBTempH3Test));
    3184             :             }
    3185             : 
    3186             :             // determine the speed number
    3187         349 :             for (spnum = 1; spnum <= nsp - 1; ++spnum) {
    3188             :                 // Low Speed
    3189         349 :                 if (OutdoorBinTemperature[BinNum] < -8.33) {
    3190         300 :                     HeatingCapacityLS = TotHeatCapTestH3(spnum) + ((TotHeatCapTestH1(spnum) - TotHeatCapTestH3(spnum)) *
    3191         200 :                                                                    (OutdoorBinTemperature[BinNum] - HeatingOutdoorCoilInletAirDBTempH3Test) /
    3192             :                                                                    (HeatingOutdoorCoilInletAirDBTempRated - HeatingOutdoorCoilInletAirDBTempH3Test));
    3193         100 :                     HeatingElecPowerLS =
    3194         200 :                         OutdoorUnitPowerTestH3(spnum) + ((OutdoorUnitPowerTestH1(spnum) - OutdoorUnitPowerTestH3(spnum)) *
    3195         200 :                                                          (OutdoorBinTemperature[BinNum] - HeatingOutdoorCoilInletAirDBTempH3Test) /
    3196             :                                                          (HeatingOutdoorCoilInletAirDBTempRated - HeatingOutdoorCoilInletAirDBTempH3Test));
    3197             : 
    3198         249 :                 } else if (OutdoorBinTemperature[BinNum] >= 4.44) {
    3199         300 :                     HeatingCapacityLS = TotHeatCapTestH1(spnum) + ((TotHeatCapTestH0(spnum) - TotHeatCapTestH1(spnum)) *
    3200         200 :                                                                    (OutdoorBinTemperature[BinNum] - HeatingOutdoorCoilInletAirDBTempRated) /
    3201             :                                                                    (HeatingOutdoorCoilInletAirDBTempH0Test - HeatingOutdoorCoilInletAirDBTempRated));
    3202         100 :                     HeatingElecPowerLS =
    3203         200 :                         OutdoorUnitPowerTestH1(spnum) + ((OutdoorUnitPowerTestH0(spnum) - OutdoorUnitPowerTestH1(spnum)) *
    3204         200 :                                                          (OutdoorBinTemperature[BinNum] - HeatingOutdoorCoilInletAirDBTempRated) /
    3205             :                                                          (HeatingOutdoorCoilInletAirDBTempH0Test - HeatingOutdoorCoilInletAirDBTempRated));
    3206             :                 } else {
    3207         447 :                     HeatingCapacityLS = TotHeatCapTestH3(spnum) + ((TotHeatCapTestH2(spnum) - TotHeatCapTestH3(spnum)) *
    3208         298 :                                                                    (OutdoorBinTemperature[BinNum] - HeatingOutdoorCoilInletAirDBTempH3Test) /
    3209             :                                                                    (HeatingOutdoorCoilInletAirDBTempH2Test - HeatingOutdoorCoilInletAirDBTempH3Test));
    3210         149 :                     HeatingElecPowerLS =
    3211         298 :                         OutdoorUnitPowerTestH3(spnum) + ((OutdoorUnitPowerTestH2(spnum) - OutdoorUnitPowerTestH3(spnum)) *
    3212         298 :                                                          (OutdoorBinTemperature[BinNum] - HeatingOutdoorCoilInletAirDBTempH3Test) /
    3213             :                                                          (HeatingOutdoorCoilInletAirDBTempH2Test - HeatingOutdoorCoilInletAirDBTempH3Test));
    3214             :                 }
    3215             :                 // High Speed
    3216         349 :                 if ((OutdoorBinTemperature[BinNum] <= -8.33) || (OutdoorBinTemperature[BinNum] >= 7.20)) {
    3217         200 :                     HeatingCapacityHS =
    3218         400 :                         TotHeatCapTestH3(spnum + 1) + ((TotHeatCapTestH1(spnum + 1) - TotHeatCapTestH3(spnum + 1)) *
    3219         400 :                                                        (OutdoorBinTemperature[BinNum] - HeatingOutdoorCoilInletAirDBTempH3Test) /
    3220             :                                                        (HeatingOutdoorCoilInletAirDBTempRated - HeatingOutdoorCoilInletAirDBTempH3Test));
    3221         200 :                     HeatingElecPowerHS =
    3222         400 :                         OutdoorUnitPowerTestH3(spnum + 1) + ((OutdoorUnitPowerTestH1(spnum + 1) - OutdoorUnitPowerTestH3(spnum + 1)) *
    3223         400 :                                                              (OutdoorBinTemperature[BinNum] - HeatingOutdoorCoilInletAirDBTempH3Test) /
    3224             :                                                              (HeatingOutdoorCoilInletAirDBTempRated - HeatingOutdoorCoilInletAirDBTempH3Test));
    3225             :                 } else {
    3226         149 :                     HeatingCapacityHS =
    3227         298 :                         TotHeatCapTestH3(spnum + 1) + ((TotHeatCapTestH2(spnum + 1) - TotHeatCapTestH3(spnum + 1)) *
    3228         298 :                                                        (OutdoorBinTemperature[BinNum] - HeatingOutdoorCoilInletAirDBTempH3Test) /
    3229             :                                                        (HeatingOutdoorCoilInletAirDBTempH2Test - HeatingOutdoorCoilInletAirDBTempH3Test));
    3230         149 :                     HeatingElecPowerHS =
    3231         298 :                         OutdoorUnitPowerTestH3(spnum + 1) + ((OutdoorUnitPowerTestH2(spnum + 1) - OutdoorUnitPowerTestH3(spnum + 1)) *
    3232         298 :                                                              (OutdoorBinTemperature[BinNum] - HeatingOutdoorCoilInletAirDBTempH3Test) /
    3233             :                                                              (HeatingOutdoorCoilInletAirDBTempH2Test - HeatingOutdoorCoilInletAirDBTempH3Test));
    3234             :                 }
    3235         349 :                 LowTempCutOutFactor = 0.0;
    3236         349 :                 if (!OATempCompressorOnOffBlank) {
    3237         114 :                     if (OutdoorBinTemperature[BinNum] <= OATempCompressorOff) {
    3238          36 :                         LowTempCutOutFactor = 0.0;
    3239          78 :                     } else if (OutdoorBinTemperature[BinNum] > OATempCompressorOff && OutdoorBinTemperature[BinNum] <= OATempCompressorOn) {
    3240          42 :                         LowTempCutOutFactor = 0.5;
    3241             :                     } else {
    3242          36 :                         LowTempCutOutFactor = 1.0;
    3243             :                     }
    3244             :                 } else {
    3245         235 :                     LowTempCutOutFactor = 1.0;
    3246             :                 }
    3247             : 
    3248         349 :                 if (BuildingHeatingLoad <= HeatingCapacityLS) {
    3249         107 :                     if (HeatingCapacityLS > 0.0) PartLoadRatio = min(1.0, BuildingHeatingLoad / HeatingCapacityLS);
    3250         107 :                     NetTotHeatCapBinned = BuildingHeatingLoad;
    3251         107 :                     PartLoadFraction = 1.0 - CyclicDegradationCoeff * (1.0 - PartLoadRatio);
    3252         107 :                     TotHeatElecPowerBinnedHP = (PartLoadRatio / PartLoadFraction) * HeatingElecPowerLS * LowTempCutOutFactor;
    3253         107 :                     TotHeatElecPowerBinnedRH = BuildingHeatingLoad * (1.0 - LowTempCutOutFactor);
    3254         107 :                     goto HeatSpeedLoop_exit;
    3255             : 
    3256         242 :                 } else if ((BuildingHeatingLoad > HeatingCapacityLS) && (BuildingHeatingLoad < HeatingCapacityHS)) {
    3257             :                     // cycle between speed "spnum" and "spnum + 1"
    3258          77 :                     LoadFactor = min(1.0, (HeatingCapacityHS - BuildingHeatingLoad) / (HeatingCapacityHS - HeatingCapacityLS));
    3259          77 :                     LoadFactor = max(0.0, LoadFactor);
    3260             : 
    3261          77 :                     NetTotHeatCapBinned = BuildingHeatingLoad;
    3262          77 :                     TotHeatElecPowerBinnedHP = LoadFactor * HeatingElecPowerLS + (1.0 - LoadFactor) * HeatingElecPowerHS;
    3263          77 :                     TotHeatElecPowerBinnedHP *= LowTempCutOutFactor;
    3264          77 :                     TotHeatElecPowerBinnedRH = BuildingHeatingLoad * (1.0 - LowTempCutOutFactor);
    3265          77 :                     goto HeatSpeedLoop_exit;
    3266             : 
    3267         165 :                 } else if (BuildingHeatingLoad >= HeatingCapacityMax) {
    3268         116 :                     NetTotHeatCapBinned = BuildingHeatingLoad;
    3269         116 :                     if (!OATempCompressorOnOffBlank && HeatingElecPowerMax > 0.0) {
    3270          36 :                         if ((OutdoorBinTemperature[BinNum] <= OATempCompressorOff) || (HeatingCapacityMax / HeatingElecPowerMax < 1.0)) {
    3271          36 :                             LowTempCutOutFactor = 0.0;
    3272           0 :                         } else if ((OutdoorBinTemperature[BinNum] > OATempCompressorOff && OutdoorBinTemperature[BinNum] <= OATempCompressorOn) &&
    3273           0 :                                    (HeatingCapacityMax / HeatingElecPowerMax > 1.0)) {
    3274           0 :                             LowTempCutOutFactor = 0.5;
    3275           0 :                         } else if ((OutdoorBinTemperature[BinNum] > OATempCompressorOn) && (HeatingCapacityMax / HeatingElecPowerMax > 1.0)) {
    3276           0 :                             LowTempCutOutFactor = 1.0;
    3277             :                         }
    3278             :                     } else {
    3279          80 :                         LowTempCutOutFactor = 1.0;
    3280             :                     }
    3281             : 
    3282         116 :                     TotHeatElecPowerBinnedHP = HeatingElecPowerMax * LowTempCutOutFactor;
    3283         116 :                     TotHeatElecPowerBinnedRH = BuildingHeatingLoad - HeatingCapacityMax * LowTempCutOutFactor;
    3284         116 :                     goto HeatSpeedLoop_exit;
    3285             :                 }
    3286             :             }
    3287           0 :         HeatSpeedLoop_exit:;
    3288             : 
    3289         300 :             NetHeatingCapWeighted += NetTotHeatCapBinned * FractionalBinHours;
    3290         300 :             TotHeatingElecPowerWeighted += (TotHeatElecPowerBinnedHP + TotHeatElecPowerBinnedRH) * FractionalBinHours;
    3291             :         }
    3292             : 
    3293          20 :         if (DefrostControl == HPdefrostControl::Timed) {
    3294          20 :             DemandDeforstCredit = 1.0; // Timed defrost control
    3295             :         } else {
    3296           0 :             DemandDeforstCredit = 1.03; // Demand defrost control
    3297             :         }
    3298             : 
    3299          20 :         if (TotHeatingElecPowerWeighted > 0.0) {
    3300          20 :             HSPF = NetHeatingCapWeighted * DemandDeforstCredit / TotHeatingElecPowerWeighted;
    3301             :         } else {
    3302           0 :             HSPF = 0.0;
    3303             :         }
    3304             : 
    3305          40 :         return std::make_tuple(NetHeatingCapRatedHighTemp, NetHeatingCapRatedLowTemp, HSPF);
    3306             :     }
    3307             : 
    3308          20 :     std::tuple<Real64, Real64, Real64> MultiSpedDXHeatingCoilHSPF2(
    3309             :         EnergyPlusData &state,
    3310             :         int const nsp,                                                // Number of compressor speed
    3311             :         Array1A<Real64> const MSFanPowerPerEvapAirFlowRateInput_2023, // 2023 rated fan power per evap air flow rate [W/(m3/s)]
    3312             :         Array1A_int const CapFTempCurveIndex,                         // Index for the capacity as a function of temperature modifier curve
    3313             :         Array1A_int const CapFFlowCurveIndex,                         // Index for the capacity as a function of flow fraction modifier curve
    3314             :         Array1A<Real64> const RatedTotalCapacity,                     // Reference capacity of DX coil [W]
    3315             :         Array1A<Real64> const RatedAirVolFlowRate,                    // Reference air flow rate of DX coil [m3/s]
    3316             :         Array1A_int const EIRFFlowCurveIndex,                         // Index for the EIR as a function of flow fraction modifier curve
    3317             :         Array1A_int const EIRFTempCurveIndex,                         // Index for the EIR as a function of temperature modifier curve
    3318             :         Array1A<Real64> const RatedCOP,                               // Reference coefficient of performance [W/W]
    3319             :         Optional_int_const RegionNum,                                 // Region number for calculating HSPF of single speed DX heating coil
    3320             :         Optional<Real64 const> MinOATCompressor,                      // Minimum OAT for heat pump compressor operation [C]
    3321             :         Optional<Real64 const> OATempCompressorOn,                    // The outdoor temperature when the compressor is automatically turned
    3322             :         Optional_bool_const OATempCompressorOnOffBlank,               // Flag used to determine low temperature cut out factor
    3323             :         Optional<HPdefrostControl const> DefrostControl)              // defrost control; 1=timed, 2=on-demand
    3324             :     {
    3325             : 
    3326             :         // Intermediate values calculated from the inputs in the idf file
    3327          20 :         Real64 HSPF2_2023(0.0);
    3328          20 :         Real64 NetHeatingCapRatedHighTemp_2023(0.0);
    3329          20 :         Real64 NetHeatingCapRatedLowTemp_2023(0.0);
    3330             : 
    3331             :         int BinNum2023; // bin number counter
    3332             :         int spnum;      // compressor speed number
    3333             : 
    3334          40 :         Array1D<Real64> FanPowerPerEvapAirFlowRate_2023(nsp); // Fan power per air volume flow rate through the evaporator coil [W/(m3/s)]
    3335             : 
    3336             :         // Real64 HeatingCapacityLS;                  // cooling capacity of Mult-speed DX coil at lower speed, [W]
    3337             :         // Real64 HeatingCapacityHS;                  // cooling capacity of Mult-speed DX coil at higher speed, [W]
    3338             :         // Real64 HeatingElecPowerLS;                 // outdoor unit electric power input at low speed, [W]
    3339             :         // Real64 HeatingElecPowerHS;                 // outdoor unit electric power input at high speed, [W]
    3340             :         // Real64 HeatingCapacityMax;                 // cooling capacity of Mult-speed DX coil at max speed, [W]
    3341             :         // Real64 HeatingElecPowerMax;                // outdoor unit electric power input at Max speed, [W]
    3342             :         // Array1D<Real64> TotHeatCapTestH1High(nsp); // net heating capacity high speed at H1 test conditon, [W]
    3343             : 
    3344             :         // Intermediate values calculated from the inputs in the idf file
    3345          40 :         Array1D<Real64> TotCapFlowModFac(nsp); // Total capacity modifier f(actual flow vs rated flow) for each speed [-]
    3346          40 :         Array1D<Real64> EIRFlowModFac(nsp);    // EIR modifier f(actual supply air flow vs rated flow) for each speed [-]
    3347             : 
    3348          20 :         Real64 TotCapTempModFacH0Low(0.0);  // Tot capacity modifier (function of entering wetbulb, outside drybulb) at H0 Low Test [-]
    3349          20 :         Real64 EIRTempModFacH0Low(0.0);     // EIR modifier (function of entering wetbulb, outside drybulb) at H0 Low Test[-]
    3350          20 :         Real64 TotCapTempModFacH1Low(0.0);  // Tot capacity modifier (function of entering wetbulb, outside drybulb) at H1 Low Test [-]
    3351          20 :         Real64 EIRTempModFacH1Low(0.0);     // EIR modifier (function of entering wetbulb, outside drybulb) at H1 Low Test[-]
    3352          20 :         Real64 TotCapTempModFacH2Int(0.0);  // Tot capacity modifier (function of entering wetbulb, outside drybulb) at H2 Int Test [-]
    3353          20 :         Real64 EIRTempModFacH2Int(0.0);     // EIR modifier (function of entering wetbulb, outside drybulb) at H2 Int Test[-]
    3354          20 :         Real64 TotCapTempModFacH1Full(0.0); // Tot capacity modifier (function of entering wetbulb, outside drybulb) at H1 Full Test [-]
    3355          20 :         Real64 EIRTempModFacH1Full(0.0);    // EIR modifier (function of entering wetbulb, outside drybulb) at H1 Full Test[-]
    3356          20 :         Real64 TotCapTempModFacH2Full(0.0); // Tot capacity modifier (function of entering wetbulb, outside drybulb) at H2 Full Test [-]
    3357          20 :         Real64 EIRTempModFacH2Full(0.0);    // EIR modifier (function of entering wetbulb, outside drybulb) at H2 Full Test[-]
    3358          20 :         Real64 TotCapTempModFacH3Full(0.0); // Tot capacity modifier (function of entering wetbulb, outside drybulb) at H3 Full Test [-]
    3359          20 :         Real64 EIRTempModFacH3Full(0.0);    // EIR modifier (function of entering wetbulb, outside drybulb) at H3 Full Test[-]
    3360          20 :         Real64 TotCapTempModFacH4Full(0.0); // Tot capacity modifier (function of entering wetbulb, outside drybulb) at H4 Full Test [-]
    3361          20 :         Real64 EIRTempModFacH4Full(0.0);    // EIR modifier (function of entering wetbulb, outside drybulb) at H4 Full Test[-]
    3362             : 
    3363          20 :         Real64 OATempCompressorOff(0.0); // Minimum outdoor air temperature to turn the commpressor off
    3364             : 
    3365          20 :         Real64 NetHeatingCapWeighted(0.0);       // net total heating cap weighted by the fraction of the binned cooling hours [W]
    3366          20 :         Real64 TotHeatingElecPowerWeighted(0.0); // net total heat pump and resistance heating electric Energy input weighted by
    3367             :         // the fraction of the binned cooling hours
    3368             : 
    3369          20 :         Real64 n(0.0);     // Fractional bin hours for the heating season  [-]
    3370          20 :         Real64 f_def(1.0); // Demand Defrost Credit, A factor to adjust HSPF if coil has demand defrost control  [-]
    3371             : 
    3372          20 :         NetHeatingCapWeighted = 0.0;
    3373          20 :         TotHeatingElecPowerWeighted = 0.0;
    3374             : 
    3375          82 :         for (spnum = 1; spnum <= nsp; ++spnum) {
    3376          62 :             FanPowerPerEvapAirFlowRate_2023(spnum) = 0.0;
    3377          62 :             if (MSFanPowerPerEvapAirFlowRateInput_2023(spnum) <= 0.0) {
    3378           0 :                 FanPowerPerEvapAirFlowRate_2023(spnum) = DefaultFanPowerPerEvapAirFlowRateSEER2;
    3379             :             } else {
    3380          62 :                 FanPowerPerEvapAirFlowRate_2023(spnum) = MSFanPowerPerEvapAirFlowRateInput_2023(spnum);
    3381             :             }
    3382             :         }
    3383             : 
    3384          20 :         Real64 HeatingOutdoorCoilInletAirDBTemp_H0LowTest = 16.66; // Outdoor air dry-bulb temp in degrees 16.66 C (62 F)
    3385          20 :         Real64 HeatingIndoorCoilInletAirDBTemp_H0LowTest = 21.11;  // Indoor air dry-bulb temp in degrees 21.11 C (70 F)
    3386             : 
    3387          20 :         Real64 HeatingOutdoorCoilInletAirDBTemp_H1LowTest = 8.33; // Outdoor air dry-bulb temp in degrees 8.33 C (47 F)
    3388          20 :         Real64 HeatingIndoorCoilInletAirDBTemp_H1LowTest = 21.11; // Indoor air dry-bulb temp in degrees 21.11 C (70 F)
    3389             : 
    3390          20 :         Real64 HeatingOutdoorCoilInletAirDBTemp_H2IntTest = 1.66; // Outdoor air dry-bulb temp in degrees 1.66 C (35 F)
    3391          20 :         Real64 HeatingIndoorCoilInletAirDBTemp_H2IntTest = 21.11; // Indoor air dry-bulb temp in degrees 21.11 C (70 F)
    3392             : 
    3393          20 :         Real64 HeatingOutdoorCoilInletAirDBTemp_H1FullTest = 8.33; // Outdoor air dry-bulb temp in degrees 8.33 C (47 F)
    3394          20 :         Real64 HeatingIndoorCoilInletAirDBTemp_H1FullTest = 21.11; // Indoor air dry-bulb temp in degrees 21.11 C (70 F)
    3395             : 
    3396          20 :         Real64 HeatingOutdoorCoilInletAirDBTemp_H2FullTest = 1.66; // Outdoor air dry-bulb temp in degrees  C (35 F)
    3397          20 :         Real64 HeatingIndoorCoilInletAirDBTemp_H2FullTest = 21.11; // Indoor air dry-bulb temp in degrees 21.11 C (70 F)
    3398             : 
    3399          20 :         Real64 HeatingOutdoorCoilInletAirDBTemp_H3FullTest = -8.33; // Outdoor air dry-bulb temp in degrees  C (17 F)
    3400          20 :         Real64 HeatingIndoorCoilInletAirDBTemp_H3FullTest = 21.11;  // Indoor air dry-bulb temp in degrees 21.11 C (70 F)
    3401             : 
    3402          20 :         Real64 HeatingOutdoorCoilInletAirDBTemp_H4FullTest = -15;  // Outdoor air dry-bulb temp in degrees  C (5 F)
    3403          20 :         Real64 HeatingIndoorCoilInletAirDBTemp_H4FullTest = 21.11; // Indoor air dry-bulb temp in degrees 21.11 C (70 F)
    3404             : 
    3405          40 :         Array1D<Real64> Q_A_Full(nsp);
    3406             : 
    3407          40 :         Array1D<Real64> Q_H0_Low(nsp);  // Total cooling capacity at H0 Low test condition (Low speed)
    3408          40 :         Array1D<Real64> Q_H1_Low(nsp);  // Total cooling capacity at H1 Low test condition (Low speed)
    3409          40 :         Array1D<Real64> Q_H2_Int(nsp);  // Total cooling capacity at H2 Int test condition
    3410          40 :         Array1D<Real64> Q_H1_Full(nsp); // Total cooling capacity at H1 Full test condition (High speed)
    3411          40 :         Array1D<Real64> Q_H2_Full(nsp); // Total cooling capacity at H2 Full test condition (High speed)
    3412          40 :         Array1D<Real64> Q_H3_Full(nsp); // Total cooling capacity at H3 Full test condition (High speed)
    3413          40 :         Array1D<Real64> Q_H4_Full(nsp); // Total cooling capacity at H4 Full test condition (High speed)
    3414             : 
    3415          40 :         Array1D<Real64> P_H0_Low(nsp);  // Outdoor Unit electric power at H0 Low test condition (Low speed)
    3416          40 :         Array1D<Real64> P_H1_Low(nsp);  // Outdoor Unit electric power at H1 Low test condition (Low speed)
    3417          40 :         Array1D<Real64> P_H2_Int(nsp);  // Outdoor Unit electric power at H2 Int test condition
    3418          40 :         Array1D<Real64> P_H1_Full(nsp); // Outdoor Unit electric power at H1 Full test condition (Full speed)
    3419          40 :         Array1D<Real64> P_H2_Full(nsp); // Outdoor Unit electric power at H2 Full test condition (Full speed)
    3420          40 :         Array1D<Real64> P_H3_Full(nsp); // Outdoor Unit electric power at H3 Full test condition (Full speed)
    3421          40 :         Array1D<Real64> P_H4_Full(nsp); // Outdoor Unit electric power at H4 Full test condition (Full speed)
    3422             : 
    3423             :         // Proceed withe HSPF2 value calculation
    3424          82 :         for (spnum = 1; spnum <= nsp; ++spnum) {
    3425          62 :             TotCapFlowModFac(spnum) = Curve::CurveValue(state, CapFFlowCurveIndex(spnum), AirMassFlowRatioRated);
    3426             : 
    3427          62 :             if (state.dataCurveManager->PerfCurve(CapFTempCurveIndex(spnum)).numDims == 1) {
    3428             : 
    3429          44 :                 TotCapTempModFacH0Low = Curve::CurveValue(state, CapFTempCurveIndex(spnum), HeatingOutdoorCoilInletAirDBTemp_H0LowTest);
    3430          44 :                 TotCapTempModFacH1Low = Curve::CurveValue(state, CapFTempCurveIndex(spnum), HeatingOutdoorCoilInletAirDBTemp_H1LowTest);
    3431          44 :                 TotCapTempModFacH2Int = Curve::CurveValue(state, CapFTempCurveIndex(spnum), HeatingOutdoorCoilInletAirDBTemp_H2IntTest);
    3432          44 :                 TotCapTempModFacH1Full = Curve::CurveValue(state, CapFTempCurveIndex(spnum), HeatingOutdoorCoilInletAirDBTemp_H1FullTest);
    3433          44 :                 TotCapTempModFacH2Full = Curve::CurveValue(state, CapFTempCurveIndex(spnum), HeatingOutdoorCoilInletAirDBTemp_H2FullTest);
    3434          44 :                 TotCapTempModFacH3Full = Curve::CurveValue(state, CapFTempCurveIndex(spnum), HeatingOutdoorCoilInletAirDBTemp_H3FullTest);
    3435          44 :                 TotCapTempModFacH4Full = Curve::CurveValue(state, CapFTempCurveIndex(spnum), HeatingOutdoorCoilInletAirDBTemp_H4FullTest);
    3436             :             } else {
    3437          36 :                 TotCapTempModFacH0Low = Curve::CurveValue(
    3438          18 :                     state, CapFTempCurveIndex(spnum), HeatingIndoorCoilInletAirDBTemp_H0LowTest, HeatingOutdoorCoilInletAirDBTemp_H0LowTest);
    3439          36 :                 TotCapTempModFacH1Low = Curve::CurveValue(
    3440          18 :                     state, CapFTempCurveIndex(spnum), HeatingIndoorCoilInletAirDBTemp_H1LowTest, HeatingOutdoorCoilInletAirDBTemp_H1LowTest);
    3441          36 :                 TotCapTempModFacH2Int = Curve::CurveValue(
    3442          18 :                     state, CapFTempCurveIndex(spnum), HeatingIndoorCoilInletAirDBTemp_H2IntTest, HeatingOutdoorCoilInletAirDBTemp_H2IntTest);
    3443          36 :                 TotCapTempModFacH1Full = Curve::CurveValue(
    3444          18 :                     state, CapFTempCurveIndex(spnum), HeatingIndoorCoilInletAirDBTemp_H1FullTest, HeatingOutdoorCoilInletAirDBTemp_H1FullTest);
    3445          36 :                 TotCapTempModFacH2Full = Curve::CurveValue(
    3446          18 :                     state, CapFTempCurveIndex(spnum), HeatingIndoorCoilInletAirDBTemp_H2FullTest, HeatingOutdoorCoilInletAirDBTemp_H2FullTest);
    3447          36 :                 TotCapTempModFacH3Full = Curve::CurveValue(
    3448          18 :                     state, CapFTempCurveIndex(spnum), HeatingIndoorCoilInletAirDBTemp_H3FullTest, HeatingOutdoorCoilInletAirDBTemp_H3FullTest);
    3449          36 :                 TotCapTempModFacH4Full = Curve::CurveValue(
    3450          18 :                     state, CapFTempCurveIndex(spnum), HeatingIndoorCoilInletAirDBTemp_H4FullTest, HeatingOutdoorCoilInletAirDBTemp_H4FullTest);
    3451             :             }
    3452             : 
    3453          62 :             Q_A_Full(spnum) =
    3454         124 :                 RatedTotalCapacity(spnum) *
    3455         186 :                     Curve::CurveValue(state, CapFTempCurveIndex(spnum), IndoorCoilInletAirWetBulbTempRated, OutdoorCoilInletAirDryBulbTempTestA2) *
    3456         124 :                     TotCapFlowModFac(spnum) -
    3457          62 :                 FanPowerPerEvapAirFlowRate_2023(spnum) * RatedAirVolFlowRate(spnum);
    3458             : 
    3459         124 :             Q_H0_Low(spnum) = RatedTotalCapacity(spnum) * TotCapTempModFacH0Low * TotCapFlowModFac(spnum) +
    3460          62 :                               FanPowerPerEvapAirFlowRate_2023(spnum) * RatedAirVolFlowRate(spnum);
    3461         124 :             Q_H1_Low(spnum) = RatedTotalCapacity(spnum) * TotCapTempModFacH1Low * TotCapFlowModFac(spnum) +
    3462          62 :                               FanPowerPerEvapAirFlowRate_2023(spnum) * RatedAirVolFlowRate(spnum);
    3463         124 :             Q_H2_Int(spnum) = RatedTotalCapacity(spnum) * TotCapTempModFacH2Int * TotCapFlowModFac(spnum) +
    3464          62 :                               FanPowerPerEvapAirFlowRate_2023(spnum) * RatedAirVolFlowRate(spnum);
    3465         124 :             Q_H1_Full(spnum) = RatedTotalCapacity(spnum) * TotCapTempModFacH1Full * TotCapFlowModFac(spnum) +
    3466          62 :                                FanPowerPerEvapAirFlowRate_2023(spnum) * RatedAirVolFlowRate(spnum);
    3467         124 :             Q_H2_Full(spnum) = RatedTotalCapacity(spnum) * TotCapTempModFacH2Full * TotCapFlowModFac(spnum) +
    3468          62 :                                FanPowerPerEvapAirFlowRate_2023(spnum) * RatedAirVolFlowRate(spnum);
    3469         124 :             Q_H3_Full(spnum) = RatedTotalCapacity(spnum) * TotCapTempModFacH3Full * TotCapFlowModFac(spnum) +
    3470          62 :                                FanPowerPerEvapAirFlowRate_2023(spnum) * RatedAirVolFlowRate(spnum);
    3471         124 :             Q_H4_Full(spnum) = RatedTotalCapacity(spnum) * TotCapTempModFacH4Full * TotCapFlowModFac(spnum) +
    3472          62 :                                FanPowerPerEvapAirFlowRate_2023(spnum) * RatedAirVolFlowRate(spnum);
    3473             : 
    3474          62 :             EIRFlowModFac(spnum) = Curve::CurveValue(state, EIRFFlowCurveIndex(spnum), AirMassFlowRatioRated);
    3475             : 
    3476          62 :             if (state.dataCurveManager->PerfCurve(EIRFTempCurveIndex(spnum)).numDims == 1) {
    3477             : 
    3478          44 :                 EIRTempModFacH0Low = Curve::CurveValue(state, EIRFTempCurveIndex(spnum), HeatingOutdoorCoilInletAirDBTemp_H0LowTest);
    3479             : 
    3480          44 :                 EIRTempModFacH1Low = Curve::CurveValue(state, EIRFTempCurveIndex(spnum), HeatingOutdoorCoilInletAirDBTemp_H1LowTest);
    3481          44 :                 EIRTempModFacH2Int = Curve::CurveValue(state, EIRFTempCurveIndex(spnum), HeatingOutdoorCoilInletAirDBTemp_H2IntTest);
    3482          44 :                 EIRTempModFacH1Full = Curve::CurveValue(state, EIRFTempCurveIndex(spnum), HeatingOutdoorCoilInletAirDBTemp_H1FullTest);
    3483          44 :                 EIRTempModFacH2Full = Curve::CurveValue(state, EIRFTempCurveIndex(spnum), HeatingOutdoorCoilInletAirDBTemp_H2FullTest);
    3484          44 :                 EIRTempModFacH3Full = Curve::CurveValue(state, EIRFTempCurveIndex(spnum), HeatingOutdoorCoilInletAirDBTemp_H3FullTest);
    3485          44 :                 EIRTempModFacH4Full = Curve::CurveValue(state, EIRFTempCurveIndex(spnum), HeatingOutdoorCoilInletAirDBTemp_H4FullTest);
    3486             : 
    3487             :             } else {
    3488             : 
    3489          36 :                 EIRTempModFacH0Low = Curve::CurveValue(
    3490          18 :                     state, EIRFTempCurveIndex(spnum), HeatingIndoorCoilInletAirDBTemp_H0LowTest, HeatingOutdoorCoilInletAirDBTemp_H0LowTest);
    3491          36 :                 EIRTempModFacH1Low = Curve::CurveValue(
    3492          18 :                     state, EIRFTempCurveIndex(spnum), HeatingIndoorCoilInletAirDBTemp_H1LowTest, HeatingOutdoorCoilInletAirDBTemp_H1LowTest);
    3493          36 :                 EIRTempModFacH2Int = Curve::CurveValue(
    3494          18 :                     state, EIRFTempCurveIndex(spnum), HeatingIndoorCoilInletAirDBTemp_H2IntTest, HeatingOutdoorCoilInletAirDBTemp_H2IntTest);
    3495          36 :                 EIRTempModFacH1Full = Curve::CurveValue(
    3496          18 :                     state, EIRFTempCurveIndex(spnum), HeatingIndoorCoilInletAirDBTemp_H1FullTest, HeatingOutdoorCoilInletAirDBTemp_H1FullTest);
    3497          36 :                 EIRTempModFacH2Full = Curve::CurveValue(
    3498          18 :                     state, EIRFTempCurveIndex(spnum), HeatingIndoorCoilInletAirDBTemp_H2FullTest, HeatingOutdoorCoilInletAirDBTemp_H2FullTest);
    3499          36 :                 EIRTempModFacH3Full = Curve::CurveValue(
    3500          18 :                     state, EIRFTempCurveIndex(spnum), HeatingIndoorCoilInletAirDBTemp_H3FullTest, HeatingOutdoorCoilInletAirDBTemp_H3FullTest);
    3501          36 :                 EIRTempModFacH4Full = Curve::CurveValue(
    3502          18 :                     state, EIRFTempCurveIndex(spnum), HeatingIndoorCoilInletAirDBTemp_H4FullTest, HeatingOutdoorCoilInletAirDBTemp_H4FullTest);
    3503             :             }
    3504             : 
    3505          62 :             if (RatedCOP(spnum) > 0.0) {
    3506             : 
    3507         124 :                 P_H0_Low(spnum) = Q_H0_Low(spnum) * EIRFlowModFac(spnum) * EIRTempModFacH0Low / RatedCOP(spnum) +
    3508          62 :                                   FanPowerPerEvapAirFlowRate_2023(spnum) * RatedAirVolFlowRate(spnum);
    3509         124 :                 P_H1_Low(spnum) = Q_H1_Low(spnum) * EIRFlowModFac(spnum) * EIRTempModFacH1Low / RatedCOP(spnum) +
    3510          62 :                                   FanPowerPerEvapAirFlowRate_2023(spnum) * RatedAirVolFlowRate(spnum);
    3511         124 :                 P_H2_Int(spnum) = Q_H2_Int(spnum) * EIRFlowModFac(spnum) * EIRTempModFacH2Int / RatedCOP(spnum) +
    3512          62 :                                   FanPowerPerEvapAirFlowRate_2023(spnum) * RatedAirVolFlowRate(spnum);
    3513         124 :                 P_H1_Full(spnum) = Q_H1_Full(spnum) * EIRFlowModFac(spnum) * EIRTempModFacH1Full / RatedCOP(spnum) +
    3514          62 :                                    FanPowerPerEvapAirFlowRate_2023(spnum) * RatedAirVolFlowRate(spnum);
    3515         124 :                 P_H2_Full(spnum) = Q_H2_Full(spnum) * EIRFlowModFac(spnum) * EIRTempModFacH2Full / RatedCOP(spnum) +
    3516          62 :                                    FanPowerPerEvapAirFlowRate_2023(spnum) * RatedAirVolFlowRate(spnum);
    3517         124 :                 P_H3_Full(spnum) = Q_H3_Full(spnum) * EIRFlowModFac(spnum) * EIRTempModFacH3Full / RatedCOP(spnum) +
    3518          62 :                                    FanPowerPerEvapAirFlowRate_2023(spnum) * RatedAirVolFlowRate(spnum);
    3519         124 :                 P_H4_Full(spnum) = Q_H4_Full(spnum) * EIRFlowModFac(spnum) * EIRTempModFacH4Full / RatedCOP(spnum) +
    3520          62 :                                    FanPowerPerEvapAirFlowRate_2023(spnum) * RatedAirVolFlowRate(spnum);
    3521             :             }
    3522             :         }
    3523             : 
    3524             :         // determine the HP capacity at the rated condition (AHRI H1 high speed test Condition); and determine the
    3525             :         // the building heat requirement for the user specified region
    3526          20 :         NetHeatingCapRatedHighTemp_2023 = Q_H1_Full(nsp);
    3527          20 :         NetHeatingCapRatedLowTemp_2023 = Q_H3_Full(nsp);
    3528             : 
    3529             :         // The minimum temperature below which the compressor is turned off
    3530          20 :         Real64 t_Off = MinOATCompressor; // Heating off | outdoor Minimum temperature below which the compressor ceases to operate
    3531             :         // The outdoor temperature when the compressor is automatically turned
    3532          20 :         Real64 t_On = OATempCompressorOn; // Heating On | outdoor temperature at which the compressor reinitiates operation
    3533             : 
    3534          20 :         Int64 RN = static_cast<int64_t>(RegionNum);
    3535             : 
    3536          20 :         Real64 q_sum(0.0);
    3537          20 :         Real64 e_sum(0.0);
    3538          20 :         Real64 rh_sum(0.0);
    3539             : 
    3540             :         // Equation 11.111 AHRI-2023
    3541          20 :         Real64 t_ob = 7.22; //  temperature at which frosting influence on full stage performance begins 7.22 C (45 F)
    3542         380 :         for (BinNum2023 = 0; BinNum2023 < 18; ++BinNum2023) { // NumOfOATempBins
    3543             : 
    3544         360 :             Real64 t = OutdoorBinTemperature[BinNum2023];
    3545         360 :             n = FracBinHoursAtOutdoorBinTempHSPF2[RN - 1][BinNum2023];
    3546         360 :             if (n == 0.0) {
    3547             :                 // we're skipping load calculations for any Temperature bin against which fractional hours are 0.0
    3548         100 :                 continue;
    3549             :             }
    3550         260 :             Real64 t_zl = ZoneLoadTemperature[RN - 1];
    3551         260 :             Real64 t_od = OutdoorDesignTemperature[RN - 1];
    3552         260 :             Real64 c_x = VariableSpeedLoadFactor[RN - 1];
    3553             : 
    3554             :             // For ANSI/AHRI 210/240 Standard 2023 | Concept of DHRI min and max is removed
    3555             :             // Section 11.2.2.1 Equation 11.104  which suggests QAFull is used instead of DHRI min
    3556             :             // While Calculaiting the Building load For heating-only heat pump units, replace Q_A_Full with Q_H_Full
    3557             :             // Q_H_Full = the heating capacity at 47F determined from the H1N test for variable capacity systems and
    3558             :             // from the H1Full test for other systems, Btu/h.
    3559         260 :             Real64 bl = (t_zl - t) / (t_zl - t_od) * c_x * Q_H1_Full(nsp);
    3560             : 
    3561         260 :             Real64 q_full(0.0);
    3562         260 :             Real64 p_full(0.0);
    3563         260 :             Real64 cop_full(0.0);
    3564             : 
    3565         260 :             Real64 delta_full(0.0);
    3566         260 :             Real64 hlf_full(0.0);
    3567         260 :             Real64 e(0.0);
    3568         260 :             Real64 rh(0.0);
    3569             : 
    3570         260 :             if (t >= t_ob) {
    3571          40 :                 q_full = Q_H3_Full(nsp) + (Q_H1_Full(nsp) - Q_H3_Full(nsp)) * ((t - (-8.33)) / (8.33 - (-8.33))); // Equation 11.112 AHRI-2023
    3572          40 :                 p_full = P_H3_Full(nsp) + (P_H1_Full(nsp) - P_H3_Full(nsp)) * ((t - (-8.33)) / (8.33 - (-8.33))); // Equation 11.117 AHRI-2023
    3573         220 :             } else if (t >= (-8.33) && t < t_ob) {
    3574         120 :                 q_full = Q_H3_Full(nsp) + (Q_H2_Full(nsp) - Q_H3_Full(nsp)) * ((t - (-8.33)) / (1.66 - (-8.33)));  // Equation 11.113 AHRI-2023
    3575         120 :                 p_full = P_H3_Full(nsp) + (P_H2_Full(nsp) - P_H3_Full(nsp)) * ((t - (-8.33)) / (1.66 - (-8.33)));  // Equation 11.118 AHRI-2023
    3576         100 :             } else if (t < (-8.33)) {                                                                              // if(t<(-8.33))
    3577         100 :                 q_full = Q_H4_Full(nsp) + (Q_H3_Full(nsp) - Q_H4_Full(nsp)) * ((t - (-8.33)) / ((-8.33) - (-15))); // Equation 11.114 AHRI-2023
    3578         100 :                 p_full = P_H4_Full(nsp) + (P_H3_Full(nsp) - P_H4_Full(nsp)) * ((t - (-8.33)) / ((-8.33) - (-15))); // Equation 11.119 AHRI-2023
    3579             :             }
    3580             : 
    3581         260 :             cop_full = q_full / p_full;
    3582             : 
    3583         260 :             if (t <= t_Off || cop_full < 1.0) {
    3584          90 :                 delta_full = 0.0; // #Equation 11.125 AHRI-2023
    3585         170 :             } else if (t > t_On) {
    3586          80 :                 delta_full = 1.0; // Equation 11.127 AHRI-2023
    3587             :             } else {
    3588          90 :                 delta_full = 0.5; // #Equation 11.126 AHRI-2023
    3589             :             }
    3590             : 
    3591         260 :             if (q_full > bl) {
    3592         129 :                 hlf_full = bl / q_full; // Equation 11.107 AHRI-2023
    3593             :             } else {
    3594         131 :                 hlf_full = 1.0; // Equation 11.108 AHRI-2023
    3595             :             }
    3596             : 
    3597         293 :             for (spnum = 1; spnum <= nsp - 1; ++spnum) {
    3598             : 
    3599             :                 // Intermediate capacity
    3600         293 :                 Real64 q_H0_low = Q_H0_Low(spnum);
    3601         293 :                 Real64 q_H1_low = Q_H1_Low(spnum);
    3602         293 :                 Real64 q_H2_int = Q_H2_Int(spnum);
    3603         293 :                 Real64 q_H1_full = Q_H1_Full(spnum);
    3604         293 :                 Real64 q_H2_full = Q_H2_Full(spnum);
    3605         293 :                 Real64 q_H3_full = Q_H3_Full(spnum);
    3606         293 :                 Real64 q_H4_full = Q_H4_Full(spnum);
    3607             :                 // Equation 11.177 AHRI-2023
    3608             :                 //?? (replaced 62 with 35) in Ratio expression // (t=>35-47/62-47)
    3609         293 :                 Real64 q_35_low = // q_H1_low + (q_H0_low - q_H1_low) * ((t - (8.33)) / (1.66 - (8.33)));
    3610         293 :                     q_H1_low + (q_H0_low - q_H1_low) * ((1.67 - (8.33)) / (16.67 - (8.33)));
    3611             : 
    3612             :                 // Equation 11.191 AHRI-2023
    3613         293 :                 Real64 N_Hq = min(1.0, (q_H2_int - q_35_low) / (q_H2_full - q_35_low));
    3614         293 :                 N_Hq = max(0.0, N_Hq);
    3615             :                 // Equation 11.190 AHRI-2023
    3616         293 :                 Real64 M_Hq = (q_H0_low - q_H1_low) / (16.66 - 8.33) * (1.0 - N_Hq) + (q_H2_full - q_H3_full) / (1.66 - (-8.33)) * N_Hq;
    3617             : 
    3618             :                 // Intermediate Power
    3619         293 :                 Real64 p_H0_low = P_H0_Low(spnum);
    3620         293 :                 Real64 p_H1_low = P_H1_Low(spnum);
    3621         293 :                 Real64 p_H2_int = P_H2_Int(spnum);
    3622         293 :                 Real64 p_H1_full = P_H1_Full(spnum);
    3623         293 :                 Real64 p_H2_full = P_H2_Full(spnum);
    3624         293 :                 Real64 p_H3_full = P_H3_Full(spnum);
    3625         293 :                 Real64 p_H4_full = P_H4_Full(spnum);
    3626             :                 // Equation 11.178 AHRI - 2023
    3627             :                 //?? (replaced 62 with 35) in Ratio expression (t=>35 F-47/35-47)
    3628         293 :                 Real64 p_35_low = // p_H1_low + (p_H0_low - p_H1_low) * ((t - (8.33)) / (1.66 - (8.33)));
    3629         293 :                     p_H1_low + (p_H0_low - p_H1_low) * ((1.67 - (8.33)) / (16.67 - (8.33)));
    3630             : 
    3631             :                 // Equation 11.194 AHRI-2023
    3632         293 :                 Real64 N_HE = min(1.0, (p_H2_int - p_35_low) / (p_H2_full - p_35_low));
    3633         293 :                 N_HE = max(0.0, N_HE);
    3634             : 
    3635             :                 // Equation 11.193 AHRI-2023
    3636         293 :                 Real64 M_HE = (p_H0_low - p_H1_low) / (16.66 - 8.33) * (1.0 - N_HE) + (p_H2_full - p_H3_full) / (1.66 - (-8.33)) * N_HE;
    3637             : 
    3638             :                 // Note: this is strange that there is no defrost cut in the low speed and doesn't use H2 or H3 low
    3639             :                 // Equation 11.177 AHRI-2023
    3640         293 :                 Real64 q_low = q_H1_low + (q_H0_low - q_H1_low) * ((t - (8.33)) / (16.66 - (8.33)));
    3641             :                 // Equation 11.178 AHRI-2023
    3642         293 :                 Real64 p_low = p_H1_low + (p_H0_low - p_H1_low) * ((t - (8.33)) / (16.66 - (8.33)));
    3643         293 :                 Real64 q_hs(0.0);
    3644         293 :                 Real64 p_hs(0.0);
    3645             :                 // Low Speed
    3646         293 :                 if (t < -8.33) {
    3647         100 :                     q_low = Q_H3_Full(spnum) + ((Q_H1_Low(spnum) - Q_H3_Full(spnum)) * (t - HeatingOutdoorCoilInletAirDBTempH3Test) /
    3648             :                                                 (HeatingOutdoorCoilInletAirDBTempRated - HeatingOutdoorCoilInletAirDBTempH3Test));
    3649             : 
    3650         100 :                     p_low = P_H3_Full(spnum) + ((P_H1_Low(spnum) - P_H3_Full(spnum)) * (t - HeatingOutdoorCoilInletAirDBTempH3Test) /
    3651             :                                                 (HeatingOutdoorCoilInletAirDBTempRated - HeatingOutdoorCoilInletAirDBTempH3Test));
    3652         193 :                 } else if (t >= 4.44) {
    3653          60 :                     q_low = Q_H1_Low(spnum) + ((Q_H0_Low(spnum) - Q_H1_Low(spnum)) * (t - HeatingOutdoorCoilInletAirDBTempRated) /
    3654             :                                                (HeatingOutdoorCoilInletAirDBTempH0Test - HeatingOutdoorCoilInletAirDBTempRated));
    3655          60 :                     p_low = P_H1_Low(spnum) + ((P_H0_Low(spnum) - P_H1_Low(spnum)) * (t - HeatingOutdoorCoilInletAirDBTempRated) /
    3656             :                                                (HeatingOutdoorCoilInletAirDBTempH0Test - HeatingOutdoorCoilInletAirDBTempRated));
    3657             :                 } else {
    3658         133 :                     q_low = Q_H3_Full(spnum) + ((Q_H2_Full(spnum) - Q_H3_Full(spnum)) * (t - HeatingOutdoorCoilInletAirDBTempH3Test) /
    3659             :                                                 (HeatingOutdoorCoilInletAirDBTempH2Test - HeatingOutdoorCoilInletAirDBTempH3Test));
    3660         133 :                     p_low = P_H3_Full(spnum) + ((P_H2_Full(spnum) - P_H3_Full(spnum)) * (t - HeatingOutdoorCoilInletAirDBTempH3Test) /
    3661             :                                                 (HeatingOutdoorCoilInletAirDBTempH2Test - HeatingOutdoorCoilInletAirDBTempH3Test));
    3662             :                 }
    3663             : 
    3664             :                 // High Speed
    3665         293 :                 if ((t <= -8.33) || (t >= 7.20)) {
    3666         160 :                     q_hs = Q_H3_Full(spnum + 1) + ((Q_H1_Full(spnum + 1) - Q_H3_Full(spnum + 1)) * (t - HeatingOutdoorCoilInletAirDBTempH3Test) /
    3667             :                                                    (HeatingOutdoorCoilInletAirDBTempRated - HeatingOutdoorCoilInletAirDBTempH3Test));
    3668         160 :                     p_hs = P_H3_Full(spnum + 1) + ((P_H1_Full(spnum + 1) - P_H3_Full(spnum + 1)) * (t - HeatingOutdoorCoilInletAirDBTempH3Test) /
    3669             :                                                    (HeatingOutdoorCoilInletAirDBTempRated - HeatingOutdoorCoilInletAirDBTempH3Test));
    3670             :                 } else {
    3671         133 :                     q_hs = Q_H3_Full(spnum + 1) + ((Q_H2_Full(spnum + 1) - Q_H3_Full(spnum + 1)) * (t - HeatingOutdoorCoilInletAirDBTempH3Test) /
    3672             :                                                    (HeatingOutdoorCoilInletAirDBTempH2Test - HeatingOutdoorCoilInletAirDBTempH3Test));
    3673         133 :                     p_hs = P_H3_Full(spnum + 1) + ((P_H2_Full(spnum + 1) - P_H3_Full(spnum + 1)) * (t - HeatingOutdoorCoilInletAirDBTempH3Test) /
    3674             :                                                    (HeatingOutdoorCoilInletAirDBTempH2Test - HeatingOutdoorCoilInletAirDBTempH3Test));
    3675             :                 }
    3676             : 
    3677         293 :                 Real64 cop_low = q_low / p_low;
    3678             : 
    3679         293 :                 Real64 q_int = q_H2_int + M_Hq * (t - (1.66));
    3680         293 :                 Real64 p_int = p_H2_int + M_HE * (t - (1.66));
    3681         293 :                 Real64 cop_int = q_int / p_int;
    3682             : 
    3683         293 :                 Real64 delta_low(0.0);
    3684         293 :                 if (bl <= q_low) {
    3685             :                     // CASE 1 : Section 11.2.2.3.1 AHRI-2023
    3686             :                     // Building Load is less than the capacity of the unit at the Low Compressor Speed (q_low >= bl)
    3687          63 :                     if (t <= t_Off || cop_low < 1.0) {
    3688           0 :                         delta_low = 0.0; //  Equation 11.159 AHRI-2023
    3689          63 :                     } else if (t > t_On) {
    3690          58 :                         delta_low = 1.0; // Equation 11.160 AHRI-2023
    3691             :                     } else {
    3692           5 :                         delta_low = 0.5; // Equation 11.161 AHRI-2023
    3693             :                     }
    3694             : 
    3695          63 :                     Real64 hlf_low(0.0); // Par tLoad Ratio
    3696          63 :                     if (q_low > 0.0) {
    3697          63 :                         hlf_low = min(1.0, bl / q_low); // Equation 11.155 AHRI-2023
    3698             :                     }
    3699             :                     // Section 6.1.3.2.3 (AHRI-2023) For Variable Capacity Systems, if the optional H1CFull and H1CLow tests are not
    3700             :                     // performed, a default value of 0.25 shall be used for the heating Degradation Coefficient
    3701          63 :                     Real64 CyclicMSHeatingDegradationCoeffHSPF2 = 0.25;
    3702             :                     // Part Load Fration
    3703          63 :                     Real64 plf_low = 1.0 - CyclicMSHeatingDegradationCoeffHSPF2 * (1.0 - hlf_low); // Equation 11.156 AHRI-2023
    3704             :                     // e = p_low * hlf_low * delta_low * n / plf_low;                                 // Equation 11.153 AHRI-2023
    3705          63 :                     e = (hlf_low / plf_low) * p_low * delta_low * n;
    3706          63 :                     rh = bl * (1.0 - delta_low) * n; // Equation 11.154 AHRI-2023
    3707          63 :                     goto HeatSpeedLoop4_exit;
    3708         230 :                 } else if (bl > q_low && bl < q_hs) {
    3709             :                     // (bl > q_low && bl < q_full) {
    3710             :                     // CASE 2 : 11.2.2.3.2 AHRI-2023
    3711             :                     // Building load can be matched by modulating the compressor speed between low speed and full speed, q_low < bl < q_full
    3712          66 :                     Real64 cop_int_bin(0.0);
    3713          66 :                     Real64 delta_int_bin(0.0);
    3714          66 :                     if (bl <= q_int) {
    3715           0 :                         cop_int_bin = cop_low + ((cop_int - cop_low) / (q_int - q_low)) * (bl - q_low);   // Equation 11.187 AHRI-2023
    3716             :                     } else {                                                                              // if bl > q_int
    3717          66 :                         cop_int_bin = cop_int + ((cop_full - cop_int) / (q_full - q_int)) * (bl - q_int); // Equation 11.188 AHRI-2023
    3718             :                     }
    3719             : 
    3720          66 :                     delta_int_bin = 0.0;
    3721          66 :                     if (!OATempCompressorOnOffBlank) {
    3722          24 :                         if (t <= t_Off) {
    3723           0 :                             delta_int_bin = 0.0;
    3724          24 :                         } else if (t > t_Off && t <= t_On) {
    3725          12 :                             delta_int_bin = 0.5;
    3726             :                         } else {
    3727          12 :                             delta_int_bin = 1.0;
    3728             :                         }
    3729             :                     } else {
    3730          42 :                         delta_int_bin = 1.0;
    3731             :                     }
    3732             : 
    3733          66 :                     rh = bl * (1.0 - delta_int_bin) * n;
    3734          66 :                     Real64 q = bl * n;                   // Equation 11.185 AHRI-2023
    3735          66 :                     e = q / cop_int_bin * delta_int_bin; // Equaiton 11.186 AHRI-2023
    3736          66 :                     goto HeatSpeedLoop4_exit;
    3737         164 :                 } else if (bl >= q_full) {
    3738             :                     // CASE 3 : 11.2.2.3.3 AHRI-2023
    3739             :                     // Building Load is greater than the capacity of the unit at the Full Compressor Speed, q_full <= bl or (bl >= q_full:)
    3740         131 :                     if (t > (-15) || t <= (-8.33)) {
    3741         131 :                         Real64 t_ratio = (t - (-15)) / ((-8.33) - (-15));
    3742             :                         // Equation 11.203 AHRI-2023
    3743         131 :                         q_full = q_H4_full + (q_H3_full - q_H4_full) * t_ratio;
    3744             :                         // Equation 11.204 AHRI-2023
    3745         131 :                         p_full = p_H4_full + (p_H3_full - p_H4_full) * t_ratio;
    3746           0 :                     } else if (t < (-15)) {
    3747           0 :                         Real64 t_ratio = (t - (-15)) / (8.33 - (-8.33));
    3748             :                         // Equation 11.205 AHRI-2023
    3749           0 :                         q_full = q_H4_full + (q_H1_full - q_H3_full) * t_ratio;
    3750             :                         // Equation 11.206 AHRI-2023
    3751           0 :                         p_full = p_H4_full + (p_H1_full - p_H3_full) * t_ratio;
    3752             :                     }
    3753             : 
    3754             :                     // if not conducting H4 Test then use this block
    3755             :                     // if (t >= t_ob || t <= (-8.33)) {
    3756             :                     //     Real64 t_ratio = (t - (-8.33)) / ((8.33) - (-8.33));
    3757             :                     //     // Equation 11.199 AHRI-2023
    3758             :                     //     q_full = q_H3_full + (q_H1_full - q_H3_full) * t_ratio;
    3759             :                     //     // Equation 11.200 AHRI-2023
    3760             :                     //     p_full = p_H3_full + (p_H1_full - p_H3_full) * t_ratio;
    3761             :                     // } else if ((-8.33) < t && t < t_ob) {
    3762             :                     //     Real64 t_ratio = (t - (-8.33)) / (1.66 - (-8.33));
    3763             :                     //     // Equation 11.201 AHRI-2023
    3764             :                     //     q_full = q_H3_full + (q_H2_full - q_H3_full) * t_ratio;
    3765             :                     //     // Equation 11.202 AHRI-2023
    3766             :                     //     p_full = p_H3_full + (p_H2_full - p_H3_full) * t_ratio;
    3767             :                     // }
    3768             : 
    3769         131 :                     if (!OATempCompressorOnOffBlank && p_full > 0.0) {
    3770          42 :                         if ((t <= OATempCompressorOff) || (q_full / p_full < 1.0)) {
    3771          42 :                             delta_full = 0.0;
    3772           0 :                         } else if ((t > OATempCompressorOff && t <= OATempCompressorOn) && (q_full / p_full > 1.0)) {
    3773           0 :                             delta_full = 0.5;
    3774           0 :                         } else if ((t > OATempCompressorOn) && (q_full / p_full > 1.0)) {
    3775           0 :                             delta_full = 1.0;
    3776             :                         }
    3777             :                     } else {
    3778          89 :                         delta_full = 1.0;
    3779             :                     }
    3780             : 
    3781         131 :                     hlf_full = 1.0; // Equation 11.170 AHRI-2023
    3782             : 
    3783             :                     // Equaiton 11.168 AHRI-2023
    3784         131 :                     e = p_full * hlf_full * delta_full * n;
    3785             :                     // Equation 11.169 AHRI - 2023
    3786         131 :                     rh = (bl - q_full * hlf_full * delta_full) * n;
    3787         131 :                     goto HeatSpeedLoop4_exit;
    3788             :                 }
    3789             :             }
    3790             : 
    3791           0 :         HeatSpeedLoop4_exit:;
    3792         260 :             q_sum += n * bl;
    3793         260 :             e_sum += e;
    3794         260 :             rh_sum += rh;
    3795             :         }
    3796             : 
    3797          20 :         Real64 defrost_period = 90;   // Time between defrost terminations (for testing) in minutes
    3798          20 :         Real64 defrost_MaxTime = 720; // Maximum time between defrosts allowed by controls in minutes
    3799          20 :         Real64 t_Test_90 = max(defrost_period, 90.00);
    3800          20 :         Real64 t_Max_90 = min(defrost_MaxTime, 720.00);
    3801             :         // default t_Test_90/t_Max_90 = 0.125
    3802          20 :         if (DefrostControl == HPdefrostControl::Timed) {
    3803             :             // Equation 11.106 AHRI-2023
    3804          20 :             f_def = 1.0; // Timed defrost control
    3805             :         } else {
    3806             :             // Equation 11.105 AHRI-2023
    3807           0 :             f_def = 1 + 0.03 * (1 - (t_Test_90 / t_Max_90)); // Demand defrost control
    3808             :             // f_def = 1.03;
    3809             :         }
    3810             : 
    3811          20 :         if (e_sum > 0.0) {
    3812          20 :             HSPF2_2023 = (q_sum / (e_sum + rh_sum)) * f_def; // Equation 11.103
    3813             :         } else {
    3814           0 :             HSPF2_2023 = 0.0;
    3815             :         }
    3816             : 
    3817          40 :         return std::make_tuple(NetHeatingCapRatedHighTemp_2023, NetHeatingCapRatedLowTemp_2023, HSPF2_2023);
    3818             :     }
    3819             : 
    3820          20 :     std::map<std::string, Real64> MultiSpeedDXHeatingCoilStandardRatings(
    3821             :         EnergyPlusData &state,
    3822             :         [[maybe_unused]] std::string const &DXCoilName,               // Name of DX coil for which HSPF is calculated
    3823             :         [[maybe_unused]] std::string const &DXCoilType,               // Type of DX coil for which HSPF is calculated
    3824             :         Array1A_int const CapFTempCurveIndex,                         // Index for the capacity as a function of temperature modifier curve
    3825             :         Array1A_int const CapFFlowCurveIndex,                         // Index for the capacity as a function of flow fraction modifier curve
    3826             :         Array1A_int const EIRFTempCurveIndex,                         // Index for the EIR as a function of temperature modifier curve
    3827             :         Array1A_int const EIRFFlowCurveIndex,                         // Index for the EIR as a function of flow fraction modifier curve
    3828             :         Array1A_int const PLFFPLRCurveIndex,                          // Index for the PLF vs part-load ratio curve
    3829             :         Array1A<Real64> const RatedTotalCapacity,                     // Reference capacity of DX coil [W]
    3830             :         Array1A<Real64> const RatedCOP,                               // Reference coefficient of performance [W/W]
    3831             :         Array1A<Real64> const RatedAirVolFlowRate,                    // Reference air flow rate of DX coil [m3/s]
    3832             :         Array1A<Real64> const MSFanPowerPerEvapAirFlowRateInput,      // 2017 rated fan power per evap air flow rate [W/(m3/s)]
    3833             :         Array1A<Real64> const MSFanPowerPerEvapAirFlowRateInput_2023, // 2023 rated fan power per evap air flow rate [W/(m3/s)]
    3834             :         int const nsp,                                                // Number of compressor speeds
    3835             :         Optional_int_const RegionNum,                                 // Region number for calculating HSPF of single speed DX heating coil
    3836             :         Optional<Real64 const> MinOATCompressor,                      // Minimum OAT for heat pump compressor operation [C]
    3837             :         Optional<Real64 const> OATempCompressorOn,                    // The outdoor temperature when the compressor is automatically turned
    3838             :         Optional_bool_const OATempCompressorOnOffBlank,               // Flag used to determine low temperature cut out factor
    3839             :         Optional<HPdefrostControl const> DefrostControl               // defrost control; 1=timed, 2=on-demand
    3840             :     )
    3841             :     {
    3842             : 
    3843             :         // SUBROUTINE INFORMATION:
    3844             :         //       AUTHOR         B. Nigusse, FSEC
    3845             :         //       DATE WRITTEN   December 2012
    3846             :         //       MODIFIED
    3847             :         //       RE-ENGINEERED  na
    3848             : 
    3849             :         // PURPOSE OF THIS SUBROUTINE:
    3850             :         // Calculates the standard ratings net heating capacity and HSPF values for multi speed DX heating coils
    3851             :         // at the AHRI standard test condition(s).
    3852             : 
    3853             :         // METHODOLOGY EMPLOYED:
    3854             :         // na
    3855             : 
    3856             :         // REFERENCES:
    3857             :         // na
    3858             : 
    3859             :         // Using/Aliasing
    3860             :         using Curve::CurveValue;
    3861             : 
    3862             :         // Argument array dimensioning
    3863          20 :         CapFTempCurveIndex.dim(nsp);
    3864          20 :         CapFFlowCurveIndex.dim(nsp);
    3865          20 :         EIRFTempCurveIndex.dim(nsp);
    3866          20 :         EIRFFlowCurveIndex.dim(nsp);
    3867          20 :         PLFFPLRCurveIndex.dim(nsp);
    3868          20 :         RatedTotalCapacity.dim(nsp);
    3869          20 :         RatedCOP.dim(nsp);
    3870          20 :         RatedAirVolFlowRate.dim(nsp);
    3871          20 :         MSFanPowerPerEvapAirFlowRateInput.dim(nsp);
    3872          20 :         MSFanPowerPerEvapAirFlowRateInput_2023.dim(nsp);
    3873             : 
    3874             :         // Locals
    3875             :         // SUBROUTINE ARGUMENT DEFINITIONS:
    3876             : 
    3877             :         // back on, if applicable, following automatic shut off. This field is
    3878             :         // used only for HSPF calculation. [C]
    3879             : 
    3880             :         // SUBROUTINE PARAMETER DEFINITIONS:
    3881             :         // CHARACTER(len=*), PARAMETER      :: RoutineName='MultiSpeedDXHeatingCoilStandardRatings: ' ! Include trailing blank space
    3882             : 
    3883             :         // INTERFACE BLOCK SPECIFICATIONS
    3884             :         // na
    3885             : 
    3886             :         // DERIVED TYPE DEFINITIONS
    3887             :         // na
    3888             : 
    3889             :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    3890             : 
    3891          20 :         Real64 NetHeatingCapRatedHighTemp = 0.0; // net heating capacity at maximum speed and High Temp
    3892          20 :         Real64 NetHeatingCapRatedLowTemp = 0.0;  // net heating capacity at maximum speed and low Temp
    3893          20 :         Real64 HSPF = 0.0;                       // seasonale energy efficiency ratio of multi speed DX cooling coil
    3894             : 
    3895          20 :         Real64 NetHeatingCapRatedHighTemp_2023 = 0.0; // net heating capacity at maximum speed and High Temp
    3896          20 :         Real64 NetHeatingCapRatedLowTemp_2023 = 0.0;  // net heating capacity at maximum speed and low Temp
    3897          20 :         Real64 HSPF2_2023 = 0.0;                      // seasonale energy efficiency ratio of multi speed DX cooling coil
    3898             : 
    3899          20 :         std::map<std::string, Real64> StandardRatingsResult;
    3900             :         // StandardRatingsResult["NetHeatingCapRatedHighTemp"] = NetHeatingCapRatedHighTemp;
    3901             :         // StandardRatingsResult["NetHeatingCapRatedLowTemp"] = NetHeatingCapRatedLowTemp;
    3902             :         // StandardRatingsResult["HSPF"] = HSPF;
    3903             :         // StandardRatingsResult["NetHeatingCapRatedHighTemp_2023"] = NetHeatingCapRatedHighTemp_2023;
    3904             :         // StandardRatingsResult["NetHeatingCapRatedLowTemp_2023"] = NetHeatingCapRatedLowTemp_2023;
    3905             :         // StandardRatingsResult["HSPF2_2023"] = HSPF2_2023;
    3906             : 
    3907             :         // HSPF Calculation | AHRI 2017 Std.
    3908          40 :         std::tie(NetHeatingCapRatedHighTemp, NetHeatingCapRatedLowTemp, HSPF) = MultiSpedDXHeatingCoilHSPF(state,
    3909             :                                                                                                            nsp,
    3910             :                                                                                                            MSFanPowerPerEvapAirFlowRateInput,
    3911             :                                                                                                            CapFTempCurveIndex,
    3912             :                                                                                                            CapFFlowCurveIndex,
    3913             :                                                                                                            RatedTotalCapacity,
    3914             :                                                                                                            RatedAirVolFlowRate,
    3915             :                                                                                                            EIRFFlowCurveIndex,
    3916             :                                                                                                            EIRFTempCurveIndex,
    3917             :                                                                                                            RatedCOP,
    3918             :                                                                                                            RegionNum,
    3919             :                                                                                                            MinOATCompressor,
    3920             :                                                                                                            OATempCompressorOnOffBlank,
    3921             :                                                                                                            OATempCompressorOn,
    3922          20 :                                                                                                            DefrostControl);
    3923             : 
    3924          20 :         StandardRatingsResult["NetHeatingCapRatedHighTemp"] = NetHeatingCapRatedHighTemp;
    3925          20 :         StandardRatingsResult["NetHeatingCapRatedLowTemp"] = NetHeatingCapRatedLowTemp;
    3926          20 :         StandardRatingsResult["HSPF"] = HSPF;
    3927             : 
    3928             :         // HSPF2 Calculation | AHRI 2023 Std.
    3929          20 :         std::tie(NetHeatingCapRatedHighTemp_2023, NetHeatingCapRatedLowTemp_2023, HSPF2_2023) =
    3930          40 :             MultiSpedDXHeatingCoilHSPF2(state,
    3931             :                                         nsp,
    3932             :                                         MSFanPowerPerEvapAirFlowRateInput_2023,
    3933             :                                         CapFTempCurveIndex,
    3934             :                                         CapFFlowCurveIndex,
    3935             :                                         RatedTotalCapacity,
    3936             :                                         RatedAirVolFlowRate,
    3937             :                                         EIRFFlowCurveIndex,
    3938             :                                         EIRFTempCurveIndex,
    3939             :                                         RatedCOP,
    3940             :                                         RegionNum,
    3941             :                                         MinOATCompressor,
    3942             :                                         OATempCompressorOnOffBlank,
    3943             :                                         OATempCompressorOn,
    3944          20 :                                         DefrostControl);
    3945             : 
    3946          20 :         StandardRatingsResult["NetHeatingCapRatedHighTemp_2023"] = NetHeatingCapRatedHighTemp_2023;
    3947          20 :         StandardRatingsResult["NetHeatingCapRatedLowTemp_2023"] = NetHeatingCapRatedLowTemp_2023;
    3948          20 :         StandardRatingsResult["HSPF2_2023"] = HSPF2_2023;
    3949             : 
    3950          20 :         return StandardRatingsResult;
    3951             :     }
    3952             : 
    3953        1490 :     void ReportDXCoilRating(EnergyPlusData &state,
    3954             :                             std::string const &CompType,    // Type of component
    3955             :                             std::string_view CompName,      // Name of component
    3956             :                             int const CompTypeNum,          // TypeNum of component
    3957             :                             Real64 const CoolCapVal,        // Standard total (net) cooling capacity for AHRI Std. 210/240 {W}
    3958             :                             Real64 const SEERUserIP,        // SEER value in IP units from user PLR curve {Btu/W-h}
    3959             :                             Real64 const SEERStandardIP,    // SEER value in IP units from AHRI Std 210/240-2008 default PLF curve and C_D {Btu/W-h}
    3960             :                             Real64 const EERValueSI,        // EER value in SI units {W/W}
    3961             :                             Real64 const EERValueIP,        // EER value in IP units {Btu/W-h}
    3962             :                             Real64 const IEERValueIP,       // IEER value in IP units {Btu/W-h}
    3963             :                             Real64 const HighHeatingCapVal, // High Temperature Heating Standard (Net) Rating Capacity
    3964             :                             Real64 const LowHeatingCapVal,  // Low Temperature Heating Standard (Net) Rating Capacity
    3965             :                             Real64 const HSPFValueIP,       // IEER value in IP units {Btu/W-h}
    3966             :                             int const RegionNum,            // Region Number for which HSPF is calculated
    3967             :                             Optional_bool_const AHRI2023StandardRatings) // True if required AHRI/ANSI 210/240 Std. 2023 SEER2,HSPF2 Ratings.
    3968             :     {
    3969             : 
    3970             :         // SUBROUTINE INFORMATION:
    3971             :         //       AUTHOR         Bereket Nigusse, Chandan Sharma
    3972             :         //       DATE WRITTEN   February 2010
    3973             :         //       MODIFIED       May 2010 (Added EER and IEER entries)
    3974             :         //                      March 2012 (Added HSPF and High/Low Heating Capacity entries)
    3975             :         //       RE-ENGINEERED  na
    3976             : 
    3977             :         // PURPOSE OF THIS SUBROUTINE:
    3978             :         // This subroutine writes the standard rating (net) cooling capacity, SEER, EER and IEER values to
    3979             :         // the "eio" and tabular output files for Single Speed compressor DX Cooling Coils.
    3980             : 
    3981             :         // METHODOLOGY EMPLOYED:
    3982             :         // na
    3983             : 
    3984             :         // REFERENCES:
    3985             :         // na
    3986             : 
    3987             :         // Using/Aliasing
    3988             : 
    3989             :         using namespace OutputReportPredefined;
    3990             :         using DataHVACGlobals::CoilDX_CoolingSingleSpeed;
    3991             :         using DataHVACGlobals::CoilDX_HeatingEmpirical;
    3992             :         using DataHVACGlobals::CoilDX_MultiSpeedCooling;
    3993             :         using DataHVACGlobals::CoilDX_MultiSpeedHeating;
    3994             : 
    3995             :         // Locals
    3996             :         // SUBROUTINE ARGUMENT DEFINITIONS:
    3997             :         //   or ANSI/AHRI Std. 340/360 {W}
    3998             : 
    3999             :         // for AHRI Std. 210/240 {W}
    4000             :         // for AHRI Std. 210/240 {W}
    4001             : 
    4002             :         // SUBROUTINE PARAMETER DEFINITIONS:
    4003             : 
    4004             :         // INTERFACE BLOCK SPECIFICATIONS
    4005             :         // na
    4006             : 
    4007             :         // DERIVED TYPE DEFINITIONS
    4008             :         // na
    4009             : 
    4010             :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    4011        1490 :         auto &MyCoolOneTimeFlag = state.dataHVACGlobal->StandardRatingsMyCoolOneTimeFlag;
    4012        1490 :         auto &MyHeatOneTimeFlag = state.dataHVACGlobal->StandardRatingsMyHeatOneTimeFlag;
    4013             : 
    4014        1490 :         switch (CompTypeNum) {
    4015             : 
    4016        1208 :         case CoilDX_CoolingSingleSpeed: {
    4017        1208 :             if (!AHRI2023StandardRatings) {
    4018         604 :                 if (MyCoolOneTimeFlag) {
    4019         160 :                     print(state.files.eio,
    4020             :                           "{}",
    4021             :                           "! <DX Cooling Coil Standard Rating Information>, Component Type, Component Name, Standard Rating (Net) "
    4022             :                           "Cooling Capacity {W}, Standard Rated Net COP {W/W}, EER {Btu/W-h}, SEER User {Btu/W-h}, SEER Standard {Btu/W-h}, "
    4023             :                           "IEER "
    4024         160 :                           "{Btu/W-h}\n");
    4025         160 :                     MyCoolOneTimeFlag = false;
    4026             :                 }
    4027             : 
    4028             :                 static constexpr std::string_view Format_991(
    4029             :                     " DX Cooling Coil Standard Rating Information, {}, {}, {:.1R}, {:.2R}, {:.2R}, {:.2R}, {:.2R}, {:.2R}\n");
    4030         604 :                 print(state.files.eio, Format_991, CompType, CompName, CoolCapVal, EERValueSI, EERValueIP, SEERUserIP, SEERStandardIP, IEERValueIP);
    4031             : 
    4032         604 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilType, CompName, CompType);
    4033         604 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilNetCapSI, CompName, CoolCapVal, 1);
    4034             :                 // W/W is the same as Btuh/Btuh so that's fine too
    4035         604 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilCOP, CompName, EERValueSI, 2);
    4036             :                 // Btu/W-h will convert to itself
    4037         604 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilEERIP, CompName, EERValueIP, 2);
    4038         604 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilSEERUserIP, CompName, SEERUserIP, 2);
    4039         604 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilSEERStandardIP, CompName, SEERStandardIP, 2);
    4040         604 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilIEERIP, CompName, IEERValueIP, 2);
    4041         604 :                 addFootNoteSubTable(state,
    4042         604 :                                     state.dataOutRptPredefined->pdstDXCoolCoil,
    4043             :                                     "ANSI/AHRI ratings account for supply air fan heat and electric power. "
    4044             :                                     "SEER User is calculated using user-input PLF curve and cooling coefficient of degradation whereas SEER Standard "
    4045         604 :                                     "is calculated using AHRI Std 210/240-2008 default PLF curve and cooling coefficient of degradation.");
    4046             :             } else {
    4047             :                 // ANSI/AHRI 210/240 Standard 2023 Ratings | SEER2
    4048         604 :                 if (MyCoolOneTimeFlag) {
    4049           0 :                     print(state.files.eio,
    4050             :                           "{}",
    4051             :                           "! <DX Cooling Coil Standard Rating Information>, Component Type, Component Name, Standard Rating (Net) "
    4052             :                           "Cooling Capacity {W}, Standard Rated Net COP2 {W/W}, EER2 {Btu/W-h}, SEER2 User {Btu/W-h}, SEER2 Standard {Btu/W-h}, "
    4053             :                           "IEER2 "
    4054           0 :                           "{Btu/W-h}\n");
    4055           0 :                     MyCoolOneTimeFlag = false;
    4056             :                 }
    4057             : 
    4058             :                 static constexpr std::string_view Format_991_(
    4059             :                     " DX Cooling Coil Standard Rating Information, {}, {}, {:.1R}, {:.2R}, {:.2R}, {:.2R}, {:.2R}, {}\n");
    4060         604 :                 print(state.files.eio, Format_991_, CompType, CompName, CoolCapVal, EERValueSI, EERValueIP, SEERUserIP, SEERStandardIP, ' ');
    4061             : 
    4062         604 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilType_2023, CompName, CompType);
    4063         604 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilNetCapSI_2023, CompName, CoolCapVal, 1);
    4064             :                 // W/W is the same as Btuh/Btuh so that's fine too
    4065         604 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilCOP_2023, CompName, EERValueSI, 2);
    4066             :                 // Btu/W-h will convert to itself
    4067         604 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilEERIP_2023, CompName, EERValueIP, 2);
    4068         604 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilSEER2UserIP_2023, CompName, SEERUserIP, 2);
    4069         604 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilSEER2StandardIP_2023, CompName, SEERStandardIP, 2);
    4070             :                 // PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilIEERIP_2023, CompName, IEERValueIP, 2);
    4071         604 :                 addFootNoteSubTable(
    4072             :                     state,
    4073         604 :                     state.dataOutRptPredefined->pdstDXCoolCoil_2023,
    4074             :                     "ANSI/AHRI ratings account for supply air fan heat and electric power. "
    4075             :                     "SEER2 User is calculated using user-input PLF curve and cooling coefficient of degradation whereas SEER2 Standard "
    4076             :                     "is calculated using AHRI Std 210/240-2023 default PLF curve and cooling coefficient of degradation. "
    4077         604 :                     "IEER Calculation was removed from the 2023 Version of the Standard.");
    4078             :             }
    4079        1208 :             break;
    4080             :         }
    4081         186 :         case CoilDX_HeatingEmpirical:
    4082             :         case CoilDX_MultiSpeedHeating: {
    4083         186 :             if (!AHRI2023StandardRatings) {
    4084          93 :                 if (MyHeatOneTimeFlag) {
    4085             :                     static constexpr std::string_view Format_992(
    4086             :                         "! <DX Heating Coil Standard Rating Information>, Component Type, Component Name, High Temperature Heating "
    4087             :                         "(net) Rating Capacity {W}, Low Temperature Heating (net) Rating Capacity {W}, HSPF {Btu/W-h}, Region "
    4088             :                         "Number\n");
    4089          59 :                     print(state.files.eio, "{}", Format_992);
    4090          59 :                     MyHeatOneTimeFlag = false;
    4091             :                 }
    4092             : 
    4093             :                 static constexpr std::string_view Format_993(" DX Heating Coil Standard Rating Information, {}, {}, {:.1R}, {:.1R}, {:.2R}, {}\n");
    4094          93 :                 print(state.files.eio, Format_993, CompType, CompName, HighHeatingCapVal, LowHeatingCapVal, HSPFValueIP, RegionNum);
    4095             : 
    4096          93 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXHeatCoilType, CompName, CompType);
    4097          93 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXHeatCoilHighCap, CompName, HighHeatingCapVal, 1);
    4098          93 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXHeatCoilLowCap, CompName, LowHeatingCapVal, 1);
    4099             :                 // Btu/W-h will convert to itself
    4100          93 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXHeatCoilHSPFIP, CompName, HSPFValueIP, 2);
    4101          93 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXHeatCoilRegionNum, CompName, RegionNum);
    4102          93 :                 addFootNoteSubTable(
    4103          93 :                     state, state.dataOutRptPredefined->pdstDXHeatCoil, "ANSI/AHRI ratings account for supply air fan heat and electric power.");
    4104             :             } else {
    4105             :                 // ANSI/AHRI 210/240 Standard 2023 Ratings | HSPF2
    4106          93 :                 if (MyHeatOneTimeFlag) {
    4107             :                     static constexpr std::string_view Format_992_(
    4108             :                         "! <DX Heating Coil Standard Rating Information>, Component Type, Component Name, High Temperature Heating "
    4109             :                         "(net) Rating Capacity {W}, Low Temperature Heating (net) Rating Capacity {W}, HSPF2 {Btu/W-h}, Region "
    4110             :                         "Number\n");
    4111           0 :                     print(state.files.eio, "{}", Format_992_);
    4112           0 :                     MyHeatOneTimeFlag = false;
    4113             :                 }
    4114             : 
    4115             :                 static constexpr std::string_view Format_993_(" DX Heating Coil Standard Rating Information, {}, {}, {:.1R}, {:.1R}, {:.2R}, {}\n");
    4116          93 :                 print(state.files.eio, Format_993_, CompType, CompName, HighHeatingCapVal, LowHeatingCapVal, HSPFValueIP, RegionNum);
    4117             : 
    4118          93 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXHeatCoilType_2023, CompName, CompType);
    4119          93 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXHeatCoilHighCap_2023, CompName, HighHeatingCapVal, 1);
    4120          93 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXHeatCoilLowCap_2023, CompName, LowHeatingCapVal, 1);
    4121             :                 // Btu/W-h will convert to itself
    4122          93 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXHeatCoilHSPF2IP_2023, CompName, HSPFValueIP, 2);
    4123          93 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXHeatCoilRegionNum_2023, CompName, RegionNum);
    4124          93 :                 addFootNoteSubTable(state,
    4125          93 :                                     state.dataOutRptPredefined->pdstDXHeatCoil_2023,
    4126          93 :                                     "ANSI/AHRI 2023 (HSPF2) ratings account for supply air fan heat and electric power.");
    4127             :             }
    4128         186 :             break;
    4129             :         }
    4130          96 :         case CoilDX_MultiSpeedCooling: {
    4131          96 :             if (!AHRI2023StandardRatings) {
    4132          48 :                 if (MyCoolOneTimeFlag) {
    4133             :                     static constexpr std::string_view Format_994(
    4134             :                         "! <DX Cooling Coil Standard Rating Information>, Component Type, Component Name, Standard Rating (Net) "
    4135             :                         "Cooling Capacity {W}, Standard Rated Net COP {W/W}, EER {Btu/W-h}, SEER User {Btu/W-h}, SEER Standard {Btu/W-h}, "
    4136             :                         "IEER "
    4137             :                         "{Btu/W-h}");
    4138          22 :                     print(state.files.eio, "{}\n", Format_994);
    4139          22 :                     MyCoolOneTimeFlag = false;
    4140             :                 }
    4141             : 
    4142             :                 static constexpr std::string_view Format_995(
    4143             :                     " DX Cooling Coil Standard Rating Information, {}, {}, {:.1R}, {}, {}, {:.2R}, {:.2R}, {}\n");
    4144          48 :                 print(state.files.eio, Format_995, CompType, CompName, CoolCapVal, ' ', ' ', SEERUserIP, SEERStandardIP, ' ');
    4145             : 
    4146          48 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilType, CompName, CompType);
    4147          48 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilNetCapSI, CompName, CoolCapVal, 1);
    4148          48 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilSEERUserIP, CompName, SEERUserIP, 2);
    4149          48 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilSEERStandardIP, CompName, SEERStandardIP, 2);
    4150          48 :                 addFootNoteSubTable(state,
    4151          48 :                                     state.dataOutRptPredefined->pdstDXCoolCoil,
    4152             :                                     "ANSI/AHRI ratings account for supply air fan heat and electric power. "
    4153             :                                     "SEER User is calculated using user-input PLF curve and cooling coefficient of degradation whereas SEER Standard "
    4154          48 :                                     "is calculated using AHRI Std 210/240-2008 default PLF curve and cooling coefficient of degradation.");
    4155             :             } else {
    4156             :                 // ANSI/AHRI 210/240 Standard 2023 Ratings | SEER2
    4157          48 :                 if (MyCoolOneTimeFlag) {
    4158             :                     static constexpr std::string_view Format_994_(
    4159             :                         "! <DX Cooling Coil Standard Rating Information>, Component Type, Component Name, Standard Rating (Net) "
    4160             :                         "Cooling Capacity {W}, Standard Rated Net COP {W/W}, EER2 {Btu/W-h}, SEER2 User {Btu/W-h}, SEER2 Standard {Btu/W-h}, "
    4161             :                         "IEER2 "
    4162             :                         "{Btu/W-h}");
    4163           0 :                     print(state.files.eio, "{}\n", Format_994_);
    4164           0 :                     MyCoolOneTimeFlag = false;
    4165             :                 }
    4166             : 
    4167             :                 static constexpr std::string_view Format_995_(
    4168             :                     " DX Cooling Coil Standard Rating Information, {}, {}, {:.1R}, {}, {}, {:.2R}, {:.2R}, {}\n");
    4169          48 :                 print(state.files.eio, Format_995_, CompType, CompName, CoolCapVal, ' ', ' ', SEERUserIP, SEERStandardIP, ' ');
    4170             : 
    4171          48 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilType_2023, CompName, CompType);
    4172          48 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilNetCapSI_2023, CompName, CoolCapVal, 1);
    4173          48 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilSEER2UserIP_2023, CompName, SEERUserIP, 2);
    4174          48 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilSEER2StandardIP_2023, CompName, SEERStandardIP, 2);
    4175          48 :                 addFootNoteSubTable(
    4176             :                     state,
    4177          48 :                     state.dataOutRptPredefined->pdstDXCoolCoil_2023,
    4178             :                     "ANSI/AHRI ratings account for supply air fan heat and electric power. "
    4179             :                     "SEER2 User is calculated using user-input PLF curve and cooling coefficient of degradation whereas SEER2 Standard "
    4180          48 :                     "is calculated using AHRI Std 210/240-2023 default PLF curve and cooling coefficient of degradation.");
    4181             :             }
    4182             : 
    4183          96 :             break;
    4184             :         }
    4185           0 :         default:
    4186           0 :             break;
    4187             :         }
    4188        1490 :     }
    4189             : 
    4190           8 :     void ReportDXCoolCoilDataCenterApplication(EnergyPlusData &state,
    4191             :                                                std::string const &CompType,           // Type of component
    4192             :                                                std::string_view CompName,             // Name of component
    4193             :                                                int const CompTypeNum,                 // TypeNum of component
    4194             :                                                Array1D<Real64> &NetCoolingCapRated,   // net cooling capacity of single speed DX cooling coil
    4195             :                                                Array1D<Real64> &TotElectricPowerRated // total electric power including supply fan
    4196             :     )
    4197             :     {
    4198             : 
    4199             :         // SUBROUTINE INFORMATION:
    4200             :         //       AUTHOR         Bereket Nigusse
    4201             :         //       DATE WRITTEN   October 2014
    4202             :         //       MODIFIED       na
    4203             :         //
    4204             :         //       RE-ENGINEERED  na
    4205             : 
    4206             :         // PURPOSE OF THIS SUBROUTINE:
    4207             :         // This subroutine writes the standard rating (net) cooling capacity and Electric Power for
    4208             :         // for room unitary air conditioners single speed DX cooling coils to the "eio" and tabular
    4209             :         // output files.
    4210             : 
    4211             :         // METHODOLOGY EMPLOYED:
    4212             :         // na
    4213             : 
    4214             :         // REFERENCES:
    4215             :         // ANSI/ASHRAE Standard 127-2012 - Method of Testing for Rating Computer and Data Processing
    4216             :         //                                 Room Unitary Air Conditioners
    4217             : 
    4218             :         // Using/Aliasing
    4219             : 
    4220             :         using namespace OutputReportPredefined;
    4221             :         using DataHVACGlobals::CoilDX_CoolingSingleSpeed;
    4222             : 
    4223             :         // Locals
    4224             :         // SUBROUTINE ARGUMENT DEFINITIONS:
    4225             :         // na
    4226             : 
    4227             :         // SUBROUTINE PARAMETER DEFINITIONS:
    4228             : 
    4229             :         // INTERFACE BLOCK SPECIFICATIONS
    4230             :         // na
    4231             : 
    4232             :         // DERIVED TYPE DEFINITIONS
    4233             :         // na
    4234             : 
    4235             :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    4236           8 :         auto &MyCoolOneTimeFlag = state.dataHVACGlobal->StandardRatingsMyCoolOneTimeFlag2;
    4237             :         int ClassNum; // class number (Class I, II, II, IV)
    4238             :         int Num;      // text number counter
    4239             : 
    4240             :         // Formats
    4241             : 
    4242           8 :         if (CompTypeNum == CoilDX_CoolingSingleSpeed) {
    4243           8 :             if (MyCoolOneTimeFlag) {
    4244             :                 static constexpr std::string_view Format_101(
    4245             :                     "! <DX Cooling Coil ASHRAE 127 Standard Ratings Information>, Component Type, Component Name, Standard 127 "
    4246             :                     "Classification, Rated Net Cooling Capacity Test A {W}, Rated Total Electric Power Test A {W}, Rated Net "
    4247             :                     "Cooling Capacity Test B {W}, Rated Total Electric Power Test B {W}, Rated Net Cooling Capacity Test C {W}, "
    4248             :                     "Rated Total Electric Power Test C {W}, Rated Net Cooling Capacity Test D {W}, Rated Total Electric "
    4249             :                     "Power Test D {W} \n");
    4250           6 :                 print(state.files.eio, "{}", Format_101);
    4251           6 :                 MyCoolOneTimeFlag = false;
    4252             :             }
    4253          40 :             for (ClassNum = 1; ClassNum <= 4; ++ClassNum) {
    4254          32 :                 Num = (ClassNum - 1) * 4;
    4255          64 :                 std::string ClassName = format("Class {}", ClassNum);
    4256          64 :                 std::string CompNameNew = fmt::format("{}({})", CompName, ClassName);
    4257             :                 static constexpr std::string_view Format_102(
    4258             :                     " DX Cooling Coil ASHRAE 127 Standard Ratings Information, {}, {}, {}, {:.1R}, {:.1R}, {:.1R}, "
    4259             :                     "{:.1R}, {:.1R}, {:.1R}, {:.1R}, {:.1R}\n");
    4260          32 :                 print(state.files.eio,
    4261             :                       Format_102,
    4262             :                       CompType,
    4263             :                       CompName,
    4264             :                       ClassName,
    4265             :                       NetCoolingCapRated(Num + 1),
    4266             :                       TotElectricPowerRated(Num + 1),
    4267             :                       NetCoolingCapRated(Num + 2),
    4268             :                       TotElectricPowerRated(Num + 2),
    4269             :                       NetCoolingCapRated(Num + 3),
    4270             :                       TotElectricPowerRated(Num + 3),
    4271             :                       NetCoolingCapRated(Num + 4),
    4272             :                       TotElectricPowerRated(Num + 4));
    4273          32 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilType, CompNameNew, CompType);
    4274             :                 // Note: If you call format("{:.1R}", NetCoolingCapRated(Num + 1)),
    4275             :                 // Then it's not the OutputReportPredefined::PreDefTableEntry prototype with Real64 that is called.
    4276             :                 // As a result, the entry isn't marked as being Real (origEntryIsReal) and unit conversion does not occur
    4277             :                 // Bad: PreDefTableEntry(state, pdchDXCoolCoilNetCapSIA, CompNameNew, format("{:.1R}", NetCoolingCapRated(Num + 1)));
    4278          32 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilNetCapSIA, CompNameNew, NetCoolingCapRated(Num + 1), 1);
    4279          32 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilNetCapSIB, CompNameNew, NetCoolingCapRated(Num + 2), 1);
    4280          32 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilNetCapSIC, CompNameNew, NetCoolingCapRated(Num + 3), 1);
    4281          32 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilNetCapSID, CompNameNew, NetCoolingCapRated(Num + 4), 1);
    4282             : 
    4283             :                 // These will stay in W, so it doesn't matter as much, but let's be consistent
    4284          32 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilElecPowerA, CompNameNew, TotElectricPowerRated(Num + 1), 1);
    4285          32 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilElecPowerB, CompNameNew, TotElectricPowerRated(Num + 2), 1);
    4286          32 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilElecPowerC, CompNameNew, TotElectricPowerRated(Num + 3), 1);
    4287          32 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilElecPowerD, CompNameNew, TotElectricPowerRated(Num + 4), 1);
    4288             : 
    4289          32 :                 addFootNoteSubTable(state,
    4290          32 :                                     state.dataOutRptPredefined->pdstDXCoolCoil2,
    4291          32 :                                     "ANSI/ASHRAE Standard 127 includes supply fan heat effect and electric power.");
    4292             :             }
    4293             :         }
    4294           8 :     }
    4295             : 
    4296         848 :     void CheckCurveLimitsForStandardRatings(EnergyPlusData &state,
    4297             :                                             std::string const &DXCoilName, // Name of DX coil for which HSPF is calculated
    4298             :                                             std::string const &DXCoilType, // Type of DX coil - heating or cooling
    4299             :                                             int const DXCoilTypeNum,       // Integer type of DX coil - heating or cooling
    4300             :                                             int const CapFTempCurveIndex,  // Index for the capacity as a function of temperature modifier curve
    4301             :                                             int const CapFFlowCurveIndex,  // Index for the capacity as a function of flow fraction modifier curve
    4302             :                                             int const EIRFTempCurveIndex,  // Index for the EIR as a function of temperature modifier curve
    4303             :                                             int const EIRFFlowCurveIndex,  // Index for the EIR as a function of flow fraction modifier curve
    4304             :                                             int const PLFFPLRCurveIndex    // Index for the EIR vs part-load ratio curve
    4305             :     )
    4306             :     {
    4307             : 
    4308             :         // SUBROUTINE INFORMATION:
    4309             :         //       AUTHOR         D. Shirey/B. Nigusse, FSEC
    4310             :         //       DATE WRITTEN   May 2010
    4311             :         //       MODIFIED       Chandan Sharma, March 2012
    4312             :         //       RE-ENGINEERED  na
    4313             : 
    4314             :         // PURPOSE OF THIS SUBROUTINE:
    4315             :         // Checks the limits of the various curves used in DXCoil and returns .FALSE. if the limits do not include
    4316             :         // the standard test condition(s).
    4317             : 
    4318             :         // METHODOLOGY EMPLOYED:
    4319             :         // na
    4320             : 
    4321             :         // REFERENCES:
    4322             :         // na
    4323             : 
    4324             :         // Using/Aliasing
    4325             :         using Curve::CurveValue;
    4326             :         using Curve::GetCurveIndex;
    4327             :         using Curve::GetCurveMinMaxValues;
    4328             :         using Curve::GetCurveName;
    4329             :         using DataHVACGlobals::CoilDX_CoolingSingleSpeed;
    4330             :         using DataHVACGlobals::CoilDX_HeatingEmpirical;
    4331             :         using DataHVACGlobals::CoilDX_MultiSpeedCooling;
    4332             :         using DataHVACGlobals::CoilDX_MultiSpeedHeating;
    4333             : 
    4334             :         // Locals
    4335             :         // SUBROUTINE ARGUMENT DEFINITIONS:
    4336             : 
    4337             :         // SUBROUTINE PARAMETER DEFINITIONS:
    4338             : 
    4339             :         static constexpr std::string_view RoutineName("CheckCurveLimitsForStandardRatings: "); // Include trailing blank space
    4340             : 
    4341             :         // INTERFACE BLOCK SPECIFICATIONS
    4342             :         // na
    4343             : 
    4344             :         // DERIVED TYPE DEFINITIONS
    4345             :         // na
    4346             : 
    4347             :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    4348             : 
    4349             :         //  Minimum and Maximum independent variable limits from Total Cooling Capacity Function of Temperature Curve
    4350         848 :         Real64 CapacityWBTempMin(0.0); // Capacity modifier Min value (wet bulb temperature), from the Curve:BiQuadratic object
    4351         848 :         Real64 CapacityWBTempMax(0.0); // Capacity modifier Max value (wet bulb temperature), from the Curve:BiQuadratic object
    4352         848 :         Real64 CapacityDBTempMin(0.0); // Capacity modifier Min value (dry bulb temperature), from the Curve:BiQuadratic object
    4353         848 :         Real64 CapacityDBTempMax(0.0); // Capacity modifier Max value (dry bulb temperature), from the Curve:BiQuadratic object
    4354             : 
    4355             :         //  Minimum and Maximum independent variable limits from Energy Input Ratio (EIR) Function of Temperature Curve
    4356         848 :         Real64 EIRWBTempMin(0.0); // EIR modifier Min value (wet bulb temperature), from the Curve:BiQuadratic object
    4357         848 :         Real64 EIRWBTempMax(0.0); // EIR modifier Max value (wet bulb temperature), from the Curve:BiQuadratic object
    4358         848 :         Real64 EIRDBTempMin(0.0); // EIR modifier Min value (dry bulb temperature), from the Curve:BiQuadratic object
    4359         848 :         Real64 EIRDBTempMax(0.0); // EIR modifier Max value (dry bulb temperature), from the Curve:BiQuadratic object
    4360             : 
    4361             :         //  Minimum and Maximum independent variable limits from Part Load Fraction Correlation Curve
    4362         848 :         Real64 PLFFPLRMin(0.0); // Maximum value for Part Load Ratio, from the corresponding curve object
    4363         848 :         Real64 PLFFPLRMax(0.0); // Minimum value for Part Load Ratio, from the corresponding curve object
    4364             : 
    4365             :         //  Minimum and Maximum independent variable limits from Total Cooling Capacity Function of Flow Fraction Curve
    4366         848 :         Real64 CapacityFlowRatioMin(0.0); // Minimum value for flow fraction, from the corresponding curve object
    4367         848 :         Real64 CapacityFlowRatioMax(0.0); // Maximum value for flow fraction, from the corresponding curve object
    4368             : 
    4369             :         //  Minimum and Maximum independent variable limits from Energy Input Ratio Function of Flow Fraction Curve
    4370         848 :         Real64 EIRFlowRatioMin(0.0); // Minimum value for flow fraction, from the corresponding curve object
    4371         848 :         Real64 EIRFlowRatioMax(0.0); // Maximum value for flow fraction, from the corresponding curve object
    4372             : 
    4373             :         //  Minimum and Maximum independent variable limits from Total Cooling Capacity Function of Temperature Curve
    4374         848 :         Real64 HeatingCapODBTempMin(0.0); // Capacity modifier Min value (outdoor dry bulb temperature)
    4375         848 :         Real64 HeatingCapODBTempMax(0.0); // Capacity modifier Max value (outdoor dry bulb temperature)
    4376         848 :         Real64 HeatingCapIDBTempMin(0.0); // Capacity modifier Min value (indoor dry bulb temperature)
    4377         848 :         Real64 HeatingCapIDBTempMax(0.0); // Capacity modifier Max value (indoor dry bulb temperature)
    4378             : 
    4379             :         //  Minimum and Maximum independent variable limits from Energy Input Ratio (EIR) Function of Temperature Curve
    4380         848 :         Real64 HeatingEIRODBTempMin(0.0); // EIR modifier Min value (outdoor dry bulb temperature)
    4381         848 :         Real64 HeatingEIRODBTempMax(0.0); // EIR modifier Max value (outdoor dry bulb temperature)
    4382         848 :         Real64 HeatingEIRIDBTempMin(0.0); // EIR modifier Min value (indoor dry bulb temperature)
    4383         848 :         Real64 HeatingEIRIDBTempMax(0.0); // EIR modifier Max value (indoor dry bulb temperature)
    4384             : 
    4385         848 :         bool CapCurveOATLimitsExceeded(false);     // Logical for capacity curve OD temp. limits being exceeded (low and High)
    4386         848 :         bool CapCurveHighOATLimitsExceeded(false); // Logical for capacity curve temperature limits being exceeded (high temp)
    4387         848 :         bool CapCurveFlowLimitsExceeded(false);    // Logical for capacity curve flow fraction limits being exceeded
    4388         848 :         bool EIRCurveHighOATLimitsExceeded(false); // Logical for EIR curve temperature limits being exceeded (high temp)
    4389         848 :         bool EIRCurveFlowLimitsExceeded(false);    // Logical for EIR curve flow fraction limits being exceeded
    4390             : 
    4391         848 :         bool CapCurveMidOATLimitsExceeded(false); // Logical for capacity curve temperature limits being exceeded (mid temp)
    4392         848 :         bool EIRCurveMidOATLimitsExceeded(false); // Logical for EIR curve temperature limits being exceeded (mid temp)
    4393         848 :         bool CapCurveLowOATLimitsExceeded(false); // Logical for capacity curve temperature limits being exceeded (low temp)
    4394         848 :         bool EIRCurveLowOATLimitsExceeded(false); // Logical for EIR curve temperature limits being exceeded (Low temp)
    4395         848 :         bool PLFfPLRforSEERLimitsExceeded(false); // Logical for PLF function of PLR limits being exceeded
    4396             : 
    4397         848 :         bool CapCurveIEERLimitsExceeded(false); // Logical for capacity curve temperature limits being exceeded (IEER calcs)
    4398         848 :         bool EIRCurveIEERLimitsExceeded(false); // Logical for EIR temperature limits being exceeded (IEER calcs)
    4399             : 
    4400         848 :         bool HeatingCapCurveHSPFLimitsExceeded(false); // Logical for capacity curve temperature limits being exceeded
    4401             :         // (HSPF calcs)
    4402         848 :         bool HeatingEIRCurveHSPFLimitsExceeded(false); // Logical for EIR curve temperature limits being exceeded
    4403             :         // (HSPF calcs)
    4404             : 
    4405         848 :         switch (DXCoilTypeNum) {
    4406             : 
    4407         604 :         case CoilDX_CoolingSingleSpeed: {
    4408         604 :             GetCurveMinMaxValues(state, CapFTempCurveIndex, CapacityWBTempMin, CapacityWBTempMax, CapacityDBTempMin, CapacityDBTempMax);
    4409         604 :             GetCurveMinMaxValues(state, EIRFTempCurveIndex, EIRWBTempMin, EIRWBTempMax, EIRDBTempMin, EIRDBTempMax);
    4410         604 :             GetCurveMinMaxValues(state, CapFFlowCurveIndex, CapacityFlowRatioMin, CapacityFlowRatioMax);
    4411         604 :             GetCurveMinMaxValues(state, EIRFFlowCurveIndex, EIRFlowRatioMin, EIRFlowRatioMax);
    4412         604 :             GetCurveMinMaxValues(state, PLFFPLRCurveIndex, PLFFPLRMin, PLFFPLRMax);
    4413             : 
    4414             :             // Checking the limits of capacity modifying curve for temperatures
    4415        1208 :             if (CapacityDBTempMax < OutdoorCoilInletAirDryBulbTempRated || CapacityDBTempMin > OutdoorCoilInletAirDryBulbTempRated ||
    4416        1208 :                 CapacityWBTempMax < CoolingCoilInletAirWetBulbTempRated || CapacityWBTempMin > CoolingCoilInletAirWetBulbTempRated) {
    4417           0 :                 CapCurveHighOATLimitsExceeded = true;
    4418             :             }
    4419             :             // Checking the limits of capacity modifying curve for flow fraction
    4420         604 :             if (CapacityFlowRatioMax < AirMassFlowRatioRated || CapacityFlowRatioMin > AirMassFlowRatioRated) {
    4421           0 :                 CapCurveFlowLimitsExceeded = true;
    4422             :             }
    4423             :             // Checking the limits of EIR modifying curve for temperatures
    4424        1208 :             if (EIRDBTempMax < OutdoorCoilInletAirDryBulbTempRated || EIRDBTempMin > OutdoorCoilInletAirDryBulbTempRated ||
    4425        1208 :                 EIRWBTempMax < CoolingCoilInletAirWetBulbTempRated || EIRWBTempMin > CoolingCoilInletAirWetBulbTempRated) {
    4426           0 :                 EIRCurveHighOATLimitsExceeded = true;
    4427             :             }
    4428             :             // Checking the limits of EIR modifying curve for flow fraction
    4429         604 :             if (EIRFlowRatioMax < AirMassFlowRatioRated || EIRFlowRatioMin > AirMassFlowRatioRated) {
    4430           0 :                 EIRCurveFlowLimitsExceeded = true;
    4431             :             }
    4432             :             // Checking the limits of capacity modifying curve for temperatures (SEER calculation)
    4433        1208 :             if (CapacityDBTempMax < OutdoorCoilInletAirDryBulbTempTestB2 || CapacityDBTempMin > OutdoorCoilInletAirDryBulbTempTestB2 ||
    4434        1208 :                 CapacityWBTempMax < CoolingCoilInletAirWetBulbTempRated || CapacityWBTempMin > CoolingCoilInletAirWetBulbTempRated) {
    4435           0 :                 CapCurveMidOATLimitsExceeded = true;
    4436             :             }
    4437             :             // Checking the limits of EIR modifying curve for temperatures (SEER calculation)
    4438        1208 :             if (EIRDBTempMax < OutdoorCoilInletAirDryBulbTempTestB2 || EIRDBTempMin > OutdoorCoilInletAirDryBulbTempTestB2 ||
    4439        1208 :                 EIRWBTempMax < CoolingCoilInletAirWetBulbTempRated || EIRWBTempMin > CoolingCoilInletAirWetBulbTempRated) {
    4440           0 :                 EIRCurveMidOATLimitsExceeded = true;
    4441             :             }
    4442             :             // Checking the limits of Part Load Fraction for PLR (SEER calculation)
    4443         604 :             if (PLFFPLRMax < PLRforSEER || PLFFPLRMin > PLRforSEER) {
    4444           0 :                 PLFfPLRforSEERLimitsExceeded = true;
    4445             :             }
    4446             :             // Checking the limits of capacity modifying curve for temperatures (IEER high and low test conditions)
    4447        1135 :             if (CapacityDBTempMax < OutdoorCoilInletAirDryBulbTempRated || CapacityDBTempMin > OADBTempLowReducedCapacityTest ||
    4448        1062 :                 CapacityWBTempMax < CoolingCoilInletAirWetBulbTempRated || CapacityWBTempMin > CoolingCoilInletAirWetBulbTempRated) {
    4449          73 :                 CapCurveIEERLimitsExceeded = true;
    4450             :             }
    4451             :             // Checking the limits of EIR modifying curve for temperatures (IEER high and low test conditions)
    4452        1133 :             if (EIRDBTempMax < OutdoorCoilInletAirDryBulbTempRated || EIRDBTempMin > OADBTempLowReducedCapacityTest ||
    4453        1058 :                 EIRWBTempMax < CoolingCoilInletAirWetBulbTempRated || EIRWBTempMin > CoolingCoilInletAirWetBulbTempRated) {
    4454          75 :                 EIRCurveIEERLimitsExceeded = true;
    4455             :             }
    4456             : 
    4457         604 :             if (CapCurveHighOATLimitsExceeded || CapCurveFlowLimitsExceeded || EIRCurveHighOATLimitsExceeded || EIRCurveFlowLimitsExceeded ||
    4458         604 :                 CapCurveMidOATLimitsExceeded || EIRCurveMidOATLimitsExceeded || PLFfPLRforSEERLimitsExceeded || CapCurveIEERLimitsExceeded ||
    4459             :                 EIRCurveIEERLimitsExceeded) {
    4460             : 
    4461         225 :                 ShowWarningError(state,
    4462         150 :                                  "The Standard Ratings is calculated for " + DXCoilType + " = " + DXCoilName +
    4463             :                                      " but not at the AHRI test condition due to curve out of bound.");
    4464          75 :                 ShowContinueError(state,
    4465             :                                   " Review the Standard Ratings calculations in the Engineering Reference for this coil type. Also, use "
    4466             :                                   "Output:Diagnostics, DisplayExtraWarnings for further guidance.");
    4467             : 
    4468          75 :                 if (state.dataGlobal->DisplayExtraWarnings) {
    4469           0 :                     ShowContinueError(state, std::string{RoutineName} + "The max and/or min limits specified in the corresponding curve objects");
    4470           0 :                     ShowContinueError(state,
    4471             :                                       " do not include the AHRI test conditions required to calculate one or more of the Standard Rating values.");
    4472             :                 }
    4473             : 
    4474             :                 // For Standard Rating Cooling Capacity:
    4475          75 :                 if (CapCurveHighOATLimitsExceeded || CapCurveFlowLimitsExceeded) {
    4476           0 :                     if (state.dataGlobal->DisplayExtraWarnings) {
    4477           0 :                         ShowContinueError(state,
    4478           0 :                                           DXCoilType + '=' + DXCoilName +
    4479             :                                               ":  Standard Rating Cooling Capacity calculated is not at the AHRI test condition.");
    4480           0 :                         if (CapCurveHighOATLimitsExceeded) {
    4481           0 :                             ShowContinueError(
    4482             :                                 state,
    4483           0 :                                 format(" Check limits in Total Cooling Capacity Function of Temperature Curve, Curve Type = {}, Curve Name = {}",
    4484           0 :                                        Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(CapFTempCurveIndex).curveType)],
    4485           0 :                                        GetCurveName(state, CapFTempCurveIndex)));
    4486             :                         }
    4487           0 :                         if (CapCurveFlowLimitsExceeded) {
    4488           0 :                             ShowContinueError(
    4489             :                                 state,
    4490           0 :                                 format(" Check limits in Total Cooling Capacity Function of Flow Fraction Curve, Curve Type = {}, Curve Name = {}",
    4491           0 :                                        Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(CapFFlowCurveIndex).curveType)],
    4492           0 :                                        GetCurveName(state, CapFFlowCurveIndex)));
    4493             :                         }
    4494             :                     }
    4495             :                 }
    4496             : 
    4497             :                 // For EER:
    4498          75 :                 if (CapCurveHighOATLimitsExceeded || CapCurveFlowLimitsExceeded || EIRCurveHighOATLimitsExceeded || EIRCurveFlowLimitsExceeded) {
    4499           0 :                     if (state.dataGlobal->DisplayExtraWarnings) {
    4500           0 :                         ShowContinueError(
    4501           0 :                             state, DXCoilType + '=' + DXCoilName + ":  Energy Efficiency Ratio (EER) calculated is not at the AHRI test condition.");
    4502           0 :                         if (CapCurveHighOATLimitsExceeded) {
    4503           0 :                             ShowContinueError(
    4504             :                                 state,
    4505           0 :                                 format(" Check limits in Total Cooling Capacity Function of Temperature Curve, Curve Type = {}, Curve Name = {}",
    4506           0 :                                        Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(CapFTempCurveIndex).curveType)],
    4507           0 :                                        GetCurveName(state, CapFTempCurveIndex)));
    4508             :                         }
    4509           0 :                         if (CapCurveFlowLimitsExceeded) {
    4510           0 :                             ShowContinueError(
    4511             :                                 state,
    4512           0 :                                 format(" Check limits in Total Cooling Capacity Function of Flow Fraction Curve, Curve Type = {}, Curve Name = {}",
    4513           0 :                                        Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(CapFFlowCurveIndex).curveType)],
    4514           0 :                                        GetCurveName(state, CapFFlowCurveIndex)));
    4515             :                         }
    4516           0 :                         if (EIRCurveHighOATLimitsExceeded) {
    4517           0 :                             ShowContinueError(
    4518             :                                 state,
    4519           0 :                                 format(" Check limits in Energy Input Ratio Function of Temperature Curve, Curve Type = {}, Curve Name = {}",
    4520           0 :                                        Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(EIRFTempCurveIndex).curveType)],
    4521           0 :                                        GetCurveName(state, EIRFTempCurveIndex)));
    4522             :                         }
    4523           0 :                         if (EIRCurveFlowLimitsExceeded) {
    4524           0 :                             ShowContinueError(
    4525             :                                 state,
    4526           0 :                                 format(" Check limits in Energy Input Ratio Function of Flow Fraction Curve, Curve Type = {}, Curve Name = {}",
    4527           0 :                                        Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(EIRFFlowCurveIndex).curveType)],
    4528           0 :                                        GetCurveName(state, EIRFFlowCurveIndex)));
    4529             :                         }
    4530             :                     }
    4531             :                 }
    4532             : 
    4533             :                 // For SEER:
    4534          75 :                 if (CapCurveMidOATLimitsExceeded || EIRCurveMidOATLimitsExceeded || CapCurveFlowLimitsExceeded || EIRCurveFlowLimitsExceeded ||
    4535             :                     PLFfPLRforSEERLimitsExceeded) {
    4536           0 :                     if (state.dataGlobal->DisplayExtraWarnings) {
    4537           0 :                         ShowContinueError(state,
    4538           0 :                                           DXCoilType + '=' + DXCoilName +
    4539             :                                               ":  Seasonal Energy Efficiency Ratio (SEER) calculated is not at the AHRI test condition.");
    4540           0 :                         if (CapCurveMidOATLimitsExceeded) {
    4541           0 :                             ShowContinueError(
    4542             :                                 state,
    4543           0 :                                 format(" Check limits in Total Cooling Capacity Function of Temperature Curve, Curve Type = {}, Curve Name = {}",
    4544           0 :                                        Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(CapFTempCurveIndex).curveType)],
    4545           0 :                                        GetCurveName(state, CapFTempCurveIndex)));
    4546             :                         }
    4547           0 :                         if (CapCurveFlowLimitsExceeded) {
    4548           0 :                             ShowContinueError(
    4549             :                                 state,
    4550           0 :                                 format(" Check limits in Total Cooling Capacity Function of Flow Fraction Curve, Curve Type = {}, Curve Name = {}",
    4551           0 :                                        Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(CapFFlowCurveIndex).curveType)],
    4552           0 :                                        GetCurveName(state, CapFFlowCurveIndex)));
    4553             :                         }
    4554           0 :                         if (EIRCurveMidOATLimitsExceeded) {
    4555           0 :                             ShowContinueError(
    4556             :                                 state,
    4557           0 :                                 format(" Check limits in Energy Input Ratio Function of Temperature Curve, Curve Type = {}, Curve Name = {}",
    4558           0 :                                        Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(EIRFTempCurveIndex).curveType)],
    4559           0 :                                        GetCurveName(state, EIRFTempCurveIndex)));
    4560             :                         }
    4561           0 :                         if (EIRCurveFlowLimitsExceeded) {
    4562           0 :                             ShowContinueError(
    4563             :                                 state,
    4564           0 :                                 format(" Check limits in Energy Input Ratio Function of Flow Fraction Curve, Curve Type = {}, Curve Name = {}",
    4565           0 :                                        Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(EIRFFlowCurveIndex).curveType)],
    4566           0 :                                        GetCurveName(state, EIRFFlowCurveIndex)));
    4567             :                         }
    4568           0 :                         if (PLFfPLRforSEERLimitsExceeded) {
    4569           0 :                             ShowContinueError(
    4570             :                                 state,
    4571           0 :                                 format(" Check limits in Part Load Fraction Correlation Curve, Curve Type = {}, Curve Name = {}",
    4572           0 :                                        Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(PLFFPLRCurveIndex).curveType)],
    4573           0 :                                        GetCurveName(state, PLFFPLRCurveIndex)));
    4574             :                         }
    4575             :                     }
    4576             :                 }
    4577             : 
    4578             :                 // For IEER:
    4579          75 :                 if (CapCurveIEERLimitsExceeded || CapCurveFlowLimitsExceeded || EIRCurveIEERLimitsExceeded || EIRCurveFlowLimitsExceeded) {
    4580          75 :                     if (state.dataGlobal->DisplayExtraWarnings) {
    4581           0 :                         ShowContinueError(state,
    4582           0 :                                           DXCoilType + '=' + DXCoilName +
    4583             :                                               ":  Integrated Energy Efficiency Ratio (IEER) calculated is not at the AHRI test condition.");
    4584           0 :                         if (CapCurveIEERLimitsExceeded) {
    4585           0 :                             ShowContinueError(
    4586             :                                 state,
    4587           0 :                                 format(" Check limits in Total Cooling Capacity Function of Temperature Curve, Curve Type = {}, Curve Name = {}",
    4588           0 :                                        Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(CapFTempCurveIndex).curveType)],
    4589           0 :                                        GetCurveName(state, CapFTempCurveIndex)));
    4590             :                         }
    4591           0 :                         if (CapCurveFlowLimitsExceeded) {
    4592           0 :                             ShowContinueError(
    4593             :                                 state,
    4594           0 :                                 format(" Check limits in Total Cooling Capacity Function of Flow Fraction Curve, Curve Type = {}, Curve Name = {}",
    4595           0 :                                        Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(CapFFlowCurveIndex).curveType)],
    4596           0 :                                        GetCurveName(state, CapFFlowCurveIndex)));
    4597             :                         }
    4598           0 :                         if (EIRCurveIEERLimitsExceeded) {
    4599           0 :                             ShowContinueError(
    4600             :                                 state,
    4601           0 :                                 format(" Check limits in EIR Function of Temperature Curve, Curve Type = {}, Curve Name = {}",
    4602           0 :                                        Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(EIRFTempCurveIndex).curveType)],
    4603           0 :                                        GetCurveName(state, EIRFTempCurveIndex)));
    4604             :                         }
    4605           0 :                         if (EIRCurveFlowLimitsExceeded) {
    4606           0 :                             ShowContinueError(
    4607             :                                 state,
    4608           0 :                                 format(" Check limits in Energy Input Ratio Function of Flow Fraction Curve, Curve Type = {}, Curve Name = {}",
    4609           0 :                                        Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(EIRFFlowCurveIndex).curveType)],
    4610           0 :                                        GetCurveName(state, EIRFFlowCurveIndex)));
    4611             :                         }
    4612             :                     }
    4613             :                 }
    4614             : 
    4615             :             } // End of curve error messages
    4616         604 :             break;
    4617             :         }
    4618          73 :         case CoilDX_HeatingEmpirical: {
    4619             :             {
    4620          73 :                 if (state.dataCurveManager->PerfCurve(CapFTempCurveIndex).numDims == 1) {
    4621          72 :                     GetCurveMinMaxValues(state, CapFTempCurveIndex, HeatingCapODBTempMin, HeatingCapODBTempMax);
    4622             : 
    4623             :                     // Checking the limits of capacity modifying curve for temperatures (IEER high and low test conditions)
    4624         144 :                     if (HeatingCapODBTempMax < HeatingOutdoorCoilInletAirDBTempRated ||
    4625          72 :                         HeatingCapODBTempMin > HeatingOutdoorCoilInletAirDBTempH3Test) {
    4626           0 :                         HeatingCapCurveHSPFLimitsExceeded = true;
    4627             :                     }
    4628             :                 } else {
    4629           1 :                     GetCurveMinMaxValues(
    4630             :                         state, CapFTempCurveIndex, HeatingCapIDBTempMin, HeatingCapIDBTempMax, HeatingCapODBTempMin, HeatingCapODBTempMax);
    4631             : 
    4632             :                     // Checking the limits of capacity modifying curve for temperatures (IEER high and low test conditions)
    4633           2 :                     if (HeatingCapODBTempMax < HeatingOutdoorCoilInletAirDBTempRated ||
    4634           2 :                         HeatingCapODBTempMin > HeatingOutdoorCoilInletAirDBTempH3Test ||
    4635           2 :                         HeatingCapIDBTempMax < HeatingIndoorCoilInletAirDBTempRated || HeatingCapIDBTempMin > HeatingIndoorCoilInletAirDBTempRated) {
    4636           0 :                         HeatingCapCurveHSPFLimitsExceeded = true;
    4637             :                     }
    4638             :                 }
    4639             :             }
    4640             :             {
    4641          73 :                 if (state.dataCurveManager->PerfCurve(EIRFTempCurveIndex).numDims == 1) {
    4642          72 :                     GetCurveMinMaxValues(state, EIRFTempCurveIndex, HeatingEIRODBTempMin, HeatingEIRODBTempMax);
    4643             : 
    4644             :                     // Checking the limits of EIR modifying curve for temperatures (HSPF high and low test conditions)
    4645         144 :                     if (HeatingEIRODBTempMax < HeatingOutdoorCoilInletAirDBTempRated ||
    4646          72 :                         HeatingEIRODBTempMin > HeatingOutdoorCoilInletAirDBTempH3Test) {
    4647           0 :                         HeatingEIRCurveHSPFLimitsExceeded = true;
    4648             :                     }
    4649             :                 } else {
    4650           1 :                     GetCurveMinMaxValues(
    4651             :                         state, EIRFTempCurveIndex, HeatingEIRIDBTempMin, HeatingEIRIDBTempMax, HeatingEIRODBTempMin, HeatingEIRODBTempMax);
    4652             : 
    4653             :                     // Checking the limits of EIR modifying curve for temperatures (HSPF high and low test conditions)
    4654           2 :                     if (HeatingEIRODBTempMax < HeatingOutdoorCoilInletAirDBTempRated ||
    4655           2 :                         HeatingEIRODBTempMin > HeatingOutdoorCoilInletAirDBTempH3Test ||
    4656           2 :                         HeatingEIRIDBTempMax < HeatingIndoorCoilInletAirDBTempRated || HeatingEIRIDBTempMin > HeatingIndoorCoilInletAirDBTempRated) {
    4657           0 :                         HeatingEIRCurveHSPFLimitsExceeded = true;
    4658             :                     }
    4659             :                 }
    4660             :             }
    4661          73 :             if (HeatingCapCurveHSPFLimitsExceeded || HeatingEIRCurveHSPFLimitsExceeded) {
    4662           0 :                 ShowWarningError(state,
    4663           0 :                                  "The Standard Ratings is calculated for " + DXCoilType + " = " + DXCoilName +
    4664             :                                      " but not at the AHRI test condition due to curve out of bound.");
    4665           0 :                 ShowContinueError(state,
    4666             :                                   " Review the Standard Ratings calculations in the Engineering Reference for this coil type. Also, use "
    4667             :                                   "Output:Diagnostics, DisplayExtraWarnings for further guidance.");
    4668           0 :                 if (state.dataGlobal->DisplayExtraWarnings) {
    4669           0 :                     ShowContinueError(state, std::string{RoutineName} + "The max and/or min limits specified in the corresponding curve objects");
    4670           0 :                     ShowContinueError(state,
    4671             :                                       " do not include the AHRI test conditions required to calculate one or more of the Standard Rating values.");
    4672             :                 }
    4673           0 :                 if (state.dataGlobal->DisplayExtraWarnings) {
    4674           0 :                     ShowWarningError(state,
    4675           0 :                                      DXCoilType + '=' + DXCoilName +
    4676             :                                          ":  Heating Seasonal Performance Factor calculated is not at the AHRI test condition.");
    4677           0 :                     ShowContinueError(state, " Review the Standard Ratings calculations in the Engineering Reference for this coil type.");
    4678           0 :                     if (HeatingCapCurveHSPFLimitsExceeded) {
    4679           0 :                         ShowContinueError(
    4680             :                             state,
    4681           0 :                             format(" Check limits in Total Heating Capacity Function of Temperature Curve, Curve Type = {}, Curve Name = {}",
    4682           0 :                                    Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(CapFTempCurveIndex).curveType)],
    4683           0 :                                    GetCurveName(state, CapFTempCurveIndex)));
    4684             :                     }
    4685           0 :                     if (HeatingEIRCurveHSPFLimitsExceeded) {
    4686           0 :                         ShowContinueError(
    4687             :                             state,
    4688           0 :                             format(" Check limits in EIR Function of Temperature Curve, Curve Type = {}, Curve Name = {}",
    4689           0 :                                    Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(EIRFTempCurveIndex).curveType)],
    4690           0 :                                    GetCurveName(state, EIRFTempCurveIndex)));
    4691             :                     }
    4692             :                 }
    4693             :             }
    4694             : 
    4695             :             //   MultiSpeed DX Coil Net Cooling Capacity and SEER:
    4696          73 :             break;
    4697             :         }
    4698         109 :         case CoilDX_MultiSpeedCooling: {
    4699         109 :             GetCurveMinMaxValues(state, CapFTempCurveIndex, CapacityWBTempMin, CapacityWBTempMax, CapacityDBTempMin, CapacityDBTempMax);
    4700         109 :             GetCurveMinMaxValues(state, EIRFTempCurveIndex, EIRWBTempMin, EIRWBTempMax, EIRDBTempMin, EIRDBTempMax);
    4701         109 :             GetCurveMinMaxValues(state, CapFFlowCurveIndex, CapacityFlowRatioMin, CapacityFlowRatioMax);
    4702         109 :             GetCurveMinMaxValues(state, EIRFFlowCurveIndex, EIRFlowRatioMin, EIRFlowRatioMax);
    4703             : 
    4704             :             // Checking the limits of capacity modifying curve for temperatures
    4705         218 :             if (CapacityDBTempMax < OutdoorCoilInletAirDryBulbTempRated || CapacityDBTempMin > OutdoorCoilInletAirDryBulbTempRated ||
    4706         218 :                 CapacityWBTempMax < CoolingCoilInletAirWetBulbTempRated || CapacityWBTempMin > CoolingCoilInletAirWetBulbTempRated) {
    4707           0 :                 CapCurveHighOATLimitsExceeded = true;
    4708             :             }
    4709             :             // Checking the limits of capacity modifying curve for flow fraction
    4710         109 :             if (CapacityFlowRatioMax < AirMassFlowRatioRated || CapacityFlowRatioMin > AirMassFlowRatioRated) {
    4711           0 :                 CapCurveFlowLimitsExceeded = true;
    4712             :             }
    4713             :             // Checking the limits of EIR modifying curve for temperatures
    4714         218 :             if (EIRDBTempMax < OutdoorCoilInletAirDryBulbTempRated || EIRDBTempMin > OutdoorCoilInletAirDryBulbTempRated ||
    4715         218 :                 EIRWBTempMax < CoolingCoilInletAirWetBulbTempRated || EIRWBTempMin > CoolingCoilInletAirWetBulbTempRated) {
    4716           0 :                 EIRCurveHighOATLimitsExceeded = true;
    4717             :             }
    4718             :             // Checking the limits of EIR modifying curve for flow fraction
    4719         109 :             if (EIRFlowRatioMax < AirMassFlowRatioRated || EIRFlowRatioMin > AirMassFlowRatioRated) {
    4720           0 :                 EIRCurveFlowLimitsExceeded = true;
    4721             :             }
    4722             :             // Checking the limits of capacity modifying curve for temperatures (SEER calculation)
    4723         130 :             if (CapacityDBTempMax < OutdoorCoilInletAirDryBulbTempTestF1 || CapacityDBTempMin > OutdoorCoilInletAirDryBulbTempTestF1 ||
    4724          42 :                 CapacityWBTempMax < CoolingCoilInletAirWetBulbTempRated || CapacityWBTempMin > CoolingCoilInletAirWetBulbTempRated) {
    4725          88 :                 CapCurveLowOATLimitsExceeded = true;
    4726             :             }
    4727             :             // Checking the limits of EIR modifying curve for temperatures (SEER calculation)
    4728         130 :             if (EIRDBTempMax < OutdoorCoilInletAirDryBulbTempTestF1 || EIRDBTempMin > OutdoorCoilInletAirDryBulbTempTestF1 ||
    4729          42 :                 EIRWBTempMax < CoolingCoilInletAirWetBulbTempRated || EIRWBTempMin > CoolingCoilInletAirWetBulbTempRated) {
    4730          88 :                 EIRCurveLowOATLimitsExceeded = true;
    4731             :             }
    4732             : 
    4733         109 :             if (CapCurveHighOATLimitsExceeded || CapCurveFlowLimitsExceeded || EIRCurveHighOATLimitsExceeded || EIRCurveFlowLimitsExceeded ||
    4734          21 :                 CapCurveLowOATLimitsExceeded || EIRCurveLowOATLimitsExceeded) {
    4735             : 
    4736         264 :                 ShowWarningError(state,
    4737         176 :                                  "The Standard Ratings is calculated for " + DXCoilType + " = " + DXCoilName +
    4738             :                                      " but not at the AHRI test condition due to curve out of bound.");
    4739          88 :                 ShowContinueError(state,
    4740             :                                   " Review the Standard Ratings calculations in the Engineering Reference for this coil type. Also, use "
    4741             :                                   "Output:Diagnostics, DisplayExtraWarnings for further guidance.");
    4742             : 
    4743          88 :                 if (state.dataGlobal->DisplayExtraWarnings) {
    4744           0 :                     ShowContinueError(state, std::string{RoutineName} + "The max and/or min limits specified in the corresponding curve objects");
    4745           0 :                     ShowContinueError(state,
    4746             :                                       " do not include the AHRI test conditions required to calculate one or more of the Standard Rating values.");
    4747             :                 }
    4748             : 
    4749             :                 // For Standard Rating Cooling Capacity:
    4750          88 :                 if (CapCurveHighOATLimitsExceeded || CapCurveFlowLimitsExceeded) {
    4751           0 :                     if (state.dataGlobal->DisplayExtraWarnings) {
    4752           0 :                         ShowContinueError(state,
    4753           0 :                                           DXCoilType + '=' + DXCoilName +
    4754             :                                               ":  The Standard Rating Cooling Capacity calculated is not at the AHRI test condition.");
    4755           0 :                         if (CapCurveHighOATLimitsExceeded) {
    4756           0 :                             ShowContinueError(
    4757             :                                 state,
    4758           0 :                                 format(" Check limits in Total Cooling Capacity Function of Temperature Curve, Curve Type = {}, Curve Name = {}",
    4759           0 :                                        Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(CapFTempCurveIndex).curveType)],
    4760           0 :                                        GetCurveName(state, CapFTempCurveIndex)));
    4761             :                         }
    4762           0 :                         if (CapCurveFlowLimitsExceeded) {
    4763           0 :                             ShowContinueError(
    4764             :                                 state,
    4765           0 :                                 format(" Check limits in Total Cooling Capacity Function of Flow Fraction Curve, Curve Type = {}, Curve Name = {}",
    4766           0 :                                        Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(CapFFlowCurveIndex).curveType)],
    4767           0 :                                        GetCurveName(state, CapFFlowCurveIndex)));
    4768             :                         }
    4769             :                     }
    4770             :                 }
    4771             : 
    4772             :                 // For MultiSpeed DX Coil SEER:
    4773             : 
    4774          88 :                 if (CapCurveLowOATLimitsExceeded || EIRCurveLowOATLimitsExceeded || CapCurveFlowLimitsExceeded || EIRCurveFlowLimitsExceeded) {
    4775          88 :                     if (state.dataGlobal->DisplayExtraWarnings) {
    4776           0 :                         ShowContinueError(state,
    4777           0 :                                           DXCoilType + '=' + DXCoilName +
    4778             :                                               ":  The Seasonal Energy Efficiency Ratio (SEER) calculated is not at the AHRI test condition.");
    4779           0 :                         if (CapCurveLowOATLimitsExceeded) {
    4780           0 :                             ShowContinueError(
    4781             :                                 state,
    4782           0 :                                 format(" Check limits in Total Cooling Capacity Function of Temperature Curve, Curve Type = {}, Curve Name = {}",
    4783           0 :                                        Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(CapFTempCurveIndex).curveType)],
    4784           0 :                                        GetCurveName(state, CapFTempCurveIndex)));
    4785             :                         }
    4786           0 :                         if (CapCurveFlowLimitsExceeded) {
    4787           0 :                             ShowContinueError(
    4788             :                                 state,
    4789           0 :                                 format(" Check limits in Total Cooling Capacity Function of Flow Fraction Curve, Curve Type = {}, Curve Name = {}",
    4790           0 :                                        Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(CapFFlowCurveIndex).curveType)],
    4791           0 :                                        GetCurveName(state, CapFFlowCurveIndex)));
    4792             :                         }
    4793           0 :                         if (EIRCurveLowOATLimitsExceeded) {
    4794           0 :                             ShowContinueError(
    4795             :                                 state,
    4796           0 :                                 format(" Check limits in Energy Input Ratio Function of Temperature Curve, Curve Type = {}, Curve Name = {}",
    4797           0 :                                        Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(EIRFTempCurveIndex).curveType)],
    4798           0 :                                        GetCurveName(state, EIRFTempCurveIndex)));
    4799             :                         }
    4800           0 :                         if (EIRCurveFlowLimitsExceeded) {
    4801           0 :                             ShowContinueError(
    4802             :                                 state,
    4803           0 :                                 format(" Check limits in Energy Input Ratio Function of Flow Fraction Curve, Curve Type = {}, Curve Name = {}",
    4804           0 :                                        Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(EIRFFlowCurveIndex).curveType)],
    4805           0 :                                        GetCurveName(state, EIRFFlowCurveIndex)));
    4806             :                         }
    4807             :                     }
    4808             :                 }
    4809             : 
    4810             :             } // End of curve error messages
    4811             : 
    4812         109 :             break;
    4813             :         }
    4814          62 :         case CoilDX_MultiSpeedHeating: {
    4815             : 
    4816             :             {
    4817          62 :                 if (state.dataCurveManager->PerfCurve(CapFTempCurveIndex).numDims == 1) {
    4818          44 :                     GetCurveMinMaxValues(state, CapFTempCurveIndex, HeatingCapODBTempMin, HeatingCapODBTempMax);
    4819             : 
    4820          88 :                     if (HeatingCapODBTempMax < HeatingOutdoorCoilInletAirDBTempRated ||
    4821          44 :                         HeatingCapODBTempMin > HeatingOutdoorCoilInletAirDBTempH3Test) {
    4822           0 :                         CapCurveOATLimitsExceeded = true;
    4823             :                     }
    4824             :                     // Checking the limits of capacity modifying curve for temperatures (HSPF high and low test conditions)
    4825          88 :                     if (HeatingCapODBTempMax < HeatingOutdoorCoilInletAirDBTempRated ||
    4826          88 :                         HeatingCapODBTempMin > HeatingOutdoorCoilInletAirDBTempH3Test ||
    4827          44 :                         HeatingCapODBTempMax < HeatingOutdoorCoilInletAirDBTempH0Test) {
    4828           0 :                         HeatingCapCurveHSPFLimitsExceeded = true;
    4829             :                     }
    4830             : 
    4831             :                 } else {
    4832          18 :                     GetCurveMinMaxValues(
    4833             :                         state, CapFTempCurveIndex, HeatingCapIDBTempMin, HeatingCapIDBTempMax, HeatingCapODBTempMin, HeatingCapODBTempMax);
    4834             : 
    4835             :                     // Checking the limits of capacity modifying curve for temperatures (HSPF high and low test conditions)
    4836          36 :                     if (HeatingCapODBTempMax < HeatingOutdoorCoilInletAirDBTempRated ||
    4837          36 :                         HeatingCapODBTempMin > HeatingOutdoorCoilInletAirDBTempH3Test ||
    4838          54 :                         HeatingCapIDBTempMax < HeatingIndoorCoilInletAirDBTempRated || HeatingCapIDBTempMin > HeatingIndoorCoilInletAirDBTempRated ||
    4839          18 :                         HeatingCapODBTempMax < HeatingOutdoorCoilInletAirDBTempH0Test) {
    4840           0 :                         HeatingCapCurveHSPFLimitsExceeded = true;
    4841             :                     }
    4842             :                 }
    4843             :             }
    4844             : 
    4845             :             {
    4846          62 :                 if (state.dataCurveManager->PerfCurve(EIRFTempCurveIndex).numDims == 1) {
    4847          44 :                     GetCurveMinMaxValues(state, EIRFTempCurveIndex, HeatingEIRODBTempMin, HeatingEIRODBTempMax);
    4848             :                     // Checking the limits of EIR modifying curve for temperatures (HSPF high and low test conditions)
    4849          88 :                     if (HeatingEIRODBTempMax < HeatingOutdoorCoilInletAirDBTempRated ||
    4850          88 :                         HeatingEIRODBTempMin > HeatingOutdoorCoilInletAirDBTempH3Test ||
    4851          44 :                         HeatingCapODBTempMax < HeatingOutdoorCoilInletAirDBTempH0Test) {
    4852           0 :                         HeatingEIRCurveHSPFLimitsExceeded = true;
    4853             :                     }
    4854             :                 } else {
    4855          18 :                     GetCurveMinMaxValues(
    4856             :                         state, EIRFTempCurveIndex, HeatingEIRIDBTempMin, HeatingEIRIDBTempMax, HeatingEIRODBTempMin, HeatingEIRODBTempMax);
    4857             : 
    4858             :                     // Checking the limits of EIR modifying curve for temperatures (HSPF high and low test conditions)
    4859          36 :                     if (HeatingEIRODBTempMax < HeatingOutdoorCoilInletAirDBTempRated ||
    4860          36 :                         HeatingEIRODBTempMin > HeatingOutdoorCoilInletAirDBTempH3Test ||
    4861          54 :                         HeatingEIRIDBTempMax < HeatingIndoorCoilInletAirDBTempRated || HeatingEIRIDBTempMin > HeatingIndoorCoilInletAirDBTempRated ||
    4862          18 :                         HeatingCapODBTempMax < HeatingOutdoorCoilInletAirDBTempH0Test) {
    4863           0 :                         HeatingEIRCurveHSPFLimitsExceeded = true;
    4864             :                     }
    4865             :                 }
    4866             :             }
    4867          62 :             if (HeatingCapCurveHSPFLimitsExceeded || HeatingEIRCurveHSPFLimitsExceeded || CapCurveOATLimitsExceeded) {
    4868             : 
    4869           0 :                 ShowWarningError(state,
    4870           0 :                                  "The Standard Ratings is calculated for " + DXCoilType + " = " + DXCoilName +
    4871             :                                      " but not at the AHRI test condition due to curve out of bound.");
    4872           0 :                 ShowContinueError(state,
    4873             :                                   " Review the Standard Ratings calculations in the Engineering Reference for this coil type. Also, use "
    4874             :                                   "Output:Diagnostics, DisplayExtraWarnings for further guidance.");
    4875             : 
    4876           0 :                 if (state.dataGlobal->DisplayExtraWarnings) {
    4877           0 :                     ShowContinueError(state, std::string{RoutineName} + "The max and/or min limits specified in the corresponding curve objects");
    4878           0 :                     ShowContinueError(state,
    4879             :                                       " do not include the AHRI test conditions required to calculate one or more of the Standard Rating values.");
    4880             :                 }
    4881             :             }
    4882          62 :             if (CapCurveOATLimitsExceeded) {
    4883           0 :                 if (state.dataGlobal->DisplayExtraWarnings) {
    4884           0 :                     ShowWarningError(state,
    4885           0 :                                      DXCoilType + '=' + DXCoilName + ":  The Net Heating Capacity Calculated is not at the AHRI test condition.");
    4886           0 :                     ShowContinueError(
    4887             :                         state,
    4888           0 :                         format(" Check limits in Total Heating Capacity Function of Temperature Curve, Curve Type = {}, Curve Name = {}",
    4889           0 :                                Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(CapFTempCurveIndex).curveType)],
    4890           0 :                                GetCurveName(state, CapFTempCurveIndex)));
    4891             :                 }
    4892             :             }
    4893             : 
    4894          62 :             if (HeatingCapCurveHSPFLimitsExceeded || HeatingEIRCurveHSPFLimitsExceeded) {
    4895           0 :                 if (state.dataGlobal->DisplayExtraWarnings) {
    4896           0 :                     ShowWarningError(state,
    4897           0 :                                      DXCoilType + '=' + DXCoilName +
    4898             :                                          ":  The Heating Seasonal Performance Factor calculated is not at the AHRI test condition.");
    4899           0 :                     if (HeatingCapCurveHSPFLimitsExceeded) {
    4900           0 :                         ShowContinueError(
    4901             :                             state,
    4902           0 :                             format(" Check limits in Total Heating Capacity Function of Temperature Curve, Curve Type = {}, Curve Name = {}",
    4903           0 :                                    Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(CapFTempCurveIndex).curveType)],
    4904           0 :                                    GetCurveName(state, CapFTempCurveIndex)));
    4905             :                     }
    4906           0 :                     if (HeatingEIRCurveHSPFLimitsExceeded) {
    4907           0 :                         ShowContinueError(
    4908             :                             state,
    4909           0 :                             format(" Check limits in EIR Function of Temperature Curve, Curve Type = {}, Curve Name = {}",
    4910           0 :                                    Curve::objectNames[static_cast<int>(state.dataCurveManager->PerfCurve(EIRFTempCurveIndex).curveType)],
    4911           0 :                                    GetCurveName(state, EIRFTempCurveIndex)));
    4912             :                     }
    4913             :                 }
    4914             :             }
    4915          62 :             break;
    4916             :         }
    4917           0 :         default:
    4918           0 :             break;
    4919             :         }
    4920         848 :     }
    4921             : 
    4922             : } // namespace StandardRatings
    4923             : 
    4924        2313 : } // namespace EnergyPlus

Generated by: LCOV version 1.13